Fix a crash when going into a directory with no files in the editor file browser, clicking on listboxes for same sets inputbox correctly
This commit is contained in:
parent
7aa618b266
commit
a327d380a7
|
@ -3,6 +3,7 @@ D1X-Rebirth Changelog
|
||||||
20120411
|
20120411
|
||||||
--------
|
--------
|
||||||
editor/ehostage.c, editor/medrobot.c, ui/file.c, ui/inputbox.c, ui/keypress.c, ui/listbox.c, ui/message.c, ui/uidraw.c: Draw the object rotation velocity, file browser and MessageBox dialogs properly
|
editor/ehostage.c, editor/medrobot.c, ui/file.c, ui/inputbox.c, ui/keypress.c, ui/listbox.c, ui/message.c, ui/uidraw.c: Draw the object rotation velocity, file browser and MessageBox dialogs properly
|
||||||
|
ui/file.c: Fix a crash when going into a directory with no files in the editor file browser, clicking on listboxes for same sets inputbox correctly
|
||||||
|
|
||||||
20120409
|
20120409
|
||||||
--------
|
--------
|
||||||
|
|
10
ui/file.c
10
ui/file.c
|
@ -121,7 +121,6 @@ typedef struct browser
|
||||||
UI_GADGET_LISTBOX *listbox2;
|
UI_GADGET_LISTBOX *listbox2;
|
||||||
UI_GADGET_INPUTBOX *user_file;
|
UI_GADGET_INPUTBOX *user_file;
|
||||||
int num_files, num_dirs;
|
int num_files, num_dirs;
|
||||||
int new_listboxes;
|
|
||||||
char spaces[35];
|
char spaces[35];
|
||||||
} browser;
|
} browser;
|
||||||
|
|
||||||
|
@ -157,17 +156,16 @@ static int browser_handler(UI_DIALOG *dlg, d_event *event, browser *b)
|
||||||
rval = 1;
|
rval = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((event->type == EVENT_UI_LISTBOX_MOVED) || b->new_listboxes)
|
if (event->type == EVENT_UI_LISTBOX_MOVED)
|
||||||
{
|
{
|
||||||
if (b->listbox1->current_item >= 0 )
|
if ((ui_event_get_gadget(event) == (UI_GADGET *)b->listbox1) && (b->listbox1->current_item >= 0) && b->filename_list[b->listbox1->current_item])
|
||||||
ui_inputbox_set_text(b->user_file, b->filename_list[b->listbox1->current_item]);
|
ui_inputbox_set_text(b->user_file, b->filename_list[b->listbox1->current_item]);
|
||||||
|
|
||||||
if (b->listbox2->current_item >= 0 )
|
if ((ui_event_get_gadget(event) == (UI_GADGET *)b->listbox2) && (b->listbox2->current_item >= 0) && b->directory_list[b->listbox2->current_item])
|
||||||
ui_inputbox_set_text(b->user_file, b->directory_list[b->listbox2->current_item]);
|
ui_inputbox_set_text(b->user_file, b->directory_list[b->listbox2->current_item]);
|
||||||
|
|
||||||
rval = 1;
|
rval = 1;
|
||||||
}
|
}
|
||||||
b->new_listboxes = 0;
|
|
||||||
|
|
||||||
if (GADGET_PRESSED(b->button1) || GADGET_PRESSED(b->user_file) || (event->type == EVENT_UI_LISTBOX_SELECTED))
|
if (GADGET_PRESSED(b->button1) || GADGET_PRESSED(b->user_file) || (event->type == EVENT_UI_LISTBOX_SELECTED))
|
||||||
{
|
{
|
||||||
|
@ -250,7 +248,6 @@ static int browser_handler(UI_DIALOG *dlg, d_event *event, browser *b)
|
||||||
|
|
||||||
ui_listbox_change(dlg, b->listbox1, b->num_files, b->filename_list);
|
ui_listbox_change(dlg, b->listbox1, b->num_files, b->filename_list);
|
||||||
ui_listbox_change(dlg, b->listbox2, b->num_dirs, b->directory_list);
|
ui_listbox_change(dlg, b->listbox2, b->num_dirs, b->directory_list);
|
||||||
b->new_listboxes = 1;
|
|
||||||
|
|
||||||
//i = TICKER;
|
//i = TICKER;
|
||||||
//while ( TICKER < i+2 );
|
//while ( TICKER < i+2 );
|
||||||
|
@ -334,7 +331,6 @@ int ui_get_filename( char * filename, char * filespec, char * message )
|
||||||
b->filename = filename;
|
b->filename = filename;
|
||||||
b->filespec = filespec;
|
b->filespec = filespec;
|
||||||
b->message = message;
|
b->message = message;
|
||||||
b->new_listboxes = 0;
|
|
||||||
|
|
||||||
wind = ui_dialog_get_window(dlg);
|
wind = ui_dialog_get_window(dlg);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue