Added config parameters to save PPU viewer tile focus policy preferences for Qt GUI.

This commit is contained in:
mjbudd77 2021-05-03 20:25:54 -04:00
parent 02e3c4e075
commit 68555d98ab
4 changed files with 32 additions and 10 deletions

View File

@ -901,6 +901,8 @@ ppuNameTableView_t::ppuNameTableView_t(QWidget *parent)
tileSelColor.setRgb(255,255,255);
tileGridColor.setRgb(255, 0, 0);
attrGridColor.setRgb( 0, 0,255);
g_config->getOption("SDL.NT_TileFocusPolicy", &hover2Focus );
}
//----------------------------------------------------
ppuNameTableView_t::~ppuNameTableView_t(void)
@ -916,6 +918,8 @@ void ppuNameTableView_t::setScrollPointer( QScrollArea *sa )
void ppuNameTableView_t::setHoverFocus( bool hoverFocus )
{
hover2Focus = hoverFocus;
g_config->setOption("SDL.NT_TileFocusPolicy", hover2Focus );
}
//----------------------------------------------------
void ppuNameTableView_t::setViewScale( int reqScale )

View File

@ -624,6 +624,11 @@ InitConfig()
// enable new PPU core
config->addOption("newppu", "SDL.NewPPU", 0);
// PPU Viewer Preferences
config->addOption("SDL.NT_TileFocusPolicy", 0);
config->addOption("SDL.PPU_TileFocusPolicy", 0);
config->addOption("SDL.OAM_TileFocusPolicy", 0);
// quit when a+b+select+start is pressed
config->addOption("4buttonexit", "SDL.ABStartSelectExit", 0);

View File

@ -349,14 +349,14 @@ ppuViewerDialog_t::ppuViewerDialog_t(QWidget *parent)
act = new QAction(tr("&Click"), this);
act->setCheckable(true);
act->setChecked(true);
act->setChecked( !patternView[0]->getHoverFocus() );
group->addAction(act);
subMenu->addAction(act);
connect(act, SIGNAL(triggered()), this, SLOT(setClickFocus(void)) );
act = new QAction(tr("&Hover"), this);
act->setCheckable(true);
act->setChecked(false);
act->setChecked( patternView[0]->getHoverFocus() );
group->addAction(act);
subMenu->addAction(act);
connect(act, SIGNAL(triggered()), this, SLOT(setHoverFocus(void)) );
@ -467,6 +467,8 @@ ppuPatternView_t::ppuPatternView_t( int patternIndexID, QWidget *parent)
gridColor.setRgb(128,128,128);
selTile.setX(-1);
selTile.setY(-1);
g_config->getOption("SDL.PPU_TileFocusPolicy", &hover2Focus );
}
//----------------------------------------------------
void ppuPatternView_t::setPattern( ppuPatternTable_t *p )
@ -482,6 +484,8 @@ void ppuPatternView_t::setTileLabel( QLabel *l )
void ppuPatternView_t::setHoverFocus( bool h )
{
hover2Focus = h;
g_config->setOption("SDL.PPU_TileFocusPolicy", hover2Focus );
}
//----------------------------------------------------
void ppuPatternView_t::setTileCoord( int x, int y )
@ -2589,6 +2593,11 @@ spriteViewerDialog_t::spriteViewerDialog_t(QWidget *parent)
spriteViewWindow = this;
oamView = new oamPatternView_t(this);
tileView = new oamTileView_t(this);
palView = new oamPaletteView_t(this);
preView = new oamPreview_t(this);
menuBar = new QMenuBar(this);
// This is needed for menu bar to show up on MacOS
@ -2659,14 +2668,14 @@ spriteViewerDialog_t::spriteViewerDialog_t(QWidget *parent)
act = new QAction(tr("&Click"), this);
act->setCheckable(true);
act->setChecked(true);
act->setChecked( !oamView->getHoverFocus() );
group->addAction(act);
subMenu->addAction(act);
connect(act, SIGNAL(triggered()), this, SLOT(setClickFocus(void)) );
act = new QAction(tr("&Hover"), this);
act->setCheckable(true);
act->setChecked(false);
act->setChecked( oamView->getHoverFocus() );
group->addAction(act);
subMenu->addAction(act);
connect(act, SIGNAL(triggered()), this, SLOT(setHoverFocus(void)) );
@ -2695,11 +2704,6 @@ spriteViewerDialog_t::spriteViewerDialog_t(QWidget *parent)
setLayout( mainLayout );
oamView = new oamPatternView_t(this);
tileView = new oamTileView_t(this);
palView = new oamPaletteView_t(this);
preView = new oamPreview_t(this);
useSprRam = new QRadioButton( tr("Sprite RAM") );
useCpuPag = new QRadioButton( tr("CPU Page #") );
cpuPagIdx = new QSpinBox(this);
@ -2959,6 +2963,8 @@ oamPatternView_t::oamPatternView_t( QWidget *parent )
selSprite.setX(0);
selSprite.setY(0);
spriteIdx = 0;
g_config->getOption("SDL.OAM_TileFocusPolicy", &hover2Focus );
}
//----------------------------------------------------
oamPatternView_t::~oamPatternView_t(void)
@ -2966,7 +2972,12 @@ oamPatternView_t::~oamPatternView_t(void)
}
//----------------------------------------------------
void oamPatternView_t::setHover2Focus(bool val){ hover2Focus = val; }
void oamPatternView_t::setHover2Focus(bool val)
{
hover2Focus = val;
g_config->setOption("SDL.OAM_TileFocusPolicy", hover2Focus );
}
//----------------------------------------------------
void oamPatternView_t::setGridVisibility(bool val){ showGrid = val; }
//----------------------------------------------------

View File

@ -58,6 +58,7 @@ class ppuPatternView_t : public QWidget
void setHoverFocus( bool h );
QPoint convPixToTile( QPoint p );
bool getHoverFocus(void){ return hover2Focus; };
bool getDrawTileGrid(void){ return drawTileGrid; };
protected:
void paintEvent(QPaintEvent *event);
@ -328,6 +329,7 @@ class oamPatternView_t : public QWidget
int getSpriteIndex(void);
void setHover2Focus(bool val);
bool getHoverFocus(void){ return hover2Focus; };
void setGridVisibility(bool val);
bool getGridVisibility(void){ return showGrid; };
protected: