Added config parameters to save settings for Qt name table viewer.
This commit is contained in:
parent
11f2a0ce07
commit
a08a824ad7
|
@ -204,6 +204,8 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
|
|||
labelColorAct->connectColor( &asmView->labelColor );
|
||||
commentColorAct->connectColor( &asmView->commentColor);
|
||||
pcColorAct->connectColor( &asmView->pcBgColor);
|
||||
|
||||
connect( this, SIGNAL(rejected(void)), this, SLOT(deleteLater(void)));
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
ConsoleDebugger::~ConsoleDebugger(void)
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "../../debug.h"
|
||||
#include "../../palette.h"
|
||||
|
||||
#include "Qt/ColorMenu.h"
|
||||
#include "Qt/ConsoleWindow.h"
|
||||
#include "Qt/ConsoleUtilities.h"
|
||||
#include "Qt/NameTableViewer.h"
|
||||
|
@ -148,8 +149,10 @@ ppuNameTableViewerDialog_t::ppuNameTableViewerDialog_t(QWidget *parent)
|
|||
QActionGroup *group;
|
||||
QLabel *lbl;
|
||||
QFont font;
|
||||
//QShortcut *shortcut;
|
||||
//char stmp[64];
|
||||
int useNativeMenuBar, pxCharWidth;
|
||||
ColorMenuItem *tileSelColorAct, *tileGridColorAct, *attrGridColorAct;
|
||||
|
||||
font.setFamily("Courier New");
|
||||
font.setStyle( QFont::StyleNormal );
|
||||
|
@ -164,6 +167,12 @@ ppuNameTableViewerDialog_t::ppuNameTableViewerDialog_t(QWidget *parent)
|
|||
|
||||
nameTableViewWindow = this;
|
||||
|
||||
g_config->getOption("SDL.NT_DrawScrollLines", &drawScrollLines);
|
||||
g_config->getOption("SDL.NT_DrawTileGridLines", &drawTileGridLines);
|
||||
g_config->getOption("SDL.NT_DrawAttrGridLines", &drawAttrGridLines);
|
||||
g_config->getOption("SDL.NT_DrawAttrbView", &attview);
|
||||
g_config->getOption("SDL.NT_IgnoreHidePal", &hidepal);
|
||||
|
||||
menuBar = new QMenuBar(this);
|
||||
|
||||
// This is needed for menu bar to show up on MacOS
|
||||
|
@ -236,11 +245,34 @@ ppuNameTableViewerDialog_t::ppuNameTableViewerDialog_t(QWidget *parent)
|
|||
act = new QAction(tr("&Ignore Palette"), this);
|
||||
//act->setShortcut(QKeySequence::Open);
|
||||
act->setCheckable(true);
|
||||
act->setChecked(attview);
|
||||
act->setChecked(hidepal);
|
||||
act->setStatusTip(tr("Ignore Palette"));
|
||||
connect(act, SIGNAL(triggered(bool)), this, SLOT(menuIgnPalChanged(bool)) );
|
||||
ignPalAct = act;
|
||||
|
||||
viewMenu->addAction(act);
|
||||
|
||||
viewMenu->addSeparator();
|
||||
|
||||
// View -> Zoom In
|
||||
act = new QAction(tr("Zoom &In"), this);
|
||||
//act->setShortcut(QKeySequence::ZoomIn);
|
||||
act->setShortcut( QKeySequence("="));
|
||||
act->setStatusTip(tr("Zoom In"));
|
||||
connect(act, SIGNAL(triggered(void)), this, SLOT(zoomIn(void)) );
|
||||
|
||||
new QShortcut( QKeySequence("+"), this );
|
||||
|
||||
viewMenu->addAction(act);
|
||||
|
||||
// View -> Zoom Out
|
||||
act = new QAction(tr("Zoom &Out"), this);
|
||||
//act->setShortcut(QKeySequence::ZoomOut);
|
||||
act->setShortcut( QKeySequence("-") );
|
||||
act->setStatusTip(tr("Zoom Out"));
|
||||
connect(act, SIGNAL(triggered(void)), this, SLOT(zoomOut(void)) );
|
||||
|
||||
|
||||
viewMenu->addAction(act);
|
||||
|
||||
// View -> Image Zoom
|
||||
|
@ -325,6 +357,8 @@ ppuNameTableViewerDialog_t::ppuNameTableViewerDialog_t(QWidget *parent)
|
|||
group->addAction(rateAct[i]);
|
||||
subMenu->addAction(rateAct[i]);
|
||||
}
|
||||
g_config->getOption("SDL.NT_RefreshFrames", &NTViewRefresh);
|
||||
|
||||
rateAct[0]->setChecked( NTViewRefresh == 0 );
|
||||
rateAct[1]->setChecked( NTViewRefresh == 1 );
|
||||
rateAct[2]->setChecked( NTViewRefresh == 3 );
|
||||
|
@ -341,28 +375,21 @@ ppuNameTableViewerDialog_t::ppuNameTableViewerDialog_t(QWidget *parent)
|
|||
colorMenu = menuBar->addMenu(tr("&Colors"));
|
||||
|
||||
// Colors -> Tile Selector
|
||||
act = new QAction(tr("Tile &Selector"), this);
|
||||
//act->setShortcut(QKeySequence::Open);
|
||||
act->setStatusTip(tr("Tile Selector"));
|
||||
connect(act, SIGNAL(triggered()), this, SLOT(setTileSelectorColor()) );
|
||||
tileSelColorAct = new ColorMenuItem(tr("Tile &Selector"), "SDL.NT_TileSelColor", this);
|
||||
|
||||
colorMenu->addAction(act);
|
||||
colorMenu->addAction(tileSelColorAct);
|
||||
|
||||
// Colors -> Tile Grid
|
||||
act = new QAction(tr("Tile &Grid"), this);
|
||||
//act->setShortcut(QKeySequence::Open);
|
||||
act->setStatusTip(tr("Tile Grid"));
|
||||
connect(act, SIGNAL(triggered()), this, SLOT(setTileGridColor()) );
|
||||
tileGridColorAct = new ColorMenuItem(tr("Tile &Grid"), "SDL.NT_TileGridColor", this);
|
||||
//connect(act, SIGNAL(triggered()), this, SLOT(setTileGridColor()) );
|
||||
|
||||
colorMenu->addAction(act);
|
||||
colorMenu->addAction(tileGridColorAct);
|
||||
|
||||
// Colors -> Attr Grid
|
||||
act = new QAction(tr("&Attr Grid"), this);
|
||||
//act->setShortcut(QKeySequence::Open);
|
||||
act->setStatusTip(tr("Attr Grid"));
|
||||
connect(act, SIGNAL(triggered()), this, SLOT(setAttrGridColor()) );
|
||||
attrGridColorAct = new ColorMenuItem(tr("&Attr Grid"), "SDL.NT_AttrGridColor", this);
|
||||
//connect(act, SIGNAL(triggered()), this, SLOT(setAttrGridColor()) );
|
||||
|
||||
colorMenu->addAction(act);
|
||||
colorMenu->addAction(attrGridColorAct);
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// End Menu
|
||||
|
@ -536,14 +563,24 @@ ppuNameTableViewerDialog_t::ppuNameTableViewerDialog_t(QWidget *parent)
|
|||
updateMirrorText();
|
||||
refreshMenuSelections();
|
||||
|
||||
tileSelColorAct->connectColor( &ntView->tileSelColor );
|
||||
tileGridColorAct->connectColor( &ntView->tileGridColor );
|
||||
attrGridColorAct->connectColor( &ntView->attrGridColor );
|
||||
|
||||
restoreGeometry(settings.value("ntViewer/geometry").toByteArray());
|
||||
|
||||
connect( this, SIGNAL(rejected(void)), this, SLOT(deleteLater(void)));
|
||||
}
|
||||
//----------------------------------------------------
|
||||
ppuNameTableViewerDialog_t::~ppuNameTableViewerDialog_t(void)
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
updateTimer->stop();
|
||||
nameTableViewWindow = NULL;
|
||||
|
||||
settings.setValue("ntViewer/geometry", saveGeometry());
|
||||
|
||||
//printf("Name Table Viewer Window Deleted\n");
|
||||
}
|
||||
//----------------------------------------------------
|
||||
|
@ -608,6 +645,20 @@ void ppuNameTableViewerDialog_t::periodicUpdate(void)
|
|||
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableViewerDialog_t::zoomIn(void)
|
||||
{
|
||||
ntView->setViewScale( ntView->getViewScale() + 1 );
|
||||
|
||||
refreshMenuSelections();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableViewerDialog_t::zoomOut(void)
|
||||
{
|
||||
ntView->setViewScale( ntView->getViewScale() - 1 );
|
||||
|
||||
refreshMenuSelections();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableViewerDialog_t::changeZoom1x(void)
|
||||
{
|
||||
ntView->setViewScale(1);
|
||||
|
@ -660,6 +711,7 @@ void ppuNameTableViewerDialog_t::changeRate( int divider )
|
|||
{
|
||||
NTViewRefresh = 1;
|
||||
}
|
||||
g_config->setOption("SDL.NT_RefreshFrames", NTViewRefresh);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableViewerDialog_t::changeRate1(void)
|
||||
|
@ -788,6 +840,8 @@ void ppuNameTableViewerDialog_t::menuScrollLinesChanged(bool checked)
|
|||
drawScrollLines = checked;
|
||||
|
||||
showScrollLineCbox->setChecked( checked );
|
||||
|
||||
g_config->setOption("SDL.NT_DrawScrollLines", drawScrollLines);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableViewerDialog_t::menuTileGridLinesChanged(bool checked)
|
||||
|
@ -795,6 +849,8 @@ void ppuNameTableViewerDialog_t::menuTileGridLinesChanged(bool checked)
|
|||
drawTileGridLines = checked;
|
||||
|
||||
showTileGridCbox->setChecked( checked );
|
||||
|
||||
g_config->setOption("SDL.NT_DrawTileGridLines", drawTileGridLines);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableViewerDialog_t::menuAttrGridLinesChanged(bool checked)
|
||||
|
@ -802,6 +858,8 @@ void ppuNameTableViewerDialog_t::menuAttrGridLinesChanged(bool checked)
|
|||
drawAttrGridLines = checked;
|
||||
|
||||
showAttrGridCbox->setChecked( checked );
|
||||
|
||||
g_config->setOption("SDL.NT_DrawAttrGridLines", drawAttrGridLines);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableViewerDialog_t::menuAttributesChanged(bool checked)
|
||||
|
@ -809,6 +867,8 @@ void ppuNameTableViewerDialog_t::menuAttributesChanged(bool checked)
|
|||
attview = checked;
|
||||
|
||||
showAttrbCbox->setChecked( checked );
|
||||
|
||||
g_config->setOption("SDL.NT_DrawAttrbView", attview);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableViewerDialog_t::menuIgnPalChanged(bool checked)
|
||||
|
@ -816,40 +876,8 @@ void ppuNameTableViewerDialog_t::menuIgnPalChanged(bool checked)
|
|||
hidepal = checked;
|
||||
|
||||
ignorePaletteCbox->setChecked( checked );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableViewerDialog_t::openColorPicker( QColor *c )
|
||||
{
|
||||
int ret;
|
||||
QColorDialog dialog( this );
|
||||
|
||||
dialog.setCurrentColor( *c );
|
||||
dialog.setOption( QColorDialog::DontUseNativeDialog, true );
|
||||
ret = dialog.exec();
|
||||
|
||||
if ( ret == QDialog::Accepted )
|
||||
{
|
||||
//QString colorText;
|
||||
//colorText = dialog.selectedColor().name();
|
||||
//printf("FG Color string '%s'\n", colorText.toStdString().c_str() );
|
||||
//g_config->setOption("SDL.HexEditFgColor", colorText.toStdString().c_str() );
|
||||
*c = dialog.selectedColor();
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableViewerDialog_t::setTileSelectorColor(void)
|
||||
{
|
||||
openColorPicker( &ntView->tileSelColor );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableViewerDialog_t::setTileGridColor(void)
|
||||
{
|
||||
openColorPicker( &ntView->tileGridColor );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableViewerDialog_t::setAttrGridColor(void)
|
||||
{
|
||||
openColorPicker( &ntView->attrGridColor );
|
||||
g_config->setOption("SDL.NT_IgnoreHidePal", hidepal);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableViewerDialog_t::showScrollLinesChanged(int state)
|
||||
|
@ -857,6 +885,8 @@ void ppuNameTableViewerDialog_t::showScrollLinesChanged(int state)
|
|||
drawScrollLines = (state != Qt::Unchecked);
|
||||
|
||||
showScrollLineAct->setChecked( drawScrollLines );
|
||||
|
||||
g_config->setOption("SDL.NT_DrawScrollLines", drawScrollLines);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableViewerDialog_t::showTileGridChanged(int state)
|
||||
|
@ -865,6 +895,8 @@ void ppuNameTableViewerDialog_t::showTileGridChanged(int state)
|
|||
|
||||
showTileGridAct->setChecked( drawTileGridLines );
|
||||
|
||||
g_config->setOption("SDL.NT_DrawTileGridLines", drawTileGridLines);
|
||||
|
||||
redrawtables = true;
|
||||
}
|
||||
//----------------------------------------------------
|
||||
|
@ -874,6 +906,8 @@ void ppuNameTableViewerDialog_t::showAttrGridChanged(int state)
|
|||
|
||||
showAttrGridAct->setChecked( drawAttrGridLines );
|
||||
|
||||
g_config->setOption("SDL.NT_DrawAttrGridLines", drawAttrGridLines);
|
||||
|
||||
redrawtables = true;
|
||||
}
|
||||
//----------------------------------------------------
|
||||
|
@ -882,6 +916,8 @@ void ppuNameTableViewerDialog_t::showAttrbChanged(int state)
|
|||
attview = (state != Qt::Unchecked);
|
||||
|
||||
showAttributesAct->setChecked( attview );
|
||||
|
||||
g_config->setOption("SDL.NT_DrawAttrbView", attview);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ppuNameTableViewerDialog_t::ignorePaletteChanged(int state)
|
||||
|
@ -889,6 +925,8 @@ void ppuNameTableViewerDialog_t::ignorePaletteChanged(int state)
|
|||
hidepal = (state != Qt::Unchecked);
|
||||
|
||||
ignPalAct->setChecked( hidepal );
|
||||
|
||||
g_config->setOption("SDL.NT_IgnoreHidePal", hidepal);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
ppuNameTableView_t::ppuNameTableView_t(QWidget *parent)
|
||||
|
@ -922,6 +960,10 @@ ppuNameTableView_t::ppuNameTableView_t(QWidget *parent)
|
|||
tileGridColor.setRgb(255, 0, 0);
|
||||
attrGridColor.setRgb( 0, 0,255);
|
||||
|
||||
fceuLoadConfigColor("SDL.NT_TileSelColor" , &tileSelColor );
|
||||
fceuLoadConfigColor("SDL.NT_TileGridColor", &tileGridColor );
|
||||
fceuLoadConfigColor("SDL.NT_AttrGridColor", &attrGridColor );
|
||||
|
||||
g_config->getOption("SDL.NT_TileFocusPolicy", &hover2Focus );
|
||||
}
|
||||
//----------------------------------------------------
|
||||
|
@ -1113,23 +1155,24 @@ void ppuNameTableView_t::computeNameTableProperties( int NameTable, int TileX, i
|
|||
//----------------------------------------------------
|
||||
void ppuNameTableView_t::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if ( (event->key() == Qt::Key_Minus) || (event->key() == Qt::Key_Underscore) )
|
||||
{
|
||||
setViewScale( viewScale-1 );
|
||||
//if ( (event->key() == Qt::Key_Minus) || (event->key() == Qt::Key_Underscore) )
|
||||
//{
|
||||
// setViewScale( viewScale-1 );
|
||||
|
||||
parent->refreshMenuSelections();
|
||||
// parent->refreshMenuSelections();
|
||||
|
||||
event->accept();
|
||||
}
|
||||
else if ( (event->key() == Qt::Key_Plus) || (event->key() == Qt::Key_Equal) )
|
||||
{
|
||||
setViewScale( viewScale+1 );
|
||||
// event->accept();
|
||||
//}
|
||||
//else if ( (event->key() == Qt::Key_Plus) || (event->key() == Qt::Key_Equal) )
|
||||
//{
|
||||
// setViewScale( viewScale+1 );
|
||||
|
||||
parent->refreshMenuSelections();
|
||||
// parent->refreshMenuSelections();
|
||||
|
||||
event->accept();
|
||||
}
|
||||
else if ( event->key() == Qt::Key_Up )
|
||||
// event->accept();
|
||||
//}
|
||||
//else if ( event->key() == Qt::Key_Up )
|
||||
if ( event->key() == Qt::Key_Up )
|
||||
{
|
||||
int y = selTile.y();
|
||||
|
||||
|
|
|
@ -187,7 +187,6 @@ class ppuNameTableViewerDialog_t : public QDialog
|
|||
protected:
|
||||
void closeEvent(QCloseEvent *bar);
|
||||
|
||||
void openColorPicker( QColor *c );
|
||||
void changeRate( int divider );
|
||||
|
||||
ppuNameTableView_t *ntView;
|
||||
|
@ -238,9 +237,6 @@ class ppuNameTableViewerDialog_t : public QDialog
|
|||
void menuAttrGridLinesChanged( bool checked );
|
||||
void menuAttributesChanged( bool checked );
|
||||
void menuIgnPalChanged( bool checked );
|
||||
void setTileSelectorColor(void);
|
||||
void setTileGridColor(void);
|
||||
void setAttrGridColor(void);
|
||||
void setClickFocus(void);
|
||||
void setHoverFocus(void);
|
||||
void changeZoom1x(void);
|
||||
|
@ -253,6 +249,8 @@ class ppuNameTableViewerDialog_t : public QDialog
|
|||
void changeRate8(void);
|
||||
void changeRate16(void);
|
||||
void forceRefresh(void);
|
||||
void zoomIn(void);
|
||||
void zoomOut(void);
|
||||
};
|
||||
|
||||
int openNameTableViewWindow( QWidget *parent );
|
||||
|
|
|
@ -700,6 +700,15 @@ InitConfig()
|
|||
config->addOption("SDL.OAM_TileFocusPolicy", 0);
|
||||
config->addOption("SDL.PPU_MaskUnused", 0);
|
||||
config->addOption("SDL.PPU_InvertMask", 0);
|
||||
config->addOption("SDL.NT_TileSelColor", "#FFFFFF");
|
||||
config->addOption("SDL.NT_TileGridColor", "#FF0000");
|
||||
config->addOption("SDL.NT_AttrGridColor", "#0000FF");
|
||||
config->addOption("SDL.NT_DrawScrollLines", 1);
|
||||
config->addOption("SDL.NT_DrawTileGridLines", 1);
|
||||
config->addOption("SDL.NT_DrawAttrGridLines", 0);
|
||||
config->addOption("SDL.NT_DrawAttrbView", 0);
|
||||
config->addOption("SDL.NT_IgnoreHidePal", 0);
|
||||
config->addOption("SDL.NT_RefreshFrames", 1);
|
||||
|
||||
// quit when a+b+select+start is pressed
|
||||
config->addOption("4buttonexit", "SDL.ABStartSelectExit", 0);
|
||||
|
|
Loading…
Reference in New Issue