WX: HiDPI: ISOProperties

And related ARCodeAddEdit/PatchAddEdit.

Change ISOFile to use wxImage instead of wxBitmap since bitmaps require
a screen context and banner images have a fixed resolution.
This commit is contained in:
EmptyChaos 2016-08-03 11:14:52 +00:00
parent 42b6ea4c81
commit 3b11581aff
7 changed files with 179 additions and 146 deletions

View File

@ -252,6 +252,9 @@ void CGameListCtrl::InitBitmaps()
InitBitmap(img_list, &m_EmuStateImageIndex, this, rating_bmp_size, 3, "rating3"); InitBitmap(img_list, &m_EmuStateImageIndex, this, rating_bmp_size, 3, "rating3");
InitBitmap(img_list, &m_EmuStateImageIndex, this, rating_bmp_size, 4, "rating4"); InitBitmap(img_list, &m_EmuStateImageIndex, this, rating_bmp_size, 4, "rating4");
InitBitmap(img_list, &m_EmuStateImageIndex, this, rating_bmp_size, 5, "rating5"); InitBitmap(img_list, &m_EmuStateImageIndex, this, rating_bmp_size, 5, "rating5");
m_utility_game_banners.resize(1);
InitBitmap(img_list, &m_utility_game_banners, this, size, 0, "nobanner");
} }
void CGameListCtrl::BrowseForDirectory() void CGameListCtrl::BrowseForDirectory()
@ -431,10 +434,14 @@ void CGameListCtrl::UpdateItemAtColumn(long _Index, int column)
} }
case COLUMN_BANNER: case COLUMN_BANNER:
{ {
int ImageIndex = -1; int ImageIndex = m_utility_game_banners[0]; // nobanner
if (rISOFile.GetBitmap().IsOk()) if (rISOFile.GetBannerImage().IsOk())
ImageIndex = GetImageList(wxIMAGE_LIST_SMALL)->Add(rISOFile.GetBitmap()); {
wxImageList* img_list = GetImageList(wxIMAGE_LIST_SMALL);
ImageIndex = img_list->Add(
WxUtils::ScaleImageToBitmap(rISOFile.GetBannerImage(), this, img_list->GetSize()));
}
SetItemColumnImage(_Index, COLUMN_BANNER, ImageIndex); SetItemColumnImage(_Index, COLUMN_BANNER, ImageIndex);
break; break;

View File

@ -70,6 +70,7 @@ private:
std::vector<int> m_FlagImageIndex; std::vector<int> m_FlagImageIndex;
std::vector<int> m_PlatformImageIndex; std::vector<int> m_PlatformImageIndex;
std::vector<int> m_EmuStateImageIndex; std::vector<int> m_EmuStateImageIndex;
std::vector<int> m_utility_game_banners;
std::vector<std::unique_ptr<GameListItem>> m_ISOFiles; std::vector<std::unique_ptr<GameListItem>> m_ISOFiles;
void ClearIsoFiles() { m_ISOFiles.clear(); } void ClearIsoFiles() { m_ISOFiles.clear(); }

View File

@ -38,9 +38,6 @@
static const u32 CACHE_REVISION = 0x127; // Last changed in PR 3309 static const u32 CACHE_REVISION = 0x127; // Last changed in PR 3309
#define DVD_BANNER_WIDTH 96
#define DVD_BANNER_HEIGHT 32
static std::string GetLanguageString(DiscIO::Language language, static std::string GetLanguageString(DiscIO::Language language,
std::map<DiscIO::Language, std::string> strings) std::map<DiscIO::Language, std::string> strings)
{ {
@ -165,13 +162,12 @@ GameListItem::GameListItem(const std::string& _rFileName,
// Volume banner. Typical for everything that isn't a DOL or ELF. // Volume banner. Typical for everything that isn't a DOL or ELF.
if (!m_pImage.empty()) if (!m_pImage.empty())
{ {
wxImage image(m_ImageWidth, m_ImageHeight, &m_pImage[0], true); // Need to make explicit copy as wxImage uses reference counting for copies combined with only
m_Bitmap = ScaleBanner(&image); // taking a pointer, not the content, when given a buffer to its constructor.
m_image.Create(m_ImageWidth, m_ImageHeight, false);
std::memcpy(m_image.GetData(), m_pImage.data(), m_pImage.size());
return; return;
} }
// Fallback in case no banner is available.
ReadPNGBanner(File::GetSysDirectory() + RESOURCES_DIR + DIR_SEP + "nobanner.png");
} }
GameListItem::~GameListItem() GameListItem::~GameListItem()
@ -277,22 +273,11 @@ bool GameListItem::ReadPNGBanner(const std::string& path)
return false; return false;
wxImage image(StrToWxStr(path), wxBITMAP_TYPE_PNG); wxImage image(StrToWxStr(path), wxBITMAP_TYPE_PNG);
m_Bitmap = ScaleBanner(&image); if (!image.IsOk())
return true; return false;
}
wxBitmap GameListItem::ScaleBanner(wxImage* image) m_image = image;
{ return true;
wxWindow* window = wxTheApp->GetTopWindow();
const double gui_scale = window->GetContentScaleFactor() * (window->FromDIP(1024) / 1024.0);
const double target_width = DVD_BANNER_WIDTH * gui_scale;
const double target_height = DVD_BANNER_HEIGHT * gui_scale;
const double banner_scale =
std::min(target_width / image->GetWidth(), target_height / image->GetHeight());
image->Rescale(image->GetWidth() * banner_scale, image->GetHeight() * banner_scale,
wxIMAGE_QUALITY_BICUBIC);
image->Resize(wxSize(target_width, target_height), wxPoint(), 0xFF, 0xFF, 0xFF);
return wxBitmap(*image, wxBITMAP_SCREEN_DEPTH, window->GetContentScaleFactor());
} }
std::string GameListItem::GetDescription(DiscIO::Language language) const std::string GameListItem::GetDescription(DiscIO::Language language) const

View File

@ -59,7 +59,9 @@ public:
// 0 is the first disc, 1 is the second disc // 0 is the first disc, 1 is the second disc
u8 GetDiscNumber() const { return m_disc_number; } u8 GetDiscNumber() const { return m_disc_number; }
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
const wxBitmap& GetBitmap() const { return m_Bitmap; } // NOTE: Banner image is at the original resolution, use WxUtils::ScaleImageToBitmap
// to display it
const wxImage& GetBannerImage() const { return m_image; }
#endif #endif
void DoState(PointerWrap& p); void DoState(PointerWrap& p);
@ -86,7 +88,7 @@ private:
u16 m_Revision; u16 m_Revision;
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
wxBitmap m_Bitmap; wxImage m_image;
#endif #endif
bool m_Valid; bool m_Valid;
std::vector<u8> m_pImage; std::vector<u8> m_pImage;
@ -107,6 +109,4 @@ private:
void ReadVolumeBanner(const std::vector<u32>& buffer, int width, int height); void ReadVolumeBanner(const std::vector<u32>& buffer, int width, int height);
// Outputs to m_Bitmap // Outputs to m_Bitmap
bool ReadPNGBanner(const std::string& path); bool ReadPNGBanner(const std::string& path);
static wxBitmap ScaleBanner(wxImage* image);
}; };

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <array>
#include <cinttypes> #include <cinttypes>
#include <cstddef> #include <cstddef>
#include <cstdio> #include <cstdio>
@ -33,7 +34,6 @@
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/progdlg.h> #include <wx/progdlg.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/slider.h>
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
#include <wx/statbmp.h> #include <wx/statbmp.h>
#include <wx/stattext.h> #include <wx/stattext.h>
@ -63,6 +63,7 @@
#include "DiscIO/VolumeCreator.h" #include "DiscIO/VolumeCreator.h"
#include "DolphinWX/Cheats/ActionReplayCodesPanel.h" #include "DolphinWX/Cheats/ActionReplayCodesPanel.h"
#include "DolphinWX/Cheats/GeckoCodeDiag.h" #include "DolphinWX/Cheats/GeckoCodeDiag.h"
#include "DolphinWX/DolphinSlider.h"
#include "DolphinWX/Frame.h" #include "DolphinWX/Frame.h"
#include "DolphinWX/Globals.h" #include "DolphinWX/Globals.h"
#include "DolphinWX/ISOFile.h" #include "DolphinWX/ISOFile.h"
@ -110,6 +111,9 @@ private:
void CreateGUI() void CreateGUI()
{ {
int space10 = FromDIP(10);
int space15 = FromDIP(15);
wxStaticBitmap* icon = wxStaticBitmap* icon =
new wxStaticBitmap(this, wxID_ANY, wxArtProvider::GetMessageBoxIcon(wxICON_WARNING)); new wxStaticBitmap(this, wxID_ANY, wxArtProvider::GetMessageBoxIcon(wxICON_WARNING));
m_message = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_message = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
@ -119,10 +123,10 @@ private:
m_btn_configure->Bind(wxEVT_BUTTON, &CheatWarningMessage::OnConfigureClicked, this); m_btn_configure->Bind(wxEVT_BUTTON, &CheatWarningMessage::OnConfigureClicked, this);
wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(icon, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 15); sizer->Add(icon, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, space15);
sizer->Add(m_message, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, 15); sizer->Add(m_message, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, space15);
sizer->Add(m_btn_configure, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10); sizer->Add(m_btn_configure, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, space10);
sizer->AddSpacer(10); sizer->AddSpacer(space10);
SetSizer(sizer); SetSizer(sizer);
} }
@ -286,8 +290,17 @@ CISOProperties::CISOProperties(const GameListItem& game_list_item, wxWindow* par
bool wii = m_open_iso->GetVolumeType() != DiscIO::Platform::GAMECUBE_DISC; bool wii = m_open_iso->GetVolumeType() != DiscIO::Platform::GAMECUBE_DISC;
ChangeBannerDetails(SConfig::GetInstance().GetCurrentLanguage(wii)); ChangeBannerDetails(SConfig::GetInstance().GetCurrentLanguage(wii));
m_Banner->SetBitmap(OpenGameListItem.GetBitmap()); if (OpenGameListItem.GetBannerImage().IsOk())
{
m_Banner->SetBitmap(WxUtils::ScaleImageToBitmap(OpenGameListItem.GetBannerImage(), this,
m_Banner->GetMinSize()));
m_Banner->Bind(wxEVT_RIGHT_DOWN, &CISOProperties::RightClickOnBanner, this); m_Banner->Bind(wxEVT_RIGHT_DOWN, &CISOProperties::RightClickOnBanner, this);
}
else
{
m_Banner->SetBitmap(
WxUtils::LoadScaledResourceBitmap("nobanner", this, m_Banner->GetMinSize()));
}
// Filesystem browser/dumper // Filesystem browser/dumper
// TODO : Should we add a way to browse the wad file ? // TODO : Should we add a way to browse the wad file ?
@ -410,6 +423,9 @@ long CISOProperties::GetElementStyle(const char* section, const char* key)
void CISOProperties::CreateGUIControls() void CISOProperties::CreateGUIControls()
{ {
const int space5 = FromDIP(5);
const int space10 = FromDIP(10);
wxButton* const EditConfig = new wxButton(this, ID_EDITCONFIG, _("Edit Config")); wxButton* const EditConfig = new wxButton(this, ID_EDITCONFIG, _("Edit Config"));
EditConfig->SetToolTip(_("This will let you manually edit the INI config file.")); EditConfig->SetToolTip(_("This will let you manually edit the INI config file."));
@ -473,8 +489,8 @@ void CISOProperties::CreateGUIControls()
arrayStringFor_GPUDeterminism.Add(_("fake-completion")); arrayStringFor_GPUDeterminism.Add(_("fake-completion"));
GPUDeterminism = new wxChoice(m_GameConfig, ID_GPUDETERMINISM, wxDefaultPosition, wxDefaultSize, GPUDeterminism = new wxChoice(m_GameConfig, ID_GPUDETERMINISM, wxDefaultPosition, wxDefaultSize,
arrayStringFor_GPUDeterminism); arrayStringFor_GPUDeterminism);
sGPUDeterminism->Add(GPUDeterminismText); sGPUDeterminism->Add(GPUDeterminismText, 0, wxALIGN_CENTER_VERTICAL);
sGPUDeterminism->Add(GPUDeterminism); sGPUDeterminism->Add(GPUDeterminism, 0, wxALIGN_CENTER_VERTICAL);
// Wii Console // Wii Console
EnableWideScreen = EnableWideScreen =
@ -485,7 +501,7 @@ void CISOProperties::CreateGUIControls()
wxBoxSizer* const sDepthPercentage = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* const sDepthPercentage = new wxBoxSizer(wxHORIZONTAL);
wxStaticText* const DepthPercentageText = wxStaticText* const DepthPercentageText =
new wxStaticText(m_GameConfig, wxID_ANY, _("Depth Percentage: ")); new wxStaticText(m_GameConfig, wxID_ANY, _("Depth Percentage: "));
DepthPercentage = new wxSlider(m_GameConfig, ID_DEPTHPERCENTAGE, 100, 0, 200); DepthPercentage = new DolphinSlider(m_GameConfig, ID_DEPTHPERCENTAGE, 100, 0, 200);
DepthPercentage->SetToolTip( DepthPercentage->SetToolTip(
_("This value is multiplied with the depth set in the graphics configuration.")); _("This value is multiplied with the depth set in the graphics configuration."));
sDepthPercentage->Add(DepthPercentageText); sDepthPercentage->Add(DepthPercentageText);
@ -518,19 +534,23 @@ void CISOProperties::CreateGUIControls()
EmuState = new wxChoice(m_GameConfig, ID_EMUSTATE, wxDefaultPosition, wxDefaultSize, EmuState = new wxChoice(m_GameConfig, ID_EMUSTATE, wxDefaultPosition, wxDefaultSize,
arrayStringFor_EmuState); arrayStringFor_EmuState);
EmuIssues = new wxTextCtrl(m_GameConfig, ID_EMU_ISSUES, wxEmptyString); EmuIssues = new wxTextCtrl(m_GameConfig, ID_EMU_ISSUES, wxEmptyString);
sEmuState->Add(EmuStateText, 0, wxALIGN_CENTER_VERTICAL);
sEmuState->Add(EmuState, 0, wxALIGN_CENTER_VERTICAL);
sEmuState->Add(EmuIssues, 1, wxEXPAND);
wxBoxSizer* const sConfigPage = new wxBoxSizer(wxVERTICAL);
wxStaticBoxSizer* const sbCoreOverrides = wxStaticBoxSizer* const sbCoreOverrides =
new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Core")); new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Core"));
sbCoreOverrides->Add(CPUThread, 0, wxLEFT, 5); sbCoreOverrides->Add(CPUThread, 0, wxLEFT | wxRIGHT, space5);
sbCoreOverrides->Add(SkipIdle, 0, wxLEFT, 5); sbCoreOverrides->Add(SkipIdle, 0, wxLEFT | wxRIGHT, space5);
sbCoreOverrides->Add(MMU, 0, wxLEFT, 5); sbCoreOverrides->Add(MMU, 0, wxLEFT | wxRIGHT, space5);
sbCoreOverrides->Add(DCBZOFF, 0, wxLEFT, 5); sbCoreOverrides->Add(DCBZOFF, 0, wxLEFT | wxRIGHT, space5);
sbCoreOverrides->Add(FPRF, 0, wxLEFT, 5); sbCoreOverrides->Add(FPRF, 0, wxLEFT | wxRIGHT, space5);
sbCoreOverrides->Add(SyncGPU, 0, wxLEFT, 5); sbCoreOverrides->Add(SyncGPU, 0, wxLEFT | wxRIGHT, space5);
sbCoreOverrides->Add(FastDiscSpeed, 0, wxLEFT, 5); sbCoreOverrides->Add(FastDiscSpeed, 0, wxLEFT | wxRIGHT, space5);
sbCoreOverrides->Add(DSPHLE, 0, wxLEFT, 5); sbCoreOverrides->Add(DSPHLE, 0, wxLEFT | wxRIGHT, space5);
sbCoreOverrides->Add(sGPUDeterminism, 0, wxEXPAND | wxALL, 5); sbCoreOverrides->AddSpacer(space5);
sbCoreOverrides->Add(sGPUDeterminism, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sbCoreOverrides->AddSpacer(space5);
wxStaticBoxSizer* const sbWiiOverrides = wxStaticBoxSizer* const sbWiiOverrides =
new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Wii Console")); new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Wii Console"));
@ -539,7 +559,7 @@ void CISOProperties::CreateGUIControls()
sbWiiOverrides->ShowItems(false); sbWiiOverrides->ShowItems(false);
EnableWideScreen->Hide(); EnableWideScreen->Hide();
} }
sbWiiOverrides->Add(EnableWideScreen, 0, wxLEFT, 5); sbWiiOverrides->Add(EnableWideScreen, 0, wxLEFT, space5);
wxStaticBoxSizer* const sbStereoOverrides = wxStaticBoxSizer* const sbStereoOverrides =
new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Stereoscopy")); new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Stereoscopy"));
@ -549,15 +569,19 @@ void CISOProperties::CreateGUIControls()
wxStaticBoxSizer* const sbGameConfig = wxStaticBoxSizer* const sbGameConfig =
new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Game-Specific Settings")); new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Game-Specific Settings"));
sbGameConfig->Add(OverrideText, 0, wxEXPAND | wxALL, 5); sbGameConfig->AddSpacer(space5);
sbGameConfig->Add(OverrideText, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sbGameConfig->AddSpacer(space5);
sbGameConfig->Add(sbCoreOverrides, 0, wxEXPAND); sbGameConfig->Add(sbCoreOverrides, 0, wxEXPAND);
sbGameConfig->Add(sbWiiOverrides, 0, wxEXPAND); sbGameConfig->Add(sbWiiOverrides, 0, wxEXPAND);
sbGameConfig->Add(sbStereoOverrides, 0, wxEXPAND); sbGameConfig->Add(sbStereoOverrides, 0, wxEXPAND);
sConfigPage->Add(sbGameConfig, 0, wxEXPAND | wxALL, 5);
sEmuState->Add(EmuStateText, 0, wxALIGN_CENTER_VERTICAL); wxBoxSizer* const sConfigPage = new wxBoxSizer(wxVERTICAL);
sEmuState->Add(EmuState, 0, wxEXPAND); sConfigPage->AddSpacer(space5);
sEmuState->Add(EmuIssues, 1, wxEXPAND); sConfigPage->Add(sbGameConfig, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sConfigPage->Add(sEmuState, 0, wxEXPAND | wxALL, 5); sConfigPage->AddSpacer(space5);
sConfigPage->Add(sEmuState, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sConfigPage->AddSpacer(space5);
m_GameConfig->SetSizer(sConfigPage); m_GameConfig->SetSizer(sConfigPage);
// Patches // Patches
@ -572,13 +596,15 @@ void CISOProperties::CreateGUIControls()
RemovePatch->Disable(); RemovePatch->Disable();
wxBoxSizer* sPatchPage = new wxBoxSizer(wxVERTICAL); wxBoxSizer* sPatchPage = new wxBoxSizer(wxVERTICAL);
sPatches->Add(Patches, 1, wxEXPAND | wxALL, 0); sPatches->Add(Patches, 1, wxEXPAND);
sPatchButtons->Add(EditPatch, 0, wxEXPAND | wxALL, 0); sPatchButtons->Add(EditPatch, 0, wxEXPAND);
sPatchButtons->AddStretchSpacer(); sPatchButtons->AddStretchSpacer();
sPatchButtons->Add(AddPatch, 0, wxEXPAND | wxALL, 0); sPatchButtons->Add(AddPatch, 0, wxEXPAND);
sPatchButtons->Add(RemovePatch, 0, wxEXPAND | wxALL, 0); sPatchButtons->Add(RemovePatch, 0, wxEXPAND);
sPatches->Add(sPatchButtons, 0, wxEXPAND | wxALL, 0); sPatches->Add(sPatchButtons, 0, wxEXPAND);
sPatchPage->Add(sPatches, 1, wxEXPAND | wxALL, 5); sPatchPage->AddSpacer(space5);
sPatchPage->Add(sPatches, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
sPatchPage->AddSpacer(space5);
m_PatchPage->SetSizer(sPatchPage); m_PatchPage->SetSizer(sPatchPage);
// Action Replay Cheats // Action Replay Cheats
@ -589,8 +615,8 @@ void CISOProperties::CreateGUIControls()
m_ar_code_panel->Bind(DOLPHIN_EVT_ARCODE_TOGGLED, &CISOProperties::OnCheatCodeToggled, this); m_ar_code_panel->Bind(DOLPHIN_EVT_ARCODE_TOGGLED, &CISOProperties::OnCheatCodeToggled, this);
wxBoxSizer* const sCheatPage = new wxBoxSizer(wxVERTICAL); wxBoxSizer* const sCheatPage = new wxBoxSizer(wxVERTICAL);
sCheatPage->Add(m_cheats_disabled_ar, 0, wxEXPAND | wxTOP, 5); sCheatPage->Add(m_cheats_disabled_ar, 0, wxEXPAND | wxTOP, space5);
sCheatPage->Add(m_ar_code_panel, 1, wxEXPAND | wxALL, 5); sCheatPage->Add(m_ar_code_panel, 1, wxEXPAND | wxALL, space5);
m_CheatPage->SetSizer(sCheatPage); m_CheatPage->SetSizer(sCheatPage);
// Gecko Cheats // Gecko Cheats
@ -600,7 +626,7 @@ void CISOProperties::CreateGUIControls()
m_geckocode_panel->Bind(DOLPHIN_EVT_GECKOCODE_TOGGLED, &CISOProperties::OnCheatCodeToggled, this); m_geckocode_panel->Bind(DOLPHIN_EVT_GECKOCODE_TOGGLED, &CISOProperties::OnCheatCodeToggled, this);
wxBoxSizer* gecko_layout = new wxBoxSizer(wxVERTICAL); wxBoxSizer* gecko_layout = new wxBoxSizer(wxVERTICAL);
gecko_layout->Add(m_cheats_disabled_gecko, 0, wxEXPAND | wxTOP, 5); gecko_layout->Add(m_cheats_disabled_gecko, 0, wxEXPAND | wxTOP, space5);
gecko_layout->Add(m_geckocode_panel, 1, wxEXPAND); gecko_layout->Add(m_geckocode_panel, 1, wxEXPAND);
gecko_cheat_page->SetSizer(gecko_layout); gecko_cheat_page->SetSizer(gecko_layout);
@ -698,67 +724,63 @@ void CISOProperties::CreateGUIControls()
m_Comment = new wxTextCtrl(m_Information, ID_COMMENT, wxEmptyString, wxDefaultPosition, m_Comment = new wxTextCtrl(m_Information, ID_COMMENT, wxEmptyString, wxDefaultPosition,
wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY); wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY);
wxStaticText* const m_BannerText = new wxStaticText(m_Information, wxID_ANY, _("Banner:")); wxStaticText* const m_BannerText = new wxStaticText(m_Information, wxID_ANY, _("Banner:"));
m_Banner = m_Banner = new wxStaticBitmap(m_Information, ID_BANNER, wxNullBitmap, wxDefaultPosition,
new wxStaticBitmap(m_Information, ID_BANNER, wxNullBitmap, wxDefaultPosition, wxSize(96, 32)); FromDIP(wxSize(96, 32)));
// ISO Details // ISO Details
wxGridBagSizer* const sISODetails = new wxGridBagSizer(0, 0); wxGridBagSizer* const sISODetails = new wxGridBagSizer(space10, space10);
sISODetails->Add(m_InternalNameText, wxGBPosition(0, 0), wxGBSpan(1, 1), sISODetails->Add(m_InternalNameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL);
wxALIGN_CENTER_VERTICAL | wxALL, 5); sISODetails->Add(m_InternalName, wxGBPosition(0, 1), wxGBSpan(1, 2), wxEXPAND);
sISODetails->Add(m_InternalName, wxGBPosition(0, 1), wxGBSpan(1, 2), wxEXPAND | wxALL, 5); sISODetails->Add(m_GameIDText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL);
sISODetails->Add(m_GameIDText, wxGBPosition(1, 0), wxGBSpan(1, 1), sISODetails->Add(m_GameID, wxGBPosition(1, 1), wxGBSpan(1, 2), wxEXPAND);
wxALIGN_CENTER_VERTICAL | wxALL, 5); sISODetails->Add(m_CountryText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL);
sISODetails->Add(m_GameID, wxGBPosition(1, 1), wxGBSpan(1, 2), wxEXPAND | wxALL, 5); sISODetails->Add(m_Country, wxGBPosition(2, 1), wxGBSpan(1, 2), wxEXPAND);
sISODetails->Add(m_CountryText, wxGBPosition(2, 0), wxGBSpan(1, 1), sISODetails->Add(m_MakerIDText, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL);
wxALIGN_CENTER_VERTICAL | wxALL, 5); sISODetails->Add(m_MakerID, wxGBPosition(3, 1), wxGBSpan(1, 2), wxEXPAND);
sISODetails->Add(m_Country, wxGBPosition(2, 1), wxGBSpan(1, 2), wxEXPAND | wxALL, 5); sISODetails->Add(m_RevisionText, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL);
sISODetails->Add(m_MakerIDText, wxGBPosition(3, 0), wxGBSpan(1, 1), sISODetails->Add(m_Revision, wxGBPosition(4, 1), wxGBSpan(1, 2), wxEXPAND);
wxALIGN_CENTER_VERTICAL | wxALL, 5); sISODetails->Add(m_DateText, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL);
sISODetails->Add(m_MakerID, wxGBPosition(3, 1), wxGBSpan(1, 2), wxEXPAND | wxALL, 5); sISODetails->Add(m_Date, wxGBPosition(5, 1), wxGBSpan(1, 2), wxEXPAND);
sISODetails->Add(m_RevisionText, wxGBPosition(4, 0), wxGBSpan(1, 1), sISODetails->Add(m_FSTText, wxGBPosition(6, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL);
wxALIGN_CENTER_VERTICAL | wxALL, 5); sISODetails->Add(m_FST, wxGBPosition(6, 1), wxGBSpan(1, 2), wxEXPAND);
sISODetails->Add(m_Revision, wxGBPosition(4, 1), wxGBSpan(1, 2), wxEXPAND | wxALL, 5); sISODetails->Add(m_MD5SumText, wxGBPosition(7, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL);
sISODetails->Add(m_DateText, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, sISODetails->Add(m_MD5Sum, wxGBPosition(7, 1), wxGBSpan(1, 1), wxEXPAND);
5); sISODetails->Add(m_MD5SumCompute, wxGBPosition(7, 2), wxGBSpan(1, 1), wxEXPAND);
sISODetails->Add(m_Date, wxGBPosition(5, 1), wxGBSpan(1, 2), wxEXPAND | wxALL, 5);
sISODetails->Add(m_FSTText, wxGBPosition(6, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL,
5);
sISODetails->Add(m_FST, wxGBPosition(6, 1), wxGBSpan(1, 2), wxEXPAND | wxALL, 5);
sISODetails->Add(m_MD5SumText, wxGBPosition(7, 0), wxGBSpan(1, 1),
wxALIGN_CENTER_VERTICAL | wxALL, 5);
sISODetails->Add(m_MD5Sum, wxGBPosition(7, 1), wxGBSpan(1, 1), wxEXPAND | wxALL, 5);
wxSizer* sMD5SumButtonSizer = CreateButtonSizer(wxNO_DEFAULT);
sMD5SumButtonSizer->Add(m_MD5SumCompute);
sISODetails->Add(sMD5SumButtonSizer, wxGBPosition(7, 2), wxGBSpan(1, 1), wxEXPAND | wxALL, 5);
sISODetails->AddGrowableCol(1); sISODetails->AddGrowableCol(1);
wxStaticBoxSizer* const sbISODetails = wxStaticBoxSizer* const sbISODetails =
new wxStaticBoxSizer(wxVERTICAL, m_Information, _("ISO Details")); new wxStaticBoxSizer(wxVERTICAL, m_Information, _("ISO Details"));
sbISODetails->Add(sISODetails, 0, wxEXPAND, 5); sbISODetails->AddSpacer(space5);
sbISODetails->Add(sISODetails, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sbISODetails->AddSpacer(space5);
// Banner Details // Banner Details
wxGridBagSizer* const sBannerDetails = new wxGridBagSizer(0, 0); wxGridBagSizer* const sBannerDetails = new wxGridBagSizer(space10, space10);
sBannerDetails->Add(m_LangText, wxGBPosition(0, 0), wxGBSpan(1, 1), sBannerDetails->Add(m_LangText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL);
wxALIGN_CENTER_VERTICAL | wxALL, 5); // Comboboxes cannot be safely stretched vertically on Windows.
sBannerDetails->Add(m_Lang, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND | wxALL, 5); sBannerDetails->Add(WxUtils::GiveMinSize(m_Lang, wxDefaultSize), wxGBPosition(0, 1),
sBannerDetails->Add(m_NameText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxGBSpan(1, 1), wxEXPAND);
wxALIGN_CENTER_VERTICAL | wxALL, 5); sBannerDetails->Add(m_NameText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL);
sBannerDetails->Add(m_Name, wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND | wxALL, 5); sBannerDetails->Add(m_Name, wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND);
sBannerDetails->Add(m_MakerText, wxGBPosition(2, 0), wxGBSpan(1, 1), sBannerDetails->Add(m_MakerText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL);
wxALIGN_CENTER_VERTICAL | wxALL, 5); sBannerDetails->Add(m_Maker, wxGBPosition(2, 1), wxGBSpan(1, 1), wxEXPAND);
sBannerDetails->Add(m_Maker, wxGBPosition(2, 1), wxGBSpan(1, 1), wxEXPAND | wxALL, 5); sBannerDetails->Add(m_CommentText, wxGBPosition(3, 0), wxGBSpan(1, 1));
sBannerDetails->Add(m_CommentText, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALL, 5); sBannerDetails->Add(m_Comment, wxGBPosition(3, 1), wxGBSpan(1, 1), wxEXPAND);
sBannerDetails->Add(m_Comment, wxGBPosition(3, 1), wxGBSpan(1, 1), wxEXPAND | wxALL, 5); sBannerDetails->Add(m_BannerText, wxGBPosition(4, 0), wxGBSpan(1, 1));
sBannerDetails->Add(m_BannerText, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALL, 5); sBannerDetails->Add(m_Banner, wxGBPosition(4, 1), wxGBSpan(1, 1), wxEXPAND);
sBannerDetails->Add(m_Banner, wxGBPosition(4, 1), wxGBSpan(1, 1), wxEXPAND | wxALL, 5);
sBannerDetails->AddGrowableCol(1); sBannerDetails->AddGrowableCol(1);
wxStaticBoxSizer* const sbBannerDetails = wxStaticBoxSizer* const sbBannerDetails =
new wxStaticBoxSizer(wxVERTICAL, m_Information, _("Banner Details")); new wxStaticBoxSizer(wxVERTICAL, m_Information, _("Banner Details"));
sbBannerDetails->Add(sBannerDetails, 0, wxEXPAND, 5); sbBannerDetails->AddSpacer(space5);
sbBannerDetails->Add(sBannerDetails, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sbBannerDetails->AddSpacer(space5);
wxBoxSizer* const sInfoPage = new wxBoxSizer(wxVERTICAL); wxBoxSizer* const sInfoPage = new wxBoxSizer(wxVERTICAL);
sInfoPage->Add(sbISODetails, 0, wxEXPAND | wxALL, 5); sInfoPage->AddSpacer(space5);
sInfoPage->Add(sbBannerDetails, 0, wxEXPAND | wxALL, 5); sInfoPage->Add(sbISODetails, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sInfoPage->AddSpacer(space5);
sInfoPage->Add(sbBannerDetails, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sInfoPage->AddSpacer(space5);
m_Information->SetSizer(sInfoPage); m_Information->SetSizer(sInfoPage);
if (m_open_iso->GetVolumeType() != DiscIO::Platform::WII_WAD) if (m_open_iso->GetVolumeType() != DiscIO::Platform::WII_WAD)
@ -767,10 +789,14 @@ void CISOProperties::CreateGUIControls()
m_Notebook->AddPage(filesystem_panel, _("Filesystem")); m_Notebook->AddPage(filesystem_panel, _("Filesystem"));
// Filesystem icons // Filesystem icons
wxImageList* const m_iconList = new wxImageList(16, 16); wxSize icon_size = FromDIP(wxSize(16, 16));
m_iconList->Add(WxUtils::LoadResourceBitmap("isoproperties_disc")); // 0 wxImageList* const m_iconList = new wxImageList(icon_size.GetWidth(), icon_size.GetHeight());
m_iconList->Add(WxUtils::LoadResourceBitmap("isoproperties_folder")); // 1 static const std::array<const char* const, 3> s_icon_names{
m_iconList->Add(WxUtils::LoadResourceBitmap("isoproperties_file")); // 2 {"isoproperties_disc", "isoproperties_folder", "isoproperties_file"}};
for (const auto& name : s_icon_names)
m_iconList->Add(
WxUtils::LoadScaledResourceBitmap(name, this, icon_size, wxDefaultSize,
WxUtils::LSI_SCALE_DOWN | WxUtils::LSI_ALIGN_CENTER));
// Filesystem tree // Filesystem tree
m_Treectrl = new wxTreeCtrl(filesystem_panel, ID_TREECTRL); m_Treectrl = new wxTreeCtrl(filesystem_panel, ID_TREECTRL);
@ -778,14 +804,16 @@ void CISOProperties::CreateGUIControls()
RootId = m_Treectrl->AddRoot(_("Disc"), 0, 0, nullptr); RootId = m_Treectrl->AddRoot(_("Disc"), 0, 0, nullptr);
wxBoxSizer* sTreePage = new wxBoxSizer(wxVERTICAL); wxBoxSizer* sTreePage = new wxBoxSizer(wxVERTICAL);
sTreePage->Add(m_Treectrl, 1, wxEXPAND | wxALL, 5); sTreePage->AddSpacer(space5);
sTreePage->Add(m_Treectrl, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
sTreePage->AddSpacer(space5);
filesystem_panel->SetSizer(sTreePage); filesystem_panel->SetSizer(sTreePage);
} }
wxSizer* sButtons = CreateButtonSizer(wxNO_DEFAULT); wxStdDialogButtonSizer* sButtons = CreateStdDialogButtonSizer(wxOK | wxNO_DEFAULT);
sButtons->Prepend(EditConfigDefault); sButtons->Prepend(EditConfigDefault);
sButtons->Prepend(EditConfig); sButtons->Prepend(EditConfig);
sButtons->Add(new wxButton(this, wxID_OK, _("Close"))); sButtons->GetAffirmativeButton()->SetLabel(_("Close"));
// If there is no default gameini, disable the button. // If there is no default gameini, disable the button.
bool game_ini_exists = false; bool game_ini_exists = false;
@ -803,10 +831,15 @@ void CISOProperties::CreateGUIControls()
// Add notebook and buttons to the dialog // Add notebook and buttons to the dialog
wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL); wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL);
sMain->Add(m_Notebook, 1, wxEXPAND | wxALL, 5); sMain->AddSpacer(space5);
sMain->Add(sButtons, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); sMain->Add(m_Notebook, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
sMain->SetMinSize(wxSize(500, -1)); sMain->AddSpacer(space5);
sMain->Add(sButtons, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sMain->AddSpacer(space5);
sMain->SetMinSize(FromDIP(wxSize(500, -1)));
SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
SetLayoutAdaptationLevel(wxDIALOG_ADAPTATION_STANDARD_SIZER);
SetSizerAndFit(sMain); SetSizerAndFit(sMain);
Center(); Center();
SetFocus(); SetFocus();
@ -842,7 +875,7 @@ void CISOProperties::OnBannerImageSave(wxCommandEvent& WXUNUSED(event))
wxFD_SAVE | wxFD_OVERWRITE_PROMPT); wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
if (dialog.ShowModal() == wxID_OK) if (dialog.ShowModal() == wxID_OK)
{ {
m_Banner->GetBitmap().ConvertToImage().SaveFile(dialog.GetPath()); OpenGameListItem.GetBannerImage().SaveFile(dialog.GetPath());
} }
Raise(); Raise();
} }

View File

@ -19,11 +19,11 @@
#include "DolphinWX/ISOFile.h" #include "DolphinWX/ISOFile.h"
#include "DolphinWX/PatchAddEdit.h" #include "DolphinWX/PatchAddEdit.h"
class DolphinSlider;
class wxButton; class wxButton;
class wxCheckBox; class wxCheckBox;
class wxCheckListBox; class wxCheckListBox;
class wxChoice; class wxChoice;
class wxSlider;
class wxSpinCtrl; class wxSpinCtrl;
class wxStaticBitmap; class wxStaticBitmap;
class wxTextCtrl; class wxTextCtrl;
@ -90,7 +90,7 @@ private:
wxCheckBox* EnableWideScreen; wxCheckBox* EnableWideScreen;
// Stereoscopy // Stereoscopy
wxSlider* DepthPercentage; DolphinSlider* DepthPercentage;
wxSpinCtrl* Convergence; wxSpinCtrl* Convergence;
wxCheckBox* MonoDepth; wxCheckBox* MonoDepth;

View File

@ -52,7 +52,8 @@ void CPatchAddEdit::CreateGUIControls(int _selection)
itCurEntry = tempEntries.begin(); itCurEntry = tempEntries.begin();
wxBoxSizer* sEditPatch = new wxBoxSizer(wxVERTICAL); const int space5 = FromDIP(5);
const int space10 = FromDIP(10);
wxStaticText* EditPatchNameText = new wxStaticText(this, wxID_ANY, _("Name:")); wxStaticText* EditPatchNameText = new wxStaticText(this, wxID_ANY, _("Name:"));
EditPatchName = new wxTextCtrl(this, wxID_ANY); EditPatchName = new wxTextCtrl(this, wxID_ANY);
@ -89,32 +90,38 @@ void CPatchAddEdit::CreateGUIControls(int _selection)
EntryRemove->Disable(); EntryRemove->Disable();
wxBoxSizer* sEditPatchName = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* sEditPatchName = new wxBoxSizer(wxHORIZONTAL);
sEditPatchName->Add(EditPatchNameText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); sEditPatchName->Add(EditPatchNameText, 0, wxALIGN_CENTER_VERTICAL);
sEditPatchName->Add(EditPatchName, 1, wxEXPAND | wxALL, 5); sEditPatchName->Add(EditPatchName, 1, wxEXPAND | wxLEFT, space5);
sEditPatch->Add(sEditPatchName, 0, wxEXPAND);
sbEntry = new wxStaticBoxSizer(wxVERTICAL, this, sbEntry = new wxStaticBoxSizer(wxVERTICAL, this,
wxString::Format(_("Entry 1/%d"), (int)tempEntries.size())); wxString::Format(_("Entry 1/%d"), (int)tempEntries.size()));
currentItem = 1; currentItem = 1;
wxGridBagSizer* sgEntry = new wxGridBagSizer(0, 0); wxGridBagSizer* sgEntry = new wxGridBagSizer(space10, space10);
sgEntry->Add(EditPatchType, wxGBPosition(0, 0), wxGBSpan(1, 2), wxEXPAND | wxALL, 5); sgEntry->Add(EditPatchType, wxGBPosition(0, 0), wxGBSpan(1, 2), wxEXPAND);
sgEntry->Add(EditPatchOffsetText, wxGBPosition(1, 0), wxGBSpan(1, 1), sgEntry->Add(EditPatchOffsetText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL);
wxALIGN_CENTER_VERTICAL | wxALL, 5); sgEntry->Add(EditPatchOffset, wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND);
sgEntry->Add(EditPatchOffset, wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND | wxALL, 5); sgEntry->Add(EditPatchValueText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL);
sgEntry->Add(EditPatchValueText, wxGBPosition(2, 0), wxGBSpan(1, 1), sgEntry->Add(EditPatchValue, wxGBPosition(2, 1), wxGBSpan(1, 1), wxEXPAND);
wxALIGN_CENTER_VERTICAL | wxALL, 5); sgEntry->Add(EntrySelection, wxGBPosition(0, 2), wxGBSpan(3, 1), wxEXPAND);
sgEntry->Add(EditPatchValue, wxGBPosition(2, 1), wxGBSpan(1, 1), wxEXPAND | wxALL, 5);
sgEntry->Add(EntrySelection, wxGBPosition(0, 2), wxGBSpan(3, 1), wxEXPAND | wxALL, 5);
sgEntry->AddGrowableCol(1); sgEntry->AddGrowableCol(1);
wxBoxSizer* sEntryAddRemove = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* sEntryAddRemove = new wxBoxSizer(wxHORIZONTAL);
sEntryAddRemove->Add(EntryAdd, 0, wxALL, 5); sEntryAddRemove->Add(EntryAdd, 0, wxALIGN_CENTER_VERTICAL);
sEntryAddRemove->Add(EntryRemove, 0, wxALL, 5); sEntryAddRemove->Add(EntryRemove, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, space5);
sbEntry->Add(sgEntry, 0, wxEXPAND); sbEntry->AddSpacer(space5);
sbEntry->Add(sEntryAddRemove, 0, wxEXPAND); sbEntry->Add(sgEntry, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sbEntry->AddSpacer(space5);
sbEntry->Add(sEntryAddRemove, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sbEntry->AddSpacer(space5);
sEditPatch->Add(sbEntry, 0, wxEXPAND | wxALL, 5); wxBoxSizer* sEditPatch = new wxBoxSizer(wxVERTICAL);
sEditPatch->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); sEditPatch->AddSpacer(space5);
sEditPatch->Add(sEditPatchName, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sEditPatch->AddSpacer(space5);
sEditPatch->Add(sbEntry, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sEditPatch->AddSpacer(space5);
sEditPatch->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
sEditPatch->AddSpacer(space5);
SetSizerAndFit(sEditPatch); SetSizerAndFit(sEditPatch);
SetFocus(); SetFocus();
} }