]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/item/label.qc
Merge branch 'master' into martin-t/dmgtext
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / item / label.qc
index 6d9b9cda1f4953bd7bebf68d44a8f22286a25923..f7a782dabbf877a3b0bcef5adee11db333d8edc0 100644 (file)
@@ -1,40 +1,5 @@
-#ifndef ITEM_LABEL_H
-       #define ITEM_LABEL_H
-       #include "../item.qc"
-       CLASS(Label, Item)
-               METHOD(Label, configureLabel, void(entity, string, float, float));
-               METHOD(Label, draw, void(entity));
-               METHOD(Label, resizeNotify, void(entity, vector, vector, vector, vector));
-               METHOD(Label, setText, void(entity, string));
-               METHOD(Label, toString, string(entity));
-               METHOD(Label, recalcPositionWithText, void(entity, string));
-               ATTRIB(Label, isBold, float, 0)
-               ATTRIB(Label, text, string, string_null)
-               ATTRIB(Label, currentText, string, string_null)
-               ATTRIB(Label, fontSize, float, 8)
-               ATTRIB(Label, align, float, 0.5)
-               ATTRIB(Label, allowCut, float, 0)
-               ATTRIB(Label, allowColors, float, 0)
-               ATTRIB(Label, keepspaceLeft, float, 0) // for use by subclasses (radiobuttons for example)
-               ATTRIB(Label, keepspaceRight, float, 0)
-               ATTRIB(Label, marginLeft, float, 0)    // alternate way to specify keepspace* (in characters from the font)
-               ATTRIB(Label, marginRight, float, 0)
-               ATTRIB(Label, realFontSize, vector, '0 0 0')
-               ATTRIB(Label, realOrigin, vector, '0 0 0')
-               ATTRIB(Label, alpha, float, 0.7)
-               ATTRIB(Label, colorL, vector, SKINCOLOR_TEXT)
-               ATTRIB(Label, disabled, float, 0)
-               ATTRIB(Label, disabledAlpha, float, 0.3)
-               ATTRIB(Label, textEntity, entity, NULL)
-               ATTRIB(Label, allowWrap, float, 0)
-               ATTRIB(Label, recalcPos, float, 0)
-               ATTRIB(Label, condenseFactor, float, 1)
-               ATTRIB(Label, overrideRealOrigin, vector, '0 0 0')
-               ATTRIB(Label, overrideCondenseFactor, float, 0)
-       ENDCLASS(Label)
-#endif
-
-#ifdef IMPLEMENTATION
+#include "label.qh"
+
        string Label_toString(entity me)
        {
                return me.text;
@@ -44,8 +9,7 @@
                me.text = txt;
                if (txt != me.currentText)
                {
-                       if (me.currentText) strunzone(me.currentText);
-                       me.currentText = strzone(txt);
+                       strcpy(me.currentText, txt);
                        me.recalcPos = 1;
                }
        }
@@ -73,7 +37,7 @@
                {
                        if (!me.overrideRealOrigin_x) me.realOrigin_x = me.keepspaceLeft;
                        if (!me.overrideCondenseFactor) me.condenseFactor = spaceAvail / spaceUsed;
-                       LOG_TRACEF("NOTE: label text %s too wide for label, condensed by factor %f\n", t, me.condenseFactor);
+                       LOG_TRACEF("NOTE: label text %s too wide for label, condensed by factor %f", t, me.condenseFactor);
                }
 
                if (!me.overrideRealOrigin_y)
                        t = me.textEntity.toString(me.textEntity);
                        if (t != me.currentText)
                        {
-                               if (me.currentText) strunzone(me.currentText);
-                               me.currentText = strzone(t);
+                               strcpy(me.currentText, t);
                                me.recalcPos = 1;
                        }
                }
 
                SUPER(Label).draw(me);
        }
-#endif