]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Improve formatting consistency
authorotta8634 <k9wolf@pm.me>
Mon, 16 Dec 2024 09:30:16 +0000 (17:30 +0800)
committerotta8634 <k9wolf@pm.me>
Mon, 16 Dec 2024 09:30:16 +0000 (17:30 +0800)
Changed spaces to tabs in menu files.
Moved menu/xonotic/guide/tab.qc and .qh to menu/xonotic/dialog_multiplayer_guide.qc and .qh to make it more consistent with every other dialog.
Added empty .qc files for .qh files which were missing one.
Slightly improved some code formatting.

18 files changed:
qcsrc/menu/xonotic/_mod.inc
qcsrc/menu/xonotic/_mod.qh
qcsrc/menu/xonotic/dialog_multiplayer_media.qc
qcsrc/menu/xonotic/dialog_multiplayer_media_guide.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_media_guide.qh [new file with mode: 0644]
qcsrc/menu/xonotic/guide/_mod.inc
qcsrc/menu/xonotic/guide/_mod.qh
qcsrc/menu/xonotic/guide/description.qh
qcsrc/menu/xonotic/guide/entries.qc
qcsrc/menu/xonotic/guide/entries.qh
qcsrc/menu/xonotic/guide/guide.qc [new file with mode: 0644]
qcsrc/menu/xonotic/guide/guide.qh [new file with mode: 0644]
qcsrc/menu/xonotic/guide/pages.qc [new file with mode: 0644]
qcsrc/menu/xonotic/guide/pages.qh
qcsrc/menu/xonotic/guide/tab.qc [deleted file]
qcsrc/menu/xonotic/guide/tab.qh [deleted file]
qcsrc/menu/xonotic/guide/topics.qc
qcsrc/menu/xonotic/guide/topics.qh

index 72e1ddd53dee09dde6941dbab9749de7a5ae8dcf..7249d3de4d8653897977e7e9412f8fab4a6c46f4 100644 (file)
@@ -56,6 +56,7 @@
 #include <menu/xonotic/dialog_multiplayer_media_demo.qc>
 #include <menu/xonotic/dialog_multiplayer_media_demo_startconfirm.qc>
 #include <menu/xonotic/dialog_multiplayer_media_demo_timeconfirm.qc>
+#include <menu/xonotic/dialog_multiplayer_media_guide.qc>
 #include <menu/xonotic/dialog_multiplayer_media_musicplayer.qc>
 #include <menu/xonotic/dialog_multiplayer_media_screenshot.qc>
 #include <menu/xonotic/dialog_multiplayer_media_screenshot_viewer.qc>
index 3ae9a58209f34eaaecdc0952a5fc2e758224e9a9..b8d1e5ca5695c6731473928de3fe97c948294b8e 100644 (file)
@@ -56,6 +56,7 @@
 #include <menu/xonotic/dialog_multiplayer_media_demo.qh>
 #include <menu/xonotic/dialog_multiplayer_media_demo_startconfirm.qh>
 #include <menu/xonotic/dialog_multiplayer_media_demo_timeconfirm.qh>
+#include <menu/xonotic/dialog_multiplayer_media_guide.qh>
 #include <menu/xonotic/dialog_multiplayer_media_musicplayer.qh>
 #include <menu/xonotic/dialog_multiplayer_media_screenshot.qh>
 #include <menu/xonotic/dialog_multiplayer_media_screenshot_viewer.qh>
index f337221fc586ea85ff391396d5a8cf708633fe5f..3203e3ec5916f8e81aa60cbc94b53b7ba7961c36 100644 (file)
@@ -1,14 +1,13 @@
 #include "dialog_multiplayer_media.qh"
 
 #include "demolist.qh"
+#include "dialog_multiplayer_media_guide.qh"
 #include "dialog_multiplayer_media_demo.qh"
 #include "dialog_multiplayer_media_screenshot.qh"
 #include "dialog_multiplayer_media_musicplayer.qh"
 #include "dialog_multiplayer_media_demo_timeconfirm.qh"
 #include "dialog_multiplayer_media_demo_startconfirm.qh"
 
-#include <menu/xonotic/guide/tab.qh>
-
 #include "tabcontroller.qh"
 
 entity makeXonoticMediaTab()
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_guide.qc b/qcsrc/menu/xonotic/dialog_multiplayer_media_guide.qc
new file mode 100644 (file)
index 0000000..4ff36c5
--- /dev/null
@@ -0,0 +1,70 @@
+#include "dialog_multiplayer_media_guide.qh"
+
+#include "inputbox.qh"
+#include "maplist.qh"
+#include "textlabel.qh"
+
+void XonoticGuideTab_fill(entity this)
+{
+       entity topics = this.topicList;
+               topics.onChange = XonoticGuideTab_topicChangeNotify;
+               topics.onChangeEntity = this;
+       entity entries = this.entryList;
+               entries.onChange = XonoticGuideTab_entryChangeNotify;
+               entries.onChangeEntity = this;
+       entity filter = entries.stringFilterBox = makeXonoticInputBox(false, string_null);
+               filter.keyDown = MapList_StringFilterBox_keyDown;
+               filter.onChange = MapList_StringFilterBox_Change;
+               filter.onChangeEntity = entries;
+       entries.controlledTextbox = filter;
+       entity description = this.descriptionPane;
+
+       int
+       col = 0, width = 1.5;
+       this.gotoRC(this, 0, col);
+               this.TD(this, 1, width, makeXonoticHeaderLabel(_("Topic")));
+       this.TR(this);
+               this.TD(this, this.rows - 1, width, topics);
+
+       col += width, width = 2;
+       this.gotoRC(this, 0, col); this.setFirstColumn(this, this.currentColumn);
+               this.TD(this, 1, width, makeXonoticHeaderLabel(_("Entry")));
+       this.TR(this);
+               this.TD(this, this.rows - 1 - 1, width, entries);
+       this.gotoRC(this, this.rows - 1, col);
+               this.TD(this, 1, 0.3, makeXonoticTextLabel(0, _("Filter:")));
+               this.TD(this, 1, width - 0.3, filter);
+
+       col += width, width = 2.5;
+       this.gotoRC(this, 0, col); this.setFirstColumn(this, this.currentColumn);
+               this.TD(this, 1, width, makeXonoticHeaderLabel(_("Description")));
+       this.TR(this);
+               this.TD(this, this.rows - 1, width, description);
+
+       this.topicChangeNotify(topics, this);
+}
+
+void XonoticGuideTab_topicChangeNotify(entity, entity this)
+{
+       entity topics = this.topicList;
+       entity entries = this.entryList;
+       int i = topics.selectedItem;
+       int idx = 0;
+       entity found = NULL;
+       #define TOPIC(src, name, icon) if (idx++ == i) { static entity e; if (!e) e = src; found = e; break; }
+       do { TOPICS(TOPIC); } while (0);
+       #undef TOPIC
+       entries.source = found;
+       entries.refilter(entries);
+       entries.setSelected(entries, 0);
+}
+
+void XonoticGuideTab_entryChangeNotify(entity, entity this)
+{
+       entity desc = this.descriptionPane;
+       entity entries = this.entryList;
+       entity e = entries.source.getEntry(entries.source, entries.selectedItem, func_null);
+       string s = e.describe(e);
+       if (cvar("developer")) { s = sprintf("entity %i\n%s", e, s); }
+       desc.setDescription(desc, s);
+}
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_guide.qh b/qcsrc/menu/xonotic/dialog_multiplayer_media_guide.qh
new file mode 100644 (file)
index 0000000..e630e5c
--- /dev/null
@@ -0,0 +1,22 @@
+#pragma once
+
+#include <menu/xonotic/guide/_mod.qh>
+
+#include "tab.qh"
+CLASS(XonoticGuideTab, XonoticTab)
+       ATTRIB(XonoticGuideTab, rows, float, 21);
+       ATTRIB(XonoticGuideTab, columns, float, 6);
+       ATTRIB(XonoticGuideTab, intendedWidth, float, 1);
+       METHOD(XonoticGuideTab, fill, void(entity));
+       METHOD(XonoticGuideTab, topicChangeNotify, void(entity, entity));
+       METHOD(XonoticGuideTab, entryChangeNotify, void(entity, entity));
+
+       ATTRIB(XonoticGuideTab, controlledTextbox, entity);
+       ATTRIB(XonoticGuideTab, topicList, entity, NEW(XonoticTopicList, NEW(TopicSource)));
+       ATTRIB(XonoticGuideTab, entryList, entity, NEW(XonoticEntryList, NULL));
+       ATTRIB(XonoticGuideTab, descriptionPane, entity, NEW(XonoticGuideDescription));
+
+       INIT(XonoticGuideTab) {
+               this.configureDialog(this);
+       }
+ENDCLASS(XonoticGuideTab)
index de777f7c083438db877a8f0835613346b28f7b35..0718ae13d054f73488a1b78faa954c99bb3d577f 100644 (file)
@@ -1,5 +1,6 @@
 // genmod.sh autogenerated file; do not modify
 #include <menu/xonotic/guide/description.qc>
 #include <menu/xonotic/guide/entries.qc>
-#include <menu/xonotic/guide/tab.qc>
+#include <menu/xonotic/guide/guide.qc>
+#include <menu/xonotic/guide/pages.qc>
 #include <menu/xonotic/guide/topics.qc>
index 80d076c5a2ce1a453ab289bc8b689ac8653600e0..36e507275a561c1259df1e2334ccd34c177e2a6e 100644 (file)
@@ -1,5 +1,6 @@
 // genmod.sh autogenerated file; do not modify
 #include <menu/xonotic/guide/description.qh>
 #include <menu/xonotic/guide/entries.qh>
-#include <menu/xonotic/guide/tab.qh>
+#include <menu/xonotic/guide/guide.qh>
+#include <menu/xonotic/guide/pages.qh>
 #include <menu/xonotic/guide/topics.qh>
index 19f59ec1868fad6d2e23713951bdf50e7f14c4e1..a4c2033839bda5e7535dc0effd945a00a18732f4 100644 (file)
@@ -2,52 +2,52 @@
 
 #include <menu/xonotic/listbox.qh>
 CLASS(XonoticGuideDescription, XonoticListBox)
-    ATTRIB(XonoticGuideDescription, realFontSize, vector, '0 0 0');
-    ATTRIB(XonoticGuideDescription, realUpperMargin, float, 0);
+       ATTRIB(XonoticGuideDescription, realFontSize, vector, '0 0 0');
+       ATTRIB(XonoticGuideDescription, realUpperMargin, float, 0);
        ATTRIB(XonoticGuideDescription, rowsPerItem, float, 1);
        ATTRIB(XonoticGuideDescription, selectionDoesntMatter, bool, true);
 
-    METHOD(XonoticGuideDescription, setDescription, void(entity, string));
-    ATTRIB(XonoticGuideDescription, description, string, string_null);
+       METHOD(XonoticGuideDescription, setDescription, void(entity, string));
+       ATTRIB(XonoticGuideDescription, description, string, string_null);
 
        METHOD(XonoticGuideDescription, resizeNotify, void(entity this, vector relOrigin, vector relSize, vector absOrigin, vector absSize)) {
-        SUPER(XonoticGuideDescription).resizeNotify(this, relOrigin, relSize, absOrigin, absSize);
-
-        this.realFontSize_y = this.fontSize / (absSize.y * this.itemHeight);
-        this.realFontSize_x = this.fontSize / (absSize.x * (1 - this.controlWidth));
-        this.realUpperMargin = 0.5 * (1 - this.realFontSize.y);
-        this.setDescription(this, this.description);
-    }
-
-    INIT(XonoticGuideDescription) {
-        this.configureXonoticListBox(this);
-    }
-
-    ATTRIB(XonoticGuideDescription, descriptionWrapped, string, string_null);
-    void XonoticGuideDescription_setDescription(entity this, string desc)
-    {
-        string current = this.description;
-        if (current && current != desc) strunzone(current);
-        this.description = strzone(desc);
-
-        string currentWrapped = this.descriptionWrapped;
-        if (currentWrapped) strunzone(currentWrapped);
-        string wrapped = "";
-        for (int i = 0, n = tokenizebyseparator(desc, "\n"); i < n; ++i) {
-            string line = "";
-            for (getWrappedLine_remaining = argv(i); getWrappedLine_remaining; ) {
-                string s = getWrappedLine(1, this.realFontSize, draw_TextWidth_WithColors);
-                line = sprintf("%s\n%s", line, s);
-            }
-            wrapped = strcat(wrapped, line);
-        }
-        this.descriptionWrapped = strzone(wrapped);
-
-        this.nItems = tokenizebyseparator(wrapped, "\n");
-    }
-
-    METHOD(XonoticGuideDescription, drawListBoxItem, void(entity this, int i, vector absSize, bool isSelected, bool isFocused)) {
-        tokenizebyseparator(this.descriptionWrapped, "\n");
-        draw_Text(this.realUpperMargin * eY, argv(i), this.realFontSize, '1 1 1', 1, 0);
-    }
+               SUPER(XonoticGuideDescription).resizeNotify(this, relOrigin, relSize, absOrigin, absSize);
+
+               this.realFontSize_y = this.fontSize / (absSize.y * this.itemHeight);
+               this.realFontSize_x = this.fontSize / (absSize.x * (1 - this.controlWidth));
+               this.realUpperMargin = 0.5 * (1 - this.realFontSize.y);
+               this.setDescription(this, this.description);
+       }
+
+       INIT(XonoticGuideDescription) {
+               this.configureXonoticListBox(this);
+       }
+
+       ATTRIB(XonoticGuideDescription, descriptionWrapped, string, string_null);
+       void XonoticGuideDescription_setDescription(entity this, string desc)
+       {
+               string current = this.description;
+               if (current && current != desc) strunzone(current);
+               this.description = strzone(desc);
+
+               string currentWrapped = this.descriptionWrapped;
+               if (currentWrapped) strunzone(currentWrapped);
+               string wrapped = "";
+               for (int i = 0, n = tokenizebyseparator(desc, "\n"); i < n; ++i) {
+                       string line = "";
+                       for (getWrappedLine_remaining = argv(i); getWrappedLine_remaining; ) {
+                               string s = getWrappedLine(1, this.realFontSize, draw_TextWidth_WithColors);
+                               line = sprintf("%s\n%s", line, s);
+                       }
+                       wrapped = strcat(wrapped, line);
+               }
+               this.descriptionWrapped = strzone(wrapped);
+
+               this.nItems = tokenizebyseparator(wrapped, "\n");
+       }
+
+       METHOD(XonoticGuideDescription, drawListBoxItem, void(entity this, int i, vector absSize, bool isSelected, bool isFocused)) {
+               tokenizebyseparator(this.descriptionWrapped, "\n");
+               draw_Text(this.realUpperMargin * eY, argv(i), this.realFontSize, '1 1 1', 1, 0);
+       }
 ENDCLASS(XonoticGuideDescription)
index 358e639d369c9d149a8e59b9dcf077e313832b4a..a5430314d9b72dc09bf422d9176cd09f3e17a084 100644 (file)
@@ -6,90 +6,90 @@
 
 string XonoticEntryList_cb_name, XonoticEntryList_cb_icon;
 void XonoticEntryList_cb(string _name, string _icon) {
-    XonoticEntryList_cb_name = _name;
-    XonoticEntryList_cb_icon = _icon;
+       XonoticEntryList_cb_name = _name;
+       XonoticEntryList_cb_icon = _icon;
 }
 
 void XonoticEntryList_drawListBoxItem(entity this, int i, vector absSize, bool isSelected, bool isFocused)
 {
-    if (!this.source) return;
-    if (!this.source.getEntry(this.source, i, XonoticEntryList_cb)) return;
-    string name = XonoticEntryList_cb_name;
-    string icon = XonoticEntryList_cb_icon;
-    if (isSelected) {
-        draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-    } else if (isFocused) {
-        this.focusedItemAlpha = getFadedAlpha(this.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
-        draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, this.focusedItemAlpha);
-    }
-    vector sz = draw_PictureSize(icon);
-    if (!sz) sz = '1 1 0';
-    float szr = sz.x / sz.y;
-    if (strstrofs(icon, "map", 0) >= 0) szr = 4 / 3;
-    float asr = this.itemAbsSize.x / this.itemAbsSize.y;
-    sz.y = 1; sz.x = szr / asr;
-    draw_Picture('0 0 0', icon, sz, '1 1 1', SKINALPHA_LISTBOX_SELECTED);
-    string s = draw_TextShortenToWidth(strdecolorize(name), 1 - sz.x - 2 * this.realFontSize.x, 0, this.realFontSize);
-    draw_Text(this.realUpperMargin1 * eY + (sz.x + 0.5 * this.realFontSize.x) * eX, s, this.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
+       if (!this.source) return;
+       if (!this.source.getEntry(this.source, i, XonoticEntryList_cb)) return;
+       string name = XonoticEntryList_cb_name;
+       string icon = XonoticEntryList_cb_icon;
+       if (isSelected) {
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       } else if (isFocused) {
+               this.focusedItemAlpha = getFadedAlpha(this.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, this.focusedItemAlpha);
+       }
+       vector sz = draw_PictureSize(icon);
+       if (!sz) sz = '1 1 0';
+       float szr = sz.x / sz.y;
+       if (strstrofs(icon, "map", 0) >= 0) szr = 4 / 3;
+       float asr = this.itemAbsSize.x / this.itemAbsSize.y;
+       sz.y = 1; sz.x = szr / asr;
+       draw_Picture('0 0 0', icon, sz, '1 1 1', SKINALPHA_LISTBOX_SELECTED);
+       string s = draw_TextShortenToWidth(strdecolorize(name), 1 - sz.x - 2 * this.realFontSize.x, 0, this.realFontSize);
+       draw_Text(this.realUpperMargin1 * eY + (sz.x + 0.5 * this.realFontSize.x) * eX, s, this.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
 }
 
 METHOD(XonoticEntryList, keyDown, float(entity this, float scan, float ascii, float shift))
 {
-    if (this.nItems <= 0) {
-        return SUPER(XonoticEntryList).keyDown(this, scan, ascii, shift);
-    } else if ((ascii >= 32 || scan == K_BACKSPACE) && this.source.indexOf) {
-        string save;
-        if (scan == K_BACKSPACE) {
-            save = substring(this.typeToSearchString, 0, strlen(this.typeToSearchString) - 1);
-        } else {
-            string ch = chr(ascii);
-            save = (time > this.typeToSearchTime) ? ch : strcat(this.typeToSearchString, ch);
-        }
-        if (this.typeToSearchString) strunzone(this.typeToSearchString);
-        this.typeToSearchString = strzone(save);
-        this.typeToSearchTime = time + 0.5;
-        if (strlen(this.typeToSearchString)) {
-            int idx = this.source.indexOf(this.source, this.typeToSearchString);
-            if (idx >= 0) this.setSelected(this, idx);
-        }
-    } else if (shift & S_CTRL && scan == 'f') {
-        this.parent.setFocus(this.parent, this.stringFilterBox);
-    } else if (shift & S_CTRL && scan == 'u') {
-        this.stringFilterBox.setText(this.stringFilterBox, "");
-        if (this.stringFilter) strunzone(this.stringFilter);
-        this.stringFilter = string_null;
-        this.refilter(this);
-    }
-    return SUPER(XonoticEntryList).keyDown(this, scan, ascii, shift);
+       if (this.nItems <= 0) {
+               return SUPER(XonoticEntryList).keyDown(this, scan, ascii, shift);
+       } else if ((ascii >= 32 || scan == K_BACKSPACE) && this.source.indexOf) {
+               string save;
+               if (scan == K_BACKSPACE) {
+                       save = substring(this.typeToSearchString, 0, strlen(this.typeToSearchString) - 1);
+               } else {
+                       string ch = chr(ascii);
+                       save = (time > this.typeToSearchTime) ? ch : strcat(this.typeToSearchString, ch);
+               }
+               if (this.typeToSearchString) strunzone(this.typeToSearchString);
+               this.typeToSearchString = strzone(save);
+               this.typeToSearchTime = time + 0.5;
+               if (strlen(this.typeToSearchString)) {
+                       int idx = this.source.indexOf(this.source, this.typeToSearchString);
+                       if (idx >= 0) this.setSelected(this, idx);
+               }
+       } else if (shift & S_CTRL && scan == 'f') {
+               this.parent.setFocus(this.parent, this.stringFilterBox);
+       } else if (shift & S_CTRL && scan == 'u') {
+               this.stringFilterBox.setText(this.stringFilterBox, "");
+               if (this.stringFilter) strunzone(this.stringFilter);
+               this.stringFilter = string_null;
+               this.refilter(this);
+       }
+       return SUPER(XonoticEntryList).keyDown(this, scan, ascii, shift);
 }
 
 void XonoticEntryList_refilter(entity this)
 {
-    if (!this.source) {
-        this.nItems = 0;
-        return;
-    }
-    this.nItems = this.source.reload(this.source, this.stringFilter);
-    for (int i = 0, n = this.nItems; i < n; ++i) {
-        if (this.source.getEntry(this.source, i, XonoticEntryList_cb)) {
-            draw_PreloadPicture(XonoticEntryList_cb_icon);
-        }
-    }
+       if (!this.source) {
+               this.nItems = 0;
+               return;
+       }
+       this.nItems = this.source.reload(this.source, this.stringFilter);
+       for (int i = 0, n = this.nItems; i < n; ++i) {
+               if (this.source.getEntry(this.source, i, XonoticEntryList_cb)) {
+                       draw_PreloadPicture(XonoticEntryList_cb_icon);
+               }
+       }
 }
 
 void XonoticEntryList_resizeNotify(entity this, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
 {
-    this.itemAbsSize = '0 0 0';
-    SUPER(XonoticEntryList).resizeNotify(this, relOrigin, relSize, absOrigin, absSize);
+       this.itemAbsSize = '0 0 0';
+       SUPER(XonoticEntryList).resizeNotify(this, relOrigin, relSize, absOrigin, absSize);
 
-    this.realFontSize_y = this.fontSize / (this.itemAbsSize_y = (absSize.y * this.itemHeight));
-    this.realFontSize_x = this.fontSize / (this.itemAbsSize_x = (absSize.x * (1 - this.controlWidth)));
-    this.realUpperMargin1 = 0.5 * (1 - 2.5 * this.realFontSize.y);
-    this.realUpperMargin2 = this.realUpperMargin1 + 1.5 * this.realFontSize.y;
+       this.realFontSize_y = this.fontSize / (this.itemAbsSize_y = (absSize.y * this.itemHeight));
+       this.realFontSize_x = this.fontSize / (this.itemAbsSize_x = (absSize.x * (1 - this.controlWidth)));
+       this.realUpperMargin1 = 0.5 * (1 - 2.5 * this.realFontSize.y);
+       this.realUpperMargin2 = this.realUpperMargin1 + 1.5 * this.realFontSize.y;
 }
 
 void XonoticEntryList_setSelected(entity this, int i)
 {
-    SUPER(XonoticEntryList).setSelected(this, i);
-    this.onChange(this, this.onChangeEntity);
+       SUPER(XonoticEntryList).setSelected(this, i);
+       this.onChange(this, this.onChangeEntity);
 }
index 90727615b452ca235c7fd18e6764a933d157549b..05e5691f8f197ef3c9c8720108b30b14bc58feb3 100644 (file)
@@ -3,33 +3,33 @@
 #include <menu/xonotic/datasource.qh>
 #include <menu/xonotic/listbox.qh>
 CLASS(XonoticEntryList, XonoticListBox)
-    ATTRIB(XonoticEntryList, alphaBG, float, 0);
-    ATTRIB(XonoticEntryList, itemAbsSize, vector, '0 0 0');
-    ATTRIB(XonoticEntryList, origin, vector, '0 0 0');
-    ATTRIB(XonoticEntryList, realFontSize, vector, '0 0 0');
-    ATTRIB(XonoticEntryList, realUpperMargin1, float, 0);
-    ATTRIB(XonoticEntryList, realUpperMargin2, float, 0);
-    ATTRIB(XonoticEntryList, rowsPerItem, float, 4);
-    ATTRIB(XonoticEntryList, stringFilterBox, entity, NULL);
-    ATTRIB(XonoticEntryList, stringFilter, string, string_null);
-    ATTRIB(XonoticEntryList, typeToSearchString, string, string_null);
-    ATTRIB(XonoticEntryList, typeToSearchTime, float, 0);
+       ATTRIB(XonoticEntryList, alphaBG, float, 0);
+       ATTRIB(XonoticEntryList, itemAbsSize, vector, '0 0 0');
+       ATTRIB(XonoticEntryList, origin, vector, '0 0 0');
+       ATTRIB(XonoticEntryList, realFontSize, vector, '0 0 0');
+       ATTRIB(XonoticEntryList, realUpperMargin1, float, 0);
+       ATTRIB(XonoticEntryList, realUpperMargin2, float, 0);
+       ATTRIB(XonoticEntryList, rowsPerItem, float, 4);
+       ATTRIB(XonoticEntryList, stringFilterBox, entity, NULL);
+       ATTRIB(XonoticEntryList, stringFilter, string, string_null);
+       ATTRIB(XonoticEntryList, typeToSearchString, string, string_null);
+       ATTRIB(XonoticEntryList, typeToSearchTime, float, 0);
 
-    METHOD(XonoticEntryList, drawListBoxItem, void(entity, int, vector, bool, bool));
-    METHOD(XonoticEntryList, keyDown, float(entity, float, float, float));
-    ATTRIB(XonoticEntryList, onChange, void(entity, entity));
-    ATTRIB(XonoticEntryList, onChangeEntity, entity);
-    METHOD(XonoticEntryList, refilter, void(entity));
-    METHOD(XonoticEntryList, resizeNotify, void(entity, vector, vector, vector, vector));
-    METHOD(XonoticEntryList, setSelected, void(entity, int));
+       METHOD(XonoticEntryList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticEntryList, keyDown, float(entity, float, float, float));
+       ATTRIB(XonoticEntryList, onChange, void(entity, entity));
+       ATTRIB(XonoticEntryList, onChangeEntity, entity);
+       METHOD(XonoticEntryList, refilter, void(entity));
+       METHOD(XonoticEntryList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticEntryList, setSelected, void(entity, int));
 
-    ATTRIB(XonoticEntryList, source, DataSource, NULL);
+       ATTRIB(XonoticEntryList, source, DataSource, NULL);
 
-    CONSTRUCTOR(XonoticEntryList, DataSource _source) {
-        CONSTRUCT(XonoticEntryList);
-        this.source = _source;
-        this.configureXonoticListBox(this);
-        this.refilter(this);
-    }
+       CONSTRUCTOR(XonoticEntryList, DataSource _source) {
+               CONSTRUCT(XonoticEntryList);
+               this.source = _source;
+               this.configureXonoticListBox(this);
+               this.refilter(this);
+       }
 
 ENDCLASS(XonoticEntryList)
diff --git a/qcsrc/menu/xonotic/guide/guide.qc b/qcsrc/menu/xonotic/guide/guide.qc
new file mode 100644 (file)
index 0000000..ca61a60
--- /dev/null
@@ -0,0 +1 @@
+#include "guide.qh"
diff --git a/qcsrc/menu/xonotic/guide/guide.qh b/qcsrc/menu/xonotic/guide/guide.qh
new file mode 100644 (file)
index 0000000..de9257a
--- /dev/null
@@ -0,0 +1,153 @@
+#pragma once
+
+#include <menu/xonotic/guide/_mod.qh>
+#include <common/items/item.qh>
+#include <menu/anim/animhost.qh>
+#include <menu/xonotic/datasource.qh>
+
+#define TOPICS(X) \
+       X(NEW(FreetextSource),  _("Guide"),     "gametype_tdm") \
+       X(NEW(GametypeSource),  _("Gametypes"), "gametype_dm") \
+       X(NEW(WeaponSource),    _("Weapons"),   "gametype_ka") \
+       X(NEW(ItemSource),      _("Items"),     "gametype_kh") \
+       X(NEW(BuffSource),      _("Buffs"),     "gametype_dom") \
+       X(NEW(NadeSource),      _("Nades"),     "gametype_ft") \
+       X(NEW(MonsterSource),   _("Monsters"),  "gametype_lms") \
+       X(NEW(VehicleSource),   _("Vehicles"),  "gametype_rc") \
+       X(NEW(TurretSource),    _("Turrets"),   "gametype_as") \
+       X(NEW(MutatorSource),   _("Mutators"),  "gametype_nb") \
+       X(NEW(MapSource),       _("Maps"),      "gametype_ctf") \
+       if (cvar("developer")) X(NEW(DebugSource), _("Debug"), "gametype_ons") \
+       /**/
+CLASS(TopicSource, DataSource)
+       METHOD(TopicSource, getEntry, entity(TopicSource this, int i, void(string, string) returns)) {
+               int idx = 0;
+               #define TOPIC(src, name, icon) if (idx++ == i) { if (returns) returns(name, icon); return DataSource_true; }
+               TOPICS(TOPIC);
+               #undef TOPIC
+               if (returns) returns("undefined", "undefined");
+               return DataSource_false;
+       }
+       METHOD(TopicSource, reload, int(TopicSource this, string filter)) {
+               int n = 0;
+               #define TOPIC(src, name, icon) n++;
+               TOPICS(TOPIC);
+               #undef TOPIC
+               return n;
+       }
+ENDCLASS(TopicSource)
+
+CLASS(DebugSource, DataSource)
+       .entity nextdebug;
+       entity find_debug() {
+               entity head = NULL, tail = NULL;
+               for (entity it = NULL; (it = nextent(it)); ) {
+                       if (!it.instanceOfObject) continue;
+                       if (it.instanceOfGameItem) continue;
+                       if (it.instanceOfAnimHost) continue;
+                       if (it.instanceOfDataSource) continue;
+                       if (it.classname == "Object") continue;
+                       if (it.classname == "vtbl") continue;
+                       if (!tail) {
+                               tail = head = it;
+                       } else {
+                               tail.nextdebug = it;
+                               tail = it;
+                       }
+               }
+               return head;
+       }
+       string DebugSource_activeFilter = "";
+       METHOD(DebugSource, getEntry, entity(DebugSource this, int i, void(string, string) returns)) {
+               int idx = 0;
+               entity e;
+               for (e = find_debug(); e; e = e.nextdebug) {
+                       if (strstrofs(sprintf("entity %i", e), DebugSource_activeFilter, 0) < 0) continue;
+                       if (idx++ == i) break;
+               }
+               if (returns) e.display(e, returns);
+               return e;
+       }
+       METHOD(DebugSource, reload, int(DebugSource this, string filter)) {
+               DebugSource_activeFilter = filter;
+               int idx = 0;
+               entity e;
+               for (e = find_debug(); e; e = e.nextdebug) {
+                       if (strstrofs(sprintf("entity %i", e), DebugSource_activeFilter, 0) < 0) continue;
+                       idx++;
+               }
+               return idx;
+       }
+ENDCLASS(DebugSource)
+
+.bool m_hidden;
+
+#define REGISTRY_SOURCE(id, arr) \
+ArrayList arr##_MENU; \
+int arr##_MENU_COUNT; \
+STATIC_INIT_LATE(arr##_MENU) \
+{ \
+       AL_NEW(arr##_MENU, arr##_MAX, NULL, e); \
+       FOREACH(arr, !it.m_hidden, { \
+               AL_sete(arr##_MENU, arr##_MENU_COUNT, it); \
+               arr##_MENU_COUNT++; \
+       }); \
+} \
+CLASS(id, DataSource) \
+       METHOD(id, getEntry, entity(id this, int i, void(string, string) returns)) { \
+               entity e = AL_gete(arr##_MENU, i); \
+               if (returns) e.display(e, returns); \
+               return e; \
+       } \
+       METHOD(id, reload, int(id this, string filter)) { return arr##_MENU_COUNT; } \
+ENDCLASS(id)
+
+REGISTRY_SOURCE(FreetextSource, GuidePages)
+
+#include <common/mapinfo.qh>
+REGISTRY_SOURCE(GametypeSource, Gametypes)
+
+#include <common/items/all.qh>
+REGISTRY_SOURCE(ItemSource, Items)
+
+#include <common/mutators/mutator/buffs/buffs.qh>
+REGISTRY_SOURCE(BuffSource, StatusEffect)
+
+#include <common/mutators/mutator/nades/nades.qh>
+REGISTRY_SOURCE(NadeSource, Nades)
+
+#include <common/weapons/all.qh>
+REGISTRY_SOURCE(WeaponSource, Weapons)
+
+#include <common/monsters/all.qh>
+REGISTRY_SOURCE(MonsterSource, Monsters)
+
+#include <common/vehicles/all.qh>
+REGISTRY_SOURCE(VehicleSource, Vehicles)
+
+#include <common/turrets/all.qh>
+REGISTRY_SOURCE(TurretSource, Turrets)
+
+#include <common/mutators/base.qh>
+REGISTRY_SOURCE(MutatorSource, Mutators)
+
+CLASS(MapSource, DataSource)
+       METHOD(MapSource, getEntry, entity(MapSource this, int i, void(string, string) returns)) {
+               if (!MapInfo_Get_ByID(i)) return DataSource_false;
+               string path = strcat("/maps/", MapInfo_Map_bspname);
+               string img = draw_PictureSize(path) ? path : "nopreview_map";
+               if (returns) returns(MapInfo_Map_titlestring, img);
+               MapInfo_ClearTemps();
+               return DataSource_true;
+       }
+       METHOD(MapSource, indexOf, int(MapSource this, string s)) {
+               MapInfo_FindName(s);
+               return MapInfo_FindName_firstResult;
+       }
+       METHOD(MapSource, reload, int(MapSource this, string s)) {
+               _MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, 0, 0);
+               if (s) MapInfo_FilterString(s);
+               return MapInfo_count;
+       }
+       METHOD(MapSource, destroy, void(MapSource this)) { MapInfo_Shutdown(); }
+ENDCLASS(MapSource)
diff --git a/qcsrc/menu/xonotic/guide/pages.qc b/qcsrc/menu/xonotic/guide/pages.qc
new file mode 100644 (file)
index 0000000..e79aed7
--- /dev/null
@@ -0,0 +1 @@
+#include "pages.qh"
index caaebd83f5f00b6ed6190bfa5d1897d5fabf9f22..78030ea40baac7724449bc4878ed8b8b4edef72f 100644 (file)
@@ -1,26 +1,24 @@
 #pragma once
 
 CLASS(GuidePage, Object);
-    ATTRIB(GuidePage, m_id, int, 0);
-    ATTRIB(GuidePage, m_title, string, "");
-    ATTRIB(GuidePage, m_description, string, "");
-    METHOD(GuidePage, describe, string(GuidePage this)) {
-        return this.m_description;
-    }
-    METHOD(GuidePage, display, void(GuidePage this, void(string name, string icon) returns)) {
-        returns(this.m_title, "nopreview_map");
-    }
-    CONSTRUCTOR(GuidePage, string _title) {
-        CONSTRUCT(GuidePage);
-        this.m_title = _title;
-    }
+       ATTRIB(GuidePage, m_id, int, 0);
+       ATTRIB(GuidePage, m_title, string, "");
+       ATTRIB(GuidePage, m_description, string, "");
+       METHOD(GuidePage, describe, string(GuidePage this)) {
+               return this.m_description;
+       }
+       METHOD(GuidePage, display, void(GuidePage this, void(string name, string icon) returns)) {
+               returns(this.m_title, "nopreview_map");
+       }
+       CONSTRUCTOR(GuidePage, string _title) {
+               CONSTRUCT(GuidePage);
+               this.m_title = _title;
+       }
 ENDCLASS(GuidePage)
 
 REGISTRY(GuidePages, 16)
 #define REGISTER_GUIDE_PAGE(id, title) \
-    REGISTER(GuidePages, GUIDE_PAGE, id, m_id, NEW(GuidePage, title))
+       REGISTER(GuidePages, GUIDE_PAGE, id, m_id, NEW(GuidePage, title))
 REGISTER_REGISTRY(GuidePages)
 
-REGISTER_GUIDE_PAGE(0, _("Intro")) { this.m_description = _(
-"Welcome to xonotic"
-);}
+REGISTER_GUIDE_PAGE(0, _("Intro")) { this.m_description = _("Welcome to Xonotic"); }
diff --git a/qcsrc/menu/xonotic/guide/tab.qc b/qcsrc/menu/xonotic/guide/tab.qc
deleted file mode 100644 (file)
index a0217bd..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-#include "tab.qh"
-
-#include <menu/xonotic/inputbox.qh>
-#include <menu/xonotic/maplist.qh>
-#include <menu/xonotic/textlabel.qh>
-
-void XonoticGuideTab_fill(entity this)
-{
-    entity topics = this.topicList;
-        topics.onChange = XonoticGuideTab_topicChangeNotify;
-        topics.onChangeEntity = this;
-    entity entries = this.entryList;
-        entries.onChange = XonoticGuideTab_entryChangeNotify;
-        entries.onChangeEntity = this;
-    entity filter = entries.stringFilterBox = makeXonoticInputBox(false, string_null);
-        filter.keyDown = MapList_StringFilterBox_keyDown;
-        filter.onChange = MapList_StringFilterBox_Change;
-        filter.onChangeEntity = entries;
-    entries.controlledTextbox = filter;
-    entity description = this.descriptionPane;
-
-    int
-    col = 0, width = 1.5;
-    this.gotoRC(this, 0, col);
-        this.TD(this, 1, width, makeXonoticHeaderLabel(_("Topic")));
-    this.TR(this);
-        this.TD(this, this.rows - 1, width, topics);
-
-    col += width, width = 2;
-    this.gotoRC(this, 0, col); this.setFirstColumn(this, this.currentColumn);
-        this.TD(this, 1, width, makeXonoticHeaderLabel(_("Entry")));
-    this.TR(this);
-        this.TD(this, this.rows - 1 - 1, width, entries);
-    this.gotoRC(this, this.rows - 1, col);
-        this.TD(this, 1, 0.3, makeXonoticTextLabel(0, _("Filter:")));
-        this.TD(this, 1, width - 0.3, filter);
-
-    col += width, width = 2.5;
-    this.gotoRC(this, 0, col); this.setFirstColumn(this, this.currentColumn);
-        this.TD(this, 1, width, makeXonoticHeaderLabel(_("Description")));
-    this.TR(this);
-        this.TD(this, this.rows - 1, width, description);
-
-    this.topicChangeNotify(topics, this);
-}
-
-void XonoticGuideTab_topicChangeNotify(entity, entity this)
-{
-    entity topics = this.topicList;
-    entity entries = this.entryList;
-    int i = topics.selectedItem;
-    int idx = 0;
-    entity found = NULL;
-    #define TOPIC(src, name, icon) if (idx++ == i) { static entity e; if (!e) e = src; found = e; break; }
-    do { TOPICS(TOPIC); } while (0);
-    #undef TOPIC
-    entries.source = found;
-    entries.refilter(entries);
-    entries.setSelected(entries, 0);
-}
-
-void XonoticGuideTab_entryChangeNotify(entity, entity this)
-{
-    entity desc = this.descriptionPane;
-    entity entries = this.entryList;
-    entity e = entries.source.getEntry(entries.source, entries.selectedItem, func_null);
-    string s = e.describe(e);
-    if (cvar("developer")) { s = sprintf("entity %i\n%s", e, s); }
-    desc.setDescription(desc, s);
-}
diff --git a/qcsrc/menu/xonotic/guide/tab.qh b/qcsrc/menu/xonotic/guide/tab.qh
deleted file mode 100644 (file)
index e2d4f42..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-#pragma once
-
-#include <common/items/item.qh>
-#include <menu/anim/animhost.qh>
-#include <menu/xonotic/datasource.qh>
-
-#define TOPICS(X) \
-    X(NEW(FreetextSource),  _("Guide"),     "gametype_tdm") \
-    X(NEW(GametypeSource),  _("Gametypes"), "gametype_dm") \
-    X(NEW(WeaponSource),    _("Weapons"),   "gametype_ka") \
-    X(NEW(ItemSource),      _("Items"),     "gametype_kh") \
-    X(NEW(BuffSource),      _("Buffs"),     "gametype_dom") \
-    X(NEW(NadeSource),      _("Nades"),     "gametype_ft") \
-    X(NEW(MonsterSource),   _("Monsters"),  "gametype_lms") \
-    X(NEW(VehicleSource),   _("Vehicles"),  "gametype_rc") \
-    X(NEW(TurretSource),    _("Turrets"),   "gametype_as") \
-    X(NEW(MutatorSource),   _("Mutators"),  "gametype_nb") \
-    X(NEW(MapSource),       _("Maps"),      "gametype_ctf") \
-    if (cvar("developer")) X(NEW(DebugSource), _("Debug"), "gametype_ons") \
-    /**/
-CLASS(TopicSource, DataSource)
-    METHOD(TopicSource, getEntry, entity(TopicSource this, int i, void(string, string) returns)) {
-        int idx = 0;
-        #define TOPIC(src, name, icon) if (idx++ == i) { if (returns) returns(name, icon); return DataSource_true; }
-        TOPICS(TOPIC);
-        #undef TOPIC
-        if (returns) returns("undefined", "undefined");
-        return DataSource_false;
-    }
-    METHOD(TopicSource, reload, int(TopicSource this, string filter)) {
-        int n = 0;
-        #define TOPIC(src, name, icon) n++;
-        TOPICS(TOPIC);
-        #undef TOPIC
-        return n;
-    }
-ENDCLASS(TopicSource)
-
-CLASS(DebugSource, DataSource)
-    .entity nextdebug;
-    entity find_debug() {
-        entity head = NULL, tail = NULL;
-        for (entity it = NULL; (it = nextent(it)); ) {
-            if (!it.instanceOfObject) continue;
-            if (it.instanceOfGameItem) continue;
-            if (it.instanceOfAnimHost) continue;
-            if (it.instanceOfDataSource) continue;
-            if (it.classname == "Object") continue;
-            if (it.classname == "vtbl") continue;
-            if (!tail) {
-                tail = head = it;
-            } else {
-                tail.nextdebug = it;
-                tail = it;
-            }
-        }
-        return head;
-    }
-    string DebugSource_activeFilter = "";
-    METHOD(DebugSource, getEntry, entity(DebugSource this, int i, void(string, string) returns)) {
-        int idx = 0;
-        entity e;
-        for (e = find_debug(); e; e = e.nextdebug) {
-            if (strstrofs(sprintf("entity %i", e), DebugSource_activeFilter, 0) < 0) continue;
-            if (idx++ == i) break;
-        }
-        if (returns) e.display(e, returns);
-        return e;
-    }
-    METHOD(DebugSource, reload, int(DebugSource this, string filter)) {
-        DebugSource_activeFilter = filter;
-        int idx = 0;
-        entity e;
-        for (e = find_debug(); e; e = e.nextdebug) {
-            if (strstrofs(sprintf("entity %i", e), DebugSource_activeFilter, 0) < 0) continue;
-            idx++;
-        }
-        return idx;
-    }
-ENDCLASS(DebugSource)
-
-.bool m_hidden;
-
-#define REGISTRY_SOURCE(id, arr) \
-ArrayList arr##_MENU; \
-int arr##_MENU_COUNT; \
-STATIC_INIT_LATE(arr##_MENU) \
-{ \
-    AL_NEW(arr##_MENU, arr##_MAX, NULL, e); \
-    FOREACH(arr, !it.m_hidden, { \
-        AL_sete(arr##_MENU, arr##_MENU_COUNT, it); \
-        arr##_MENU_COUNT++; \
-    }); \
-} \
-CLASS(id, DataSource) \
-    METHOD(id, getEntry, entity(id this, int i, void(string, string) returns)) { \
-        entity e = AL_gete(arr##_MENU, i); \
-        if (returns) e.display(e, returns); \
-        return e; \
-    } \
-    METHOD(id, reload, int(id this, string filter)) { return arr##_MENU_COUNT; } \
-ENDCLASS(id)
-
-#include "pages.qh"
-REGISTRY_SOURCE(FreetextSource, GuidePages)
-
-#include <common/mapinfo.qh>
-REGISTRY_SOURCE(GametypeSource, Gametypes)
-
-#include <common/items/all.qh>
-REGISTRY_SOURCE(ItemSource, Items)
-
-#include <common/mutators/mutator/buffs/buffs.qh>
-REGISTRY_SOURCE(BuffSource, StatusEffect)
-
-#include <common/mutators/mutator/nades/nades.qh>
-REGISTRY_SOURCE(NadeSource, Nades)
-
-#include <common/weapons/all.qh>
-REGISTRY_SOURCE(WeaponSource, Weapons)
-
-#include <common/monsters/all.qh>
-REGISTRY_SOURCE(MonsterSource, Monsters)
-
-#include <common/vehicles/all.qh>
-REGISTRY_SOURCE(VehicleSource, Vehicles)
-
-#include <common/turrets/all.qh>
-REGISTRY_SOURCE(TurretSource, Turrets)
-
-#include <common/mutators/base.qh>
-REGISTRY_SOURCE(MutatorSource, Mutators)
-
-CLASS(MapSource, DataSource)
-    METHOD(MapSource, getEntry, entity(MapSource this, int i, void(string, string) returns)) {
-        if (!MapInfo_Get_ByID(i)) return DataSource_false;
-        string path = strcat("/maps/", MapInfo_Map_bspname);
-        string img = draw_PictureSize(path) ? path : "nopreview_map";
-        if (returns) returns(MapInfo_Map_titlestring, img);
-        MapInfo_ClearTemps();
-        return DataSource_true;
-    }
-    METHOD(MapSource, indexOf, int(MapSource this, string s)) {
-        MapInfo_FindName(s);
-        return MapInfo_FindName_firstResult;
-    }
-    METHOD(MapSource, reload, int(MapSource this, string s)) {
-        _MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, 0, 0);
-        if (s) MapInfo_FilterString(s);
-        return MapInfo_count;
-    }
-    METHOD(MapSource, destroy, void(MapSource this)) { MapInfo_Shutdown(); }
-ENDCLASS(MapSource)
-
-#include "topics.qh"
-#include "entries.qh"
-#include "description.qh"
-#include <menu/xonotic/tab.qh>
-CLASS(XonoticGuideTab, XonoticTab)
-    ATTRIB(XonoticGuideTab, rows, float, 21);
-    ATTRIB(XonoticGuideTab, columns, float, 6);
-       ATTRIB(XonoticGuideTab, intendedWidth, float, 1);
-    METHOD(XonoticGuideTab, fill, void(entity));
-    METHOD(XonoticGuideTab, topicChangeNotify, void(entity, entity));
-    METHOD(XonoticGuideTab, entryChangeNotify, void(entity, entity));
-
-    ATTRIB(XonoticGuideTab, controlledTextbox, entity);
-    ATTRIB(XonoticGuideTab, topicList, entity, NEW(XonoticTopicList, NEW(TopicSource)));
-    ATTRIB(XonoticGuideTab, entryList, entity, NEW(XonoticEntryList, NULL));
-    ATTRIB(XonoticGuideTab, descriptionPane, entity, NEW(XonoticGuideDescription));
-
-    INIT(XonoticGuideTab) {
-        this.configureDialog(this);
-    }
-ENDCLASS(XonoticGuideTab)
index ad75a34fa1afbb3a795c9325c5b1c72e6c6b6201..9d1453dce10386480f354b77ad9f1b561fbefea2 100644 (file)
@@ -1,65 +1,65 @@
 #include "topics.qh"
 
-#include "entries.qh"
+#include <menu/xonotic/guide/entries.qh>
 
 void XonoticTopicList_clickListBoxItem(entity this, float i, vector where)
 {
-    m_play_click_sound(MENU_SOUND_SELECT);
+       m_play_click_sound(MENU_SOUND_SELECT);
 }
 
 string XonoticTopicList_cb_name, XonoticTopicList_cb_icon;
 void XonoticTopicList_cb(string _name, string _icon) {
-    XonoticTopicList_cb_name = _name;
-    XonoticTopicList_cb_icon = _icon;
+       XonoticTopicList_cb_name = _name;
+       XonoticTopicList_cb_icon = _icon;
 }
 
 void XonoticTopicList_drawListBoxItem(entity this, int i, vector absSize, bool isSelected, bool isFocused)
 {
-    if (!this.source) return;
-    if (!this.source.getEntry(this.source, i, XonoticTopicList_cb)) return;
-    string icon = XonoticTopicList_cb_icon;
-    string name = XonoticTopicList_cb_name;
-    if (isSelected) {
-        draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-    } else if (isFocused) {
-        this.focusedItemAlpha = getFadedAlpha(this.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
-        draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, this.focusedItemAlpha);
-    }
-    draw_Picture(this.columnIconOrigin * eX, icon, this.columnIconSize * eX + eY, '1 1 1', SKINALPHA_LISTBOX_SELECTED);
-    vector save_fontscale = draw_fontscale;
-    float f = draw_CondensedFontFactor(name, false, this.realFontSize, 1);
-    draw_fontscale.x *= f;
-    vector fs = this.realFontSize;
-    fs.x *= f;
-    draw_Text(this.realUpperMargin * eY + this.columnNameOrigin * eX, name, fs, '1 1 1', SKINALPHA_TEXT, 0);
-    draw_fontscale = save_fontscale;
+       if (!this.source) return;
+       if (!this.source.getEntry(this.source, i, XonoticTopicList_cb)) return;
+       string icon = XonoticTopicList_cb_icon;
+       string name = XonoticTopicList_cb_name;
+       if (isSelected) {
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       } else if (isFocused) {
+               this.focusedItemAlpha = getFadedAlpha(this.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, this.focusedItemAlpha);
+       }
+       draw_Picture(this.columnIconOrigin * eX, icon, this.columnIconSize * eX + eY, '1 1 1', SKINALPHA_LISTBOX_SELECTED);
+       vector save_fontscale = draw_fontscale;
+       float f = draw_CondensedFontFactor(name, false, this.realFontSize, 1);
+       draw_fontscale.x *= f;
+       vector fs = this.realFontSize;
+       fs.x *= f;
+       draw_Text(this.realUpperMargin * eY + this.columnNameOrigin * eX, name, fs, '1 1 1', SKINALPHA_TEXT, 0);
+       draw_fontscale = save_fontscale;
 }
 
 bool XonoticTopicList_keyDown(entity this, float scan, float ascii, float shift)
 {
-    if (scan == K_ENTER || scan == K_KP_ENTER) {
-        m_play_click_sound(MENU_SOUND_EXECUTE);
-        return true;
-    }
-    return SUPER(XonoticEntryList).keyDown(this, scan, ascii, shift);
+       if (scan == K_ENTER || scan == K_KP_ENTER) {
+               m_play_click_sound(MENU_SOUND_EXECUTE);
+               return true;
+       }
+       return SUPER(XonoticEntryList).keyDown(this, scan, ascii, shift);
 }
 
 void XonoticTopicList_resizeNotify(entity this, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
 {
-    this.itemAbsSize = '0 0 0';
-    SUPER(XonoticEntryList).resizeNotify(this, relOrigin, relSize, absOrigin, absSize);
+       this.itemAbsSize = '0 0 0';
+       SUPER(XonoticEntryList).resizeNotify(this, relOrigin, relSize, absOrigin, absSize);
 
-    this.realFontSize_y = this.fontSize / (this.itemAbsSize_y = (absSize.y * this.itemHeight));
-    this.realFontSize_x = this.fontSize / (this.itemAbsSize_x = (absSize.x * (1 - this.controlWidth)));
-    this.realUpperMargin = 0.5 * (1 - this.realFontSize.y);
-    this.columnIconOrigin = 0;
-    this.columnIconSize = this.itemAbsSize.y / this.itemAbsSize.x;
-    this.columnNameOrigin = this.columnIconOrigin + this.columnIconSize + (0.5 * this.realFontSize.x);
-    this.columnNameSize = 1 - this.columnIconSize - (1.5 * this.realFontSize.x);
+       this.realFontSize_y = this.fontSize / (this.itemAbsSize_y = (absSize.y * this.itemHeight));
+       this.realFontSize_x = this.fontSize / (this.itemAbsSize_x = (absSize.x * (1 - this.controlWidth)));
+       this.realUpperMargin = 0.5 * (1 - this.realFontSize.y);
+       this.columnIconOrigin = 0;
+       this.columnIconSize = this.itemAbsSize.y / this.itemAbsSize.x;
+       this.columnNameOrigin = this.columnIconOrigin + this.columnIconSize + (0.5 * this.realFontSize.x);
+       this.columnNameSize = 1 - this.columnIconSize - (1.5 * this.realFontSize.x);
 }
 
 void XonoticTopicList_setSelected(entity this, int i)
 {
-    SUPER(XonoticEntryList).setSelected(this, i);
-    this.onChange(this, this.onChangeEntity);
+       SUPER(XonoticEntryList).setSelected(this, i);
+       this.onChange(this, this.onChangeEntity);
 }
index cd84ce8dc7b12b4e7b1ff2a5210fbf624cbc639b..3caf5ad9b3f59914a71514b3d452cf5be4d433a0 100644 (file)
@@ -3,26 +3,26 @@
 #include <menu/xonotic/datasource.qh>
 #include <menu/xonotic/listbox.qh>
 CLASS(XonoticTopicList, XonoticListBox)
-    ATTRIB(XonoticTopicList, columnIconOrigin, float, 0);
-    ATTRIB(XonoticTopicList, columnIconSize, float, 0);
-    ATTRIB(XonoticTopicList, columnNameOrigin, float, 0);
-    ATTRIB(XonoticTopicList, columnNameSize, float, 0);
-    ATTRIB(XonoticTopicList, realFontSize, vector, '0 0 0');
-    ATTRIB(XonoticTopicList, realUpperMargin, float, 0);
-    ATTRIB(XonoticTopicList, rowsPerItem, float, 3);
+       ATTRIB(XonoticTopicList, columnIconOrigin, float, 0);
+       ATTRIB(XonoticTopicList, columnIconSize, float, 0);
+       ATTRIB(XonoticTopicList, columnNameOrigin, float, 0);
+       ATTRIB(XonoticTopicList, columnNameSize, float, 0);
+       ATTRIB(XonoticTopicList, realFontSize, vector, '0 0 0');
+       ATTRIB(XonoticTopicList, realUpperMargin, float, 0);
+       ATTRIB(XonoticTopicList, rowsPerItem, float, 3);
 
-    METHOD(XonoticTopicList, clickListBoxItem, void(entity, float, vector));
-    METHOD(XonoticTopicList, drawListBoxItem, void(entity, int, vector, bool, bool));
-    METHOD(XonoticTopicList, keyDown, bool(entity, float, float, float));
-    METHOD(XonoticTopicList, resizeNotify, void(entity, vector, vector, vector, vector));
-    METHOD(XonoticTopicList, setSelected, void(entity, int));
+       METHOD(XonoticTopicList, clickListBoxItem, void(entity, float, vector));
+       METHOD(XonoticTopicList, drawListBoxItem, void(entity, int, vector, bool, bool));
+       METHOD(XonoticTopicList, keyDown, bool(entity, float, float, float));
+       METHOD(XonoticTopicList, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(XonoticTopicList, setSelected, void(entity, int));
 
-    ATTRIB(XonoticTopicList, source, DataSource, NULL);
+       ATTRIB(XonoticTopicList, source, DataSource, NULL);
 
-    CONSTRUCTOR(XonoticTopicList, DataSource _source) {
-       CONSTRUCT(XonoticTopicList);
-       this.source = _source;
-       this.nItems = _source.reload(_source, "");
-       this.configureXonoticListBox(this);
-    }
+       CONSTRUCTOR(XonoticTopicList, DataSource _source) {
+               CONSTRUCT(XonoticTopicList);
+               this.source = _source;
+               this.nItems = _source.reload(_source, "");
+               this.configureXonoticListBox(this);
+       }
 ENDCLASS(XonoticTopicList)