Skip to content

Commit 157b303

Browse files
committed
Have the BitMapViewer use MSXPalette
1 parent 39a9d42 commit 157b303

File tree

5 files changed

+187
-247
lines changed

5 files changed

+187
-247
lines changed

src/BitMapViewer.cpp

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,6 @@
44
#include "Convert.h"
55
#include <QMessageBox>
66

7-
static const uint8_t defaultPalette[32] = {
8-
// RB G
9-
0x00, 0,
10-
0x00, 0,
11-
0x11, 6,
12-
0x33, 7,
13-
0x17, 1,
14-
0x27, 3,
15-
0x51, 1,
16-
0x27, 6,
17-
0x71, 1,
18-
0x73, 3,
19-
0x61, 6,
20-
0x64, 6,
21-
0x11, 4,
22-
0x65, 2,
23-
0x55, 5,
24-
0x77, 7,
25-
};
26-
277
BitMapViewer::BitMapViewer(QWidget* parent)
288
: QDialog(parent)
299
, screenMod(0) // avoid UMR
@@ -38,7 +18,6 @@ BitMapViewer::BitMapViewer(QWidget* parent)
3818
connect(useVDPRegisters, &QCheckBox::stateChanged,this, &BitMapViewer::on_useVDPRegisters_stateChanged);
3919

4020
connect(saveImageButton, &QPushButton::clicked, this, &BitMapViewer::on_saveImageButton_clicked);
41-
connect(editPaletteButton, &QPushButton::clicked, this, &BitMapViewer::on_editPaletteButton_clicked);
4221
connect(useVDPPalette, &QCheckBox::stateChanged, this, &BitMapViewer::on_useVDPPalette_stateChanged);
4322
connect(zoomLevel, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &BitMapViewer::on_zoomLevel_valueChanged);
4423

@@ -61,10 +40,9 @@ BitMapViewer::BitMapViewer(QWidget* parent)
6140
useVDP = useVDPRegisters->isChecked();
6241

6342
const uint8_t* vram = VDPDataStore::instance().getVramPointer();
64-
const uint8_t* palette = VDPDataStore::instance().getPalettePointer();
6543
imageWidget->setVramSource(vram);
6644
imageWidget->setVramAddress(0);
67-
imageWidget->setPaletteSource(palette);
45+
imageWidget->setPaletteSource(VDPDataStore::instance().getPalette(paletteVDP));
6846

6947
//now hook up some signals and slots
7048
connect(&VDPDataStore::instance(), &VDPDataStore::dataRefreshed,
@@ -246,23 +224,13 @@ void BitMapViewer::on_saveImageButton_clicked(bool /*checked*/)
246224
"Sorry, the save image dialog is not yet implemented");
247225
}
248226

249-
void BitMapViewer::on_editPaletteButton_clicked(bool /*checked*/)
250-
{
251-
useVDPPalette->setChecked(false);
252-
QMessageBox::information(
253-
this,
254-
"Not yet implemented",
255-
"Sorry, the palette editor is not yet implemented, "
256-
"only disabling 'Use VDP palette registers' for now");
257-
}
258227

259228
void BitMapViewer::on_useVDPPalette_stateChanged(int state)
260229
{
261230
if (state) {
262-
const uint8_t* palette = VDPDataStore::instance().getPalettePointer();
263-
imageWidget->setPaletteSource(palette);
231+
imageWidget->setPaletteSource(VDPDataStore::instance().getPalette(paletteVDP));
264232
} else {
265-
imageWidget->setPaletteSource(defaultPalette);
233+
imageWidget->setPaletteSource(VDPDataStore::instance().getPalette(paletteBitmap));
266234
}
267235
imageWidget->refresh();
268236
}

src/BitMapViewer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <QDialog>
66

77
class VramBitMappedView;
8+
class MSXPalette;
89

910
class BitMapViewer : public QDialog, private Ui::BitMapViewer
1011
{
@@ -25,7 +26,6 @@ class BitMapViewer : public QDialog, private Ui::BitMapViewer
2526
void on_useVDPRegisters_stateChanged(int state);
2627

2728
void on_saveImageButton_clicked(bool checked);
28-
void on_editPaletteButton_clicked(bool checked);
2929
void on_useVDPPalette_stateChanged(int state);
3030
void on_zoomLevel_valueChanged(double d);
3131

0 commit comments

Comments
 (0)