mirror of
https://github.com/holub/mame
synced 2025-07-05 18:08:04 +03:00
Moving paste() from mame_ui_manager class to natural_keyboard class,
exposing to LUA
This commit is contained in:
parent
a0ca0e8e7d
commit
3aa9ee4992
@ -564,6 +564,27 @@ void natural_keyboard::post_coded(const char *text, size_t length, const attotim
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// paste - does a paste from the keyboard
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void natural_keyboard::paste()
|
||||||
|
{
|
||||||
|
// retrieve the clipboard text
|
||||||
|
char *text = osd_get_clipboard_text();
|
||||||
|
|
||||||
|
// was a result returned?
|
||||||
|
if (text != nullptr)
|
||||||
|
{
|
||||||
|
// post the text
|
||||||
|
post_utf8(text);
|
||||||
|
|
||||||
|
// free the string
|
||||||
|
free(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// build_codes - given an input port table, create
|
// build_codes - given an input port table, create
|
||||||
// an input code table useful for mapping unicode
|
// an input code table useful for mapping unicode
|
||||||
|
@ -54,6 +54,7 @@ public:
|
|||||||
void post(const char32_t *text, size_t length = 0, const attotime &rate = attotime::zero);
|
void post(const char32_t *text, size_t length = 0, const attotime &rate = attotime::zero);
|
||||||
void post_utf8(const char *text, size_t length = 0, const attotime &rate = attotime::zero);
|
void post_utf8(const char *text, size_t length = 0, const attotime &rate = attotime::zero);
|
||||||
void post_coded(const char *text, size_t length = 0, const attotime &rate = attotime::zero);
|
void post_coded(const char *text, size_t length = 0, const attotime &rate = attotime::zero);
|
||||||
|
void paste();
|
||||||
|
|
||||||
// debugging
|
// debugging
|
||||||
void dump(std::ostream &str) const;
|
void dump(std::ostream &str) const;
|
||||||
|
@ -766,6 +766,7 @@ void lua_engine::initialize()
|
|||||||
emu["romname"] = [this](){ return machine().basename(); };
|
emu["romname"] = [this](){ return machine().basename(); };
|
||||||
emu["softname"] = [this]() { return machine().options().software_name(); };
|
emu["softname"] = [this]() { return machine().options().software_name(); };
|
||||||
emu["keypost"] = [this](const char *keys){ machine().ioport().natkeyboard().post_utf8(keys); };
|
emu["keypost"] = [this](const char *keys){ machine().ioport().natkeyboard().post_utf8(keys); };
|
||||||
|
emu["paste"] = [this](){ machine().ioport().natkeyboard().paste(); };
|
||||||
emu["time"] = [this](){ return machine().time().as_double(); };
|
emu["time"] = [this](){ return machine().time().as_double(); };
|
||||||
emu["start"] = [this](const char *driver) {
|
emu["start"] = [this](const char *driver) {
|
||||||
int i = driver_list::find(driver);
|
int i = driver_list::find(driver);
|
||||||
|
@ -904,27 +904,6 @@ bool mame_ui_manager::can_paste()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
|
||||||
// paste - does a paste from the keyboard
|
|
||||||
//-------------------------------------------------
|
|
||||||
|
|
||||||
void mame_ui_manager::paste()
|
|
||||||
{
|
|
||||||
// retrieve the clipboard text
|
|
||||||
char *text = osd_get_clipboard_text();
|
|
||||||
|
|
||||||
// was a result returned?
|
|
||||||
if (text != nullptr)
|
|
||||||
{
|
|
||||||
// post the text
|
|
||||||
machine().ioport().natkeyboard().post_utf8(text);
|
|
||||||
|
|
||||||
// free the string
|
|
||||||
free(text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// draw_fps_counter
|
// draw_fps_counter
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
@ -1105,7 +1084,7 @@ uint32_t mame_ui_manager::handler_ingame(render_container &container)
|
|||||||
{
|
{
|
||||||
// paste command
|
// paste command
|
||||||
if (machine().ui_input().pressed(IPT_UI_PASTE))
|
if (machine().ui_input().pressed(IPT_UI_PASTE))
|
||||||
paste();
|
machine().ioport().natkeyboard().paste();
|
||||||
}
|
}
|
||||||
|
|
||||||
image_handler_ingame();
|
image_handler_ingame();
|
||||||
|
@ -223,7 +223,6 @@ public:
|
|||||||
void show_mouse(bool status);
|
void show_mouse(bool status);
|
||||||
virtual bool is_menu_active() override;
|
virtual bool is_menu_active() override;
|
||||||
bool can_paste();
|
bool can_paste();
|
||||||
void paste();
|
|
||||||
void image_handler_ingame();
|
void image_handler_ingame();
|
||||||
void increase_frameskip();
|
void increase_frameskip();
|
||||||
void decrease_frameskip();
|
void decrease_frameskip();
|
||||||
|
Loading…
Reference in New Issue
Block a user