From 7e7d0b57f55ae940275c314223e1df7b4cf2ad56 Mon Sep 17 00:00:00 2001 From: stephena Date: Thu, 9 Jun 2005 19:04:59 +0000 Subject: [PATCH] First attempt at adding buttons to each DebuggerDialog class. The PromptDialog is currently broken. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@477 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/gui/DebuggerDialog.cxx | 37 ++++++++++++++++++++++++++----- stella/src/gui/DebuggerDialog.hxx | 4 +++- stella/src/gui/PromptDialog.cxx | 28 +++++++++++++++++++---- stella/src/gui/PromptDialog.hxx | 11 +++++---- 4 files changed, 66 insertions(+), 14 deletions(-) diff --git a/stella/src/gui/DebuggerDialog.cxx b/stella/src/gui/DebuggerDialog.cxx index 05e95648c..cf151ae1a 100644 --- a/stella/src/gui/DebuggerDialog.cxx +++ b/stella/src/gui/DebuggerDialog.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: DebuggerDialog.cxx,v 1.4 2005-06-08 21:16:06 stephena Exp $ +// $Id: DebuggerDialog.cxx,v 1.5 2005-06-09 19:04:59 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -47,7 +47,7 @@ DebuggerDialog::DebuggerDialog(OSystem* osystem, DialogContainer* parent, const int space = 5; const int width = 40; int xpos = border; - +/* // Add a row of buttons for the various debugger operations new ButtonWidget(this, xpos, border, width, 16, "Prompt", kPromptCmd, 0); xpos += space + width; @@ -61,11 +61,14 @@ DebuggerDialog::DebuggerDialog(OSystem* osystem, DialogContainer* parent, xpos += space + width; new ButtonWidget(this, xpos, border, width, 16, "Code", kCodeCmd, 0); xpos += space + width; - +*/ const int xoff = border; const int yoff = border + 16 + 2; - // And create the debugger dialog boxes - myPromptDialog = new PromptDialog(osystem, parent, x + xoff, y + yoff, + + // Create the debugger dialog boxes +// myPromptDialog = new PromptDialog(this, osystem, parent, x, y, w, h); + + myPromptDialog = new PromptDialog(this, osystem, parent, x + xoff, y + yoff, w - xoff - 2, h - yoff - 3); } @@ -82,6 +85,30 @@ DebuggerDialog::~DebuggerDialog() */ } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void DebuggerDialog::addButtons(GuiObject* boss) +{ + // This is a terrible hack, but it does seem to work ... + const int border = 5; + const int space = 5; + const int width = 40; + int xpos = border; + + // Add a row of buttons for the various debugger operations + new ButtonWidget(boss, xpos, border, width, 16, "Prompt", kPromptCmd, 0); + xpos += space + width; + new ButtonWidget(boss, xpos, border, width, 16, "CPU", kCpuCmd, 0); + xpos += space + width; + new ButtonWidget(boss, xpos, border, width, 16, "RAM", kRamCmd, 0); + xpos += space + width; + new ButtonWidget(boss, xpos, border, width, 16, "ROM", kRomCmd, 0); + xpos += space + width; + new ButtonWidget(boss, xpos, border, width, 16, "TIA", kTiaCmd, 0); + xpos += space + width; + new ButtonWidget(boss, xpos, border, width, 16, "Code", kCodeCmd, 0); + xpos += space + width; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DebuggerDialog::loadConfig() { diff --git a/stella/src/gui/DebuggerDialog.hxx b/stella/src/gui/DebuggerDialog.hxx index 529a51325..3c856d3bb 100644 --- a/stella/src/gui/DebuggerDialog.hxx +++ b/stella/src/gui/DebuggerDialog.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: DebuggerDialog.hxx,v 1.3 2005-06-07 01:27:06 stephena Exp $ +// $Id: DebuggerDialog.hxx,v 1.4 2005-06-09 19:04:59 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -43,6 +43,8 @@ class DebuggerDialog : public Dialog virtual void loadConfig(); virtual void handleCommand(CommandSender* sender, int cmd, int data); + void addButtons(GuiObject* boss); + protected: // The debugger dialogs PromptDialog* myPromptDialog; diff --git a/stella/src/gui/PromptDialog.cxx b/stella/src/gui/PromptDialog.cxx index 6e926f1d1..6bd8cb53c 100644 --- a/stella/src/gui/PromptDialog.cxx +++ b/stella/src/gui/PromptDialog.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: PromptDialog.cxx,v 1.7 2005-06-09 15:08:23 stephena Exp $ +// $Id: PromptDialog.cxx,v 1.8 2005-06-09 19:04:59 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -24,6 +24,7 @@ #include "EventHandler.hxx" #include "Version.hxx" #include "Debugger.hxx" +#include "DebuggerDialog.hxx" #include "PromptDialog.hxx" @@ -38,10 +39,29 @@ */ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -PromptDialog::PromptDialog(OSystem* osystem, DialogContainer* parent, +PromptDialog::PromptDialog(DebuggerDialog* dbg, OSystem* osystem, + DialogContainer* parent, int x, int y, int w, int h) - : Dialog(osystem, parent, x, y, w, h) + : Dialog(osystem, parent, x, y, w, h), + myDebuggerDialog(dbg) { + // Add the buttons common to all DebuggerDialog children +// myDebuggerDialog->addButtons(this); +/* + const int border = 5; + const int space = 5; + const int width = 40; + int xpos = border; + + // Add a row of buttons for the various debugger operations + new ButtonWidget(this, xpos, border, width, 16, "Prompt", 0, 0); +*/ + + + new ButtonWidget(this, 10, 10, 50, 20, "Prompt", 0); + + + _kConsoleCharWidth = instance()->consoleFont().getMaxCharWidth(); _kConsoleLineHeight = instance()->consoleFont().getFontHeight() + 2; @@ -91,7 +111,7 @@ void PromptDialog::loadConfig() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptDialog::drawDialog() +void PromptDialog::drawDialog1() { FrameBuffer& fb = instance()->frameBuffer(); diff --git a/stella/src/gui/PromptDialog.hxx b/stella/src/gui/PromptDialog.hxx index da863ba2e..142d0025e 100644 --- a/stella/src/gui/PromptDialog.hxx +++ b/stella/src/gui/PromptDialog.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: PromptDialog.hxx,v 1.5 2005-06-09 15:08:23 stephena Exp $ +// $Id: PromptDialog.hxx,v 1.6 2005-06-09 19:04:59 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -25,7 +25,7 @@ class CommandSender; class DialogContainer; class ScrollBarWidget; -class DebuggerParser; +class DebuggerDialog; #include #include "Dialog.hxx" @@ -40,7 +40,7 @@ enum { class PromptDialog : public Dialog { public: - PromptDialog(OSystem* osystem, DialogContainer* parent, + PromptDialog(DebuggerDialog* dbg, OSystem* osystem, DialogContainer* parent, int x, int y, int w, int h); virtual ~PromptDialog(); @@ -53,7 +53,7 @@ class PromptDialog : public Dialog protected: inline char &buffer(int idx) { return _buffer[idx % kBufferSize]; } - void drawDialog(); + void drawDialog1(); void drawCaret(); void putcharIntern(int c); void insertIntoPrompt(const char *str); @@ -101,6 +101,9 @@ class PromptDialog : public Dialog int _historyLine; int _kConsoleCharWidth, _kConsoleLineHeight; + + private: + DebuggerDialog* myDebuggerDialog; }; #endif