# HG changeset patch # User truebrain # Date 2011-12-16 18:02:27 # Node ID dfaaba643efc3d53bb8dbb3748d65dc2e6070e07 # Parent c75ccc68341dc17bccc796353a5be4547a3dc24b (svn r23544) -Codechange: document and rename widgets to be consistent and understandable diff --git a/src/bootstrap_gui.cpp b/src/bootstrap_gui.cpp --- a/src/bootstrap_gui.cpp +++ b/src/bootstrap_gui.cpp @@ -66,7 +66,7 @@ public: /** Nested widgets for the download window. */ static const NWidgetPart _nested_boostrap_download_status_window_widgets[] = { NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_CONTENT_DOWNLOAD_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), - NWidget(WWT_PANEL, COLOUR_GREY, NCDSWW_BACKGROUND), + NWidget(WWT_PANEL, COLOUR_GREY, WID_NCDS_BACKGROUND), NWidget(NWID_SPACER), SetMinimalSize(350, 0), SetMinimalTextLines(3, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 30), EndContainer(), }; diff --git a/src/music_gui.cpp b/src/music_gui.cpp --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -293,16 +293,16 @@ struct MusicTrackSelectionWindow : publi MusicTrackSelectionWindow(const WindowDesc *desc, WindowNumber number) : Window() { this->InitNested(desc, number); - this->LowerWidget(MTSW_LIST_LEFT); - this->LowerWidget(MTSW_LIST_RIGHT); - this->SetWidgetDisabledState(MTSW_CLEAR, _settings_client.music.playlist <= 3); - this->LowerWidget(MTSW_ALL + _settings_client.music.playlist); + this->LowerWidget(WID_MTS_LIST_LEFT); + this->LowerWidget(WID_MTS_LIST_RIGHT); + this->SetWidgetDisabledState(WID_MTS_CLEAR, _settings_client.music.playlist <= 3); + this->LowerWidget(WID_MTS_ALL + _settings_client.music.playlist); } virtual void SetStringParameters(int widget) const { switch (widget) { - case MTSW_PLAYLIST: + case WID_MTS_PLAYLIST: SetDParam(0, STR_MUSIC_PLAYLIST_ALL + _settings_client.music.playlist); break; } @@ -317,16 +317,16 @@ struct MusicTrackSelectionWindow : publi { if (!gui_scope) return; for (int i = 0; i < 6; i++) { - this->SetWidgetLoweredState(MTSW_ALL + i, i == _settings_client.music.playlist); + this->SetWidgetLoweredState(WID_MTS_ALL + i, i == _settings_client.music.playlist); } - this->SetWidgetDisabledState(MTSW_CLEAR, _settings_client.music.playlist <= 3); + this->SetWidgetDisabledState(WID_MTS_CLEAR, _settings_client.music.playlist <= 3); this->SetDirty(); } virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case MTSW_PLAYLIST: { + case WID_MTS_PLAYLIST: { Dimension d = {0, 0}; for (int i = 0; i < 6; i++) { @@ -339,7 +339,7 @@ struct MusicTrackSelectionWindow : publi break; } - case MTSW_LIST_LEFT: case MTSW_LIST_RIGHT: { + case WID_MTS_LIST_LEFT: case WID_MTS_LIST_RIGHT: { Dimension d = {0, 0}; for (uint i = 0; i < NUM_SONGS_AVAILABLE; i++) { @@ -364,7 +364,7 @@ struct MusicTrackSelectionWindow : publi virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case MTSW_LIST_LEFT: { + case WID_MTS_LIST_LEFT: { GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, PC_BLACK); int y = r.top + WD_FRAMERECT_TOP; @@ -381,7 +381,7 @@ struct MusicTrackSelectionWindow : publi break; } - case MTSW_LIST_RIGHT: { + case WID_MTS_LIST_RIGHT: { GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, PC_BLACK); int y = r.top + WD_FRAMERECT_TOP; @@ -401,7 +401,7 @@ struct MusicTrackSelectionWindow : publi virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case MTSW_LIST_LEFT: { // add to playlist + case WID_MTS_LIST_LEFT: { // add to playlist int y = this->GetRowFromWidget(pt.y, widget, 0, FONT_HEIGHT_SMALL); if (_settings_client.music.playlist < 4) return; @@ -426,7 +426,7 @@ struct MusicTrackSelectionWindow : publi break; } - case MTSW_LIST_RIGHT: { // remove from playlist + case WID_MTS_LIST_RIGHT: { // remove from playlist int y = this->GetRowFromWidget(pt.y, widget, 0, FONT_HEIGHT_SMALL); if (_settings_client.music.playlist < 4) return; @@ -442,16 +442,16 @@ struct MusicTrackSelectionWindow : publi break; } - case MTSW_CLEAR: // clear + case WID_MTS_CLEAR: // clear for (uint i = 0; _playlists[_settings_client.music.playlist][i] != 0; i++) _playlists[_settings_client.music.playlist][i] = 0; this->SetDirty(); StopMusic(); SelectSongToPlay(); break; - case MTSW_ALL: case MTSW_OLD: case MTSW_NEW: - case MTSW_EZY: case MTSW_CUSTOM1: case MTSW_CUSTOM2: // set playlist - SelectPlaylist(widget - MTSW_ALL); + case WID_MTS_ALL: case WID_MTS_OLD: case WID_MTS_NEW: + case WID_MTS_EZY: case WID_MTS_CUSTOM1: case WID_MTS_CUSTOM2: // set playlist + SelectPlaylist(widget - WID_MTS_ALL); StopMusic(); SelectSongToPlay(); break; @@ -469,26 +469,26 @@ static const NWidgetPart _nested_music_t /* Left panel. */ NWidget(NWID_VERTICAL), NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_PLAYLIST_TRACK_INDEX, STR_NULL), - NWidget(WWT_PANEL, COLOUR_GREY, MTSW_LIST_LEFT), SetMinimalSize(180, 194), SetDataTip(0x0, STR_PLAYLIST_TOOLTIP_CLICK_TO_ADD_TRACK), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_MTS_LIST_LEFT), SetMinimalSize(180, 194), SetDataTip(0x0, STR_PLAYLIST_TOOLTIP_CLICK_TO_ADD_TRACK), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 2), EndContainer(), /* Middle buttons. */ NWidget(NWID_VERTICAL), NWidget(NWID_SPACER), SetMinimalSize(60, 30), // Space above the first button from the title bar. - NWidget(WWT_TEXTBTN, COLOUR_GREY, MTSW_ALL), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_ALL, STR_MUSIC_TOOLTIP_SELECT_ALL_TRACKS_PROGRAM), - NWidget(WWT_TEXTBTN, COLOUR_GREY, MTSW_OLD), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_OLD_STYLE, STR_MUSIC_TOOLTIP_SELECT_OLD_STYLE_MUSIC), - NWidget(WWT_TEXTBTN, COLOUR_GREY, MTSW_NEW), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_NEW_STYLE, STR_MUSIC_TOOLTIP_SELECT_NEW_STYLE_MUSIC), - NWidget(WWT_TEXTBTN, COLOUR_GREY, MTSW_EZY), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_EZY_STREET, STR_MUSIC_TOOLTIP_SELECT_EZY_STREET_STYLE), - NWidget(WWT_TEXTBTN, COLOUR_GREY, MTSW_CUSTOM1), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_CUSTOM_1, STR_MUSIC_TOOLTIP_SELECT_CUSTOM_1_USER_DEFINED), - NWidget(WWT_TEXTBTN, COLOUR_GREY, MTSW_CUSTOM2), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_CUSTOM_2, STR_MUSIC_TOOLTIP_SELECT_CUSTOM_2_USER_DEFINED), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_ALL), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_ALL, STR_MUSIC_TOOLTIP_SELECT_ALL_TRACKS_PROGRAM), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_OLD), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_OLD_STYLE, STR_MUSIC_TOOLTIP_SELECT_OLD_STYLE_MUSIC), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_NEW), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_NEW_STYLE, STR_MUSIC_TOOLTIP_SELECT_NEW_STYLE_MUSIC), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_EZY), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_EZY_STREET, STR_MUSIC_TOOLTIP_SELECT_EZY_STREET_STYLE), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_CUSTOM1), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_CUSTOM_1, STR_MUSIC_TOOLTIP_SELECT_CUSTOM_1_USER_DEFINED), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_MTS_CUSTOM2), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_CUSTOM_2, STR_MUSIC_TOOLTIP_SELECT_CUSTOM_2_USER_DEFINED), NWidget(NWID_SPACER), SetMinimalSize(0, 16), // Space above 'clear' button - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, MTSW_CLEAR), SetFill(1, 0), SetDataTip(STR_PLAYLIST_CLEAR, STR_PLAYLIST_TOOLTIP_CLEAR_CURRENT_PROGRAM_CUSTOM1), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_MTS_CLEAR), SetFill(1, 0), SetDataTip(STR_PLAYLIST_CLEAR, STR_PLAYLIST_TOOLTIP_CLEAR_CURRENT_PROGRAM_CUSTOM1), NWidget(NWID_SPACER), SetFill(0, 1), EndContainer(), /* Right panel. */ NWidget(NWID_VERTICAL), - NWidget(WWT_LABEL, COLOUR_GREY, MTSW_PLAYLIST), SetDataTip(STR_PLAYLIST_PROGRAM, STR_NULL), - NWidget(WWT_PANEL, COLOUR_GREY, MTSW_LIST_RIGHT), SetMinimalSize(180, 194), SetDataTip(0x0, STR_PLAYLIST_TOOLTIP_CLICK_TO_REMOVE_TRACK), EndContainer(), + NWidget(WWT_LABEL, COLOUR_GREY, WID_MTS_PLAYLIST), SetDataTip(STR_PLAYLIST_PROGRAM, STR_NULL), + NWidget(WWT_PANEL, COLOUR_GREY, WID_MTS_LIST_RIGHT), SetMinimalSize(180, 194), SetDataTip(0x0, STR_PLAYLIST_TOOLTIP_CLICK_TO_REMOVE_TRACK), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 2), EndContainer(), EndContainer(), @@ -513,17 +513,17 @@ struct MusicWindow : public Window { MusicWindow(const WindowDesc *desc, WindowNumber number) : Window() { this->InitNested(desc, number); - this->LowerWidget(_settings_client.music.playlist + MW_ALL); - this->SetWidgetLoweredState(MW_SHUFFLE, _settings_client.music.shuffle); + this->LowerWidget(_settings_client.music.playlist + WID_M_ALL); + this->SetWidgetLoweredState(WID_M_SHUFFLE, _settings_client.music.shuffle); } virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - /* Make sure that MW_SHUFFLE and MW_PROGRAMME have the same size. - * This can't be done by using NC_EQUALSIZE as the MW_INFO is + /* Make sure that WID_M_SHUFFLE and WID_M_PROGRAMME have the same size. + * This can't be done by using NC_EQUALSIZE as the WID_M_INFO is * between those widgets and of different size. */ - case MW_SHUFFLE: case MW_PROGRAMME: { + case WID_M_SHUFFLE: case WID_M_PROGRAMME: { Dimension d = maxdim(GetStringBoundingBox(STR_MUSIC_PROGRAM), GetStringBoundingBox(STR_MUSIC_SHUFFLE)); d.width += padding.width; d.height += padding.height; @@ -531,7 +531,7 @@ struct MusicWindow : public Window { break; } - case MW_TRACK_NR: { + case WID_M_TRACK_NR: { Dimension d = GetStringBoundingBox(STR_MUSIC_TRACK_NONE); d.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; @@ -539,7 +539,7 @@ struct MusicWindow : public Window { break; } - case MW_TRACK_NAME: { + case WID_M_TRACK_NAME: { Dimension d = GetStringBoundingBox(STR_MUSIC_TITLE_NONE); for (uint i = 0; i < NUM_SONGS_AVAILABLE; i++) { SetDParamStr(0, GetSongName(i)); @@ -553,16 +553,16 @@ struct MusicWindow : public Window { /* Hack-ish: set the proper widget data; only needs to be done once * per (Re)Init as that's the only time the language changes. */ - case MW_PREV: this->GetWidget(MW_PREV)->widget_data = _current_text_dir == TD_RTL ? SPR_IMG_SKIP_TO_NEXT : SPR_IMG_SKIP_TO_PREV; break; - case MW_NEXT: this->GetWidget(MW_NEXT)->widget_data = _current_text_dir == TD_RTL ? SPR_IMG_SKIP_TO_PREV : SPR_IMG_SKIP_TO_NEXT; break; - case MW_PLAY: this->GetWidget(MW_PLAY)->widget_data = _current_text_dir == TD_RTL ? SPR_IMG_PLAY_MUSIC_RTL : SPR_IMG_PLAY_MUSIC; break; + case WID_M_PREV: this->GetWidget(WID_M_PREV)->widget_data = _current_text_dir == TD_RTL ? SPR_IMG_SKIP_TO_NEXT : SPR_IMG_SKIP_TO_PREV; break; + case WID_M_NEXT: this->GetWidget(WID_M_NEXT)->widget_data = _current_text_dir == TD_RTL ? SPR_IMG_SKIP_TO_PREV : SPR_IMG_SKIP_TO_NEXT; break; + case WID_M_PLAY: this->GetWidget(WID_M_PLAY)->widget_data = _current_text_dir == TD_RTL ? SPR_IMG_PLAY_MUSIC_RTL : SPR_IMG_PLAY_MUSIC; break; } } virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case MW_TRACK_NR: { + case WID_M_TRACK_NR: { GfxFillRect(r.left + 1, r.top + 1, r.right, r.bottom, PC_BLACK); StringID str = STR_MUSIC_TRACK_NONE; if (_song_is_active != 0 && _music_wnd_cursong != 0) { @@ -574,7 +574,7 @@ struct MusicWindow : public Window { break; } - case MW_TRACK_NAME: { + case WID_M_TRACK_NAME: { GfxFillRect(r.left, r.top + 1, r.right - 1, r.bottom, PC_BLACK); StringID str = STR_MUSIC_TITLE_NONE; if (_song_is_active != 0 && _music_wnd_cursong != 0) { @@ -585,9 +585,9 @@ struct MusicWindow : public Window { break; } - case MW_MUSIC_VOL: case MW_EFFECT_VOL: { + case WID_M_MUSIC_VOL: case WID_M_EFFECT_VOL: { DrawFrameRect(r.left, r.top + 2, r.right, r.bottom - 2, COLOUR_GREY, FR_LOWERED); - byte volume = (widget == MW_MUSIC_VOL) ? _settings_client.music.music_vol : _settings_client.music.effect_vol; + byte volume = (widget == WID_M_MUSIC_VOL) ? _settings_client.music.music_vol : _settings_client.music.effect_vol; int x = (volume * (r.right - r.left) / 127); if (_current_text_dir == TD_RTL) { x = r.right - x; @@ -609,7 +609,7 @@ struct MusicWindow : public Window { { if (!gui_scope) return; for (int i = 0; i < 6; i++) { - this->SetWidgetLoweredState(MW_ALL + i, i == _settings_client.music.playlist); + this->SetWidgetLoweredState(WID_M_ALL + i, i == _settings_client.music.playlist); } this->SetDirty(); } @@ -617,36 +617,36 @@ struct MusicWindow : public Window { virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case MW_PREV: // skip to prev + case WID_M_PREV: // skip to prev if (!_song_is_active) return; SkipToPrevSong(); this->SetDirty(); break; - case MW_NEXT: // skip to next + case WID_M_NEXT: // skip to next if (!_song_is_active) return; SkipToNextSong(); this->SetDirty(); break; - case MW_STOP: // stop playing + case WID_M_STOP: // stop playing _settings_client.music.playing = false; break; - case MW_PLAY: // start playing + case WID_M_PLAY: // start playing _settings_client.music.playing = true; break; - case MW_MUSIC_VOL: case MW_EFFECT_VOL: { // volume sliders + case WID_M_MUSIC_VOL: case WID_M_EFFECT_VOL: { // volume sliders int x = pt.x - this->GetWidget(widget)->pos_x; - byte *vol = (widget == MW_MUSIC_VOL) ? &_settings_client.music.music_vol : &_settings_client.music.effect_vol; + byte *vol = (widget == WID_M_MUSIC_VOL) ? &_settings_client.music.music_vol : &_settings_client.music.effect_vol; byte new_vol = x * 127 / this->GetWidget(widget)->current_x; if (_current_text_dir == TD_RTL) new_vol = 127 - new_vol; if (new_vol != *vol) { *vol = new_vol; - if (widget == MW_MUSIC_VOL) MusicVolumeChanged(new_vol); + if (widget == WID_M_MUSIC_VOL) MusicVolumeChanged(new_vol); this->SetDirty(); } @@ -654,22 +654,22 @@ struct MusicWindow : public Window { break; } - case MW_SHUFFLE: // toggle shuffle + case WID_M_SHUFFLE: // toggle shuffle _settings_client.music.shuffle ^= 1; - this->SetWidgetLoweredState(MW_SHUFFLE, _settings_client.music.shuffle); - this->SetWidgetDirty(MW_SHUFFLE); + this->SetWidgetLoweredState(WID_M_SHUFFLE, _settings_client.music.shuffle); + this->SetWidgetDirty(WID_M_SHUFFLE); StopMusic(); SelectSongToPlay(); this->SetDirty(); break; - case MW_PROGRAMME: // show track selection + case WID_M_PROGRAMME: // show track selection ShowMusicTrackSelection(); break; - case MW_ALL: case MW_OLD: case MW_NEW: - case MW_EZY: case MW_CUSTOM1: case MW_CUSTOM2: // playlist - SelectPlaylist(widget - MW_ALL); + case WID_M_ALL: case WID_M_OLD: case WID_M_NEW: + case WID_M_EZY: case WID_M_CUSTOM1: case WID_M_CUSTOM2: // playlist + SelectPlaylist(widget - WID_M_ALL); StopMusic(); SelectSongToPlay(); this->SetDirty(); @@ -688,18 +688,18 @@ static const NWidgetPart _nested_music_w NWidget(NWID_VERTICAL), NWidget(WWT_PANEL, COLOUR_GREY, -1), SetFill(1, 1), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, MW_PREV), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_SKIP_TO_PREV, STR_MUSIC_TOOLTIP_SKIP_TO_PREVIOUS_TRACK), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, MW_NEXT), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_SKIP_TO_NEXT, STR_MUSIC_TOOLTIP_SKIP_TO_NEXT_TRACK_IN_SELECTION), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, MW_STOP), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_STOP_MUSIC, STR_MUSIC_TOOLTIP_STOP_PLAYING_MUSIC), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, MW_PLAY), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_PLAY_MUSIC, STR_MUSIC_TOOLTIP_START_PLAYING_MUSIC), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_M_PREV), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_SKIP_TO_PREV, STR_MUSIC_TOOLTIP_SKIP_TO_PREVIOUS_TRACK), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_M_NEXT), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_SKIP_TO_NEXT, STR_MUSIC_TOOLTIP_SKIP_TO_NEXT_TRACK_IN_SELECTION), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_M_STOP), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_STOP_MUSIC, STR_MUSIC_TOOLTIP_STOP_PLAYING_MUSIC), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_M_PLAY), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_PLAY_MUSIC, STR_MUSIC_TOOLTIP_START_PLAYING_MUSIC), EndContainer(), NWidget(WWT_PANEL, COLOUR_GREY, -1), SetFill(1, 1), EndContainer(), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, MW_SLIDERS), + NWidget(WWT_PANEL, COLOUR_GREY, WID_M_SLIDERS), NWidget(NWID_HORIZONTAL), SetPIP(20, 20, 20), NWidget(NWID_VERTICAL), NWidget(WWT_LABEL, COLOUR_GREY, -1), SetFill(1, 0), SetDataTip(STR_MUSIC_MUSIC_VOLUME, STR_NULL), - NWidget(WWT_EMPTY, COLOUR_GREY, MW_MUSIC_VOL), SetMinimalSize(67, 0), SetMinimalTextLines(1, 0), SetFill(1, 0), SetDataTip(0x0, STR_MUSIC_TOOLTIP_DRAG_SLIDERS_TO_SET_MUSIC), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_M_MUSIC_VOL), SetMinimalSize(67, 0), SetMinimalTextLines(1, 0), SetFill(1, 0), SetDataTip(0x0, STR_MUSIC_TOOLTIP_DRAG_SLIDERS_TO_SET_MUSIC), NWidget(NWID_HORIZONTAL), NWidget(WWT_LABEL, COLOUR_GREY, -1), SetDataTip(STR_MUSIC_RULER_MIN, STR_NULL), NWidget(WWT_LABEL, COLOUR_GREY, -1), SetDataTip(STR_MUSIC_RULER_MARKER, STR_NULL), SetFill(1, 0), @@ -712,7 +712,7 @@ static const NWidgetPart _nested_music_w EndContainer(), NWidget(NWID_VERTICAL), NWidget(WWT_LABEL, COLOUR_GREY, -1), SetFill(1, 0), SetDataTip(STR_MUSIC_EFFECTS_VOLUME, STR_NULL), - NWidget(WWT_EMPTY, COLOUR_GREY, MW_EFFECT_VOL), SetMinimalSize(67, 0), SetMinimalTextLines(1, 0), SetFill(1, 0), SetDataTip(0x0, STR_MUSIC_TOOLTIP_DRAG_SLIDERS_TO_SET_MUSIC), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_M_EFFECT_VOL), SetMinimalSize(67, 0), SetMinimalTextLines(1, 0), SetFill(1, 0), SetDataTip(0x0, STR_MUSIC_TOOLTIP_DRAG_SLIDERS_TO_SET_MUSIC), NWidget(NWID_HORIZONTAL), NWidget(WWT_LABEL, COLOUR_GREY, -1), SetDataTip(STR_MUSIC_RULER_MIN, STR_NULL), NWidget(WWT_LABEL, COLOUR_GREY, -1), SetDataTip(STR_MUSIC_RULER_MARKER, STR_NULL), SetFill(1, 0), @@ -726,35 +726,35 @@ static const NWidgetPart _nested_music_w EndContainer(), EndContainer(), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, MW_BACKGROUND), + NWidget(WWT_PANEL, COLOUR_GREY, WID_M_BACKGROUND), NWidget(NWID_HORIZONTAL), SetPIP(6, 0, 6), NWidget(NWID_VERTICAL), NWidget(NWID_SPACER), SetFill(0, 1), - NWidget(WWT_TEXTBTN, COLOUR_GREY, MW_SHUFFLE), SetMinimalSize(50, 8), SetDataTip(STR_MUSIC_SHUFFLE, STR_MUSIC_TOOLTIP_TOGGLE_PROGRAM_SHUFFLE), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_M_SHUFFLE), SetMinimalSize(50, 8), SetDataTip(STR_MUSIC_SHUFFLE, STR_MUSIC_TOOLTIP_TOGGLE_PROGRAM_SHUFFLE), NWidget(NWID_SPACER), SetFill(0, 1), EndContainer(), NWidget(NWID_VERTICAL), SetPadding(0, 0, 3, 3), - NWidget(WWT_LABEL, COLOUR_GREY, MW_TRACK), SetFill(0, 0), SetDataTip(STR_MUSIC_TRACK, STR_NULL), - NWidget(WWT_PANEL, COLOUR_GREY, MW_TRACK_NR), EndContainer(), + NWidget(WWT_LABEL, COLOUR_GREY, WID_M_TRACK), SetFill(0, 0), SetDataTip(STR_MUSIC_TRACK, STR_NULL), + NWidget(WWT_PANEL, COLOUR_GREY, WID_M_TRACK_NR), EndContainer(), EndContainer(), NWidget(NWID_VERTICAL), SetPadding(0, 3, 3, 0), - NWidget(WWT_LABEL, COLOUR_GREY, MW_TRACK_TITLE), SetFill(1, 0), SetDataTip(STR_MUSIC_XTITLE, STR_NULL), - NWidget(WWT_PANEL, COLOUR_GREY, MW_TRACK_NAME), SetFill(1, 0), EndContainer(), + NWidget(WWT_LABEL, COLOUR_GREY, WID_M_TRACK_TITLE), SetFill(1, 0), SetDataTip(STR_MUSIC_XTITLE, STR_NULL), + NWidget(WWT_PANEL, COLOUR_GREY, WID_M_TRACK_NAME), SetFill(1, 0), EndContainer(), EndContainer(), NWidget(NWID_VERTICAL), NWidget(NWID_SPACER), SetFill(0, 1), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, MW_PROGRAMME), SetMinimalSize(50, 8), SetDataTip(STR_MUSIC_PROGRAM, STR_MUSIC_TOOLTIP_SHOW_MUSIC_TRACK_SELECTION), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_M_PROGRAMME), SetMinimalSize(50, 8), SetDataTip(STR_MUSIC_PROGRAM, STR_MUSIC_TOOLTIP_SHOW_MUSIC_TRACK_SELECTION), NWidget(NWID_SPACER), SetFill(0, 1), EndContainer(), EndContainer(), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_TEXTBTN, COLOUR_GREY, MW_ALL), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_ALL, STR_MUSIC_TOOLTIP_SELECT_ALL_TRACKS_PROGRAM), - NWidget(WWT_TEXTBTN, COLOUR_GREY, MW_OLD), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_OLD_STYLE, STR_MUSIC_TOOLTIP_SELECT_OLD_STYLE_MUSIC), - NWidget(WWT_TEXTBTN, COLOUR_GREY, MW_NEW), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_NEW_STYLE, STR_MUSIC_TOOLTIP_SELECT_NEW_STYLE_MUSIC), - NWidget(WWT_TEXTBTN, COLOUR_GREY, MW_EZY), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_EZY_STREET, STR_MUSIC_TOOLTIP_SELECT_EZY_STREET_STYLE), - NWidget(WWT_TEXTBTN, COLOUR_GREY, MW_CUSTOM1), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_CUSTOM_1, STR_MUSIC_TOOLTIP_SELECT_CUSTOM_1_USER_DEFINED), - NWidget(WWT_TEXTBTN, COLOUR_GREY, MW_CUSTOM2), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_CUSTOM_2, STR_MUSIC_TOOLTIP_SELECT_CUSTOM_2_USER_DEFINED), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_M_ALL), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_ALL, STR_MUSIC_TOOLTIP_SELECT_ALL_TRACKS_PROGRAM), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_M_OLD), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_OLD_STYLE, STR_MUSIC_TOOLTIP_SELECT_OLD_STYLE_MUSIC), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_M_NEW), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_NEW_STYLE, STR_MUSIC_TOOLTIP_SELECT_NEW_STYLE_MUSIC), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_M_EZY), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_EZY_STREET, STR_MUSIC_TOOLTIP_SELECT_EZY_STREET_STYLE), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_M_CUSTOM1), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_CUSTOM_1, STR_MUSIC_TOOLTIP_SELECT_CUSTOM_1_USER_DEFINED), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_M_CUSTOM2), SetFill(1, 0), SetDataTip(STR_MUSIC_PLAYLIST_CUSTOM_2, STR_MUSIC_TOOLTIP_SELECT_CUSTOM_2_USER_DEFINED), EndContainer(), }; diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -314,7 +314,7 @@ struct NetworkChatWindow : public QueryS this->InitNested(desc, type); - this->SetFocusedWidget(NWCW_TEXTBOX); + this->SetFocusedWidget(WID_NC_TEXTBOX); InvalidateWindowData(WC_NEWS_WINDOW, 0, this->height); _chat_tab_completion_active = false; @@ -468,7 +468,7 @@ struct NetworkChatWindow : public QueryS virtual void OnPaint() { this->DrawWidgets(); - this->DrawEditBox(NWCW_TEXTBOX); + this->DrawEditBox(WID_NC_TEXTBOX); } virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number) @@ -479,7 +479,7 @@ struct NetworkChatWindow : public QueryS virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { - if (widget != NWCW_DESTINATION) return; + if (widget != WID_NC_DESTINATION) return; if (this->dtype == DESTTYPE_CLIENT) { SetDParamStr(0, NetworkClientInfo::GetByClientID((ClientID)this->dest)->client_name); @@ -492,7 +492,7 @@ struct NetworkChatWindow : public QueryS virtual void DrawWidget(const Rect &r, int widget) const { - if (widget != NWCW_DESTINATION) return; + if (widget != WID_NC_DESTINATION) return; if (this->dtype == DESTTYPE_CLIENT) { SetDParamStr(0, NetworkClientInfo::GetByClientID((ClientID)this->dest)->client_name); @@ -504,15 +504,15 @@ struct NetworkChatWindow : public QueryS { switch (widget) { /* Send */ - case NWCW_SENDBUTTON: SendChat(this->text.buf, this->dtype, this->dest); + case WID_NC_SENDBUTTON: SendChat(this->text.buf, this->dtype, this->dest); /* FALL THROUGH */ - case NWCW_CLOSE: /* Cancel */ delete this; break; + case WID_NC_CLOSE: /* Cancel */ delete this; break; } } virtual void OnMouseLoop() { - this->HandleEditBox(NWCW_TEXTBOX); + this->HandleEditBox(WID_NC_TEXTBOX); } virtual EventState OnKeyPress(uint16 key, uint16 keycode) @@ -523,7 +523,7 @@ struct NetworkChatWindow : public QueryS state = ES_HANDLED; } else { _chat_tab_completion_active = false; - switch (this->HandleEditBoxKey(NWCW_TEXTBOX, key, keycode, state)) { + switch (this->HandleEditBoxKey(WID_NC_TEXTBOX, key, keycode, state)) { default: NOT_REACHED(); case HEBR_EDITING: { Window *osk = FindWindowById(WC_OSK, 0); @@ -542,7 +542,7 @@ struct NetworkChatWindow : public QueryS virtual void OnOpenOSKWindow(int wid) { - ShowOnScreenKeyboard(this, wid, NWCW_CLOSE, NWCW_SENDBUTTON); + ShowOnScreenKeyboard(this, wid, WID_NC_CLOSE, WID_NC_SENDBUTTON); } /** @@ -559,13 +559,13 @@ struct NetworkChatWindow : public QueryS /** The widgets of the chat window. */ static const NWidgetPart _nested_chat_window_widgets[] = { NWidget(NWID_HORIZONTAL), - NWidget(WWT_CLOSEBOX, COLOUR_GREY, NWCW_CLOSE), - NWidget(WWT_PANEL, COLOUR_GREY, NWCW_BACKGROUND), + NWidget(WWT_CLOSEBOX, COLOUR_GREY, WID_NC_CLOSE), + NWidget(WWT_PANEL, COLOUR_GREY, WID_NC_BACKGROUND), NWidget(NWID_HORIZONTAL), - NWidget(WWT_TEXT, COLOUR_GREY, NWCW_DESTINATION), SetMinimalSize(62, 12), SetPadding(1, 0, 1, 0), SetDataTip(STR_NULL, STR_NULL), - NWidget(WWT_EDITBOX, COLOUR_GREY, NWCW_TEXTBOX), SetMinimalSize(100, 12), SetPadding(1, 0, 1, 0), SetResize(1, 0), + NWidget(WWT_TEXT, COLOUR_GREY, WID_NC_DESTINATION), SetMinimalSize(62, 12), SetPadding(1, 0, 1, 0), SetDataTip(STR_NULL, STR_NULL), + NWidget(WWT_EDITBOX, COLOUR_GREY, WID_NC_TEXTBOX), SetMinimalSize(100, 12), SetPadding(1, 0, 1, 0), SetResize(1, 0), SetDataTip(STR_NETWORK_CHAT_OSKTITLE, STR_NULL), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, NWCW_SENDBUTTON), SetMinimalSize(62, 12), SetPadding(1, 0, 1, 0), SetDataTip(STR_NETWORK_CHAT_SEND, STR_NULL), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_NC_SENDBUTTON), SetMinimalSize(62, 12), SetPadding(1, 0, 1, 0), SetDataTip(STR_NETWORK_CHAT_SEND, STR_NULL), EndContainer(), EndContainer(), EndContainer(), diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -30,11 +30,11 @@ /** Nested widgets for the download window. */ static const NWidgetPart _nested_network_content_download_status_window_widgets[] = { NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_CONTENT_DOWNLOAD_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), - NWidget(WWT_PANEL, COLOUR_GREY, NCDSWW_BACKGROUND), + NWidget(WWT_PANEL, COLOUR_GREY, WID_NCDS_BACKGROUND), NWidget(NWID_SPACER), SetMinimalSize(350, 0), SetMinimalTextLines(3, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 30), NWidget(NWID_HORIZONTAL), NWidget(NWID_SPACER), SetMinimalSize(125, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCDSWW_CANCELOK), SetMinimalSize(101, 12), SetDataTip(STR_BUTTON_CANCEL, STR_NULL), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCDS_CANCELOK), SetMinimalSize(101, 12), SetDataTip(STR_BUTTON_CANCEL, STR_NULL), NWidget(NWID_SPACER), SetFill(1, 0), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 4), @@ -65,7 +65,7 @@ BaseNetworkContentDownloadStatusWindow:: /* virtual */ void BaseNetworkContentDownloadStatusWindow::DrawWidget(const Rect &r, int widget) const { - if (widget != NCDSWW_BACKGROUND) return; + if (widget != WID_NCDS_BACKGROUND) return; /* Draw nice progress bar :) */ DrawFrameRect(r.left + 20, r.top + 4, r.left + 20 + (int)((this->width - 40LL) * this->downloaded_bytes / this->total_bytes), r.top + 14, COLOUR_MAUVE, FR_NONE); @@ -198,7 +198,7 @@ public: virtual void OnClick(Point pt, int widget, int click_count) { - if (widget == NCDSWW_CANCELOK) { + if (widget == WID_NCDS_CANCELOK) { if (this->downloaded_bytes != this->total_bytes) { _network_content_client.Close(); delete this; @@ -217,7 +217,7 @@ public: /* When downloading is finished change cancel in ok */ if (this->downloaded_bytes == this->total_bytes) { - this->GetWidget(NCDSWW_CANCELOK)->widget_data = STR_BUTTON_OK; + this->GetWidget(WID_NCDS_CANCELOK)->widget_data = STR_BUTTON_OK; } } }; @@ -356,14 +356,14 @@ public: list_pos(0) { this->CreateNestedTree(desc); - this->vscroll = this->GetScrollbar(NCLWW_SCROLLBAR); + this->vscroll = this->GetScrollbar(WID_NCL_SCROLLBAR); this->FinishInitNested(desc, 1); - this->GetWidget(NCLWW_SEL_ALL_UPDATE)->SetDisplayedPlane(select_all); + this->GetWidget(WID_NCL_SEL_ALL_UPDATE)->SetDisplayedPlane(select_all); this->afilter = CS_ALPHANUMERAL; InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, EDITBOX_MAX_LENGTH); - this->SetFocusedWidget(NCLWW_FILTER); + this->SetFocusedWidget(WID_NCL_FILTER); _network_content_client.AddCallback(this); this->content.SetListing(this->last_sorting); @@ -385,11 +385,11 @@ public: virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case NCLWW_FILTER_CAPT: + case WID_NCL_FILTER_CAPT: *size = maxdim(*size, GetStringBoundingBox(STR_CONTENT_FILTER_TITLE)); break; - case NCLWW_TYPE: { + case WID_NCL_TYPE: { Dimension d = *size; for (int i = CONTENT_TYPE_BEGIN; i < CONTENT_TYPE_END; i++) { d = maxdim(d, GetStringBoundingBox(STR_CONTENT_TYPE_BASE_GRAPHICS + i - CONTENT_TYPE_BASE_GRAPHICS)); @@ -398,7 +398,7 @@ public: break; } - case NCLWW_MATRIX: + case WID_NCL_MATRIX: resize->height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; size->height = 10 * resize->height; break; @@ -409,15 +409,15 @@ public: virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case NCLWW_FILTER_CAPT: + case WID_NCL_FILTER_CAPT: DrawString(r.left, r.right, r.top, STR_CONTENT_FILTER_TITLE, TC_FROMSTRING, SA_RIGHT); break; - case NCLWW_DETAILS: + case WID_NCL_DETAILS: this->DrawDetails(r); break; - case NCLWW_MATRIX: + case WID_NCL_MATRIX: this->DrawMatrix(r); break; } @@ -434,12 +434,12 @@ public: this->DrawWidgets(); /* Edit box to filter for keywords */ - this->DrawEditBox(NCLWW_FILTER); + this->DrawEditBox(WID_NCL_FILTER); switch (this->content.SortType()) { - case NCLWW_CHECKBOX - NCLWW_CHECKBOX: this->DrawSortButtonState(NCLWW_CHECKBOX, arrow); break; - case NCLWW_TYPE - NCLWW_CHECKBOX: this->DrawSortButtonState(NCLWW_TYPE, arrow); break; - case NCLWW_NAME - NCLWW_CHECKBOX: this->DrawSortButtonState(NCLWW_NAME, arrow); break; + case WID_NCL_CHECKBOX - WID_NCL_CHECKBOX: this->DrawSortButtonState(WID_NCL_CHECKBOX, arrow); break; + case WID_NCL_TYPE - WID_NCL_CHECKBOX: this->DrawSortButtonState(WID_NCL_TYPE, arrow); break; + case WID_NCL_NAME - WID_NCL_CHECKBOX: this->DrawSortButtonState(WID_NCL_NAME, arrow); break; } } @@ -449,9 +449,9 @@ public: */ void DrawMatrix(const Rect &r) const { - const NWidgetBase *nwi_checkbox = this->GetWidget(NCLWW_CHECKBOX); - const NWidgetBase *nwi_name = this->GetWidget(NCLWW_NAME); - const NWidgetBase *nwi_type = this->GetWidget(NCLWW_TYPE); + const NWidgetBase *nwi_checkbox = this->GetWidget(WID_NCL_CHECKBOX); + const NWidgetBase *nwi_name = this->GetWidget(WID_NCL_NAME); + const NWidgetBase *nwi_type = this->GetWidget(WID_NCL_TYPE); /* Fill the matrix with the information */ @@ -599,14 +599,14 @@ public: virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case NCLWW_MATRIX: { - uint id_v = this->vscroll->GetScrolledRowFromWidget(pt.y, this, NCLWW_MATRIX); + case WID_NCL_MATRIX: { + uint id_v = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_NCL_MATRIX); if (id_v >= this->content.Length()) return; // click out of bounds this->selected = *this->content.Get(id_v); this->list_pos = id_v; - const NWidgetBase *checkbox = this->GetWidget(NCLWW_CHECKBOX); + const NWidgetBase *checkbox = this->GetWidget(WID_NCL_CHECKBOX); if (click_count > 1 || IsInsideBS(pt.x, checkbox->pos_x, checkbox->current_x)) { _network_content_client.ToggleSelectedState(this->selected); this->content.ForceResort(); @@ -616,14 +616,14 @@ public: break; } - case NCLWW_CHECKBOX: - case NCLWW_TYPE: - case NCLWW_NAME: - if (this->content.SortType() == widget - NCLWW_CHECKBOX) { + case WID_NCL_CHECKBOX: + case WID_NCL_TYPE: + case WID_NCL_NAME: + if (this->content.SortType() == widget - WID_NCL_CHECKBOX) { this->content.ToggleSortOrder(); this->list_pos = this->content.Length() - this->list_pos - 1; } else { - this->content.SetSortType(widget - NCLWW_CHECKBOX); + this->content.SetSortType(widget - WID_NCL_CHECKBOX); this->content.ForceResort(); this->SortContentList(); } @@ -631,33 +631,33 @@ public: this->InvalidateData(); break; - case NCLWW_SELECT_ALL: + case WID_NCL_SELECT_ALL: _network_content_client.SelectAll(); this->InvalidateData(); break; - case NCLWW_SELECT_UPDATE: + case WID_NCL_SELECT_UPDATE: _network_content_client.SelectUpgrade(); this->InvalidateData(); break; - case NCLWW_UNSELECT: + case WID_NCL_UNSELECT: _network_content_client.UnselectAll(); this->InvalidateData(); break; - case NCLWW_CANCEL: + case WID_NCL_CANCEL: delete this; break; - case NCLWW_OPEN_URL: + case WID_NCL_OPEN_URL: if (this->selected != NULL) { extern void OpenBrowser(const char *url); OpenBrowser(this->selected->url); } break; - case NCLWW_DOWNLOAD: + case WID_NCL_DOWNLOAD: if (BringWindowToFrontById(WC_NETWORK_STATUS_WINDOW, 0) == NULL) new NetworkContentDownloadStatusWindow(); break; } @@ -665,7 +665,7 @@ public: virtual void OnMouseLoop() { - this->HandleEditBox(NCLWW_FILTER); + this->HandleEditBox(WID_NCL_FILTER); } virtual EventState OnKeyPress(uint16 key, uint16 keycode) @@ -698,7 +698,7 @@ public: case WKC_SPACE: case WKC_RETURN: - if (keycode == WKC_RETURN || !IsWidgetFocused(NCLWW_FILTER)) { + if (keycode == WKC_RETURN || !IsWidgetFocused(WID_NCL_FILTER)) { if (this->selected != NULL) { _network_content_client.ToggleSelectedState(this->selected); this->content.ForceResort(); @@ -711,8 +711,8 @@ public: default: { /* Handle editbox input */ EventState state = ES_NOT_HANDLED; - if (this->HandleEditBoxKey(NCLWW_FILTER, key, keycode, state) == HEBR_EDITING) { - this->OnOSKInput(NCLWW_FILTER); + if (this->HandleEditBoxKey(WID_NCL_FILTER, key, keycode, state) == HEBR_EDITING) { + this->OnOSKInput(WID_NCL_FILTER); } return state; @@ -740,8 +740,8 @@ public: virtual void OnResize() { - this->vscroll->SetCapacityFromWidget(this, NCLWW_MATRIX); - this->GetWidget(NCLWW_MATRIX)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); + this->vscroll->SetCapacityFromWidget(this, WID_NCL_MATRIX); + this->GetWidget(WID_NCL_MATRIX)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); } virtual void OnReceiveContentInfo(const ContentInfo *rci) @@ -801,13 +801,13 @@ public: } /* If data == 2 then the status window caused this OnInvalidate */ - this->SetWidgetDisabledState(NCLWW_DOWNLOAD, this->filesize_sum == 0 || (FindWindowById(WC_NETWORK_STATUS_WINDOW, 0) != NULL && data != 2)); - this->SetWidgetDisabledState(NCLWW_UNSELECT, this->filesize_sum == 0); - this->SetWidgetDisabledState(NCLWW_SELECT_ALL, !show_select_all); - this->SetWidgetDisabledState(NCLWW_SELECT_UPDATE, !show_select_upgrade); - this->SetWidgetDisabledState(NCLWW_OPEN_URL, this->selected == NULL || StrEmpty(this->selected->url)); + this->SetWidgetDisabledState(WID_NCL_DOWNLOAD, this->filesize_sum == 0 || (FindWindowById(WC_NETWORK_STATUS_WINDOW, 0) != NULL && data != 2)); + this->SetWidgetDisabledState(WID_NCL_UNSELECT, this->filesize_sum == 0); + this->SetWidgetDisabledState(WID_NCL_SELECT_ALL, !show_select_all); + this->SetWidgetDisabledState(WID_NCL_SELECT_UPDATE, !show_select_upgrade); + this->SetWidgetDisabledState(WID_NCL_OPEN_URL, this->selected == NULL || StrEmpty(this->selected->url)); - this->GetWidget(NCLWW_CANCEL)->widget_data = this->filesize_sum == 0 ? STR_AI_SETTINGS_CLOSE : STR_AI_LIST_CANCEL; + this->GetWidget(WID_NCL_CANCEL)->widget_data = this->filesize_sum == 0 ? STR_AI_SETTINGS_CLOSE : STR_AI_LIST_CANCEL; } }; @@ -830,12 +830,12 @@ static const NWidgetPart _nested_network NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE), NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetDataTip(STR_CONTENT_TITLE, STR_NULL), EndContainer(), - NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NCLWW_BACKGROUND), + NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, WID_NCL_BACKGROUND), NWidget(NWID_SPACER), SetMinimalSize(0, 7), SetResize(1, 0), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(8, 8, 8), /* Top */ - NWidget(WWT_EMPTY, COLOUR_LIGHT_BLUE, NCLWW_FILTER_CAPT), SetFill(1, 0), SetResize(1, 0), - NWidget(WWT_EDITBOX, COLOUR_LIGHT_BLUE, NCLWW_FILTER), SetFill(1, 0), SetResize(1, 0), + NWidget(WWT_EMPTY, COLOUR_LIGHT_BLUE, WID_NCL_FILTER_CAPT), SetFill(1, 0), SetResize(1, 0), + NWidget(WWT_EDITBOX, COLOUR_LIGHT_BLUE, WID_NCL_FILTER), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 7), SetResize(1, 0), @@ -845,41 +845,41 @@ static const NWidgetPart _nested_network NWidget(NWID_HORIZONTAL), NWidget(NWID_VERTICAL), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_CHECKBOX), SetMinimalSize(13, 1), SetDataTip(STR_EMPTY, STR_NULL), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_TYPE), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_CHECKBOX), SetMinimalSize(13, 1), SetDataTip(STR_EMPTY, STR_NULL), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_TYPE), SetDataTip(STR_CONTENT_TYPE_CAPTION, STR_CONTENT_TYPE_CAPTION_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_NAME), SetResize(1, 0), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_NAME), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_CONTENT_NAME_CAPTION, STR_CONTENT_NAME_CAPTION_TOOLTIP), EndContainer(), - NWidget(WWT_MATRIX, COLOUR_LIGHT_BLUE, NCLWW_MATRIX), SetResize(1, 14), SetFill(1, 1), SetScrollbar(NCLWW_SCROLLBAR), SetDataTip(STR_NULL, STR_CONTENT_MATRIX_TOOLTIP), + NWidget(WWT_MATRIX, COLOUR_LIGHT_BLUE, WID_NCL_MATRIX), SetResize(1, 14), SetFill(1, 1), SetScrollbar(WID_NCL_SCROLLBAR), SetDataTip(STR_NULL, STR_CONTENT_MATRIX_TOOLTIP), EndContainer(), - NWidget(NWID_VSCROLLBAR, COLOUR_LIGHT_BLUE, NCLWW_SCROLLBAR), + NWidget(NWID_VSCROLLBAR, COLOUR_LIGHT_BLUE, WID_NCL_SCROLLBAR), EndContainer(), EndContainer(), /* Right side. */ NWidget(NWID_VERTICAL), - NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NCLWW_DETAILS), SetResize(1, 1), SetFill(1, 1), EndContainer(), + NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, WID_NCL_DETAILS), SetResize(1, 1), SetFill(1, 1), EndContainer(), EndContainer(), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 7), SetResize(1, 0), /* Bottom. */ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(8, 8, 8), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(8, 8, 8), - NWidget(NWID_SELECTION, INVALID_COLOUR, NCLWW_SEL_ALL_UPDATE), SetResize(1, 0), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_SELECT_UPDATE), SetResize(1, 0), SetFill(1, 0), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_NCL_SEL_ALL_UPDATE), SetResize(1, 0), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_SELECT_UPDATE), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_CONTENT_SELECT_UPDATES_CAPTION, STR_CONTENT_SELECT_UPDATES_CAPTION_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_SELECT_ALL), SetResize(1, 0), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_SELECT_ALL), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_CONTENT_SELECT_ALL_CAPTION, STR_CONTENT_SELECT_ALL_CAPTION_TOOLTIP), EndContainer(), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_UNSELECT), SetResize(1, 0), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_UNSELECT), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_CONTENT_UNSELECT_ALL_CAPTION, STR_CONTENT_UNSELECT_ALL_CAPTION_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(8, 8, 8), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_OPEN_URL), SetResize(1, 0), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_OPEN_URL), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_CONTENT_OPEN_URL, STR_CONTENT_OPEN_URL_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_CANCEL), SetResize(1, 0), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_CANCEL), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_NULL), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NCLWW_DOWNLOAD), SetResize(1, 0), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_DOWNLOAD), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_CONTENT_DOWNLOAD_CAPTION, STR_CONTENT_DOWNLOAD_CAPTION_TOOLTIP), EndContainer(), EndContainer(), diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -88,17 +88,17 @@ class NWidgetServerListHeader : public N public: NWidgetServerListHeader() : NWidgetContainer(NWID_HORIZONTAL) { - NWidgetLeaf *leaf = new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_NAME, STR_NETWORK_SERVER_LIST_GAME_NAME, STR_NETWORK_SERVER_LIST_GAME_NAME_TOOLTIP); + NWidgetLeaf *leaf = new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_NAME, STR_NETWORK_SERVER_LIST_GAME_NAME, STR_NETWORK_SERVER_LIST_GAME_NAME_TOOLTIP); leaf->SetResize(1, 0); leaf->SetFill(1, 0); this->Add(leaf); - this->Add(new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_CLIENTS, STR_NETWORK_SERVER_LIST_CLIENTS_CAPTION, STR_NETWORK_SERVER_LIST_CLIENTS_CAPTION_TOOLTIP)); - this->Add(new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_MAPSIZE, STR_NETWORK_SERVER_LIST_MAP_SIZE_CAPTION, STR_NETWORK_SERVER_LIST_MAP_SIZE_CAPTION_TOOLTIP)); - this->Add(new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_DATE, STR_NETWORK_SERVER_LIST_DATE_CAPTION, STR_NETWORK_SERVER_LIST_DATE_CAPTION_TOOLTIP)); - this->Add(new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_YEARS, STR_NETWORK_SERVER_LIST_YEARS_CAPTION, STR_NETWORK_SERVER_LIST_YEARS_CAPTION_TOOLTIP)); + this->Add(new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_CLIENTS, STR_NETWORK_SERVER_LIST_CLIENTS_CAPTION, STR_NETWORK_SERVER_LIST_CLIENTS_CAPTION_TOOLTIP)); + this->Add(new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_MAPSIZE, STR_NETWORK_SERVER_LIST_MAP_SIZE_CAPTION, STR_NETWORK_SERVER_LIST_MAP_SIZE_CAPTION_TOOLTIP)); + this->Add(new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_DATE, STR_NETWORK_SERVER_LIST_DATE_CAPTION, STR_NETWORK_SERVER_LIST_DATE_CAPTION_TOOLTIP)); + this->Add(new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_YEARS, STR_NETWORK_SERVER_LIST_YEARS_CAPTION, STR_NETWORK_SERVER_LIST_YEARS_CAPTION_TOOLTIP)); - leaf = new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_INFO, STR_EMPTY, STR_NETWORK_SERVER_LIST_INFO_ICONS_TOOLTIP); + leaf = new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_INFO, STR_EMPTY, STR_NETWORK_SERVER_LIST_INFO_ICONS_TOOLTIP); leaf->SetMinimalSize(40, 12); leaf->SetFill(0, 1); this->Add(leaf); @@ -111,7 +111,7 @@ public: void SetupSmallestSize(Window *w, bool init_array) { /* Oh yeah, we ought to be findable! */ - w->nested_array[NGWW_HEADER] = this; + w->nested_array[WID_NG_HEADER] = this; this->smallest_x = this->head->smallest_x + this->tail->smallest_x; // First and last are always shown, rest not this->smallest_y = 0; // Biggest child. @@ -201,10 +201,10 @@ public: * @param widget the widget to check for visibility * @return true iff the widget is visible. */ - bool IsWidgetVisible(NetworkGameWindowWidgets widget) const + bool IsWidgetVisible(NetworkGameWidgets widget) const { - assert((uint)(widget - NGWW_NAME) < lengthof(this->visible)); - return this->visible[widget - NGWW_NAME]; + assert((uint)(widget - WID_NG_NAME) < lengthof(this->visible)); + return this->visible[widget - WID_NG_NAME]; } }; @@ -345,8 +345,8 @@ protected: */ void DrawServerLine(const NetworkGameList *cur_item, uint y, bool highlight) const { - const NWidgetBase *nwi_name = this->GetWidget(NGWW_NAME); - const NWidgetBase *nwi_info = this->GetWidget(NGWW_INFO); + const NWidgetBase *nwi_name = this->GetWidget(WID_NG_NAME); + const NWidgetBase *nwi_info = this->GetWidget(WID_NG_INFO); /* show highlighted item with a different colour */ if (highlight) GfxFillRect(nwi_name->pos_x + 1, y - 2, nwi_info->pos_x + nwi_info->current_x - 2, y + FONT_HEIGHT_NORMAL - 1, PC_GREY); @@ -355,10 +355,10 @@ protected: /* only draw details if the server is online */ if (cur_item->online) { - const NWidgetServerListHeader *nwi_header = this->GetWidget(NGWW_HEADER); + const NWidgetServerListHeader *nwi_header = this->GetWidget(WID_NG_HEADER); - if (nwi_header->IsWidgetVisible(NGWW_CLIENTS)) { - const NWidgetBase *nwi_clients = this->GetWidget(NGWW_CLIENTS); + if (nwi_header->IsWidgetVisible(WID_NG_CLIENTS)) { + const NWidgetBase *nwi_clients = this->GetWidget(WID_NG_CLIENTS); SetDParam(0, cur_item->info.clients_on); SetDParam(1, cur_item->info.clients_max); SetDParam(2, cur_item->info.companies_on); @@ -366,26 +366,26 @@ protected: DrawString(nwi_clients->pos_x, nwi_clients->pos_x + nwi_clients->current_x - 1, y, STR_NETWORK_SERVER_LIST_GENERAL_ONLINE, TC_FROMSTRING, SA_HOR_CENTER); } - if (nwi_header->IsWidgetVisible(NGWW_MAPSIZE)) { + if (nwi_header->IsWidgetVisible(WID_NG_MAPSIZE)) { /* map size */ - const NWidgetBase *nwi_mapsize = this->GetWidget(NGWW_MAPSIZE); + const NWidgetBase *nwi_mapsize = this->GetWidget(WID_NG_MAPSIZE); SetDParam(0, cur_item->info.map_width); SetDParam(1, cur_item->info.map_height); DrawString(nwi_mapsize->pos_x, nwi_mapsize->pos_x + nwi_mapsize->current_x - 1, y, STR_NETWORK_SERVER_LIST_MAP_SIZE_SHORT, TC_FROMSTRING, SA_HOR_CENTER); } - if (nwi_header->IsWidgetVisible(NGWW_DATE)) { + if (nwi_header->IsWidgetVisible(WID_NG_DATE)) { /* current date */ - const NWidgetBase *nwi_date = this->GetWidget(NGWW_DATE); + const NWidgetBase *nwi_date = this->GetWidget(WID_NG_DATE); YearMonthDay ymd; ConvertDateToYMD(cur_item->info.game_date, &ymd); SetDParam(0, ymd.year); DrawString(nwi_date->pos_x, nwi_date->pos_x + nwi_date->current_x - 1, y, STR_JUST_INT, TC_BLACK, SA_HOR_CENTER); } - if (nwi_header->IsWidgetVisible(NGWW_YEARS)) { + if (nwi_header->IsWidgetVisible(WID_NG_YEARS)) { /* number of years the game is running */ - const NWidgetBase *nwi_years = this->GetWidget(NGWW_YEARS); + const NWidgetBase *nwi_years = this->GetWidget(WID_NG_YEARS); YearMonthDay ymd_cur, ymd_start; ConvertDateToYMD(cur_item->info.game_date, &ymd_cur); ConvertDateToYMD(cur_item->info.start_date, &ymd_start); @@ -424,17 +424,17 @@ public: NetworkGameWindow(const WindowDesc *desc) : QueryStringBaseWindow(NETWORK_CLIENT_NAME_LENGTH) { this->CreateNestedTree(desc); - this->vscroll = this->GetScrollbar(NGWW_SCROLLBAR); + this->vscroll = this->GetScrollbar(WID_NG_SCROLLBAR); this->FinishInitNested(desc, 0); ttd_strlcpy(this->edit_str_buf, _settings_client.network.client_name, this->edit_str_size); this->afilter = CS_ALPHANUMERAL; InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, 120); - this->SetFocusedWidget(NGWW_CLIENT); + this->SetFocusedWidget(WID_NG_CLIENT); UpdateNetworkGameWindow(true); - this->field = NGWW_CLIENT; + this->field = WID_NG_CLIENT; this->last_joined = NetworkGameListAddItem(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); this->server = this->last_joined; @@ -452,7 +452,7 @@ public: virtual void SetStringParameters(int widget) const { switch (widget) { - case NGWW_CONN_BTN: + case WID_NG_CONN_BTN: SetDParam(0, _lan_internet_types_dropdown[_settings_client.network.lan_internet]); break; } @@ -461,30 +461,30 @@ public: virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case NGWW_CONN_BTN: + case WID_NG_CONN_BTN: *size = maxdim(GetStringBoundingBox(_lan_internet_types_dropdown[0]), GetStringBoundingBox(_lan_internet_types_dropdown[1])); size->width += padding.width; size->height += padding.height; break; - case NGWW_MATRIX: + case WID_NG_MATRIX: resize->height = WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM; size->height = 10 * resize->height; break; - case NGWW_LASTJOINED: + case WID_NG_LASTJOINED: size->height = WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM; break; - case NGWW_LASTJOINED_SPACER: + case WID_NG_LASTJOINED_SPACER: size->width = NWidgetScrollbar::GetVerticalDimension().width; break; - case NGWW_NAME: + case WID_NG_NAME: size->width += 2 * WD_SORTBUTTON_ARROW_WIDTH; // Make space for the arrow break; - case NGWW_CLIENTS: + case WID_NG_CLIENTS: size->width += 2 * WD_SORTBUTTON_ARROW_WIDTH; // Make space for the arrow SetDParam(0, 255); SetDParam(1, 255); @@ -493,21 +493,21 @@ public: *size = maxdim(*size, GetStringBoundingBox(STR_NETWORK_SERVER_LIST_GENERAL_ONLINE)); break; - case NGWW_MAPSIZE: + case WID_NG_MAPSIZE: size->width += 2 * WD_SORTBUTTON_ARROW_WIDTH; // Make space for the arrow SetDParam(0, 2048); SetDParam(1, 2048); *size = maxdim(*size, GetStringBoundingBox(STR_NETWORK_SERVER_LIST_MAP_SIZE_SHORT)); break; - case NGWW_DATE: - case NGWW_YEARS: + case WID_NG_DATE: + case WID_NG_YEARS: size->width += 2 * WD_SORTBUTTON_ARROW_WIDTH; // Make space for the arrow SetDParam(0, 99999); *size = maxdim(*size, GetStringBoundingBox(STR_JUST_INT)); break; - case NGWW_DETAILS_SPACER: + case WID_NG_DETAILS_SPACER: size->height = 20 + 12 * FONT_HEIGHT_NORMAL; break; } @@ -516,7 +516,7 @@ public: virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case NGWW_MATRIX: { + case WID_NG_MATRIX: { uint16 y = r.top + WD_MATRIX_TOP; const int max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (int)this->servers.Length()); @@ -529,22 +529,22 @@ public: break; } - case NGWW_LASTJOINED: + case WID_NG_LASTJOINED: /* Draw the last joined server, if any */ if (this->last_joined != NULL) this->DrawServerLine(this->last_joined, r.top + WD_MATRIX_TOP, this->last_joined == this->server); break; - case NGWW_DETAILS: + case WID_NG_DETAILS: this->DrawDetails(r); break; - case NGWW_NAME: - case NGWW_CLIENTS: - case NGWW_MAPSIZE: - case NGWW_DATE: - case NGWW_YEARS: - case NGWW_INFO: - if (widget - NGWW_NAME == this->servers.SortType()) this->DrawSortButtonState(widget, this->servers.IsDescSortOrder() ? SBS_DOWN : SBS_UP); + case WID_NG_NAME: + case WID_NG_CLIENTS: + case WID_NG_MAPSIZE: + case WID_NG_DATE: + case WID_NG_YEARS: + case WID_NG_INFO: + if (widget - WID_NG_NAME == this->servers.SortType()) this->DrawSortButtonState(widget, this->servers.IsDescSortOrder() ? SBS_DOWN : SBS_UP); break; } } @@ -559,20 +559,20 @@ public: NetworkGameList *sel = this->server; /* 'Refresh' button invisible if no server selected */ - this->SetWidgetDisabledState(NGWW_REFRESH, sel == NULL); + this->SetWidgetDisabledState(WID_NG_REFRESH, sel == NULL); /* 'Join' button disabling conditions */ - this->SetWidgetDisabledState(NGWW_JOIN, sel == NULL || // no Selected Server + this->SetWidgetDisabledState(WID_NG_JOIN, sel == NULL || // no Selected Server !sel->online || // Server offline sel->info.clients_on >= sel->info.clients_max || // Server full !sel->info.compatible); // Revision mismatch /* 'NewGRF Settings' button invisible if no NewGRF is used */ - this->GetWidget(NGWW_NEWGRF_SEL)->SetDisplayedPlane(sel == NULL || !sel->online || sel->info.grfconfig == NULL); - this->GetWidget(NGWW_NEWGRF_MISSING_SEL)->SetDisplayedPlane(sel == NULL || !sel->online || sel->info.grfconfig == NULL || !sel->info.version_compatible || sel->info.compatible); + this->GetWidget(WID_NG_NEWGRF_SEL)->SetDisplayedPlane(sel == NULL || !sel->online || sel->info.grfconfig == NULL); + this->GetWidget(WID_NG_NEWGRF_MISSING_SEL)->SetDisplayedPlane(sel == NULL || !sel->online || sel->info.grfconfig == NULL || !sel->info.version_compatible || sel->info.compatible); this->DrawWidgets(); /* Edit box to set client name */ - this->DrawEditBox(NGWW_CLIENT); + this->DrawEditBox(WID_NG_CLIENT); } void DrawDetails(const Rect &r) const @@ -650,25 +650,25 @@ public: { this->field = widget; switch (widget) { - case NGWW_CANCEL: // Cancel button + case WID_NG_CANCEL: // Cancel button DeleteWindowById(WC_NETWORK_WINDOW, 0); break; - case NGWW_CONN_BTN: // 'Connection' droplist - ShowDropDownMenu(this, _lan_internet_types_dropdown, _settings_client.network.lan_internet, NGWW_CONN_BTN, 0, 0); // do it for widget NSSW_CONN_BTN + case WID_NG_CONN_BTN: // 'Connection' droplist + ShowDropDownMenu(this, _lan_internet_types_dropdown, _settings_client.network.lan_internet, WID_NG_CONN_BTN, 0, 0); // do it for widget WID_NSS_CONN_BTN break; - case NGWW_NAME: // Sort by name - case NGWW_CLIENTS: // Sort by connected clients - case NGWW_MAPSIZE: // Sort by map size - case NGWW_DATE: // Sort by date - case NGWW_YEARS: // Sort by years - case NGWW_INFO: // Connectivity (green dot) - if (this->servers.SortType() == widget - NGWW_NAME) { + case WID_NG_NAME: // Sort by name + case WID_NG_CLIENTS: // Sort by connected clients + case WID_NG_MAPSIZE: // Sort by map size + case WID_NG_DATE: // Sort by date + case WID_NG_YEARS: // Sort by years + case WID_NG_INFO: // Connectivity (green dot) + if (this->servers.SortType() == widget - WID_NG_NAME) { this->servers.ToggleSortOrder(); if (this->list_pos != SLP_INVALID) this->list_pos = this->servers.Length() - this->list_pos - 1; } else { - this->servers.SetSortType(widget - NGWW_NAME); + this->servers.SetSortType(widget - WID_NG_NAME); this->servers.ForceResort(); this->SortNetworkGameList(); } @@ -676,18 +676,18 @@ public: this->SetDirty(); break; - case NGWW_MATRIX: { // Matrix to show networkgames - uint id_v = this->vscroll->GetScrolledRowFromWidget(pt.y, this, NGWW_MATRIX); + case WID_NG_MATRIX: { // Matrix to show networkgames + uint id_v = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_NG_MATRIX); this->server = (id_v < this->servers.Length()) ? this->servers[id_v] : NULL; this->list_pos = (server == NULL) ? SLP_INVALID : id_v; this->SetDirty(); /* FIXME the disabling should go into some InvalidateData, which is called instead of the SetDirty */ - if (click_count > 1 && !this->IsWidgetDisabled(NGWW_JOIN)) this->OnClick(pt, NGWW_JOIN, 1); + if (click_count > 1 && !this->IsWidgetDisabled(WID_NG_JOIN)) this->OnClick(pt, WID_NG_JOIN, 1); break; } - case NGWW_LASTJOINED: { + case WID_NG_LASTJOINED: { if (this->last_joined != NULL) { this->server = this->last_joined; @@ -702,19 +702,19 @@ public: this->SetDirty(); /* FIXME the disabling should go into some InvalidateData, which is called instead of the SetDirty */ - if (click_count > 1 && !this->IsWidgetDisabled(NGWW_JOIN)) this->OnClick(pt, NGWW_JOIN, 1); + if (click_count > 1 && !this->IsWidgetDisabled(WID_NG_JOIN)) this->OnClick(pt, WID_NG_JOIN, 1); } break; } - case NGWW_FIND: // Find server automatically + case WID_NG_FIND: // Find server automatically switch (_settings_client.network.lan_internet) { case 0: NetworkUDPSearchGame(); break; case 1: NetworkUDPQueryMasterServer(); break; } break; - case NGWW_ADD: // Add a server + case WID_NG_ADD: // Add a server SetDParamStr(0, _settings_client.network.connect_to_ip); ShowQueryString( STR_JUST_RAW_STRING, @@ -723,11 +723,11 @@ public: this, CS_ALPHANUMERAL, QSF_ACCEPT_UNCHANGED); break; - case NGWW_START: // Start server + case WID_NG_START: // Start server ShowNetworkStartServerWindow(); break; - case NGWW_JOIN: // Join Game + case WID_NG_JOIN: // Join Game if (this->server != NULL) { snprintf(_settings_client.network.last_host, sizeof(_settings_client.network.last_host), "%s", this->server->address.GetHostname()); _settings_client.network.last_port = this->server->address.GetPort(); @@ -735,15 +735,15 @@ public: } break; - case NGWW_REFRESH: // Refresh + case WID_NG_REFRESH: // Refresh if (this->server != NULL) NetworkUDPQueryServer(this->server->address); break; - case NGWW_NEWGRF: // NewGRF Settings + case WID_NG_NEWGRF: // NewGRF Settings if (this->server != NULL) ShowNewGRFSettings(false, false, false, &this->server->info.grfconfig); break; - case NGWW_NEWGRF_MISSING: // Find missing content online + case WID_NG_NEWGRF_MISSING: // Find missing content online if (this->server != NULL) ShowMissingContentWindow(this->server->info.grfconfig); break; } @@ -752,7 +752,7 @@ public: virtual void OnDropdownSelect(int widget, int index) { switch (widget) { - case NGWW_CONN_BTN: + case WID_NG_CONN_BTN: _settings_client.network.lan_internet = index; break; @@ -765,7 +765,7 @@ public: virtual void OnMouseLoop() { - if (this->field == NGWW_CLIENT) this->HandleEditBox(NGWW_CLIENT); + if (this->field == WID_NG_CLIENT) this->HandleEditBox(WID_NG_CLIENT); } /** @@ -832,7 +832,7 @@ public: return ES_HANDLED; } - if (this->field != NGWW_CLIENT) { + if (this->field != WID_NG_CLIENT) { if (this->server != NULL) { if (keycode == WKC_DELETE) { // Press 'delete' to remove servers NetworkGameListRemoveItem(this->server); @@ -844,7 +844,7 @@ public: return state; } - if (this->HandleEditBoxKey(NGWW_CLIENT, key, keycode, state) == HEBR_CONFIRM) return state; + if (this->HandleEditBoxKey(WID_NG_CLIENT, key, keycode, state) == HEBR_CONFIRM) return state; /* The name is only allowed when it starts with a letter! */ if (!StrEmpty(this->edit_str_buf) && this->edit_str_buf[0] != ' ') { @@ -862,8 +862,8 @@ public: virtual void OnResize() { - this->vscroll->SetCapacityFromWidget(this, NGWW_MATRIX); - this->GetWidget(NGWW_MATRIX)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); + this->vscroll->SetCapacityFromWidget(this, WID_NG_MATRIX); + this->GetWidget(WID_NG_MATRIX)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); } virtual void OnTick() @@ -884,7 +884,7 @@ GUIGameServerList::SortFunction * const static NWidgetBase *MakeResizableHeader(int *biggest_index) { - *biggest_index = max(*biggest_index, NGWW_INFO); + *biggest_index = max(*biggest_index, WID_NG_INFO); return new NWidgetServerListHeader(); } @@ -894,15 +894,15 @@ static const NWidgetPart _nested_network NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE), NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetDataTip(STR_NETWORK_SERVER_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), EndContainer(), - NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NGWW_MAIN), + NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, WID_NG_MAIN), NWidget(NWID_VERTICAL), SetPIP(10, 7, 0), NWidget(NWID_HORIZONTAL), SetPIP(10, 7, 10), - NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NGWW_CONNECTION), SetDataTip(STR_NETWORK_SERVER_LIST_CONNECTION, STR_NULL), - NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, NGWW_CONN_BTN), + NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NG_CONNECTION), SetDataTip(STR_NETWORK_SERVER_LIST_CONNECTION, STR_NULL), + NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, WID_NG_CONN_BTN), SetDataTip(STR_BLACK_STRING, STR_NETWORK_SERVER_LIST_CONNECTION_TOOLTIP), NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0), - NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NGWW_CLIENT_LABEL), SetDataTip(STR_NETWORK_SERVER_LIST_PLAYER_NAME, STR_NULL), - NWidget(WWT_EDITBOX, COLOUR_LIGHT_BLUE, NGWW_CLIENT), SetMinimalSize(151, 12), + NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NG_CLIENT_LABEL), SetDataTip(STR_NETWORK_SERVER_LIST_PLAYER_NAME, STR_NULL), + NWidget(WWT_EDITBOX, COLOUR_LIGHT_BLUE, WID_NG_CLIENT), SetMinimalSize(151, 12), SetDataTip(STR_NETWORK_SERVER_LIST_PLAYER_NAME_OSKTITLE, STR_NETWORK_SERVER_LIST_ENTER_NAME_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), SetPIP(10, 7, 10), @@ -911,41 +911,41 @@ static const NWidgetPart _nested_network NWidget(NWID_HORIZONTAL), NWidget(NWID_VERTICAL), NWidgetFunction(MakeResizableHeader), - NWidget(WWT_MATRIX, COLOUR_LIGHT_BLUE, NGWW_MATRIX), SetResize(1, 1), SetFill(1, 0), - SetDataTip(0, STR_NETWORK_SERVER_LIST_CLICK_GAME_TO_SELECT), SetScrollbar(NGWW_SCROLLBAR), + NWidget(WWT_MATRIX, COLOUR_LIGHT_BLUE, WID_NG_MATRIX), SetResize(1, 1), SetFill(1, 0), + SetDataTip(0, STR_NETWORK_SERVER_LIST_CLICK_GAME_TO_SELECT), SetScrollbar(WID_NG_SCROLLBAR), EndContainer(), - NWidget(NWID_VSCROLLBAR, COLOUR_LIGHT_BLUE, NGWW_SCROLLBAR), + NWidget(NWID_VSCROLLBAR, COLOUR_LIGHT_BLUE, WID_NG_SCROLLBAR), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 7), SetResize(1, 0), SetFill(1, 1), - NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NGWW_LASTJOINED_LABEL), SetFill(1, 0), + NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NG_LASTJOINED_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_LAST_JOINED_SERVER, STR_NULL), SetResize(1, 0), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NGWW_LASTJOINED), SetFill(1, 0), SetResize(1, 0), + NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, WID_NG_LASTJOINED), SetFill(1, 0), SetResize(1, 0), SetDataTip(0x0, STR_NETWORK_SERVER_LIST_CLICK_TO_SELECT_LAST), EndContainer(), - NWidget(WWT_EMPTY, INVALID_COLOUR, NGWW_LASTJOINED_SPACER), SetFill(0, 0), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NG_LASTJOINED_SPACER), SetFill(0, 0), EndContainer(), EndContainer(), /* RIGHT SIDE */ - NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NGWW_DETAILS), + NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, WID_NG_DETAILS), NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(5, 5, 5), - NWidget(WWT_EMPTY, INVALID_COLOUR, NGWW_DETAILS_SPACER), SetMinimalSize(140, 155), SetResize(0, 1), SetFill(1, 1), // Make sure it's at least this wide + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NG_DETAILS_SPACER), SetMinimalSize(140, 155), SetResize(0, 1), SetFill(1, 1), // Make sure it's at least this wide NWidget(NWID_HORIZONTAL, NC_NONE), SetPIP(5, 5, 5), - NWidget(NWID_SELECTION, INVALID_COLOUR, NGWW_NEWGRF_MISSING_SEL), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_NEWGRF_MISSING), SetFill(1, 0), SetDataTip(STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_BUTTON, STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_TOOLTIP), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_NG_NEWGRF_MISSING_SEL), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_NEWGRF_MISSING), SetFill(1, 0), SetDataTip(STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_BUTTON, STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_TOOLTIP), NWidget(NWID_SPACER), SetFill(1, 0), EndContainer(), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(5, 5, 5), NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(NWID_SELECTION, INVALID_COLOUR, NGWW_NEWGRF_SEL), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_NEWGRF), SetFill(1, 0), SetDataTip(STR_INTRO_NEWGRF_SETTINGS, STR_NULL), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_NG_NEWGRF_SEL), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_NEWGRF), SetFill(1, 0), SetDataTip(STR_INTRO_NEWGRF_SETTINGS, STR_NULL), NWidget(NWID_SPACER), SetFill(1, 0), EndContainer(), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(5, 5, 5), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_JOIN), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_JOIN_GAME, STR_NULL), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_REFRESH), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_REFRESH, STR_NETWORK_SERVER_LIST_REFRESH_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_JOIN), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_JOIN_GAME, STR_NULL), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_REFRESH), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_REFRESH, STR_NETWORK_SERVER_LIST_REFRESH_TOOLTIP), EndContainer(), EndContainer(), EndContainer(), @@ -954,10 +954,10 @@ static const NWidgetPart _nested_network NWidget(NWID_HORIZONTAL), NWidget(NWID_VERTICAL), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 7, 4), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_FIND), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_FIND_SERVER, STR_NETWORK_SERVER_LIST_FIND_SERVER_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_ADD), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_ADD_SERVER, STR_NETWORK_SERVER_LIST_ADD_SERVER_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_START), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_START_SERVER, STR_NETWORK_SERVER_LIST_START_SERVER_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_CANCEL), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_NULL), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_FIND), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_FIND_SERVER, STR_NETWORK_SERVER_LIST_FIND_SERVER_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_ADD), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_ADD_SERVER, STR_NETWORK_SERVER_LIST_ADD_SERVER_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_START), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_START_SERVER, STR_NETWORK_SERVER_LIST_START_SERVER_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_CANCEL), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_NULL), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 6), SetResize(1, 0), SetFill(1, 0), EndContainer(), @@ -1006,31 +1006,31 @@ struct NetworkStartServerWindow : public this->afilter = CS_ALPHANUMERAL; InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, 160); - this->SetFocusedWidget(NSSW_GAMENAME); + this->SetFocusedWidget(WID_NSS_GAMENAME); - this->field = NSSW_GAMENAME; + this->field = WID_NSS_GAMENAME; } virtual void SetStringParameters(int widget) const { switch (widget) { - case NSSW_CONNTYPE_BTN: + case WID_NSS_CONNTYPE_BTN: SetDParam(0, _connection_types_dropdown[_settings_client.network.server_advertise]); break; - case NSSW_CLIENTS_TXT: + case WID_NSS_CLIENTS_TXT: SetDParam(0, _settings_client.network.max_clients); break; - case NSSW_COMPANIES_TXT: + case WID_NSS_COMPANIES_TXT: SetDParam(0, _settings_client.network.max_companies); break; - case NSSW_SPECTATORS_TXT: + case WID_NSS_SPECTATORS_TXT: SetDParam(0, _settings_client.network.max_spectators); break; - case NSSW_LANGUAGE_BTN: + case WID_NSS_LANGUAGE_BTN: SetDParam(0, STR_NETWORK_LANG_ANY + _settings_client.network.server_lang); break; } @@ -1039,7 +1039,7 @@ struct NetworkStartServerWindow : public virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case NSSW_CONNTYPE_BTN: + case WID_NSS_CONNTYPE_BTN: *size = maxdim(GetStringBoundingBox(_connection_types_dropdown[0]), GetStringBoundingBox(_connection_types_dropdown[1])); size->width += padding.width; size->height += padding.height; @@ -1050,7 +1050,7 @@ struct NetworkStartServerWindow : public virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case NSSW_SETPWD: + case WID_NSS_SETPWD: /* if password is set, draw red '*' next to 'Set password' button */ if (!StrEmpty(_settings_client.network.server_password)) DrawString(r.right + WD_FRAMERECT_LEFT, this->width - WD_FRAMERECT_RIGHT, r.top, "*", TC_RED); } @@ -1062,69 +1062,69 @@ struct NetworkStartServerWindow : public this->DrawWidgets(); /* editbox to set game name */ - this->DrawEditBox(NSSW_GAMENAME); + this->DrawEditBox(WID_NSS_GAMENAME); } virtual void OnClick(Point pt, int widget, int click_count) { this->field = widget; switch (widget) { - case NSSW_CANCEL: // Cancel button + case WID_NSS_CANCEL: // Cancel button ShowNetworkGameWindow(); break; - case NSSW_SETPWD: // Set password button - this->widget_id = NSSW_SETPWD; + case WID_NSS_SETPWD: // Set password button + this->widget_id = WID_NSS_SETPWD; SetDParamStr(0, _settings_client.network.server_password); ShowQueryString(STR_JUST_RAW_STRING, STR_NETWORK_START_SERVER_SET_PASSWORD, 20, this, CS_ALPHANUMERAL, QSF_NONE); break; - case NSSW_CONNTYPE_BTN: // Connection type - ShowDropDownMenu(this, _connection_types_dropdown, _settings_client.network.server_advertise, NSSW_CONNTYPE_BTN, 0, 0); // do it for widget NSSW_CONNTYPE_BTN + case WID_NSS_CONNTYPE_BTN: // Connection type + ShowDropDownMenu(this, _connection_types_dropdown, _settings_client.network.server_advertise, WID_NSS_CONNTYPE_BTN, 0, 0); // do it for widget WID_NSS_CONNTYPE_BTN break; - case NSSW_CLIENTS_BTND: case NSSW_CLIENTS_BTNU: // Click on up/down button for number of clients - case NSSW_COMPANIES_BTND: case NSSW_COMPANIES_BTNU: // Click on up/down button for number of companies - case NSSW_SPECTATORS_BTND: case NSSW_SPECTATORS_BTNU: // Click on up/down button for number of spectators + case WID_NSS_CLIENTS_BTND: case WID_NSS_CLIENTS_BTNU: // Click on up/down button for number of clients + case WID_NSS_COMPANIES_BTND: case WID_NSS_COMPANIES_BTNU: // Click on up/down button for number of companies + case WID_NSS_SPECTATORS_BTND: case WID_NSS_SPECTATORS_BTNU: // Click on up/down button for number of spectators /* Don't allow too fast scrolling */ if ((this->flags & WF_TIMEOUT) && this->timeout_timer <= 1) { this->HandleButtonClick(widget); this->SetDirty(); switch (widget) { default: NOT_REACHED(); - case NSSW_CLIENTS_BTND: case NSSW_CLIENTS_BTNU: - _settings_client.network.max_clients = Clamp(_settings_client.network.max_clients + widget - NSSW_CLIENTS_TXT, 2, MAX_CLIENTS); + case WID_NSS_CLIENTS_BTND: case WID_NSS_CLIENTS_BTNU: + _settings_client.network.max_clients = Clamp(_settings_client.network.max_clients + widget - WID_NSS_CLIENTS_TXT, 2, MAX_CLIENTS); break; - case NSSW_COMPANIES_BTND: case NSSW_COMPANIES_BTNU: - _settings_client.network.max_companies = Clamp(_settings_client.network.max_companies + widget - NSSW_COMPANIES_TXT, 1, MAX_COMPANIES); + case WID_NSS_COMPANIES_BTND: case WID_NSS_COMPANIES_BTNU: + _settings_client.network.max_companies = Clamp(_settings_client.network.max_companies + widget - WID_NSS_COMPANIES_TXT, 1, MAX_COMPANIES); break; - case NSSW_SPECTATORS_BTND: case NSSW_SPECTATORS_BTNU: - _settings_client.network.max_spectators = Clamp(_settings_client.network.max_spectators + widget - NSSW_SPECTATORS_TXT, 0, MAX_CLIENTS); + case WID_NSS_SPECTATORS_BTND: case WID_NSS_SPECTATORS_BTNU: + _settings_client.network.max_spectators = Clamp(_settings_client.network.max_spectators + widget - WID_NSS_SPECTATORS_TXT, 0, MAX_CLIENTS); break; } } _left_button_clicked = false; break; - case NSSW_CLIENTS_TXT: // Click on number of clients - this->widget_id = NSSW_CLIENTS_TXT; + case WID_NSS_CLIENTS_TXT: // Click on number of clients + this->widget_id = WID_NSS_CLIENTS_TXT; SetDParam(0, _settings_client.network.max_clients); ShowQueryString(STR_JUST_INT, STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS, 4, this, CS_NUMERAL, QSF_NONE); break; - case NSSW_COMPANIES_TXT: // Click on number of companies - this->widget_id = NSSW_COMPANIES_TXT; + case WID_NSS_COMPANIES_TXT: // Click on number of companies + this->widget_id = WID_NSS_COMPANIES_TXT; SetDParam(0, _settings_client.network.max_companies); ShowQueryString(STR_JUST_INT, STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES, 3, this, CS_NUMERAL, QSF_NONE); break; - case NSSW_SPECTATORS_TXT: // Click on number of spectators - this->widget_id = NSSW_SPECTATORS_TXT; + case WID_NSS_SPECTATORS_TXT: // Click on number of spectators + this->widget_id = WID_NSS_SPECTATORS_TXT; SetDParam(0, _settings_client.network.max_spectators); ShowQueryString(STR_JUST_INT, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS, 4, this, CS_NUMERAL, QSF_NONE); break; - case NSSW_LANGUAGE_BTN: { // Language + case WID_NSS_LANGUAGE_BTN: { // Language uint sel = 0; for (uint i = 0; i < lengthof(_language_dropdown) - 1; i++) { if (_language_dropdown[i] == STR_NETWORK_LANG_ANY + _settings_client.network.server_lang) { @@ -1132,11 +1132,11 @@ struct NetworkStartServerWindow : public break; } } - ShowDropDownMenu(this, _language_dropdown, sel, NSSW_LANGUAGE_BTN, 0, 0); + ShowDropDownMenu(this, _language_dropdown, sel, WID_NSS_LANGUAGE_BTN, 0, 0); break; } - case NSSW_GENERATE_GAME: // Start game + case WID_NSS_GENERATE_GAME: // Start game _is_network_server = true; if (_ctrl_pressed) { StartNewGameWithoutGUI(GENERATE_NEW_SEED); @@ -1145,17 +1145,17 @@ struct NetworkStartServerWindow : public } break; - case NSSW_LOAD_GAME: + case WID_NSS_LOAD_GAME: _is_network_server = true; ShowSaveLoadDialog(SLD_LOAD_GAME); break; - case NSSW_PLAY_SCENARIO: + case WID_NSS_PLAY_SCENARIO: _is_network_server = true; ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break; - case NSSW_PLAY_HEIGHTMAP: + case WID_NSS_PLAY_HEIGHTMAP: _is_network_server = true; ShowSaveLoadDialog(SLD_LOAD_HEIGHTMAP); break; @@ -1165,10 +1165,10 @@ struct NetworkStartServerWindow : public virtual void OnDropdownSelect(int widget, int index) { switch (widget) { - case NSSW_CONNTYPE_BTN: + case WID_NSS_CONNTYPE_BTN: _settings_client.network.server_advertise = (index != 0); break; - case NSSW_LANGUAGE_BTN: + case WID_NSS_LANGUAGE_BTN: _settings_client.network.server_lang = _language_dropdown[index] - STR_NETWORK_LANG_ANY; break; default: @@ -1180,14 +1180,14 @@ struct NetworkStartServerWindow : public virtual void OnMouseLoop() { - if (this->field == NSSW_GAMENAME) this->HandleEditBox(NSSW_GAMENAME); + if (this->field == WID_NSS_GAMENAME) this->HandleEditBox(WID_NSS_GAMENAME); } virtual EventState OnKeyPress(uint16 key, uint16 keycode) { EventState state = ES_NOT_HANDLED; - if (this->field == NSSW_GAMENAME) { - if (this->HandleEditBoxKey(NSSW_GAMENAME, key, keycode, state) == HEBR_CONFIRM) return state; + if (this->field == WID_NSS_GAMENAME) { + if (this->HandleEditBoxKey(WID_NSS_GAMENAME, key, keycode, state) == HEBR_CONFIRM) return state; strecpy(_settings_client.network.server_name, this->text.buf, lastof(_settings_client.network.server_name)); } @@ -1197,7 +1197,7 @@ struct NetworkStartServerWindow : public virtual void OnTimeout() { - static const int raise_widgets[] = {NSSW_CLIENTS_BTND, NSSW_CLIENTS_BTNU, NSSW_COMPANIES_BTND, NSSW_COMPANIES_BTNU, NSSW_SPECTATORS_BTND, NSSW_SPECTATORS_BTNU, WIDGET_LIST_END}; + static const int raise_widgets[] = {WID_NSS_CLIENTS_BTND, WID_NSS_CLIENTS_BTNU, WID_NSS_COMPANIES_BTND, WID_NSS_COMPANIES_BTNU, WID_NSS_SPECTATORS_BTND, WID_NSS_SPECTATORS_BTNU, WIDGET_LIST_END}; for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) { if (this->IsWidgetLowered(*widget)) { this->RaiseWidget(*widget); @@ -1210,16 +1210,16 @@ struct NetworkStartServerWindow : public { if (str == NULL) return; - if (this->widget_id == NSSW_SETPWD) { + if (this->widget_id == WID_NSS_SETPWD) { strecpy(_settings_client.network.server_password, str, lastof(_settings_client.network.server_password)); } else { int32 value = atoi(str); this->SetWidgetDirty(this->widget_id); switch (this->widget_id) { default: NOT_REACHED(); - case NSSW_CLIENTS_TXT: _settings_client.network.max_clients = Clamp(value, 2, MAX_CLIENTS); break; - case NSSW_COMPANIES_TXT: _settings_client.network.max_companies = Clamp(value, 1, MAX_COMPANIES); break; - case NSSW_SPECTATORS_TXT: _settings_client.network.max_spectators = Clamp(value, 0, MAX_CLIENTS); break; + case WID_NSS_CLIENTS_TXT: _settings_client.network.max_clients = Clamp(value, 2, MAX_CLIENTS); break; + case WID_NSS_COMPANIES_TXT: _settings_client.network.max_companies = Clamp(value, 1, MAX_COMPANIES); break; + case WID_NSS_SPECTATORS_TXT: _settings_client.network.max_spectators = Clamp(value, 0, MAX_CLIENTS); break; } } @@ -1232,75 +1232,75 @@ static const NWidgetPart _nested_network NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE), NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetDataTip(STR_NETWORK_START_SERVER_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), EndContainer(), - NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NSSW_BACKGROUND), + NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, WID_NSS_BACKGROUND), NWidget(NWID_VERTICAL), SetPIP(10, 6, 10), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 6, 10), NWidget(NWID_VERTICAL), SetPIP(0, 1, 0), /* Game name widgets */ - NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_GAMENAME_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_NEW_GAME_NAME, STR_NULL), - NWidget(WWT_EDITBOX, COLOUR_LIGHT_BLUE, NSSW_GAMENAME), SetMinimalSize(10, 12), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_NEW_GAME_NAME_OSKTITLE, STR_NETWORK_START_SERVER_NEW_GAME_NAME_TOOLTIP), + NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NSS_GAMENAME_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_NEW_GAME_NAME, STR_NULL), + NWidget(WWT_EDITBOX, COLOUR_LIGHT_BLUE, WID_NSS_GAMENAME), SetMinimalSize(10, 12), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_NEW_GAME_NAME_OSKTITLE, STR_NETWORK_START_SERVER_NEW_GAME_NAME_TOOLTIP), EndContainer(), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 6, 10), NWidget(NWID_VERTICAL), SetPIP(0, 1, 0), - NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_CONNTYPE_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_CONNECTION, STR_NULL), - NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, NSSW_CONNTYPE_BTN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NETWORK_SERVER_LIST_CONNECTION_TOOLTIP), + NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NSS_CONNTYPE_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_CONNECTION, STR_NULL), + NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, WID_NSS_CONNTYPE_BTN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NETWORK_SERVER_LIST_CONNECTION_TOOLTIP), EndContainer(), NWidget(NWID_VERTICAL), SetPIP(0, 1, 0), - NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_LANGUAGE_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_LANGUAGE_SPOKEN, STR_NULL), - NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, NSSW_LANGUAGE_BTN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NETWORK_START_SERVER_LANGUAGE_TOOLTIP), + NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NSS_LANGUAGE_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_LANGUAGE_SPOKEN, STR_NULL), + NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, WID_NSS_LANGUAGE_BTN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NETWORK_START_SERVER_LANGUAGE_TOOLTIP), EndContainer(), NWidget(NWID_VERTICAL), SetPIP(0, 1, 0), NWidget(NWID_SPACER), SetFill(1, 1), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NSSW_SETPWD), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_SET_PASSWORD, STR_NETWORK_START_SERVER_PASSWORD_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NSS_SETPWD), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_SET_PASSWORD, STR_NETWORK_START_SERVER_PASSWORD_TOOLTIP), EndContainer(), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 6, 10), NWidget(NWID_VERTICAL), SetPIP(0, 1, 0), - NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_CLIENTS_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS, STR_NULL), + NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NSS_CLIENTS_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS, STR_NULL), NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_CLIENTS_BTND), SetMinimalSize(12, 12), SetFill(0, 1), SetDataTip(SPR_ARROW_DOWN, STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, NSSW_CLIENTS_TXT), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_CLIENTS_SELECT, STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS_TOOLTIP), - NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_CLIENTS_BTNU), SetMinimalSize(12, 12), SetFill(0, 1), SetDataTip(SPR_ARROW_UP, STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, WID_NSS_CLIENTS_BTND), SetMinimalSize(12, 12), SetFill(0, 1), SetDataTip(SPR_ARROW_DOWN, STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_NSS_CLIENTS_TXT), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_CLIENTS_SELECT, STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, WID_NSS_CLIENTS_BTNU), SetMinimalSize(12, 12), SetFill(0, 1), SetDataTip(SPR_ARROW_UP, STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS_TOOLTIP), EndContainer(), EndContainer(), NWidget(NWID_VERTICAL), SetPIP(0, 1, 0), - NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_COMPANIES_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES, STR_NULL), + NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NSS_COMPANIES_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES, STR_NULL), NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_COMPANIES_BTND), SetMinimalSize(12, 12), SetFill(0, 1), SetDataTip(SPR_ARROW_DOWN, STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, NSSW_COMPANIES_TXT), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_COMPANIES_SELECT, STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES_TOOLTIP), - NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_COMPANIES_BTNU), SetMinimalSize(12, 12), SetFill(0, 1), SetDataTip(SPR_ARROW_UP, STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, WID_NSS_COMPANIES_BTND), SetMinimalSize(12, 12), SetFill(0, 1), SetDataTip(SPR_ARROW_DOWN, STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_NSS_COMPANIES_TXT), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_COMPANIES_SELECT, STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, WID_NSS_COMPANIES_BTNU), SetMinimalSize(12, 12), SetFill(0, 1), SetDataTip(SPR_ARROW_UP, STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES_TOOLTIP), EndContainer(), EndContainer(), NWidget(NWID_VERTICAL), SetPIP(0, 1, 0), - NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_SPECTATORS_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS, STR_NULL), + NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NSS_SPECTATORS_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS, STR_NULL), NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_SPECTATORS_BTND), SetMinimalSize(12, 12), SetFill(0, 1), SetDataTip(SPR_ARROW_DOWN, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, NSSW_SPECTATORS_TXT), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_SPECTATORS_SELECT, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS_TOOLTIP), - NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_SPECTATORS_BTNU), SetMinimalSize(12, 12), SetFill(0, 1), SetDataTip(SPR_ARROW_UP, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, WID_NSS_SPECTATORS_BTND), SetMinimalSize(12, 12), SetFill(0, 1), SetDataTip(SPR_ARROW_DOWN, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_NSS_SPECTATORS_TXT), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_SPECTATORS_SELECT, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, WID_NSS_SPECTATORS_BTNU), SetMinimalSize(12, 12), SetFill(0, 1), SetDataTip(SPR_ARROW_UP, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS_TOOLTIP), EndContainer(), EndContainer(), EndContainer(), /* 'generate game' and 'load game' buttons */ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 6, 10), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NSSW_GENERATE_GAME), SetDataTip(STR_INTRO_NEW_GAME, STR_INTRO_TOOLTIP_NEW_GAME), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NSSW_LOAD_GAME), SetDataTip(STR_INTRO_LOAD_GAME, STR_INTRO_TOOLTIP_LOAD_GAME), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NSS_GENERATE_GAME), SetDataTip(STR_INTRO_NEW_GAME, STR_INTRO_TOOLTIP_NEW_GAME), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NSS_LOAD_GAME), SetDataTip(STR_INTRO_LOAD_GAME, STR_INTRO_TOOLTIP_LOAD_GAME), SetFill(1, 0), EndContainer(), /* 'play scenario' and 'play heightmap' buttons */ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 6, 10), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NSSW_PLAY_SCENARIO), SetDataTip(STR_INTRO_PLAY_SCENARIO, STR_INTRO_TOOLTIP_PLAY_SCENARIO), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NSSW_PLAY_HEIGHTMAP), SetDataTip(STR_INTRO_PLAY_HEIGHTMAP, STR_INTRO_TOOLTIP_PLAY_HEIGHTMAP), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NSS_PLAY_SCENARIO), SetDataTip(STR_INTRO_PLAY_SCENARIO, STR_INTRO_TOOLTIP_PLAY_SCENARIO), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NSS_PLAY_HEIGHTMAP), SetDataTip(STR_INTRO_PLAY_HEIGHTMAP, STR_INTRO_TOOLTIP_PLAY_HEIGHTMAP), SetFill(1, 0), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 0, 10), NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NSSW_CANCEL), SetDataTip(STR_BUTTON_CANCEL, STR_NULL), SetMinimalSize(128, 12), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NSS_CANCEL), SetDataTip(STR_BUTTON_CANCEL, STR_NULL), SetMinimalSize(128, 12), NWidget(NWID_SPACER), SetFill(1, 0), EndContainer(), EndContainer(), @@ -1331,7 +1331,7 @@ struct NetworkLobbyWindow : public Windo Window(), company(INVALID_COMPANY), server(ngl) { this->CreateNestedTree(desc); - this->vscroll = this->GetScrollbar(NLWW_SCROLLBAR); + this->vscroll = this->GetScrollbar(WID_NL_SCROLLBAR); this->FinishInitNested(desc, 0); this->OnResize(); } @@ -1351,16 +1351,16 @@ struct NetworkLobbyWindow : public Windo virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case NLWW_HEADER: + case WID_NL_HEADER: size->height = WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM; break; - case NLWW_MATRIX: + case WID_NL_MATRIX: resize->height = WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM; size->height = 10 * resize->height; break; - case NLWW_DETAILS: + case WID_NL_DETAILS: size->height = 30 + 11 * FONT_HEIGHT_NORMAL; break; } @@ -1369,7 +1369,7 @@ struct NetworkLobbyWindow : public Windo virtual void SetStringParameters(int widget) const { switch (widget) { - case NLWW_TEXT: + case WID_NL_TEXT: SetDParamStr(0, this->server->info.server_name); break; } @@ -1378,11 +1378,11 @@ struct NetworkLobbyWindow : public Windo virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case NLWW_DETAILS: + case WID_NL_DETAILS: this->DrawDetails(r); break; - case NLWW_MATRIX: + case WID_NL_MATRIX: this->DrawMatrix(r); break; } @@ -1393,11 +1393,11 @@ struct NetworkLobbyWindow : public Windo const NetworkGameInfo *gi = &this->server->info; /* Join button is disabled when no company is selected and for AI companies*/ - this->SetWidgetDisabledState(NLWW_JOIN, this->company == INVALID_COMPANY || GetLobbyCompanyInfo(this->company)->ai); + this->SetWidgetDisabledState(WID_NL_JOIN, this->company == INVALID_COMPANY || GetLobbyCompanyInfo(this->company)->ai); /* Cannot start new company if there are too many */ - this->SetWidgetDisabledState(NLWW_NEW, gi->companies_on >= gi->companies_max); + this->SetWidgetDisabledState(WID_NL_NEW, gi->companies_on >= gi->companies_max); /* Cannot spectate if there are too many spectators */ - this->SetWidgetDisabledState(NLWW_SPECTATE, gi->spectators_on >= gi->spectators_max); + this->SetWidgetDisabledState(WID_NL_SPECTATE, gi->spectators_on >= gi->spectators_max); this->vscroll->SetCount(gi->companies_on); @@ -1513,34 +1513,34 @@ struct NetworkLobbyWindow : public Windo virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case NLWW_CANCEL: // Cancel button + case WID_NL_CANCEL: // Cancel button ShowNetworkGameWindow(); break; - case NLWW_MATRIX: { // Company list - uint id_v = this->vscroll->GetScrolledRowFromWidget(pt.y, this, NLWW_MATRIX); + case WID_NL_MATRIX: { // Company list + uint id_v = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_NL_MATRIX); this->company = (id_v >= this->server->info.companies_on) ? INVALID_COMPANY : NetworkLobbyFindCompanyIndex(id_v); this->SetDirty(); /* FIXME the disabling should go into some InvalidateData, which is called instead of the SetDirty */ - if (click_count > 1 && !this->IsWidgetDisabled(NLWW_JOIN)) this->OnClick(pt, NLWW_JOIN, 1); + if (click_count > 1 && !this->IsWidgetDisabled(WID_NL_JOIN)) this->OnClick(pt, WID_NL_JOIN, 1); break; } - case NLWW_JOIN: // Join company + case WID_NL_JOIN: // Join company /* Button can be clicked only when it is enabled */ NetworkClientConnectGame(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port), this->company); break; - case NLWW_NEW: // New company + case WID_NL_NEW: // New company NetworkClientConnectGame(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port), COMPANY_NEW_COMPANY); break; - case NLWW_SPECTATE: // Spectate game + case WID_NL_SPECTATE: // Spectate game NetworkClientConnectGame(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port), COMPANY_SPECTATOR); break; - case NLWW_REFRESH: // Refresh + case WID_NL_REFRESH: // Refresh NetworkTCPQueryServer(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); // company info NetworkUDPQueryServer(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); // general data /* Clear the information so removed companies don't remain */ @@ -1551,8 +1551,8 @@ struct NetworkLobbyWindow : public Windo virtual void OnResize() { - this->vscroll->SetCapacityFromWidget(this, NLWW_MATRIX); - this->GetWidget(NLWW_MATRIX)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); + this->vscroll->SetCapacityFromWidget(this, WID_NL_MATRIX); + this->GetWidget(WID_NL_MATRIX)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); } }; @@ -1561,33 +1561,33 @@ static const NWidgetPart _nested_network NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE), NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetDataTip(STR_NETWORK_GAME_LOBBY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), EndContainer(), - NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NLWW_BACKGROUND), - NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NLWW_TEXT), SetDataTip(STR_NETWORK_GAME_LOBBY_PREPARE_TO_JOIN, STR_NULL), SetResize(1, 0), SetPadding(10, 10, 0, 10), + NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, WID_NL_BACKGROUND), + NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NL_TEXT), SetDataTip(STR_NETWORK_GAME_LOBBY_PREPARE_TO_JOIN, STR_NULL), SetResize(1, 0), SetPadding(10, 10, 0, 10), NWidget(NWID_SPACER), SetMinimalSize(0, 3), NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 10), /* Company list. */ NWidget(NWID_VERTICAL), - NWidget(WWT_PANEL, COLOUR_WHITE, NLWW_HEADER), SetMinimalSize(146, 0), SetResize(1, 0), SetFill(1, 0), EndContainer(), - NWidget(WWT_MATRIX, COLOUR_LIGHT_BLUE, NLWW_MATRIX), SetMinimalSize(146, 0), SetResize(1, 1), SetFill(1, 1), SetDataTip(0, STR_NETWORK_GAME_LOBBY_COMPANY_LIST_TOOLTIP), SetScrollbar(NLWW_SCROLLBAR), + NWidget(WWT_PANEL, COLOUR_WHITE, WID_NL_HEADER), SetMinimalSize(146, 0), SetResize(1, 0), SetFill(1, 0), EndContainer(), + NWidget(WWT_MATRIX, COLOUR_LIGHT_BLUE, WID_NL_MATRIX), SetMinimalSize(146, 0), SetResize(1, 1), SetFill(1, 1), SetDataTip(0, STR_NETWORK_GAME_LOBBY_COMPANY_LIST_TOOLTIP), SetScrollbar(WID_NL_SCROLLBAR), EndContainer(), - NWidget(NWID_VSCROLLBAR, COLOUR_LIGHT_BLUE, NLWW_SCROLLBAR), + NWidget(NWID_VSCROLLBAR, COLOUR_LIGHT_BLUE, WID_NL_SCROLLBAR), NWidget(NWID_SPACER), SetMinimalSize(5, 0), SetResize(0, 1), /* Company info. */ - NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NLWW_DETAILS), SetMinimalSize(232, 0), SetResize(1, 1), SetFill(1, 1), EndContainer(), + NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, WID_NL_DETAILS), SetMinimalSize(232, 0), SetResize(1, 1), SetFill(1, 1), EndContainer(), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 9), /* Buttons. */ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 3, 10), NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 3, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NLWW_JOIN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_GAME_LOBBY_JOIN_COMPANY, STR_NETWORK_GAME_LOBBY_JOIN_COMPANY_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NLWW_NEW), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_GAME_LOBBY_NEW_COMPANY, STR_NETWORK_GAME_LOBBY_NEW_COMPANY_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NL_JOIN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_GAME_LOBBY_JOIN_COMPANY, STR_NETWORK_GAME_LOBBY_JOIN_COMPANY_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NL_NEW), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_GAME_LOBBY_NEW_COMPANY, STR_NETWORK_GAME_LOBBY_NEW_COMPANY_TOOLTIP), EndContainer(), NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 3, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NLWW_SPECTATE), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_GAME_LOBBY_SPECTATE_GAME, STR_NETWORK_GAME_LOBBY_SPECTATE_GAME_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NLWW_REFRESH), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_REFRESH, STR_NETWORK_SERVER_LIST_REFRESH_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NL_SPECTATE), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_GAME_LOBBY_SPECTATE_GAME, STR_NETWORK_GAME_LOBBY_SPECTATE_GAME_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NL_REFRESH), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_REFRESH, STR_NETWORK_SERVER_LIST_REFRESH_TOOLTIP), EndContainer(), NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 3, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NLWW_CANCEL), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_NULL), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NL_CANCEL), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_NULL), NWidget(NWID_SPACER), SetFill(1, 1), EndContainer(), EndContainer(), @@ -1640,7 +1640,7 @@ extern void DrawCompanyIcon(CompanyID ci typedef void ClientList_Action_Proc(const NetworkClientInfo *ci); static const NWidgetPart _nested_client_list_popup_widgets[] = { - NWidget(WWT_PANEL, COLOUR_GREY, CLPW_PANEL), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_CLP_PANEL), EndContainer(), }; static const WindowDesc _client_list_popup_desc( @@ -1816,7 +1816,7 @@ static const NWidgetPart _nested_client_ NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_NETWORK_COMPANY_LIST_CLIENT_LIST, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, CLW_PANEL), SetMinimalSize(250, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM), SetResize(1, 1), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_CL_PANEL), SetMinimalSize(250, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM), SetResize(1, 1), EndContainer(), }; static const WindowDesc _client_list_desc( @@ -1857,7 +1857,7 @@ struct NetworkClientListWindow : Window num *= FONT_HEIGHT_NORMAL; - int diff = (num + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM) - (this->GetWidget(CLW_PANEL)->current_y); + int diff = (num + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM) - (this->GetWidget(WID_CL_PANEL)->current_y); /* If height is changed */ if (diff != 0) { ResizeWindow(this, 0, diff); @@ -1868,7 +1868,7 @@ struct NetworkClientListWindow : Window virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { - if (widget != CLW_PANEL) return; + if (widget != WID_CL_PANEL) return; this->server_client_width = max(GetStringBoundingBox(STR_NETWORK_SERVER).width, GetStringBoundingBox(STR_NETWORK_CLIENT).width) + WD_FRAMERECT_RIGHT; this->company_icon_width = GetSpriteSize(SPR_COMPANY_ICON).width + WD_FRAMERECT_LEFT; @@ -1892,7 +1892,7 @@ struct NetworkClientListWindow : Window virtual void DrawWidget(const Rect &r, int widget) const { - if (widget != CLW_PANEL) return; + if (widget != WID_CL_PANEL) return; bool rtl = _current_text_dir == TD_RTL; int icon_y_offset = 1 + (FONT_HEIGHT_NORMAL - 10) / 2; @@ -1960,9 +1960,9 @@ struct NetworkClientListWindow : Window } /* Find the new selected item (if any) */ - pt.y -= this->GetWidget(CLW_PANEL)->pos_y; + pt.y -= this->GetWidget(WID_CL_PANEL)->pos_y; int item = -1; - if (IsInsideMM(pt.y, WD_FRAMERECT_TOP, this->GetWidget(CLW_PANEL)->current_y - WD_FRAMERECT_BOTTOM)) { + if (IsInsideMM(pt.y, WD_FRAMERECT_TOP, this->GetWidget(WID_CL_PANEL)->current_y - WD_FRAMERECT_BOTTOM)) { item = (pt.y - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL; } @@ -1996,7 +1996,7 @@ struct NetworkJoinStatusWindow : Window virtual void DrawWidget(const Rect &r, int widget) const { - if (widget != NJSW_BACKGROUND) return; + if (widget != WID_NJS_BACKGROUND) return; uint8 progress; // used for progress bar DrawString(r.left + 2, r.right - 2, r.top + 20, STR_NETWORK_CONNECTING_1 + _network_join_status, TC_FROMSTRING, SA_HOR_CENTER); @@ -2029,7 +2029,7 @@ struct NetworkJoinStatusWindow : Window virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { - if (widget != NJSW_BACKGROUND) return; + if (widget != WID_NJS_BACKGROUND) return; size->height = 25 + 2 * FONT_HEIGHT_NORMAL; @@ -2055,7 +2055,7 @@ struct NetworkJoinStatusWindow : Window virtual void OnClick(Point pt, int widget, int click_count) { - if (widget == NJSW_CANCELOK) { // Disconnect button + if (widget == WID_NJS_CANCELOK) { // Disconnect button NetworkDisconnect(); SwitchToMode(SM_MENU); ShowNetworkGameWindow(); @@ -2081,10 +2081,10 @@ struct NetworkJoinStatusWindow : Window static const NWidgetPart _nested_network_join_status_window_widgets[] = { NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_NETWORK_CONNECTING_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_PANEL, COLOUR_GREY), - NWidget(WWT_EMPTY, COLOUR_GREY, NJSW_BACKGROUND), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_NJS_BACKGROUND), NWidget(NWID_HORIZONTAL), NWidget(NWID_SPACER), SetMinimalSize(75, 0), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NJSW_CANCELOK), SetMinimalSize(101, 12), SetDataTip(STR_NETWORK_CONNECTION_DISCONNECT, STR_NULL), + NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NJS_CANCELOK), SetMinimalSize(101, 12), SetDataTip(STR_NETWORK_CONNECTION_DISCONNECT, STR_NULL), NWidget(NWID_SPACER), SetMinimalSize(75, 0), SetFill(1, 0), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 4), @@ -2127,12 +2127,12 @@ struct NetworkCompanyPasswordWindow : pu this->parent = parent; this->afilter = CS_ALPHANUMERAL; InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size); - this->SetFocusedWidget(NCPWW_PASSWORD); + this->SetFocusedWidget(WID_NCP_PASSWORD); } void OnOk() { - if (this->IsWidgetLowered(NCPWW_SAVE_AS_DEFAULT_PASSWORD)) { + if (this->IsWidgetLowered(WID_NCP_SAVE_AS_DEFAULT_PASSWORD)) { snprintf(_settings_client.network.default_company_pass, lengthof(_settings_client.network.default_company_pass), "%s", this->edit_str_buf); } @@ -2142,22 +2142,22 @@ struct NetworkCompanyPasswordWindow : pu virtual void OnPaint() { this->DrawWidgets(); - this->DrawEditBox(NCPWW_PASSWORD); + this->DrawEditBox(WID_NCP_PASSWORD); } virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case NCPWW_OK: + case WID_NCP_OK: this->OnOk(); /* FALL THROUGH */ - case NCPWW_CANCEL: + case WID_NCP_CANCEL: delete this; break; - case NCPWW_SAVE_AS_DEFAULT_PASSWORD: - this->ToggleWidgetLoweredState(NCPWW_SAVE_AS_DEFAULT_PASSWORD); + case WID_NCP_SAVE_AS_DEFAULT_PASSWORD: + this->ToggleWidgetLoweredState(WID_NCP_SAVE_AS_DEFAULT_PASSWORD); this->SetDirty(); break; } @@ -2171,7 +2171,7 @@ struct NetworkCompanyPasswordWindow : pu virtual EventState OnKeyPress(uint16 key, uint16 keycode) { EventState state = ES_NOT_HANDLED; - switch (this->HandleEditBoxKey(NCPWW_PASSWORD, key, keycode, state)) { + switch (this->HandleEditBoxKey(WID_NCP_PASSWORD, key, keycode, state)) { default: break; case HEBR_CONFIRM: @@ -2187,7 +2187,7 @@ struct NetworkCompanyPasswordWindow : pu virtual void OnOpenOSKWindow(int wid) { - ShowOnScreenKeyboard(this, wid, NCPWW_CANCEL, NCPWW_OK); + ShowOnScreenKeyboard(this, wid, WID_NCP_CANCEL, WID_NCP_OK); } }; @@ -2196,22 +2196,22 @@ static const NWidgetPart _nested_network NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_COMPANY_PASSWORD_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, NCPWW_BACKGROUND), + NWidget(WWT_PANEL, COLOUR_GREY, WID_NCP_BACKGROUND), NWidget(NWID_VERTICAL), SetPIP(5, 5, 5), NWidget(NWID_HORIZONTAL), SetPIP(5, 5, 5), - NWidget(WWT_TEXT, COLOUR_GREY, NCPWW_LABEL), SetDataTip(STR_COMPANY_VIEW_PASSWORD, STR_NULL), - NWidget(WWT_EDITBOX, COLOUR_GREY, NCPWW_PASSWORD), SetMinimalSize(194, 12), SetDataTip(STR_COMPANY_VIEW_SET_PASSWORD, STR_NULL), + NWidget(WWT_TEXT, COLOUR_GREY, WID_NCP_LABEL), SetDataTip(STR_COMPANY_VIEW_PASSWORD, STR_NULL), + NWidget(WWT_EDITBOX, COLOUR_GREY, WID_NCP_PASSWORD), SetMinimalSize(194, 12), SetDataTip(STR_COMPANY_VIEW_SET_PASSWORD, STR_NULL), EndContainer(), NWidget(NWID_HORIZONTAL), SetPIP(5, 0, 5), NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(WWT_TEXTBTN, COLOUR_GREY, NCPWW_SAVE_AS_DEFAULT_PASSWORD), SetMinimalSize(194, 12), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_NCP_SAVE_AS_DEFAULT_PASSWORD), SetMinimalSize(194, 12), SetDataTip(STR_COMPANY_PASSWORD_MAKE_DEFAULT, STR_COMPANY_PASSWORD_MAKE_DEFAULT_TOOLTIP), EndContainer(), EndContainer(), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, NCPWW_CANCEL), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_COMPANY_PASSWORD_CANCEL), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, NCPWW_OK), SetFill(1, 0), SetDataTip(STR_BUTTON_OK, STR_COMPANY_PASSWORD_OK), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_NCP_CANCEL), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_COMPANY_PASSWORD_CANCEL), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_NCP_OK), SetFill(1, 0), SetDataTip(STR_BUTTON_OK, STR_COMPANY_PASSWORD_OK), EndContainer(), }; diff --git a/src/widgets/music_widget.h b/src/widgets/music_widget.h --- a/src/widgets/music_widget.h +++ b/src/widgets/music_widget.h @@ -14,40 +14,40 @@ /** Widgets of the WC_MUSIC_TRACK_SELECTION. */ enum MusicTrackSelectionWidgets { - MTSW_LIST_LEFT, - MTSW_PLAYLIST, - MTSW_LIST_RIGHT, - MTSW_ALL, - MTSW_OLD, - MTSW_NEW, - MTSW_EZY, - MTSW_CUSTOM1, - MTSW_CUSTOM2, - MTSW_CLEAR, + WID_MTS_LIST_LEFT, ///< Left button. + WID_MTS_PLAYLIST, ///< Playlist. + WID_MTS_LIST_RIGHT, ///< Right button. + WID_MTS_ALL, ///< All button. + WID_MTS_OLD, ///< Old button. + WID_MTS_NEW, ///< New button. + WID_MTS_EZY, ///< Ezy button. + WID_MTS_CUSTOM1, ///< Custom1 button. + WID_MTS_CUSTOM2, ///< Custom2 button. + WID_MTS_CLEAR, ///< Clear button. }; /** Widgets of the WC_MUSIC_WINDOW. */ enum MusicWidgets { - MW_PREV, - MW_NEXT, - MW_STOP, - MW_PLAY, - MW_SLIDERS, - MW_MUSIC_VOL, - MW_EFFECT_VOL, - MW_BACKGROUND, - MW_TRACK, - MW_TRACK_NR, - MW_TRACK_TITLE, - MW_TRACK_NAME, - MW_SHUFFLE, - MW_PROGRAMME, - MW_ALL, - MW_OLD, - MW_NEW, - MW_EZY, - MW_CUSTOM1, - MW_CUSTOM2, + WID_M_PREV, ///< Previous button. + WID_M_NEXT, ///< Next button. + WID_M_STOP, ///< Stop button. + WID_M_PLAY, ///< Play button. + WID_M_SLIDERS, ///< Sliders. + WID_M_MUSIC_VOL, ///< Music volume. + WID_M_EFFECT_VOL, ///< Effect volume. + WID_M_BACKGROUND, ///< Background of the window. + WID_M_TRACK, ///< Track playing. + WID_M_TRACK_NR, ///< Track number. + WID_M_TRACK_TITLE, ///< Track title. + WID_M_TRACK_NAME, ///< Track name. + WID_M_SHUFFLE, ///< Shuffle button. + WID_M_PROGRAMME, ///< Program button. + WID_M_ALL, ///< All button. + WID_M_OLD, ///< Old button. + WID_M_NEW, ///< New button. + WID_M_EZY, ///< Ezy button. + WID_M_CUSTOM1, ///< Custom1 button. + WID_M_CUSTOM2, ///< Custom2 button. }; #endif /* WIDGETS_MUSIC_WIDGET_H */ diff --git a/src/widgets/network_chat_widget.h b/src/widgets/network_chat_widget.h --- a/src/widgets/network_chat_widget.h +++ b/src/widgets/network_chat_widget.h @@ -14,11 +14,11 @@ /** Widgets of the WC_SEND_NETWORK_MSG. */ enum NetWorkChatWidgets { - NWCW_CLOSE, - NWCW_BACKGROUND, - NWCW_DESTINATION, - NWCW_TEXTBOX, - NWCW_SENDBUTTON, + WID_NC_CLOSE, ///< Close button. + WID_NC_BACKGROUND, ///< Background of the window. + WID_NC_DESTINATION, ///< Destination. + WID_NC_TEXTBOX, ///< Textbox. + WID_NC_SENDBUTTON, ///< Send button. }; diff --git a/src/widgets/network_content_widget.h b/src/widgets/network_content_widget.h --- a/src/widgets/network_content_widget.h +++ b/src/widgets/network_content_widget.h @@ -13,35 +13,35 @@ #define WIDGETS_NETWORK_CONTENT_WIDGET_H /** Widgets of the WC_NETWORK_STATUS_WINDOW (WC_NETWORK_STATUS_WINDOW is also used in NetworkJoinStatusWidgets). */ -enum NetworkContentDownloadStatusWindowWidgets { - NCDSWW_BACKGROUND, ///< Background - NCDSWW_CANCELOK, ///< (Optional) Cancel/OK button +enum NetworkContentDownloadStatusWidgets { + WID_NCDS_BACKGROUND, ///< Background of the window. + WID_NCDS_CANCELOK, ///< (Optional) Cancel/OK button. }; /** Widgets of the WC_NETWORK_WINDOW (WC_NETWORK_WINDOW is also used in NetworkGameWindowWidgets, NetworkStartServerWidgets, and NetworkLobbyWindowWidgets). */ -enum NetworkContentListWindowWidgets { - NCLWW_BACKGROUND, ///< Resize button +enum NetworkContentListWidgets { + WID_NCL_BACKGROUND, ///< Resize button. - NCLWW_FILTER_CAPT, ///< Caption for the filter editbox - NCLWW_FILTER, ///< Filter editbox + WID_NCL_FILTER_CAPT, ///< Caption for the filter editbox. + WID_NCL_FILTER, ///< Filter editbox. - NCLWW_CHECKBOX, ///< Button above checkboxes - NCLWW_TYPE, ///< 'Type' button - NCLWW_NAME, ///< 'Name' button + WID_NCL_CHECKBOX, ///< Button above checkboxes. + WID_NCL_TYPE, ///< 'Type' button. + WID_NCL_NAME, ///< 'Name' button. - NCLWW_MATRIX, ///< Panel with list of content - NCLWW_SCROLLBAR, ///< Scrollbar of matrix + WID_NCL_MATRIX, ///< Panel with list of content. + WID_NCL_SCROLLBAR, ///< Scrollbar of matrix. - NCLWW_DETAILS, ///< Panel with content details + WID_NCL_DETAILS, ///< Panel with content details. - NCLWW_SELECT_ALL, ///< 'Select all' button - NCLWW_SELECT_UPDATE, ///< 'Select updates' button - NCLWW_UNSELECT, ///< 'Unselect all' button - NCLWW_OPEN_URL, ///< 'Open url' button - NCLWW_CANCEL, ///< 'Cancel' button - NCLWW_DOWNLOAD, ///< 'Download' button + WID_NCL_SELECT_ALL, ///< 'Select all' button. + WID_NCL_SELECT_UPDATE, ///< 'Select updates' button. + WID_NCL_UNSELECT, ///< 'Unselect all' button. + WID_NCL_OPEN_URL, ///< 'Open url' button. + WID_NCL_CANCEL, ///< 'Cancel' button. + WID_NCL_DOWNLOAD, ///< 'Download' button. - NCLWW_SEL_ALL_UPDATE, ///< #NWID_SELECTION widget for select all/update buttons. + WID_NCL_SEL_ALL_UPDATE, ///< #NWID_SELECTION widget for select all/update buttons.. }; #endif /* WIDGETS_NETWORK_CONTENT_WIDGET_H */ diff --git a/src/widgets/network_widget.h b/src/widgets/network_widget.h --- a/src/widgets/network_widget.h +++ b/src/widgets/network_widget.h @@ -12,117 +12,116 @@ #ifndef WIDGETS_NETWORK_WIDGET_H #define WIDGETS_NETWORK_WIDGET_H -/** Widgets of the WC_NETWORK_WINDOW (WC_NETWORK_WINDOW is also used in NetworkContentListWindowWidgets, NetworkStartServerWidgets, and NetworkLobbyWindowWidgets). */ -enum NetworkGameWindowWidgets { - NGWW_MAIN, ///< Main panel +/** Widgets of the WC_NETWORK_WINDOW (WC_NETWORK_WINDOW is also used in NetworkContentListWidgets, NetworkStartServerWidgets, and NetworkLobbyWidgets). */ +enum NetworkGameWidgets { + WID_NG_MAIN, ///< Main panel. - NGWW_CONNECTION, ///< Label in front of connection droplist - NGWW_CONN_BTN, ///< 'Connection' droplist button - NGWW_CLIENT_LABEL, ///< Label in front of client name edit box - NGWW_CLIENT, ///< Panel with editbox to set client name + WID_NG_CONNECTION, ///< Label in front of connection droplist. + WID_NG_CONN_BTN, ///< 'Connection' droplist button. + WID_NG_CLIENT_LABEL, ///< Label in front of client name edit box. + WID_NG_CLIENT, ///< Panel with editbox to set client name. - NGWW_HEADER, ///< Header container of the matrix - NGWW_NAME, ///< 'Name' button - NGWW_CLIENTS, ///< 'Clients' button - NGWW_MAPSIZE, ///< 'Map size' button - NGWW_DATE, ///< 'Date' button - NGWW_YEARS, ///< 'Years' button - NGWW_INFO, ///< Third button in the game list panel + WID_NG_HEADER, ///< Header container of the matrix. + WID_NG_NAME, ///< 'Name' button. + WID_NG_CLIENTS, ///< 'Clients' button. + WID_NG_MAPSIZE, ///< 'Map size' button. + WID_NG_DATE, ///< 'Date' button. + WID_NG_YEARS, ///< 'Years' button. + WID_NG_INFO, ///< Third button in the game list panel. - NGWW_MATRIX, ///< Panel with list of games - NGWW_SCROLLBAR, ///< Scrollbar of matrix + WID_NG_MATRIX, ///< Panel with list of games. + WID_NG_SCROLLBAR, ///< Scrollbar of matrix. - NGWW_LASTJOINED_LABEL, ///< Label "Last joined server:" - NGWW_LASTJOINED, ///< Info about the last joined server - NGWW_LASTJOINED_SPACER, ///< Spacer after last joined server panel + WID_NG_LASTJOINED_LABEL, ///< Label "Last joined server:". + WID_NG_LASTJOINED, ///< Info about the last joined server. + WID_NG_LASTJOINED_SPACER, ///< Spacer after last joined server panel. - NGWW_DETAILS, ///< Panel with game details - NGWW_DETAILS_SPACER, ///< Spacer for game actual details - NGWW_JOIN, ///< 'Join game' button - NGWW_REFRESH, ///< 'Refresh server' button - NGWW_NEWGRF, ///< 'NewGRF Settings' button - NGWW_NEWGRF_SEL, ///< Selection 'widget' to hide the NewGRF settings - NGWW_NEWGRF_MISSING, ///< 'Find missing NewGRF online' button - NGWW_NEWGRF_MISSING_SEL, ///< Selection widget for the above button + WID_NG_DETAILS, ///< Panel with game details. + WID_NG_DETAILS_SPACER, ///< Spacer for game actual details. + WID_NG_JOIN, ///< 'Join game' button. + WID_NG_REFRESH, ///< 'Refresh server' button. + WID_NG_NEWGRF, ///< 'NewGRF Settings' button. + WID_NG_NEWGRF_SEL, ///< Selection 'widget' to hide the NewGRF settings. + WID_NG_NEWGRF_MISSING, ///< 'Find missing NewGRF online' button. + WID_NG_NEWGRF_MISSING_SEL, ///< Selection widget for the above button. - NGWW_FIND, ///< 'Find server' button - NGWW_ADD, ///< 'Add server' button - NGWW_START, ///< 'Start server' button - NGWW_CANCEL, ///< 'Cancel' button + WID_NG_FIND, ///< 'Find server' button. + WID_NG_ADD, ///< 'Add server' button. + WID_NG_START, ///< 'Start server' button. + WID_NG_CANCEL, ///< 'Cancel' button. }; -/** Widgets of the WC_NETWORK_WINDOW (WC_NETWORK_WINDOW is also used in NetworkContentListWindowWidgets, NetworkGameWindowWidgets, and NetworkLobbyWindowWidgets). */ +/** Widgets of the WC_NETWORK_WINDOW (WC_NETWORK_WINDOW is also used in NetworkContentListWidgets, NetworkGameWidgets, and NetworkLobbyWidgets). */ enum NetworkStartServerWidgets { - NSSW_BACKGROUND, - NSSW_GAMENAME_LABEL, - NSSW_GAMENAME, ///< Background for editbox to set game name - NSSW_SETPWD, ///< 'Set password' button - NSSW_CONNTYPE_LABEL, - NSSW_CONNTYPE_BTN, ///< 'Connection type' droplist button - NSSW_CLIENTS_LABEL, - NSSW_CLIENTS_BTND, ///< 'Max clients' downarrow - NSSW_CLIENTS_TXT, ///< 'Max clients' text - NSSW_CLIENTS_BTNU, ///< 'Max clients' uparrow - NSSW_COMPANIES_LABEL, - NSSW_COMPANIES_BTND, ///< 'Max companies' downarrow - NSSW_COMPANIES_TXT, ///< 'Max companies' text - NSSW_COMPANIES_BTNU, ///< 'Max companies' uparrow - NSSW_SPECTATORS_LABEL, - NSSW_SPECTATORS_BTND, ///< 'Max spectators' downarrow - NSSW_SPECTATORS_TXT, ///< 'Max spectators' text - NSSW_SPECTATORS_BTNU, ///< 'Max spectators' uparrow + WID_NSS_BACKGROUND, ///< Background of the window. + WID_NSS_GAMENAME_LABEL, ///< Label for the game name. + WID_NSS_GAMENAME, ///< Background for editbox to set game name. + WID_NSS_SETPWD, ///< 'Set password' button. + WID_NSS_CONNTYPE_LABEL, ///< Label for 'connection type'. + WID_NSS_CONNTYPE_BTN, ///< 'Connection type' droplist button. + WID_NSS_CLIENTS_LABEL, ///< Label for 'max clients'. + WID_NSS_CLIENTS_BTND, ///< 'Max clients' downarrow. + WID_NSS_CLIENTS_TXT, ///< 'Max clients' text. + WID_NSS_CLIENTS_BTNU, ///< 'Max clients' uparrow. + WID_NSS_COMPANIES_LABEL, ///< Label for 'max companies'. + WID_NSS_COMPANIES_BTND, ///< 'Max companies' downarrow. + WID_NSS_COMPANIES_TXT, ///< 'Max companies' text. + WID_NSS_COMPANIES_BTNU, ///< 'Max companies' uparrow. + WID_NSS_SPECTATORS_LABEL, ///< Label for 'max spectators'. + WID_NSS_SPECTATORS_BTND, ///< 'Max spectators' downarrow. + WID_NSS_SPECTATORS_TXT, ///< 'Max spectators' text. + WID_NSS_SPECTATORS_BTNU, ///< 'Max spectators' uparrow. - NSSW_LANGUAGE_LABEL, - NSSW_LANGUAGE_BTN, ///< 'Language spoken' droplist button + WID_NSS_LANGUAGE_LABEL, ///< Label for 'language spoken'. + WID_NSS_LANGUAGE_BTN, ///< 'Language spoken' droplist button. - NSSW_GENERATE_GAME, ///< New game button - NSSW_LOAD_GAME, ///< Load game button - NSSW_PLAY_SCENARIO, ///< Play scenario button - NSSW_PLAY_HEIGHTMAP, ///< Play heightmap button + WID_NSS_GENERATE_GAME, ///< New game button. + WID_NSS_LOAD_GAME, ///< Load game button. + WID_NSS_PLAY_SCENARIO, ///< Play scenario button. + WID_NSS_PLAY_HEIGHTMAP, ///< Play heightmap button. - NSSW_CANCEL, ///< 'Cancel' button + WID_NSS_CANCEL, ///< 'Cancel' button. }; -/** Widgets of the WC_NETWORK_WINDOW (WC_NETWORK_WINDOW is also used in NetworkContentListWindowWidgets, NetworkGameWindowWidgets, and NetworkStartServerWidgets). */ -enum NetworkLobbyWindowWidgets { - NLWW_BACKGROUND, ///< Background panel - NLWW_TEXT, ///< Heading text - NLWW_HEADER, ///< Header above list of companies - NLWW_MATRIX, ///< List of companies - NLWW_SCROLLBAR, ///< Scroll bar - NLWW_DETAILS, ///< Company details - NLWW_JOIN, ///< 'Join company' button - NLWW_NEW, ///< 'New company' button - NLWW_SPECTATE, ///< 'Spectate game' button - NLWW_REFRESH, ///< 'Refresh server' button - NLWW_CANCEL, ///< 'Cancel' button +/** Widgets of the WC_NETWORK_WINDOW (WC_NETWORK_WINDOW is also used in NetworkContentListWidgets, NetworkGameWidgets, and NetworkStartServerWidgets). */ +enum NetworkLobbyWidgets { + WID_NL_BACKGROUND, ///< Background of the window. + WID_NL_TEXT, ///< Heading text. + WID_NL_HEADER, ///< Header above list of companies. + WID_NL_MATRIX, ///< List of companies. + WID_NL_SCROLLBAR, ///< Scroll bar. + WID_NL_DETAILS, ///< Company details. + WID_NL_JOIN, ///< 'Join company' button. + WID_NL_NEW, ///< 'New company' button. + WID_NL_SPECTATE, ///< 'Spectate game' button. + WID_NL_REFRESH, ///< 'Refresh server' button. + WID_NL_CANCEL, ///< 'Cancel' button. }; /** Widgets of the WC_CLIENT_LIST. */ enum ClientListWidgets { - CLW_PANEL, + WID_CL_PANEL, ///< Panel of the window. }; /** Widgets of the WC_CLIENT_LIST_POPUP. */ enum ClientListPopupWidgets { - CLPW_PANEL, + WID_CLP_PANEL, ///< Panel of the window. }; -/** Widgets of the WC_NETWORK_STATUS_WINDOW (WC_NETWORK_STATUS_WINDOW is also used in NetworkContentDownloadStatusWindowWidgets). */ +/** Widgets of the WC_NETWORK_STATUS_WINDOW (WC_NETWORK_STATUS_WINDOW is also used in NetworkContentDownloadStatusWidgets). */ enum NetworkJoinStatusWidgets { - NJSW_BACKGROUND, ///< Background - NJSW_CANCELOK, ///< Cancel/OK button + WID_NJS_BACKGROUND, ///< Background of the window. + WID_NJS_CANCELOK, ///< Cancel / OK button. }; /** Widgets of the WC_COMPANY_PASSWORD_WINDOW. */ -enum NetworkCompanyPasswordWindowWidgets { - NCPWW_BACKGROUND, ///< The background of the interface - NCPWW_LABEL, ///< Label in front of the password field - NCPWW_PASSWORD, ///< Input field for the password - NCPWW_SAVE_AS_DEFAULT_PASSWORD, ///< Toggle 'button' for saving the current password as default password - NCPWW_CANCEL, ///< Close the window without changing anything - NCPWW_OK, ///< Safe the password etc. +enum NetworkCompanyPasswordWidgets { + WID_NCP_BACKGROUND, ///< Background of the window. + WID_NCP_LABEL, ///< Label in front of the password field. + WID_NCP_PASSWORD, ///< Input field for the password. + WID_NCP_SAVE_AS_DEFAULT_PASSWORD, ///< Toggle 'button' for saving the current password as default password. + WID_NCP_CANCEL, ///< Close the window without changing anything. + WID_NCP_OK, ///< Safe the password etc. }; - #endif /* WIDGETS_NETWORK_WIDGET_H */