For Qt GUI, added logic to make nametable viewer tile select, tile grid,
and attribute grid colors configurable.
This commit is contained in:
parent
aff634b0ed
commit
9b0ae8840b
|
@ -27,6 +27,7 @@
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
#include <QColorDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include "../../types.h"
|
#include "../../types.h"
|
||||||
|
@ -118,7 +119,7 @@ ppuNameTableViewerDialog_t::ppuNameTableViewerDialog_t(QWidget *parent)
|
||||||
QGridLayout *grid;
|
QGridLayout *grid;
|
||||||
QGroupBox *frame;
|
QGroupBox *frame;
|
||||||
QMenuBar *menuBar;
|
QMenuBar *menuBar;
|
||||||
QMenu *viewMenu, *subMenu;
|
QMenu *viewMenu, *colorMenu, *subMenu;
|
||||||
QAction *act, *zoomAct[4];
|
QAction *act, *zoomAct[4];
|
||||||
QActionGroup *group;
|
QActionGroup *group;
|
||||||
QLabel *lbl;
|
QLabel *lbl;
|
||||||
|
@ -133,8 +134,6 @@ ppuNameTableViewerDialog_t::ppuNameTableViewerDialog_t(QWidget *parent)
|
||||||
|
|
||||||
nameTableViewWindow = this;
|
nameTableViewWindow = this;
|
||||||
|
|
||||||
compactView = false;
|
|
||||||
|
|
||||||
menuBar = new QMenuBar(this);
|
menuBar = new QMenuBar(this);
|
||||||
|
|
||||||
// This is needed for menu bar to show up on MacOS
|
// This is needed for menu bar to show up on MacOS
|
||||||
|
@ -225,6 +224,33 @@ ppuNameTableViewerDialog_t::ppuNameTableViewerDialog_t(QWidget *parent)
|
||||||
|
|
||||||
viewMenu->addAction(act);
|
viewMenu->addAction(act);
|
||||||
|
|
||||||
|
// Colors
|
||||||
|
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()) );
|
||||||
|
|
||||||
|
colorMenu->addAction(act);
|
||||||
|
|
||||||
|
// 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()) );
|
||||||
|
|
||||||
|
colorMenu->addAction(act);
|
||||||
|
|
||||||
|
// 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()) );
|
||||||
|
|
||||||
|
colorMenu->addAction(act);
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// End Menu
|
// End Menu
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
@ -460,18 +486,6 @@ void ppuNameTableViewerDialog_t::changeZoom4x(void)
|
||||||
void ppuNameTableViewerDialog_t::updateVisibility(void)
|
void ppuNameTableViewerDialog_t::updateVisibility(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
//if ( compactView )
|
|
||||||
//{
|
|
||||||
// ctlPanelFrame->hide();
|
|
||||||
// mirrorGroup->hide();
|
|
||||||
// dataDisplayGroup->hide();
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// ctlPanelFrame->show();
|
|
||||||
// mirrorGroup->show();
|
|
||||||
// dataDisplayGroup->show();
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
void ppuNameTableViewerDialog_t::setPropertyLabels( int TileID, int TileX, int TileY, int NameTable, int PPUAddress, int AttAddress, int Attrib, int palAddr )
|
void ppuNameTableViewerDialog_t::setPropertyLabels( int TileID, int TileX, int TileY, int NameTable, int PPUAddress, int AttAddress, int Attrib, int palAddr )
|
||||||
|
@ -585,11 +599,39 @@ void ppuNameTableViewerDialog_t::menuIgnPalChanged(bool checked)
|
||||||
ignorePaletteCbox->setChecked( checked );
|
ignorePaletteCbox->setChecked( checked );
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
void ppuNameTableViewerDialog_t::menuCompactChanged(void)
|
void ppuNameTableViewerDialog_t::openColorPicker( QColor *c )
|
||||||
{
|
{
|
||||||
compactView = !compactView;
|
int ret;
|
||||||
|
QColorDialog dialog( this );
|
||||||
|
|
||||||
updateVisibility();
|
dialog.setCurrentColor( *c );
|
||||||
|
dialog.setOption( QColorDialog::DontUseNativeDialog, true );
|
||||||
|
dialog.show();
|
||||||
|
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 );
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
void ppuNameTableViewerDialog_t::showScrollLinesChanged(int state)
|
void ppuNameTableViewerDialog_t::showScrollLinesChanged(int state)
|
||||||
|
@ -657,6 +699,7 @@ ppuNameTableView_t::ppuNameTableView_t(QWidget *parent)
|
||||||
selTable = 0;
|
selTable = 0;
|
||||||
scrollArea = NULL;
|
scrollArea = NULL;
|
||||||
|
|
||||||
|
tileSelColor.setRgb(255,255,255);
|
||||||
tileGridColor.setRgb(255, 0, 0);
|
tileGridColor.setRgb(255, 0, 0);
|
||||||
attrGridColor.setRgb( 0, 0,255);
|
attrGridColor.setRgb( 0, 0,255);
|
||||||
}
|
}
|
||||||
|
@ -1078,7 +1121,7 @@ void ppuNameTableView_t::paintEvent(QPaintEvent *event)
|
||||||
painter.drawRect( xx, yy, w*8, h*8 );
|
painter.drawRect( xx, yy, w*8, h*8 );
|
||||||
|
|
||||||
pen.setWidth( 1 );
|
pen.setWidth( 1 );
|
||||||
pen.setColor( QColor(255,255,255) );
|
pen.setColor( tileSelColor );
|
||||||
painter.setPen( pen );
|
painter.setPen( pen );
|
||||||
|
|
||||||
painter.drawRect( xx, yy, w*8, h*8 );
|
painter.drawRect( xx, yy, w*8, h*8 );
|
||||||
|
|
|
@ -56,6 +56,10 @@ class ppuNameTableView_t : public QWidget
|
||||||
int getViewScale( void ){ return viewScale; };
|
int getViewScale( void ){ return viewScale; };
|
||||||
|
|
||||||
void setScrollPointer( QScrollArea *sa );
|
void setScrollPointer( QScrollArea *sa );
|
||||||
|
|
||||||
|
QColor tileSelColor;
|
||||||
|
QColor tileGridColor;
|
||||||
|
QColor attrGridColor;
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event);
|
void paintEvent(QPaintEvent *event);
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent *event);
|
||||||
|
@ -73,8 +77,6 @@ class ppuNameTableView_t : public QWidget
|
||||||
int selTable;
|
int selTable;
|
||||||
QPoint selTile;
|
QPoint selTile;
|
||||||
QPoint selTileLoc;
|
QPoint selTileLoc;
|
||||||
QColor tileGridColor;
|
|
||||||
QColor attrGridColor;
|
|
||||||
QRect viewRect;
|
QRect viewRect;
|
||||||
QScrollArea *scrollArea;
|
QScrollArea *scrollArea;
|
||||||
|
|
||||||
|
@ -93,6 +95,8 @@ class ppuNameTableViewerDialog_t : public QDialog
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *bar);
|
void closeEvent(QCloseEvent *bar);
|
||||||
|
|
||||||
|
void openColorPicker( QColor *c );
|
||||||
|
|
||||||
ppuNameTableView_t *ntView;
|
ppuNameTableView_t *ntView;
|
||||||
QScrollArea *scrollArea;
|
QScrollArea *scrollArea;
|
||||||
QCheckBox *showScrollLineCbox;
|
QCheckBox *showScrollLineCbox;
|
||||||
|
@ -116,7 +120,6 @@ class ppuNameTableViewerDialog_t : public QDialog
|
||||||
QAction *showAttributesAct;
|
QAction *showAttributesAct;
|
||||||
QAction *ignPalAct;
|
QAction *ignPalAct;
|
||||||
QLabel *mirrorLbl;
|
QLabel *mirrorLbl;
|
||||||
bool compactView;
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void closeWindow(void);
|
void closeWindow(void);
|
||||||
|
@ -135,7 +138,9 @@ class ppuNameTableViewerDialog_t : public QDialog
|
||||||
void menuGridLinesChanged( bool checked );
|
void menuGridLinesChanged( bool checked );
|
||||||
void menuAttributesChanged( bool checked );
|
void menuAttributesChanged( bool checked );
|
||||||
void menuIgnPalChanged( bool checked );
|
void menuIgnPalChanged( bool checked );
|
||||||
void menuCompactChanged(void);
|
void setTileSelectorColor(void);
|
||||||
|
void setTileGridColor(void);
|
||||||
|
void setAttrGridColor(void);
|
||||||
void changeZoom1x(void);
|
void changeZoom1x(void);
|
||||||
void changeZoom2x(void);
|
void changeZoom2x(void);
|
||||||
void changeZoom3x(void);
|
void changeZoom3x(void);
|
||||||
|
|
Loading…
Reference in New Issue