Fixed GUI layout (RAM)

This commit is contained in:
Dimitris Panokostas 2017-12-15 13:57:18 +01:00
parent 601663fbf1
commit 753aab1682

View file

@ -25,18 +25,20 @@
#include "gui_handling.h" #include "gui_handling.h"
static const char *ChipMem_list[] = { "512 K", "1 MB", "2 MB", "4 MB", "8 MB" }; static const char* ChipMem_list[] = {"512 K", "1 MB", "2 MB", "4 MB", "8 MB"};
static const int ChipMem_values[] = { 0x080000, 0x100000, 0x200000, 0x400000, 0x800000 }; static const int ChipMem_values[] = {0x080000, 0x100000, 0x200000, 0x400000, 0x800000};
static const char *SlowMem_list[] = { "None", "512 K", "1 MB", "1.5 MB", "1.8 MB" }; static const char* SlowMem_list[] = {"None", "512 K", "1 MB", "1.5 MB", "1.8 MB"};
static const int SlowMem_values[] = { 0x000000, 0x080000, 0x100000, 0x180000, 0x1c0000 }; static const int SlowMem_values[] = {0x000000, 0x080000, 0x100000, 0x180000, 0x1c0000};
static const char *FastMem_list[] = { "None", "1 MB", "2 MB", "4 MB", "8 MB", "16 MB", "32 MB", "64 MB", "128 MB" }; static const char* FastMem_list[] = {"None", "1 MB", "2 MB", "4 MB", "8 MB", "16 MB", "32 MB", "64 MB", "128 MB"};
static const int FastMem_values[] = { 0x000000, 0x100000, 0x200000, 0x400000, 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000 }; static const int FastMem_values[] = {
static const char *A3000LowMem_list[] = { "None", "8 MB", "16 MB" }; 0x000000, 0x100000, 0x200000, 0x400000, 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000
static const int A3000LowMem_values[] = { 0x080000, 0x800000, 0x1000000 }; };
static const char *A3000HighMem_list[] = { "None", "8 MB", "16 MB", "32 MB" }; static const char* A3000LowMem_list[] = {"None", "8 MB", "16 MB"};
static const int A3000HighMem_values[] = { 0x080000, 0x800000, 0x1000000, 0x2000000 }; static const int A3000LowMem_values[] = {0x080000, 0x800000, 0x1000000};
static const char* A3000HighMem_list[] = {"None", "8 MB", "16 MB", "32 MB"};
static const int A3000HighMem_values[] = {0x080000, 0x800000, 0x1000000, 0x2000000};
static gcn::Window *grpRAM; static gcn::Window* grpRAM;
static gcn::Label* lblChipmem; static gcn::Label* lblChipmem;
static gcn::Label* lblChipsize; static gcn::Label* lblChipsize;
static gcn::Slider* sldChipmem; static gcn::Slider* sldChipmem;
@ -97,13 +99,15 @@ public:
changed_prefs.rtgboards[0].rtgmem_type = GFXBOARD_UAE_Z3; changed_prefs.rtgboards[0].rtgmem_type = GFXBOARD_UAE_Z3;
} }
if (actionEvent.getSource() == sldA3000Lowmem) { if (actionEvent.getSource() == sldA3000Lowmem)
{
changed_prefs.mbresmem_low_size = A3000LowMem_values[(int)(sldA3000Lowmem->getValue())]; changed_prefs.mbresmem_low_size = A3000LowMem_values[(int)(sldA3000Lowmem->getValue())];
if (currprefs.mbresmem_low_size != changed_prefs.mbresmem_low_size) if (currprefs.mbresmem_low_size != changed_prefs.mbresmem_low_size)
DisableResume(); DisableResume();
} }
if (actionEvent.getSource() == sldA3000Highmem) { if (actionEvent.getSource() == sldA3000Highmem)
{
changed_prefs.mbresmem_high_size = A3000HighMem_values[(int)(sldA3000Highmem->getValue())]; changed_prefs.mbresmem_high_size = A3000HighMem_values[(int)(sldA3000Highmem->getValue())];
if (currprefs.mbresmem_high_size != changed_prefs.mbresmem_high_size) if (currprefs.mbresmem_high_size != changed_prefs.mbresmem_high_size)
DisableResume(); DisableResume();
@ -118,128 +122,128 @@ static MemorySliderActionListener* memorySliderActionListener;
void InitPanelRAM(const struct _ConfigCategory& category) void InitPanelRAM(const struct _ConfigCategory& category)
{ {
memorySliderActionListener = new MemorySliderActionListener(); memorySliderActionListener = new MemorySliderActionListener();
int sldWidth; int sldWidth;
int markerLength; int markerLength;
#ifdef ANDROID #ifdef ANDROID
sldWidth = 150; sldWidth = 150;
markerLength = 30; markerLength = 30;
#else #else
sldWidth = 110; sldWidth = 110;
markerLength = 20; markerLength = 20;
#endif #endif
lblChipmem = new gcn::Label("Chip:"); lblChipmem = new gcn::Label("Chip:");
sldChipmem = new gcn::Slider(0, 4); sldChipmem = new gcn::Slider(0, 4);
sldChipmem->setSize(sldWidth, SLIDER_HEIGHT); sldChipmem->setSize(sldWidth, SLIDER_HEIGHT);
sldChipmem->setBaseColor(gui_baseCol); sldChipmem->setBaseColor(gui_baseCol);
sldChipmem->setMarkerLength(markerLength); sldChipmem->setMarkerLength(markerLength);
sldChipmem->setStepLength(1); sldChipmem->setStepLength(1);
sldChipmem->setId("Chipmem"); sldChipmem->setId("Chipmem");
sldChipmem->addActionListener(memorySliderActionListener); sldChipmem->addActionListener(memorySliderActionListener);
lblChipsize = new gcn::Label("None "); lblChipsize = new gcn::Label("None ");
lblSlowmem = new gcn::Label("Slow:"); lblSlowmem = new gcn::Label("Slow:");
sldSlowmem = new gcn::Slider(0, 4); sldSlowmem = new gcn::Slider(0, 4);
sldSlowmem->setSize(sldWidth, SLIDER_HEIGHT); sldSlowmem->setSize(sldWidth, SLIDER_HEIGHT);
sldSlowmem->setBaseColor(gui_baseCol); sldSlowmem->setBaseColor(gui_baseCol);
sldSlowmem->setMarkerLength(markerLength); sldSlowmem->setMarkerLength(markerLength);
sldSlowmem->setStepLength(1); sldSlowmem->setStepLength(1);
sldSlowmem->setId("Slowmem"); sldSlowmem->setId("Slowmem");
sldSlowmem->addActionListener(memorySliderActionListener); sldSlowmem->addActionListener(memorySliderActionListener);
lblSlowsize = new gcn::Label("None "); lblSlowsize = new gcn::Label("None ");
lblFastmem = new gcn::Label("Z2 Fast:"); lblFastmem = new gcn::Label("Z2 Fast:");
sldFastmem = new gcn::Slider(0, 4); sldFastmem = new gcn::Slider(0, 4);
sldFastmem->setSize(sldWidth, SLIDER_HEIGHT); sldFastmem->setSize(sldWidth, SLIDER_HEIGHT);
sldFastmem->setBaseColor(gui_baseCol); sldFastmem->setBaseColor(gui_baseCol);
sldFastmem->setMarkerLength(markerLength); sldFastmem->setMarkerLength(markerLength);
sldFastmem->setStepLength(1); sldFastmem->setStepLength(1);
sldFastmem->setId("Fastmem"); sldFastmem->setId("Fastmem");
sldFastmem->addActionListener(memorySliderActionListener); sldFastmem->addActionListener(memorySliderActionListener);
lblFastsize = new gcn::Label("None "); lblFastsize = new gcn::Label("None ");
lblZ3mem = new gcn::Label("Z3 fast:"); lblZ3mem = new gcn::Label("Z3 fast:");
sldZ3mem = new gcn::Slider(0, 8); sldZ3mem = new gcn::Slider(0, 8);
sldZ3mem->setSize(sldWidth, SLIDER_HEIGHT); sldZ3mem->setSize(sldWidth, SLIDER_HEIGHT);
sldZ3mem->setBaseColor(gui_baseCol); sldZ3mem->setBaseColor(gui_baseCol);
sldZ3mem->setMarkerLength(markerLength); sldZ3mem->setMarkerLength(markerLength);
sldZ3mem->setStepLength(1); sldZ3mem->setStepLength(1);
sldZ3mem->setId("Z3mem"); sldZ3mem->setId("Z3mem");
sldZ3mem->addActionListener(memorySliderActionListener); sldZ3mem->addActionListener(memorySliderActionListener);
lblZ3size = new gcn::Label("None "); lblZ3size = new gcn::Label("None ");
lblGfxmem = new gcn::Label("RTG board:"); lblGfxmem = new gcn::Label("RTG board:");
sldGfxmem = new gcn::Slider(0, 5); sldGfxmem = new gcn::Slider(0, 5);
sldGfxmem->setSize(sldWidth, SLIDER_HEIGHT); sldGfxmem->setSize(sldWidth, SLIDER_HEIGHT);
sldGfxmem->setBaseColor(gui_baseCol); sldGfxmem->setBaseColor(gui_baseCol);
sldGfxmem->setMarkerLength(markerLength); sldGfxmem->setMarkerLength(markerLength);
sldGfxmem->setStepLength(1); sldGfxmem->setStepLength(1);
sldGfxmem->setId("Gfxmem"); sldGfxmem->setId("Gfxmem");
sldGfxmem->addActionListener(memorySliderActionListener); sldGfxmem->addActionListener(memorySliderActionListener);
lblGfxsize = new gcn::Label("None "); lblGfxsize = new gcn::Label("None ");
lblA3000Lowmem = new gcn::Label("A4000 Motherb. slot:"); lblA3000Lowmem = new gcn::Label("A4000 Motherb. slot:");
sldA3000Lowmem = new gcn::Slider(0, 2); sldA3000Lowmem = new gcn::Slider(0, 2);
sldA3000Lowmem->setSize(sldWidth, SLIDER_HEIGHT); sldA3000Lowmem->setSize(sldWidth, SLIDER_HEIGHT);
sldA3000Lowmem->setBaseColor(gui_baseCol); sldA3000Lowmem->setBaseColor(gui_baseCol);
sldA3000Lowmem->setMarkerLength(markerLength); sldA3000Lowmem->setMarkerLength(markerLength);
sldA3000Lowmem->setStepLength(1); sldA3000Lowmem->setStepLength(1);
sldA3000Lowmem->setId("A3000Low"); sldA3000Lowmem->setId("A3000Low");
sldA3000Lowmem->addActionListener(memorySliderActionListener); sldA3000Lowmem->addActionListener(memorySliderActionListener);
lblA3000Lowsize = new gcn::Label("None "); lblA3000Lowsize = new gcn::Label("None ");
lblA3000Highmem = new gcn::Label("A4000 Proc. board:"); lblA3000Highmem = new gcn::Label("A4000 Proc. board:");
sldA3000Highmem = new gcn::Slider(0, 3); sldA3000Highmem = new gcn::Slider(0, 3);
sldA3000Highmem->setSize(sldWidth, SLIDER_HEIGHT); sldA3000Highmem->setSize(sldWidth, SLIDER_HEIGHT);
sldA3000Highmem->setBaseColor(gui_baseCol); sldA3000Highmem->setBaseColor(gui_baseCol);
sldA3000Highmem->setMarkerLength(markerLength); sldA3000Highmem->setMarkerLength(markerLength);
sldA3000Highmem->setStepLength(1); sldA3000Highmem->setStepLength(1);
sldA3000Highmem->setId("A3000High"); sldA3000Highmem->setId("A3000High");
sldA3000Highmem->addActionListener(memorySliderActionListener); sldA3000Highmem->addActionListener(memorySliderActionListener);
lblA3000Highsize = new gcn::Label("None "); lblA3000Highsize = new gcn::Label("None ");
grpRAM = new gcn::Window("Memory Settings"); grpRAM = new gcn::Window("Memory Settings");
grpRAM->setPosition(DISTANCE_BORDER, DISTANCE_BORDER); grpRAM->setPosition(DISTANCE_BORDER, DISTANCE_BORDER);
int posY = 10; int posY = 10;
grpRAM->add(lblChipmem, 8, posY); grpRAM->add(lblChipmem, 8, posY);
grpRAM->add(sldChipmem, 160, posY); grpRAM->add(sldChipmem, lblA3000Lowmem->getWidth() + DISTANCE_NEXT_Y, posY);
grpRAM->add(lblChipsize, 160 + sldChipmem->getWidth() + 12, posY); grpRAM->add(lblChipsize, lblA3000Lowmem->getWidth() + DISTANCE_NEXT_Y + sldChipmem->getWidth() + 12, posY);
posY += sldChipmem->getHeight() + DISTANCE_NEXT_Y; posY += sldChipmem->getHeight() + DISTANCE_NEXT_Y;
grpRAM->add(lblSlowmem, 8, posY); grpRAM->add(lblSlowmem, 8, posY);
grpRAM->add(sldSlowmem, 160, posY); grpRAM->add(sldSlowmem, lblA3000Lowmem->getWidth() + DISTANCE_NEXT_Y, posY);
grpRAM->add(lblSlowsize, 160 + sldSlowmem->getWidth() + 12, posY); grpRAM->add(lblSlowsize, lblA3000Lowmem->getWidth() + DISTANCE_NEXT_Y + sldSlowmem->getWidth() + 12, posY);
posY += sldSlowmem->getHeight() + DISTANCE_NEXT_Y; posY += sldSlowmem->getHeight() + DISTANCE_NEXT_Y;
grpRAM->add(lblFastmem, 8, posY); grpRAM->add(lblFastmem, 8, posY);
grpRAM->add(sldFastmem, 160, posY); grpRAM->add(sldFastmem, lblA3000Lowmem->getWidth() + DISTANCE_NEXT_Y, posY);
grpRAM->add(lblFastsize, 160 + sldFastmem->getWidth() + 12, posY); grpRAM->add(lblFastsize, lblA3000Lowmem->getWidth() + DISTANCE_NEXT_Y + sldFastmem->getWidth() + 12, posY);
posY += sldFastmem->getHeight() + DISTANCE_NEXT_Y; posY += sldFastmem->getHeight() + DISTANCE_NEXT_Y;
grpRAM->add(lblZ3mem, 8, posY); grpRAM->add(lblZ3mem, 8, posY);
grpRAM->add(sldZ3mem, 160, posY); grpRAM->add(sldZ3mem, lblA3000Lowmem->getWidth() + DISTANCE_NEXT_Y, posY);
grpRAM->add(lblZ3size, 160 + sldZ3mem->getWidth() + 12, posY); grpRAM->add(lblZ3size, lblA3000Lowmem->getWidth() + DISTANCE_NEXT_Y + sldZ3mem->getWidth() + 12, posY);
posY += sldZ3mem->getHeight() + DISTANCE_NEXT_Y; posY += sldZ3mem->getHeight() + DISTANCE_NEXT_Y;
grpRAM->add(lblGfxmem, 8, posY); grpRAM->add(lblGfxmem, 8, posY);
grpRAM->add(sldGfxmem, 160, posY); grpRAM->add(sldGfxmem, lblA3000Lowmem->getWidth() + DISTANCE_NEXT_Y, posY);
grpRAM->add(lblGfxsize, 160 + sldGfxmem->getWidth() + 12, posY); grpRAM->add(lblGfxsize, lblA3000Lowmem->getWidth() + DISTANCE_NEXT_Y + sldGfxmem->getWidth() + 12, posY);
posY += sldGfxmem->getHeight() + DISTANCE_NEXT_Y; posY += sldGfxmem->getHeight() + DISTANCE_NEXT_Y;
grpRAM->add(lblA3000Lowmem, 8, posY); grpRAM->add(lblA3000Lowmem, 8, posY);
grpRAM->add(sldA3000Lowmem, 160, posY); grpRAM->add(sldA3000Lowmem, lblA3000Lowmem->getWidth() + DISTANCE_NEXT_Y, posY);
grpRAM->add(lblA3000Lowsize, 160 + sldA3000Lowmem->getWidth() + 12, posY); grpRAM->add(lblA3000Lowsize, lblA3000Lowmem->getWidth() + DISTANCE_NEXT_Y + sldA3000Lowmem->getWidth() + 12, posY);
posY += sldA3000Lowmem->getHeight() + DISTANCE_NEXT_Y; posY += sldA3000Lowmem->getHeight() + DISTANCE_NEXT_Y;
grpRAM->add(lblA3000Highmem, 8, posY); grpRAM->add(lblA3000Highmem, 8, posY);
grpRAM->add(sldA3000Highmem, 160, posY); grpRAM->add(sldA3000Highmem, lblA3000Lowmem->getWidth() + DISTANCE_NEXT_Y, posY);
grpRAM->add(lblA3000Highsize, 160 + sldA3000Highmem->getWidth() + 12, posY); grpRAM->add(lblA3000Highsize, lblA3000Lowmem->getWidth() + DISTANCE_NEXT_Y + sldA3000Highmem->getWidth() + 12, posY);
posY += sldA3000Highmem->getHeight() + DISTANCE_NEXT_Y; posY += sldA3000Highmem->getHeight() + DISTANCE_NEXT_Y;
grpRAM->setMovable(false); grpRAM->setMovable(false);
grpRAM->setSize(350, posY + DISTANCE_BORDER); grpRAM->setSize(400, posY + DISTANCE_BORDER);
grpRAM->setBaseColor(gui_baseCol); grpRAM->setBaseColor(gui_baseCol);
category.panel->add(grpRAM); category.panel->add(grpRAM);
@ -300,7 +304,7 @@ void RefreshPanelRAM()
} }
} }
for (i = 0; i<5; ++i) for (i = 0; i < 5; ++i)
{ {
if (changed_prefs.fastmem[0].size == FastMem_values[i]) if (changed_prefs.fastmem[0].size == FastMem_values[i])
{ {
@ -310,7 +314,7 @@ void RefreshPanelRAM()
} }
} }
for (i = 0; i<9; ++i) for (i = 0; i < 9; ++i)
{ {
if (changed_prefs.z3fastmem[0].size == FastMem_values[i]) if (changed_prefs.z3fastmem[0].size == FastMem_values[i])
{ {
@ -321,7 +325,7 @@ void RefreshPanelRAM()
} }
sldZ3mem->setEnabled(!changed_prefs.address_space_24); sldZ3mem->setEnabled(!changed_prefs.address_space_24);
for (i = 0; i<6; ++i) for (i = 0; i < 6; ++i)
{ {
if (changed_prefs.rtgboards[0].rtgmem_size == FastMem_values[i]) if (changed_prefs.rtgboards[0].rtgmem_size == FastMem_values[i])
{ {
@ -332,7 +336,7 @@ void RefreshPanelRAM()
} }
sldGfxmem->setEnabled(!changed_prefs.address_space_24); sldGfxmem->setEnabled(!changed_prefs.address_space_24);
for (i = 0; i<3; ++i) for (i = 0; i < 3; ++i)
{ {
if (changed_prefs.mbresmem_low_size == A3000LowMem_values[i]) if (changed_prefs.mbresmem_low_size == A3000LowMem_values[i])
{ {
@ -342,7 +346,7 @@ void RefreshPanelRAM()
} }
} }
for (i = 0; i<4; ++i) for (i = 0; i < 4; ++i)
{ {
if (changed_prefs.mbresmem_high_size == A3000HighMem_values[i]) if (changed_prefs.mbresmem_high_size == A3000HighMem_values[i])
{ {
@ -354,16 +358,19 @@ void RefreshPanelRAM()
} }
bool HelpPanelRAM(std::vector<std::string> &helptext) bool HelpPanelRAM(vector<string>& helptext)
{ {
helptext.clear(); helptext.clear();
helptext.push_back("Select the amount of RAM for each type you want to emulate in your Amiga."); helptext.push_back("Select the amount of RAM for each type you want to emulate in your Amiga.");
helptext.push_back("\"Slow\" is the simple memory extension of an Amiga 500."); helptext.push_back("\"Slow\" is the simple memory extension of an Amiga 500.");
helptext.push_back("\"Z2 Fast\" is real fast memory in 24 bit address space."); helptext.push_back("\"Z2 Fast\" is real fast memory in 24 bit address space.");
helptext.push_back("\"Z3 Fast\" is real fast memory in 32 bit address space and only available if a 32 bit CPU is selected."); helptext.push_back(
helptext.push_back("\"RTG board\" is the graphics memory used by Picasso96 and only available if a 32 bit CPU is selected. If you"); "\"Z3 Fast\" is real fast memory in 32 bit address space and only available if a 32 bit CPU is selected.");
helptext.push_back(
"\"RTG board\" is the graphics memory used by Picasso96 and only available if a 32 bit CPU is selected. If you");
helptext.push_back("select some memory for this type, the Z3 RTG board will be activated."); helptext.push_back("select some memory for this type, the Z3 RTG board will be activated.");
helptext.push_back("A4000 motherboard and processor board memory is only detected by the Amiga if you choose the correct"); helptext.push_back(
"A4000 motherboard and processor board memory is only detected by the Amiga if you choose the correct");
helptext.push_back("Kickstart ROM (A4000)."); helptext.push_back("Kickstart ROM (A4000).");
return true; return true;
} }