mirror of https://github.com/stella-emu/stella.git
Implemented 'Fill to scanline' in TiaOutputWidget. Currently, you
have to be in 'scanline' mode for it to work (which means you must have previously selected 'Alt l' or pressed the 'Scanline+1' button). This is similar to the bug where stepping shows partial changes only when you've first selected scanline mode; this bug will be fixed shortly. Fixed coordinate issues in TiaZoomWidget and when setting position from TiaOutputWidget. The position selected in TiaOutputWidget now becomes the center point in the zoomed image. Zooming in TiaZoomWidget now operates on the center coordinate. That means you actually zoom in on the center of the image (vs. before, where you zoomed on the upper-left area). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@757 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
1cefd6893e
commit
797cf67ee7
|
@ -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.2 2005-08-31 22:34:43 stephena Exp $
|
||||
// $Id: TiaOutputWidget.cxx,v 1.3 2005-09-01 16:49:52 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -25,6 +25,8 @@
|
|||
#include "GuiObject.hxx"
|
||||
#include "ContextMenu.hxx"
|
||||
#include "TiaZoomWidget.hxx"
|
||||
#include "Debugger.hxx"
|
||||
#include "TIADebug.hxx"
|
||||
|
||||
#include "TiaOutputWidget.hxx"
|
||||
|
||||
|
@ -82,18 +84,13 @@ void TiaOutputWidget::advance(int frames)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TiaOutputWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
||||
{
|
||||
// FIXME - these coords aren't yet accurate, but that doesn't stop
|
||||
// us from implementing the functionality
|
||||
int xstart = atoi(instance()->console().properties().get("Display.XStart").c_str());
|
||||
int ystart = atoi(instance()->console().properties().get("Display.YStart").c_str());
|
||||
|
||||
// Grab right mouse button for zoom context menu
|
||||
// Grab right mouse button for command context menu
|
||||
if(button == 2)
|
||||
{
|
||||
myClickX = x + getAbsX();
|
||||
myClickY = y + getAbsY();
|
||||
myClickX = x;
|
||||
myClickY = y;
|
||||
|
||||
myMenu->setPos(myClickX, myClickY);
|
||||
myMenu->setPos(x + getAbsX(), y + getAbsY());
|
||||
myMenu->show();
|
||||
}
|
||||
}
|
||||
|
@ -101,14 +98,24 @@ void TiaOutputWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TiaOutputWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||
{
|
||||
// FIXME - these coords aren't yet accurate, but that doesn't stop
|
||||
// us from implementing the functionality
|
||||
// Maybe they're accurate enough for our purposes??
|
||||
int xstart = atoi(instance()->console().properties().get("Display.XStart").c_str());
|
||||
int ystart = atoi(instance()->console().properties().get("Display.YStart").c_str());
|
||||
|
||||
switch(cmd)
|
||||
{
|
||||
case kCMenuItemSelectedCmd:
|
||||
switch(myMenu->getSelected())
|
||||
{
|
||||
case 0:
|
||||
cerr << "Fill to scanline\n";
|
||||
{
|
||||
int lines = myClickY + ystart - instance()->debugger().tiaDebug().scanlines();
|
||||
if(lines > 0)
|
||||
instance()->debugger().nextScanline(lines);
|
||||
break;
|
||||
}
|
||||
|
||||
case 1:
|
||||
cerr << "Set breakpoint\n";
|
||||
|
|
|
@ -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: TiaZoomWidget.cxx,v 1.2 2005-08-31 22:34:43 stephena Exp $
|
||||
// $Id: TiaZoomWidget.cxx,v 1.3 2005-09-01 16:49:52 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -46,6 +46,8 @@ TiaZoomWidget::TiaZoomWidget(GuiObject* boss, int x, int y)
|
|||
myNumRows = (_h - 4) / myZoomLevel;
|
||||
myXoff = 0;
|
||||
myYoff = 0;
|
||||
myXCenter = myNumCols >> 1;
|
||||
myYCenter = myNumRows >> 1;
|
||||
|
||||
// Create context menu for zoom levels
|
||||
myMenu = new ContextMenu(this, instance()->consoleFont());
|
||||
|
@ -73,8 +75,11 @@ void TiaZoomWidget::loadConfig()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TiaZoomWidget::setPos(int x, int y)
|
||||
{
|
||||
myXoff = x;
|
||||
myYoff = y;
|
||||
// Center zoom on given x,y point
|
||||
myXCenter = x >> 1;
|
||||
myYCenter = y;
|
||||
|
||||
//cerr << " ==> myXCenter = " << myXCenter << ", myYCenter = " << myYCenter << endl;
|
||||
|
||||
recalc();
|
||||
}
|
||||
|
@ -96,19 +101,32 @@ void TiaZoomWidget::zoom(int level)
|
|||
void TiaZoomWidget::recalc()
|
||||
{
|
||||
// Don't go past end of framebuffer
|
||||
int imageWidth = instance()->console().mediaSource().width();
|
||||
int imageHeight = instance()->console().mediaSource().height();
|
||||
const int width = instance()->console().mediaSource().width(),
|
||||
height = instance()->console().mediaSource().height();
|
||||
|
||||
if(myXoff < 0)
|
||||
myXoff = 0;
|
||||
else if(myXoff > imageWidth - myNumCols)
|
||||
myXoff = imageWidth - myNumCols;
|
||||
else if(myYoff < 0)
|
||||
myYoff = 0;
|
||||
else if(myYoff > imageHeight - myNumRows)
|
||||
myYoff = imageHeight - myNumRows;
|
||||
// Figure out the bounding rectangle for the current center coords
|
||||
const int xoff = myNumCols >> 1,
|
||||
yoff = myNumRows >> 1;
|
||||
|
||||
setDirty(); draw();
|
||||
if(myXCenter < xoff)
|
||||
myXCenter = xoff;
|
||||
else if(myXCenter + xoff >= width)
|
||||
myXCenter = width - xoff - 1;
|
||||
else if(myYCenter < yoff)
|
||||
myYCenter = yoff;
|
||||
else if(myYCenter + yoff >= height)
|
||||
myYCenter = height - yoff - 1;
|
||||
|
||||
// Only redraw when necessary
|
||||
int oldXoff = myXoff, oldYoff = myYoff;
|
||||
myXoff = myXCenter - (myNumCols >> 1);
|
||||
myYoff = myYCenter - (myNumRows >> 1);
|
||||
if(oldXoff != myXoff || oldYoff != myYoff)
|
||||
{
|
||||
setDirty(); draw();
|
||||
//cerr << " OLD ==> myXoff: " << oldXoff << ", myYoff = " << oldYoff << endl;
|
||||
//cerr << " NEW ==> myXoff: " << myXoff << ", myYoff = " << myYoff << endl << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -130,22 +148,22 @@ bool TiaZoomWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
|||
switch (keycode)
|
||||
{
|
||||
case 256+17: // up arrow
|
||||
myYoff -= 4;
|
||||
myYCenter -= 4;
|
||||
handled = true;
|
||||
break;
|
||||
|
||||
case 256+18: // down arrow
|
||||
myYoff += 4;
|
||||
myYCenter += 4;
|
||||
handled = true;
|
||||
break;
|
||||
|
||||
case 256+20: // left arrow
|
||||
myXoff -= 2;
|
||||
myXCenter -= 2;
|
||||
handled = true;
|
||||
break;
|
||||
|
||||
case 256+19: // right arrow
|
||||
myXoff += 2;
|
||||
myXCenter += 2;
|
||||
handled = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -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: TiaZoomWidget.hxx,v 1.2 2005-08-31 22:34:43 stephena Exp $
|
||||
// $Id: TiaZoomWidget.hxx,v 1.3 2005-09-01 16:49:52 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -56,6 +56,7 @@ class TiaZoomWidget : public Widget, public CommandSender
|
|||
int myZoomLevel;
|
||||
int myNumCols, myNumRows;
|
||||
int myXoff, myYoff;
|
||||
int myXCenter, myYCenter;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue