From 862907cf5bf3857b1653318acf44394a173d5594 Mon Sep 17 00:00:00 2001 From: BaconCatBug Date: Mon, 29 Apr 2024 18:47:19 +0100 Subject: [PATCH] Update CMakeLists.txt to allow for static compilation | Update Readme.md | Update package.ps1 (#74) * Fix CMakeLists, Update Readme and package.ps1 Fixed CMakeLists to allow for static complilation/workaround for broken Hunspell Upped version number to 2.5.0 Updated Readme to include corrected compilation instructions for Visual Studio and Workarounds. Updated package.ps1 to include the cli executable in the dist zips and upped the version number to 2.5.0 * Update README.md * Update package.ps1 * Update package.ps1 * Update CHANGES.md * Update preferences_window.cpp * Update README.md --- CHANGES.md | 3 +- CMakeLists.txt | 10 +++- README.md | 37 +++++++----- package.ps1 | 15 ++++- src/gui/preferences_window.cpp | 104 ++++++++++++++++----------------- 5 files changed, 99 insertions(+), 70 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 0c33b29b..51c0347e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,7 +2,7 @@ Magic Set Editor changelog, for the details see `git log` ============================================================================== ------------------------------------------------------------------------------ -HEAD: new items added as changes are made +version 2.5.0 (Unofficial), 2024-04-28 ------------------------------------------------------------------------------ Features: @@ -13,6 +13,7 @@ Bug fixes: * Fixed crash when 0 keywords match filter string in keyword panel (@llemoi, haganbmj#57) * Correct "all images" filter when selecting files. (haganbmj#70) * Correct localization of strings on Print window. + * Fixed issue where "All Images" filter on the art picker was not showing .jpeg files (BaconCatBug) Internal: * Add Mac OS build resources (@halian, haganbmj#67, haganbmj#68) diff --git a/CMakeLists.txt b/CMakeLists.txt index c9e80aeb..84eea3de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.13) -project(magicseteditor VERSION 2.4.0) +project(magicseteditor VERSION 2.5.0) add_definitions(-DUNOFFICIAL_BUILD) set(CMAKE_CXX_STANDARD 17) @@ -26,6 +26,11 @@ if( NOT HUNSPELL_FOUND ) endif() endif() +# You will most likely get a message about being unable to open hunspell-1.7.lib because pkgconf forgets to add the actual path to +# HUNSPELL_LIBRARIES. If so, uncomment the below line and point it to the correct vcpkg root folder/library. +#set(HUNSPELL_LIBRARIES "C:\\PATH\\TO\\ROOT\\vcpkg\\installed\\${VCPKG_TARGET_TRIPLET}\\lib\\hunspell-1.7.lib") +message("-- Does this have a full path? If not, and it's just a file name, it's broken: Found Hunspell at ${HUNSPELL_LIBRARIES}") + include_directories("${PROJECT_BINARY_DIR}/src") include_directories("${PROJECT_SOURCE_DIR}/src") include(${wxWidgets_USE_FILE}) @@ -142,3 +147,6 @@ endif() # Test suite include(test/tests.cmake) + +# Debug Message +message("-- Does this have a full path? If not, and it's just a file name, it's broken: Found Hunspell at ${HUNSPELL_LIBRARIES}") diff --git a/README.md b/README.md index 05d52579..fa7a9886 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,13 @@ Magic Set Editor, or MSE for short, is a program with which you can design your More information on https://magicseteditor.boards.net/ +## Main Features in the Unofficial Branch + * Fixes the "All Image" art selector list to include .jpeg images. + * Allows for the option to remove aliasing on selected art by increasing the size of the stored images in the set file. + * Adds a text filter on the style tab for Stylesheet. + * Decouples the zoom and export scales. + + ## Dependencies The code depends on @@ -14,29 +21,31 @@ The code depends on ## Building on windows with Visual Studio On windows, the program can be compiled with Visual Studio (recommended) or with mingw-gcc. - - * Download and install [Visual Studio Community edition](https://visualstudio.microsoft.com/vs/community/) + * VS instructions up-to-date as of April 2024 + * Download and install [Visual Studio Community Edition](https://visualstudio.microsoft.com/vs/community/) * Download and install [vcpkg](https://github.com/microsoft/vcpkg) - * Use vcpkg to install wxwidgets, boost, hunspell + * Use vcpkg to install pkgconf, wxwidgets, boost, hunspell ```` -vcpkg install wxwidgets -vcpkg install boost-smart-ptr -vcpkg install boost-regex -vcpkg install boost-logic -vcpkg install boost-pool -vcpkg install boost-iterator -vcpkg install hunspell -vcpkg integrate install +.\vcpkg install pkgconf wxwidgets boost-smart-ptr boost-regex boost-logic boost-pool boost-iterator hunspell --triplet=x64-windows-static +```` +and/or +```` +.\vcpkg install pkgconf wxwidgets boost-smart-ptr boost-regex boost-logic boost-pool boost-iterator hunspell --triplet=x86-windows-static +```` +```` +.\vcpkg integrate install ```` * Then just use "Open Folder" from inside visual studio to open the Magic Set Editor source code root folder. - * Select the configuration that you want to build, and hit F7. + * Select the configuration that you want to build (release x64-windows-static), and hit F7. Notes: + * You will most likely get a message about being unable to open hunspell-1.7.lib because pkgconf forgets to add the actual path to HUNSPELL_LIBRARIES. If so, uncomment the noted line in CMakeLists.txt (line 31) and point it to the root vcpkg installation to find the correct hunspell-1.7.lib file. + * You may need to work around [this bug](https://github.com/microsoft/vcpkg/issues/4756) by replacing `$VCPATH\IDE\CommonExtensions\Microsoft\CMake\CMake\share\cmake-3.16\Modules\FindwxWidgets.cmake` with the file from https://github.com/CaeruleusAqua/vcpkg-wx-find (`$VCPATH` is usually `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7`) - * vcpkg by default installs 32 bit versions of libraries, use `vcpkg install PACKAGENAME:x64-windows` if you want to enable a 64 bit build. - * Similarly, to use a static build, use `vcpkg install PACKAGENAME:x32-windows-static`. + * vcpkg by default installs 32 bit versions of libraries, use `vcpkg install PACKAGENAME --triplet=x64-windows` if you want to enable a 64 bit build. + * Similarly, to use a static build, use `vcpkg install PACKAGENAME --triplet=x32-windows` or `vcpkg install PACKAGENAME -triplet=x64-windows-static`. For running tests you will also need to * Download and install perl (For example [Strawberry perl](http://strawberryperl.com/) or using [MSYS2](https://www.msys2.org/)) diff --git a/package.ps1 b/package.ps1 index 4d527f8b..c11ea02c 100644 --- a/package.ps1 +++ b/package.ps1 @@ -1,6 +1,15 @@ # Super basic build script for release versions. # Note the hardcoded version numbers which don't read from CMakeLists at all. +# Set alias for 7zip +$7zipPath = "$env:ProgramFiles\7-Zip\7z.exe" + +if (-not (Test-Path -Path $7zipPath -PathType Leaf)) { +throw "7 zip file '$7zipPath' not found" +} + +Set-Alias 7z $7zipPath + # Cleanup and Recreate the working directories. Remove-Item .\out\temp -Recurse Remove-Item .\out\dist -Recurse @@ -40,16 +49,18 @@ Copy-Item ./data/ko.mse-locale/ ./out/temp/data/ko.mse-locale/ -Force -Recurse Copy-Item ./BUNDLED_README.txt ./out/temp/x64/README.txt -Force -Recurse Copy-Item ./out/build/x64-Release-static/magicseteditor.com ./out/temp/x64/ -Force -Recurse Copy-Item ./out/build/x64-Release-static/magicseteditor.exe ./out/temp/x64/ -Force -Recurse +Copy-Item ./out/build/x64-Release-static/magicseteditor-cli.exe ./out/temp/x64/ -Force -Recurse #Copy-Item ./data/en.mse-locale/ ./out/temp/x64/data/en.mse-locale/ -Force -Recurse Copy-Item ./out/temp/data/ ./out/temp/x64/data/ -Force -Recurse -7z a -tzip ./out/dist/MagicSetEditor-2.4.0-win64.zip ./out/temp/x64/** +7z a -tzip ./out/dist/MagicSetEditor-2.5.0-unofficial-win64.zip ./out/temp/x64/** # Gather the relevant x86 files and Zip them. Copy-Item ./BUNDLED_README.txt ./out/temp/x86/README.txt -Force -Recurse Copy-Item ./out/build/x86-Release-static/magicseteditor.com ./out/temp/x86/ -Force -Recurse Copy-Item ./out/build/x86-Release-static/magicseteditor.exe ./out/temp/x86/ -Force -Recurse +Copy-Item ./out/build/x86-Release-static/magicseteditor-cli.exe ./out/temp/x86/ -Force -Recurse #Copy-Item ./data/en.mse-locale/ ./out/temp/x86/data/en.mse-locale/ -Force -Recurse Copy-Item ./out/temp/data/ ./out/temp/x86/data/ -Force -Recurse -7z a -tzip ./out/dist/MagicSetEditor-2.4.0-win32.zip ./out/temp/x86/** +7z a -tzip ./out/dist/MagicSetEditor-2.5.0-unofficial-win32.zip ./out/temp/x86/** diff --git a/src/gui/preferences_window.cpp b/src/gui/preferences_window.cpp index 6df0dae6..bdaafdb7 100644 --- a/src/gui/preferences_window.cpp +++ b/src/gui/preferences_window.cpp @@ -65,22 +65,22 @@ private: void updateZoom(); void onExportZoomChange(wxCommandEvent&); void updateExportZoom(); -}; - +}; + class InternalPreferencesPage : public PreferencesPage { -public: - InternalPreferencesPage(Window* parent); - void store() override; - -private: - DECLARE_EVENT_TABLE(); - - wxCheckBox* internal_image_extension; - - wxComboBox* internal_scale; - int internal_scale_int; - - void onInternalScaleChange(wxCommandEvent&); +public: + InternalPreferencesPage(Window* parent); + void store() override; + +private: + DECLARE_EVENT_TABLE(); + + wxCheckBox* internal_image_extension; + + wxComboBox* internal_scale; + int internal_scale_int; + + void onInternalScaleChange(wxCommandEvent&); void updateInternalScale(); }; @@ -124,7 +124,7 @@ PreferencesWindow::PreferencesWindow(Window* parent) // init notebook wxNotebook* nb = new wxNotebook(this, ID_NOTEBOOK); nb->AddPage(new GlobalPreferencesPage (nb), _TITLE_("global")); - nb->AddPage(new DisplayPreferencesPage(nb), _TITLE_("display")); + nb->AddPage(new DisplayPreferencesPage(nb), _TITLE_("display")); nb->AddPage(new InternalPreferencesPage(nb), _TITLE_("internal")); nb->AddPage(new DirsPreferencesPage (nb), _TITLE_("directories")); nb->AddPage(new UpdatePreferencesPage (nb), _TITLE_("updates")); @@ -202,7 +202,7 @@ void GlobalPreferencesPage::store() { // set the_locale? // open_sets_in_new_window settings.open_sets_in_new_window = open_sets_in_new_window->GetValue(); -} +} // ----------------------------------------------------------------------------- : Preferences page : display @@ -213,17 +213,17 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent) high_quality = new wxCheckBox(this, wxID_ANY, _BUTTON_("high quality")); borders = new wxCheckBox(this, wxID_ANY, _BUTTON_("show lines")); draw_editing = new wxCheckBox(this, wxID_ANY, _BUTTON_("show editing hints")); - spellcheck_enabled = new wxCheckBox(this, wxID_ANY, _BUTTON_("spellcheck enabled")); + spellcheck_enabled = new wxCheckBox(this, wxID_ANY, _BUTTON_("spellcheck enabled")); non_normal_export = new wxCheckBox(this, wxID_ANY, _BUTTON_("zoom export")); zoom = new wxComboBox(this, ID_ZOOM); - export_zoom = new wxComboBox(this, ID_EXPORT_ZOOM); + export_zoom = new wxComboBox(this, ID_EXPORT_ZOOM); //wxButton* columns = new wxButton(this, ID_SELECT_COLUMNS, _BUTTON_("select")); // set values high_quality-> SetValue( settings.default_stylesheet_settings.card_anti_alias()); borders-> SetValue( settings.default_stylesheet_settings.card_borders()); draw_editing-> SetValue( settings.default_stylesheet_settings.card_draw_editing()); - spellcheck_enabled->SetValue( settings.default_stylesheet_settings.card_spellcheck_enabled()); + spellcheck_enabled->SetValue( settings.default_stylesheet_settings.card_spellcheck_enabled()); non_normal_export->SetValue(!settings.default_stylesheet_settings.card_normal_export()); zoom_int = static_cast(settings.default_stylesheet_settings.card_zoom() * 100); zoom->SetValue(String::Format(_("%d%%"),zoom_int)); @@ -258,7 +258,7 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent) s4->Add(new wxStaticText(this, wxID_ANY, _LABEL_("percent of normal")), 1, wxALL & ~wxRIGHT, 4); s2->Add(s3, 0, wxEXPAND | wxALL, 4); - s2->Add(s4, 0, wxEXPAND | wxALL, 4); + s2->Add(s4, 0, wxEXPAND | wxALL, 4); s2->Add(non_normal_export, 0, wxEXPAND | wxALL, 4); s->Add(s2, 0, wxEXPAND | wxALL, 8); @@ -271,7 +271,7 @@ void DisplayPreferencesPage::store() { settings.default_stylesheet_settings.card_anti_alias = high_quality->GetValue(); settings.default_stylesheet_settings.card_borders = borders->GetValue(); settings.default_stylesheet_settings.card_draw_editing = draw_editing->GetValue(); - settings.default_stylesheet_settings.card_spellcheck_enabled = spellcheck_enabled->GetValue(); + settings.default_stylesheet_settings.card_spellcheck_enabled = spellcheck_enabled->GetValue(); settings.default_stylesheet_settings.card_normal_export = !non_normal_export->GetValue(); updateZoom(); @@ -316,45 +316,45 @@ BEGIN_EVENT_TABLE(DisplayPreferencesPage, wxPanel) EVT_COMBOBOX(ID_EXPORT_ZOOM, DisplayPreferencesPage::onExportZoomChange) EVT_TEXT_ENTER(ID_EXPORT_ZOOM, DisplayPreferencesPage::onExportZoomChange) END_EVENT_TABLE () - -// ----------------------------------------------------------------------------- : Preferences page : internal - -InternalPreferencesPage::InternalPreferencesPage(Window* parent) : PreferencesPage(parent) { - internal_image_extension = new wxCheckBox(this, wxID_ANY, _BUTTON_("internal image extension")); - internal_scale = new wxComboBox(this, ID_INTERNAL_SCALE); - - internal_image_extension->SetValue(settings.internal_image_extension); - - internal_scale_int = static_cast(settings.internal_scale * 100); - internal_scale->SetValue(String::Format(_("%d%%"), internal_scale_int)); - - int choices[] = { 100,200 }; + +// ----------------------------------------------------------------------------- : Preferences page : internal + +InternalPreferencesPage::InternalPreferencesPage(Window* parent) : PreferencesPage(parent) { + internal_image_extension = new wxCheckBox(this, wxID_ANY, _BUTTON_("internal image extension")); + internal_scale = new wxComboBox(this, ID_INTERNAL_SCALE); + + internal_image_extension->SetValue(settings.internal_image_extension); + + internal_scale_int = static_cast(settings.internal_scale * 100); + internal_scale->SetValue(String::Format(_("%d%%"), internal_scale_int)); + + int choices[] = { 100,200,300,400 }; for (unsigned int i = 0; i < sizeof(choices) / sizeof(choices[0]); ++i) { internal_scale->Append(String::Format(_("%d%%"), choices[i])); - } - - wxSizer* s = new wxBoxSizer(wxVERTICAL); - wxSizer* s2 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("storage")); + } + + wxSizer* s = new wxBoxSizer(wxVERTICAL); + wxSizer* s2 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("storage")); wxSizer* s3 = new wxBoxSizer(wxHORIZONTAL); s3->Add(new wxStaticText(this, wxID_ANY, _LABEL_("scale")), 0, wxALL & ~wxLEFT, 4); s3->AddSpacer(2); s3->Add(internal_scale); - s3->Add(new wxStaticText(this, wxID_ANY, _LABEL_("percent of normal")), 1, wxALL & ~wxRIGHT, 4); - s2->Add(s3); - s2->Add(new wxStaticText(this, wxID_ANY, _LABEL_("internal scale desc")), 0, wxALL & ~wxLEFT, 4); - s2->Add(internal_image_extension, 0, wxEXPAND | wxALL, 4); + s3->Add(new wxStaticText(this, wxID_ANY, _LABEL_("percent of normal")), 1, wxALL & ~wxRIGHT, 4); + s2->Add(s3); + s2->Add(new wxStaticText(this, wxID_ANY, _LABEL_("internal scale desc")), 0, wxALL & ~wxLEFT, 4); + s2->Add(internal_image_extension, 0, wxEXPAND | wxALL, 4); s->Add(s2, 0, wxEXPAND | wxALL, 8); s->SetSizeHints(this); - SetSizer(s); -} - + SetSizer(s); +} + void InternalPreferencesPage::store() { - settings.internal_image_extension = internal_image_extension->GetValue(); - + settings.internal_image_extension = internal_image_extension->GetValue(); + updateInternalScale(); settings.internal_scale = internal_scale_int / 100.0; -} - +} + void InternalPreferencesPage::onInternalScaleChange(wxCommandEvent&) { updateInternalScale(); } @@ -366,8 +366,8 @@ void InternalPreferencesPage::updateInternalScale() { internal_scale_int = min(max(i, 1), 1000); } internal_scale->SetValue(String::Format(_("%d%%"), (int)internal_scale_int)); -} - +} + BEGIN_EVENT_TABLE(InternalPreferencesPage, wxPanel) EVT_COMBOBOX(ID_INTERNAL_SCALE, InternalPreferencesPage::onInternalScaleChange) END_EVENT_TABLE()