From a149680eba9b8f9948384b2103ea2e70e1ed9787 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Tue, 12 Sep 2023 22:19:37 +0800 Subject: [PATCH 1/3] consider windows DPI for slider --- src/slic3r/GUI/GLCanvas3D.cpp | 15 ++++++++++++--- src/slic3r/GUI/GUI_Utils.hpp | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 40d9f52f5f..7184f554df 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -38,6 +38,8 @@ #include "NotificationManager.hpp" #include "format.hpp" +#include + #if ENABLE_RETINA_GL #include "slic3r/Utils/RetinaHelper.hpp" #endif @@ -2029,7 +2031,11 @@ void GLCanvas3D::render(bool only_init) float right_margin = SLIDER_DEFAULT_RIGHT_MARGIN; float bottom_margin = SLIDER_DEFAULT_BOTTOM_MARGIN; if (m_canvas_type == ECanvasType::CanvasPreview) { - const float scale_factor = get_scale(); + float scale_factor = get_scale(); +#ifdef WIN32 + int dpi = get_dpi_for_window(wxGetApp().GetTopWindow()); + scale_factor *= (float) dpi / (float) DPI_DEFAULT; +#endif // WIN32 right_margin = SLIDER_RIGHT_MARGIN * scale_factor * GCODE_VIEWER_SLIDER_SCALE; bottom_margin = SLIDER_BOTTOM_MARGIN * scale_factor * GCODE_VIEWER_SLIDER_SCALE; } @@ -6873,7 +6879,6 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with //BBS: GUI refactor: add canvas size as parameters void GLCanvas3D::_render_gcode(int canvas_width, int canvas_height) { - float scale_factor = get_scale() * GCODE_VIEWER_SLIDER_SCALE; m_gcode_viewer.render(canvas_width, canvas_height, SLIDER_RIGHT_MARGIN * GCODE_VIEWER_SLIDER_SCALE); IMSlider *layers_slider = m_gcode_viewer.get_layers_slider(); IMSlider *moves_slider = m_gcode_viewer.get_moves_slider(); @@ -6946,7 +6951,11 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale() if (wxGetApp().plater()->is_preview_shown()) { IMSlider *m_layers_slider = get_gcode_viewer().get_layers_slider(); IMSlider *m_moves_slider = get_gcode_viewer().get_moves_slider(); - const float sc = get_scale(); + float sc = get_scale(); +#ifdef WIN32 + int dpi = get_dpi_for_window(wxGetApp().GetTopWindow()); + sc *= (float) dpi / (float) DPI_DEFAULT; +#endif // WIN32 m_layers_slider->set_scale(sc * GCODE_VIEWER_SLIDER_SCALE); m_moves_slider->set_scale(sc * GCODE_VIEWER_SLIDER_SCALE); diff --git a/src/slic3r/GUI/GUI_Utils.hpp b/src/slic3r/GUI/GUI_Utils.hpp index 10e2a6f940..bf2c4277b8 100644 --- a/src/slic3r/GUI/GUI_Utils.hpp +++ b/src/slic3r/GUI/GUI_Utils.hpp @@ -498,6 +498,8 @@ public: bool load_image(const std::string& filename, wxImage &image); bool generate_image(const std::string &filename, wxImage &image, wxSize img_size, int method = GERNERATE_IMAGE_RESIZE); +int get_dpi_for_window(const wxWindow *window); + }} From e3f36c8a0649ca5cee36b2634979fbf697be8b7f Mon Sep 17 00:00:00 2001 From: SoftFever Date: Tue, 12 Sep 2023 22:57:03 +0800 Subject: [PATCH 2/3] sign window app --- .github/workflows/build_orca.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_orca.yml b/.github/workflows/build_orca.yml index 0e18479c6b..ec6599ce1c 100644 --- a/.github/workflows/build_orca.yml +++ b/.github/workflows/build_orca.yml @@ -157,6 +157,11 @@ jobs: run: | choco install nsis + - name: Check signtool.exe + if: matrix.os == 'windows-2019' + run: | + signtool.exe + - name: download deps if: matrix.os == 'windows-2019' shell: powershell @@ -200,8 +205,21 @@ jobs: - name: Create installer Win if: matrix.os == 'windows-2019' + env: + BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} + P12_PASSWORD: ${{ secrets.P12_PASSWORD }} working-directory: ${{ github.workspace }}/build - run: cpack -G NSIS + run: | + # Decode the certificate + echo "$BUILD_CERTIFICATE_BASE64" | base64 -d > certificate.p12 + # Sign all .exe and .dll files in the specified folder + for file in OrcaSlicer/*; do + if [[ $file == *.exe ]] || [[ $file == *.dll ]]; then + signtool.exe sign /fd sha256 /f certificate.p12 /p $P12_PASSWORD "$file" + fi + done + cpack -G NSIS + signtool.exe sign /fd sha256 /f certificate.p12 /p $P12_PASSWORD "${{ github.workspace }}/build/OrcaSlicer_Windows_Installer_${{ env.ver }}.exe" # - name: pack app # if: matrix.os == 'windows-2019' From 7e66d8d23190a7602c4ff808c8536fbc4778a75c Mon Sep 17 00:00:00 2001 From: SoftFever Date: Tue, 12 Sep 2023 23:03:30 +0800 Subject: [PATCH 3/3] full path of signtool --- .github/workflows/build_orca.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_orca.yml b/.github/workflows/build_orca.yml index ec6599ce1c..33e30f1a86 100644 --- a/.github/workflows/build_orca.yml +++ b/.github/workflows/build_orca.yml @@ -160,7 +160,7 @@ jobs: - name: Check signtool.exe if: matrix.os == 'windows-2019' run: | - signtool.exe + "C:/Program Files (x86)/Microsoft SDKs/ClickOnce/SignTool/signtool.exe/signtool.exe" - name: download deps if: matrix.os == 'windows-2019' @@ -215,11 +215,11 @@ jobs: # Sign all .exe and .dll files in the specified folder for file in OrcaSlicer/*; do if [[ $file == *.exe ]] || [[ $file == *.dll ]]; then - signtool.exe sign /fd sha256 /f certificate.p12 /p $P12_PASSWORD "$file" + "C:/Program Files (x86)/Microsoft SDKs/ClickOnce/SignTool/signtool.exe/signtool.exe" sign /fd sha256 /f certificate.p12 /p $P12_PASSWORD "$file" fi done cpack -G NSIS - signtool.exe sign /fd sha256 /f certificate.p12 /p $P12_PASSWORD "${{ github.workspace }}/build/OrcaSlicer_Windows_Installer_${{ env.ver }}.exe" + "C:/Program Files (x86)/Microsoft SDKs/ClickOnce/SignTool/signtool.exe/signtool.exe" sign /fd sha256 /f certificate.p12 /p $P12_PASSWORD "${{ github.workspace }}/build/OrcaSlicer_Windows_Installer_${{ env.ver }}.exe" # - name: pack app # if: matrix.os == 'windows-2019'