mirror of https://github.com/OpenRCT2/OpenRCT2.git
Refactor WIDX_UP and WIDX_NEW
This commit is contained in:
parent
446db73dc2
commit
58964cb301
|
@ -239,31 +239,20 @@ static void window_loadsave_mouseup(rct_window *w, int widgetIndex)
|
||||||
int result = 0;
|
int result = 0;
|
||||||
char path[MAX_PATH], filter[MAX_PATH];
|
char path[MAX_PATH], filter[MAX_PATH];
|
||||||
|
|
||||||
|
bool isSave = (_type & 0x01) == LOADSAVETYPE_SAVE;
|
||||||
switch (widgetIndex){
|
switch (widgetIndex){
|
||||||
case WIDX_CLOSE:
|
case WIDX_CLOSE:
|
||||||
window_close(w);
|
window_close(w);
|
||||||
break;
|
break;
|
||||||
case WIDX_UP:
|
case WIDX_UP:
|
||||||
{
|
safe_strcpy(path, _parentDirectory, sizeof(path));
|
||||||
char directory[MAX_PATH];
|
window_loadsave_populate_list(w, isSave, path, _extension);
|
||||||
int includeNewItem = (_type & 1) == LOADSAVETYPE_SAVE;
|
|
||||||
|
|
||||||
safe_strcpy(directory, _parentDirectory, sizeof(directory));
|
|
||||||
window_loadsave_populate_list(w, includeNewItem, directory, _extension);
|
|
||||||
window_init_scroll_widgets(w);
|
window_init_scroll_widgets(w);
|
||||||
w->no_list_items = _listItemsCount;
|
w->no_list_items = _listItemsCount;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case WIDX_NEW:
|
case WIDX_NEW:
|
||||||
{
|
window_text_input_open(w, WIDX_NEW, STR_NONE, STR_FILEBROWSER_NAME_PROMPT, STR_STRING, (uint32)&_defaultName, 64);
|
||||||
rct_string_id templateStringId = STR_PLACEHOLDER;
|
|
||||||
char *templateString;
|
|
||||||
|
|
||||||
templateString = (char *)language_get_string(templateStringId);
|
|
||||||
strcpy(templateString, _defaultName);
|
|
||||||
window_text_input_open(w, WIDX_NEW, STR_NONE, STR_FILEBROWSER_NAME_PROMPT, templateStringId, 0, 64);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case WIDX_BROWSE:
|
case WIDX_BROWSE:
|
||||||
safe_strcpy(path, _directory, MAX_PATH);
|
safe_strcpy(path, _directory, MAX_PATH);
|
||||||
if (_type & LOADSAVETYPE_SAVE) {
|
if (_type & LOADSAVETYPE_SAVE) {
|
||||||
|
|
Loading…
Reference in New Issue