- enhancement: Show mousetip for numbers in the GNU assembly file.

This commit is contained in:
Roy Qu 2023-03-04 18:23:57 +08:00
parent 8d9a79068d
commit 1504e6cb04
8 changed files with 406 additions and 306 deletions

View File

@ -1,8 +1,10 @@
Red Panda C++ Version 2.17
- enhancement: Add X86_64 AVX/AVX instruction descriptions to asm syntaxer.
- enhancement: Update to the newest x86 Assembly manual.
- enhancement: Update x86 Assembly manual link to the newest website.
- enhancement: Add "New Text File" in the File menu
- enhancement: Add "address" in the memory view's mouse tip.
- enhancement: Show mousetip for numbers in the GNU assembly file.
Red Panda C++ Version 2.16

View File

@ -3166,7 +3166,10 @@ QVariant MemoryModel::data(const QModelIndex &index, int role) const
return QString("%1").arg(line->datas[col],2,16,QChar('0'));
} else if (role == Qt::ToolTipRole) {
if (col<line->datas.count()) {
QString s =tr("dec: %1").arg(line->datas[col])
QString s =
tr("addr: %1").arg(line->startAddress+col,0,16)
+"<br/>"
+tr("dec: %1").arg(line->datas[col])
+"<br/>"
+tr("oct: %1").arg(line->datas[col],0,8)
+"<br/>"

View File

@ -1882,6 +1882,15 @@ void Editor::onTooltipTimer()
pError = issues->front();
}
}
if (reason == TipType::Number) {
if (!syntaxer() ||
(syntaxer()->language() != QSynedit::ProgrammingLanguage::Assembly
&& syntaxer()->language() != QSynedit::ProgrammingLanguage::ATTAssembly
)
) {
reason=TipType::None;
}
}
// Get subject
bool isIncludeLine = false;
@ -1927,6 +1936,19 @@ void Editor::onTooltipTimer()
case TipType::Error:
s = pError->token;
break;
case TipType::Number:
if (!mCompletionPopup->isVisible()
&& !mHeaderCompletionPopup->isVisible()) {
QSynedit::PTokenAttribute attr;
int start;
if (getTokenAttriAtRowColEx(p,s,start,attr)) {
QString line=document()->getLine(p.line-1);
int idx=start-2;
if (idx>=0 && idx<line.length() && line[idx]=='-')
s='-'+s;
}
}
break;
case TipType::None:
cancelHint();
mCurrentWord = "";
@ -1955,7 +1977,6 @@ void Editor::onTooltipTimer()
mCurrentWord = s;
mCurrentTipType = reason;
// Determine what to do with subject
QString hint = "";
switch (reason) {
@ -1984,6 +2005,33 @@ void Editor::onTooltipTimer()
}
}
break;
case TipType::Number:
if (syntaxer() &&
(syntaxer()->language() == QSynedit::ProgrammingLanguage::Assembly
|| syntaxer()->language() == QSynedit::ProgrammingLanguage::ATTAssembly)
) {
qDebug()<<s;
bool neg=false;
LONGLONG val;
bool ok;
if (s.startsWith("-")) {
s=s.mid(1);
neg=true;
}
if (s.startsWith("0x")) {
val=s.toLongLong(&ok,16);
} else {
val=s.toLongLong(&ok,10);
}
if (ok) {
if (neg)
val = -val;
hint=tr("hex: %1").arg((ULONGLONG)val,0,16)
+"<br />"
+tr("dec: %1").arg(val,0,10);
}
}
break;
case TipType::Keyword:
if (pSettings->editor().enableIdentifierToolTips()) {
if (syntaxer() &&
@ -3854,6 +3902,8 @@ Editor::TipType Editor::getTipType(QPoint point, QSynedit::BufferCoord& pos)
return TipType::Preprocessor;
} else if (attr->tokenType() == QSynedit::TokenType::Identifier) {
return TipType::Identifier;
} else if (attr->tokenType() == QSynedit::TokenType::Number) {
return TipType::Number;
} else if (attr->tokenType() == QSynedit::TokenType::Keyword) {
return TipType::Keyword;
}

View File

@ -105,6 +105,7 @@ public:
Identifier, // cursor hovers above identifier
Selection, // cursor hovers above selection
Keyword,
Number,
None, // mouseover not allowed
Error //Cursor hovers above error line/item;
};

View File

@ -439,6 +439,7 @@
<addaction name="actionStep_Over"/>
<addaction name="actionStep_Into"/>
<addaction name="actionStep_Out"/>
<addaction name="actionRun_To_Cursor"/>
<addaction name="actionContinue"/>
<addaction name="actionStop_Execution"/>
<addaction name="separator"/>
@ -2398,6 +2399,10 @@
</property>
</action>
<action name="actionRun_To_Cursor">
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/icons/images/newlook24/052-next.png</normaloff>:/icons/images/newlook24/052-next.png</iconset>
</property>
<property name="text">
<string>Run To Cursor</string>
</property>

View File

@ -1046,6 +1046,14 @@
<source>Error Load File</source>
<translation type="unfinished">Erro ao carregar arquivo</translation>
</message>
<message>
<source>hex: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>dec: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditorAutoSaveWidget</name>
@ -5138,6 +5146,10 @@
<source>bin: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>addr: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NewClassDialog</name>

File diff suppressed because it is too large Load Diff

View File

@ -927,6 +927,14 @@
<source>Error Load File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>hex: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>dec: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditorAutoSaveWidget</name>
@ -4891,6 +4899,10 @@
<source>bin: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>addr: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NewClassDialog</name>