BRIDGE: added GuiScriptEnableHighlighting
DBG: removed debug printf DBG: fixed manifest problems
This commit is contained in:
parent
5777b7364f
commit
a339dd2d2f
|
@ -690,6 +690,11 @@ BRIDGE_IMPEXP int GuiScriptMsgyn(const char* message)
|
|||
return (int)(duint)_gui_sendmessage(GUI_SCRIPT_MSGYN, (void*)message, 0);
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP void GuiScriptEnableHighlighting(bool enable)
|
||||
{
|
||||
_gui_sendmessage(GUI_SCRIPT_ENABLEHIGHLIGHTING, (void*)(duint)enable, 0);
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP void GuiSymbolLogAdd(const char* message)
|
||||
{
|
||||
_gui_sendmessage(GUI_SYMBOL_LOG_ADD, (void*)message, 0);
|
||||
|
|
|
@ -552,7 +552,8 @@ enum GUIMSG
|
|||
GUI_GETLINE_WINDOW, // param1=const char* title, param2=char* text
|
||||
GUI_AUTOCOMPLETE_ADDCMD, // param1=const char* cmd, param2=ununsed
|
||||
GUI_AUTOCOMPLETE_DELCMD, // param1=const char* cmd, param2=ununsed
|
||||
GUI_AUTOCOMPLETE_CLEARALL // param1=ununsed, param2=unused
|
||||
GUI_AUTOCOMPLETE_CLEARALL, // param1=ununsed, param2=unused
|
||||
GUI_SCRIPT_ENABLEHIGHLIGHTING // param1=bool enable, param2=unused
|
||||
};
|
||||
|
||||
//GUI structures
|
||||
|
@ -589,6 +590,7 @@ BRIDGE_IMPEXP void GuiScriptSetTitle(const char* title);
|
|||
BRIDGE_IMPEXP void GuiScriptSetInfoLine(int line, const char* info);
|
||||
BRIDGE_IMPEXP void GuiScriptMessage(const char* message);
|
||||
BRIDGE_IMPEXP int GuiScriptMsgyn(const char* message);
|
||||
BRIDGE_IMPEXP void GuiScriptEnableHighlighting(bool enable);
|
||||
BRIDGE_IMPEXP void GuiSymbolLogAdd(const char* message);
|
||||
BRIDGE_IMPEXP void GuiSymbolLogClear();
|
||||
BRIDGE_IMPEXP void GuiSymbolSetProgress(int percent);
|
||||
|
|
|
@ -68,6 +68,7 @@ CMDRESULT cbDebugAttach(int argc, char* argv[]);
|
|||
CMDRESULT cbDebugDetach(int argc, char* argv[]);
|
||||
CMDRESULT cbDebugDump(int argc, char* argv[]);
|
||||
CMDRESULT cbDebugStackDump(int argc, char* argv[]);
|
||||
CMDRESULT cbDebugContinue(int argc, char* argv[]);
|
||||
|
||||
//variables
|
||||
extern PROCESS_INFORMATION* fdProcessInfo;
|
||||
|
|
|
@ -289,7 +289,6 @@ bool pluginmenuclear(int hMenu)
|
|||
|
||||
void pluginmenucall(int hEntry)
|
||||
{
|
||||
dprintf("pluginmenucall(%d)\n", hEntry);
|
||||
if(hEntry==-1)
|
||||
return;
|
||||
for(unsigned int i=0; i<pluginMenuList.size(); i++)
|
||||
|
|
|
@ -480,6 +480,7 @@ static DWORD WINAPI scriptRunThread(void* arg)
|
|||
static DWORD WINAPI scriptLoadThread(void* filename)
|
||||
{
|
||||
GuiScriptClear();
|
||||
GuiScriptEnableHighlighting(true); //enable default script syntax highlighting
|
||||
scriptIp=0;
|
||||
std::vector<SCRIPTBP>().swap(scriptbplist); //clear breakpoints
|
||||
std::vector<int>().swap(scriptstack); //clear script stack
|
||||
|
|
|
@ -47,11 +47,13 @@
|
|||
<OutDir>$(SolutionDir)bin\x32\</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
<TargetName>x32_dbg</TargetName>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)bin\x64\</OutDir>
|
||||
<TargetName>x64_dbg</TargetName>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
|
@ -68,6 +70,8 @@
|
|||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>$(SolutionDir)bin\x32\x32_bridge.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ProgramDatabaseFile>$(TargetDir)$(TargetName)_exe.pdb</ProgramDatabaseFile>
|
||||
<AdditionalManifestDependencies>
|
||||
</AdditionalManifestDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
@ -84,6 +88,8 @@
|
|||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>$(SolutionDir)bin\x64\x64_bridge.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ProgramDatabaseFile>$(TargetDir)$(TargetName)_exe.pdb</ProgramDatabaseFile>
|
||||
<AdditionalManifestDependencies>
|
||||
</AdditionalManifestDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
ScriptView::ScriptView(StdTable *parent) : StdTable(parent)
|
||||
{
|
||||
mEnableSyntaxHighlighting=false;
|
||||
enableMultiSelection(false);
|
||||
|
||||
int charwidth=QFontMetrics(this->font()).width(QChar(' '));
|
||||
|
@ -20,6 +21,7 @@ ScriptView::ScriptView(StdTable *parent) : StdTable(parent)
|
|||
connect(Bridge::getBridge(), SIGNAL(scriptSetInfoLine(int,QString)), this, SLOT(setInfoLine(int,QString)));
|
||||
connect(Bridge::getBridge(), SIGNAL(scriptMessage(QString)), this, SLOT(message(QString)));
|
||||
connect(Bridge::getBridge(), SIGNAL(scriptQuestion(QString)), this, SLOT(question(QString)));
|
||||
connect(Bridge::getBridge(), SIGNAL(scriptEnableHighlighting(bool)), this, SLOT(enableHighlighting(bool)));
|
||||
|
||||
setupContextMenu();
|
||||
}
|
||||
|
@ -67,38 +69,103 @@ QString ScriptView::paintContent(QPainter* painter, int_t rowBase, int rowOffset
|
|||
|
||||
case 1: //command
|
||||
{
|
||||
//initialize
|
||||
painter->save();
|
||||
int charwidth=QFontMetrics(this->font()).width(QChar(' '));
|
||||
int xadd=charwidth; //for testing
|
||||
QList<CustomRichText_t> richText;
|
||||
CustomRichText_t newRichText;
|
||||
QString command=getCellContent(rowBase+rowOffset, col);
|
||||
if(mEnableSyntaxHighlighting)
|
||||
{
|
||||
//initialize
|
||||
painter->save();
|
||||
int charwidth=QFontMetrics(this->font()).width(QChar(' '));
|
||||
int xadd=charwidth; //for testing
|
||||
QList<CustomRichText_t> richText;
|
||||
CustomRichText_t newRichText;
|
||||
QString command=getCellContent(rowBase+rowOffset, col);
|
||||
|
||||
//handle comments
|
||||
int comment_idx=command.indexOf("//"); //find the index of the space
|
||||
QString comment="";
|
||||
if(comment_idx!=-1 && command.at(0)!=QChar('/')) //there is a comment
|
||||
{
|
||||
comment=command.right(command.length()-comment_idx);
|
||||
if(command.at(comment_idx-1)==QChar(' '))
|
||||
command.truncate(comment_idx-1);
|
||||
else
|
||||
command.truncate(comment_idx);
|
||||
}
|
||||
|
||||
//setup the richText list
|
||||
switch(linetype)
|
||||
{
|
||||
case linecommand:
|
||||
{
|
||||
if(isScriptCommand(command, "ret"))
|
||||
//handle comments
|
||||
int comment_idx=command.indexOf("//"); //find the index of the space
|
||||
QString comment="";
|
||||
if(comment_idx!=-1 && command.at(0)!=QChar('/')) //there is a comment
|
||||
{
|
||||
newRichText.flags=FlagBackground;
|
||||
newRichText.textBackground=QColor("#00FFFF");
|
||||
newRichText.text="ret";
|
||||
comment=command.right(command.length()-comment_idx);
|
||||
if(command.at(comment_idx-1)==QChar(' '))
|
||||
command.truncate(comment_idx-1);
|
||||
else
|
||||
command.truncate(comment_idx);
|
||||
}
|
||||
|
||||
//setup the richText list
|
||||
switch(linetype)
|
||||
{
|
||||
case linecommand:
|
||||
{
|
||||
if(isScriptCommand(command, "ret"))
|
||||
{
|
||||
newRichText.flags=FlagBackground;
|
||||
newRichText.textBackground=QColor("#00FFFF");
|
||||
newRichText.text="ret";
|
||||
richText.push_back(newRichText);
|
||||
QString remainder=command.right(command.length()-3);
|
||||
if(remainder.length())
|
||||
{
|
||||
newRichText.flags=FlagNone;
|
||||
newRichText.text=remainder;
|
||||
richText.push_back(newRichText);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newRichText.flags=FlagNone;
|
||||
newRichText.text=command;
|
||||
richText.push_back(newRichText);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case linebranch:
|
||||
{
|
||||
SCRIPTBRANCH branchinfo;
|
||||
DbgScriptGetBranchInfo(line, &branchinfo);
|
||||
//jumps
|
||||
int i=command.indexOf(" "); //find the index of the space
|
||||
switch(branchinfo.type)
|
||||
{
|
||||
case scriptjmp: //unconditional jumps
|
||||
newRichText.flags=FlagBackground;
|
||||
newRichText.textBackground=QColor("#FFFF00");
|
||||
break;
|
||||
|
||||
case scriptjnejnz: //conditional jumps
|
||||
case scriptjejz:
|
||||
case scriptjbjl:
|
||||
case scriptjajg:
|
||||
case scriptjbejle:
|
||||
case scriptjaejge:
|
||||
newRichText.flags=FlagAll;
|
||||
newRichText.textBackground=QColor("#FFFF00");
|
||||
newRichText.textColor=QColor("#FF0000");
|
||||
break;
|
||||
|
||||
case scriptcall: //calls
|
||||
newRichText.flags=FlagBackground;
|
||||
newRichText.textBackground=QColor("#00FFFF");
|
||||
break;
|
||||
|
||||
default:
|
||||
newRichText.flags=FlagNone;
|
||||
break;
|
||||
}
|
||||
newRichText.text=command.left(i);
|
||||
richText.push_back(newRichText);
|
||||
QString remainder=command.right(command.length()-3);
|
||||
//space
|
||||
newRichText.flags=FlagNone;
|
||||
newRichText.text=" ";
|
||||
richText.push_back(newRichText);
|
||||
//label
|
||||
QString label=branchinfo.branchlabel;
|
||||
newRichText.flags=FlagBackground;
|
||||
newRichText.textBackground=QColor("#FFFF00");
|
||||
newRichText.text=label;
|
||||
richText.push_back(newRichText);
|
||||
//remainder
|
||||
QString remainder=command.right(command.length()-command.indexOf(label)-label.length());
|
||||
if(remainder.length())
|
||||
{
|
||||
newRichText.flags=FlagNone;
|
||||
|
@ -106,113 +173,53 @@ QString ScriptView::paintContent(QPainter* painter, int_t rowBase, int rowOffset
|
|||
richText.push_back(newRichText);
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
case linelabel:
|
||||
{
|
||||
newRichText.flags=FlagNone;
|
||||
newRichText.flags=FlagColor;
|
||||
newRichText.textColor=QColor("#808080");
|
||||
newRichText.text=command;
|
||||
richText.push_back(newRichText);
|
||||
painter->drawLine(QPoint(x+xadd+2, y+h-2), QPoint(x+w-4, y+h-2));
|
||||
}
|
||||
break;
|
||||
|
||||
case linecomment:
|
||||
{
|
||||
newRichText.flags=FlagColor;
|
||||
newRichText.textColor=QColor("#808080");
|
||||
newRichText.text=command;
|
||||
richText.push_back(newRichText);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case linebranch:
|
||||
{
|
||||
SCRIPTBRANCH branchinfo;
|
||||
DbgScriptGetBranchInfo(line, &branchinfo);
|
||||
//jumps
|
||||
int i=command.indexOf(" "); //find the index of the space
|
||||
switch(branchinfo.type)
|
||||
case lineempty:
|
||||
{
|
||||
case scriptjmp: //unconditional jumps
|
||||
newRichText.flags=FlagBackground;
|
||||
newRichText.textBackground=QColor("#FFFF00");
|
||||
break;
|
||||
|
||||
case scriptjnejnz: //conditional jumps
|
||||
case scriptjejz:
|
||||
case scriptjbjl:
|
||||
case scriptjajg:
|
||||
case scriptjbejle:
|
||||
case scriptjaejge:
|
||||
newRichText.flags=FlagAll;
|
||||
newRichText.textBackground=QColor("#FFFF00");
|
||||
newRichText.textColor=QColor("#FF0000");
|
||||
break;
|
||||
|
||||
case scriptcall: //calls
|
||||
newRichText.flags=FlagBackground;
|
||||
newRichText.textBackground=QColor("#00FFFF");
|
||||
break;
|
||||
|
||||
default:
|
||||
newRichText.flags=FlagNone;
|
||||
}
|
||||
break;
|
||||
}
|
||||
newRichText.text=command.left(i);
|
||||
richText.push_back(newRichText);
|
||||
//space
|
||||
newRichText.flags=FlagNone;
|
||||
newRichText.text=" ";
|
||||
richText.push_back(newRichText);
|
||||
//label
|
||||
QString label=branchinfo.branchlabel;
|
||||
newRichText.flags=FlagBackground;
|
||||
newRichText.textBackground=QColor("#FFFF00");
|
||||
newRichText.text=label;
|
||||
richText.push_back(newRichText);
|
||||
//remainder
|
||||
QString remainder=command.right(command.length()-command.indexOf(label)-label.length());
|
||||
if(remainder.length())
|
||||
|
||||
//append the comment (when present)
|
||||
if(comment.length())
|
||||
{
|
||||
CustomRichText_t newRichText;
|
||||
newRichText.flags=FlagNone;
|
||||
newRichText.text=remainder;
|
||||
richText.push_back(newRichText);
|
||||
newRichText.text=" ";
|
||||
richText.push_back(newRichText); //space
|
||||
newRichText.flags=FlagColor;
|
||||
newRichText.textColor=QColor("#808080");
|
||||
newRichText.text=comment;
|
||||
richText.push_back(newRichText); //comment
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case linelabel:
|
||||
{
|
||||
newRichText.flags=FlagColor;
|
||||
newRichText.textColor=QColor("#808080");
|
||||
newRichText.text=command;
|
||||
richText.push_back(newRichText);
|
||||
painter->drawLine(QPoint(x+xadd+2, y+h-2), QPoint(x+w-4, y+h-2));
|
||||
//paint the rich text
|
||||
RichTextPainter::paintRichText(painter, x+1, y, w, h, xadd, &richText, charwidth);
|
||||
painter->restore();
|
||||
returnString="";
|
||||
}
|
||||
break;
|
||||
|
||||
case linecomment:
|
||||
{
|
||||
newRichText.flags=FlagColor;
|
||||
newRichText.textColor=QColor("#808080");
|
||||
newRichText.text=command;
|
||||
richText.push_back(newRichText);
|
||||
}
|
||||
break;
|
||||
|
||||
case lineempty:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//append the comment (when present)
|
||||
if(comment.length())
|
||||
{
|
||||
CustomRichText_t newRichText;
|
||||
newRichText.flags=FlagNone;
|
||||
newRichText.text=" ";
|
||||
richText.push_back(newRichText); //space
|
||||
newRichText.flags=FlagColor;
|
||||
newRichText.textColor=QColor("#808080");
|
||||
newRichText.text=comment;
|
||||
richText.push_back(newRichText); //comment
|
||||
}
|
||||
|
||||
//paint the rich text
|
||||
RichTextPainter::paintRichText(painter, x+1, y, w, h, xadd, &richText, charwidth);
|
||||
painter->restore();
|
||||
returnString="";
|
||||
else //no syntax highlighting
|
||||
returnString=getCellContent(rowBase+rowOffset, col);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -529,3 +536,8 @@ void ScriptView::question(QString message)
|
|||
else
|
||||
Bridge::getBridge()->BridgeSetResult(0);
|
||||
}
|
||||
|
||||
void ScriptView::enableHighlighting(bool enable)
|
||||
{
|
||||
mEnableSyntaxHighlighting=enable;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ public slots:
|
|||
void message(QString message);
|
||||
void newIp();
|
||||
void question(QString message);
|
||||
void enableHighlighting(bool enable);
|
||||
|
||||
private:
|
||||
//private functions
|
||||
|
@ -49,6 +50,7 @@ private:
|
|||
|
||||
//private variables
|
||||
int mIpLine;
|
||||
bool mEnableSyntaxHighlighting;
|
||||
|
||||
QMenu* mLoadMenu;
|
||||
QAction* mScriptLoad;
|
||||
|
|
|
@ -139,6 +139,11 @@ int Bridge::emitScriptQuestion(QString message)
|
|||
return bridgeResult;
|
||||
}
|
||||
|
||||
void Bridge::emitScriptEnableHighlighting(bool enable)
|
||||
{
|
||||
emit scriptEnableHighlighting(enable);
|
||||
}
|
||||
|
||||
void Bridge::emitUpdateSymbolList(int module_count, SYMBOLMODULEINFO* modules)
|
||||
{
|
||||
emit updateSymbolList(module_count, modules);
|
||||
|
@ -475,6 +480,12 @@ __declspec(dllexport) void* _gui_sendmessage(GUIMSG type, void* param1, void* pa
|
|||
}
|
||||
break;
|
||||
|
||||
case GUI_SCRIPT_ENABLEHIGHLIGHTING:
|
||||
{
|
||||
Bridge::getBridge()->emitScriptEnableHighlighting((bool)(int_t)param1);
|
||||
}
|
||||
break;
|
||||
|
||||
case GUI_SYMBOL_UPDATE_MODULE_LIST:
|
||||
{
|
||||
Bridge::getBridge()->emitUpdateSymbolList((int)(int_t)param1, (SYMBOLMODULEINFO*)param2);
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
void emitScriptSetInfoLine(int line, QString info);
|
||||
void emitScriptMessage(QString message);
|
||||
int emitScriptQuestion(QString message);
|
||||
void emitScriptEnableHighlighting(bool enable);
|
||||
void emitUpdateSymbolList(int module_count, SYMBOLMODULEINFO* modules);
|
||||
void emitAddMsgToSymbolLog(QString msg);
|
||||
void emitClearSymbolLog();
|
||||
|
@ -97,6 +98,7 @@ signals:
|
|||
void scriptSetInfoLine(int line, QString info);
|
||||
void scriptMessage(QString message);
|
||||
void scriptQuestion(QString message);
|
||||
void scriptEnableHighlighting(bool enable);
|
||||
void updateSymbolList(int module_count, SYMBOLMODULEINFO* modules);
|
||||
void addMsgToSymbolLog(QString msg);
|
||||
void clearSymbolLog();
|
||||
|
|
Loading…
Reference in New Issue