BRIDGE+GUI: adjusted behavior for GuiReferenceGetCellContent
This commit is contained in:
parent
5715e1cc27
commit
3b754f0791
|
@ -1228,9 +1228,9 @@ BRIDGE_IMPEXP void GuiReferenceSetCellContent(int row, int col, const char* str)
|
|||
_gui_sendmessage(GUI_REF_SETCELLCONTENT, &info, 0);
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP const char* GuiReferenceGetCellContent(int row, int col)
|
||||
BRIDGE_IMPEXP char* GuiReferenceGetCellContent(int row, int col)
|
||||
{
|
||||
return (const char*)_gui_sendmessage(GUI_REF_GETCELLCONTENT, (void*)(duint)row, (void*)(duint)col);
|
||||
return (char*)_gui_sendmessage(GUI_REF_GETCELLCONTENT, (void*)(duint)row, (void*)(duint)col);
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP void GuiReferenceReloadData()
|
||||
|
|
|
@ -1088,7 +1088,7 @@ BRIDGE_IMPEXP int GuiReferenceGetRowCount();
|
|||
BRIDGE_IMPEXP void GuiReferenceDeleteAllColumns();
|
||||
BRIDGE_IMPEXP void GuiReferenceInitialize(const char* name);
|
||||
BRIDGE_IMPEXP void GuiReferenceSetCellContent(int row, int col, const char* str);
|
||||
BRIDGE_IMPEXP const char* GuiReferenceGetCellContent(int row, int col);
|
||||
BRIDGE_IMPEXP char* GuiReferenceGetCellContent(int row, int col);
|
||||
BRIDGE_IMPEXP void GuiReferenceReloadData();
|
||||
BRIDGE_IMPEXP void GuiReferenceSetSingleSelection(int index, bool scroll);
|
||||
BRIDGE_IMPEXP void GuiReferenceSetProgress(int progress);
|
||||
|
|
|
@ -12,6 +12,7 @@ bool cbInstrDisableGuiUpdate(int argc, char* argv[]);
|
|||
bool cbDebugSetfreezestack(int argc, char* argv[]);
|
||||
bool cbInstrRefinit(int argc, char* argv[]);
|
||||
bool cbInstrRefadd(int argc, char* argv[]);
|
||||
bool cbInstrRefGet(int argc, char* argv[]);
|
||||
bool cbInstrEnableLog(int argc, char* argv[]);
|
||||
bool cbInstrDisableLog(int argc, char* argv[]);
|
||||
bool cbInstrAddFavTool(int argc, char* argv[]);
|
||||
|
|
|
@ -385,6 +385,7 @@ static void registercommands()
|
|||
dbgcmdnew("setfreezestack", cbDebugSetfreezestack, false); //freeze the stack from auto updates
|
||||
dbgcmdnew("refinit", cbInstrRefinit, false);
|
||||
dbgcmdnew("refadd", cbInstrRefadd, false);
|
||||
dbgcmdnew("refget", cbInstrRefGet, false);
|
||||
dbgcmdnew("EnableLog\1LogEnable", cbInstrEnableLog, false); //enable log
|
||||
dbgcmdnew("DisableLog\1LogDisable", cbInstrDisableLog, false); //disable log
|
||||
dbgcmdnew("ClearLog\1cls\1lc\1lclr", cbClearLog, false); //clear the log
|
||||
|
|
|
@ -209,7 +209,8 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
|
|||
break;
|
||||
|
||||
case GUI_REF_ADDCOLUMN:
|
||||
referenceManager->currentReferenceView()->addColumnAt((int)param1, QString((const char*)param2));
|
||||
if(referenceManager->currentReferenceView())
|
||||
referenceManager->currentReferenceView()->addColumnAt((int)param1, QString((const char*)param2));
|
||||
break;
|
||||
|
||||
case GUI_REF_SETROWCOUNT:
|
||||
|
@ -217,7 +218,9 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
|
|||
break;
|
||||
|
||||
case GUI_REF_GETROWCOUNT:
|
||||
return (void*)referenceManager->currentReferenceView()->mList->getRowCount();
|
||||
if(referenceManager->currentReferenceView())
|
||||
return (void*)referenceManager->currentReferenceView()->mList->getRowCount();
|
||||
return 0;
|
||||
|
||||
case GUI_REF_DELETEALLCOLUMNS:
|
||||
GuiReferenceInitialize(tr("References").toUtf8().constData());
|
||||
|
@ -231,7 +234,15 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
|
|||
break;
|
||||
|
||||
case GUI_REF_GETCELLCONTENT:
|
||||
return (void*)referenceManager->currentReferenceView()->mList->getCellContent((int)param1, (int)param2).toUtf8().constData();
|
||||
{
|
||||
QString content;
|
||||
if(referenceManager->currentReferenceView())
|
||||
content = referenceManager->currentReferenceView()->mList->getCellContent((int)param1, (int)param2);
|
||||
auto bytes = content.toUtf8();
|
||||
auto data = BridgeAlloc(bytes.size() + 1);
|
||||
memcpy(data, bytes.constData(), bytes.size());
|
||||
return data;
|
||||
}
|
||||
|
||||
case GUI_REF_RELOADDATA:
|
||||
emit referenceReloadData();
|
||||
|
|
Loading…
Reference in New Issue