mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
(MESS) ui: fixed for real the wrong confirmation menu being
prompted when leaving file creation. also, better backspace support in the file creation menu (so that it work on Mac too). nw.
This commit is contained in:
parent
f8f06c9a5c
commit
9bdcb9ce52
@ -980,8 +980,8 @@ void ui_menu_control_floppy_image::handle()
|
||||
break;
|
||||
|
||||
case ui_menu_select_rw::WRITE_OTHER:
|
||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_create(machine(), container, image, current_directory, current_file)));
|
||||
state = CREATE_FILE;
|
||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_create(machine(), container, image, current_directory, current_file, &create_ok)));
|
||||
state = CHECK_CREATE;
|
||||
break;
|
||||
|
||||
case -1:
|
||||
|
@ -54,7 +54,7 @@ static void input_character(char *buffer, size_t buffer_length, unicode_char uni
|
||||
{
|
||||
size_t buflen = strlen(buffer);
|
||||
|
||||
if ((unichar == 8) && (buflen > 0))
|
||||
if ((unichar == 8 || unichar == 0x7f) && (buflen > 0))
|
||||
{
|
||||
*(char *)utf8_previous_char(&buffer[buflen]) = 0;
|
||||
}
|
||||
@ -65,7 +65,6 @@ static void input_character(char *buffer, size_t buffer_length, unicode_char uni
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// extra_text_draw_box - generically adds header
|
||||
// or footer text
|
||||
@ -220,12 +219,14 @@ static int is_valid_filename_char(unicode_char unichar)
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
ui_menu_file_create::ui_menu_file_create(running_machine &machine, render_container *container, device_image_interface *image, astring ¤t_directory, astring ¤t_file)
|
||||
ui_menu_file_create::ui_menu_file_create(running_machine &machine, render_container *container, device_image_interface *image, astring ¤t_directory, astring ¤t_file, bool *ok)
|
||||
: ui_menu(machine, container),
|
||||
m_current_directory(current_directory),
|
||||
m_current_file(current_file)
|
||||
{
|
||||
m_image = image;
|
||||
m_ok = ok;
|
||||
*m_ok = true;
|
||||
}
|
||||
|
||||
|
||||
@ -328,12 +329,13 @@ void ui_menu_file_create::handle()
|
||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||
}
|
||||
break;
|
||||
case IPT_UI_CANCEL:
|
||||
*m_ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
FILE SELECTOR MENU
|
||||
***************************************************************************/
|
||||
|
@ -34,7 +34,7 @@ private:
|
||||
class ui_menu_file_create : public ui_menu
|
||||
{
|
||||
public:
|
||||
ui_menu_file_create(running_machine &machine, render_container *container, device_image_interface *image, astring ¤t_directory, astring ¤t_file);
|
||||
ui_menu_file_create(running_machine &machine, render_container *container, device_image_interface *image, astring ¤t_directory, astring ¤t_file, bool *ok);
|
||||
virtual ~ui_menu_file_create();
|
||||
virtual void populate();
|
||||
virtual void handle();
|
||||
@ -46,6 +46,9 @@ private:
|
||||
astring & m_current_file;
|
||||
const image_device_format * m_current_format;
|
||||
char m_filename_buffer[1024];
|
||||
|
||||
protected:
|
||||
bool * m_ok;
|
||||
};
|
||||
|
||||
|
||||
|
@ -276,8 +276,8 @@ void ui_menu_control_device_image::handle()
|
||||
break;
|
||||
|
||||
case ui_menu_file_selector::R_CREATE:
|
||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_create(machine(), container, image, current_directory, current_file)));
|
||||
state = CREATE_FILE;
|
||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_create(machine(), container, image, current_directory, current_file, &create_ok)));
|
||||
state = CHECK_CREATE;
|
||||
break;
|
||||
|
||||
case ui_menu_file_selector::R_SOFTLIST:
|
||||
@ -309,12 +309,16 @@ void ui_menu_control_device_image::handle()
|
||||
break;
|
||||
}
|
||||
|
||||
case CREATE_CONFIRM: {
|
||||
case CREATE_CONFIRM:
|
||||
state = create_confirmed ? DO_CREATE : START_FILE;
|
||||
handle();
|
||||
break;
|
||||
}
|
||||
|
||||
case CHECK_CREATE:
|
||||
state = create_ok ? CREATE_FILE : START_FILE;
|
||||
handle();
|
||||
break;
|
||||
|
||||
case DO_CREATE: {
|
||||
astring path;
|
||||
zippath_combine(path, current_directory, current_file);
|
||||
|
@ -25,7 +25,9 @@ public:
|
||||
|
||||
protected:
|
||||
enum {
|
||||
START_FILE, START_OTHER_PART, START_SOFTLIST, SELECT_PARTLIST, SELECT_ONE_PART, SELECT_OTHER_PART, SELECT_FILE, CREATE_FILE, CREATE_CONFIRM, DO_CREATE, SELECT_SOFTLIST,
|
||||
START_FILE, START_OTHER_PART, START_SOFTLIST,
|
||||
SELECT_PARTLIST, SELECT_ONE_PART, SELECT_OTHER_PART,
|
||||
SELECT_FILE, CREATE_FILE, CREATE_CONFIRM, CHECK_CREATE, DO_CREATE, SELECT_SOFTLIST,
|
||||
LAST_ID
|
||||
};
|
||||
|
||||
@ -39,6 +41,8 @@ protected:
|
||||
// methods
|
||||
virtual void hook_load(astring filename, bool softlist);
|
||||
|
||||
bool create_ok;
|
||||
|
||||
private:
|
||||
// instance variables
|
||||
bool create_confirmed;
|
||||
|
Loading…
Reference in New Issue
Block a user