mirror of https://github.com/stella-emu/stella.git
More efficiency fixes. Redrawing a tab (in the TabDialog) no longer
forces a redraw of the whole parent dialog (this is a big optimization in the case of the DebuggerDialog, since it will soon have a resolution of 1024x768). Made the TiaOutputWidget act as a dirty rect, and only redraw itself when necessary. Fixed selection of items in TabWidget which have the WIDGET_TAB_NAVIGATE property. Clicking them with the mouse now correctly selects them (and deselects other widgets in that chain). Still TODO here is have the TabWidget draw the outline around such widgets itself, so that when one is selected and the others deselected, only the outlines need to be redrawn (vs. the whole tab). Removed FrameBuffer::blendRect(), since the GUI code will never have blended rectangles (it would cause to much complexity in the dirty update/rectangle code). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@709 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
f27b41ca22
commit
655c1b5257
|
@ -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: FrameBufferGL.cxx,v 1.38 2005-08-02 15:59:43 stephena Exp $
|
||||
// $Id: FrameBufferGL.cxx,v 1.39 2005-08-03 13:26:01 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifdef DISPLAY_OPENGL
|
||||
|
@ -349,15 +349,6 @@ void FrameBufferGL::vLine(uInt32 x, uInt32 y, uInt32 y2, OverlayColor color)
|
|||
SDL_FillRect(myTexture, &tmp, myPalette[color]);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferGL::blendRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
||||
OverlayColor color, uInt32 level)
|
||||
{
|
||||
// FIXME - make this do alpha-blending
|
||||
// for now, just do a normal fill
|
||||
fillRect(x, y, w, h, color);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferGL::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
||||
OverlayColor color)
|
||||
|
|
|
@ -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: FrameBufferGL.hxx,v 1.21 2005-08-02 15:59:43 stephena Exp $
|
||||
// $Id: FrameBufferGL.hxx,v 1.22 2005-08-03 13:26:01 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_GL_HXX
|
||||
|
@ -37,7 +37,7 @@ class GUI::Font;
|
|||
This class implements an SDL OpenGL framebuffer.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBufferGL.hxx,v 1.21 2005-08-02 15:59:43 stephena Exp $
|
||||
@version $Id: FrameBufferGL.hxx,v 1.22 2005-08-03 13:26:01 stephena Exp $
|
||||
*/
|
||||
class FrameBufferGL : public FrameBuffer
|
||||
{
|
||||
|
@ -132,19 +132,6 @@ class FrameBufferGL : public FrameBuffer
|
|||
*/
|
||||
virtual void vLine(uInt32 x, uInt32 y, uInt32 y2, OverlayColor color);
|
||||
|
||||
/**
|
||||
This method is called to draw a blended rectangle.
|
||||
|
||||
@param x The x coordinate
|
||||
@param y The y coordinate
|
||||
@param w The width of the box
|
||||
@param h The height of the box
|
||||
@param color FIXME
|
||||
@param level FIXME
|
||||
*/
|
||||
virtual void blendRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
||||
OverlayColor color, uInt32 level = 3);
|
||||
|
||||
/**
|
||||
This method is called to draw a filled rectangle.
|
||||
|
||||
|
|
|
@ -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: FrameBufferSoft.cxx,v 1.31 2005-08-01 22:33:11 stephena Exp $
|
||||
// $Id: FrameBufferSoft.cxx,v 1.32 2005-08-03 13:26:01 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <SDL.h>
|
||||
|
@ -360,15 +360,6 @@ void FrameBufferSoft::vLine(uInt32 x, uInt32 y, uInt32 y2, OverlayColor color)
|
|||
SDL_FillRect(myScreen, &tmp, myPalette[color]);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferSoft::blendRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
||||
OverlayColor color, uInt32 level)
|
||||
{
|
||||
// FIXME - make this do alpha-blending
|
||||
// for now, just do a normal fill
|
||||
fillRect(x, y, w, h, color);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferSoft::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
||||
OverlayColor color)
|
||||
|
|
|
@ -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: FrameBufferSoft.hxx,v 1.19 2005-08-01 22:33:11 stephena Exp $
|
||||
// $Id: FrameBufferSoft.hxx,v 1.20 2005-08-03 13:26:01 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_SOFT_HXX
|
||||
|
@ -35,7 +35,7 @@ class RectList;
|
|||
This class implements an SDL software framebuffer.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBufferSoft.hxx,v 1.19 2005-08-01 22:33:11 stephena Exp $
|
||||
@version $Id: FrameBufferSoft.hxx,v 1.20 2005-08-03 13:26:01 stephena Exp $
|
||||
*/
|
||||
class FrameBufferSoft : public FrameBuffer
|
||||
{
|
||||
|
@ -130,19 +130,6 @@ class FrameBufferSoft : public FrameBuffer
|
|||
*/
|
||||
virtual void vLine(uInt32 x, uInt32 y, uInt32 y2, OverlayColor color);
|
||||
|
||||
/**
|
||||
This method is called to draw a blended rectangle.
|
||||
|
||||
@param x The x coordinate
|
||||
@param y The y coordinate
|
||||
@param w The width of the box
|
||||
@param h The height of the box
|
||||
@param color FIXME
|
||||
@param level FIXME
|
||||
*/
|
||||
virtual void blendRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
||||
OverlayColor color, uInt32 level = 3);
|
||||
|
||||
/**
|
||||
This method is called to draw a filled rectangle.
|
||||
|
||||
|
|
|
@ -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: TiaOutputWidget.cxx,v 1.3 2005-08-01 22:33:12 stephena Exp $
|
||||
// $Id: TiaOutputWidget.cxx,v 1.4 2005-08-03 13:26:02 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -46,6 +46,7 @@ void TiaOutputWidget::advanceScanline(int lines)
|
|||
instance()->console().mediaSource().updateScanline();
|
||||
--lines;
|
||||
}
|
||||
setDirty(); draw();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -56,12 +57,19 @@ void TiaOutputWidget::advance(int frames)
|
|||
instance()->console().mediaSource().update();
|
||||
--frames;
|
||||
}
|
||||
setDirty(); draw();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TiaOutputWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
||||
{
|
||||
cerr << "TiaOutputWidget button press: x = " << x << ", y = " << y << endl;
|
||||
int xstart = atoi(instance()->console().properties().get("Display.XStart").c_str());
|
||||
int ystart = atoi(instance()->console().properties().get("Display.YStart").c_str());
|
||||
|
||||
cerr << "TiaOutputWidget button press:" << endl
|
||||
<< "x = " << x << ", y = " << y << endl
|
||||
<< "xstart = " << xstart << ", ystart = " << ystart << endl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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: TiaOutputWidget.hxx,v 1.3 2005-08-01 22:33:12 stephena Exp $
|
||||
// $Id: TiaOutputWidget.hxx,v 1.4 2005-08-03 13:26:02 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -34,6 +34,7 @@ class TiaOutputWidget : public Widget, public CommandSender
|
|||
TiaOutputWidget(GuiObject *boss, int x, int y, int w, int h);
|
||||
virtual ~TiaOutputWidget();
|
||||
|
||||
void handleMouseDown(int x, int y, int button, int clickCount);
|
||||
|
||||
// Eventually, these methods will enable access to the onscreen TIA image
|
||||
// For example, clicking an area may cause an action
|
||||
|
@ -45,15 +46,12 @@ class TiaOutputWidget : public Widget, public CommandSender
|
|||
virtual bool handleKeyUp(int ascii, int keycode, int modifiers);
|
||||
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||
*/
|
||||
|
||||
void advanceScanline(int lines);
|
||||
void advance(int frames);
|
||||
|
||||
protected:
|
||||
void drawWidget(bool hilite);
|
||||
bool wantsFocus() { return false; }
|
||||
|
||||
void handleMouseDown(int x, int y, int button, int clickCount);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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: FrameBuffer.hxx,v 1.51 2005-08-01 22:33:13 stephena Exp $
|
||||
// $Id: FrameBuffer.hxx,v 1.52 2005-08-03 13:26:02 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_HXX
|
||||
|
@ -52,7 +52,7 @@ enum FrameStyle {
|
|||
All GUI elements (ala ScummVM) are drawn here as well.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBuffer.hxx,v 1.51 2005-08-01 22:33:13 stephena Exp $
|
||||
@version $Id: FrameBuffer.hxx,v 1.52 2005-08-03 13:26:02 stephena Exp $
|
||||
*/
|
||||
class FrameBuffer
|
||||
{
|
||||
|
@ -334,19 +334,6 @@ class FrameBuffer
|
|||
*/
|
||||
virtual void vLine(uInt32 x, uInt32 y, uInt32 y2, OverlayColor color) = 0;
|
||||
|
||||
/**
|
||||
This method should be called to draw a blended rectangle.
|
||||
|
||||
@param x The x coordinate
|
||||
@param y The y coordinate
|
||||
@param w The width of the box
|
||||
@param h The height of the box
|
||||
@param color FIXME
|
||||
@param level FIXME
|
||||
*/
|
||||
virtual void blendRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
||||
OverlayColor color, uInt32 level = 3) = 0;
|
||||
|
||||
/**
|
||||
This method should be called to draw a filled rectangle.
|
||||
|
||||
|
|
|
@ -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.28 2005-08-01 22:33:15 stephena Exp $
|
||||
// $Id: DebuggerDialog.cxx,v 1.29 2005-08-03 13:26:02 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -64,6 +64,7 @@ void DebuggerDialog::loadConfig()
|
|||
cerr << "DebuggerDialog::loadConfig()\n";
|
||||
myTab->loadConfig();
|
||||
myTiaInfo->loadConfig();
|
||||
myTiaOutput->loadConfig();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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: Dialog.cxx,v 1.22 2005-08-01 22:33:15 stephena Exp $
|
||||
// $Id: Dialog.cxx,v 1.23 2005-08-03 13:26:02 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -128,7 +128,7 @@ void Dialog::drawDialog()
|
|||
cerr << "Dialog::drawDialog()\n";
|
||||
FrameBuffer& fb = instance()->frameBuffer();
|
||||
|
||||
fb.blendRect(_x+1, _y+1, _w-2, _h-2, kBGColor);
|
||||
fb.fillRect(_x+1, _y+1, _w-2, _h-2, kBGColor);
|
||||
fb.box(_x, _y, _w, _h, kColor, kShadowColor);
|
||||
|
||||
// Make all child widget dirty
|
||||
|
|
|
@ -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: TabWidget.cxx,v 1.15 2005-08-02 15:59:45 stephena Exp $
|
||||
// $Id: TabWidget.cxx,v 1.16 2005-08-03 13:26:02 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -40,7 +40,7 @@ TabWidget::TabWidget(GuiObject *boss, int x, int y, int w, int h)
|
|||
: Widget(boss, x, y, w, h),
|
||||
CommandSender(boss)
|
||||
{
|
||||
_flags = WIDGET_ENABLED;
|
||||
_flags = WIDGET_ENABLED | WIDGET_CLEARBG;
|
||||
_type = kTabWidget;
|
||||
_activeTab = -1;
|
||||
|
||||
|
@ -100,11 +100,6 @@ void TabWidget::setActiveTab(int tabID)
|
|||
{
|
||||
assert(0 <= tabID && tabID < (int)_tabs.size());
|
||||
|
||||
// Make sure all child widgets are shown
|
||||
_boss->setDirty(); _boss->draw();
|
||||
Widget::setDirtyInChain(_tabs[tabID].firstWidget);
|
||||
Widget::setDirtyInChain(_tabs[tabID].parentWidget);
|
||||
|
||||
if(_tabs[tabID].parentWidget)
|
||||
_tabs[tabID].parentWidget->loadConfig();
|
||||
|
||||
|
@ -129,6 +124,8 @@ void TabWidget::setActiveTab(int tabID)
|
|||
if(_activeWidget)
|
||||
_activeWidget->receivedFocus();
|
||||
}
|
||||
|
||||
setDirty(); draw();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -171,7 +168,6 @@ void TabWidget::cycleWidget(int direction)
|
|||
Widget::setNextInChain(_tabs[_activeTab].firstWidget,
|
||||
_tabs[_activeTab].activeWidget);
|
||||
|
||||
_boss->setDirty();
|
||||
Widget::setDirtyInChain(_tabs[_activeTab].firstWidget);
|
||||
}
|
||||
|
||||
|
@ -200,7 +196,7 @@ void TabWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
|||
}
|
||||
|
||||
// If a tab was clicked, switch to that pane
|
||||
if (tabID >= 0)
|
||||
if (tabID >= 0 && tabID != _activeTab)
|
||||
setActiveTab(tabID);
|
||||
}
|
||||
|
||||
|
@ -250,6 +246,7 @@ void TabWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
|||
{
|
||||
_tabs[_activeTab].activeWidget = _activeWidget;
|
||||
Widget::setFocusForChain(_firstWidget, _activeWidget);
|
||||
setActiveTab(_activeTab);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue