From d8cb12f74f62d765707b83969558ccd8ba9d9369 Mon Sep 17 00:00:00 2001 From: WeatherWonders Date: Mon, 9 Jun 2025 22:16:39 -0400 Subject: [PATCH 1/4] Fix long-used recent files being truncated out of the list --- src/io/recent-files.cpp | 30 ++++++++++++++------------ src/ui/dialog/inkscape-preferences.cpp | 2 -- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/io/recent-files.cpp b/src/io/recent-files.cpp index 4df63056ac..19206825fb 100644 --- a/src/io/recent-files.cpp +++ b/src/io/recent-files.cpp @@ -28,7 +28,7 @@ std::vector> getInkscapeRecentFiles(unsigned max_f std::vector> output; auto recent_manager = Gtk::RecentManager::get_default(); - // all recent files not necessarily inkscape only (std::vector) + // All recent files, not necessarily inkscape only (std::vector) auto recent_files = recent_manager->get_items(); // Remove non-inkscape files. @@ -37,15 +37,22 @@ std::vector> getInkscapeRecentFiles(unsigned max_f bool valid_file = recent_file->has_application(g_get_prgname()) || recent_file->has_application("org.inkscape.Inkscape") || - recent_file->has_application("inkscape") -#ifdef _WIN32 - || recent_file->has_application("inkscape.exe") -#endif -; + recent_file->has_application("inkscape") || + recent_file->has_application("inkscape.exe"); return !valid_file; }); - - // Truncate to user specified max_files. + + // Sort by "last modified" time, which puts the most recently opened files first. + auto sort_by_time = [&](){ + std::sort(std::begin(recent_files), std::end(recent_files), [](auto const &a, auto const &b) -> bool { + // a should precede b if a->get_modified() is later than b->get_modified() + return a->get_modified().compare(b->get_modified()) > 0; + }); + }; + + sort_by_time(); // Initial sort so the longest-unused files are removed + + // Truncate to user-specified max_files. if (max_files && recent_files.size() > max_files) { recent_files.resize(max_files); } @@ -64,11 +71,7 @@ std::vector> getInkscapeRecentFiles(unsigned max_f auto it_u = std::unique (recent_files.begin(), recent_files.end(), unique_comparator_uri); recent_files.erase(it_u, recent_files.end()); - // Sort by "last modified" time, which puts the most recently opened files first. - std::sort(std::begin(recent_files), std::end(recent_files), [](auto const &a, auto const &b) -> bool { - // a should precede b if a->get_modified() is later than b->get_modified() - return a->get_modified().compare(b->get_modified()) > 0; - }); + sort_by_time(); // Final order return recent_files; } @@ -166,7 +169,6 @@ std::map getShortenedPathMap(std::vectorhas_application(g_get_prgname()) || e->has_application("org.inkscape.Inkscape") || e->has_application("inkscape") -#ifdef _WIN32 || e->has_application("inkscape.exe") -#endif ) { manager->remove_item(e->get_uri()); } -- GitLab From f6ee41ce0cff63fcf19f00b14ecd34189b0706df Mon Sep 17 00:00:00 2001 From: WeatherWonders Date: Tue, 10 Jun 2025 10:59:36 -0400 Subject: [PATCH 2/4] Truncate after removing duplicate recent list entries --- src/io/recent-files.cpp | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/io/recent-files.cpp b/src/io/recent-files.cpp index 19206825fb..2ea50de2c9 100644 --- a/src/io/recent-files.cpp +++ b/src/io/recent-files.cpp @@ -42,21 +42,6 @@ std::vector> getInkscapeRecentFiles(unsigned max_f return !valid_file; }); - // Sort by "last modified" time, which puts the most recently opened files first. - auto sort_by_time = [&](){ - std::sort(std::begin(recent_files), std::end(recent_files), [](auto const &a, auto const &b) -> bool { - // a should precede b if a->get_modified() is later than b->get_modified() - return a->get_modified().compare(b->get_modified()) > 0; - }); - }; - - sort_by_time(); // Initial sort so the longest-unused files are removed - - // Truncate to user-specified max_files. - if (max_files && recent_files.size() > max_files) { - recent_files.resize(max_files); - } - // Ensure that display uri's are unique. It is possible that an XBEL file // has multiple entries for the same file as a path can be written in equivalent // ways: i.e. with a ';' or '%3B', or with a drive name of 'c' or 'C' on Windows. @@ -71,7 +56,16 @@ std::vector> getInkscapeRecentFiles(unsigned max_f auto it_u = std::unique (recent_files.begin(), recent_files.end(), unique_comparator_uri); recent_files.erase(it_u, recent_files.end()); - sort_by_time(); // Final order + // Sort by "last modified" time, which puts the most recently opened files first. + std::sort(std::begin(recent_files), std::end(recent_files), [](auto const &a, auto const &b) -> bool { + // a should precede b if a->get_modified() is later than b->get_modified() + return a->get_modified().compare(b->get_modified()) > 0; + }); + + // Truncate to user-specified max_files. + if (max_files && recent_files.size() > max_files) { + recent_files.resize(max_files); + } return recent_files; } -- GitLab From ee5ce4522410fffaf3466973f9c6da3dd2ee3719 Mon Sep 17 00:00:00 2001 From: WeatherWonders Date: Mon, 22 Sep 2025 18:34:43 -0400 Subject: [PATCH 3/4] Improvements to the VSC tutorial and Windows build instructions --- doc/building/windows.md | 3 ++- doc/vscode/readme.md | 28 +++++++++++++++++++++------- doc/vscode/tasks.json | 6 +++--- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/doc/building/windows.md b/doc/building/windows.md index fcd80aec66..ca67d63824 100644 --- a/doc/building/windows.md +++ b/doc/building/windows.md @@ -67,7 +67,7 @@ cd build # should always point to the root folder of your copy of the Inkscape source. # ( For details on these build flags, see below "Build Flags" ) -cmake -G Ninja -DCMAKE_INSTALL_PREFIX="${PWD}/install_dir" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -DWITH_INTERNAL_2GEOM=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. +cmake -G Ninja -DCMAKE_INSTALL_PREFIX="${PWD}/install_dir" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -DWITH_INTERNAL_2GEOM=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DWITH_CAPYPDF=OFF .. # start the compilation and # install compiled files and all dependencies required to run Inkscape into the @@ -167,4 +167,5 @@ For older versions before 1.5.0, or if you do not want the automatic installatio Some background information on why the build flags were chosen. - `-DBUILD_SHARED_LIBS=OFF` avoids trying to build with [too many debug symbols](https://stackoverflow.com/questions/47135973/error-export-ordinal-too-large-104116). +- `-DWITH_CAPYPDF=OFF` disables a newer PDF generation library that currently makes builds fail. - The other build flags are the recommended default also for [Linux](../linux.md). diff --git a/doc/vscode/readme.md b/doc/vscode/readme.md index 6f6aa15718..16ffbcd829 100644 --- a/doc/vscode/readme.md +++ b/doc/vscode/readme.md @@ -2,7 +2,7 @@ 1. Follow these sections of [the tutorial for compiling Inkscape on Windows](../building/windows.md): - 1. _Compiling Inkscape on Windows_ **or** _Installing Build Dependencies Manually_ + 1. _Installing Build Dependencies Easily_ **or** _Installing Build Dependencies Manually_ 0. _Obtaining Inkscape Source_ @@ -18,7 +18,8 @@ 0. Open the command palette (Ctrl + Shift + P) and enter `> Open User Settings (JSON)`. -0. In the file that opens, add the following. This will allow you to launch the relevant MSYS2 terminals from within VS Code (Ctrl + \`) for convenience. If `terminal.integrated.profiles.windows` already exists, just add the items `UCRT` and `MSYS` to it. Note the presence of commas between adjacent list items. +0. In the file that opens, add this data. This will allow you to launch the relevant MSYS2 terminals from within VS Code (Ctrl + \`) for convenience. + ```json "terminal.integrated.profiles.windows": { "UCRT": { @@ -34,17 +35,30 @@ } ``` + This data goes between the outermost curly brackets. If you've just installed VS Code, the file will have only those brackets. + + Otherwise, note the presence of commas between adjacent list items. If `terminal.integrated.profiles.windows` already exists, just add the items `UCRT` and `MSYS` to it. + 0. Save and close `settings.json`. -0. Open the folder with your clone of the Inkscape repository. You can open a folder with `File > Open Folder...`. +0. Open the folder with your clone of the Inkscape repository. You can open a folder with `File > Open Folder...`. Choose to trust the folder when prompted. -0. To build Inkscape, I recommend trying via the terminal first to make it easier to troubleshoot. You can do that in VS Code: in the command palette, enter `> Create New Terminal (With Profile)` and choose `UCRT`. +0. To build Inkscape, I recommend trying via the terminal first to make it easier to troubleshoot. You can do that in VS Code: in the command palette, enter `> Create New Terminal (With Profile)` and choose `UCRT`. Do not build with the `MSYS` shell. + + Enter these commands: + + ```bash + mkdir build + cd build + cmake -G Ninja -DCMAKE_INSTALL_PREFIX="${PWD}/install_dir" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -DWITH_INTERNAL_2GEOM=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DWITH_CAPYPDF=OFF .. + ninja install + ``` - At this point you can follow [the commands from the compilation tutorial](../building/windows.md#building-inkscape-with-msys2). + For details, see [the regular Windows tutorial (§ _Building Inkscape with MSYS2_)](../building/windows.md#building-inkscape-with-msys2). - (Footnote: The build flag `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` in the standard build commands tells CMake to output `build/compile_commands.json`. [c_cpp_properties.json](./c_cpp_properties.json) tells IntelliSense to use this to understand the code, preventing a lot of false errors.) + > **Footnote:** The build flag `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` tells CMake to output `build/compile_commands.json`. [c_cpp_properties.json](./c_cpp_properties.json) has IntelliSense use this to understand the code, preventing a lot of false errors. -0. To make the build process more convenient, [tasks.json](./tasks.json) defines tasks called `CMake` and `Ninja Install` that you can run via the command palette by entering `task ` followed by the name. These require the `build` folder to exist. +0. To make the build process more convenient, [tasks.json](./tasks.json) defines tasks called `CMake` and `Ninja Install` that you can run via the command palette by entering `task ` (no `>`) followed by the name. These require the `build` folder to exist. In addition, Ctrl + Shift + B is bound to the "default build task", which will be `Ninja Install` by default. diff --git a/doc/vscode/tasks.json b/doc/vscode/tasks.json index 0d2f41b5cd..bbb1c8cd47 100644 --- a/doc/vscode/tasks.json +++ b/doc/vscode/tasks.json @@ -13,7 +13,7 @@ "args": ["-lc"] }, "env": { - "MSYSTEM": "MINGW64", + "MSYSTEM": "UCRT64", "CHERE_INVOKING": "1" } }, @@ -26,14 +26,14 @@ { "label": "CMake", "type": "shell", - "command": "cd \"${workspaceFolder}/build\" && cmake -DCMAKE_INSTALL_PREFIX=\"${workspaceFolder}/build/install_dir\" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DWITH_INTERNAL_2GEOM=ON -DBUILD_SHARED_LIBS=OFF -G Ninja ..", + "command": "cd \"${workspaceFolder}/build\" && cmake -DCMAKE_INSTALL_PREFIX=\"${workspaceFolder}/build/install_dir\" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DWITH_INTERNAL_2GEOM=ON -DBUILD_SHARED_LIBS=OFF -DWITH_CAPYPDF=OFF -G Ninja ..", "options": { "shell": { "executable": "C:\\msys64\\usr\\bin\\bash.exe", "args": ["-lc"] }, "env": { - "MSYSTEM": "MINGW64", + "MSYSTEM": "UCRT64", "CHERE_INVOKING": "1" } }, -- GitLab From 18b4d4820e2de1302e70bce018bb6e21ca5761e0 Mon Sep 17 00:00:00 2001 From: WeatherWonders Date: Tue, 7 Oct 2025 15:33:06 -0400 Subject: [PATCH 4/4] Remove `DWITH_CAPYPDF=OFF` from tutorials --- doc/building/windows.md | 3 +-- doc/vscode/readme.md | 2 +- doc/vscode/tasks.json | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/building/windows.md b/doc/building/windows.md index ca67d63824..fcd80aec66 100644 --- a/doc/building/windows.md +++ b/doc/building/windows.md @@ -67,7 +67,7 @@ cd build # should always point to the root folder of your copy of the Inkscape source. # ( For details on these build flags, see below "Build Flags" ) -cmake -G Ninja -DCMAKE_INSTALL_PREFIX="${PWD}/install_dir" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -DWITH_INTERNAL_2GEOM=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DWITH_CAPYPDF=OFF .. +cmake -G Ninja -DCMAKE_INSTALL_PREFIX="${PWD}/install_dir" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -DWITH_INTERNAL_2GEOM=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. # start the compilation and # install compiled files and all dependencies required to run Inkscape into the @@ -167,5 +167,4 @@ For older versions before 1.5.0, or if you do not want the automatic installatio Some background information on why the build flags were chosen. - `-DBUILD_SHARED_LIBS=OFF` avoids trying to build with [too many debug symbols](https://stackoverflow.com/questions/47135973/error-export-ordinal-too-large-104116). -- `-DWITH_CAPYPDF=OFF` disables a newer PDF generation library that currently makes builds fail. - The other build flags are the recommended default also for [Linux](../linux.md). diff --git a/doc/vscode/readme.md b/doc/vscode/readme.md index 16ffbcd829..f167b94db6 100644 --- a/doc/vscode/readme.md +++ b/doc/vscode/readme.md @@ -50,7 +50,7 @@ ```bash mkdir build cd build - cmake -G Ninja -DCMAKE_INSTALL_PREFIX="${PWD}/install_dir" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -DWITH_INTERNAL_2GEOM=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DWITH_CAPYPDF=OFF .. + cmake -G Ninja -DCMAKE_INSTALL_PREFIX="${PWD}/install_dir" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -DWITH_INTERNAL_2GEOM=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. ninja install ``` diff --git a/doc/vscode/tasks.json b/doc/vscode/tasks.json index bbb1c8cd47..b6bb07c8b5 100644 --- a/doc/vscode/tasks.json +++ b/doc/vscode/tasks.json @@ -26,7 +26,7 @@ { "label": "CMake", "type": "shell", - "command": "cd \"${workspaceFolder}/build\" && cmake -DCMAKE_INSTALL_PREFIX=\"${workspaceFolder}/build/install_dir\" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DWITH_INTERNAL_2GEOM=ON -DBUILD_SHARED_LIBS=OFF -DWITH_CAPYPDF=OFF -G Ninja ..", + "command": "cd \"${workspaceFolder}/build\" && cmake -DCMAKE_INSTALL_PREFIX=\"${workspaceFolder}/build/install_dir\" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DWITH_INTERNAL_2GEOM=ON -DBUILD_SHARED_LIBS=OFF -G Ninja ..", "options": { "shell": { "executable": "C:\\msys64\\usr\\bin\\bash.exe", -- GitLab