Mercurial > hg > openttd
changeset 18648:f68b9653f952 draft
(svn r23495) -Feature: button in NewGRF window to open URL from action14
author | yexo <yexo@openttd.org> |
---|---|
date | Sun, 11 Dec 2011 12:55:28 +0000 |
parents | a52c4c1e219f |
children | 9d5d9d24be00 |
files | src/newgrf_gui.cpp |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -715,6 +715,7 @@ SNGRFS_SCROLL2BAR, SNGRFS_NEWGRF_INFO_TITLE, SNGRFS_NEWGRF_INFO, + SNGRFS_OPEN_URL, SNGRFS_NEWGRF_TEXTFILE, SNGRFS_SET_PARAMETERS = SNGRFS_NEWGRF_TEXTFILE + TFT_END, SNGRFS_TOGGLE_PALETTE, @@ -1022,6 +1023,14 @@ break; } + case SNGRFS_OPEN_URL: { + const GRFConfig *c = (this->avail_sel == NULL) ? this->active_sel : this->avail_sel; + + extern void OpenBrowser(const char *url); + OpenBrowser(c->GetURL()); + break; + } + case SNGRFS_PRESET_SAVE: ShowQueryString(STR_EMPTY, STR_NEWGRF_SETTINGS_PRESET_SAVE_QUERY, 32, this, CS_ALPHANUMERAL, QSF_NONE); break; @@ -1325,6 +1334,7 @@ for (TextfileType tft = TFT_BEGIN; tft < TFT_END; tft++) { this->SetWidgetDisabledState(SNGRFS_NEWGRF_TEXTFILE + tft, c == NULL || c->GetTextfile(tft) == NULL); } + this->SetWidgetDisabledState(SNGRFS_OPEN_URL, c == NULL || StrEmpty(c->GetURL())); this->SetWidgetDisabledState(SNGRFS_SET_PARAMETERS, !this->show_params || disable_all || this->active_sel->num_valid_params == 0); this->SetWidgetDisabledState(SNGRFS_TOGGLE_PALETTE, disable_all); @@ -1837,6 +1847,8 @@ NWidget(WWT_EMPTY, COLOUR_MAUVE, SNGRFS_NEWGRF_INFO_TITLE), SetFill(1, 0), SetResize(1, 0), NWidget(WWT_EMPTY, COLOUR_MAUVE, SNGRFS_NEWGRF_INFO), SetFill(1, 1), SetResize(1, 1), SetMinimalSize(150, 100), EndContainer(), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_OPEN_URL), SetFill(1, 0), SetResize(1, 0), + SetDataTip(STR_CONTENT_OPEN_URL, STR_CONTENT_OPEN_URL_TOOLTIP), NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_NEWGRF_TEXTFILE + TFT_README), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_NEWGRF_SETTINGS_VIEW_README, STR_NULL), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),