DBG+GUI+BRIDGE: allow menu items to be checkable
This commit is contained in:
parent
96e07deeef
commit
98d04b2a78
|
@ -1367,6 +1367,11 @@ BRIDGE_IMPEXP void GuiMenuSetEntryIcon(int hEntry, const ICONDATA* icon)
|
|||
_gui_sendmessage(GUI_MENU_SET_ENTRY_ICON, (void*)hEntry, (void*)icon);
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP void GuiMenuSetEntryChecked(int hEntry, bool checked)
|
||||
{
|
||||
_gui_sendmessage(GUI_MENU_SET_ENTRY_CHECKED, (void*)hEntry, (void*)checked);
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP void GuiShowCpu()
|
||||
{
|
||||
_gui_sendmessage(GUI_SHOW_CPU, 0, 0);
|
||||
|
|
|
@ -966,7 +966,8 @@ typedef enum
|
|||
GUI_SET_FAVOURITE_TOOL_SHORTCUT,// param1=const char* name param2=const char* shortcut
|
||||
GUI_FOLD_DISASSEMBLY, // param1=duint startAddress param2=duint length
|
||||
GUI_SELECT_IN_MEMORY_MAP, // param1=duint addr, param2=unused
|
||||
GUI_GET_ACTIVE_VIEW // param1=ACTIVEVIEW*, param2=unused
|
||||
GUI_GET_ACTIVE_VIEW, // param1=ACTIVEVIEW*, param2=unused
|
||||
GUI_MENU_SET_ENTRY_CHECKED // param1=int hEntry, param2=bool checked
|
||||
} GUIMSG;
|
||||
|
||||
//GUI Typedefs
|
||||
|
@ -1077,6 +1078,7 @@ BRIDGE_IMPEXP void GuiUpdateSEHChain();
|
|||
BRIDGE_IMPEXP void GuiLoadSourceFile(const char* path, int line);
|
||||
BRIDGE_IMPEXP void GuiMenuSetIcon(int hMenu, const ICONDATA* icon);
|
||||
BRIDGE_IMPEXP void GuiMenuSetEntryIcon(int hEntry, const ICONDATA* icon);
|
||||
BRIDGE_IMPEXP void GuiMenuSetEntryChecked(int hEntry, bool checked);
|
||||
BRIDGE_IMPEXP void GuiShowCpu();
|
||||
BRIDGE_IMPEXP void GuiAddQWidgetTab(void* qWidget);
|
||||
BRIDGE_IMPEXP void GuiShowQWidgetTab(void* qWidget);
|
||||
|
|
|
@ -92,6 +92,11 @@ PLUG_IMPEXP void _plugin_menuentryseticon(int pluginHandle, int hEntry, const IC
|
|||
pluginmenuentryseticon(pluginHandle, hEntry, icon);
|
||||
}
|
||||
|
||||
PLUG_IMPEXP void _plugin_menuentrysetchecked(int pluginHandle, int hEntry, bool checked)
|
||||
{
|
||||
pluginmenuentrysetchecked(pluginHandle, hEntry, checked);
|
||||
}
|
||||
|
||||
PLUG_IMPEXP void _plugin_startscript(CBPLUGINSCRIPT cbScript)
|
||||
{
|
||||
dbgstartscriptthread(cbScript);
|
||||
|
@ -122,4 +127,4 @@ PLUG_IMPEXP bool _plugin_unload(const char* pluginName)
|
|||
PLUG_IMPEXP bool _plugin_load(const char* pluginName)
|
||||
{
|
||||
return pluginload(pluginName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -245,6 +245,7 @@ PLUG_IMPEXP bool _plugin_menuaddseparator(int hMenu);
|
|||
PLUG_IMPEXP bool _plugin_menuclear(int hMenu);
|
||||
PLUG_IMPEXP void _plugin_menuseticon(int hMenu, const ICONDATA* icon);
|
||||
PLUG_IMPEXP void _plugin_menuentryseticon(int pluginHandle, int hEntry, const ICONDATA* icon);
|
||||
PLUG_IMPEXP void _plugin_menuentrysetchecked(int pluginHandle, int hEntry, bool checked);
|
||||
PLUG_IMPEXP void _plugin_startscript(CBPLUGINSCRIPT cbScript);
|
||||
PLUG_IMPEXP bool _plugin_waituntilpaused();
|
||||
PLUG_IMPEXP bool _plugin_registerexprfunction(int pluginHandle, const char* name, int argc, CBPLUGINEXPRFUNCTION cbFunction, void* userdata);
|
||||
|
|
|
@ -767,6 +767,21 @@ void pluginmenuentryseticon(int pluginHandle, int hEntry, const ICONDATA* icon)
|
|||
}
|
||||
}
|
||||
|
||||
void pluginmenuentrysetchecked(int pluginHandle, int hEntry, bool checked)
|
||||
{
|
||||
if(hEntry == -1)
|
||||
return;
|
||||
SHARED_ACQUIRE(LockPluginMenuList);
|
||||
for(const auto & currentMenu : pluginMenuList)
|
||||
{
|
||||
if(currentMenu.pluginHandle == pluginHandle && currentMenu.hEntryPlugin == hEntry)
|
||||
{
|
||||
GuiMenuSetEntryChecked(currentMenu.hEntryMenu, checked);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool pluginexprfuncregister(int pluginHandle, const char* name, int argc, CBPLUGINEXPRFUNCTION cbFunction, void* userdata)
|
||||
{
|
||||
PLUG_EXPRFUNCTION plugExprfunction;
|
||||
|
|
|
@ -73,6 +73,7 @@ bool pluginwinevent(MSG* message, long* result);
|
|||
bool pluginwineventglobal(MSG* message);
|
||||
void pluginmenuseticon(int hMenu, const ICONDATA* icon);
|
||||
void pluginmenuentryseticon(int pluginHandle, int hEntry, const ICONDATA* icon);
|
||||
void pluginmenuentrysetchecked(int pluginHandle, int hEntry, bool checked);
|
||||
bool pluginexprfuncregister(int pluginHandle, const char* name, int argc, CBPLUGINEXPRFUNCTION cbFunction, void* userdata);
|
||||
bool pluginexprfuncunregister(int pluginHandle, const char* name);
|
||||
|
||||
|
|
|
@ -479,6 +479,14 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
|
|||
}
|
||||
break;
|
||||
|
||||
case GUI_MENU_SET_ENTRY_CHECKED:
|
||||
{
|
||||
BridgeResult result;
|
||||
emit setCheckedMenuEntry(int(param1), bool(param2));
|
||||
result.Wait();
|
||||
}
|
||||
break;
|
||||
|
||||
case GUI_SHOW_CPU:
|
||||
emit showCpu();
|
||||
break;
|
||||
|
|
|
@ -110,6 +110,7 @@ signals:
|
|||
void loadSourceFile(const QString path, int line, int selection);
|
||||
void setIconMenuEntry(int hEntry, QIcon icon);
|
||||
void setIconMenu(int hMenu, QIcon icon);
|
||||
void setCheckedMenuEntry(int hEntry, bool checked);
|
||||
void showCpu();
|
||||
void addQWidgetTab(QWidget* qWidget);
|
||||
void showQWidgetTab(QWidget* qWidget);
|
||||
|
|
|
@ -75,6 +75,7 @@ MainWindow::MainWindow(QWidget* parent)
|
|||
connect(Bridge::getBridge(), SIGNAL(getStrWindow(QString, QString*)), this, SLOT(getStrWindow(QString, QString*)));
|
||||
connect(Bridge::getBridge(), SIGNAL(setIconMenu(int, QIcon)), this, SLOT(setIconMenu(int, QIcon)));
|
||||
connect(Bridge::getBridge(), SIGNAL(setIconMenuEntry(int, QIcon)), this, SLOT(setIconMenuEntry(int, QIcon)));
|
||||
connect(Bridge::getBridge(), SIGNAL(setCheckedMenuEntry(int, bool)), this, SLOT(setCheckedMenuEntry(int, bool)));
|
||||
connect(Bridge::getBridge(), SIGNAL(showCpu()), this, SLOT(displayCpuWidget()));
|
||||
connect(Bridge::getBridge(), SIGNAL(addQWidgetTab(QWidget*)), this, SLOT(addQWidgetTab(QWidget*)));
|
||||
connect(Bridge::getBridge(), SIGNAL(showQWidgetTab(QWidget*)), this, SLOT(showQWidgetTab(QWidget*)));
|
||||
|
@ -1055,6 +1056,7 @@ void MainWindow::addMenuEntry(int hMenu, QString title)
|
|||
QWidget* parent = hMenu == -1 ? this : menu->parent;
|
||||
QAction* wAction = new QAction(title, parent);
|
||||
wAction->setObjectName(QString().sprintf("ENTRY|%d", hEntryNew));
|
||||
wAction->setCheckable(true);
|
||||
parent->addAction(wAction);
|
||||
connect(wAction, SIGNAL(triggered()), this, SLOT(menuEntrySlot()));
|
||||
newInfo.mAction = wAction;
|
||||
|
@ -1183,6 +1185,20 @@ void MainWindow::setIconMenu(int hMenu, QIcon icon)
|
|||
Bridge::getBridge()->setResult();
|
||||
}
|
||||
|
||||
void MainWindow::setCheckedMenuEntry(int hEntry, bool checked)
|
||||
{
|
||||
for(int i = 0; i < mEntryList.size(); i++)
|
||||
{
|
||||
if(mEntryList.at(i).hEntry == hEntry)
|
||||
{
|
||||
const MenuEntryInfo & entry = mEntryList.at(i);
|
||||
entry.mAction->setChecked(checked);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Bridge::getBridge()->setResult();
|
||||
}
|
||||
|
||||
void MainWindow::runSelection()
|
||||
{
|
||||
if(!DbgIsDebugging())
|
||||
|
|
|
@ -102,6 +102,7 @@ public slots:
|
|||
void removeMenuEntry(int hEntry);
|
||||
void setIconMenuEntry(int hEntry, QIcon icon);
|
||||
void setIconMenu(int hMenu, QIcon icon);
|
||||
void setCheckedMenuEntry(int hEntry, bool checked);
|
||||
void runSelection();
|
||||
void runExpression();
|
||||
void getStrWindow(const QString title, QString* text);
|
||||
|
|
Loading…
Reference in New Issue