SkinnedUI: bug fixing and improvements:

* SPE-1945 : LINUX - Black background in dark mode in search - "Category"
* SPE-1941 : Font size is applied for old PS version (app_config key for font size is changed to "font_pt_size")
* SPE-1939 : Preferences : PS widows have incorrect dims when used max font size
* SPE-1943 : Fixed gtk resize popup window (Manually merged 60dbf71cd6 )
* SPE-1942 : Linux specific: Brim check button on sidebar jumps
* SPE-1944 : PrusaConnect URL is missing in physical Printer
+ Changed icon which is used to comboboxes
This commit is contained in:
YuSanka 2023-10-10 09:42:18 +02:00 committed by Lukas Matena
parent d42e3823dc
commit 1a182999a8
10 changed files with 65 additions and 27 deletions

View File

@ -1,3 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12.75 6.25L7.75 9.75L2.75 6.25" stroke="#646464" stroke-linecap="round"/>
<path d="M12.75 6.25L7.75 9.75L2.75 6.25" stroke="#646464" stroke-width="1.75" stroke-linecap="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 187 B

After

Width:  |  Height:  |  Size: 207 B

View File

@ -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));

View File

@ -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();

View File

@ -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

View File

@ -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<wxTextCtrl*>(printhost_field->getWindow()); temp && temp->GetValue().IsEmpty()) {
if (text_ctrl* temp = dynamic_cast<text_ctrl*>(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;
}
}

View File

@ -10,10 +10,10 @@
#include <wx/gdicmn.h>
#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<PresetForPrinter*> m_presets;
ConfigOptionsGroup* m_optgroup { nullptr };

View File

@ -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<wxScrolledWindow*>(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_ptr<ConfigOptionsGroup>create_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<ConfigOptionsGroup> optgroup = std::make_shared<ConfigOptionsGroup>(tab);
std::shared_ptr<ConfigOptionsGroup> optgroup = std::make_shared<ConfigOptionsGroup>(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<std::string> options_to_recreate_GUI = { "no_defaults", "tabs_as_menu", "sys_menu_enabled", "font_size", "suppress_round_corners" };
std::vector<std::string> 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<ConfigOptionsGroup> 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);

View File

@ -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;

View File

@ -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

View File

@ -11,6 +11,10 @@
#include <wx/display.h>
#ifdef __WXGTK__
#include <gtk/gtk.h>
#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;
}