From 99cd5c0e9b690b455d05c46776161ef6571f9ee0 Mon Sep 17 00:00:00 2001 From: marco-calautti Date: Thu, 4 Jan 2024 13:21:13 +0100 Subject: [PATCH 1/7] Add support for high DPI on Windows --- app/CMakeLists.txt | 2 ++ app/win_stuff/DeltaPatcher.exe.manifest | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 app/win_stuff/DeltaPatcher.exe.manifest diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 877d838..c815f47 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -5,9 +5,11 @@ FILE(GLOB_RECURSE SOURCES src/*.cpp) if (WIN32) ENABLE_LANGUAGE(RC) set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/win_stuff/resource.rc ${SOURCES}) + set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/win_stuff/DeltaPatcher.exe.manifest ${SOURCES}) endif() add_executable(DeltaPatcher WIN32 ${SOURCES}) + target_link_libraries(DeltaPatcher wx::core wx::base xdelta3) if (APPLE) diff --git a/app/win_stuff/DeltaPatcher.exe.manifest b/app/win_stuff/DeltaPatcher.exe.manifest new file mode 100644 index 0000000..f2708ec --- /dev/null +++ b/app/win_stuff/DeltaPatcher.exe.manifest @@ -0,0 +1,9 @@ + + + + + true + PerMonitorV2 + + + From b5766f37fda2a3d99e3db0e1d61564f850f0111a Mon Sep 17 00:00:00 2001 From: marco-calautti Date: Thu, 4 Jan 2024 13:25:05 +0100 Subject: [PATCH 2/7] Also add high DPI support on mac --- app/mac_stuff/Info.plist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/mac_stuff/Info.plist b/app/mac_stuff/Info.plist index 0faf3f0..7442976 100644 --- a/app/mac_stuff/Info.plist +++ b/app/mac_stuff/Info.plist @@ -26,6 +26,8 @@ 2010+ Phoenix (SadNES cITy Translations) NSPrincipalClass NSApplication + NSHighResolutionCapable + True CFBundleIconFile icon From f1092113971e1261bbbf929a82ea40b5410bf810 Mon Sep 17 00:00:00 2001 From: marco-calautti Date: Thu, 4 Jan 2024 13:42:44 +0100 Subject: [PATCH 3/7] Added proper UI scaling --- app/include/gui/dpgui.h | 8 ++++---- app/src/gui/DeltaPatcherMainDialog.cpp | 18 ++++++++++++++++-- app/src/gui/dpgui.cpp | 4 ++-- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/app/include/gui/dpgui.h b/app/include/gui/dpgui.h index f94bce4..1efff21 100644 --- a/app/include/gui/dpgui.h +++ b/app/include/gui/dpgui.h @@ -77,7 +77,7 @@ class MainDialog : public wxDialog public: - MainDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Delta Patcher"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 504,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER ); + MainDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Delta Patcher"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER ); ~MainDialog(); }; @@ -123,7 +123,7 @@ class DecodePanel : public wxPanel public: wxBoxSizer* decodeMainSizer; - DecodePanel( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 260,184 ), long style = wxTAB_TRAVERSAL ); + DecodePanel( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL ); ~DecodePanel(); }; @@ -174,7 +174,7 @@ class EncodePanel : public wxPanel public: - EncodePanel( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 320,407 ), long style = wxTAB_TRAVERSAL ); + EncodePanel( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL ); ~EncodePanel(); }; @@ -212,7 +212,7 @@ class AboutDialog : public wxDialog public: - AboutDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About Delta Patcher"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 354,308 ), long style = wxDEFAULT_DIALOG_STYLE ); + AboutDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About Delta Patcher"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); ~AboutDialog(); }; diff --git a/app/src/gui/DeltaPatcherMainDialog.cpp b/app/src/gui/DeltaPatcherMainDialog.cpp index 9b9d170..414f46f 100644 --- a/app/src/gui/DeltaPatcherMainDialog.cpp +++ b/app/src/gui/DeltaPatcherMainDialog.cpp @@ -15,6 +15,11 @@ #include #endif +#define DECODE_PANEL_WIDTH 20 +#define ENCODE_PANEL_WIDTH 30 +#define ENCODE_PANEL_HEIGHT 25 +#define LOG_CTRL_WIDTH 30 + DeltaPatcherMainDialog::DeltaPatcherMainDialog( wxWindow* parent, const wxString& patchName ) : MainDialog( parent ), decodeMode(true), pendingPatchPath(patchName) @@ -43,20 +48,29 @@ MainDialog( parent ), decodeMode(true), pendingPatchPath(patchName) nullPanel->Show(false); + wxSize sizeM = GetTextExtent("M"); + wxSize minDecodePanelSize(DECODE_PANEL_WIDTH*sizeM.x,-1); + wxSize minEncodePanelSize(ENCODE_PANEL_WIDTH*sizeM.x,ENCODE_PANEL_HEIGHT*sizeM.y); + wxSize minLogCtrlSize(LOG_CTRL_WIDTH*sizeM.x,-1); + //preparing default panel decodePanel=new DeltaPatcherDecodePanel(this,this); - + decodePanel->SetSizeHints(minDecodePanelSize); + panelSizer->Add( decodePanel, 1, wxEXPAND | wxALL, 5 ); decodePanel->GetSizer()->Fit(decodePanel); //preparing encode panel encodePanel=new DeltaPatcherEncodePanel(this,this); + encodePanel->SetSizeHints(minEncodePanelSize); + encodePanel->Show(false); panelSizer->Add( encodePanel, 1, wxEXPAND | wxALL, 5 ); //preparing log area logCtrl->SetEditable(false); - + logCtrl->SetSizeHints(minLogCtrlSize); + //checking release type #ifdef __DP_DECODE_ONLY__ operationButton->Show(false); diff --git a/app/src/gui/dpgui.cpp b/app/src/gui/dpgui.cpp index 262c349..2825224 100644 --- a/app/src/gui/dpgui.cpp +++ b/app/src/gui/dpgui.cpp @@ -28,7 +28,7 @@ MainDialog::MainDialog( wxWindow* parent, wxWindowID id, const wxString& title, panelSizer = new wxBoxSizer( wxVERTICAL ); - nullPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize( 260,184 ), wxTAB_TRAVERSAL ); + nullPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); panelSizer->Add( nullPanel, 1, wxEXPAND | wxALL, 5 ); @@ -72,7 +72,7 @@ MainDialog::MainDialog( wxWindow* parent, wxWindowID id, const wxString& title, logBox = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Log:") ), wxVERTICAL ); - logCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 350,-1 ), wxHSCROLL|wxTE_MULTILINE|wxTE_WORDWRAP ); + logCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxTE_MULTILINE|wxTE_WORDWRAP ); logBox->Add( logCtrl, 1, wxALL|wxEXPAND, 5 ); From dbdef7e14994cdcf487ed9777cb852d11d7aa760 Mon Sep 17 00:00:00 2001 From: marco-calautti Date: Thu, 4 Jan 2024 14:11:42 +0100 Subject: [PATCH 4/7] More generic sizes --- app/include/gui/dpgui.h | 7 ------- app/src/gui/DeltaPatcherDecodePanel.cpp | 6 ++++++ app/src/gui/DeltaPatcherEncodePanel.cpp | 9 +++++++++ app/src/gui/DeltaPatcherMainDialog.cpp | 7 ------- app/src/gui/dpgui.cpp | 9 --------- 5 files changed, 15 insertions(+), 23 deletions(-) diff --git a/app/include/gui/dpgui.h b/app/include/gui/dpgui.h index 1efff21..d44958d 100644 --- a/app/include/gui/dpgui.h +++ b/app/include/gui/dpgui.h @@ -1,10 +1,3 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 12 2015) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - #ifndef __DPGUI_H__ #define __DPGUI_H__ diff --git a/app/src/gui/DeltaPatcherDecodePanel.cpp b/app/src/gui/DeltaPatcherDecodePanel.cpp index 1e4f176..3fcb7fd 100644 --- a/app/src/gui/DeltaPatcherDecodePanel.cpp +++ b/app/src/gui/DeltaPatcherDecodePanel.cpp @@ -9,6 +9,8 @@ #include #include +#define DECODE_TEXTCTRL_WIDTH 16 + DeltaPatcherDecodePanel::DeltaPatcherDecodePanel( wxWindow* parent,Logger* l ) : DecodePanel( parent ), logger( l ) @@ -33,6 +35,10 @@ DecodePanel( parent ), logger( l ) checksumCheck = new wxMenuItem( applyOptionsMenu, wxID_ANY, wxString( _("Checksum validation") ) , wxEmptyString, wxITEM_CHECK ); applyOptionsMenu->Append( checksumCheck ); checksumCheck->Check( true ); + + wxSize sizeM = GetTextExtent("M"); + originalField->SetSizeHints(DECODE_TEXTCTRL_WIDTH*sizeM.x,-1); + patchField->SetSizeHints(DECODE_TEXTCTRL_WIDTH*sizeM.x,-1); } void DeltaPatcherDecodePanel::OnDecodeOptionsClicked(wxCommandEvent& event) diff --git a/app/src/gui/DeltaPatcherEncodePanel.cpp b/app/src/gui/DeltaPatcherEncodePanel.cpp index 0715408..e799a82 100644 --- a/app/src/gui/DeltaPatcherEncodePanel.cpp +++ b/app/src/gui/DeltaPatcherEncodePanel.cpp @@ -9,6 +9,9 @@ #include #include +#define ENCODE_TEXTCTRL_WIDTH 25 +#define ENCODE_DESCRIPTION_TEXTCTRL_HEIGHT 10 + class EncodePanelDropHandler : public DeltaPatcherDropHandler { private: @@ -94,6 +97,12 @@ EncodePanel( parent ), logger( l ) checksumCheck = new wxMenuItem( createOptionsMenu, wxID_ANY, wxString( _("Add Checksum to patch") ) , wxEmptyString, wxITEM_CHECK ); createOptionsMenu->Append( checksumCheck ); checksumCheck->Check( true ); + + wxSize sizeM = GetTextExtent("M"); + originalField->SetSizeHints(ENCODE_TEXTCTRL_WIDTH*sizeM.x,-1); + modifiedField->SetSizeHints(ENCODE_TEXTCTRL_WIDTH*sizeM.x,-1); + descriptionField->SetSizeHints(ENCODE_TEXTCTRL_WIDTH*sizeM.x,ENCODE_DESCRIPTION_TEXTCTRL_HEIGHT*sizeM.y); + patchField->SetSizeHints(ENCODE_TEXTCTRL_WIDTH*sizeM.x,-1); } void DeltaPatcherEncodePanel::OnEncodeOptionsClicked(wxCommandEvent& event) diff --git a/app/src/gui/DeltaPatcherMainDialog.cpp b/app/src/gui/DeltaPatcherMainDialog.cpp index 414f46f..dd377c8 100644 --- a/app/src/gui/DeltaPatcherMainDialog.cpp +++ b/app/src/gui/DeltaPatcherMainDialog.cpp @@ -15,9 +15,6 @@ #include #endif -#define DECODE_PANEL_WIDTH 20 -#define ENCODE_PANEL_WIDTH 30 -#define ENCODE_PANEL_HEIGHT 25 #define LOG_CTRL_WIDTH 30 DeltaPatcherMainDialog::DeltaPatcherMainDialog( wxWindow* parent, const wxString& patchName ) @@ -49,20 +46,16 @@ MainDialog( parent ), decodeMode(true), pendingPatchPath(patchName) nullPanel->Show(false); wxSize sizeM = GetTextExtent("M"); - wxSize minDecodePanelSize(DECODE_PANEL_WIDTH*sizeM.x,-1); - wxSize minEncodePanelSize(ENCODE_PANEL_WIDTH*sizeM.x,ENCODE_PANEL_HEIGHT*sizeM.y); wxSize minLogCtrlSize(LOG_CTRL_WIDTH*sizeM.x,-1); //preparing default panel decodePanel=new DeltaPatcherDecodePanel(this,this); - decodePanel->SetSizeHints(minDecodePanelSize); panelSizer->Add( decodePanel, 1, wxEXPAND | wxALL, 5 ); decodePanel->GetSizer()->Fit(decodePanel); //preparing encode panel encodePanel=new DeltaPatcherEncodePanel(this,this); - encodePanel->SetSizeHints(minEncodePanelSize); encodePanel->Show(false); panelSizer->Add( encodePanel, 1, wxEXPAND | wxALL, 5 ); diff --git a/app/src/gui/dpgui.cpp b/app/src/gui/dpgui.cpp index 2825224..533d803 100644 --- a/app/src/gui/dpgui.cpp +++ b/app/src/gui/dpgui.cpp @@ -1,14 +1,5 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 12 2015) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - #include -/////////////////////////////////////////////////////////////////////////// - BEGIN_EVENT_TABLE( MainDialog, wxDialog ) EVT_ACTIVATE( MainDialog::_wxFB_OnActivate ) EVT_CLOSE( MainDialog::_wxFB_OnMainDialogClose ) From 3848f6bfb61b742a61f7d37e04e8185fc88410b7 Mon Sep 17 00:00:00 2001 From: marco-calautti Date: Thu, 4 Jan 2024 15:21:31 +0100 Subject: [PATCH 5/7] Increased decode panel width --- app/src/gui/DeltaPatcherDecodePanel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/gui/DeltaPatcherDecodePanel.cpp b/app/src/gui/DeltaPatcherDecodePanel.cpp index 3fcb7fd..2cab853 100644 --- a/app/src/gui/DeltaPatcherDecodePanel.cpp +++ b/app/src/gui/DeltaPatcherDecodePanel.cpp @@ -9,7 +9,7 @@ #include #include -#define DECODE_TEXTCTRL_WIDTH 16 +#define DECODE_TEXTCTRL_WIDTH 17 DeltaPatcherDecodePanel::DeltaPatcherDecodePanel( wxWindow* parent,Logger* l ) : From bf8450c1dbe20dd91cdb4fb2eb86ddc6b7469a80 Mon Sep 17 00:00:00 2001 From: marco-calautti Date: Thu, 4 Jan 2024 15:44:06 +0100 Subject: [PATCH 6/7] Another small increase --- app/src/gui/DeltaPatcherDecodePanel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/gui/DeltaPatcherDecodePanel.cpp b/app/src/gui/DeltaPatcherDecodePanel.cpp index 2cab853..7200605 100644 --- a/app/src/gui/DeltaPatcherDecodePanel.cpp +++ b/app/src/gui/DeltaPatcherDecodePanel.cpp @@ -9,7 +9,7 @@ #include #include -#define DECODE_TEXTCTRL_WIDTH 17 +#define DECODE_TEXTCTRL_WIDTH 18 DeltaPatcherDecodePanel::DeltaPatcherDecodePanel( wxWindow* parent,Logger* l ) : From 6df1245564af4add50cd72d22599ebfb7229bab4 Mon Sep 17 00:00:00 2001 From: marco-calautti Date: Thu, 4 Jan 2024 15:46:15 +0100 Subject: [PATCH 7/7] Reverted increase! --- app/src/gui/DeltaPatcherDecodePanel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/gui/DeltaPatcherDecodePanel.cpp b/app/src/gui/DeltaPatcherDecodePanel.cpp index 7200605..2cab853 100644 --- a/app/src/gui/DeltaPatcherDecodePanel.cpp +++ b/app/src/gui/DeltaPatcherDecodePanel.cpp @@ -9,7 +9,7 @@ #include #include -#define DECODE_TEXTCTRL_WIDTH 18 +#define DECODE_TEXTCTRL_WIDTH 17 DeltaPatcherDecodePanel::DeltaPatcherDecodePanel( wxWindow* parent,Logger* l ) :