improved tooltips hiding

added tooltip to breakpoint/trap status
added tooltip to search/compare buttons and dialogs
added tooltips to data operation buttons
This commit is contained in:
thrust26 2020-11-20 10:11:40 +01:00
parent 763685e0c3
commit 3b04034aab
19 changed files with 63 additions and 25 deletions

View File

@ -118,7 +118,8 @@ FBInitStatus Debugger::initializeVideo()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Debugger::start(const string& message, int address, bool read)
bool Debugger::start(const string& message, int address, bool read,
const string& toolTip)
{
if(myOSystem.eventHandler().enterDebugMode())
{
@ -129,6 +130,7 @@ bool Debugger::start(const string& message, int address, bool read)
if(address > -1)
buf << cartDebug().getLabel(address, read, 4);
myDialog->message().setText(buf.str());
myDialog->message().setToolTip(toolTip);
return true;
}
return false;

View File

@ -97,7 +97,8 @@ class Debugger : public DialogContainer
@param message Message to display when entering debugger
@param address An address associated with the message
*/
bool start(const string& message = "", int address = -1, bool read = true);
bool start(const string& message = "", int address = -1, bool read = true,
const string& toolTip = "");
bool startWithFatalError(const string& message = "");
/**

View File

@ -91,7 +91,7 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
for(int i = 0; i < 4; ++i)
{
myCpuDataSrc[i] = new EditTextWidget(boss, nfont, xpos, src_y, src_w, fontHeight + 1);
myCpuDataSrc[i]->setToolTip("Source label of last load into " + labels[i] + ".");
myCpuDataSrc[i]->setToolTip("Source label of last read for " + labels[i] + ".");
myCpuDataSrc[i]->setEditable(false, true);
src_y += fontHeight + 2;
}
@ -140,7 +140,7 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
xpos = myCpuDataSrc[0]->getLeft();
new StaticTextWidget(boss, lfont, xpos - fontWidth * 4.5, ypos + 2, "Dest");
myCpuDataDest = new EditTextWidget(boss, nfont, xpos, ypos, src_w, fontHeight + 1);
myCpuDataDest->setToolTip("Destination label of last store.");
myCpuDataDest->setToolTip("Destination label of last write.");
myCpuDataDest->setEditable(false, true);
_h = ypos + myPSRegister->getHeight() - y;

View File

@ -33,31 +33,38 @@ DataGridOpsWidget::DataGridOpsWidget(GuiObject* boss, const GUI::Font& font,
xpos = x; ypos = y;
_zeroButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"0", kDGZeroCmd);
_zeroButton->setToolTip("Zero currently selected value");
ypos += bheight + space;
_invButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Inv", kDGInvertCmd);
_invButton->setToolTip("Invert currently selected value");
ypos += bheight + space;
_incButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"++", kDGIncCmd);
_incButton->setToolTip("Increase currently selected value.");
ypos += bheight + space;
_shiftLeftButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"<<", kDGShiftLCmd);
_shiftLeftButton->setToolTip("Shift currently selected value left");
// Move to next column, skip a row
xpos = x + bwidth + space; ypos = y + bheight + space;
_negButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Neg", kDGNegateCmd);
_negButton->setToolTip("Negate currently selected value");
ypos += bheight + space;
_decButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"--", kDGDecCmd);
_decButton->setToolTip("Decrease currently selected value");
ypos += bheight + space;
_shiftRightButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
">>", kDGShiftRCmd);
_shiftRightButton->setToolTip("Shift currently selected value right");
// Calculate real dimensions
_w = 2 * (bwidth+space);

View File

@ -713,6 +713,7 @@ void DataGridWidget::startEditMode()
{
if (isEditable() && !_editMode && _selectedItem >= 0)
{
dialog().tooltip().hide();
enableEditMode(true);
setText("", true); // Erase current entry when starting editing
}

View File

@ -94,6 +94,7 @@ void DebuggerDialog::loadConfig()
myRomTab->loadConfig();
myMessageBox->setText("");
myMessageBox->setToolTip("");
}
void DebuggerDialog::saveConfig()

View File

@ -78,18 +78,21 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
by += bheight + VGAP * 6;
mySearchButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Search" + ELLIPSIS, kSearchCmd);
mySearchButton->setToolTip("Search and highlight found values.");
wid.push_back(mySearchButton);
mySearchButton->setTarget(this);
by += bheight + VGAP;
myCompareButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Compare" + ELLIPSIS, kCmpCmd);
myCompareButton->setToolTip("Compare highlighted values.");
wid.push_back(myCompareButton);
myCompareButton->setTarget(this);
by += bheight + VGAP;
myRestartButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Reset", kRestartCmd);
myRestartButton->setToolTip("Reset search/compare mode.");
wid.push_back(myRestartButton);
myRestartButton->setTarget(this);
@ -366,6 +369,9 @@ void RamWidget::showInputBox(int cmd)
myInputBox->show(x, y, dialog().surface().dstRect());
myInputBox->setText("");
myInputBox->setMessage("");
myInputBox->setToolTip(cmd == kSValEntered
? "Enter search value (leave blank for all)."
: "Enter relative or absolute value\nto compare with searched values.");
myInputBox->setFocus(0);
myInputBox->setEmitSignal(cmd);
myInputBox->setTitle(cmd == kSValEntered ? "Search" : "Compare");

View File

@ -23,7 +23,6 @@
#include "Widget.hxx"
#include "GuiObject.hxx"
#include "Dialog.hxx"
#include "ToolTip.hxx"
#include "ContextMenu.hxx"
#include "TiaZoomWidget.hxx"
#include "Debugger.hxx"
@ -104,7 +103,7 @@ void TiaOutputWidget::saveSnapshot(int execDepth, const string& execPrefix)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaOutputWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
{
{
if(b == MouseButton::LEFT)
myZoom->setPos(x, y);
// Grab right mouse button for command context menu
@ -113,7 +112,6 @@ void TiaOutputWidget::handleMouseDown(int x, int y, MouseButton b, int clickCoun
myClickX = x;
myClickY = y - 1;
dialog().tooltip().hide();
// Add menu at current x,y mouse location
myMenu->show(x + getAbsX(), y + getAbsY(), dialog().surface().dstRect());
}

View File

@ -129,7 +129,6 @@ void TiaZoomWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
}
else if(b == MouseButton::RIGHT)
{
dialog().tooltip().hide();
// Add menu at current x,y mouse location
myMenu->show(x + getAbsX(), y + getAbsY(), dialog().surface().dstRect());
}

View File

@ -31,11 +31,13 @@ void DispatchResult::setOk(uInt64 cycles)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DispatchResult::setDebugger(uInt64 cycles, const string& message, int address, bool wasReadTrap)
void DispatchResult::setDebugger(uInt64 cycles, const string& message,
const string& tooltip, int address, bool wasReadTrap)
{
myStatus = Status::debugger;
myCycles = cycles;
myMessage = message;
myToolTip = tooltip;
myAddress = address;
myWasReadTrap = wasReadTrap;
}

View File

@ -37,12 +37,14 @@ class DispatchResult
bool wasReadTrap() const { assertStatus(Status::debugger); return myWasReadTrap; }
const string& getToolTip() const { assertStatus(Status::debugger, Status::fatal); return myToolTip; }
bool isSuccess() const;
void setOk(uInt64 cycles);
void setDebugger(uInt64 cycles, const string& message = "", int address = -1,
bool wasReadTrap = true);
void setDebugger(uInt64 cycles, const string& message = "",
const string& tooltip = "", int address = -1, bool wasReadTrap = true);
void setFatal(uInt64 cycles);
@ -73,6 +75,8 @@ class DispatchResult
int myAddress{0};
bool myWasReadTrap{false};
string myToolTip;
};
#endif // DISPATCH_RESULT_HXX

View File

@ -243,7 +243,9 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
myJustHitReadTrapFlag = myJustHitWriteTrapFlag = false;
myLastBreakCycle = mySystem->cycles();
result.setDebugger(currentCycles, myHitTrapInfo.message, myHitTrapInfo.address, read);
result.setDebugger(currentCycles, myHitTrapInfo.message,
read ? "Read trap" : "Write trap",
myHitTrapInfo.address, read);
return;
}
@ -264,7 +266,7 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
ostringstream msg;
msg << "BP: $" << Common::Base::HEX4 << PC << ", bank #" << std::dec << int(bank);
result.setDebugger(currentCycles, msg.str());
result.setDebugger(currentCycles, msg.str(), "Breakpoint");
}
return;
}
@ -278,7 +280,7 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
msg << "CBP[" << Common::Base::HEX2 << cond << "]: " << myCondBreakNames[cond];
myLastBreakCycle = mySystem->cycles();
result.setDebugger(currentCycles, msg.str());
result.setDebugger(currentCycles, msg.str(), "Conditional breakpoint");
return;
}
}
@ -327,7 +329,7 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
{
ostringstream msg;
msg << "RWP[@ $" << Common::Base::HEX4 << rwpAddr << "]: ";
result.setDebugger(currentCycles, msg.str(), oldPC);
result.setDebugger(currentCycles, msg.str(), "Read from write port", oldPC);
return;
}
}
@ -339,7 +341,7 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
{
ostringstream msg;
msg << "WRP[@ $" << Common::Base::HEX4 << wrpAddr << "]: ";
result.setDebugger(currentCycles, msg.str(), oldPC);
result.setDebugger(currentCycles, msg.str(), "Write to read port", oldPC);
return;
}
}
@ -348,7 +350,7 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
myExecutionStatus |= FatalErrorBit;
result.setMessage(e.what());
} catch (const EmulationWarning& e) {
result.setDebugger(currentCycles, e.what(), PC);
result.setDebugger(currentCycles, e.what(), "Emulation exception", PC);
return;
}

View File

@ -775,7 +775,8 @@ double OSystem::dispatchEmulation(EmulationWorker& emulationWorker)
myDebugger->start(
dispatchResult.getMessage(),
dispatchResult.getAddress(),
dispatchResult.wasReadTrap()
dispatchResult.wasReadTrap(),
dispatchResult.getToolTip()
);
#endif

View File

@ -512,6 +512,8 @@ void Dialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
{
Event::Type e = Event::NoType;
tooltip().hide();
// FIXME - I don't think this will compile!
#if defined(RETRON77)
// special keys used for R77

View File

@ -17,6 +17,7 @@
#include "OSystem.hxx"
#include "Dialog.hxx"
#include "ToolTip.hxx"
#include "Stack.hxx"
#include "EventHandler.hxx"
#include "FrameBuffer.hxx"
@ -159,6 +160,10 @@ int DialogContainer::addDialog(Dialog* d)
"Unable to show dialog box; FIX THE CODE", MessagePosition::BottomCenter, true);
else
{
// Close all open tooltips
if(!myDialogStack.empty())
myDialogStack.top()->tooltip().hide();
d->setDirty();
myDialogStack.push(d);
}

View File

@ -81,9 +81,10 @@ void InputTextDialog::initialize(const GUI::Font& lfont, const GUI::Font& nfont,
for(i = 0; i < labels.size(); ++i)
{
xpos = HBORDER;
new StaticTextWidget(this, lfont, xpos, ypos + 2,
lwidth, fontHeight,
labels[i], TextAlign::Left);
StaticTextWidget* s = new StaticTextWidget(this, lfont, xpos, ypos + 2,
lwidth, fontHeight,
labels[i]);
myLabel.push_back(s);
xpos += lwidth + fontWidth;
EditTextWidget* w = new EditTextWidget(this, nfont, xpos, ypos,
@ -177,6 +178,13 @@ void InputTextDialog::setTextFilter(const EditableWidget::TextFilter& f, int idx
myInput[idx]->setTextFilter(f);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void InputTextDialog::setToolTip(const string& str, int idx)
{
if(uInt32(idx) < myLabel.size())
myLabel[idx]->setToolTip(str);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void InputTextDialog::setFocus(int idx)
{

View File

@ -46,6 +46,7 @@ class InputTextDialog : public Dialog, public CommandSender
void setText(const string& str, int idx = 0);
void setTextFilter(const EditableWidget::TextFilter& f, int idx = 0);
void setToolTip(const string& str, int idx = 0);
void setEmitSignal(int cmd) { myCmd = cmd; }
void setMessage(const string& title);
@ -61,6 +62,7 @@ class InputTextDialog : public Dialog, public CommandSender
void setPosition() override;
private:
vector<StaticTextWidget*> myLabel;
vector<EditTextWidget*> myInput;
StaticTextWidget* myMessage{nullptr};

View File

@ -568,7 +568,6 @@ void LauncherDialog::handleMouseDown(int x, int y, MouseButton b, int clickCount
// Grab right mouse button for context menu, send left to base class
if(b == MouseButton::RIGHT)
{
dialog().tooltip().hide();
// Dynamically create context menu for ROM list options
VariantList items;

View File

@ -21,7 +21,6 @@
#include "Font.hxx"
#include "ContextMenu.hxx"
#include "Dialog.hxx"
#include "ToolTip.hxx"
#include "DialogContainer.hxx"
#include "PopUpWidget.hxx"
@ -124,7 +123,6 @@ void PopUpWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
{
if(isEnabled() && !myMenu->isVisible())
{
dialog().tooltip().hide();
// Add menu just underneath parent widget
myMenu->show(getAbsX() + _labelWidth, getAbsY() + getHeight(),
dialog().surface().dstRect(), myMenu->getSelected());