2013-03-15 13:11:33 +00:00
|
|
|
namespace phoenix {
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
void pMenu::append(Action& action) {
|
2011-09-05 03:48:23 +00:00
|
|
|
action.state.window = this->action.state.window;
|
|
|
|
|
|
|
|
gtk_menu_shell_append(GTK_MENU_SHELL(gtkMenu), action.p.widget);
|
|
|
|
if(action.state.window && action.state.window->state.menuFont != "") {
|
|
|
|
action.p.setFont(action.state.window->state.menuFont);
|
|
|
|
}
|
2011-02-24 09:27:21 +00:00
|
|
|
gtk_widget_show(action.p.widget);
|
|
|
|
}
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
void pMenu::remove(Action& action) {
|
2011-09-05 03:48:23 +00:00
|
|
|
action.p.orphan();
|
2013-03-15 13:11:33 +00:00
|
|
|
action.state.window = nullptr;
|
2011-02-24 09:27:21 +00:00
|
|
|
}
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
void pMenu::setImage(const image& image) {
|
2012-06-18 10:13:51 +00:00
|
|
|
if(image.empty() == false) {
|
2013-05-02 11:25:45 +00:00
|
|
|
GtkImage* gtkImage = CreateImage(image, true);
|
2012-06-18 10:13:51 +00:00
|
|
|
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(widget), (GtkWidget*)gtkImage);
|
|
|
|
} else {
|
|
|
|
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(widget), nullptr);
|
|
|
|
}
|
2012-01-26 06:50:09 +00:00
|
|
|
}
|
|
|
|
|
2013-05-05 09:21:30 +00:00
|
|
|
void pMenu::setText(string text) {
|
Update to v085r03 release.
byuu says:
Changelog:
- fixed cursor being visible under Metacity window manager (hopefully
doesn't cause regression with other WMs)
- show normal cursor when using SDL video driver
- added menu accelerators (meh, why not?)
- removed debugvirtual, ChipDebugger and chip/debugger functionality
entirely
- alt/smp disassembler moved up
- fixed alt/smp incw/decw instructions (unsigned->uint16 for internal
variables)
My plan going forward for a debugger is not to hardcode functionality
that causes the 10-15% slowdown right into the emulator itself.
Instead, I'm going to make a callback class, which will be a specialized
version of nall::function:
- can call function even if not assigned (results in no-op, return type
must have a trivial default constructor)
- if compiled without #define DEBUGGER, the entire thing turns into
a huge no-op; and will be eliminated entirely when compiled
- strategically place the functions: cb_step, cb_read, cb_write, etc.
From here, the ui-debugger GUI will bind the callbacks, implement
breakpoint checking, usage table generation, etc itself.
I'll probably have to add some breakout commands to exit the emulation
core prior to a frame event in some cases as well.
I didn't initially want any debugger-related stuff in the base cores,
but the #if debugger sCPUDebugger #else sCPU #endif stuff was already
more of a burden than this will be.
2012-02-04 09:23:53 +00:00
|
|
|
gtk_menu_item_set_label(GTK_MENU_ITEM(widget), mnemonic(text));
|
2011-02-24 09:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void pMenu::constructor() {
|
2011-09-05 03:48:23 +00:00
|
|
|
gtkMenu = gtk_menu_new();
|
Update to v085r03 release.
byuu says:
Changelog:
- fixed cursor being visible under Metacity window manager (hopefully
doesn't cause regression with other WMs)
- show normal cursor when using SDL video driver
- added menu accelerators (meh, why not?)
- removed debugvirtual, ChipDebugger and chip/debugger functionality
entirely
- alt/smp disassembler moved up
- fixed alt/smp incw/decw instructions (unsigned->uint16 for internal
variables)
My plan going forward for a debugger is not to hardcode functionality
that causes the 10-15% slowdown right into the emulator itself.
Instead, I'm going to make a callback class, which will be a specialized
version of nall::function:
- can call function even if not assigned (results in no-op, return type
must have a trivial default constructor)
- if compiled without #define DEBUGGER, the entire thing turns into
a huge no-op; and will be eliminated entirely when compiled
- strategically place the functions: cb_step, cb_read, cb_write, etc.
From here, the ui-debugger GUI will bind the callbacks, implement
breakpoint checking, usage table generation, etc itself.
I'll probably have to add some breakout commands to exit the emulation
core prior to a frame event in some cases as well.
I didn't initially want any debugger-related stuff in the base cores,
but the #if debugger sCPUDebugger #else sCPU #endif stuff was already
more of a burden than this will be.
2012-02-04 09:23:53 +00:00
|
|
|
widget = gtk_image_menu_item_new_with_mnemonic("");
|
2011-09-05 03:48:23 +00:00
|
|
|
gtk_menu_item_set_submenu(GTK_MENU_ITEM(widget), gtkMenu);
|
Update to v085r03 release.
byuu says:
Changelog:
- fixed cursor being visible under Metacity window manager (hopefully
doesn't cause regression with other WMs)
- show normal cursor when using SDL video driver
- added menu accelerators (meh, why not?)
- removed debugvirtual, ChipDebugger and chip/debugger functionality
entirely
- alt/smp disassembler moved up
- fixed alt/smp incw/decw instructions (unsigned->uint16 for internal
variables)
My plan going forward for a debugger is not to hardcode functionality
that causes the 10-15% slowdown right into the emulator itself.
Instead, I'm going to make a callback class, which will be a specialized
version of nall::function:
- can call function even if not assigned (results in no-op, return type
must have a trivial default constructor)
- if compiled without #define DEBUGGER, the entire thing turns into
a huge no-op; and will be eliminated entirely when compiled
- strategically place the functions: cb_step, cb_read, cb_write, etc.
From here, the ui-debugger GUI will bind the callbacks, implement
breakpoint checking, usage table generation, etc itself.
I'll probably have to add some breakout commands to exit the emulation
core prior to a frame event in some cases as well.
I didn't initially want any debugger-related stuff in the base cores,
but the #if debugger sCPUDebugger #else sCPU #endif stuff was already
more of a burden than this will be.
2012-02-04 09:23:53 +00:00
|
|
|
setText(menu.state.text);
|
2011-09-05 03:48:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void pMenu::destructor() {
|
|
|
|
gtk_widget_destroy(gtkMenu);
|
|
|
|
gtk_widget_destroy(widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pMenu::orphan() {
|
2013-05-02 11:25:45 +00:00
|
|
|
for(auto& action : menu.state.action) action.p.orphan();
|
2011-09-05 03:48:23 +00:00
|
|
|
destructor();
|
|
|
|
constructor();
|
2013-05-02 11:25:45 +00:00
|
|
|
for(auto& action : menu.state.action) append(action);
|
2011-09-05 03:48:23 +00:00
|
|
|
}
|
|
|
|
|
2013-05-05 09:21:30 +00:00
|
|
|
void pMenu::setFont(string font) {
|
2011-09-05 03:48:23 +00:00
|
|
|
pAction::setFont(font);
|
2013-05-02 11:25:45 +00:00
|
|
|
for(auto& item : menu.state.action) item.p.setFont(font);
|
2011-02-24 09:27:21 +00:00
|
|
|
}
|
2013-03-15 13:11:33 +00:00
|
|
|
|
|
|
|
}
|