Show which BIOS file is currently selected.
It is not possible to pre-select a file with `wxFilePickerCtrl`. Hence, we add a label to show the current gopts.{gba_bios,gb_bios,gbc_bios} is being used, if any. - Fix remaining of #196.
This commit is contained in:
parent
76756ef916
commit
dbb5914fa4
|
@ -3405,10 +3405,10 @@ bool MainFrame::BindControls()
|
|||
} while (0)
|
||||
#define getcbie(n, o, v) getbie(n, o, v, cb, wxCheckBox, CB)
|
||||
wxFilePickerCtrl* fp;
|
||||
#define getfp(n, o) \
|
||||
do { \
|
||||
fp = SafeXRCCTRL<wxFilePickerCtrl>(d, n); \
|
||||
fp->SetValidator(wxFileDirPickerValidator(&o)); \
|
||||
#define getfp(n, o, l) \
|
||||
do { \
|
||||
fp = SafeXRCCTRL<wxFilePickerCtrl>(d, n); \
|
||||
fp->SetValidator(wxFileDirPickerValidator(&o, l)); \
|
||||
} while (0)
|
||||
d = LoadXRCropertySheetDialog("GameBoyConfig");
|
||||
{
|
||||
|
@ -3418,10 +3418,15 @@ bool MainFrame::BindControls()
|
|||
// in command handler. Plus making changes might require resizing
|
||||
// game area. Validation only here.
|
||||
SafeXRCCTRL<wxChoice>(d, "Borders");
|
||||
/// Boot ROM
|
||||
getfp("BootRom", gopts.gb_bios);
|
||||
/// GB Boot ROM
|
||||
wxStaticText *label = SafeXRCCTRL<wxStaticText>(d, "BiosFile");
|
||||
if (!gopts.gb_bios.empty()) label->SetLabel(gopts.gb_bios);
|
||||
getfp("BootRom", gopts.gb_bios, label);
|
||||
getlab("BootRomLab");
|
||||
getfp("CBootRom", gopts.gbc_bios);
|
||||
/// GBC
|
||||
wxStaticText *clabel = SafeXRCCTRL<wxStaticText>(d, "CBiosFile");
|
||||
if (!gopts.gbc_bios.empty()) clabel->SetLabel(gopts.gbc_bios);
|
||||
getfp("CBootRom", gopts.gbc_bios, clabel);
|
||||
getlab("CBootRomLab");
|
||||
/// Custom Colors
|
||||
//getcbi("Color", gbColorOption);
|
||||
|
@ -3492,7 +3497,9 @@ bool MainFrame::BindControls()
|
|||
wxCommandEventHandler(BatConfig_t::Detect),
|
||||
NULL, &BatConfigHandler);
|
||||
/// Boot ROM
|
||||
getfp("BootRom", gopts.gba_bios);
|
||||
wxStaticText *label = SafeXRCCTRL<wxStaticText>(d, "BiosFile");
|
||||
if (!gopts.gba_bios.empty()) label->SetLabel(gopts.gba_bios);
|
||||
getfp("BootRom", gopts.gba_bios, label);
|
||||
getlab("BootRomLab");
|
||||
/// Game Overrides
|
||||
getgbaw("GameSettings");
|
||||
|
|
|
@ -114,22 +114,26 @@ protected:
|
|||
bool* vptr;
|
||||
};
|
||||
|
||||
#include <wx/stattext.h>
|
||||
|
||||
// wxFilePickerCtrl/wxDirPickerCtrl copy-only vvalidator
|
||||
class wxFileDirPickerValidator : public wxValidator {
|
||||
public:
|
||||
wxFileDirPickerValidator(wxString* _vptr)
|
||||
wxFileDirPickerValidator(wxString* _vptr, wxStaticText* _label = NULL)
|
||||
: wxValidator()
|
||||
, vptr(_vptr)
|
||||
, vlabel(_label)
|
||||
{
|
||||
}
|
||||
wxFileDirPickerValidator(const wxFileDirPickerValidator& v)
|
||||
: wxValidator()
|
||||
, vptr(v.vptr)
|
||||
, vlabel(v.vlabel)
|
||||
{
|
||||
}
|
||||
wxObject* Clone() const
|
||||
{
|
||||
return new wxFileDirPickerValidator(vptr);
|
||||
return new wxFileDirPickerValidator(vptr, vlabel);
|
||||
}
|
||||
bool TransferToWindow();
|
||||
bool TransferFromWindow();
|
||||
|
@ -141,6 +145,7 @@ public:
|
|||
|
||||
protected:
|
||||
wxString* vptr;
|
||||
wxStaticText* vlabel;
|
||||
};
|
||||
|
||||
// color copy-only validator that supports either 32-bit or 16-bit color
|
||||
|
|
|
@ -230,6 +230,7 @@ bool wxFileDirPickerValidator::TransferFromWindow()
|
|||
|
||||
if (fp) {
|
||||
*vptr = fp->GetPath();
|
||||
if (vlabel) vlabel->SetLabel(*vptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -237,6 +238,7 @@ bool wxFileDirPickerValidator::TransferFromWindow()
|
|||
|
||||
if (dp) {
|
||||
*vptr = dp->GetPath();
|
||||
if (vlabel) vlabel->SetLabel(*vptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,6 +105,27 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<flag>wxALL|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxHORIZONTAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticText">
|
||||
<label>Current BIOS file :</label>
|
||||
</object>
|
||||
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticText" name="BiosFile">
|
||||
<label>(None)</label>
|
||||
</object>
|
||||
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<orient>wxVERTICAL</orient>
|
||||
</object>
|
||||
<flag>wxALL|wxEXPAND</flag>
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
<orient>wxHORIZONTAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticText" name="BootRomLab">
|
||||
<label>Boot _ROM file :</label>
|
||||
<label>GB Boot _ROM file :</label>
|
||||
</object>
|
||||
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
|
||||
<border>5</border>
|
||||
|
@ -121,6 +121,48 @@
|
|||
</object>
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<flag>wxALL|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxHORIZONTAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticText">
|
||||
<label>Current GB BIOS file :</label>
|
||||
</object>
|
||||
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticText" name="BiosFile">
|
||||
<label>(None)</label>
|
||||
</object>
|
||||
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<flag>wxALL|wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxHORIZONTAL</orient>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticText">
|
||||
<label>Current GBC BIOS file :</label>
|
||||
</object>
|
||||
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticText" name="CBiosFile">
|
||||
<label>(None)</label>
|
||||
</object>
|
||||
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
|
||||
<border>5</border>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<label>Boot ROM</label>
|
||||
|
|
Loading…
Reference in New Issue