mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 10:17:55 -06:00
Added scaling for more some dialogs
+ Set size for mode buttons
This commit is contained in:
parent
2e14f3456e
commit
f899cf1c91
9 changed files with 46 additions and 40 deletions
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "libslic3r/Utils.hpp"
|
#include "libslic3r/Utils.hpp"
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
|
#include "wxExtensions.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
@ -41,17 +42,13 @@ AboutDialog::AboutDialog()
|
||||||
main_sizer->Add(hsizer, 0, wxEXPAND | wxALL, 20);
|
main_sizer->Add(hsizer, 0, wxEXPAND | wxALL, 20);
|
||||||
|
|
||||||
// logo
|
// logo
|
||||||
wxBitmap logo_bmp = wxBitmap(from_u8(Slic3r::var("Slic3r_192px.png")), wxBITMAP_TYPE_PNG);
|
// wxBitmap logo_bmp = wxBitmap(from_u8(Slic3r::var("Slic3r_192px.png")), wxBITMAP_TYPE_PNG);
|
||||||
auto *logo = new wxStaticBitmap(this, wxID_ANY, std::move(logo_bmp));
|
// auto *logo = new wxStaticBitmap(this, wxID_ANY, std::move(logo_bmp));
|
||||||
|
auto *logo = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("Slic3r_192px.png"));
|
||||||
hsizer->Add(logo, 1, wxALIGN_CENTER_VERTICAL);
|
hsizer->Add(logo, 1, wxALIGN_CENTER_VERTICAL);
|
||||||
|
|
||||||
wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL);
|
||||||
// #ifdef __WXMSW__
|
hsizer->Add(vsizer, 2, wxEXPAND|wxLEFT, 20);
|
||||||
// int proportion = 2;
|
|
||||||
// #else
|
|
||||||
int proportion = 3;
|
|
||||||
// #endif
|
|
||||||
hsizer->Add(vsizer, proportion, wxEXPAND|wxLEFT, 20);
|
|
||||||
|
|
||||||
// title
|
// title
|
||||||
{
|
{
|
||||||
|
|
|
@ -98,7 +98,8 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
|
||||||
else if (option_name == "Size") {
|
else if (option_name == "Size") {
|
||||||
line.near_label_widget = [this](wxWindow* parent) {
|
line.near_label_widget = [this](wxWindow* parent) {
|
||||||
return new wxStaticBitmap(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition,
|
return new wxStaticBitmap(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition,
|
||||||
wxBitmap(from_u8(var("one_layer_lock_on.png")), wxBITMAP_TYPE_PNG).GetSize());
|
// wxBitmap(from_u8(var("one_layer_lock_on.png")), wxBITMAP_TYPE_PNG).GetSize());
|
||||||
|
create_scaled_bitmap("one_layer_lock_on.png").GetSize());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "GUI.hpp"
|
#include "GUI.hpp"
|
||||||
#include <wx/scrolwin.h>
|
#include <wx/scrolwin.h>
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
|
#include "wxExtensions.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
@ -16,7 +17,8 @@ KBShortcutsDialog::KBShortcutsDialog()
|
||||||
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
// logo
|
// logo
|
||||||
wxBitmap logo_bmp = wxBitmap(from_u8(Slic3r::var("Slic3r_32px.png")), wxBITMAP_TYPE_PNG);
|
// wxBitmap logo_bmp = wxBitmap(from_u8(Slic3r::var("Slic3r_32px.png")), wxBITMAP_TYPE_PNG);
|
||||||
|
const wxBitmap logo_bmp = create_scaled_bitmap("Slic3r_32px.png");
|
||||||
|
|
||||||
// fonts
|
// fonts
|
||||||
wxFont head_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Bold();
|
wxFont head_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Bold();
|
||||||
|
|
|
@ -13,13 +13,16 @@
|
||||||
#include "GUI.hpp"
|
#include "GUI.hpp"
|
||||||
#include "I18N.hpp"
|
#include "I18N.hpp"
|
||||||
#include "ConfigWizard.hpp"
|
#include "ConfigWizard.hpp"
|
||||||
|
#include "wxExtensions.hpp"
|
||||||
|
#include "GUI_App.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
|
|
||||||
MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &headline, wxWindowID button_id) :
|
MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &headline, wxWindowID button_id) :
|
||||||
MsgDialog(parent, title, headline, wxBitmap(from_u8(Slic3r::var("Slic3r_192px.png")), wxBITMAP_TYPE_PNG), button_id)
|
// MsgDialog(parent, title, headline, wxBitmap(from_u8(Slic3r::var("Slic3r_192px.png")), wxBITMAP_TYPE_PNG), button_id)
|
||||||
|
MsgDialog(parent, title, headline, create_scaled_bitmap("Slic3r_192px.png"), button_id)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &headline, wxBitmap bitmap, wxWindowID button_id) :
|
MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &headline, wxBitmap bitmap, wxWindowID button_id) :
|
||||||
|
@ -35,7 +38,7 @@ MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &he
|
||||||
|
|
||||||
auto *headtext = new wxStaticText(this, wxID_ANY, headline);
|
auto *headtext = new wxStaticText(this, wxID_ANY, headline);
|
||||||
headtext->SetFont(boldfont);
|
headtext->SetFont(boldfont);
|
||||||
headtext->Wrap(CONTENT_WIDTH);
|
headtext->Wrap(CONTENT_WIDTH*wxGetApp().em_unit());
|
||||||
rightsizer->Add(headtext);
|
rightsizer->Add(headtext);
|
||||||
rightsizer->AddSpacer(VERT_SPACING);
|
rightsizer->AddSpacer(VERT_SPACING);
|
||||||
|
|
||||||
|
@ -64,7 +67,8 @@ MsgDialog::~MsgDialog() {}
|
||||||
|
|
||||||
ErrorDialog::ErrorDialog(wxWindow *parent, const wxString &msg)
|
ErrorDialog::ErrorDialog(wxWindow *parent, const wxString &msg)
|
||||||
: MsgDialog(parent, _(L("Slic3r error")), _(L("Slic3r has encountered an error")),
|
: MsgDialog(parent, _(L("Slic3r error")), _(L("Slic3r has encountered an error")),
|
||||||
wxBitmap(from_u8(Slic3r::var("Slic3r_192px_grayscale.png")), wxBITMAP_TYPE_PNG),
|
// wxBitmap(from_u8(Slic3r::var("Slic3r_192px_grayscale.png")), wxBITMAP_TYPE_PNG),
|
||||||
|
create_scaled_bitmap("Slic3r_192px_grayscale.png"),
|
||||||
wxID_NONE)
|
wxID_NONE)
|
||||||
, msg(msg)
|
, msg(msg)
|
||||||
{
|
{
|
||||||
|
@ -73,10 +77,10 @@ ErrorDialog::ErrorDialog(wxWindow *parent, const wxString &msg)
|
||||||
panel->SetSizer(p_sizer);
|
panel->SetSizer(p_sizer);
|
||||||
|
|
||||||
auto *text = new wxStaticText(panel, wxID_ANY, msg);
|
auto *text = new wxStaticText(panel, wxID_ANY, msg);
|
||||||
text->Wrap(CONTENT_WIDTH);
|
text->Wrap(CONTENT_WIDTH*wxGetApp().em_unit());
|
||||||
p_sizer->Add(text, 1, wxEXPAND);
|
p_sizer->Add(text, 1, wxEXPAND);
|
||||||
|
|
||||||
panel->SetMinSize(wxSize(CONTENT_WIDTH, 0));
|
panel->SetMinSize(wxSize(CONTENT_WIDTH*wxGetApp().em_unit(), 0));
|
||||||
panel->SetScrollRate(0, 5);
|
panel->SetScrollRate(0, 5);
|
||||||
|
|
||||||
content_sizer->Add(panel, 1, wxEXPAND);
|
content_sizer->Add(panel, 1, wxEXPAND);
|
||||||
|
@ -95,7 +99,7 @@ ErrorDialog::ErrorDialog(wxWindow *parent, const wxString &msg)
|
||||||
btn_sizer->Add(btn_copy, 0, wxRIGHT, HORIZ_SPACING);
|
btn_sizer->Add(btn_copy, 0, wxRIGHT, HORIZ_SPACING);
|
||||||
btn_sizer->Add(btn_ok);
|
btn_sizer->Add(btn_ok);
|
||||||
|
|
||||||
SetMaxSize(wxSize(-1, CONTENT_MAX_HEIGHT));
|
SetMaxSize(wxSize(-1, CONTENT_MAX_HEIGHT*wxGetApp().em_unit()));
|
||||||
Fit();
|
Fit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,8 @@ struct MsgDialog : wxDialog
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum {
|
enum {
|
||||||
CONTENT_WIDTH = 500,
|
CONTENT_WIDTH = 50,//500,
|
||||||
CONTENT_MAX_HEIGHT = 600,
|
CONTENT_MAX_HEIGHT = 60,//600,
|
||||||
BORDER = 30,
|
BORDER = 30,
|
||||||
VERT_SPACING = 15,
|
VERT_SPACING = 15,
|
||||||
HORIZ_SPACING = 5,
|
HORIZ_SPACING = 5,
|
||||||
|
|
|
@ -15,7 +15,7 @@ void PreferencesDialog::build()
|
||||||
{
|
{
|
||||||
auto app_config = get_app_config();
|
auto app_config = get_app_config();
|
||||||
m_optgroup = std::make_shared<ConfigOptionsGroup>(this, _(L("General")));
|
m_optgroup = std::make_shared<ConfigOptionsGroup>(this, _(L("General")));
|
||||||
m_optgroup->label_width = 400;
|
m_optgroup->label_width = 40 * wxGetApp().em_unit(); //400;
|
||||||
m_optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value){
|
m_optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value){
|
||||||
m_values[opt_key] = boost::any_cast<bool>(value) ? "1" : "0";
|
m_values[opt_key] = boost::any_cast<bool>(value) ? "1" : "0";
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <wx/clipbrd.h>
|
#include <wx/clipbrd.h>
|
||||||
#include <wx/platinfo.h>
|
#include <wx/platinfo.h>
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
|
#include "wxExtensions.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
@ -49,8 +50,9 @@ SysInfoDialog::SysInfoDialog()
|
||||||
main_sizer->Add(hsizer, 1, wxEXPAND | wxALL, 10);
|
main_sizer->Add(hsizer, 1, wxEXPAND | wxALL, 10);
|
||||||
|
|
||||||
// logo
|
// logo
|
||||||
wxBitmap logo_bmp = wxBitmap(from_u8(Slic3r::var("Slic3r_192px.png")), wxBITMAP_TYPE_PNG);
|
// wxBitmap logo_bmp = wxBitmap(from_u8(Slic3r::var("Slic3r_192px.png")), wxBITMAP_TYPE_PNG);
|
||||||
auto *logo = new wxStaticBitmap(this, wxID_ANY, std::move(logo_bmp));
|
// auto *logo = new wxStaticBitmap(this, wxID_ANY, std::move(logo_bmp));
|
||||||
|
auto *logo = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("Slic3r_192px.png"));
|
||||||
hsizer->Add(logo, 0, wxALIGN_CENTER_VERTICAL);
|
hsizer->Add(logo, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
|
|
||||||
wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
#include "GUI_ObjectList.hpp"
|
#include "GUI_ObjectList.hpp"
|
||||||
#include "libslic3r/GCode/PreviewData.hpp"
|
#include "libslic3r/GCode/PreviewData.hpp"
|
||||||
|
#include "I18N.hpp"
|
||||||
|
|
||||||
using Slic3r::GUI::from_u8;
|
using Slic3r::GUI::from_u8;
|
||||||
|
|
||||||
|
@ -2340,9 +2341,9 @@ PrusaModeButton::PrusaModeButton( wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& mode/* = wxEmptyString*/,
|
const wxString& mode/* = wxEmptyString*/,
|
||||||
const wxBitmap& bmp_on/* = wxNullBitmap*/,
|
const wxBitmap& bmp_on/* = wxNullBitmap*/,
|
||||||
const wxPoint& pos/* = wxDefaultPosition*/,
|
const wxSize& size/* = wxDefaultSize*/,
|
||||||
const wxSize& size/* = wxDefaultSize*/) :
|
const wxPoint& pos/* = wxDefaultPosition*/) :
|
||||||
wxButton(parent, id, mode, pos, size, wxBU_EXACTFIT | wxNO_BORDER),
|
wxButton(parent, id, mode, pos, size, /*wxBU_EXACTFIT | */wxNO_BORDER),
|
||||||
m_bmp_on(bmp_on)
|
m_bmp_on(bmp_on)
|
||||||
{
|
{
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
|
@ -2394,20 +2395,19 @@ PrusaModeSizer::PrusaModeSizer(wxWindow *parent) :
|
||||||
{
|
{
|
||||||
SetFlexibleDirection(wxHORIZONTAL);
|
SetFlexibleDirection(wxHORIZONTAL);
|
||||||
|
|
||||||
// const wxBitmap bmp_simple_on = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("mode_simple_sq.png")), wxBITMAP_TYPE_PNG);
|
std::vector<std::pair<wxString, wxBitmap>> buttons = {
|
||||||
// const wxBitmap bmp_advanced_on = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("mode_middle_sq.png")), wxBITMAP_TYPE_PNG);
|
{_(L("Simple")), create_scaled_bitmap("mode_simple_sq.png")},
|
||||||
// const wxBitmap bmp_expert_on = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("mode_expert_sq.png")), wxBITMAP_TYPE_PNG);
|
{_(L("Advanced")), create_scaled_bitmap("mode_middle_sq.png")},
|
||||||
|
{_(L("Expert")), create_scaled_bitmap("mode_expert_sq.png")}
|
||||||
const wxBitmap bmp_simple_on = create_scaled_bitmap("mode_simple_sq.png");
|
};
|
||||||
const wxBitmap bmp_advanced_on = create_scaled_bitmap("mode_middle_sq.png");
|
|
||||||
const wxBitmap bmp_expert_on = create_scaled_bitmap("mode_expert_sq.png");
|
|
||||||
|
|
||||||
|
|
||||||
mode_btns.reserve(3);
|
mode_btns.reserve(3);
|
||||||
|
for (const auto& button : buttons) {
|
||||||
mode_btns.push_back(new PrusaModeButton(parent, wxID_ANY, "Simple", bmp_simple_on));
|
int x, y;
|
||||||
mode_btns.push_back(new PrusaModeButton(parent, wxID_ANY, "Advanced", bmp_advanced_on));
|
parent->GetTextExtent(button.first, &x, &y, nullptr, nullptr, &Slic3r::GUI::wxGetApp().bold_font());
|
||||||
mode_btns.push_back(new PrusaModeButton(parent, wxID_ANY, "Expert", bmp_expert_on));
|
const wxSize size = wxSize(x + button.second.GetWidth() + Slic3r::GUI::wxGetApp().em_unit(), y);
|
||||||
|
mode_btns.push_back(new PrusaModeButton(parent, wxID_ANY, button.first, button.second, size));
|
||||||
|
}
|
||||||
|
|
||||||
for (auto btn : mode_btns)
|
for (auto btn : mode_btns)
|
||||||
{
|
{
|
||||||
|
|
|
@ -884,8 +884,8 @@ public:
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& mode = wxEmptyString,
|
const wxString& mode = wxEmptyString,
|
||||||
const wxBitmap& bmp_on = wxNullBitmap,
|
const wxBitmap& bmp_on = wxNullBitmap,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxSize& size = wxDefaultSize,
|
||||||
const wxSize& size = wxDefaultSize);
|
const wxPoint& pos = wxDefaultPosition);
|
||||||
~PrusaModeButton() {}
|
~PrusaModeButton() {}
|
||||||
|
|
||||||
void OnButton(wxCommandEvent& event);
|
void OnButton(wxCommandEvent& event);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue