diff --git a/resources/icons/drop_down.svg b/resources/icons/drop_down.svg
index 3354ddc295..1276e34039 100644
--- a/resources/icons/drop_down.svg
+++ b/resources/icons/drop_down.svg
@@ -1,3 +1,3 @@
diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp
index a173b621d2..23d556fced 100644
--- a/src/slic3r/GUI/GUI_App.cpp
+++ b/src/slic3r/GUI/GUI_App.cpp
@@ -1326,7 +1326,7 @@ bool GUI_App::on_init_inner()
if (!delayed_error_load_presets.empty())
show_error(nullptr, delayed_error_load_presets);
- mainframe = new MainFrame(app_config->has("font_size") ? atoi(app_config->get("font_size").c_str()) : -1);
+ mainframe = new MainFrame(app_config->has("font_pt_size") ? atoi(app_config->get("font_pt_size").c_str()) : -1);
// hide settings tabs after first Layout
if (is_editor())
mainframe->select_tab(size_t(0));
@@ -1761,9 +1761,21 @@ bool GUI_App::suppress_round_corners() const
return true;// app_config->get("suppress_round_corners") == "1";
}
-wxSize GUI_App::get_min_size() const
+wxSize GUI_App::get_min_size(wxWindow* display_win) const
{
- return wxSize(76*m_em_unit, 49 * m_em_unit);
+ wxSize min_size(76*m_em_unit, 49 * m_em_unit);
+
+ const wxDisplay display = wxDisplay(display_win);
+ wxRect display_rect = display.GetGeometry();
+ display_rect.width *= 0.75;
+ display_rect.height *= 0.75;
+
+ if (min_size.x > display_rect.GetWidth())
+ min_size.x = display_rect.GetWidth();
+ if (min_size.y > display_rect.GetHeight())
+ min_size.y = display_rect.GetHeight();
+
+ return min_size;
}
float GUI_App::toolbar_icon_scale(const bool is_limited/* = false*/) const
@@ -1838,7 +1850,7 @@ void GUI_App::recreate_GUI(const wxString& msg_name)
dlg.Update(10, _L("Recreating") + dots);
MainFrame *old_main_frame = mainframe;
- mainframe = new MainFrame(app_config->has("font_size") ? atoi(app_config->get("font_size").c_str()) : -1);
+ mainframe = new MainFrame(app_config->has("font_pt_size") ? atoi(app_config->get("font_pt_size").c_str()) : -1);
if (is_editor())
// hide settings tabs after first Layout
mainframe->select_tab(size_t(0));
diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp
index fb4e1d87ab..e9e7dc17c0 100644
--- a/src/slic3r/GUI/GUI_App.hpp
+++ b/src/slic3r/GUI/GUI_App.hpp
@@ -249,7 +249,7 @@ public:
int em_unit() const { return m_em_unit; }
bool tabs_as_menu() const;
bool suppress_round_corners() const;
- wxSize get_min_size() const;
+ wxSize get_min_size(wxWindow* display_win) const;
float toolbar_icon_scale(const bool is_limited = false) const;
void set_auto_toolbar_icon_scale(float scale) const;
void check_printer_presets();
diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp
index e68d94348f..26befcb803 100644
--- a/src/slic3r/GUI/MainFrame.cpp
+++ b/src/slic3r/GUI/MainFrame.cpp
@@ -213,7 +213,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
sizer->SetSizeHints(this);
Fit();
- const wxSize min_size = wxGetApp().get_min_size(); //wxSize(76*wxGetApp().em_unit(), 49*wxGetApp().em_unit());
+ const wxSize min_size = wxGetApp().get_min_size(this);
#ifdef __APPLE__
// Using SetMinSize() on Mac messes up the window position in some cases
// cf. https://groups.google.com/forum/#!topic/wx-users/yUKPBBfXWO0
diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp
index 807413e047..5ef37e013f 100644
--- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp
+++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp
@@ -184,7 +184,7 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxWindow* parent, wxString printer_
m_add_preset_btn->SetToolTip(_L("Add preset for this printer device"));
m_add_preset_btn->Bind(wxEVT_BUTTON, &PhysicalPrinterDialog::AddPreset, this);
- m_printer_name = new wxTextCtrl(this, wxID_ANY, printer_name, wxDefaultPosition, wxDefaultSize);
+ m_printer_name = new ::TextInput(this,printer_name);
wxGetApp().UpdateDarkUI(m_printer_name);
m_printer_name->Bind(wxEVT_TEXT, [this](wxEvent&) { this->update_full_printer_names(); });
@@ -242,7 +242,7 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxWindow* parent, wxString printer_
if (new_printer) {
m_printer_name->SetFocus();
- m_printer_name->SelectAll();
+ m_printer_name->GetTextCtrl()->SelectAll();
}
this->Fit();
@@ -508,7 +508,7 @@ void PhysicalPrinterDialog::update(bool printer_change)
supports_multiple_printers = opt && opt->value == htRepetier;
if (opt->value == htPrusaConnect) { // automatically show default prusaconnect address
if (Field* printhost_field = m_optgroup->get_field("print_host"); printhost_field) {
- if (wxTextCtrl* temp = dynamic_cast(printhost_field->getWindow()); temp && temp->GetValue().IsEmpty()) {
+ if (text_ctrl* temp = dynamic_cast(printhost_field->getWindow()); temp && temp->GetValue().IsEmpty()) {
temp->SetValue(L"https://connect.prusa3d.com");
}
}
@@ -674,7 +674,7 @@ void PhysicalPrinterDialog::update_full_printer_names()
InfoDialog(this, format_wxstr("%1%: \"%2%\" ", _L("Unexpected character"), str),
_L("The following characters are not allowed in the name") + ": " + unusable_symbols).ShowModal();
m_printer_name->SetValue(printer_name);
- m_printer_name->SetInsertionPointEnd();
+ m_printer_name->GetTextCtrl()->SetInsertionPointEnd();
return;
}
}
diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.hpp b/src/slic3r/GUI/PhysicalPrinterDialog.hpp
index fd98c3d61a..8668fd1719 100644
--- a/src/slic3r/GUI/PhysicalPrinterDialog.hpp
+++ b/src/slic3r/GUI/PhysicalPrinterDialog.hpp
@@ -10,10 +10,10 @@
#include
#include "libslic3r/Preset.hpp"
+#include "Widgets/TextInput.hpp"
#include "GUI_Utils.hpp"
class wxString;
-class wxTextCtrl;
class wxStaticText;
class ScalableButton;
class wxBoxSizer;
@@ -67,7 +67,7 @@ class PhysicalPrinterDialog : public DPIDialog
wxString m_default_name;
DynamicPrintConfig* m_config { nullptr };
- wxTextCtrl* m_printer_name { nullptr };
+ ::TextInput* m_printer_name { nullptr };
std::vector m_presets;
ConfigOptionsGroup* m_optgroup { nullptr };
diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp
index 2c566a62af..07322b849e 100644
--- a/src/slic3r/GUI/Preferences.cpp
+++ b/src/slic3r/GUI/Preferences.cpp
@@ -66,13 +66,25 @@ namespace GUI {
PreferencesDialog::PreferencesDialog(wxWindow* parent) :
DPIDialog(parent, wxID_ANY, _L("Preferences"), wxDefaultPosition,
- wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
+ wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
#ifdef __WXOSX__
isOSX = true;
#endif
build();
+ wxSize sz = GetSize();
+ sz.x += em_unit();
+
+ const size_t pages_cnt = tabs->GetPageCount();
+ for (size_t tab_id = 0; tab_id < pages_cnt; tab_id++) {
+ wxSizer* tab_sizer = tabs->GetPage(tab_id)->GetSizer();
+ wxScrolledWindow* scrolled = static_cast(tab_sizer->GetItem(size_t(0))->GetWindow());
+ scrolled->SetScrollRate(0, 5);
+ }
+
+ SetSize(sz);
+
m_highlighter.set_timer_owner(this, 0);
}
@@ -133,14 +145,22 @@ void PreferencesDialog::show(const std::string& highlight_opt_key /*= std::strin
static std::shared_ptrcreate_options_tab(const wxString& title, wxBookCtrlBase* tabs)
{
wxPanel* tab = new wxPanel(tabs, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL);
+
tabs->AddPage(tab, _(title));
tab->SetFont(wxGetApp().normal_font());
+ auto scrolled = new wxScrolledWindow(tab);
+
+ // Sizer in the scrolled area
+ auto* scrolled_sizer = new wxBoxSizer(wxVERTICAL);
+ scrolled->SetSizer(scrolled_sizer);
+
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
+ sizer->Add(scrolled, 1, wxEXPAND);
sizer->SetSizeHints(tab);
tab->SetSizer(sizer);
- std::shared_ptr optgroup = std::make_shared(tab);
+ std::shared_ptr optgroup = std::make_shared(scrolled);
optgroup->label_width = 40;
optgroup->set_config_category_and_type(title, int(Preset::TYPE_PREFERENCES));
return optgroup;
@@ -722,7 +742,7 @@ void PreferencesDialog::accept(wxEvent&)
#endif // __linux__
}
- std::vector options_to_recreate_GUI = { "no_defaults", "tabs_as_menu", "sys_menu_enabled", "font_size", "suppress_round_corners" };
+ std::vector options_to_recreate_GUI = { "no_defaults", "tabs_as_menu", "sys_menu_enabled", "font_pt_size", "suppress_round_corners" };
for (const std::string& option : options_to_recreate_GUI) {
if (m_values.find(option) != m_values.end()) {
@@ -903,7 +923,7 @@ void PreferencesDialog::refresh_og(std::shared_ptr og)
{
og->parent()->Layout();
tabs->Layout();
- this->layout();
+// this->layout();
}
void PreferencesDialog::create_icon_size_slider()
@@ -1081,7 +1101,7 @@ void PreferencesDialog::create_settings_font_widget()
wxStaticBox* stb = new wxStaticBox(parent, wxID_ANY, _(title));
if (!wxOSX) stb->SetBackgroundStyle(wxBG_STYLE_PAINT);
- const std::string opt_key = "font_size";
+ const std::string opt_key = "font_pt_size";
m_blinkers[opt_key] = new BlinkingBitmap(parent);
wxSizer* stb_sizer = new wxStaticBoxSizer(stb, wxHORIZONTAL);
diff --git a/src/slic3r/GUI/Search.cpp b/src/slic3r/GUI/Search.cpp
index 79b7ed70d4..35dec1f481 100644
--- a/src/slic3r/GUI/Search.cpp
+++ b/src/slic3r/GUI/Search.cpp
@@ -487,7 +487,11 @@ SearchDialog::SearchDialog(OptionsSearcher* searcher)
searcher(searcher)
{
SetFont(GUI::wxGetApp().normal_font());
+#if _WIN32
GUI::wxGetApp().UpdateDarkUI(this);
+#elif __WXGTK__
+ SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
+#endif
default_string = _L("Enter a search term");
int border = 10;
diff --git a/src/slic3r/GUI/Widgets/BitmapToggleButton.cpp b/src/slic3r/GUI/Widgets/BitmapToggleButton.cpp
index c8f2292090..e73b789c5f 100644
--- a/src/slic3r/GUI/Widgets/BitmapToggleButton.cpp
+++ b/src/slic3r/GUI/Widgets/BitmapToggleButton.cpp
@@ -8,7 +8,8 @@ BitmapToggleButton::BitmapToggleButton(wxWindow* parent, const wxString& label,
wxBitmapToggleButton::Create(parent, id, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE | wxBU_EXACTFIT);
else {
#ifdef __linux__
- wxSize def_size = wxSize(parent->GetTextExtent(label).GetX() + 20, 20);
+ wxSize label_size = parent->GetTextExtent(label);
+ wxSize def_size = wxSize(label_size.GetX() + 20, label_size.GetY());
#else
wxSize def_size = wxDefaultSize;
#endif
@@ -38,14 +39,7 @@ BitmapToggleButton::BitmapToggleButton(wxWindow* parent, const wxString& label,
void BitmapToggleButton::update_size()
{
-#ifdef __linux__
- wxSize bmp_sz = GetBitmap().GetSize();
- wxSize sz = GetSize();
- if (GetLabel().IsEmpty())
- SetSize(bmp_sz);
- else
- SetSize(sz.x, bmp_sz.y);
-#else
+#ifndef __WXGTK__
wxSize best_sz = GetBestSize();
SetSize(best_sz);
#endif
diff --git a/src/slic3r/GUI/Widgets/DropDown.cpp b/src/slic3r/GUI/Widgets/DropDown.cpp
index 44e557e89f..999dba41f8 100644
--- a/src/slic3r/GUI/Widgets/DropDown.cpp
+++ b/src/slic3r/GUI/Widgets/DropDown.cpp
@@ -11,6 +11,10 @@
#include
+#ifdef __WXGTK__
+#include
+#endif
+
wxDEFINE_EVENT(EVT_DISMISS, wxCommandEvent);
BEGIN_EVENT_TABLE(DropDown, wxPopupTransientWindow)
@@ -380,6 +384,10 @@ void DropDown::messureSize()
szContent.y *= std::min((size_t)15, texts.size());
szContent.y += texts.size() > 15 ? rowSize.y / 2 : 0;
wxWindow::SetSize(szContent);
+#ifdef __WXGTK__
+ // Gtk has a wrapper window for popup widget
+ gtk_window_resize(GTK_WINDOW(m_widget), szContent.x, szContent.y);
+#endif
need_sync = false;
}