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

View File

@ -97,7 +97,8 @@ class Debugger : public DialogContainer
@param message Message to display when entering debugger @param message Message to display when entering debugger
@param address An address associated with the message @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 = ""); 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) for(int i = 0; i < 4; ++i)
{ {
myCpuDataSrc[i] = new EditTextWidget(boss, nfont, xpos, src_y, src_w, fontHeight + 1); 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); myCpuDataSrc[i]->setEditable(false, true);
src_y += fontHeight + 2; src_y += fontHeight + 2;
} }
@ -140,7 +140,7 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
xpos = myCpuDataSrc[0]->getLeft(); xpos = myCpuDataSrc[0]->getLeft();
new StaticTextWidget(boss, lfont, xpos - fontWidth * 4.5, ypos + 2, "Dest"); new StaticTextWidget(boss, lfont, xpos - fontWidth * 4.5, ypos + 2, "Dest");
myCpuDataDest = new EditTextWidget(boss, nfont, xpos, ypos, src_w, fontHeight + 1); 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); myCpuDataDest->setEditable(false, true);
_h = ypos + myPSRegister->getHeight() - y; _h = ypos + myPSRegister->getHeight() - y;

View File

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

View File

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

View File

@ -94,6 +94,7 @@ void DebuggerDialog::loadConfig()
myRomTab->loadConfig(); myRomTab->loadConfig();
myMessageBox->setText(""); myMessageBox->setText("");
myMessageBox->setToolTip("");
} }
void DebuggerDialog::saveConfig() 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; by += bheight + VGAP * 6;
mySearchButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight, mySearchButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Search" + ELLIPSIS, kSearchCmd); "Search" + ELLIPSIS, kSearchCmd);
mySearchButton->setToolTip("Search and highlight found values.");
wid.push_back(mySearchButton); wid.push_back(mySearchButton);
mySearchButton->setTarget(this); mySearchButton->setTarget(this);
by += bheight + VGAP; by += bheight + VGAP;
myCompareButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight, myCompareButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Compare" + ELLIPSIS, kCmpCmd); "Compare" + ELLIPSIS, kCmpCmd);
myCompareButton->setToolTip("Compare highlighted values.");
wid.push_back(myCompareButton); wid.push_back(myCompareButton);
myCompareButton->setTarget(this); myCompareButton->setTarget(this);
by += bheight + VGAP; by += bheight + VGAP;
myRestartButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight, myRestartButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Reset", kRestartCmd); "Reset", kRestartCmd);
myRestartButton->setToolTip("Reset search/compare mode.");
wid.push_back(myRestartButton); wid.push_back(myRestartButton);
myRestartButton->setTarget(this); myRestartButton->setTarget(this);
@ -366,6 +369,9 @@ void RamWidget::showInputBox(int cmd)
myInputBox->show(x, y, dialog().surface().dstRect()); myInputBox->show(x, y, dialog().surface().dstRect());
myInputBox->setText(""); myInputBox->setText("");
myInputBox->setMessage(""); 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->setFocus(0);
myInputBox->setEmitSignal(cmd); myInputBox->setEmitSignal(cmd);
myInputBox->setTitle(cmd == kSValEntered ? "Search" : "Compare"); myInputBox->setTitle(cmd == kSValEntered ? "Search" : "Compare");

View File

@ -23,7 +23,6 @@
#include "Widget.hxx" #include "Widget.hxx"
#include "GuiObject.hxx" #include "GuiObject.hxx"
#include "Dialog.hxx" #include "Dialog.hxx"
#include "ToolTip.hxx"
#include "ContextMenu.hxx" #include "ContextMenu.hxx"
#include "TiaZoomWidget.hxx" #include "TiaZoomWidget.hxx"
#include "Debugger.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) void TiaOutputWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
{ {
if(b == MouseButton::LEFT) if(b == MouseButton::LEFT)
myZoom->setPos(x, y); myZoom->setPos(x, y);
// Grab right mouse button for command context menu // 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; myClickX = x;
myClickY = y - 1; myClickY = y - 1;
dialog().tooltip().hide();
// Add menu at current x,y mouse location // Add menu at current x,y mouse location
myMenu->show(x + getAbsX(), y + getAbsY(), dialog().surface().dstRect()); 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) else if(b == MouseButton::RIGHT)
{ {
dialog().tooltip().hide();
// Add menu at current x,y mouse location // Add menu at current x,y mouse location
myMenu->show(x + getAbsX(), y + getAbsY(), dialog().surface().dstRect()); 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; myStatus = Status::debugger;
myCycles = cycles; myCycles = cycles;
myMessage = message; myMessage = message;
myToolTip = tooltip;
myAddress = address; myAddress = address;
myWasReadTrap = wasReadTrap; myWasReadTrap = wasReadTrap;
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -17,6 +17,7 @@
#include "OSystem.hxx" #include "OSystem.hxx"
#include "Dialog.hxx" #include "Dialog.hxx"
#include "ToolTip.hxx"
#include "Stack.hxx" #include "Stack.hxx"
#include "EventHandler.hxx" #include "EventHandler.hxx"
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
@ -159,6 +160,10 @@ int DialogContainer::addDialog(Dialog* d)
"Unable to show dialog box; FIX THE CODE", MessagePosition::BottomCenter, true); "Unable to show dialog box; FIX THE CODE", MessagePosition::BottomCenter, true);
else else
{ {
// Close all open tooltips
if(!myDialogStack.empty())
myDialogStack.top()->tooltip().hide();
d->setDirty(); d->setDirty();
myDialogStack.push(d); 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) for(i = 0; i < labels.size(); ++i)
{ {
xpos = HBORDER; xpos = HBORDER;
new StaticTextWidget(this, lfont, xpos, ypos + 2, StaticTextWidget* s = new StaticTextWidget(this, lfont, xpos, ypos + 2,
lwidth, fontHeight, lwidth, fontHeight,
labels[i], TextAlign::Left); labels[i]);
myLabel.push_back(s);
xpos += lwidth + fontWidth; xpos += lwidth + fontWidth;
EditTextWidget* w = new EditTextWidget(this, nfont, xpos, ypos, 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); 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) 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 setText(const string& str, int idx = 0);
void setTextFilter(const EditableWidget::TextFilter& f, 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 setEmitSignal(int cmd) { myCmd = cmd; }
void setMessage(const string& title); void setMessage(const string& title);
@ -61,6 +62,7 @@ class InputTextDialog : public Dialog, public CommandSender
void setPosition() override; void setPosition() override;
private: private:
vector<StaticTextWidget*> myLabel;
vector<EditTextWidget*> myInput; vector<EditTextWidget*> myInput;
StaticTextWidget* myMessage{nullptr}; 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 // Grab right mouse button for context menu, send left to base class
if(b == MouseButton::RIGHT) if(b == MouseButton::RIGHT)
{ {
dialog().tooltip().hide();
// Dynamically create context menu for ROM list options // Dynamically create context menu for ROM list options
VariantList items; VariantList items;

View File

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