Updated wxWidgets to 3.3.2 (#12941)

# Description

Upgrade wxWidgets to the latest 3.3.2.

The wxWidgets team mentioned that while 3.3 is not labeled “stable,” it
is production-ready. It isn’t labeled “stable” only because it may
introduce breaking ABI/API changes. As Linux distros are moving to
Wayland, and given the number of fixes in wxWidgets to improve Wayland
support, it’s worth upgrading to 3.3.2 instead of staying on 3.2.x.

Note:
I didn’t switch the dark mode implementation to wxWidgets for two
reasons:
1. To avoid broader changes, since the current dark mode works well with
wxWidgets 3.3.2.
2. wxWidgets dark mode doesn’t support changing themes on the fly; it
requires an application restart for the change to take effect.



# Screenshots/Recordings/Graphs

<!--
> Please attach relevant screenshots to showcase the UI changes.
> Please attach images that can help explain the changes.
-->

## Tests

<!--
> Please describe the tests that you have conducted to verify the
changes made in this PR.
-->
This commit is contained in:
SoftFever
2026-03-30 13:54:45 +08:00
committed by GitHub
58 changed files with 345 additions and 410 deletions
-1
View File
@@ -124,7 +124,6 @@ endif()
option(SLIC3R_STATIC "Compile OrcaSlicer with static libraries (Boost, TBB, glew)" ${SLIC3R_STATIC_INITIAL})
option(SLIC3R_GUI "Compile OrcaSlicer with GUI components (OpenGL, wxWidgets)" 1)
option(SLIC3R_FHS "Assume OrcaSlicer is to be installed in a FHS directory structure" 0)
option(SLIC3R_WX_STABLE "Build against wxWidgets stable (3.0) as oppsed to dev (3.1) on Linux" 0)
option(SLIC3R_PROFILE "Compile OrcaSlicer with an invasive Shiny profiler" 0)
option(SLIC3R_PCH "Use precompiled headers" 1)
option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1)
+24 -10
View File
@@ -21,21 +21,13 @@ else ()
set(_wx_edge "-DwxUSE_WEBVIEW_EDGE=OFF")
endif ()
set(_wx_opengl_override "")
if(APPLE AND CMAKE_VERSION VERSION_GREATER_EQUAL "4.0")
set(_wx_opengl_override
-DOPENGL_gl_LIBRARY="-framework OpenGL"
-DOPENGL_glu_LIBRARY="-framework OpenGL"
)
endif()
orcaslicer_add_cmake_project(
wxWidgets
GIT_REPOSITORY "https://github.com/SoftFever/Orca-deps-wxWidgets"
GIT_TAG v3.3.2
GIT_SHALLOW ON
DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} ${JPEG_PKG}
CMAKE_ARGS
${_wx_opengl_override}
-DwxBUILD_PRECOMP=ON
${_wx_toolkit}
"-DCMAKE_DEBUG_POSTFIX:STRING=${_wx_debug_postfix}"
@@ -44,7 +36,6 @@ orcaslicer_add_cmake_project(
${_wx_shared}
-DwxUSE_MEDIACTRL=ON
-DwxUSE_DETECT_SM=OFF
-DwxUSE_UNICODE=ON
-DwxUSE_PRIVATE_FONTS=ON
-DwxUSE_OPENGL=ON
-DwxUSE_GLCANVAS_EGL=OFF
@@ -62,6 +53,29 @@ orcaslicer_add_cmake_project(
-DwxUSE_LIBJPEG=sys
-DwxUSE_LIBTIFF=OFF
-DwxUSE_EXPAT=sys
-DwxUSE_NANOSVG=OFF
)
# wxWidgets 3.3 cmake install doesn't include private headers.
# OrcaSlicer uses some of the private headers (for accessibility support).
# Copy the private headers directory after install.
if(MSVC)
set(_wx_inc_dest ${DESTDIR}/include/wx)
else()
set(_wx_inc_dest ${DESTDIR}/include/wx-3.3/wx)
endif()
ExternalProject_Add_Step(dep_wxWidgets copy_private_headers
DEPENDEES install
COMMENT "Copying wxWidgets private headers"
COMMAND ${CMAKE_COMMAND} -E copy_directory
<SOURCE_DIR>/include/wx/private
${_wx_inc_dest}/private
COMMAND ${CMAKE_COMMAND} -E copy_directory
<SOURCE_DIR>/include/wx/generic/private
${_wx_inc_dest}/generic/private
COMMAND ${CMAKE_COMMAND} -E copy_directory
<SOURCE_DIR>/include/wx/gtk/private
${_wx_inc_dest}/gtk/private
)
if (MSVC)
@@ -97,7 +97,6 @@ modules:
- -DBUILD_SHARED_LIBS=ON
- -DwxUSE_MEDIACTRL=ON
- -DwxUSE_DETECT_SM=OFF
- -DwxUSE_UNICODE=ON
- -DwxUSE_PRIVATE_FONTS=ON
- -DwxUSE_OPENGL=ON
- -DwxUSE_GLCANVAS_EGL=OFF
@@ -119,9 +118,12 @@ modules:
- -DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=lld
- -DCMAKE_MODULE_LINKER_FLAGS=-fuse-ld=lld
sources:
- type: archive
url: https://github.com/SoftFever/Orca-deps-wxWidgets/archive/refs/tags/orca-3.1.5-1.tar.gz
sha256: 1dc9d3865d899cb71c27a7e549aa5491e832ef6e81a7b6653ccb11f9c37fa99d
# Use git instead of archive: wxWidgets 3.3 relies on multiple git
# submodules (PCRE2, etc.) that are not included in GitHub tarballs.
- type: git
url: https://github.com/SoftFever/Orca-deps-wxWidgets.git
tag: orca-3.3.2
commit: db1005db3dea2c37a46fb455a9a02e37aa360751
# OrcaSlicer C++ dependencies (built offline with pre-downloaded archives)
- name: orca_deps
+5 -7
View File
@@ -30,20 +30,18 @@ if (SLIC3R_GUI)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set (wxWidgets_CONFIG_OPTIONS "--toolkit=gtk${SLIC3R_GTK}")
if (SLIC3R_WX_STABLE)
find_package(wxWidgets 3.0 REQUIRED COMPONENTS base core adv html gl aui net media webview)
else ()
find_package(wxWidgets 3.1 REQUIRED COMPONENTS base core adv html gl aui net media webview)
endif ()
find_package(wxWidgets 3.3 REQUIRED COMPONENTS base core adv html gl aui net media webview)
else ()
find_package(wxWidgets 3.1 REQUIRED COMPONENTS html adv gl core base webview aui net media)
find_package(wxWidgets 3.3 CONFIG REQUIRED COMPONENTS html adv gl core base webview aui net media)
endif ()
if(UNIX)
message(STATUS "wx-config path: ${wxWidgets_CONFIG_EXECUTABLE}")
endif()
include(${wxWidgets_USE_FILE})
if(wxWidgets_USE_FILE)
include(${wxWidgets_USE_FILE})
endif()
find_package(JPEG QUIET)
+1
View File
@@ -6,6 +6,7 @@
#define NOMINMAX
#include <Windows.h>
#include <wchar.h>
#include <commctrl.h>
#ifdef SLIC3R_GUI
extern "C"
{
+2 -2
View File
@@ -618,7 +618,7 @@ void AMSSettingTypePanel::CreateGui()
h_sizer->AddStretchSpacer();
h_sizer->Add(m_type_combobox, 0, wxEXPAND);
h_sizer->Add(m_switching_icon, 0, wxALIGN_CENTER);
h_sizer->Add(m_switching_tips, 0, wxEXPAND | wxLEFT | wxALIGN_CENTER, FromDIP(8));
h_sizer->Add(m_switching_tips, 0, wxEXPAND | wxLEFT, FromDIP(8));
SetSizer(h_sizer);
Layout();
Fit();
@@ -754,7 +754,7 @@ void AMSSettingArrangeAMSOrder::CreateGui()
m_btn_rearrange->Bind(wxEVT_BUTTON, &AMSSettingArrangeAMSOrder::OnBtnRearrangeClicked, this);
h_sizer->Add(title, 0);
h_sizer->AddStretchSpacer();
h_sizer->Add(m_btn_rearrange, 0, wxEXPAND | wxALIGN_CENTER_VERTICAL);
h_sizer->Add(m_btn_rearrange, 0, wxEXPAND);
SetSizer(h_sizer);
Layout();
Fit();
+2 -1
View File
@@ -293,7 +293,8 @@ AboutDialog::AboutDialog()
find_txt += text_list[i][o];
count_txt += text_list[i][o];
} else {
find_txt += std::string("\n") + text_list[i][o];
find_txt += "\n";
find_txt += text_list[i][o];
count_txt = text_list[i][o];
}
}
+2 -2
View File
@@ -717,7 +717,7 @@ AmsMapingPopup::AmsMapingPopup(wxWindow *parent, bool use_in_sync_dialog) :
m_sizer_ams_right_horizonal->AddStretchSpacer();
m_sizer_ams_right_horizonal->AddSpacer(FromDIP(5));
m_sizer_ams_right_horizonal->Add(m_reset_btn, 0, wxALIGN_TOP | wxEXPAND );
m_sizer_ams_right_horizonal->Add(m_reset_btn, 0, wxEXPAND );
m_reset_btn->Hide();
m_right_first_text_panel->SetSizer(m_sizer_ams_right_horizonal);
const int same_height = 15;
@@ -813,7 +813,7 @@ void AmsMapingPopup::msw_rescale()
m_split_left_line->SetMaxSize(wxSize(-1, 1));
sizer_split_ams->Add(0, 0, 0, wxEXPAND, 0);
sizer_split_ams->Add(ams_title_text, 0, wxALIGN_CENTER, 0);
sizer_split_ams->Add(m_split_left_line, 1, wxALIGN_CENTER_VERTICAL | wxEXPAND, 0);
sizer_split_ams->Add(m_split_left_line, 1, wxEXPAND, 0);
return sizer_split_ams;
}
+4 -3
View File
@@ -368,7 +368,7 @@ void AuFile::on_input_enter(wxCommandEvent &evt)
auto new_fullname = new_file_name + m_file_path.extension().string();
wxString new_fullname_path = dir.wstring() + "/" + new_fullname;
wxString new_fullname_path = wxString(dir.wstring()) + "/" + new_fullname;
fs::path new_dir_path(new_fullname_path.ToStdWstring());
@@ -955,7 +955,8 @@ void AuxiliaryPanel::on_import_file(wxCommandEvent &event)
}
if (!is_exist) {
dir_path += "/" + src_bfs_path.filename().generic_wstring();
dir_path += "/";
dir_path += src_bfs_path.filename().generic_wstring();
} else {
time_t t1 = time(0);
char ch1[64];
@@ -965,7 +966,7 @@ void AuxiliaryPanel::on_import_file(wxCommandEvent &event)
wxString name = src_bfs_path.filename().generic_wstring();
auto before_name = replaceSpace(name.ToStdString(), src_bfs_path.extension().string(), "");
time_text = replaceSpace(time_text, ":", "_");
dir_path += "/" + before_name + "_" + time_text + src_bfs_path.extension().wstring();
dir_path += wxString("/") + before_name + "_" + time_text + src_bfs_path.extension().wstring();
}
+6 -3
View File
@@ -332,9 +332,12 @@ wxDataViewItemArray AuxiliaryModel::ImportFile(AuxiliaryModelNode* sel, wxArrayS
// Copy imported file to project temp directory
fs::path src_bfs_path(file_path.ToStdWstring());
wxString dir_path = m_root_dir;
if (sel != m_root)
dir_path += "\\" + sel->name;
dir_path += "\\" + src_bfs_path.filename().generic_wstring();
if (sel != m_root) {
dir_path += "\\";
dir_path += sel->name;
}
dir_path += "\\";
dir_path += src_bfs_path.filename().generic_wstring();
boost::system::error_code ec;
if (!fs::copy_file(src_bfs_path, fs::path(dir_path.ToStdWstring()), fs::copy_options::overwrite_existing, ec))
+3 -3
View File
@@ -55,9 +55,9 @@ BBLStatusBar::BBLStatusBar(wxWindow *parent, int id)
m_cancelbutton->Hide();
});
m_sizer->Add(m_object_info_sizer, 1, wxEXPAND | wxALL | wxALIGN_LEFT, 5);
m_sizer->Add(m_slice_info_sizer, 1, wxEXPAND | wxALL | wxALIGN_LEFT, 5);
m_sizer->Add(m_status_text, 1, wxEXPAND | wxALL | wxALIGN_LEFT, 5);
m_sizer->Add(m_object_info_sizer, 1, wxEXPAND | wxALL, 5);
m_sizer->Add(m_slice_info_sizer, 1, wxEXPAND | wxALL, 5);
m_sizer->Add(m_status_text, 1, wxEXPAND | wxALL, 5);
m_sizer->Add(m_prog, 0, wxEXPAND | wxLEFT | wxALL, 5);
m_sizer->Add(m_cancelbutton, 0, wxEXPAND | wxALL, 5);
m_sizer->SetSizeHints(m_self);
+1
View File
@@ -2,6 +2,7 @@
#include "wx/artprov.h"
#include "wx/aui/framemanager.h"
#include "wx/display.h"
#include <wx/utils.h>
#include "I18N.hpp"
#include "GUI_App.hpp"
#include "GUI.hpp"
+4 -2
View File
@@ -91,8 +91,9 @@ BitmapComboBox::~BitmapComboBox()
}
#ifdef __APPLE__
bool BitmapComboBox::OnAddBitmap(const wxBitmap& bitmap)
bool BitmapComboBox::OnAddBitmap(const wxBitmapBundle& bundle)
{
wxBitmap bitmap = bundle.GetBitmap(bundle.GetDefaultSize());
if (bitmap.IsOk())
{
// we should use scaled! size values of bitmap
@@ -131,7 +132,8 @@ void BitmapComboBox::OnDrawItem(wxDC& dc,
int item,
int flags) const
{
const wxBitmap& bmp = *(static_cast<wxBitmap*>(m_bitmaps[item]));
const wxBitmapBundle& bundle = m_bitmapbundles[item];
wxBitmap bmp = bundle.GetBitmap(bundle.GetDefaultSize());
if (bmp.IsOk())
{
// we should use scaled! size values of bitmap
+1 -1
View File
@@ -47,7 +47,7 @@ protected:
* For this purpose control drawing methods and
* control size calculation methods (virtual) are overridden.
**/
bool OnAddBitmap(const wxBitmap& bitmap) override;
bool OnAddBitmap(const wxBitmapBundle& bitmap) override;
void OnDrawItem(wxDC& dc, const wxRect& rect, int item, int flags) const override;
#endif
@@ -1139,8 +1139,8 @@ void CalibrationPresetPage::create_multi_extruder_filament_list_panel(wxWindow *
else {
m_main_sizer->GetStaticBox()->SetLabel(_L("Right Nozzle"));
m_deputy_sizer->GetStaticBox()->SetLabel(_L("Left Nozzle"));
m_multi_exturder_ams_sizer->Add(m_deputy_sizer, 1, wxEXPAND | wxALL | wxALIGN_BOTTOM, 10);
m_multi_exturder_ams_sizer->Add(m_main_sizer, 1, wxEXPAND | wxALL | wxALIGN_BOTTOM, 10);
m_multi_exturder_ams_sizer->Add(m_deputy_sizer, 1, wxEXPAND | wxALL, 10);
m_multi_exturder_ams_sizer->Add(m_main_sizer, 1, wxEXPAND | wxALL, 10);
}
m_multi_extruder_ams_panel_sizer->Add(m_multi_exturder_ams_sizer);
@@ -2152,8 +2152,8 @@ void CalibrationPresetPage::init_with_machine(MachineObject* obj)
m_main_sizer->GetStaticBox()->SetLabel(_L("Right Nozzle"));
m_deputy_sizer->GetStaticBox()->SetLabel(_L("Left Nozzle"));
m_multi_exturder_ams_sizer->Add(m_deputy_sizer, 1, wxEXPAND | wxALL | wxALIGN_BOTTOM, 10);
m_multi_exturder_ams_sizer->Add(m_main_sizer, 1, wxEXPAND | wxALL | wxALIGN_BOTTOM, 10);
m_multi_exturder_ams_sizer->Add(m_deputy_sizer, 1, wxEXPAND | wxALL, 10);
m_multi_exturder_ams_sizer->Add(m_main_sizer, 1, wxEXPAND | wxALL, 10);
m_main_extruder_on_left = false;
}
@@ -2163,8 +2163,8 @@ void CalibrationPresetPage::init_with_machine(MachineObject* obj)
m_main_sizer->GetStaticBox()->SetLabel(_L("Left Nozzle"));
m_deputy_sizer->GetStaticBox()->SetLabel(_L("Right Nozzle"));
m_multi_exturder_ams_sizer->Add(m_main_sizer, 1, wxEXPAND | wxALL | wxALIGN_BOTTOM, 10);
m_multi_exturder_ams_sizer->Add(m_deputy_sizer, 1, wxEXPAND | wxALL | wxALIGN_BOTTOM, 10);
m_multi_exturder_ams_sizer->Add(m_main_sizer, 1, wxEXPAND | wxALL, 10);
m_multi_exturder_ams_sizer->Add(m_deputy_sizer, 1, wxEXPAND | wxALL, 10);
m_main_extruder_on_left = true;
}
+2 -1
View File
@@ -7,6 +7,7 @@
#include <wx/progdlg.h>
#include <wx/clipbrd.h>
#include <wx/dcgraph.h>
#include <wx/utils.h>
#include "GUI_App.hpp"
#include <slic3r/GUI/StatusPanel.hpp>
@@ -127,7 +128,7 @@ CameraPopup::CameraPopup(wxWindow *parent)
top_sizer->Add(m_custom_camera_hint, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, FromDIP(5));
top_sizer->Add(0, 0, wxALL, 0);
top_sizer->Add(m_custom_camera_input, 2, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxEXPAND | wxALL, FromDIP(5));
top_sizer->Add(m_custom_camera_input, 2, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL, FromDIP(5));
top_sizer->Add(m_custom_camera_input_confirm, 1, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, FromDIP(5));
main_sizer->Add(top_sizer, 0, wxALL, FromDIP(10));
+1 -1
View File
@@ -46,7 +46,7 @@ CloneDialog::CloneDialog(wxWindow *parent)
m_progress->SetProgressForedColour(StateColor::darkModeColorFor(wxColour("#DFDFDF")));
m_progress->SetDoubleBuffered(true);
m_progress->Hide();
bottom_sizer->Add(m_progress, 2, wxEXPAND | wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(10));
bottom_sizer->Add(m_progress, 2, wxEXPAND | wxLEFT, FromDIP(10));
auto dlg_btns = new DialogButtons(this, {"Fill", "OK", "Cancel"}, "", 1 /*left_aligned*/);
-13
View File
@@ -902,20 +902,7 @@ void PageMaterials::update_lists(int sel_type, int sel_vendor, int last_selected
wxArrayInt sel_printers;
int sel_printers_count = list_printer->GetSelections(sel_printers);
// Does our wxWidgets version support operator== for wxArrayInt ?
#if wxCHECK_VERSION(3, 1, 1)
if (sel_printers != sel_printers_prev) {
#else
auto are_equal = [](const wxArrayInt& arr_first, const wxArrayInt& arr_second) {
if (arr_first.GetCount() != arr_second.GetCount())
return false;
for (size_t i = 0; i < arr_first.GetCount(); i++)
if (arr_first[i] != arr_second[i])
return false;
return true;
};
if (!are_equal(sel_printers, sel_printers_prev)) {
#endif
// Refresh type list
list_type->Clear();
+57 -56
View File
@@ -8,6 +8,7 @@
#include <openssl/evp.h>
#include <wx/dcgraph.h>
#include <wx/tooltip.h>
#include <wx/utils.h>
#include <boost/nowide/cstdio.hpp>
#include "libslic3r/PresetBundle.hpp"
#include "I18N.hpp"
@@ -770,7 +771,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_vendor_item()
wxStaticText *static_vendor_text = new wxStaticText(this, wxID_ANY, _L("Vendor"), wxDefaultPosition, wxDefaultSize);
optionSizer->Add(static_vendor_text, 0, wxEXPAND | wxALL, 0);
optionSizer->SetMinSize(OPTION_SIZE);
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(5));
// Convert all std::any to std::string
std::vector<std::string> string_vendors;
@@ -811,7 +812,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_vendor_item()
event.Skip();
});
m_filament_custom_vendor_input->Hide();
vendor_sizer->Add(textInputSizer, 0, wxEXPAND | wxALIGN_CENTER_VERTICAL, FromDIP(10));
vendor_sizer->Add(textInputSizer, 0, wxEXPAND, FromDIP(10));
wxBoxSizer *comboBoxSizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *checkbox_sizer = new wxBoxSizer(wxHORIZONTAL);
@@ -848,7 +849,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_vendor_item()
comboBoxSizer->Add(vendor_sizer, 0, wxEXPAND | wxTOP, FromDIP(5));
comboBoxSizer->Add(checkbox_sizer, 0, wxEXPAND | wxTOP, FromDIP(5));
horizontal_sizer->Add(comboBoxSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
horizontal_sizer->Add(comboBoxSizer, 0, wxEXPAND | wxALL, FromDIP(5));
return horizontal_sizer;
@@ -862,7 +863,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_type_item()
wxStaticText *static_type_text = new wxStaticText(this, wxID_ANY, _L("Type"), wxDefaultPosition, wxDefaultSize);
optionSizer->Add(static_type_text, 0, wxEXPAND | wxALL, 0);
optionSizer->SetMinSize(OPTION_SIZE);
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(5));
wxArrayString filament_type;
for (const wxString filament : m_system_filament_types_set) {
@@ -876,7 +877,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_type_item()
m_filament_type_combobox->SetLabelColor(DEFAULT_PROMPT_TEXT_COLOUR);
m_filament_type_combobox->Set(filament_type);
comboBoxSizer->Add(m_filament_type_combobox, 0, wxEXPAND | wxALL, 0);
horizontal_sizer->Add(comboBoxSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
horizontal_sizer->Add(comboBoxSizer, 0, wxEXPAND | wxALL, FromDIP(5));
m_filament_type_combobox->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent &e) {
m_filament_type_combobox->SetLabelColor(*wxBLACK);
@@ -908,7 +909,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_serial_item()
wxStaticText *static_serial_text = new wxStaticText(this, wxID_ANY, _L("Serial"), wxDefaultPosition, wxDefaultSize);
optionSizer->Add(static_serial_text, 0, wxEXPAND | wxALL, 0);
optionSizer->SetMinSize(OPTION_SIZE);
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(5));
wxBoxSizer *comboBoxSizer = new wxBoxSizer(wxVERTICAL);
m_filament_serial_input = new TextInput(this, "", "", "", wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE, wxTE_PROCESS_ENTER);
@@ -927,7 +928,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_serial_item()
static_eg_text->SetForegroundColour(wxColour("#6B6B6B"));
static_eg_text->SetFont(::Label::Body_12);
comboBoxSizer->Add(static_eg_text, 0, wxEXPAND | wxTOP, FromDIP(5));
horizontal_sizer->Add(comboBoxSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
horizontal_sizer->Add(comboBoxSizer, 0, wxEXPAND | wxALL, FromDIP(5));
return horizontal_sizer;
}
@@ -940,7 +941,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_filament_preset_item()
wxStaticText *static_filament_preset_text = new wxStaticText(this, wxID_ANY, _L("Filament Preset"), wxDefaultPosition, wxDefaultSize);
optionSizer->Add(static_filament_preset_text, 0, wxEXPAND | wxALL, 0);
optionSizer->SetMinSize(OPTION_SIZE);
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(10));
wxBoxSizer * comboBoxSizer = new wxBoxSizer(wxVERTICAL);
comboBoxSizer->Add(create_radio_item(m_create_type.base_filament, this, wxEmptyString, m_create_type_btns), 0, wxEXPAND | wxALL, 0);
@@ -1015,7 +1016,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_filament_preset_item()
comboBoxSizer->Add(create_radio_item(m_create_type.base_filament_preset, this, wxEmptyString, m_create_type_btns), 0, wxEXPAND | wxTOP, FromDIP(10));
horizontal_sizer->Add(comboBoxSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(comboBoxSizer, 0, wxEXPAND | wxALL, FromDIP(10));
horizontal_sizer->Add(0, 0, 0, wxLEFT, FromDIP(30));
@@ -1031,7 +1032,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_filament_preset_for_printer_item(
m_filament_preset_panel->SetSize(PRINTER_LIST_SIZE);
m_filament_presets_sizer = new wxGridSizer(3, FromDIP(5), FromDIP(5));
m_filament_preset_panel->SetSizer(m_filament_presets_sizer);
vertical_sizer->Add(m_filament_preset_panel, 0, wxEXPAND | wxTOP | wxALIGN_CENTER_HORIZONTAL, FromDIP(5));
vertical_sizer->Add(m_filament_preset_panel, 0, wxEXPAND | wxTOP, FromDIP(5));
return vertical_sizer;
}
@@ -1647,16 +1648,16 @@ wxBoxSizer *CreatePrinterPresetDialog::create_step_switch_item()
step_switch_panel->SetBackgroundColour(*wxWHITE);
horizontal_sizer->Add(0, 0, 1, wxEXPAND,0);
m_step_1 = new wxStaticBitmap(step_switch_panel, wxID_ANY, create_scaled_bitmap("step_1", nullptr, FromDIP(20)), wxDefaultPosition, wxDefaultSize);
horizontal_sizer->Add(m_step_1, 0, wxEXPAND | wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(3));
horizontal_sizer->Add(m_step_1, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(3));
wxStaticText *static_create_printer_text = new wxStaticText(step_switch_panel, wxID_ANY, m_create_type.create_printer, wxDefaultPosition, wxDefaultSize);
horizontal_sizer->Add(static_create_printer_text, 0, wxEXPAND | wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(3));
horizontal_sizer->Add(static_create_printer_text, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(3));
auto divider_line = new wxPanel(step_switch_panel, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(50), 1));
divider_line->SetBackgroundColour(PRINTER_LIST_COLOUR);
horizontal_sizer->Add(divider_line, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(3));
m_step_2 = new wxStaticBitmap(step_switch_panel, wxID_ANY, create_scaled_bitmap("step_2_ready", nullptr, FromDIP(20)), wxDefaultPosition, wxDefaultSize);
horizontal_sizer->Add(m_step_2, 0, wxEXPAND | wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(3));
horizontal_sizer->Add(m_step_2, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(3));
wxStaticText *static_import_presets_text = new wxStaticText(step_switch_panel, wxID_ANY, _L("Import Preset"), wxDefaultPosition, wxDefaultSize);
horizontal_sizer->Add(static_import_presets_text, 0, wxEXPAND | wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(3));
horizontal_sizer->Add(static_import_presets_text, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(3));
horizontal_sizer->Add(0, 0, 1, wxEXPAND, 0);
step_switch_panel->SetSizer(horizontal_sizer);
@@ -1707,13 +1708,13 @@ wxBoxSizer *CreatePrinterPresetDialog::create_type_item(wxWindow *parent)
wxStaticText *static_serial_text = new wxStaticText(parent, wxID_ANY, _L("Create Type"), wxDefaultPosition, wxDefaultSize);
optionSizer->Add(static_serial_text, 0, wxEXPAND | wxALL, 0);
optionSizer->SetMinSize(OPTION_SIZE);
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(10));
wxBoxSizer *radioBoxSizer = new wxBoxSizer(wxVERTICAL);
radioBoxSizer->Add(create_radio_item(m_create_type.create_printer, parent, wxEmptyString, m_create_type_btns), 0, wxEXPAND | wxALL, 0);
radioBoxSizer->Add(create_radio_item(m_create_type.create_nozzle, parent, wxEmptyString, m_create_type_btns), 0, wxEXPAND | wxTOP, FromDIP(10));
horizontal_sizer->Add(radioBoxSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(radioBoxSizer, 0, wxEXPAND | wxALL, FromDIP(10));
return horizontal_sizer;
}
@@ -1726,7 +1727,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_item(wxWindow *parent)
wxStaticText *static_vendor_text = new wxStaticText(parent, wxID_ANY, _L("Printer"), wxDefaultPosition, wxDefaultSize);
optionSizer->Add(static_vendor_text, 0, wxEXPAND | wxALL, 0);
optionSizer->SetMinSize(OPTION_SIZE);
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(10));
wxBoxSizer *vertical_sizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *comboBoxSizer = new wxBoxSizer(wxHORIZONTAL);
@@ -1854,7 +1855,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_item(wxWindow *parent)
vertical_sizer->Add(checkbox_sizer, 0, wxEXPAND | wxTOP, FromDIP(5));
horizontal_sizer->Add(vertical_sizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(vertical_sizer, 0, wxEXPAND | wxALL, FromDIP(10));
return horizontal_sizer;
@@ -1868,7 +1869,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_nozzle_diameter_item(wxWindow *par
wxStaticText *static_type_text = new wxStaticText(parent, wxID_ANY, _L("Nozzle Diameter"), wxDefaultPosition, wxDefaultSize);
optionSizer->Add(static_type_text, 0, wxEXPAND | wxALL, 0);
optionSizer->SetMinSize(OPTION_SIZE);
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(10));
wxBoxSizer *vertical_sizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *comboBoxSizer = new wxBoxSizer(wxHORIZONTAL);
@@ -1933,7 +1934,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_nozzle_diameter_item(wxWindow *par
});
vertical_sizer->Add(checkbox_sizer, 0, wxEXPAND | wxTOP, FromDIP(5));
horizontal_sizer->Add(vertical_sizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(vertical_sizer, 0, wxEXPAND | wxALL, FromDIP(10));
horizontal_sizer->Add(0, 0, 0, wxEXPAND | wxLEFT, FromDIP(200));
return horizontal_sizer;
@@ -1947,12 +1948,12 @@ wxBoxSizer *CreatePrinterPresetDialog::create_bed_shape_item(wxWindow *parent)
wxStaticText *static_type_text = new wxStaticText(parent, wxID_ANY, _L("Bed Shape"), wxDefaultPosition, wxDefaultSize);
optionSizer->Add(static_type_text, 0, wxEXPAND | wxALL, 0);
optionSizer->SetMinSize(OPTION_SIZE);
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(10));
wxBoxSizer * bed_shape_sizer = new wxBoxSizer(wxVERTICAL);
wxStaticText *static_bed_shape_text = new wxStaticText(parent, wxID_ANY, _L("Rectangle"), wxDefaultPosition, wxDefaultSize);
bed_shape_sizer->Add(static_bed_shape_text, 0, wxEXPAND | wxALL, 0);
horizontal_sizer->Add(bed_shape_sizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(bed_shape_sizer, 0, wxEXPAND | wxALL, FromDIP(10));
return horizontal_sizer;
}
@@ -1965,26 +1966,26 @@ wxBoxSizer *CreatePrinterPresetDialog::create_bed_size_item(wxWindow *parent)
wxStaticText *static_type_text = new wxStaticText(parent, wxID_ANY, _L("Printable Space"), wxDefaultPosition, wxDefaultSize);
optionSizer->Add(static_type_text, 0, wxEXPAND | wxALL, 0);
optionSizer->SetMinSize(OPTION_SIZE);
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(10));
wxBoxSizer * length_sizer = new wxBoxSizer(wxVERTICAL);
// ORCA use icon on input box to match style with other Point fields
horizontal_sizer->Add(length_sizer, 0, wxEXPAND | wxLEFT | wxTOP | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(length_sizer, 0, wxEXPAND | wxLEFT | wxTOP, FromDIP(10));
wxBoxSizer *length_input_sizer = new wxBoxSizer(wxVERTICAL);
m_bed_size_x_input = new TextInput(parent, "200", _L("mm"), "inputbox_x", wxDefaultPosition, PRINTER_SPACE_SIZE, wxTE_PROCESS_ENTER);
wxTextValidator validator(wxFILTER_DIGITS);
m_bed_size_x_input->GetTextCtrl()->SetValidator(validator);
length_input_sizer->Add(m_bed_size_x_input, 0, wxEXPAND | wxLEFT, FromDIP(5));
horizontal_sizer->Add(length_input_sizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
horizontal_sizer->Add(length_input_sizer, 0, wxEXPAND | wxALL, FromDIP(5));
wxBoxSizer * width_sizer = new wxBoxSizer(wxVERTICAL);
// ORCA use icon on input box to match style with other Point fields
horizontal_sizer->Add(width_sizer, 0, wxEXPAND | wxLEFT | wxTOP | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(width_sizer, 0, wxEXPAND | wxLEFT | wxTOP, FromDIP(10));
wxBoxSizer *width_input_sizer = new wxBoxSizer(wxVERTICAL);
m_bed_size_y_input = new TextInput(parent, "200", _L("mm"), "inputbox_y", wxDefaultPosition, PRINTER_SPACE_SIZE, wxTE_PROCESS_ENTER);
m_bed_size_y_input->GetTextCtrl()->SetValidator(validator);
width_input_sizer->Add(m_bed_size_y_input, 0, wxEXPAND | wxALL, 0);
horizontal_sizer->Add(width_input_sizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
horizontal_sizer->Add(width_input_sizer, 0, wxEXPAND | wxALL, FromDIP(5));
return horizontal_sizer;
@@ -1998,26 +1999,26 @@ wxBoxSizer *CreatePrinterPresetDialog::create_origin_item(wxWindow *parent)
wxStaticText *static_type_text = new wxStaticText(parent, wxID_ANY, _L("Origin"), wxDefaultPosition, wxDefaultSize);
optionSizer->Add(static_type_text, 0, wxEXPAND | wxALL, 0);
optionSizer->SetMinSize(OPTION_SIZE);
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(10));
wxBoxSizer * length_sizer = new wxBoxSizer(wxVERTICAL);
// ORCA use icon on input box to match style with other Point fields
horizontal_sizer->Add(length_sizer, 0, wxEXPAND | wxLEFT | wxTOP | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(length_sizer, 0, wxEXPAND | wxLEFT | wxTOP, FromDIP(10));
wxBoxSizer *length_input_sizer = new wxBoxSizer(wxVERTICAL);
m_bed_origin_x_input = new TextInput(parent, "0", _L("mm"), "inputbox_x", wxDefaultPosition, PRINTER_SPACE_SIZE, wxTE_PROCESS_ENTER);
wxTextValidator validator(wxFILTER_DIGITS);
m_bed_origin_x_input->GetTextCtrl()->SetValidator(validator);
length_input_sizer->Add(m_bed_origin_x_input, 0, wxEXPAND | wxLEFT, FromDIP(5)); // Align with other
horizontal_sizer->Add(length_input_sizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
horizontal_sizer->Add(length_input_sizer, 0, wxEXPAND | wxALL, FromDIP(5));
wxBoxSizer * width_sizer = new wxBoxSizer(wxVERTICAL);
// ORCA use icon on input box to match style with other Point fields
horizontal_sizer->Add(width_sizer, 0, wxEXPAND | wxLEFT | wxTOP | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(width_sizer, 0, wxEXPAND | wxLEFT | wxTOP, FromDIP(10));
wxBoxSizer *width_input_sizer = new wxBoxSizer(wxVERTICAL);
m_bed_origin_y_input = new TextInput(parent, "0", _L("mm"), "inputbox_y", wxDefaultPosition, PRINTER_SPACE_SIZE, wxTE_PROCESS_ENTER);
m_bed_origin_y_input->GetTextCtrl()->SetValidator(validator);
width_input_sizer->Add(m_bed_origin_y_input, 0, wxEXPAND | wxALL, 0);
horizontal_sizer->Add(width_input_sizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
horizontal_sizer->Add(width_input_sizer, 0, wxEXPAND | wxALL, FromDIP(5));
return horizontal_sizer;
}
@@ -2030,7 +2031,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_hot_bed_stl_item(wxWindow *parent)
wxStaticText *static_type_text = new wxStaticText(parent, wxID_ANY, _L("Hot Bed STL"), wxDefaultPosition, wxDefaultSize);
optionSizer->Add(static_type_text, 0, wxEXPAND | wxALL, 0);
optionSizer->SetMinSize(OPTION_SIZE);
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(10));
wxBoxSizer *hot_bed_stl_sizer = new wxBoxSizer(wxVERTICAL);
@@ -2040,11 +2041,11 @@ wxBoxSizer *CreatePrinterPresetDialog::create_hot_bed_stl_item(wxWindow *parent)
hot_bed_stl_sizer->Add(m_button_bed_stl, 0, wxEXPAND | wxALL, 0);
horizontal_sizer->Add(hot_bed_stl_sizer, 0, wxEXPAND | wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(hot_bed_stl_sizer, 0, wxEXPAND | wxLEFT, FromDIP(10));
m_upload_stl_tip_text = new wxStaticText(parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize);
m_upload_stl_tip_text->SetLabelText(_L("Empty"));
horizontal_sizer->Add(m_upload_stl_tip_text, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(m_upload_stl_tip_text, 0, wxEXPAND | wxALL, FromDIP(10));
return horizontal_sizer;
}
@@ -2056,7 +2057,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_hot_bed_svg_item(wxWindow *parent)
wxStaticText *static_type_text = new wxStaticText(parent, wxID_ANY, _L("Hot Bed SVG"), wxDefaultPosition, wxDefaultSize);
optionSizer->Add(static_type_text, 0, wxEXPAND | wxALL, 0);
optionSizer->SetMinSize(OPTION_SIZE);
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(10));
wxBoxSizer *hot_bed_stl_sizer = new wxBoxSizer(wxVERTICAL);
@@ -2066,11 +2067,11 @@ wxBoxSizer *CreatePrinterPresetDialog::create_hot_bed_svg_item(wxWindow *parent)
hot_bed_stl_sizer->Add(m_button_bed_svg, 0, wxEXPAND | wxALL, 0);
horizontal_sizer->Add(hot_bed_stl_sizer, 0, wxEXPAND | wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(hot_bed_stl_sizer, 0, wxEXPAND | wxLEFT, FromDIP(10));
m_upload_svg_tip_text = new wxStaticText(parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize);
m_upload_svg_tip_text->SetLabelText(_L("Empty"));
horizontal_sizer->Add(m_upload_svg_tip_text, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(m_upload_svg_tip_text, 0, wxEXPAND | wxALL, FromDIP(10));
return horizontal_sizer;
}
@@ -2082,14 +2083,14 @@ wxBoxSizer *CreatePrinterPresetDialog::create_max_print_height_item(wxWindow *pa
wxStaticText *static_type_text = new wxStaticText(parent, wxID_ANY, _L("Max Print Height"), wxDefaultPosition, wxDefaultSize);
optionSizer->Add(static_type_text, 0, wxEXPAND | wxALL, 0);
optionSizer->SetMinSize(OPTION_SIZE);
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(10));
wxBoxSizer *hight_input_sizer = new wxBoxSizer(wxVERTICAL);
m_print_height_input = new TextInput(parent, "200", _L("mm"), wxEmptyString, wxDefaultPosition, PRINTER_SPACE_SIZE, wxTE_PROCESS_ENTER); // Use same alignment with all other input boxes
wxTextValidator validator(wxFILTER_DIGITS);
m_print_height_input->GetTextCtrl()->SetValidator(validator);
hight_input_sizer->Add(m_print_height_input, 0, wxEXPAND | wxLEFT, FromDIP(5));
horizontal_sizer->Add(hight_input_sizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
horizontal_sizer->Add(hight_input_sizer, 0, wxEXPAND | wxALL, FromDIP(5));
return horizontal_sizer;
}
@@ -2595,7 +2596,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_preset_item(wxWindow *pare
wxStaticText *static_vendor_text = new wxStaticText(parent, wxID_ANY, _L("Printer Preset"), wxDefaultPosition, wxDefaultSize);
optionSizer->Add(static_vendor_text, 0, wxEXPAND | wxALL, 0);
optionSizer->SetMinSize(OPTION_SIZE);
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(10));
wxBoxSizer * vertical_sizer = new wxBoxSizer(wxVERTICAL);
wxStaticText *combobox_title = new wxStaticText(parent, wxID_ANY, m_create_type.base_curr_printer, wxDefaultPosition, wxDefaultSize, 0);
@@ -2628,7 +2629,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_preset_item(wxWindow *pare
comboBox_sizer->Add(m_printer_model, 0, wxEXPAND | wxLEFT, FromDIP(10));
vertical_sizer->Add(comboBox_sizer, 0, wxEXPAND | wxTOP, FromDIP(5));
horizontal_sizer->Add(vertical_sizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(vertical_sizer, 0, wxEXPAND | wxALL, FromDIP(10));
return horizontal_sizer;
@@ -2642,13 +2643,13 @@ wxBoxSizer *CreatePrinterPresetDialog::create_presets_item(wxWindow *parent)
wxStaticText *static_serial_text = new wxStaticText(parent, wxID_ANY, _L("Presets"), wxDefaultPosition, wxDefaultSize);
optionSizer->Add(static_serial_text, 0, wxEXPAND | wxALL, 0);
optionSizer->SetMinSize(OPTION_SIZE);
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(10));
wxBoxSizer *radioBoxSizer = new wxBoxSizer(wxVERTICAL);
radioBoxSizer->Add(create_radio_item(m_create_type.base_template, parent, wxEmptyString, m_create_presets_btns), 0, wxEXPAND | wxALL, 0);
radioBoxSizer->Add(create_radio_item(m_create_type.base_curr_printer, parent, wxEmptyString, m_create_presets_btns), 0, wxEXPAND | wxTOP, FromDIP(10));
horizontal_sizer->Add(radioBoxSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(radioBoxSizer, 0, wxEXPAND | wxALL, FromDIP(10));
return horizontal_sizer;
}
@@ -2734,7 +2735,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_presets_template_item(wxWindow *pa
m_preset_template_panel->SetSizer(m_filament_sizer);
m_scrooled_preset_sizer->Add(m_preset_template_panel, 0, wxEXPAND | wxALL, 0);
m_scrolled_preset_window->SetSizerAndFit(m_scrooled_preset_sizer);
vertical_sizer->Add(m_scrolled_preset_window, 0, wxEXPAND | wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(10));
vertical_sizer->Add(m_scrolled_preset_window, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(10));
return vertical_sizer;
}
@@ -3721,7 +3722,7 @@ wxBoxSizer *ExportConfigsDialog::create_export_config_item(wxWindow *parent)
wxStaticText *static_serial_text = new wxStaticText(parent, wxID_ANY, _L("Presets"), wxDefaultPosition, wxDefaultSize);
optionSizer->Add(static_serial_text, 0, wxEXPAND | wxALL, 0);
optionSizer->SetMinSize(OPTION_SIZE);
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(10));
wxBoxSizer *radioBoxSizer = new wxBoxSizer(wxVERTICAL);
@@ -3741,7 +3742,7 @@ wxBoxSizer *ExportConfigsDialog::create_export_config_item(wxWindow *parent)
radioBoxSizer->Add(create_radio_item(m_exprot_type.printer_preset, parent, wxEmptyString, m_export_type_btns), 0, wxEXPAND | wxTOP, FromDIP(10));
radioBoxSizer->Add(create_radio_item(m_exprot_type.filament_preset, parent, wxEmptyString, m_export_type_btns), 0, wxEXPAND | wxTOP, FromDIP(10));
radioBoxSizer->Add(create_radio_item(m_exprot_type.process_preset, parent, wxEmptyString, m_export_type_btns), 0, wxEXPAND | wxTOP, FromDIP(10));
horizontal_sizer->Add(radioBoxSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(radioBoxSizer, 0, wxEXPAND | wxALL, FromDIP(10));
return horizontal_sizer;
}
@@ -4284,7 +4285,7 @@ wxBoxSizer *ExportConfigsDialog::create_select_printer(wxWindow *parent)
m_serial_text = new wxStaticText(parent, wxID_ANY, _L("Please select a type you want to export"), wxDefaultPosition, wxDefaultSize);
optionSizer->Add(m_serial_text, 0, wxEXPAND | wxALL, 0);
optionSizer->SetMinSize(OPTION_SIZE);
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(10));
m_scrolled_preset_window = new wxScrolledWindow(parent);
m_scrolled_preset_window->SetScrollRate(5, 5);
m_scrolled_preset_window->SetBackgroundColour(*wxWHITE);
@@ -4453,7 +4454,7 @@ EditFilamentPresetDialog::EditFilamentPresetDialog(wxWindow *parent, Filamentinf
m_main_sizer->Add(create_add_filament_btn(), 0, wxEXPAND | wxALL, 0);
m_main_sizer->Add(create_preset_tree_sizer(), 0, wxEXPAND | wxALL, 0);
m_note_text = new wxStaticText(this, wxID_ANY, _L("Note: If the only preset under this filament is deleted, the filament will be deleted after exiting the dialog."));
m_main_sizer->Add(m_note_text, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, FromDIP(10));
m_main_sizer->Add(m_note_text, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(10));
m_note_text->Hide();
m_main_sizer->Add(create_dialog_buttons(), 0, wxEXPAND);
@@ -4655,31 +4656,31 @@ wxBoxSizer *EditFilamentPresetDialog::create_filament_basic_info()
wxStaticText *static_vendor_text = new wxStaticText(this, wxID_ANY, _L("Vendor"), wxDefaultPosition, wxDefaultSize);
vendor_key_sizer->Add(static_vendor_text, 0, wxEXPAND | wxALL, 0);
vendor_key_sizer->SetMinSize(OPTION_SIZE);
vendor_sizer->Add(vendor_key_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, FromDIP(10));
vendor_sizer->Add(vendor_key_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(10));
wxBoxSizer *vendor_value_sizer = new wxBoxSizer(wxVERTICAL);
wxStaticText *vendor_text = new wxStaticText(this, wxID_ANY, from_u8(m_vendor_name), wxDefaultPosition, wxDefaultSize);
vendor_value_sizer->Add(vendor_text, 0, wxEXPAND | wxALL, 0);
vendor_sizer->Add(vendor_value_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, FromDIP(10));
vendor_sizer->Add(vendor_value_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(10));
//type
wxBoxSizer * type_key_sizer = new wxBoxSizer(wxVERTICAL);
wxStaticText *static_type_text = new wxStaticText(this, wxID_ANY, _L("Type"), wxDefaultPosition, wxDefaultSize);
type_key_sizer->Add(static_type_text, 0, wxEXPAND | wxALL, 0);
type_key_sizer->SetMinSize(OPTION_SIZE);
type_sizer->Add(type_key_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, FromDIP(10));
type_sizer->Add(type_key_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(10));
wxBoxSizer * type_value_sizer = new wxBoxSizer(wxVERTICAL);
wxStaticText *type_text = new wxStaticText(this, wxID_ANY, from_u8(m_filament_type), wxDefaultPosition, wxDefaultSize);
type_value_sizer->Add(type_text, 0, wxEXPAND | wxALL, 0);
type_sizer->Add(type_value_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, FromDIP(10));
type_sizer->Add(type_value_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(10));
//serial
wxBoxSizer * serial_key_sizer = new wxBoxSizer(wxVERTICAL);
wxStaticText *static_serial_text = new wxStaticText(this, wxID_ANY, _L("Serial"), wxDefaultPosition, wxDefaultSize);
serial_key_sizer->Add(static_serial_text, 0, wxEXPAND | wxALL, 0);
serial_key_sizer->SetMinSize(OPTION_SIZE);
serial_sizer->Add(serial_key_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, FromDIP(10));
serial_sizer->Add(serial_key_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(10));
wxBoxSizer * serial_value_sizer = new wxBoxSizer(wxVERTICAL);
wxString full_filamnet_serial = from_u8(m_filament_serial);
@@ -4691,7 +4692,7 @@ wxBoxSizer *EditFilamentPresetDialog::create_filament_basic_info()
wxToolTip * toolTip = new wxToolTip(full_filamnet_serial);
serial_text->SetToolTip(toolTip);
serial_value_sizer->Add(serial_text, 0, wxEXPAND | wxALL, 0);
serial_sizer->Add(serial_value_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, FromDIP(10));
serial_sizer->Add(serial_value_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(10));
basic_info_sizer->Add(vendor_sizer, 0, wxEXPAND | wxALL, 0);
basic_info_sizer->Add(type_sizer, 0, wxEXPAND | wxALL, 0);
@@ -4738,7 +4739,7 @@ wxBoxSizer *EditFilamentPresetDialog::create_preset_tree_sizer()
wxBoxSizer* m_preset_tree_window_sizer = new wxBoxSizer(wxVERTICAL);
m_preset_tree_window_sizer->Add(m_preset_tree_panel, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(10));
m_preset_tree_window->SetSizerAndFit(m_preset_tree_window_sizer);
filament_preset_tree_sizer->Add(m_preset_tree_window, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
filament_preset_tree_sizer->Add(m_preset_tree_window, 0, wxEXPAND | wxALL, FromDIP(10));
return filament_preset_tree_sizer;
}
+4 -6
View File
@@ -17,15 +17,13 @@ void open_folder(const std::string& path)
// Code taken from NotificationManager.cpp
// Execute command to open a file explorer, platform dependent.
// FIXME: The const_casts aren't needed in wxWidgets 3.1, remove them when we upgrade.
#ifdef _WIN32
const wxString widepath = from_u8(path);
const wchar_t* argv[] = { L"explorer", widepath.GetData(), nullptr };
::wxExecute(const_cast<wchar_t**>(argv), wxEXEC_ASYNC, nullptr);
::wxExecute(argv, wxEXEC_ASYNC, nullptr);
#elif __APPLE__
const char* argv[] = { "open", path.data(), nullptr };
::wxExecute(const_cast<char**>(argv), wxEXEC_ASYNC, nullptr);
::wxExecute(argv, wxEXEC_ASYNC, nullptr);
#else
const char* argv[] = { "xdg-open", path.data(), nullptr };
@@ -53,11 +51,11 @@ void open_folder(const std::string& path)
exec_env.cwd = std::move(owd);
}
::wxExecute(const_cast<char**>(argv), wxEXEC_ASYNC, nullptr, &exec_env);
::wxExecute(argv, wxEXEC_ASYNC, nullptr, &exec_env);
}
else {
// Looks like we're NOT running from AppImage, we'll make no changes to the environment.
::wxExecute(const_cast<char**>(argv), wxEXEC_ASYNC, nullptr, nullptr);
::wxExecute(argv, wxEXEC_ASYNC, nullptr, nullptr);
}
#endif
}
+1 -1
View File
@@ -5,7 +5,7 @@
#include <wx/dataview.h>
#if wxUSE_MARKUP && wxCHECK_VERSION(3, 1, 1)
#if wxUSE_MARKUP
#define SUPPORTS_MARKUP
#endif
+1 -1
View File
@@ -2308,7 +2308,7 @@ void SliderCtrl::BUILD()
m_textctrl->SetFont(Slic3r::GUI::wxGetApp().normal_font());
m_textctrl->SetBackgroundStyle(wxBG_STYLE_PAINT);
temp->Add(m_slider, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL, 0);
temp->Add(m_slider, 1, wxEXPAND, 0);
temp->Add(m_textctrl, 0, wxALIGN_CENTER_VERTICAL, 0);
m_slider->Bind(wxEVT_SLIDER, ([this](wxCommandEvent e) {
+3 -3
View File
@@ -169,9 +169,9 @@ FilamentMapDialog::FilamentMapDialog(wxWindow *parent,
else
m_default_map_panel = nullptr;
panel_sizer->Add(m_manual_map_panel, 0, wxALIGN_CENTER | wxEXPAND);
panel_sizer->Add(m_auto_map_panel, 0, wxALIGN_CENTER | wxEXPAND);
if (show_default) panel_sizer->Add(m_default_map_panel, 0, wxALIGN_CENTER | wxEXPAND);
panel_sizer->Add(m_manual_map_panel, 0, wxEXPAND);
panel_sizer->Add(m_auto_map_panel, 0, wxEXPAND);
if (show_default) panel_sizer->Add(m_default_map_panel, 0, wxEXPAND);
main_sizer->Add(panel_sizer, 0, wxEXPAND);
wxPanel* bottom_panel = new wxPanel(this);
+9 -8
View File
@@ -1,6 +1,7 @@
#include "FilamentMapPanel.hpp"
#include "GUI_App.hpp"
#include <wx/dcbuffer.h>
#include <wx/utils.h>
#include "wx/graphics.h"
namespace Slic3r { namespace GUI {
@@ -54,14 +55,14 @@ FilamentMapManualPanel::FilamentMapManualPanel(wxWindow *p
m_right_panel->SetMinSize({ FromDIP(260),-1 });
drag_sizer->AddStretchSpacer();
drag_sizer->Add(m_left_panel, 1, wxALIGN_CENTER | wxEXPAND);
drag_sizer->Add(m_left_panel, 1, wxEXPAND);
drag_sizer->AddSpacer(FromDIP(7));
drag_sizer->Add(m_switch_btn, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, FromDIP(1));
drag_sizer->AddSpacer(FromDIP(7));
drag_sizer->Add(m_right_panel, 1, wxALIGN_CENTER | wxEXPAND);
drag_sizer->Add(m_right_panel, 1, wxEXPAND);
drag_sizer->AddStretchSpacer();
top_sizer->Add(drag_sizer, 0, wxALIGN_CENTER | wxEXPAND);
top_sizer->Add(drag_sizer, 0, wxEXPAND);
m_tips = new Label(this, _L("Tip: You can drag the filaments to reassign them to different nozzles."));
m_tips->SetFont(Label::Body_14);
@@ -133,14 +134,14 @@ GUI::FilamentMapBtnPanel::FilamentMapBtnPanel(wxWindow *parent, const wxString &
auto label_sizer = new wxBoxSizer(wxHORIZONTAL);
label_sizer->AddStretchSpacer();
label_sizer->Add(m_btn, 0, wxALIGN_CENTER | wxEXPAND | wxLEFT, FromDIP(1));
label_sizer->Add(m_label, 0, wxALIGN_CENTER | wxEXPAND| wxALL, FromDIP(3));
label_sizer->Add(m_btn, 0, wxEXPAND | wxLEFT, FromDIP(1));
label_sizer->Add(m_label, 0, wxEXPAND| wxALL, FromDIP(3));
label_sizer->AddStretchSpacer();
m_disable_tip = new Label(this, _L("(Sync with printer)"));
sizer->AddSpacer(FromDIP(32));
sizer->Add(label_sizer, 0, wxALIGN_CENTER | wxEXPAND);
sizer->Add(label_sizer, 0, wxEXPAND);
sizer->Add(m_disable_tip, 0, wxALIGN_CENTER);
sizer->AddSpacer(FromDIP(3));
@@ -154,7 +155,7 @@ GUI::FilamentMapBtnPanel::FilamentMapBtnPanel(wxWindow *parent, const wxString &
detail_sizer->Add(m_detail, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, horizontal_margin);
detail_sizer->AddStretchSpacer();
sizer->Add(detail_sizer, 0, wxALIGN_CENTER | wxEXPAND);
sizer->Add(detail_sizer, 0, wxEXPAND);
sizer->AddSpacer(FromDIP(10));
SetSizer(sizer);
@@ -364,7 +365,7 @@ FilamentMapDefaultPanel::FilamentMapDefaultPanel(wxWindow *parent) : wxPanel(par
m_label->Wrap(FromDIP(500));
sizer->AddStretchSpacer();
sizer->Add(m_label, 1, wxEXPAND | wxALIGN_CENTER);
sizer->Add(m_label, 1, wxEXPAND);
sizer->AddStretchSpacer();
SetSizerAndFit(sizer);
+1
View File
@@ -39,6 +39,7 @@
#include <boost/nowide/fstream.hpp>
#include <wx/progdlg.h>
#include <wx/numformatter.h>
#include <wx/utils.h>
#include <array>
#include <algorithm>
+33 -10
View File
@@ -53,6 +53,7 @@
#include <wx/settings.h>
#include <wx/tooltip.h>
#include <wx/debug.h>
#include <wx/utils.h>
#include <wx/fontutil.h>
// Print now includes tbb, and tbb includes Windows. This breaks compilation of wxWidgets if included before wx.
#include "libslic3r/Print.hpp"
@@ -78,6 +79,13 @@
#include <imguizmo/ImGuizmo.h>
#ifdef __WXMSW__
#if wxUSE_POPUPWIN
#include <wx/popupwin.h>
extern wxPopupWindow* wxCurrentPopupWindow;
#endif
#endif
static constexpr const float TRACKBALLSIZE = 0.8f;
static Slic3r::ColorRGBA DEFAULT_BG_LIGHT_COLOR = { 0.906f, 0.906f, 0.906f, 1.0f };
@@ -4257,14 +4265,21 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
if (evt.Entering()) {
// Set focus in order to remove it from sidebar fields and ensure hotkeys work
if (m_canvas != nullptr) {
// Only set focus if the top level window of this canvas is active.
auto p = dynamic_cast<wxWindow*>(evt.GetEventObject());
while (p->GetParent())
p = p->GetParent();
auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(p);
//Orca: Set focus so hotkeys like 'tab' work when a notification is shown.
if (top_level_wnd != nullptr && top_level_wnd->IsActive())
m_canvas->SetFocus();
#if defined(__WXMSW__) && wxUSE_POPUPWIN
// Don't steal focus when a popup window is active (e.g., search dropdown).
// Stealing focus triggers MSWDismissUnfocusedPopup, closing the popup unexpectedly.
if (!wxCurrentPopupWindow)
#endif
{
// Only set focus if the top level window of this canvas is active.
auto p = dynamic_cast<wxWindow*>(evt.GetEventObject());
while (p->GetParent())
p = p->GetParent();
auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(p);
//Orca: Set focus so hotkeys like 'tab' work when a notification is shown.
if (top_level_wnd != nullptr && top_level_wnd->IsActive())
m_canvas->SetFocus();
}
m_mouse.position = pos.cast<double>();
m_tooltip_enabled = false;
// 1) forces a frame render to ensure that m_hover_volume_idxs is updated even when the user right clicks while
@@ -4724,11 +4739,19 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
void GLCanvas3D::on_paint(wxPaintEvent& evt)
{
if (m_initialized)
if (m_initialized) {
#ifdef __WXMSW__
// Idle events are not dispatched during the Windows resize modal loop,
// so render immediately to avoid blank frames.
_refresh_if_shown_on_screen();
m_dirty = false;
#else
m_dirty = true;
else
#endif
} else {
// Call render directly, so it gets initialized immediately, not from On Idle handler.
this->render();
}
}
void GLCanvas3D::force_set_focus() {
+8 -11
View File
@@ -461,7 +461,7 @@ unsigned int combochecklist_get_flags(wxComboCtrl* comboCtrl)
{
unsigned int flags = 0;
wxCheckListBoxComboPopup* popup = wxDynamicCast(comboCtrl->GetPopupControl(), wxCheckListBoxComboPopup);
wxCheckListBoxComboPopup* popup = dynamic_cast<wxCheckListBoxComboPopup*>(comboCtrl->GetPopupControl());
if (popup != nullptr) {
for (unsigned int i = 0; i < popup->GetCount(); ++i) {
if (popup->IsChecked(i))
@@ -474,7 +474,7 @@ unsigned int combochecklist_get_flags(wxComboCtrl* comboCtrl)
void combochecklist_set_flags(wxComboCtrl* comboCtrl, unsigned int flags)
{
wxCheckListBoxComboPopup* popup = wxDynamicCast(comboCtrl->GetPopupControl(), wxCheckListBoxComboPopup);
wxCheckListBoxComboPopup* popup = dynamic_cast<wxCheckListBoxComboPopup*>(comboCtrl->GetPopupControl());
if (popup != nullptr) {
for (unsigned int i = 0; i < popup->GetCount(); ++i) {
popup->Check(i, (flags & (1 << i)) != 0);
@@ -530,16 +530,14 @@ void login()
void desktop_open_datadir_folder()
{
// Execute command to open a file explorer, platform dependent.
// FIXME: The const_casts aren't needed in wxWidgets 3.1, remove them when we upgrade.
const auto path = data_dir();
#ifdef _WIN32
const wxString widepath = from_u8(path);
const wchar_t *argv[] = { L"explorer", widepath.GetData(), nullptr };
::wxExecute(const_cast<wchar_t**>(argv), wxEXEC_ASYNC, nullptr);
::wxExecute(argv, wxEXEC_ASYNC, nullptr);
#elif __APPLE__
const char *argv[] = { "open", path.data(), nullptr };
::wxExecute(const_cast<char**>(argv), wxEXEC_ASYNC, nullptr);
::wxExecute(argv, wxEXEC_ASYNC, nullptr);
#else
const char *argv[] = { "xdg-open", path.data(), nullptr };
@@ -567,10 +565,10 @@ void desktop_open_datadir_folder()
exec_env.cwd = std::move(owd);
}
::wxExecute(const_cast<char**>(argv), wxEXEC_ASYNC, nullptr, &exec_env);
::wxExecute(argv, wxEXEC_ASYNC, nullptr, &exec_env);
} else {
// Looks like we're NOT running from AppImage, we'll make no changes to the environment.
::wxExecute(const_cast<char**>(argv), wxEXEC_ASYNC, nullptr, nullptr);
::wxExecute(argv, wxEXEC_ASYNC, nullptr, nullptr);
}
#endif
}
@@ -578,7 +576,6 @@ void desktop_open_datadir_folder()
void desktop_open_any_folder( const std::string& path )
{
// Execute command to open a file explorer, platform dependent.
// FIXME: The const_casts aren't needed in wxWidgets 3.1, remove them when we upgrade.
#ifdef _WIN32
const wxString widepath = from_u8(path);
@@ -619,10 +616,10 @@ void desktop_open_any_folder( const std::string& path )
exec_env.cwd = std::move(owd);
}
::wxExecute(const_cast<char **>(argv), wxEXEC_ASYNC, nullptr, &exec_env);
::wxExecute(argv, wxEXEC_ASYNC, nullptr, &exec_env);
} else {
// Looks like we're NOT running from AppImage, we'll make no changes to the environment.
::wxExecute(const_cast<char **>(argv), wxEXEC_ASYNC, nullptr, nullptr);
::wxExecute(argv, wxEXEC_ASYNC, nullptr, nullptr);
}
#endif
}
+22 -26
View File
@@ -633,24 +633,6 @@ wxString file_wildcards(FileType file_type, const std::string &custom_extension)
static std::string libslic3r_translate_callback(const char *s) { return wxGetTranslation(wxString(s, wxConvUTF8)).utf8_str().data(); }
#ifdef WIN32
#if !wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
static void register_win32_dpi_event()
{
enum { WM_DPICHANGED_ = 0x02e0 };
wxWindow::MSWRegisterMessageHandler(WM_DPICHANGED_, [](wxWindow *win, WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) {
const int dpi = wParam & 0xffff;
const auto rect = reinterpret_cast<PRECT>(lParam);
const wxRect wxrect(wxPoint(rect->top, rect->left), wxPoint(rect->bottom, rect->right));
DpiChangedEvent evt(EVT_DPI_CHANGED_SLICER, dpi, wxrect);
win->GetEventHandler()->AddPendingEvent(evt);
return true;
});
}
#endif // !wxVERSION_EQUAL_OR_GREATER_THAN
static GUID GUID_DEVINTERFACE_HID = { 0x4D1E55B2, 0xF16F, 0x11CF, 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30 };
static void register_win32_device_notification_event()
@@ -2726,11 +2708,15 @@ bool GUI_App::on_init_inner()
#if defined(__WXGTK20__) || defined(__WXGTK3__)
// Suppress harmless GTK critical warnings from the GTK3/wxWidgets interaction.
// These include widget allocation on hidden widgets and events on unrealized widgets.
// These include widget allocation on hidden widgets, events on unrealized widgets,
// and style context operations during widget construction (SetBackgroundColour
// before GTK widget realization).
g_log_set_handler("Gtk", G_LOG_LEVEL_CRITICAL,
[](const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) {
if (message && (strstr(message, "gtk_widget_set_allocation") ||
strstr(message, "WIDGET_REALIZED_FOR_EVENT")))
strstr(message, "WIDGET_REALIZED_FOR_EVENT") ||
strstr(message, "gtk_widget_get_style_context") ||
strstr(message, "gtk_style_context_add_provider")))
return;
g_log_default_handler(log_domain, log_level, message, user_data);
}, nullptr);
@@ -2845,6 +2831,11 @@ bool GUI_App::on_init_inner()
bool init_dark_color_mode = dark_mode();
bool init_sys_menu_enabled = app_config->get("sys_menu_enabled") == "1";
#ifdef __WINDOWS__
// Inform wxWidgets 3.3's dark mode system so it tracks NppDarkMode's state.
// Must be called before NppDarkMode::InitDarkMode() so that NppDarkMode's
// SetPreferredAppMode(ForceDark) overrides the AllowDark state set here.
// Orca: todo switch to native dark mode support in wxWidgets and remove NppDarkMode
MSWEnableDarkMode(DarkMode_Auto);
NppDarkMode::InitDarkMode(init_dark_color_mode, init_sys_menu_enabled);
#endif // __WINDOWS__
@@ -3094,9 +3085,6 @@ bool GUI_App::on_init_inner()
//}
#ifdef WIN32
#if !wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
register_win32_dpi_event();
#endif // !wxVERSION_EQUAL_OR_GREATER_THAN
register_win32_device_notification_event();
#endif // WIN32
@@ -3657,9 +3645,15 @@ bool GUI_App::dark_mode()
// proper dark mode was first introduced.
return wxPlatformInfo::Get().CheckOSVersion(10, 14) && mac_dark_mode();
#else
return wxGetApp().app_config->get("dark_color_mode") == "1" ? true : check_dark_mode();
//const unsigned luma = get_colour_approx_luma(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
//return luma < 128;
// When the user has explicitly chosen a mode, honour it directly.
// Falling through to check_dark_mode() for an explicit "0" would query
// wxSystemSettings::GetAppearance().IsDark(), which is contaminated by
// wxWidgets 3.3's MSWEnableDarkMode(DarkMode_Auto) and can return true
// even though the user asked for light mode.
const auto &val = wxGetApp().app_config->get("dark_color_mode");
if (val == "1") return true;
if (val == "0") return false;
return check_dark_mode();
#endif
#else
//BBS disable DarkUI mode
@@ -4313,8 +4307,10 @@ void GUI_App::force_colors_update()
#ifdef _MSW_DARK_MODE
#ifdef __WINDOWS__
NppDarkMode::SetDarkMode(dark_mode());
#if wxVERSION_NUMBER < 3300
if (WXHWND wxHWND = wxToolTip::GetToolTipCtrl())
NppDarkMode::SetDarkExplorerTheme((HWND)wxHWND);
#endif
NppDarkMode::SetDarkTitleBar(mainframe->GetHWND());
+1 -1
View File
@@ -147,7 +147,7 @@ class GizmoObjectManipulation;
static wxString dots("...", wxConvUTF8);
// Does our wxWidgets version support markup?
#if wxUSE_MARKUP && wxCHECK_VERSION(3, 1, 1)
#if wxUSE_MARKUP
#define SUPPORTS_MARKUP
#endif
+1
View File
@@ -32,6 +32,7 @@
#include <wx/progdlg.h>
#include <wx/listbook.h>
#include <wx/numformatter.h>
#include <wx/utils.h>
#include <wx/headerctrl.h>
#include "slic3r/Utils/FixModelByWin10.hpp"
-9
View File
@@ -148,10 +148,6 @@ void on_window_geometry(wxTopLevelWindow *tlw, std::function<void()> callback)
#endif
}
#if !wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
wxDEFINE_EVENT(EVT_DPI_CHANGED_SLICER, DpiChangedEvent);
#endif // !wxVERSION_EQUAL_OR_GREATER_THAN
#ifdef _WIN32
template<class F> typename F::FN winapi_get_function(const wchar_t *dll, const char *fn_name) {
static HINSTANCE dll_handle = LoadLibraryExW(dll, nullptr, 0);
@@ -247,12 +243,7 @@ bool check_dark_mode() {
return value <= 0;
}
#endif
#if wxCHECK_VERSION(3,1,3)
return wxSystemSettings::GetAppearance().IsDark();
#else
const unsigned luma = wxGetApp().get_colour_approx_luma(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
return luma < 128;
#endif
}
-59
View File
@@ -81,24 +81,6 @@ void update_dark_config();
void update_dark_ui(wxWindow* window);
#endif
#if !wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
struct DpiChangedEvent : public wxEvent {
int dpi;
wxRect rect;
DpiChangedEvent(wxEventType eventType, int dpi, wxRect rect)
: wxEvent(0, eventType), dpi(dpi), rect(rect)
{}
virtual wxEvent *Clone() const
{
return new DpiChangedEvent(*this);
}
};
wxDECLARE_EVENT(EVT_DPI_CHANGED_SLICER, DpiChangedEvent);
#endif // !wxVERSION_EQUAL_OR_GREATER_THAN
extern std::deque<wxDialog*> dialogStack;
template<class P> class DPIAware : public P
@@ -136,26 +118,12 @@ public:
// recalc_font();
#ifndef __WXOSX__
#if wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
this->Bind(wxEVT_DPI_CHANGED, [this](wxDPIChangedEvent& evt) {
m_scale_factor = (float)evt.GetNewDPI().x / (float)DPI_DEFAULT;
m_new_font_point_size = get_default_font_for_dpi(this, evt.GetNewDPI().x).GetPointSize();
if (m_can_rescale && (m_force_rescale || is_new_scale_factor()))
rescale(wxRect());
});
#else
this->Bind(EVT_DPI_CHANGED_SLICER, [this](const DpiChangedEvent& evt) {
m_scale_factor = (float)evt.dpi / (float)DPI_DEFAULT;
m_new_font_point_size = get_default_font_for_dpi(this, evt.dpi).GetPointSize();
if (!m_can_rescale)
return;
if (m_force_rescale || is_new_scale_factor())
rescale(evt.rect);
});
#endif // wxVERSION_EQUAL_OR_GREATER_THAN
#endif // no __WXOSX__
this->Bind(wxEVT_MOVE_START, [this](wxMoveEvent& event)
@@ -258,38 +226,11 @@ private:
// check if new scale is differ from previous
bool is_new_scale_factor() const { return fabs(m_scale_factor - m_prev_scale_factor) > 0.001; }
// function for a font scaling of the window
void scale_win_font(wxWindow *window, const int font_point_size)
{
wxFont new_font(window->GetFont());
new_font.SetPointSize(font_point_size);
window->SetFont(new_font);
}
// recursive function for scaling fonts for all controls in Window
void scale_controls_fonts(wxWindow *window, const int font_point_size)
{
auto children = window->GetChildren();
for (auto child : children) {
scale_controls_fonts(child, font_point_size);
scale_win_font(child, font_point_size);
}
window->Layout();
}
void rescale(const wxRect &suggested_rect)
{
this->Freeze();
m_force_rescale = false;
#if !wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
// rescale fonts of all controls
scale_controls_fonts(this, m_new_font_point_size);
// rescale current window font
scale_win_font(this, m_new_font_point_size);
#endif // wxVERSION_EQUAL_OR_GREATER_THAN
// set normal application font as a current window font
m_normal_font = this->GetFont();
+1 -5
View File
@@ -64,11 +64,7 @@ namespace I18N {
inline std::string translate_utf8(const std::wstring &s, const std::wstring &plural, unsigned int n) { return translate(s, plural, n).ToUTF8().data(); }
inline std::string translate_utf8(const wxString &s, const wxString &plural, unsigned int n) { return translate(s, plural, n).ToUTF8().data(); }
#if wxCHECK_VERSION(3, 1, 1)
#define _wxGetTranslation_ctx(S, CTX) wxGetTranslation((S), wxEmptyString, (CTX))
#else
#define _wxGetTranslation_ctx(S, CTX) ((void)(CTX), wxGetTranslation((S)))
#endif
#define _wxGetTranslation_ctx(S, CTX) wxGetTranslation((S), wxEmptyString, (CTX))
inline wxString translate(const char *s, const char* ctx) { return _wxGetTranslation_ctx(wxString(s, wxConvUTF8), ctx); }
inline wxString translate(const wchar_t *s, const char* ctx) { return _wxGetTranslation_ctx(s, ctx); }
+28 -35
View File
@@ -118,7 +118,7 @@ public:
ResizeEdgePanel(MainFrame* frame, Edge edge)
: wxPanel(frame, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxBORDER_NONE | wxTRANSPARENT_WINDOW)
wxBORDER_NONE)
, m_frame(frame)
, m_edge(edge)
{
@@ -524,25 +524,6 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_
update_layout();
sizer->SetSizeHints(this);
#ifdef WIN32
// SetMaximize causes the window to overlap the taskbar, due to the fact this window has wxMAXIMIZE_BOX off
// https://forums.wxwidgets.org/viewtopic.php?t=50634
// Fix it here
this->Bind(wxEVT_MAXIMIZE, [this](auto &e) {
wxDisplay display(this);
auto size = display.GetClientArea().GetSize();
auto pos = display.GetClientArea().GetPosition();
HWND hWnd = GetHandle();
RECT borderThickness;
SetRectEmpty(&borderThickness);
AdjustWindowRectEx(&borderThickness, GetWindowLongPtr(hWnd, GWL_STYLE), FALSE, 0);
const auto max_size = size + wxSize{-borderThickness.left + borderThickness.right, -borderThickness.top + borderThickness.bottom};
const auto current_size = GetSize();
SetSize({std::min(max_size.x, current_size.x), std::min(max_size.y, current_size.y)});
Move(pos + wxPoint{borderThickness.left, borderThickness.top});
e.Skip();
});
#endif // WIN32
// BBS
Fit();
@@ -855,26 +836,31 @@ WXLRESULT MainFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam
its wParam value is TRUE and the return value is 0 */
case WM_NCCALCSIZE:
if (wParam) {
/* Detect whether window is maximized or not. We don't need to change the resize border when win is
* maximized because all resize borders are gone automatically */
WINDOWPLACEMENT wPos;
// GetWindowPlacement fail if this member is not set correctly.
wPos.length = sizeof(wPos);
GetWindowPlacement(hWnd, &wPos);
NCCALCSIZE_PARAMS *sz = reinterpret_cast<NCCALCSIZE_PARAMS *>(lParam);
RECT borderThickness;
SetRectEmpty(&borderThickness);
// Use & ~WS_CAPTION to get only the border thickness, not the caption height.
// wxWidgets 3.3 adds WS_CAPTION when wxMINIMIZE_BOX/wxMAXIMIZE_BOX/wxCLOSE_BOX is set,
// but we use a custom titlebar so we must exclude the caption from NC area calculations.
AdjustWindowRectEx(&borderThickness, GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION, FALSE, NULL);
borderThickness.left *= -1;
borderThickness.top *= -1;
if (wPos.showCmd != SW_SHOWMAXIMIZED) {
RECT borderThickness;
SetRectEmpty(&borderThickness);
AdjustWindowRectEx(&borderThickness, GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION, FALSE, NULL);
borderThickness.left *= -1;
borderThickness.top *= -1;
NCCALCSIZE_PARAMS *sz = reinterpret_cast<NCCALCSIZE_PARAMS *>(lParam);
// Add 1 pixel to the top border to make the window resizable from the top border
sz->rgrc[0].top += 1; // borderThickness.top;
sz->rgrc[0].left += borderThickness.left;
sz->rgrc[0].right -= borderThickness.right;
sz->rgrc[0].bottom -= borderThickness.bottom;
return 0;
sz->rgrc[0].top += 1;
} else {
// When maximized, Windows extends the window beyond the screen by the border thickness.
// Strip the full border overshoot so the client area matches the work area.
sz->rgrc[0].top += borderThickness.top;
}
sz->rgrc[0].left += borderThickness.left;
sz->rgrc[0].right -= borderThickness.right;
sz->rgrc[0].bottom -= borderThickness.bottom;
return 0;
}
break;
@@ -1802,8 +1788,10 @@ wxBoxSizer* MainFrame::create_side_tools()
m_slice_select = eSlicePlate;
m_print_select = ePrintPlate;
auto slice_panel = new wxPanel(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxTRANSPARENT_WINDOW);
auto print_panel = new wxPanel(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxTRANSPARENT_WINDOW);
auto slice_panel = new wxPanel(this,wxID_ANY,wxDefaultPosition,wxDefaultSize);
auto print_panel = new wxPanel(this,wxID_ANY,wxDefaultPosition,wxDefaultSize);
slice_panel->SetBackgroundColour(StateColor::darkModeColorFor(wxColour("#3B4446")));
print_panel->SetBackgroundColour(StateColor::darkModeColorFor(wxColour("#3B4446")));
m_slice_btn = new SideButton(slice_panel, _L("Slice plate"), "");
m_slice_option_btn = new SideButton(slice_panel, "", "sidebutton_dropdown", 0, 14);
@@ -2336,6 +2324,11 @@ void MainFrame::update_side_button_style()
m_print_option_btn->SetExtraSize(wxSize(FromDIP(10), FromDIP(10)));
m_print_option_btn->SetIconOffset(FromDIP(2));
m_print_option_btn->SetMinSize(wxSize(FromDIP(24), FromDIP(24)));
// Keep panel backgrounds in sync with SideButton's darkModeColorFor(#3B4446) bottom strip
auto bg = StateColor::darkModeColorFor(wxColour("#3B4446"));
m_slice_btn->GetParent()->SetBackgroundColour(bg);
m_print_btn->GetParent()->SetBackgroundColour(bg);
}
void MainFrame::update_slice_print_status(SlicePrintEventType event, bool can_slice, bool can_print)
+4 -6
View File
@@ -69,15 +69,13 @@ namespace {
// Code taken from desktop_open_datadir_folder()
// Execute command to open a file explorer, platform dependent.
// FIXME: The const_casts aren't needed in wxWidgets 3.1, remove them when we upgrade.
#ifdef _WIN32
const wxString widepath = from_u8(path);
const wchar_t* argv[] = { L"explorer", widepath.GetData(), nullptr };
::wxExecute(const_cast<wchar_t**>(argv), wxEXEC_ASYNC, nullptr);
::wxExecute(argv, wxEXEC_ASYNC, nullptr);
#elif __APPLE__
const char* argv[] = { "open", path.data(), nullptr };
::wxExecute(const_cast<char**>(argv), wxEXEC_ASYNC, nullptr);
::wxExecute(argv, wxEXEC_ASYNC, nullptr);
#else
const char* argv[] = { "xdg-open", path.data(), nullptr };
@@ -105,11 +103,11 @@ namespace {
exec_env.cwd = std::move(owd);
}
::wxExecute(const_cast<char**>(argv), wxEXEC_ASYNC, nullptr, &exec_env);
::wxExecute(argv, wxEXEC_ASYNC, nullptr, &exec_env);
}
else {
// Looks like we're NOT running from AppImage, we'll make no changes to the environment.
::wxExecute(const_cast<char**>(argv), wxEXEC_ASYNC, nullptr, nullptr);
::wxExecute(argv, wxEXEC_ASYNC, nullptr, nullptr);
}
#endif
}
+3 -3
View File
@@ -57,7 +57,7 @@ wxBoxSizer* ObjColorDialog::create_btn_sizer(long flags,bool exist_error)
m_button_list[wxOK] = dlg_btns->GetOK();
m_button_list[wxCANCEL] = dlg_btns->GetCANCEL();
btn_sizer->Add(dlg_btns, 0, wxEXPAND | wxALIGN_CENTER_VERTICAL);
btn_sizer->Add(dlg_btns, 0, wxEXPAND);
return btn_sizer;
}
@@ -310,8 +310,8 @@ ObjColorPanel::ObjColorPanel(wxWindow *parent, Slic3r::ObjDialogInOut &in_out, c
wxBORDER_NONE | wxBU_AUTODRAW);
m_image_button->SetBitmap(image);
m_image_button->SetCanFocus(false);
icon_sizer->Add(m_image_button, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL,
FromDIP(0)); // wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL
icon_sizer->Add(m_image_button, 0, wxEXPAND | wxALL,
FromDIP(0)); // wxEXPAND | wxALL
cur_combox->Raise();//for mac
m_sizer_simple->Add(icon_sizer, FromDIP(0), wxALIGN_CENTER | wxALL, FromDIP(0));
+6 -26
View File
@@ -19,9 +19,6 @@
#include "GUI_Init.hpp"
#ifdef __APPLE__
// Part of hack to remove crash when closing the application on OSX 10.9.5 when building against newer wxWidgets
#include <wx/platinfo.h>
#include "../Utils/MacDarkMode.hpp"
#endif // __APPLE__
@@ -237,26 +234,12 @@ bool OpenGLManager::s_force_power_of_two_textures = false;
OpenGLManager::EMultisampleState OpenGLManager::s_multisample = OpenGLManager::EMultisampleState::Unknown;
OpenGLManager::EFramebufferType OpenGLManager::s_framebuffers_type = OpenGLManager::EFramebufferType::Unknown;
#ifdef __APPLE__
// Part of hack to remove crash when closing the application on OSX 10.9.5 when building against newer wxWidgets
OpenGLManager::OSInfo OpenGLManager::s_os_info;
#endif // __APPLE__
OpenGLManager::~OpenGLManager()
{
m_shaders_manager.shutdown();
#ifdef __APPLE__
// This is an ugly hack needed to solve the crash happening when closing the application on OSX 10.9.5 with newer wxWidgets
// The crash is triggered inside wxGLContext destructor
if (s_os_info.major != 10 || s_os_info.minor != 9 || s_os_info.micro != 5)
{
#endif //__APPLE__
if (m_context != nullptr)
delete m_context;
#ifdef __APPLE__
}
#endif //__APPLE__
if (m_context != nullptr)
delete m_context;
}
bool OpenGLManager::init_gl(bool popup_error)
@@ -412,12 +395,6 @@ wxGLContext* OpenGLManager::init_glcontext(wxGLCanvas& canvas, const std::pair<i
m_context = new wxGLContext(&canvas, nullptr, &attrs);
}
#ifdef __APPLE__
// Part of hack to remove crash when closing the application on OSX 10.9.5 when building against newer wxWidgets
s_os_info.major = wxPlatformInfo::Get().GetOSMajorVersion();
s_os_info.minor = wxPlatformInfo::Get().GetOSMinorVersion();
s_os_info.micro = wxPlatformInfo::Get().GetOSMicroVersion();
#endif //__APPLE__
}
return m_context;
}
@@ -451,7 +428,10 @@ wxGLCanvas* OpenGLManager::create_wxglcanvas(wxWindow& parent)
if (! can_multisample())
attribList[12] = 0;
return new wxGLCanvas(&parent, wxID_ANY, attribList, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);
wxGLCanvas* canvas = new wxGLCanvas(&parent, wxID_ANY, attribList, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);
// The GL canvas paints its entire surface, so background erasing is unnecessary.
canvas->SetBackgroundStyle(wxBG_STYLE_PAINT);
return canvas;
}
void OpenGLManager::detect_multisample(int* attribList)
-14
View File
@@ -62,16 +62,6 @@ public:
void detect() const;
};
#ifdef __APPLE__
// Part of hack to remove crash when closing the application on OSX 10.9.5 when building against newer wxWidgets
struct OSInfo
{
int major{ 0 };
int minor{ 0 };
int micro{ 0 };
};
#endif //__APPLE__
private:
enum class EMultisampleState : unsigned char
{
@@ -84,10 +74,6 @@ private:
wxGLContext* m_context{ nullptr };
GLShadersManager m_shaders_manager;
static GLInfo s_gl_info;
#ifdef __APPLE__
// Part of hack to remove crash when closing the application on OSX 10.9.5 when building against newer wxWidgets
static OSInfo s_os_info;
#endif //__APPLE__
static bool s_compressed_textures_supported;
static bool s_force_power_of_two_textures;
+2 -2
View File
@@ -197,9 +197,9 @@ PartSkipDialog::PartSkipDialog(wxWindow *parent) : DPIDialog(parent, wxID_ANY, _
#else
m_dlg_btn_sizer->Add(m_tot_label, 0, wxALIGN_CENTER_VERTICAL, 0);
#endif
m_dlg_btn_sizer->Add(0, 0, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL, FromDIP(0));
m_dlg_btn_sizer->Add(0, 0, 1, wxEXPAND, FromDIP(0));
m_dlg_btn_sizer->Add(m_apply_btn, 0, wxALIGN_CENTER_VERTICAL, FromDIP(0));
m_dlg_btn_sizer->Add(0, 0, 0, wxLEFT | wxEXPAND | wxALIGN_CENTER_VERTICAL, FromDIP(24));
m_dlg_btn_sizer->Add(0, 0, 0, wxLEFT | wxEXPAND, FromDIP(24));
m_dlg_placeholder = new wxPanel(m_book_third_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_dlg_placeholder->SetMinSize(wxSize(-1, FromDIP(15)));
+2 -2
View File
@@ -384,7 +384,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
auto txt = new wxStaticText(parent, wxID_ANY, from_u8((boost::format("%1%\n\t%2%") % info % ca_file_hint).str()));
txt->SetFont(wxGetApp().normal_font());
auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(txt, 1, wxEXPAND|wxALIGN_LEFT);
sizer->Add(txt, 1, wxEXPAND);
return sizer;
};
m_optgroup->append_line(line);
@@ -430,7 +430,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
// Always fill in the "printhost_port" combo box from the config and select it.
{
Choice* choice = dynamic_cast<Choice*>(m_optgroup->get_field("printhost_port"));
choice->set_values({ m_config->opt_string("printhost_port") });
choice->set_values(std::vector<std::string>{ m_config->opt_string("printhost_port") });
choice->set_selection();
}
+1 -1
View File
@@ -313,7 +313,7 @@ void OtherLayersSeqPanel::append_layer(const LayerSeqInfo* layer_info)
single_layer_input_sizer->Add(end_layer_input, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER, FromDIP(5));
single_layer_input_sizer->AddStretchSpacer();
single_layer_input_sizer->Add(drag_canvas, 0, wxLEFT | wxALIGN_CENTER, FromDIP(5));
layer_panel_sizer->Add(single_layer_input_sizer, 0, wxEXPAND | wxALIGN_CENTER | wxBOTTOM, FromDIP(10));
layer_panel_sizer->Add(single_layer_input_sizer, 0, wxEXPAND | wxBOTTOM, FromDIP(10));
m_layer_input_sizer_list.push_back(single_layer_input_sizer);
m_begin_layer_input_list.push_back(begin_layer_input);
m_end_layer_input_list.push_back(end_layer_input);
+9 -7
View File
@@ -529,7 +529,7 @@ void Sidebar::priv::layout_printer(bool isBBL, bool isDual)
//if (isBBL) {
wxBoxSizer *hsizer = new wxBoxSizer(wxHORIZONTAL);
hsizer->Add(image_printer, 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, FromDIP(10));
hsizer->Add(combo_printer, 1, wxEXPAND | wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, FromDIP(2));
hsizer->Add(combo_printer, 1, wxEXPAND | wxALL, FromDIP(2));
hsizer->AddSpacer(FromDIP(2));
hsizer->Add(btn_edit_printer, 0, wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(SidebarProps::IconSpacing()));
//hsizer->Add(btn_connect_printer, 0, wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(SidebarProps::IconSpacing()));
@@ -1571,7 +1571,7 @@ void Sidebar::update_sync_ams_btn_enable(wxUpdateUIEvent &e)
}
Sidebar::Sidebar(Plater *parent)
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(42 * wxGetApp().em_unit(), -1)), p(new priv(parent))
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(39 * wxGetApp().em_unit(), -1)), p(new priv(parent))
{
Choice::register_dynamic_list("support_filament", &dynamic_filament_list);
Choice::register_dynamic_list("support_interface_filament", &dynamic_filament_list);
@@ -2186,7 +2186,7 @@ Sidebar::Sidebar(Plater *parent)
auto search_sizer = new wxBoxSizer(wxHORIZONTAL);
search_sizer->Add(new wxWindow(p->m_search_bar, wxID_ANY, wxDefaultPosition, wxSize(0, 0)), 0, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(1));
search_sizer->Add(p->m_search_item, 1, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
search_sizer->Add(p->m_search_item, 1, wxEXPAND | wxALL, FromDIP(2));
p->m_search_bar->SetSizer(search_sizer);
p->m_search_bar->Layout();
search_sizer->Fit(p->m_search_bar);
@@ -2789,7 +2789,7 @@ void Sidebar::update_filaments_area_height()
void Sidebar::msw_rescale()
{
SetMinSize(wxSize(42 * wxGetApp().em_unit(), -1));
SetMinSize(wxSize(39 * wxGetApp().em_unit(), -1));
p->m_panel_printer_title->GetSizer()->SetMinSize(-1, 3 * wxGetApp().em_unit());
p->m_panel_filament_title->GetSizer()
->SetMinSize(-1, 3 * wxGetApp().em_unit());
@@ -4929,7 +4929,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
.TopDockable(false)
.BottomDockable(false)
.Floatable(true)
.BestSize(wxSize(42 * wxGetApp().em_unit(), 90 * wxGetApp().em_unit())));
.BestSize(wxSize(39 * wxGetApp().em_unit(), 90 * wxGetApp().em_unit())));
auto* panel_sizer = new wxBoxSizer(wxHORIZONTAL);
panel_sizer->Add(view3D, 1, wxEXPAND | wxALL, 0);
@@ -5299,12 +5299,14 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
for (size_t i = 0; i < evt.data.size(); ++i) {
input_files.push_back(from_u8(evt.data[i].string()));
}
wxGetApp().mainframe->Show();
wxGetApp().mainframe->Raise();
this->q->load_files(input_files);
});
this->q->Bind(EVT_START_DOWNLOAD_OTHER_INSTANCE, [](StartDownloadOtherInstanceEvent& evt) {
BOOST_LOG_TRIVIAL(trace) << "Received url from other instance event.";
wxGetApp().mainframe->Show();
wxGetApp().mainframe->Raise();
for (size_t i = 0; i < evt.data.size(); ++i) {
wxGetApp().start_download(evt.data[i]);
@@ -11557,8 +11559,8 @@ void Plater::priv::bring_instance_forward() const
{
main_frame->Restore();
wxGetApp().GetTopWindow()->SetFocus(); // focus on my window
wxGetApp().GetTopWindow()->Raise(); // bring window to front
wxGetApp().GetTopWindow()->Show(true); // show the window
wxGetApp().GetTopWindow()->Raise(); // bring window to front
}
}
@@ -12110,7 +12112,7 @@ void Plater::import_model_id(wxString download_info)
/* load project */
// Orca: If download is a zip file, treat it as if file has been drag and dropped on the plater
if (target_path.extension() == ".zip")
this->load_files(wxArrayString(1, target_path.string()));
{ wxArrayString arr; arr.Add(wxString::FromUTF8(target_path.string())); this->load_files(arr); }
else
this->load_project(target_path.wstring());
/*BBS set project info after load project, project info is reset in load project */
+1 -1
View File
@@ -284,7 +284,7 @@ wxBoxSizer *PreferencesDialog::create_item_language_combobox(wxString title, wxS
if (combobox->GetSelection() == m_current_language_selected)
return;
if (e.GetString().mb_str() != app_config->get(param)) {
if (e.GetString().ToStdString() != app_config->get(param)) {
{
//check if the project has changed
if (wxGetApp().plater()->is_project_dirty()) {
+2 -2
View File
@@ -184,7 +184,7 @@ bool OptionsSearcher::search(const std::string &search, bool force /* = false*/,
found.clear();
bool full_list = search.empty();
std::wstring sep = L" : ";
wxString sep = L" : ";
auto get_label = [this, &sep](const Option &opt, bool marked = true) {
std::wstring out;
@@ -213,7 +213,7 @@ bool OptionsSearcher::search(const std::string &search, bool force /* = false*/,
};
auto get_tooltip = [this, &sep](const Option &opt) {
return marker_by_type(opt.type, printer_technology) + opt.category_local + sep + opt.group_local + sep + opt.label_local;
return wxString(marker_by_type(opt.type, printer_technology)) + opt.category_local + sep + opt.group_local + sep + opt.label_local;
};
std::vector<uint16_t> matches, matches2;
+5 -9
View File
@@ -449,12 +449,10 @@ PrintParams SendMultiMachinePage::request_params(MachineObject* obj)
bool timelapse = app_config->get("print", "timelapse") == "1" ? true : false;
auto use_ams = false;
AmsRadioSelectorList::Node* node = m_radio_group.GetFirst();
auto groupid = 0;
while (node) {
AmsRadioSelector* rs = node->GetData();
for (auto it = m_radio_group.begin(); it != m_radio_group.end(); ++it) {
AmsRadioSelector* rs = *it;
if (rs->m_param_name == "use_ams" && rs->m_radiobox->GetValue()) {
use_ams = true;
}
@@ -462,8 +460,6 @@ PrintParams SendMultiMachinePage::request_params(MachineObject* obj)
if (rs->m_param_name == "use_extra" && rs->m_radiobox->GetValue()) {
use_ams = false;
}
node = node->GetNext();
}
//use ams
@@ -938,7 +934,7 @@ wxBoxSizer* SendMultiMachinePage::create_item_radiobox(wxString title, wxWindow*
void SendMultiMachinePage::OnSelectRadio(wxMouseEvent& event)
{
AmsRadioSelectorList::Node* node = m_radio_group.GetFirst();
AmsRadioSelectorList::compatibility_iterator node = m_radio_group.GetFirst();
auto groupid = 0;
//while (node) {
@@ -975,7 +971,7 @@ void SendMultiMachinePage::OnSelectRadio(wxMouseEvent& event)
void SendMultiMachinePage::on_select_radio(std::string param)
{
AmsRadioSelectorList::Node* node = m_radio_group.GetFirst();
AmsRadioSelectorList::compatibility_iterator node = m_radio_group.GetFirst();
auto groupid = 0;
while (node) {
@@ -995,7 +991,7 @@ void SendMultiMachinePage::on_select_radio(std::string param)
bool SendMultiMachinePage::get_value_radio(std::string param)
{
AmsRadioSelectorList::Node* node = m_radio_group.GetFirst();
AmsRadioSelectorList::compatibility_iterator node = m_radio_group.GetFirst();
auto groupid = 0;
while (node) {
AmsRadioSelector* rs = node->GetData();
+1 -1
View File
@@ -481,7 +481,7 @@ static std::string generate_system_info_json()
monitor_node.put("height", display.GetGeometry().GetHeight());
// Only get the scaling on Win, it is not reliable on other platforms.
#if defined(_WIN32) && wxCHECK_VERSION(3, 1, 2)
#if defined(_WIN32)
double scaling = display.GetPPI().GetWidth() / 96.;
std::stringstream ss;
ss << std::setprecision(3) << scaling;
+2 -2
View File
@@ -783,7 +783,7 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
printingstage_horizontal_sizer->Add(m_printing_stage_value, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 0);
printingstage_horizontal_sizer->Add(m_question_button, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(5));
printingstage_vertical_sizer->Add(printingstage_horizontal_sizer, 0, wxALIGN_CENTER_VERTICAL, 0);
printingstage_vertical_sizer->Add(m_printing_stage_underline, 0, wxEXPAND |wxALIGN_TOP, 0);
printingstage_vertical_sizer->Add(m_printing_stage_underline, 0, wxEXPAND, 0);
m_printing_stage_panel->SetSizer(printingstage_vertical_sizer);
// Orca: display the end time of the print
@@ -2122,7 +2122,7 @@ wxBoxSizer* StatusBasePanel::create_filament_group(wxWindow* parent)
});
sizer_box->Add(steps_sizer, 0, wxEXPAND | wxALIGN_LEFT | wxTOP, FromDIP(5));
sizer_box->Add(steps_sizer, 0, wxEXPAND | wxTOP, FromDIP(5));
sizer_box->Add(m_button_retry, 0, wxLEFT, FromDIP(28));
sizer_box->Add(0, 0, 0, wxTOP, FromDIP(5));
m_filament_load_box->SetBackgroundColour(*wxWHITE);
+12 -12
View File
@@ -495,7 +495,7 @@ void SyncAmsInfoDialog::add_two_image_control()
m_swipe_left_button->SetBitmap(m_swipe_left_bmp_normal.bmp());
});
m_swipe_left_button->Bind(wxEVT_BUTTON, &SyncAmsInfoDialog::to_previous_plate, this);
swipe_left__sizer->Add(m_swipe_left_button, 0, wxALIGN_CENTER | wxEXPAND | wxALIGN_CENTER_VERTICAL);
swipe_left__sizer->Add(m_swipe_left_button, 0, wxEXPAND);
swipe_left__sizer->AddStretchSpacer();
view_two_thumbnail_sizer->Add(swipe_left__sizer, 0, wxEXPAND);
view_two_thumbnail_sizer->AddSpacer(FromDIP(24));
@@ -507,19 +507,19 @@ void SyncAmsInfoDialog::add_two_image_control()
m_left_image_button = new wxButton(m_two_image_panel, wxID_ANY, {}, wxDefaultPosition, wxSize(FromDIP(LEFT_THUMBNAIL_SIZE_WIDTH), FromDIP(LEFT_THUMBNAIL_SIZE_WIDTH)),
wxBORDER_NONE | wxBU_AUTODRAW);
m_left_sizer_thumbnail = create_sizer_thumbnail(m_left_image_button, true);
m_two_image_panel_sizer->Add(m_left_sizer_thumbnail, FromDIP(0), wxALIGN_LEFT | wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, FromDIP(8));
m_two_image_panel_sizer->Add(m_left_sizer_thumbnail, FromDIP(0), wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, FromDIP(8));
m_two_image_panel_sizer->AddSpacer(FromDIP(5));
m_right_image_button = new wxButton(m_two_image_panel, wxID_ANY, {}, wxDefaultPosition,
wxSize(FromDIP(RIGHT_THUMBNAIL_SIZE_WIDTH), FromDIP(RIGHT_THUMBNAIL_SIZE_WIDTH)),
wxBORDER_NONE | wxBU_AUTODRAW);
m_right_sizer_thumbnail = create_sizer_thumbnail(m_right_image_button, false);
m_two_image_panel_sizer->Add(m_right_sizer_thumbnail, FromDIP(0), wxALIGN_LEFT | wxEXPAND | wxRIGHT | wxTOP | wxBOTTOM, FromDIP(8));
m_two_image_panel_sizer->Add(m_right_sizer_thumbnail, FromDIP(0), wxEXPAND | wxRIGHT | wxTOP | wxBOTTOM, FromDIP(8));
m_two_image_panel->SetSizer(m_two_image_panel_sizer);
m_two_image_panel->Layout();
m_two_image_panel->Fit();
view_two_thumbnail_sizer->Add(m_two_image_panel, FromDIP(0), wxALIGN_LEFT | wxEXPAND | wxTOP, FromDIP(2));
view_two_thumbnail_sizer->Add(m_two_image_panel, FromDIP(0), wxEXPAND | wxTOP, FromDIP(2));
}
view_two_thumbnail_sizer->AddSpacer(FromDIP(20));
auto swipe_right__sizer = new wxBoxSizer(wxVERTICAL);
@@ -536,7 +536,7 @@ void SyncAmsInfoDialog::add_two_image_control()
});
m_swipe_right_button->Bind(wxEVT_BUTTON, &SyncAmsInfoDialog::to_next_plate, this);
swipe_right__sizer->Add(m_swipe_right_button, 0, wxALIGN_CENTER | wxEXPAND | wxALIGN_CENTER_VERTICAL);
swipe_right__sizer->Add(m_swipe_right_button, 0, wxEXPAND);
swipe_right__sizer->AddStretchSpacer();
view_two_thumbnail_sizer->Add(swipe_right__sizer, 0, wxEXPAND);
view_two_thumbnail_sizer->AddStretchSpacer();
@@ -546,7 +546,7 @@ void SyncAmsInfoDialog::add_two_image_control()
m_choose_plate_sizer->AddStretchSpacer();
wxStaticText *chose_combox_title = new wxStaticText(m_two_thumbnail_panel, wxID_ANY, _CTX(L_CONTEXT("Plate", "Sync_AMS"), "Sync_AMS"));
m_choose_plate_sizer->Add(chose_combox_title, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP, FromDIP(6));
m_choose_plate_sizer->Add(chose_combox_title, 0, wxEXPAND | wxTOP, FromDIP(6));
m_choose_plate_sizer->AddSpacer(FromDIP(10));
m_combobox_plate = new ComboBox(m_two_thumbnail_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(60), -1), 0, NULL, wxCB_READONLY);
@@ -563,7 +563,7 @@ void SyncAmsInfoDialog::add_two_image_control()
m_two_thumbnail_panel->SetSizer(m_two_thumbnail_panel_sizer);
m_two_thumbnail_panel->Layout();
m_two_thumbnail_panel->Fit();
m_sizer_main->Add(m_two_thumbnail_panel, FromDIP(0), wxALIGN_CENTER | wxEXPAND | wxLEFT | wxRIGHT, FromDIP(25));
m_sizer_main->Add(m_two_thumbnail_panel, FromDIP(0), wxEXPAND | wxLEFT | wxRIGHT, FromDIP(25));
update_swipe_button_state();
}
@@ -717,9 +717,9 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
m_colormap_btn = new CapsuleButton(m_scrolledWindow, PageType::ptColorMap, _L("Mapping"), true);
m_override_btn = new CapsuleButton(m_scrolledWindow, PageType::ptOverride, _L("Overwriting"), false);
m_mode_combox_sizer->AddSpacer(SyncAmsInfoDialogWidth / 2.0f - FromDIP(8) / 2.0f - m_colormap_btn->GetSize().GetX());
m_mode_combox_sizer->Add(m_colormap_btn, 0, wxALIGN_CENTER | wxEXPAND | wxALL, FromDIP(2));
m_mode_combox_sizer->Add(m_colormap_btn, 0, wxEXPAND | wxALL, FromDIP(2));
m_mode_combox_sizer->AddSpacer(FromDIP(8));
m_mode_combox_sizer->Add(m_override_btn, 0, wxALIGN_CENTER | wxEXPAND | wxALL, FromDIP(2));
m_mode_combox_sizer->Add(m_override_btn, 0, wxEXPAND | wxALL, FromDIP(2));
m_mode_combox_sizer->AddSpacer(SyncAmsInfoDialogWidth / 2.0f - FromDIP(8) / 2.0f - m_override_btn->GetSize().GetX() - FromDIP(60));
m_reset_all_btn = new ScalableButton(m_scrolledWindow, wxID_ANY, "reset_gray", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER,
true, 14);
@@ -727,12 +727,12 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
m_reset_all_btn->SetBackgroundColour(*wxWHITE);
m_reset_all_btn->SetToolTip(_L("Reset all filament mapping"));
m_mode_combox_sizer->Add(m_reset_all_btn, 0, wxALIGN_LEFT | wxEXPAND | wxALL, FromDIP(2));
m_mode_combox_sizer->Add(m_reset_all_btn, 0, wxEXPAND | wxALL, FromDIP(2));
m_colormap_btn->Bind(wxEVT_BUTTON, &SyncAmsInfoDialog::update_when_change_map_mode,this); // update_when_change_map_mode(e.GetSelection());
m_override_btn->Bind(wxEVT_BUTTON, &SyncAmsInfoDialog::update_when_change_map_mode,this);
bSizer->Add(m_mode_combox_sizer, FromDIP(0), wxEXPAND | wxALIGN_LEFT | wxTOP, FromDIP(10));
bSizer->Add(m_mode_combox_sizer, FromDIP(0), wxEXPAND | wxTOP, FromDIP(10));
}
m_basic_panel = new wxPanel(m_scrolledWindow, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
@@ -1079,7 +1079,7 @@ void SyncAmsInfoDialog::check_empty_project()
if (!temp_plate->get_objects_on_this_plate().empty()) {
if (m_is_empty_project) { m_is_empty_project = false; }
if (i < 9) {
m_plate_number_choices_str.Add("0" + std::to_wstring(i + 1));
m_plate_number_choices_str.Add(wxString("0") + std::to_wstring(i + 1));
}
else if (i == 9) {
m_plate_number_choices_str.Add("10");
+1 -1
View File
@@ -109,7 +109,7 @@ SysInfoDialog::SysInfoDialog()
title_font.SetFamily(wxFONTFAMILY_ROMAN);
title_font.SetPointSize(22);
title->SetFont(title_font);
vsizer->Add(title, 0, wxEXPAND | wxALIGN_LEFT | wxTOP, wxGetApp().em_unit()/*50*/);
vsizer->Add(title, 0, wxEXPAND | wxTOP, wxGetApp().em_unit()/*50*/);
}
// main_info_text
+1
View File
@@ -182,6 +182,7 @@ void TabButton::render(wxDC &dc)
pt.y = (size.y - showimg.GetHeight()) / 2;
dc.DrawBitmap(showimg, pt);
}
}
void TabButton::messureSize()
+1 -1
View File
@@ -1078,7 +1078,7 @@ void AMSControl::createAmsPanel(wxSimplebook *parent, int &idx, std::vector<AMSi
else{
auto ext_image = new AMSExtImage(book_panel, pos, m_total_ext_count, false);
book_sizer->Add(ams1, 0, wxLEFT, FromDIP(30));
book_sizer->Add(ext_image, 0, wxEXPAND | wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(30));
book_sizer->Add(ext_image, 0, wxEXPAND | wxLEFT, FromDIP(30));
ext_image->setTotalExtNum(series_name, printer_type, total_ext_num);
m_ext_image_list[infos[0].ams_id] = ext_image;
}
+1 -9
View File
@@ -48,7 +48,7 @@ Button::Button(wxWindow* parent, wxString text, wxString icon, long style, int i
bool Button::Create(wxWindow* parent, wxString text, wxString icon, long style, int iconSize, wxWindowID btn_id)
{
StaticBox::Create(parent, btn_id, wxDefaultPosition, wxDefaultSize, style);
state_handler.attach({&text_color});
state_handler.attach(std::vector<StateColor const*>{&text_color});
state_handler.update_binds();
//BBS set default font
SetFont(Label::Body_14);
@@ -364,14 +364,6 @@ void Button::render(wxDC& dc)
dc.SetBrush(*wxLIGHT_GREY);
dc.SetPen(wxPen(*wxLIGHT_GREY));
dc.DrawRectangle(pt, textSize.GetSize());
#endif
#ifdef __WXOSX__
pt.y -= this->textSize.x / 2;
#endif
#ifdef __APPLE__
if (Slic3r::is_mac_version_15()) {
pt.y -= FromDIP(1);
}
#endif
dc.DrawText(text, pt);
}
+17 -2
View File
@@ -24,9 +24,16 @@ CheckBox::CheckBox(wxWindow *parent, int id)
Bind(wxEVT_ENTER_WINDOW, &CheckBox::updateBitmap, this);
Bind(wxEVT_LEAVE_WINDOW, &CheckBox::updateBitmap, this);
#endif
update();
#ifdef __WXGTK__
wxSize bestSize = GetBestSize();
bestSize.IncTo(m_on.GetBmpSize());
SetSize(bestSize);
SetMinSize(bestSize);
#else
SetSize(m_on.GetBmpSize());
SetMinSize(m_on.GetBmpSize());
update();
#endif
}
void CheckBox::SetValue(bool value)
@@ -54,8 +61,16 @@ void CheckBox::Rescale()
m_on_focused.msw_rescale();
m_half_focused.msw_rescale();
m_off_focused.msw_rescale();
update();
#ifdef __WXGTK__
wxSize bestSize = GetBestSize();
bestSize.IncTo(m_on.GetBmpSize());
SetSize(bestSize);
SetMinSize(bestSize);
#else
SetSize(m_on.GetBmpSize());
update();
SetMinSize(m_on.GetBmpSize());
#endif
}
void CheckBox::update()
+17 -2
View File
@@ -13,9 +13,16 @@ RadioBox::RadioBox(wxWindow *parent)
// SetBackgroundStyle(wxBG_STYLE_TRANSPARENT);
if (parent) SetBackgroundColour(parent->GetBackgroundColour());
// Bind(wxEVT_TOGGLEBUTTON, [this](auto& e) { update(); e.Skip(); });
update();
#ifdef __WXGTK__
wxSize bestSize = GetBestSize();
bestSize.IncTo(m_on.GetBmpSize());
SetSize(bestSize);
SetMinSize(bestSize);
#else
SetSize(m_on.GetBmpSize());
SetMinSize(m_on.GetBmpSize());
update();
#endif
}
void RadioBox::SetValue(bool value)
@@ -34,8 +41,16 @@ void RadioBox::Rescale()
{
m_on.msw_rescale();
m_off.msw_rescale();
SetSize(m_on.GetBmpSize());
update();
#ifdef __WXGTK__
wxSize bestSize = GetBestSize();
bestSize.IncTo(m_on.GetBmpSize());
SetSize(bestSize);
SetMinSize(bestSize);
#else
SetSize(m_on.GetBmpSize());
SetMinSize(m_on.GetBmpSize());
#endif
}
void RadioBox::update() {
+1 -3
View File
@@ -278,13 +278,11 @@ void SideButton::dorender(wxDC& dc, wxDC& text_dc)
auto text = GetLabel();
if (!text.IsEmpty()) {
pt.y += (rcContent.height - textSize.y) / 2;
#ifdef __APPLE__
pt.y -= FromDIP(2);
#endif
text_dc.SetFont(GetFont());
text_dc.SetTextForeground(text_color.colorForStates(states));
text_dc.DrawText(text, pt);
}
}
void SideButton::messureSize()
+8 -1
View File
@@ -180,8 +180,15 @@ void SwitchButton::Rescale()
(i == 0 ? m_off : m_on).bmp() = bmp;
}
}
SetSize(m_on.GetBmpSize());
update();
#ifdef __WXGTK__
wxSize bestSize = GetBestSize();
bestSize.IncTo(m_on.GetBmpSize());
SetSize(bestSize);
SetMinSize(bestSize);
#else
SetSize(m_on.GetBmpSize());
#endif
}
void SwitchButton::update()
+8 -2
View File
@@ -173,6 +173,12 @@ private:
class WebViewWebKit : public wxWebViewWebKit
{
public:
WebViewWebKit()
: wxWebViewWebKit(wxWebView::NewConfiguration(wxWebViewBackendWebKit))
{
}
~WebViewWebKit() override
{
RemoveScriptMessageHandler("wx");
@@ -258,7 +264,7 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url)
#ifdef __WIN32__
wxWebView* webView = new WebViewEdge;
#elif defined(__WXOSX__)
wxWebView *webView = new WebViewWebKit;
wxWebView* webView = new WebViewWebKit;
#else
auto webView = wxWebView::New();
#endif
@@ -331,7 +337,7 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url)
bool WebView::CheckWebViewRuntime()
{
wxWebViewFactoryEdge factory;
auto wxVersion = factory.GetVersionInfo();
auto wxVersion = factory.GetVersionInfo(wxVersionContext::RunTime);
return wxVersion.GetMajor() != 0;
}
-10
View File
@@ -12,14 +12,4 @@
// later when we no longer need to undef _
#define __(s) wxGetTranslation((s))
// legacy macros
// https://wiki.wxwidgets.org/EventTypes_and_Event-Table_Macros
#ifndef wxEVT_BUTTON
#define wxEVT_BUTTON wxEVT_COMMAND_BUTTON_CLICKED
#endif
#ifndef wxEVT_HTML_LINK_CLICKED
#define wxEVT_HTML_LINK_CLICKED wxEVT_COMMAND_HTML_LINK_CLICKED
#endif
#endif