From 7e5d519234907e18413dcb8f7d51c40a4fd89d5e Mon Sep 17 00:00:00 2001 From: stephena Date: Thu, 21 Jun 2007 12:27:00 +0000 Subject: [PATCH] Oops, forgot to add UI objects to change fullscreen resolution. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1325 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/debugger/gui/DebuggerDialog.cxx | 4 +- stella/src/debugger/gui/PromptWidget.cxx | 119 +++++++++++---------- stella/src/emucore/M6532.cxx | 4 +- stella/src/gui/OptionsDialog.cxx | 4 +- stella/src/gui/PopUpWidget.cxx | 21 +++- stella/src/gui/PopUpWidget.hxx | 8 +- stella/src/gui/VideoDialog.cxx | 29 +++-- stella/src/gui/VideoDialog.hxx | 3 +- 8 files changed, 122 insertions(+), 70 deletions(-) diff --git a/stella/src/debugger/gui/DebuggerDialog.cxx b/stella/src/debugger/gui/DebuggerDialog.cxx index 84a74d189..e331a816f 100644 --- a/stella/src/debugger/gui/DebuggerDialog.cxx +++ b/stella/src/debugger/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.18 2007-01-01 18:04:43 stephena Exp $ +// $Id: DebuggerDialog.cxx,v 1.19 2007-06-21 12:27:00 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -293,5 +293,5 @@ void DebuggerDialog::doScanlineAdvance() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DebuggerDialog::doExit() { - instance()->debugger().quit(); + instance()->debugger().parser()->run("run"); } diff --git a/stella/src/debugger/gui/PromptWidget.cxx b/stella/src/debugger/gui/PromptWidget.cxx index 641111d28..57c8fa492 100644 --- a/stella/src/debugger/gui/PromptWidget.cxx +++ b/stella/src/debugger/gui/PromptWidget.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: PromptWidget.cxx,v 1.15 2007-01-01 18:04:44 stephena Exp $ +// $Id: PromptWidget.cxx,v 1.16 2007-06-21 12:27:00 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -166,7 +166,7 @@ bool PromptWidget::handleKeyDown(int ascii, int keycode, int modifiers) int i; bool handled = true; bool dirty = false; - + switch(ascii) { case '\n': // enter/return @@ -188,7 +188,8 @@ bool PromptWidget::handleKeyDown(int ascii, int keycode, int modifiers) addToHistory(command.c_str()); // Pass the command to the debugger, and print the result - print( instance()->debugger().run(command) + "\n"); + string result = instance()->debugger().run(command) + "\n"; + print( result ); } printPrompt(); @@ -202,7 +203,7 @@ bool PromptWidget::handleKeyDown(int ascii, int keycode, int modifiers) // both at once. if(_currentPos <= _promptStartPos) - break; + break; scrollToCurrent(); int len = _promptEndPos - _promptStartPos; @@ -211,12 +212,14 @@ bool PromptWidget::handleKeyDown(int ascii, int keycode, int modifiers) char delimiter = '\0'; char *str = new char[len + 1]; - for (i = 0; i < len; i++) { - str[i] = buffer(_promptStartPos + i) & 0x7f; - if(strchr("*@<> ", str[i]) != NULL ) { - lastDelimPos = i; - delimiter = str[i]; - } + for (i = 0; i < len; i++) + { + str[i] = buffer(_promptStartPos + i) & 0x7f; + if(strchr("*@<> ", str[i]) != NULL ) + { + lastDelimPos = i; + delimiter = str[i]; + } } str[len] = '\0'; @@ -224,60 +227,66 @@ bool PromptWidget::handleKeyDown(int ascii, int keycode, int modifiers) const char *prefix; int possibilities; - if(lastDelimPos < 0) { - // no delimiters, do command completion: - DebuggerParser *parser = instance()->debugger().parser(); - possibilities = parser->countCompletions(str); + if(lastDelimPos < 0) + { + // no delimiters, do command completion: + DebuggerParser *parser = instance()->debugger().parser(); + possibilities = parser->countCompletions(str); - if(possibilities < 1) { - delete[] str; - break; - } + if(possibilities < 1) { + delete[] str; + break; + } - completionList = parser->getCompletions(); - prefix = parser->getCompletionPrefix(); - } else { - // we got a delimiter, so this must be a label: - EquateList *equates = instance()->debugger().equates(); - possibilities = equates->countCompletions(str + lastDelimPos + 1); + completionList = parser->getCompletions(); + prefix = parser->getCompletionPrefix(); + } + else + { + // we got a delimiter, so this must be a label: + EquateList *equates = instance()->debugger().equates(); + possibilities = equates->countCompletions(str + lastDelimPos + 1); - if(possibilities < 1) { - delete[] str; - break; - } + if(possibilities < 1) { + delete[] str; + break; + } - completionList = equates->getCompletions(); - prefix = equates->getCompletionPrefix(); - } + completionList = equates->getCompletions(); + prefix = equates->getCompletionPrefix(); + } - if(possibilities == 1) { - // add to buffer as though user typed it (plus a space) - _currentPos = _promptStartPos + lastDelimPos + 1; - while(*completionList != '\0') { - putcharIntern(*completionList++); - } - putcharIntern(' '); - _promptEndPos = _currentPos; - } else { - nextLine(); - // add to buffer as-is, then add PROMPT plus whatever we have so far - _currentPos = _promptStartPos + lastDelimPos + 1; + if(possibilities == 1) + { + // add to buffer as though user typed it (plus a space) + _currentPos = _promptStartPos + lastDelimPos + 1; + while(*completionList != '\0') + putcharIntern(*completionList++); - print("\n"); - print(completionList); - print("\n"); - print(PROMPT); + putcharIntern(' '); + _promptEndPos = _currentPos; + } + else + { + nextLine(); + // add to buffer as-is, then add PROMPT plus whatever we have so far + _currentPos = _promptStartPos + lastDelimPos + 1; - _promptStartPos = _currentPos; + print("\n"); + print(completionList); + print("\n"); + print(PROMPT); - for(i=0; i 0) - putcharIntern(delimiter); + for(i=0; i 0) + putcharIntern(delimiter); + + print(prefix); + _promptEndPos = _currentPos; } delete[] str; dirty = true; @@ -639,7 +648,7 @@ void PromptWidget::addToHistory(const char *str) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int PromptWidget::compareHistory(const char *histLine) { - return 1; + return 1; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/emucore/M6532.cxx b/stella/src/emucore/M6532.cxx index ea19cf672..b5991d6fb 100644 --- a/stella/src/emucore/M6532.cxx +++ b/stella/src/emucore/M6532.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: M6532.cxx,v 1.9 2007-01-01 18:04:48 stephena Exp $ +// $Id: M6532.cxx,v 1.10 2007-06-21 12:27:00 stephena Exp $ //============================================================================ #include @@ -238,6 +238,7 @@ void M6532::poke(uInt16 addr, uInt8 value) else if((addr & 0x07) == 0x01) // Port A Data Direction Register { myDDRA = value; +#ifdef ATARIVOX_SUPPORT /* 20060608 bkw: Not the most elegant thing in the world... When a bit in the DDR is set as input, +5V is placed on its output @@ -262,6 +263,7 @@ void M6532::poke(uInt16 addr, uInt8 value) c.write(Controller::Three, !(value & 0x04)); c.write(Controller::Four, !(value & 0x08)); } +#endif } else if((addr & 0x07) == 0x02) // Port B I/O Register (Console switches) { diff --git a/stella/src/gui/OptionsDialog.cxx b/stella/src/gui/OptionsDialog.cxx index 7e34327f7..0e89bf1ab 100644 --- a/stella/src/gui/OptionsDialog.cxx +++ b/stella/src/gui/OptionsDialog.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: OptionsDialog.cxx,v 1.52 2007-06-20 16:33:23 stephena Exp $ +// $Id: OptionsDialog.cxx,v 1.53 2007-06-21 12:27:00 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -107,7 +107,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent, int x = 0, y = 0, w, h; // Now create all the dialogs attached to each menu button - w = 230; h = 150; + w = 230; h = 165; myVideoDialog = new VideoDialog(myOSystem, parent, font, x, y, w, h); w = 200; h = 140; diff --git a/stella/src/gui/PopUpWidget.cxx b/stella/src/gui/PopUpWidget.cxx index 3b4c6415b..e7a489dc0 100644 --- a/stella/src/gui/PopUpWidget.cxx +++ b/stella/src/gui/PopUpWidget.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: PopUpWidget.cxx,v 1.32 2007-01-01 18:04:54 stephena Exp $ +// $Id: PopUpWidget.cxx,v 1.33 2007-06-21 12:27:00 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -509,6 +509,19 @@ void PopUpWidget::setSelected(int item) } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void PopUpWidget::setSelectedName(const string& name) +{ + for(unsigned int item = 0; item < _entries.size(); ++item) + { + if(_entries[item].name == name) + { + setSelected(item); + return; + } + } +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PopUpWidget::setSelectedTag(int tag) { @@ -522,6 +535,12 @@ void PopUpWidget::setSelectedTag(int tag) } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void PopUpWidget::setSelectedMax() +{ + setSelected(_entries.size() - 1); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PopUpWidget::drawWidget(bool hilite) { diff --git a/stella/src/gui/PopUpWidget.hxx b/stella/src/gui/PopUpWidget.hxx index 8a2ef86b8..e438accbf 100644 --- a/stella/src/gui/PopUpWidget.hxx +++ b/stella/src/gui/PopUpWidget.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: PopUpWidget.hxx,v 1.17 2007-01-01 18:04:54 stephena Exp $ +// $Id: PopUpWidget.hxx,v 1.18 2007-06-21 12:27:00 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -72,9 +72,15 @@ class PopUpWidget : public Widget, public CommandSender /** Select the entry at the given index. */ void setSelected(int item); + /** Select the first entry matching the given name. */ + void setSelectedName(const string& name); + /** Select the first entry matching the given tag. */ void setSelectedTag(int tag); + /** Select the highest/last entry in the internal list. */ + void setSelectedMax(); + int getSelected() const { return _selectedItem; } int getSelectedTag() const diff --git a/stella/src/gui/VideoDialog.cxx b/stella/src/gui/VideoDialog.cxx index e9978047c..0c60d7d18 100644 --- a/stella/src/gui/VideoDialog.cxx +++ b/stella/src/gui/VideoDialog.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: VideoDialog.cxx,v 1.43 2007-06-20 16:33:23 stephena Exp $ +// $Id: VideoDialog.cxx,v 1.44 2007-06-21 12:27:00 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -86,6 +86,14 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent, wid.push_back(myPalettePopup); ypos += lineHeight + 4; + // Fullscreen resolution + myFSResPopup = new PopUpWidget(this, font, xpos, ypos, pwidth, + lineHeight, "FS Res: ", lwidth); + for(uInt32 i = 0; i < instance()->supportedResolutions().size(); ++i) + myFSResPopup->appendEntry(instance()->supportedResolutions()[i].name, i+1); + wid.push_back(myFSResPopup); + ypos += lineHeight + 4; + // Available UI zoom levels myUIZoomSlider = new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight, "UI Zoom: ", lwidth, kUIZoomChanged); @@ -229,6 +237,12 @@ void VideoDialog::loadConfig() else if(s == "z26") myPalettePopup->setSelectedTag(3); else if(s == "user") myPalettePopup->setSelectedTag(4); + // Fullscreen resolution + s = instance()->settings().getString("fullres"); + myFSResPopup->setSelectedName(s); + if(myFSResPopup->getSelectedTag() < 0) + myFSResPopup->setSelectedMax(); + // UI zoom level s = instance()->settings().getString("zoom_ui"); i = instance()->settings().getInt("zoom_ui"); @@ -293,12 +307,6 @@ void VideoDialog::saveConfig() else if(i == 4) s = "always"; instance()->settings().setString("gl_fsmax", s); -/* - // Aspect ratio - s = myAspectRatioLabel->getLabel(); - instance()->settings().setString("gl_aspect", s); -*/ - // Palette i = myPalettePopup->getSelectedTag(); if(i == 1) s = "standard"; @@ -307,6 +315,10 @@ void VideoDialog::saveConfig() else if(i == 4) s = "user"; instance()->settings().setString("palette", s); + // Fullscreen resolution + s = myFSResPopup->getSelectedString(); + instance()->settings().setString("fullres", s); + // UI Scaler s = myUIZoomLabel->getLabel(); instance()->settings().setString("zoom_ui", s); @@ -349,6 +361,7 @@ void VideoDialog::setDefaults() myFilterPopup->setSelectedTag(1); myFSStretchPopup->setSelectedTag(1); myPalettePopup->setSelectedTag(1); + myFSResPopup->setSelectedMax(); myUIZoomSlider->setValue(2); myUIZoomLabel->setLabel("2"); myTIAZoomSlider->setValue(2); @@ -386,6 +399,8 @@ void VideoDialog::handleRendererChange(int item) void VideoDialog::handleFullscreenChange(bool enable) { #ifdef WINDOWED_SUPPORT + myFSResPopup->setEnabled(enable); + myUIZoomSlider->setEnabled(!enable); myUIZoomLabel->setEnabled(!enable); myTIAZoomSlider->setEnabled(!enable); diff --git a/stella/src/gui/VideoDialog.hxx b/stella/src/gui/VideoDialog.hxx index 1f4e40351..583e18e47 100644 --- a/stella/src/gui/VideoDialog.hxx +++ b/stella/src/gui/VideoDialog.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: VideoDialog.hxx,v 1.20 2007-06-20 16:33:23 stephena Exp $ +// $Id: VideoDialog.hxx,v 1.21 2007-06-21 12:27:00 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -54,6 +54,7 @@ class VideoDialog : public Dialog PopUpWidget* myFilterPopup; PopUpWidget* myFSStretchPopup; PopUpWidget* myPalettePopup; + PopUpWidget* myFSResPopup; SliderWidget* myUIZoomSlider; StaticTextWidget* myUIZoomLabel; SliderWidget* myTIAZoomSlider;