1
0
Fork 0

BRIDGE+GUI: adjusted behavior for GuiReferenceGetCellContent

This commit is contained in:
mrexodia 2017-03-11 03:42:26 +01:00
parent 5715e1cc27
commit 3b754f0791
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
5 changed files with 19 additions and 6 deletions

View File

@ -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()

View File

@ -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);

View File

@ -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[]);

View File

@ -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

View File

@ -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();