Class for RadioGroup & LabeledStaticBox and improvements for Calibration Dialogs, Windows with wxStaticBoxSizer (#9797)
Some checks are pending
Build all / Build All (push) Waiting to run
Build all / Flatpak (push) Waiting to run

* update

* Update calib_dlg.cpp

* Update LabeledStaticBox.hpp

* Update calib_dlg.cpp

* update

* update

* RadioGroup fix

* update

* update

* update

* update

* RadioGroup

* Fix render issue when position is set to default (-1)

* Fix macOS render issue by removing default NSBox border

* Fix compile

---------

Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
This commit is contained in:
yw4z 2025-06-12 15:15:02 +03:00 committed by GitHub
parent 5c2fe4da87
commit 8fff1caa39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 833 additions and 331 deletions

View file

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
<circle cx="8.5" cy="8.5" r="7" style="fill:none;stroke:#DBDBDB;stroke-miterlimit:10"/>
<circle cx="8.5" cy="8.5" r="5.5" style="fill:#F0F0F1"/></svg>

After

Width:  |  Height:  |  Size: 234 B

View file

@ -0,0 +1,2 @@
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
<circle cx="8.5" cy="8.5" r="7" style="fill:none;stroke:#009688;stroke-miterlimit:10"/></svg>

After

Width:  |  Height:  |  Size: 177 B

View file

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
<circle cx="8.5" cy="8.5" r="7" style="fill:none;stroke:#009688;stroke-miterlimit:10"/>
<circle cx="8.5" cy="8.5" r="5.5" style="fill:#009688"/></svg>

After

Width:  |  Height:  |  Size: 234 B

View file

@ -38,6 +38,8 @@ set(SLIC3R_GUI_SOURCES
GUI/Widgets/Scrollbar.hpp
GUI/Widgets/ScrolledWindow.cpp
GUI/Widgets/ScrolledWindow.hpp
GUI/Widgets/LabeledStaticBox.cpp
GUI/Widgets/LabeledStaticBox.hpp
GUI/Widgets/StaticBox.cpp
GUI/Widgets/StaticBox.hpp
GUI/Widgets/ImageSwitchButton.cpp
@ -70,6 +72,8 @@ set(SLIC3R_GUI_SOURCES
GUI/Widgets/StepCtrl.hpp
GUI/Widgets/ProgressBar.cpp
GUI/Widgets/ProgressBar.hpp
GUI/Widgets/RadioGroup.cpp
GUI/Widgets/RadioGroup.hpp
GUI/Widgets/SideTools.cpp
GUI/Widgets/SideTools.hpp
GUI/Widgets/WebView.cpp

View file

@ -12,6 +12,7 @@
#include "libslic3r/Model.hpp"
#include "libslic3r/Polygon.hpp"
#include "Widgets/LabeledStaticBox.hpp"
#include "Widgets/DialogButtons.hpp"
#include <boost/algorithm/string/predicate.hpp>
@ -189,9 +190,9 @@ void BedShapePanel::build_panel(const Pointfs& default_pt, const std::string& cu
m_custom_texture = custom_texture.empty() ? NONE : custom_texture;
m_custom_model = custom_model.empty() ? NONE : custom_model;
auto sbsizer = new wxStaticBoxSizer(wxVERTICAL, this, _L("Shape"));
sbsizer->GetStaticBox()->SetFont(wxGetApp().bold_font());
wxGetApp().UpdateDarkUI(sbsizer->GetStaticBox());
// ORCA match style of wxStaticBox between platforms
LabeledStaticBox* stb = new LabeledStaticBox(this, _L("Shape"));
auto sbsizer = new wxStaticBoxSizer(stb, wxVERTICAL);
// shape options
m_shape_options_book = new wxSimplebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);

View file

@ -18,6 +18,7 @@
#include <wx/debug.h>
#include <wx/settings.h>
#include <wx/dataview.h>
#include <wx/statbox.h>
#include <chrono>
@ -496,6 +497,7 @@ int get_dpi_for_window(const wxWindow *window);
#ifdef __WXOSX__
void dataview_remove_insets(wxDataViewCtrl* dv);
void staticbox_remove_margin(wxStaticBox* sb);
#endif
/// <summary>

View file

@ -14,6 +14,12 @@ void dataview_remove_insets(wxDataViewCtrl* dv) {
}
}
void staticbox_remove_margin(wxStaticBox* sb) {
NSBox* nativeBox = (NSBox*)sb->GetHandle();
[nativeBox setBoxType:NSBoxCustom];
[nativeBox setBorderWidth:0];
}
}
}

View file

@ -7,6 +7,7 @@
#include "MsgDialog.hpp"
#include "format.hpp"
#include "Widgets/StaticLine.hpp"
#include "Widgets/LabeledStaticBox.hpp"
#include <utility>
#include <wx/bookctrl.h>
@ -470,14 +471,11 @@ bool OptionsGroup::activate(std::function<void()> throw_if_canceled/* = [](){}*/
try {
if (staticbox) {
wxStaticBox * stb = new wxStaticBox(m_parent, wxID_ANY, _(title));
if (!wxOSX) stb->SetBackgroundStyle(wxBG_STYLE_PAINT);
stb->SetBackgroundColour(m_parent->GetBackgroundColour());
stb->SetFont(wxOSX ? wxGetApp().normal_font() : wxGetApp().bold_font());
wxGetApp().UpdateDarkUI(stb);
// BBS: new layout
sizer = new wxStaticBoxSizer(stb, wxVERTICAL);
// ORCA match style of wxStaticBox between platforms
LabeledStaticBox * stb = new LabeledStaticBox(m_parent, _(title));
//wxGetApp().UpdateDarkUI(stb);
this->stb = stb;
sizer = new wxStaticBoxSizer(stb, wxVERTICAL);
}
else {
// BBS: new layout

View file

@ -0,0 +1,181 @@
#include "LabeledStaticBox.hpp"
#include "libslic3r/Utils.hpp"
#include "../GUI.hpp"
#include "../GUI_Utils.hpp"
#include "Label.hpp"
/*
Fix label overflowing to inner frame
Fix use elypsis if text too long
setmin size
*/
LabeledStaticBox::LabeledStaticBox()
: state_handler(this)
{
m_radius = 3;
m_border_width = 1;
m_font = Label::Head_14;
text_color = StateColor(
std::make_pair(0x363636, (int) StateColor::Normal),
std::make_pair(0x6B6B6B, (int) StateColor::Disabled)
);
background_color = StateColor(
std::make_pair(0xFFFFFF, (int) StateColor::Normal),
std::make_pair(0xF0F0F1, (int) StateColor::Disabled)
);
border_color = StateColor(
std::make_pair(0xDBDBDB, (int) StateColor::Normal),
std::make_pair(0xDBDBDB, (int) StateColor::Disabled)
);
}
LabeledStaticBox::LabeledStaticBox(
wxWindow* parent,
const wxString& label,
const wxPoint& pos,
const wxSize& size,
long style
)
: LabeledStaticBox()
{
Create(parent, label, pos, size, style);
}
bool LabeledStaticBox::Create(
wxWindow* parent,
const wxString& label,
const wxPoint& pos,
const wxSize& size,
long style
)
{
if (style & wxBORDER_NONE)
m_border_width = 0;
wxStaticBox::Create(parent, wxID_ANY, label, pos, size, style);
#ifdef __WXOSX__
Slic3r::GUI::staticbox_remove_margin(this);
#endif
m_label = label;
m_scale = FromDIP(100) / 100.f;
m_pos = this->GetPosition();
int tW,tH,descent,externalLeading;
GetTextExtent("Yy", &tW, &tH, &descent, &externalLeading, &m_font);
m_label_height = tH - externalLeading;
GetTextExtent(m_label, &tW, &tH, &descent, &externalLeading, &m_font);
m_label_width = tW;
Bind(wxEVT_PAINT,([this](wxPaintEvent e) {
wxPaintDC dc(this);
PickDC(dc);
}));
state_handler.attach({&text_color, &background_color, &border_color});
state_handler.update_binds();
#ifndef __WXOSX__
SetBackgroundStyle(wxBG_STYLE_PAINT);
#endif
SetBackgroundColour(background_color.colorForStates(state_handler.states()));
SetForegroundColour( text_color.colorForStates(state_handler.states()));
SetBorderColor( border_color.colorForStates(state_handler.states()));
SetCanFocus(false);
return true;
}
void LabeledStaticBox::SetCornerRadius(int radius)
{
this->m_radius = radius;
Refresh();
}
void LabeledStaticBox::SetBorderWidth(int width)
{
this->m_border_width = width;
Refresh();
}
void LabeledStaticBox::SetBorderColor(StateColor const &color)
{
border_color = color;
state_handler.update_binds();
Refresh();
}
void LabeledStaticBox::SetFont(wxFont set_font)
{
m_font = set_font;
Refresh();
}
bool LabeledStaticBox::Enable(bool enable)
{
bool result = this->wxStaticBox::Enable(enable);
if (result) {
wxCommandEvent e(EVT_ENABLE_CHANGED);
e.SetEventObject(this);
GetEventHandler()->ProcessEvent(e);
this->SetForegroundColour( text_color.colorForStates(state_handler.states()));
this->SetBorderColor( border_color.colorForStates(state_handler.states()));
}
return result;
}
void LabeledStaticBox::PickDC(wxDC& dc)
{
#ifdef __WXMSW__
wxSize size = GetSize();
if (size.x <= 0 || size.y <= 0)
return;
wxMemoryDC memdc(&dc);
if (!memdc.IsOk()) {
DrawBorderAndLabel(dc);
return;
}
wxBitmap bmp(size.x, size.y);
memdc.SelectObject(bmp);
memdc.SetBackground(wxBrush(GetBackgroundColour()));
memdc.Clear();
{
wxGCDC dc2(memdc);
DrawBorderAndLabel(dc2);
}
memdc.SelectObject(wxNullBitmap);
dc.DrawBitmap(bmp, 0, 0);
#else
DrawBorderAndLabel(dc);
#endif
}
void LabeledStaticBox::DrawBorderAndLabel(wxDC& dc)
{
// fill full background
dc.SetBackground(wxBrush(background_color.colorForStates(0)));
dc.Clear();
wxSize wSz = GetSize();
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetPen(wxPen(border_color.colorForStates(state_handler.states()), m_border_width, wxSOLID));
dc.DrawRoundedRectangle( // Border
std::max(0, m_pos.x),
std::max(0, m_pos.y) + m_label_height * .5,
wSz.GetWidth(),
wSz.GetHeight() - m_label_height * .5,
m_radius * m_scale
);
if (!m_label.IsEmpty()) {
dc.SetFont(m_font);
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(wxBrush(background_color.colorForStates(0)));
dc.DrawRectangle(wxRect(7 * m_scale,0 , m_label_width + 7 * m_scale, m_label_height)); // text background
// NEEDFIX if text lenght > client size
dc.SetTextForeground(text_color.colorForStates(state_handler.states()));
dc.DrawText(m_label, wxPoint(10 * m_scale, 0));
}
}

View file

@ -0,0 +1,68 @@
#ifndef slic3r_GUI_LabeledStaticBox_hpp_
#define slic3r_GUI_LabeledStaticBox_hpp_
#include <wx/window.h>
#include <wx/dc.h>
#include <wx/dcgraph.h>
#include <wx/dcclient.h>
#include <wx/dcbuffer.h>
#include <wx/settings.h>
#include <wx/statbox.h>
#include <wx/pen.h>
#include "libslic3r/Utils.hpp"
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/Widgets/StateHandler.hpp"
class LabeledStaticBox : public wxStaticBox
{
public:
LabeledStaticBox();
LabeledStaticBox(
wxWindow* parent,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0
);
bool Create(
wxWindow* parent,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0
);
void SetCornerRadius(int radius);
void SetBorderWidth(int width);
void SetBorderColor(StateColor const &color);
void SetFont(wxFont set_font);
bool Enable(bool enable) override;
private:
void PickDC(wxDC& dc);
virtual void DrawBorderAndLabel(wxDC& dc);
protected:
StateHandler state_handler;
StateColor text_color;
StateColor border_color;
StateColor background_color;
int m_border_width;
int m_radius;
wxFont m_font;
wxString m_label;
int m_label_height;
int m_label_width;
float m_scale;
wxPoint m_pos;
};
#endif // !slic3r_GUI_LabeledStaticBox_hpp_

View file

@ -0,0 +1,149 @@
#include "RadioGroup.hpp"
#include "Label.hpp"
#include "StateColor.hpp"
RadioGroup::RadioGroup(
wxWindow* parent,
const std::vector<wxString>& labels,
long direction,
int row_col_limit
)
: wxPanel(parent, wxID_ANY)
, m_on( this, "radio_on" , 18)
, m_off( this, "radio_off" , 18)
, m_on_hover( this, "radio_on_hover" , 18)
, m_off_hover(this, "radio_off_hover", 18)
, m_disabled( this, "radio_off_hover", 18)
, m_selectedIndex(0)
, m_focused(false)
{
Create(parent, labels, direction, row_col_limit);
}
void RadioGroup::Create(
wxWindow* parent,
const std::vector<wxString>& labels,
long direction, /* wxHORIZONTAL / wxVERTICAL */
int row_col_limit /* sets column/row count depends on direction. creates new row if wxHORIZONTAL used after limit reached */
)
{
m_labels = labels;
auto bg = parent->GetBackgroundColour();
this->SetBackgroundColour(bg);
auto bmp_size = m_on.GetBmpSize();
int item_count = m_labels.size();
int item_limit = row_col_limit < 0 ? 1 : row_col_limit > item_count ? item_count : row_col_limit;
int count = (int(item_count / item_limit) + (item_count % item_limit));
int rows = (direction & wxHORIZONTAL) ? item_limit : count;
int cols = (direction & wxHORIZONTAL) ? count : item_limit;
wxFlexGridSizer* f_sizer = new wxFlexGridSizer(rows, cols, 0, 0);
SetDoubleBuffered(true);
AcceptsFocusFromKeyboard();
Bind(wxEVT_SET_FOCUS ,([this](wxFocusEvent e) {m_focused = true ;Refresh(); e.Skip();}));
Bind(wxEVT_KILL_FOCUS,([this](wxFocusEvent e) {m_focused = false;Refresh(); e.Skip();}));
Bind(wxEVT_PAINT,([this](wxPaintEvent e) {
wxPaintDC dc(this);
dc.Clear();
dc.SetPen(wxPen(StateColor::darkModeColorFor(wxColour("#009688")), 1, wxPENSTYLE_SOLID));
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRectangle(
m_focused ? wxRect(
m_radioButtons[GetSelection()]->GetRect().GetTopLeft() - wxPoint(1, 3),
m_labelButtons[GetSelection()]->GetRect().GetBottomRight() + wxPoint(4, 1)
) : wxRect(0,0,0,0)
);
if (m_focused) // Required to take focus again since Refresh causing lossing focus
SetFocus();
}));
// DPIDialog's uses wxEVT_CHAR_HOOK
Bind(wxEVT_CHAR_HOOK, ([this](wxKeyEvent&e){
int k = e.GetKeyCode();
bool is_next = (k == WXK_DOWN || k == WXK_RIGHT);
bool is_prev = (k == WXK_LEFT || k == WXK_UP);
if(m_focused){
if (is_next) SelectNext();
else if (is_prev) SelectPrevious();
e.Skip(!(is_next || is_prev));
}else{
e.Skip();
}
}));
for (int i = 0; i < item_count; ++i){
auto rb = new wxStaticBitmap(this, wxID_ANY, m_off.bmp(), wxDefaultPosition, wxDefaultSize, wxBU_LEFT | wxNO_BORDER);
m_radioButtons.push_back(rb);
rb->Bind(wxEVT_LEFT_DOWN ,([this, i](wxMouseEvent e) {OnClick(i) ; e.Skip();}));
rb->Bind(wxEVT_ENTER_WINDOW,([this, i](wxMouseEvent e) {SetRadioIcon(i, true) ; e.Skip();}));
rb->Bind(wxEVT_LEAVE_WINDOW,([this, i](wxMouseEvent e) {
// prevent removing hover effect while switching between button and its text
if(wxFindWindowAtPoint(wxGetMousePosition())->GetId() != m_labelButtons[i]->GetId())
SetRadioIcon(i, false);
e.Skip();
}));
auto tx = new wxStaticText(this, wxID_ANY, " " + m_labels[i], wxDefaultPosition, wxDefaultSize);
tx->SetForegroundColour(wxColour("#363636"));
tx->SetFont(Label::Body_14);
m_labelButtons.push_back(tx);
tx->Bind(wxEVT_LEFT_DOWN ,([this, i](wxMouseEvent e) {OnClick(i) ; e.Skip();}));
tx->Bind(wxEVT_ENTER_WINDOW,([this, i](wxMouseEvent e) {SetRadioIcon(i, true) ; e.Skip();}));
tx->Bind(wxEVT_LEAVE_WINDOW,([this, i](wxMouseEvent e) {
// prevent removing hover effect while switching between button and its text
if(wxFindWindowAtPoint(wxGetMousePosition())->GetId() != m_radioButtons[i]->GetId())
SetRadioIcon(i, false);
e.Skip();
}));
wxBoxSizer* radio_sizer = new wxBoxSizer(wxHORIZONTAL);
radio_sizer->Add(rb, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 1);
radio_sizer->Add(tx, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, this->FromDIP(15));
f_sizer->Add(radio_sizer, 0, wxTOP | wxBOTTOM, this->FromDIP(4));
}
SetSelection(m_selectedIndex);
SetSizer(f_sizer);
}
void RadioGroup::OnClick(int i)
{
m_focused = true; // prevents 2 time refresh
SetSelection(i);
}
void RadioGroup::SetSelection(int index)
{
if (index >= 0 && index < static_cast<int>(m_labels.size())){
m_selectedIndex = index;
for (size_t i = 0; i < m_labels.size(); ++i)
SetRadioIcon(i, HasFocus() && i == m_selectedIndex);
wxCommandEvent evt(wxEVT_COMMAND_RADIOBOX_SELECTED, GetId());
evt.SetInt(index);
evt.SetString(m_labels[index]);
GetEventHandler()->ProcessEvent(evt);
Refresh(); // refresh on every change
}
}
int RadioGroup::GetSelection()
{
return m_selectedIndex;
}
void RadioGroup::SelectNext(bool focus)
{
SetSelection(m_selectedIndex + 1 > (m_radioButtons.size() - 1) ? 0 : m_selectedIndex + 1);
}
void RadioGroup::SelectPrevious(bool focus)
{
SetSelection(m_selectedIndex - 1 < 0 ? (m_radioButtons.size() - 1) : m_selectedIndex - 1);
}
void RadioGroup::SetRadioIcon(int i, bool hover)
{
auto icon = m_selectedIndex == i ? (hover ? m_on_hover : m_on) : (hover ? m_off_hover : m_off);
m_radioButtons[i]->SetBitmap(icon.bmp());
}

View file

@ -0,0 +1,63 @@
#ifndef slic3r_GUI_RADIOGROUP_hpp_
#define slic3r_GUI_RADIOGROUP_hpp_
#include "../wxExtensions.hpp"
#include <wx/wx.h>
#include <wx/dcclient.h>
#include <wx/dcgraph.h>
#include <vector>
#include <string>
class RadioGroup : public wxPanel
{
public:
RadioGroup();
RadioGroup(
wxWindow* parent,
const std::vector<wxString>& labels = {"1", "2", "3"},
long direction = wxHORIZONTAL,
int row_col_limit = -1
);
void Create(
wxWindow* parent,
const std::vector<wxString>& labels = {"1", "2", "3"},
long direction = wxHORIZONTAL,
int row_col_limit = -1
);
int GetSelection();
void SetSelection(int index);
void SelectNext(bool focus = true);
void SelectPrevious(bool focus = true);
private:
std::vector<wxString> m_labels;
std::vector<wxStaticBitmap*> m_radioButtons;
std::vector<wxStaticText*> m_labelButtons;
int m_selectedIndex;
bool m_focused;
ScalableBitmap m_on;
ScalableBitmap m_off;
ScalableBitmap m_on_hover;
ScalableBitmap m_off_hover;
ScalableBitmap m_disabled;
void OnClick(int i);
void UpdateFocus(bool focus);
void SetRadioIcon(int i, bool hover);
void OnKeyDown(wxKeyEvent& e);
};
#endif // !slic3r_GUI_RADIOGROUP_hpp_

View file

@ -6,6 +6,7 @@
#include "MainFrame.hpp"
#include "Widgets/DialogButtons.hpp"
#include <string>
namespace Slic3r { namespace GUI {
namespace {
@ -19,102 +20,99 @@ void ParseStringValues(std::string str, std::vector<double> &vec)
[](int x){ return x > 0; });
}
int GetTextMax(wxWindow* parent, const std::vector<wxString>& labels)
{
wxSize text_size;
for (wxString label : labels)
text_size.IncTo(parent->GetTextExtent(label));
return text_size.x + parent->FromDIP(10);
}
wxBoxSizer* create_item_checkbox(wxString title, wxWindow* parent, bool* value, CheckBox*& checkbox)
{
wxBoxSizer* m_sizer_checkbox = new wxBoxSizer(wxHORIZONTAL);
m_sizer_checkbox->Add(0, 0, 0, wxEXPAND | wxLEFT, 5);
checkbox = new ::CheckBox(parent);
m_sizer_checkbox->Add(checkbox, 0, wxALIGN_CENTER, 0);
m_sizer_checkbox->Add(0, 0, 0, wxEXPAND | wxLEFT, 8);
auto checkbox_title = new wxStaticText(parent, wxID_ANY, title, wxDefaultPosition, wxSize(-1, -1), 0);
checkbox_title->SetForegroundColour(wxColour(144, 144, 144));
checkbox_title->SetFont(::Label::Body_13);
checkbox_title->Wrap(-1);
m_sizer_checkbox->Add(checkbox_title, 0, wxALIGN_CENTER | wxALL, 3);
checkbox->SetValue(true);
checkbox->Bind(wxEVT_TOGGLEBUTTON, [parent, checkbox, value](wxCommandEvent& e) {
(*value) = (*value) ? false : true;
e.Skip();
});
return m_sizer_checkbox;
}
PA_Calibration_Dlg::PA_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
: DPIDialog(parent, id, _L("PA Calibration"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), m_plater(plater)
: DPIDialog(parent, id, _L("PA Calibration"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE), m_plater(plater)
{
SetBackgroundColour(*wxWHITE); // make sure background color set for dialog
SetForegroundColour(wxColour("#363636"));
SetFont(Label::Body_14);
wxBoxSizer* v_sizer = new wxBoxSizer(wxVERTICAL);
SetSizer(v_sizer);
wxBoxSizer* choice_sizer = new wxBoxSizer(wxHORIZONTAL);
wxString m_rbExtruderTypeChoices[] = { _L("DDE"), _L("Bowden") };
int m_rbExtruderTypeNChoices = sizeof(m_rbExtruderTypeChoices) / sizeof(wxString);
m_rbExtruderType = new wxRadioBox(this, wxID_ANY, _L("Extruder type"), wxDefaultPosition, wxDefaultSize, m_rbExtruderTypeNChoices, m_rbExtruderTypeChoices, 2, wxRA_SPECIFY_COLS);
m_rbExtruderType->SetSelection(0);
choice_sizer->Add(m_rbExtruderType, 0, wxALL, 5);
choice_sizer->Add(FromDIP(5), 0, 0, wxEXPAND, 5);
wxString m_rbMethodChoices[] = { _L("PA Tower"), _L("PA Line"), _L("PA Pattern") };
int m_rbMethodNChoices = sizeof(m_rbMethodChoices) / sizeof(wxString);
m_rbMethod = new wxRadioBox(this, wxID_ANY, _L("Method"), wxDefaultPosition, wxDefaultSize, m_rbMethodNChoices, m_rbMethodChoices, 2, wxRA_SPECIFY_COLS);
m_rbMethod->SetSelection(0);
choice_sizer->Add(m_rbMethod, 0, wxALL, 5);
// Extruder type Radio Group
auto labeled_box_type = new LabeledStaticBox(this, _L("Extruder type"));
auto type_box = new wxStaticBoxSizer(labeled_box_type, wxHORIZONTAL);
v_sizer->Add(choice_sizer);
m_rbExtruderType = new RadioGroup(this, {_L("DDE"), _L("Bowden")}, wxHORIZONTAL);
type_box->Add(m_rbExtruderType, 0, wxALL | wxEXPAND, FromDIP(4));
v_sizer->Add(type_box, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
// Method Radio Group
auto labeled_box_method = new LabeledStaticBox(this, _L("Method"));
auto method_box = new wxStaticBoxSizer(labeled_box_method, wxHORIZONTAL);
m_rbMethod = new RadioGroup(this, { _L("PA Tower"), _L("PA Line"), _L("PA Pattern") }, wxHORIZONTAL);
method_box->Add(m_rbMethod, 0, wxALL | wxEXPAND, FromDIP(4));
v_sizer->Add(method_box, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
// Settings
//
wxString start_pa_str = _L("Start PA: ");
wxString end_pa_str = _L("End PA: ");
wxString PA_step_str = _L("PA step: ");
wxString sp_accel_str = _L("Accelerations: ");
wxString sp_speed_str = _L("Speeds: ");
auto text_size = wxWindow::GetTextExtent(start_pa_str);
text_size.IncTo(wxWindow::GetTextExtent(end_pa_str));
text_size.IncTo(wxWindow::GetTextExtent(PA_step_str));
text_size.IncTo(wxWindow::GetTextExtent(sp_accel_str));
text_size.IncTo(wxWindow::GetTextExtent(sp_speed_str));
text_size.x = text_size.x * 1.1;
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _L("Settings"));
wxString cb_print_no_str = _L("Print numbers");
int text_max = GetTextMax(this, std::vector<wxString>{start_pa_str, end_pa_str, PA_step_str, sp_accel_str, sp_speed_str, cb_print_no_str});
auto st_size = FromDIP(wxSize(text_max, -1));
auto ti_size = FromDIP(wxSize(120, -1));
LabeledStaticBox* stb = new LabeledStaticBox(this, _L("Settings"));
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(stb, wxVERTICAL);
settings_sizer->AddSpacer(FromDIP(5));
auto st_size = FromDIP(wxSize(text_size.x, -1));
auto ti_size = FromDIP(wxSize(140, -1));
// start PA
auto start_PA_sizer = new wxBoxSizer(wxHORIZONTAL);
auto start_pa_text = new wxStaticText(this, wxID_ANY, start_pa_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiStartPA = new TextInput(this, "", "", "", wxDefaultPosition, ti_size, wxTE_CENTRE | wxTE_PROCESS_ENTER);
m_tiStartPA = new TextInput(this, "", "", "", wxDefaultPosition, ti_size, wxTE_PROCESS_ENTER);
m_tiStartPA->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
start_PA_sizer->Add(start_pa_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
start_PA_sizer->Add(m_tiStartPA, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(start_PA_sizer);
start_PA_sizer->Add(start_pa_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
start_PA_sizer->Add(m_tiStartPA , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(start_PA_sizer, 0, wxLEFT, FromDIP(3));
// end PA
auto end_PA_sizer = new wxBoxSizer(wxHORIZONTAL);
auto end_pa_text = new wxStaticText(this, wxID_ANY, end_pa_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiEndPA = new TextInput(this, "", "", "", wxDefaultPosition, ti_size, wxTE_CENTRE | wxTE_PROCESS_ENTER);
m_tiEndPA = new TextInput(this, "", "", "", wxDefaultPosition, ti_size, wxTE_PROCESS_ENTER);
m_tiStartPA->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
end_PA_sizer->Add(end_pa_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
end_PA_sizer->Add(m_tiEndPA, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(end_PA_sizer);
end_PA_sizer->Add(end_pa_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
end_PA_sizer->Add(m_tiEndPA , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(end_PA_sizer, 0, wxLEFT, FromDIP(3));
// PA step
auto PA_step_sizer = new wxBoxSizer(wxHORIZONTAL);
auto PA_step_text = new wxStaticText(this, wxID_ANY, PA_step_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiPAStep = new TextInput(this, "", "", "", wxDefaultPosition, ti_size, wxTE_CENTRE | wxTE_PROCESS_ENTER);
m_tiPAStep = new TextInput(this, "", "", "", wxDefaultPosition, ti_size, wxTE_PROCESS_ENTER);
m_tiStartPA->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
PA_step_sizer->Add(PA_step_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
PA_step_sizer->Add(m_tiPAStep, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(PA_step_sizer);
PA_step_sizer->Add(PA_step_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
PA_step_sizer->Add(m_tiPAStep , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(PA_step_sizer, 0, wxLEFT, FromDIP(3));
settings_sizer->Add(create_item_checkbox(_L("Print numbers"), this, &m_params.print_numbers, m_cbPrintNum));
// Print Numbers
wxBoxSizer* cb_sizer = new wxBoxSizer(wxHORIZONTAL);
auto cb_title = new wxStaticText(this, wxID_ANY, cb_print_no_str, wxDefaultPosition, st_size, 0);
m_cbPrintNum = new CheckBox(this);
m_cbPrintNum->SetValue(false);
m_cbPrintNum->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent& e) {
(m_params.print_numbers) = (m_params.print_numbers) ? false : true;
e.Skip();
});
cb_sizer->Add(cb_title , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
cb_sizer->Add(m_cbPrintNum , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(cb_sizer, 0, wxLEFT | wxTOP | wxBOTTOM, FromDIP(3));
wxTextValidator val_list_validator(wxFILTER_INCLUDE_CHAR_LIST);
val_list_validator.SetCharIncludes(wxString("0123456789,"));
@ -124,21 +122,21 @@ PA_Calibration_Dlg::PA_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater*
m_tiBMAccels = new TextInput(this, "", "", "", wxDefaultPosition, ti_size, wxTE_PROCESS_ENTER);
m_tiBMAccels->SetToolTip(_L("Comma-separated list of printing accelerations"));
m_tiBMAccels->GetTextCtrl()->SetValidator(val_list_validator);
sp_accel_sizer->Add(sp_accel_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
sp_accel_sizer->Add(m_tiBMAccels, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(sp_accel_sizer);
sp_accel_sizer->Add(sp_accel_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
sp_accel_sizer->Add(m_tiBMAccels , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(sp_accel_sizer, 0, wxLEFT, FromDIP(3));
auto sp_speed_sizer = new wxBoxSizer(wxHORIZONTAL);
auto sp_speed_text = new wxStaticText(this, wxID_ANY, sp_speed_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiBMSpeeds = new TextInput(this, "", "", "", wxDefaultPosition, ti_size, wxTE_PROCESS_ENTER);
m_tiBMSpeeds->SetToolTip(_L("Comma-separated list of printing speeds"));
m_tiBMSpeeds->GetTextCtrl()->SetValidator(val_list_validator);
sp_speed_sizer->Add(sp_speed_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
sp_speed_sizer->Add(m_tiBMSpeeds, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(sp_speed_sizer);
sp_speed_sizer->Add(sp_speed_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
sp_speed_sizer->Add(m_tiBMSpeeds , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(sp_speed_sizer, 0, wxLEFT, FromDIP(3));
v_sizer->Add(settings_sizer);
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
v_sizer->AddSpacer(FromDIP(5));
auto dlg_btns = new DialogButtons(this, {"OK"});
v_sizer->Add(dlg_btns , 0, wxEXPAND);
@ -151,7 +149,8 @@ PA_Calibration_Dlg::PA_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater*
m_rbExtruderType->Connect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(PA_Calibration_Dlg::on_extruder_type_changed), NULL, this);
m_rbMethod->Connect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(PA_Calibration_Dlg::on_method_changed), NULL, this);
this->Connect(wxEVT_SHOW, wxShowEventHandler(PA_Calibration_Dlg::on_show));
//wxGetApp().UpdateDlgDarkUI(this);
wxGetApp().UpdateDlgDarkUI(this);
Layout();
Fit();
@ -273,67 +272,69 @@ enum FILAMENT_TYPE : int
};
Temp_Calibration_Dlg::Temp_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
: DPIDialog(parent, id, _L("Temperature calibration"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), m_plater(plater)
: DPIDialog(parent, id, _L("Temperature calibration"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE), m_plater(plater)
{
SetBackgroundColour(*wxWHITE); // make sure background color set for dialog
SetForegroundColour(wxColour("#363636"));
SetFont(Label::Body_14);
wxBoxSizer* v_sizer = new wxBoxSizer(wxVERTICAL);
SetSizer(v_sizer);
wxBoxSizer* choice_sizer = new wxBoxSizer(wxHORIZONTAL);
wxString m_rbFilamentTypeChoices[] = { _L("PLA"), _L("ABS/ASA"), _L("PETG"), _L("PCTG"), _L("TPU"), _L("PA-CF"), _L("PET-CF"), _L("Custom") };
int m_rbFilamentTypeNChoices = sizeof(m_rbFilamentTypeChoices) / sizeof(wxString);
m_rbFilamentType = new wxRadioBox(this, wxID_ANY, _L("Filament type"), wxDefaultPosition, wxDefaultSize, m_rbFilamentTypeNChoices, m_rbFilamentTypeChoices, 2, wxRA_SPECIFY_COLS);
m_rbFilamentType->SetSelection(0);
m_rbFilamentType->Select(0);
choice_sizer->Add(m_rbFilamentType, 0, wxALL, 5);
choice_sizer->Add(FromDIP(5), 0, 0, wxEXPAND, 5);
wxString m_rbMethodChoices[] = { _L("PA Tower"), _L("PA Line") };
// Method Radio Group
auto labeled_box_method = new LabeledStaticBox(this, _L("Filament type"));
auto method_box = new wxStaticBoxSizer(labeled_box_method, wxHORIZONTAL);
v_sizer->Add(choice_sizer);
m_rbFilamentType = new RadioGroup(this, { _L("PLA"), _L("ABS/ASA"), _L("PETG"), _L("PCTG"), _L("TPU"), _L("PA-CF"), _L("PET-CF"), _L("Custom") }, wxVERTICAL, 2);
method_box->Add(m_rbFilamentType, 0, wxALL | wxEXPAND, FromDIP(4));
v_sizer->Add(method_box, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
// Settings
//
wxString start_temp_str = _L("Start temp: ");
wxString end_temp_str = _L("End temp: ");
wxString temp_step_str = _L("Temp step: ");
auto text_size = wxWindow::GetTextExtent(start_temp_str);
text_size.IncTo(wxWindow::GetTextExtent(end_temp_str));
text_size.IncTo(wxWindow::GetTextExtent(temp_step_str));
text_size.x = text_size.x * 1.5;
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _L("Settings"));
int text_max = GetTextMax(this, std::vector<wxString>{start_temp_str, end_temp_str, temp_step_str});
auto st_size = FromDIP(wxSize(text_max, -1));
auto ti_size = FromDIP(wxSize(120, -1));
LabeledStaticBox* stb = new LabeledStaticBox(this, _L("Settings"));
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(stb, wxVERTICAL);
settings_sizer->AddSpacer(FromDIP(5));
auto st_size = FromDIP(wxSize(text_size.x, -1));
auto ti_size = FromDIP(wxSize(90, -1));
// start temp
auto start_temp_sizer = new wxBoxSizer(wxHORIZONTAL);
auto start_temp_text = new wxStaticText(this, wxID_ANY, start_temp_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiStart = new TextInput(this, std::to_string(230), _L("\u2103"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
m_tiStart = new TextInput(this, std::to_string(230), _L("\u2103"), "", wxDefaultPosition, ti_size);
m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
start_temp_sizer->Add(start_temp_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
start_temp_sizer->Add(m_tiStart, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(start_temp_sizer);
start_temp_sizer->Add(start_temp_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
start_temp_sizer->Add(m_tiStart , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(start_temp_sizer, 0, wxLEFT, FromDIP(3));
// end temp
auto end_temp_sizer = new wxBoxSizer(wxHORIZONTAL);
auto end_temp_text = new wxStaticText(this, wxID_ANY, end_temp_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiEnd = new TextInput(this, std::to_string(190), _L("\u2103"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
m_tiEnd = new TextInput(this, std::to_string(190), _L("\u2103"), "", wxDefaultPosition, ti_size);
m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
end_temp_sizer->Add(end_temp_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
end_temp_sizer->Add(m_tiEnd, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(end_temp_sizer);
end_temp_sizer->Add(end_temp_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
end_temp_sizer->Add(m_tiEnd , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(end_temp_sizer, 0, wxLEFT, FromDIP(3));
// temp step
auto temp_step_sizer = new wxBoxSizer(wxHORIZONTAL);
auto temp_step_text = new wxStaticText(this, wxID_ANY, temp_step_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiStep = new TextInput(this, wxString::FromDouble(5),_L("\u2103"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
m_tiStep = new TextInput(this, wxString::FromDouble(5),_L("\u2103"), "", wxDefaultPosition, ti_size);
m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
m_tiStep->Enable(false);
temp_step_sizer->Add(temp_step_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
temp_step_sizer->Add(m_tiStep, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(temp_step_sizer);
temp_step_sizer->Add(temp_step_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
temp_step_sizer->Add(m_tiStep , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(temp_step_sizer, 0, wxLEFT, FromDIP(3));
v_sizer->Add(settings_sizer);
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
settings_sizer->AddSpacer(FromDIP(5));
v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
v_sizer->AddSpacer(FromDIP(5));
auto dlg_btns = new DialogButtons(this, {"OK"});
v_sizer->Add(dlg_btns , 0, wxEXPAND);
@ -342,7 +343,7 @@ Temp_Calibration_Dlg::Temp_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plat
m_rbFilamentType->Connect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(Temp_Calibration_Dlg::on_filament_type_changed), NULL, this);
//wxGetApp().UpdateDlgDarkUI(this);
wxGetApp().UpdateDlgDarkUI(this);
Layout();
Fit();
@ -452,64 +453,66 @@ void Temp_Calibration_Dlg::on_dpi_changed(const wxRect& suggested_rect) {
//
MaxVolumetricSpeed_Test_Dlg::MaxVolumetricSpeed_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
: DPIDialog(parent, id, _L("Max volumetric speed test"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), m_plater(plater)
: DPIDialog(parent, id, _L("Max volumetric speed test"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE), m_plater(plater)
{
SetBackgroundColour(*wxWHITE); // make sure background color set for dialog
SetForegroundColour(wxColour("#363636"));
SetFont(Label::Body_14);
wxBoxSizer* v_sizer = new wxBoxSizer(wxVERTICAL);
SetSizer(v_sizer);
// Settings
//
wxString start_vol_str = _L("Start volumetric speed: ");
wxString end_vol_str = _L("End volumetric speed: ");
wxString vol_step_str = _L("step: ");
auto text_size = wxWindow::GetTextExtent(start_vol_str);
text_size.IncTo(wxWindow::GetTextExtent(end_vol_str));
text_size.IncTo(wxWindow::GetTextExtent(vol_step_str));
text_size.x = text_size.x * 1.5;
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _L("Settings"));
wxString vol_step_str = _L("Step") + ": ";
int text_max = GetTextMax(this, std::vector<wxString>{start_vol_str, end_vol_str, vol_step_str});
wxString input_str = _L("mm³/s");
auto input_text_size = wxWindow::GetTextExtent(input_str);
auto st_size = FromDIP(wxSize(text_max, -1));
auto ti_size = FromDIP(wxSize(120, -1));
LabeledStaticBox* stb = new LabeledStaticBox(this, _L("Settings"));
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(stb, wxVERTICAL);
settings_sizer->AddSpacer(FromDIP(5));
auto st_size = FromDIP(wxSize(text_size.x, -1));
auto ti_size = FromDIP(wxSize(input_text_size.x + 90, -1));
// start vol
auto start_vol_sizer = new wxBoxSizer(wxHORIZONTAL);
auto start_vol_text = new wxStaticText(this, wxID_ANY, start_vol_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiStart = new TextInput(this, std::to_string(5), _L("mm³/s"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
m_tiStart = new TextInput(this, std::to_string(5), _L("mm³/s"), "", wxDefaultPosition, ti_size);
m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
start_vol_sizer->Add(start_vol_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
start_vol_sizer->Add(m_tiStart, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(start_vol_sizer);
start_vol_sizer->Add(start_vol_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
start_vol_sizer->Add(m_tiStart , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(start_vol_sizer, 0, wxLEFT, FromDIP(3));
// end vol
auto end_vol_sizer = new wxBoxSizer(wxHORIZONTAL);
auto end_vol_text = new wxStaticText(this, wxID_ANY, end_vol_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiEnd = new TextInput(this, std::to_string(20), _L("mm³/s"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
m_tiEnd = new TextInput(this, std::to_string(20), _L("mm³/s"), "", wxDefaultPosition, ti_size);
m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
end_vol_sizer->Add(end_vol_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
end_vol_sizer->Add(m_tiEnd, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(end_vol_sizer);
end_vol_sizer->Add(end_vol_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
end_vol_sizer->Add(m_tiEnd , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(end_vol_sizer, 0, wxLEFT, FromDIP(3));
// vol step
auto vol_step_sizer = new wxBoxSizer(wxHORIZONTAL);
auto vol_step_text = new wxStaticText(this, wxID_ANY, vol_step_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiStep = new TextInput(this, wxString::FromDouble(0.5), _L("mm³/s"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
m_tiStep = new TextInput(this, wxString::FromDouble(0.5), _L("mm³/s"), "", wxDefaultPosition, ti_size);
m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
vol_step_sizer->Add(vol_step_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
vol_step_sizer->Add(m_tiStep, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(vol_step_sizer);
vol_step_sizer->Add(vol_step_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
vol_step_sizer->Add(m_tiStep , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(vol_step_sizer, 0, wxLEFT, FromDIP(3));
v_sizer->Add(settings_sizer);
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
v_sizer->AddSpacer(FromDIP(5));
auto dlg_btns = new DialogButtons(this, {"OK"});
v_sizer->Add(dlg_btns , 0, wxEXPAND);
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &MaxVolumetricSpeed_Test_Dlg::on_start, this);
//wxGetApp().UpdateDlgDarkUI(this);
wxGetApp().UpdateDlgDarkUI(this);
Layout();
Fit();
@ -548,65 +551,69 @@ void MaxVolumetricSpeed_Test_Dlg::on_dpi_changed(const wxRect& suggested_rect) {
//
VFA_Test_Dlg::VFA_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
: DPIDialog(parent, id, _L("VFA test"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
: DPIDialog(parent, id, _L("VFA test"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE)
, m_plater(plater)
{
SetBackgroundColour(*wxWHITE); // make sure background color set for dialog
SetForegroundColour(wxColour("#363636"));
SetFont(Label::Body_14);
wxBoxSizer* v_sizer = new wxBoxSizer(wxVERTICAL);
SetSizer(v_sizer);
// Settings
//
wxString start_str = _L("Start speed: ");
wxString end_vol_str = _L("End speed: ");
wxString vol_step_str = _L("step: ");
auto text_size = wxWindow::GetTextExtent(start_str);
text_size.IncTo(wxWindow::GetTextExtent(end_vol_str));
text_size.IncTo(wxWindow::GetTextExtent(vol_step_str));
text_size.x = text_size.x * 1.5;
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _L("Settings"));
wxString vol_step_str = _L("Step") + ": ";
int text_max = GetTextMax(this, std::vector<wxString>{start_str, end_vol_str, vol_step_str});
wxString input_str = _L("mm/s");
auto input_text_size = wxWindow::GetTextExtent(input_str);
auto st_size = FromDIP(wxSize(text_max, -1));
auto ti_size = FromDIP(wxSize(120, -1));
LabeledStaticBox* stb = new LabeledStaticBox(this, _L("Settings"));
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(stb, wxVERTICAL);
settings_sizer->AddSpacer(FromDIP(5));
auto st_size = FromDIP(wxSize(text_size.x, -1));
auto ti_size = FromDIP(wxSize(input_text_size.x + 90, -1));
// start vol
auto start_vol_sizer = new wxBoxSizer(wxHORIZONTAL);
auto start_vol_text = new wxStaticText(this, wxID_ANY, start_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiStart = new TextInput(this, std::to_string(40), _L("mm/s"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
m_tiStart = new TextInput(this, std::to_string(40), _L("mm/s"), "", wxDefaultPosition, ti_size);
m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
start_vol_sizer->Add(start_vol_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
start_vol_sizer->Add(m_tiStart, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(start_vol_sizer);
start_vol_sizer->Add(start_vol_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
start_vol_sizer->Add(m_tiStart , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(start_vol_sizer, 0, wxLEFT, FromDIP(3));
// end vol
auto end_vol_sizer = new wxBoxSizer(wxHORIZONTAL);
auto end_vol_text = new wxStaticText(this, wxID_ANY, end_vol_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiEnd = new TextInput(this, std::to_string(200), _L("mm/s"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
m_tiEnd = new TextInput(this, std::to_string(200), _L("mm/s"), "", wxDefaultPosition, ti_size);
m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
end_vol_sizer->Add(end_vol_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
end_vol_sizer->Add(m_tiEnd, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(end_vol_sizer);
end_vol_sizer->Add(end_vol_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
end_vol_sizer->Add(m_tiEnd , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(end_vol_sizer, 0, wxLEFT, FromDIP(3));
// vol step
auto vol_step_sizer = new wxBoxSizer(wxHORIZONTAL);
auto vol_step_text = new wxStaticText(this, wxID_ANY, vol_step_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiStep = new TextInput(this, wxString::FromDouble(10), _L("mm/s"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
m_tiStep = new TextInput(this, wxString::FromDouble(10), _L("mm/s"), "", wxDefaultPosition, ti_size);
m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
vol_step_sizer->Add(vol_step_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
vol_step_sizer->Add(m_tiStep, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(vol_step_sizer);
vol_step_sizer->Add(vol_step_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
vol_step_sizer->Add(m_tiStep , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(vol_step_sizer, 0, wxLEFT, FromDIP(3));
v_sizer->Add(settings_sizer);
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
settings_sizer->AddSpacer(FromDIP(5));
v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
v_sizer->AddSpacer(FromDIP(5));
auto dlg_btns = new DialogButtons(this, {"OK"});
v_sizer->Add(dlg_btns , 0, wxEXPAND);
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &VFA_Test_Dlg::on_start, this);
// wxGetApp().UpdateDlgDarkUI(this);
wxGetApp().UpdateDlgDarkUI(this);
Layout();
Fit();
@ -647,64 +654,68 @@ void VFA_Test_Dlg::on_dpi_changed(const wxRect& suggested_rect)
//
Retraction_Test_Dlg::Retraction_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
: DPIDialog(parent, id, _L("Retraction test"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), m_plater(plater)
: DPIDialog(parent, id, _L("Retraction test"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE), m_plater(plater)
{
SetBackgroundColour(*wxWHITE); // make sure background color set for dialog
SetForegroundColour(wxColour("#363636"));
SetFont(Label::Body_14);
wxBoxSizer* v_sizer = new wxBoxSizer(wxVERTICAL);
SetSizer(v_sizer);
// Settings
//
wxString start_length_str = _L("Start retraction length: ");
wxString end_length_str = _L("End retraction length: ");
wxString length_step_str = _L("step: ");
auto text_size = wxWindow::GetTextExtent(start_length_str);
text_size.IncTo(wxWindow::GetTextExtent(end_length_str));
text_size.IncTo(wxWindow::GetTextExtent(length_step_str));
text_size.x = text_size.x * 1.5;
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _L("Settings"));
wxString length_step_str = _L("Step") + ": ";
int text_max = GetTextMax(this, std::vector<wxString>{start_length_str, end_length_str, length_step_str});
wxString input_text_str = _L("mm/mm");
auto input_text_size = wxWindow::GetTextExtent(input_text_str);
auto st_size = FromDIP(wxSize(text_max, -1));
auto ti_size = FromDIP(wxSize(120, -1));
LabeledStaticBox* stb = new LabeledStaticBox(this, _L("Settings"));
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(stb, wxVERTICAL);
settings_sizer->AddSpacer(FromDIP(5));
auto st_size = FromDIP(wxSize(text_size.x, -1));
auto ti_size = FromDIP(wxSize(input_text_size.x + 90, -1));
// start length
auto start_length_sizer = new wxBoxSizer(wxHORIZONTAL);
auto start_length_text = new wxStaticText(this, wxID_ANY, start_length_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiStart = new TextInput(this, std::to_string(0), _L("mm"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
m_tiStart = new TextInput(this, std::to_string(0), _L("mm"), "", wxDefaultPosition, ti_size);
m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
start_length_sizer->Add(start_length_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
start_length_sizer->Add(m_tiStart, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(start_length_sizer);
start_length_sizer->Add(start_length_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
start_length_sizer->Add(m_tiStart , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(start_length_sizer, 0, wxLEFT, FromDIP(3));
// end length
auto end_length_sizer = new wxBoxSizer(wxHORIZONTAL);
auto end_length_text = new wxStaticText(this, wxID_ANY, end_length_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiEnd = new TextInput(this, std::to_string(2), _L("mm"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
m_tiEnd = new TextInput(this, std::to_string(2), _L("mm"), "", wxDefaultPosition, ti_size);
m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
end_length_sizer->Add(end_length_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
end_length_sizer->Add(m_tiEnd, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(end_length_sizer);
end_length_sizer->Add(end_length_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
end_length_sizer->Add(m_tiEnd , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(end_length_sizer, 0, wxLEFT, FromDIP(3));
// length step
auto length_step_sizer = new wxBoxSizer(wxHORIZONTAL);
auto length_step_text = new wxStaticText(this, wxID_ANY, length_step_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiStep = new TextInput(this, wxString::FromDouble(0.1), _L("mm/mm"), "", wxDefaultPosition, ti_size, wxTE_RIGHT);
m_tiStep = new TextInput(this, wxString::FromDouble(0.1), _L("mm"), "", wxDefaultPosition, ti_size);
m_tiStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
length_step_sizer->Add(length_step_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
length_step_sizer->Add(m_tiStep, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(length_step_sizer);
length_step_sizer->Add(length_step_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
length_step_sizer->Add(m_tiStep , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(length_step_sizer, 0, wxLEFT, FromDIP(3));
v_sizer->Add(settings_sizer);
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
settings_sizer->AddSpacer(FromDIP(5));
v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
v_sizer->AddSpacer(FromDIP(5));
auto dlg_btns = new DialogButtons(this, {"OK"});
v_sizer->Add(dlg_btns , 0, wxEXPAND);
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &Retraction_Test_Dlg::on_start, this);
//wxGetApp().UpdateDlgDarkUI(this);
wxGetApp().UpdateDlgDarkUI(this);
Layout();
Fit();
@ -742,89 +753,91 @@ void Retraction_Test_Dlg::on_dpi_changed(const wxRect& suggested_rect) {
//
Input_Shaping_Freq_Test_Dlg::Input_Shaping_Freq_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
: DPIDialog(parent, id, _L("Input shaping Frequency test"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), m_plater(plater)
: DPIDialog(parent, id, _L("Input shaping Frequency test"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE), m_plater(plater)
{
SetBackgroundColour(*wxWHITE); // make sure background color set for dialog
SetForegroundColour(wxColour("#363636"));
SetFont(Label::Body_14);
wxBoxSizer* v_sizer = new wxBoxSizer(wxVERTICAL);
SetSizer(v_sizer);
// Model selection
wxString m_rbModelChoices[] = { _L("Ringing Tower"), _L("Fast Tower") };
int m_rbModelNChoices = sizeof(m_rbModelChoices) / sizeof(wxString);
m_rbModel = new wxRadioBox(this, wxID_ANY, _L("Test model"), wxDefaultPosition, wxDefaultSize, m_rbModelNChoices, m_rbModelChoices, 1, wxRA_SPECIFY_ROWS);
m_rbModel->SetSelection(0);
v_sizer->Add(m_rbModel, 0, wxALL | wxEXPAND, 5);
auto labeled_box_model = new LabeledStaticBox(this, _L("Test model"));
auto model_box = new wxStaticBoxSizer(labeled_box_model, wxHORIZONTAL);
m_rbModel = new RadioGroup(this, { _L("Ringing Tower"), _L("Fast Tower") }, wxHORIZONTAL);
model_box->Add(m_rbModel, 0, wxALL | wxEXPAND, FromDIP(4));
v_sizer->Add(model_box, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
// Settings
//
wxString start_x_str = _L("Start X: ");
wxString end_x_str = _L("End X: ");
wxString start_y_str = _L("Start Y: ");
wxString end_y_str = _L("End Y: ");
auto text_size = wxWindow::GetTextExtent(start_x_str);
text_size.IncTo(wxWindow::GetTextExtent(end_x_str));
text_size.IncTo(wxWindow::GetTextExtent(start_y_str));
text_size.IncTo(wxWindow::GetTextExtent(end_y_str));
text_size.x = text_size.x * 1.5;
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _L("Frequency settings"));
wxString x_axis_str = "X " + _L("Start / End") + ": ";
wxString y_axis_str = "Y " + _L("Start / End") + ": ";
int text_max = GetTextMax(this, std::vector<wxString>{x_axis_str, y_axis_str});
auto st_size = FromDIP(wxSize(text_size.x, -1));
auto ti_size = FromDIP(wxSize(90, -1));
auto st_size = FromDIP(wxSize(text_max, -1));
auto ti_size = FromDIP(wxSize(120, -1));
LabeledStaticBox* stb = new LabeledStaticBox(this, _L("Frequency settings"));
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(stb, wxVERTICAL);
settings_sizer->AddSpacer(FromDIP(5));
// X axis frequencies
auto x_freq_sizer = new wxBoxSizer(wxHORIZONTAL);
auto start_x_text = new wxStaticText(this, wxID_ANY, start_x_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiFreqStartX = new TextInput(this, std::to_string(15), _L("HZ"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
auto start_x_text = new wxStaticText(this, wxID_ANY, x_axis_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiFreqStartX = new TextInput(this, std::to_string(15) , _L("hz"), "", wxDefaultPosition, ti_size);
m_tiFreqStartX->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
auto end_x_text = new wxStaticText(this, wxID_ANY, end_x_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiFreqEndX = new TextInput(this, std::to_string(110), _L("HZ"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
m_tiFreqEndX = new TextInput(this, std::to_string(110), _L("hz"), "", wxDefaultPosition, ti_size);
m_tiFreqEndX->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
x_freq_sizer->Add(start_x_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
x_freq_sizer->Add(m_tiFreqStartX, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
x_freq_sizer->Add(end_x_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
x_freq_sizer->Add(m_tiFreqEndX, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(x_freq_sizer);
x_freq_sizer->Add(start_x_text , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
x_freq_sizer->Add(m_tiFreqStartX, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
x_freq_sizer->Add(m_tiFreqEndX , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(x_freq_sizer, 0, wxLEFT, FromDIP(3));
// Y axis frequencies
auto y_freq_sizer = new wxBoxSizer(wxHORIZONTAL);
auto start_y_text = new wxStaticText(this, wxID_ANY, start_y_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiFreqStartY = new TextInput(this, std::to_string(15), _L("HZ"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
auto start_y_text = new wxStaticText(this, wxID_ANY, y_axis_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiFreqStartY = new TextInput(this, std::to_string(15) , _L("hz"), "", wxDefaultPosition, ti_size);
m_tiFreqStartY->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
auto end_y_text = new wxStaticText(this, wxID_ANY, end_y_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiFreqEndY = new TextInput(this, std::to_string(110), _L("HZ"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
m_tiFreqEndY = new TextInput(this, std::to_string(110), _L("hz"), "", wxDefaultPosition, ti_size);
m_tiFreqEndY->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
y_freq_sizer->Add(start_y_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
y_freq_sizer->Add(m_tiFreqStartY, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
y_freq_sizer->Add(end_y_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
y_freq_sizer->Add(m_tiFreqEndY, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(y_freq_sizer);
y_freq_sizer->Add(start_y_text , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
y_freq_sizer->Add(m_tiFreqStartY, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
y_freq_sizer->Add(m_tiFreqEndY , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(y_freq_sizer, 0, wxLEFT, FromDIP(3));
// Damping Factor
wxString damping_factor_str = _L("Damp: ");
auto damping_factor_sizer = new wxBoxSizer(wxHORIZONTAL);
auto damping_factor_text = new wxStaticText(this, wxID_ANY, damping_factor_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiDampingFactor = new TextInput(this, wxString::Format("%.3f", 0.15), "", "", wxDefaultPosition, ti_size, wxTE_CENTRE);
m_tiDampingFactor = new TextInput(this, wxString::Format("%.3f", 0.15), "", "", wxDefaultPosition, ti_size);
m_tiDampingFactor->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
damping_factor_sizer->Add(damping_factor_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
damping_factor_sizer->Add(m_tiDampingFactor, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(damping_factor_sizer);
damping_factor_sizer->Add(damping_factor_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
damping_factor_sizer->Add(m_tiDampingFactor , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(damping_factor_sizer, 0, wxLEFT, FromDIP(3));
settings_sizer->AddSpacer(FromDIP(5));
// Add a note explaining that 0 means use default value
auto note_text = new wxStaticText(this, wxID_ANY, _L("Recommended: Set Damp to 0.\nThis will use the printer's default or the last saved value."), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
note_text->SetForegroundColour(wxColour(128, 128, 128));
settings_sizer->Add(note_text, 0, wxALL, 5);
settings_sizer->Add(note_text, 0, wxALL, FromDIP(5));
v_sizer->Add(settings_sizer);
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
settings_sizer->AddSpacer(FromDIP(5));
v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
v_sizer->AddSpacer(FromDIP(5));
auto dlg_btns = new DialogButtons(this, {"OK"});
v_sizer->Add(dlg_btns , 0, wxEXPAND);
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &Input_Shaping_Freq_Test_Dlg::on_start, this);
//wxGetApp().UpdateDlgDarkUI(this);//FIXME: dark mode background color
wxGetApp().UpdateDlgDarkUI(this);
Layout();
Fit();
@ -876,80 +889,77 @@ void Input_Shaping_Freq_Test_Dlg::on_dpi_changed(const wxRect& suggested_rect) {
//
Input_Shaping_Damp_Test_Dlg::Input_Shaping_Damp_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
: DPIDialog(parent, id, _L("Input shaping Damp test"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), m_plater(plater)
: DPIDialog(parent, id, _L("Input shaping Damp test"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE), m_plater(plater)
{
SetBackgroundColour(*wxWHITE); // make sure background color set for dialog
SetForegroundColour(wxColour("#363636"));
SetFont(Label::Body_14);
wxBoxSizer* v_sizer = new wxBoxSizer(wxVERTICAL);
SetSizer(v_sizer);
// Model selection
wxString m_rbModelChoices[] = { _L("Ringing Tower"), _L("Fast Tower") };
int m_rbModelNChoices = sizeof(m_rbModelChoices) / sizeof(wxString);
m_rbModel = new wxRadioBox(this, wxID_ANY, _L("Test model"), wxDefaultPosition, wxDefaultSize, m_rbModelNChoices, m_rbModelChoices, 1, wxRA_SPECIFY_ROWS);
m_rbModel->SetSelection(0);
v_sizer->Add(m_rbModel, 0, wxALL | wxEXPAND, 5);
auto labeled_box_model = new LabeledStaticBox(this, _L("Test model"));
auto model_box = new wxStaticBoxSizer(labeled_box_model, wxHORIZONTAL);
m_rbModel = new RadioGroup(this, { _L("Ringing Tower"), _L("Fast Tower") }, wxHORIZONTAL);
model_box->Add(m_rbModel, 0, wxALL | wxEXPAND, FromDIP(4));
v_sizer->Add(model_box, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
// Settings
//
wxString freq_x_str = _L("Freq X: ");
wxString freq_y_str = _L("Freq Y: ");
wxString damp_start_str = _L("Start damp: ");
wxString damp_end_str = _L("End damp: ");
auto text_size = wxWindow::GetTextExtent(freq_x_str);
text_size.IncTo(wxWindow::GetTextExtent(freq_y_str));
text_size.IncTo(wxWindow::GetTextExtent(damp_start_str));
text_size.IncTo(wxWindow::GetTextExtent(damp_end_str));
text_size.x = text_size.x * 1.5;
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _L("Frequency settings"));
wxString freq_str = _L("Frequency") + " X / Y: ";
wxString damp_str = _L("Damp") + " " + _L("Start / End") + ": ";
int text_max = GetTextMax(this, std::vector<wxString>{freq_str, damp_str});
auto st_size = FromDIP(wxSize(text_size.x, -1));
auto ti_size = FromDIP(wxSize(90, -1));
auto st_size = FromDIP(wxSize(text_max, -1));
auto ti_size = FromDIP(wxSize(120, -1));
LabeledStaticBox* stb = new LabeledStaticBox(this, _L("Frequency settings"));
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(stb, wxVERTICAL);
settings_sizer->AddSpacer(FromDIP(5));
auto freq_sizer = new wxBoxSizer(wxHORIZONTAL);
auto freq_x_text = new wxStaticText(this, wxID_ANY, freq_x_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiFreqX = new TextInput(this, std::to_string(30), _L("HZ"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
auto freq_text = new wxStaticText(this, wxID_ANY, freq_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiFreqX = new TextInput(this, std::to_string(30), _L("hz"), "", wxDefaultPosition, ti_size);
m_tiFreqX->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
auto freq_y_text = new wxStaticText(this, wxID_ANY, freq_y_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiFreqY = new TextInput(this, std::to_string(30), _L("HZ"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
m_tiFreqY = new TextInput(this, std::to_string(30), _L("hz"), "", wxDefaultPosition, ti_size);
m_tiFreqY->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
freq_sizer->Add(freq_x_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
freq_sizer->Add(m_tiFreqX, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
freq_sizer->Add(freq_y_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
freq_sizer->Add(m_tiFreqY, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(freq_sizer);
freq_sizer->Add(freq_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
freq_sizer->Add(m_tiFreqX, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
freq_sizer->Add(m_tiFreqY, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(freq_sizer, 0, wxLEFT, FromDIP(3));
// Damping Factor Start and End
auto damp_sizer = new wxBoxSizer(wxHORIZONTAL);
auto damp_start_text = new wxStaticText(this, wxID_ANY, damp_start_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiDampingFactorStart = new TextInput(this, wxString::Format("%.3f", 0.00), "", "", wxDefaultPosition, ti_size, wxTE_CENTRE);
auto damp_text = new wxStaticText(this, wxID_ANY, damp_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiDampingFactorStart = new TextInput(this, wxString::Format("%.3f", 0.00), "", "", wxDefaultPosition, ti_size);
m_tiDampingFactorStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
auto damp_end_text = new wxStaticText(this, wxID_ANY, damp_end_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiDampingFactorEnd = new TextInput(this, wxString::Format("%.3f", 0.40), "", "", wxDefaultPosition, ti_size, wxTE_CENTRE);
m_tiDampingFactorEnd = new TextInput(this, wxString::Format("%.3f", 0.40), "", "", wxDefaultPosition, ti_size);
m_tiDampingFactorEnd->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
damp_sizer->Add(damp_text , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
damp_sizer->Add(m_tiDampingFactorStart, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
damp_sizer->Add(m_tiDampingFactorEnd , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(damp_sizer, 0, wxLEFT, FromDIP(3));
damp_sizer->Add(damp_start_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
damp_sizer->Add(m_tiDampingFactorStart, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
damp_sizer->Add(damp_end_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
damp_sizer->Add(m_tiDampingFactorEnd, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(damp_sizer);
settings_sizer->AddSpacer(FromDIP(5));
// Add a note to explain users to use their previously calculated frequency
auto note_text = new wxStaticText(this, wxID_ANY, _L("Note: Use previously calculated frequencies."), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
note_text->SetForegroundColour(wxColour(128, 128, 128));
settings_sizer->Add(note_text, 0, wxALL, 5);
settings_sizer->Add(note_text, 0, wxALL, FromDIP(5));
note_text->SetForegroundColour(wxColour(128, 128, 128));
settings_sizer->Add(note_text, 0, wxALL, 5);
settings_sizer->AddSpacer(FromDIP(5));
v_sizer->Add(settings_sizer);
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
v_sizer->AddSpacer(FromDIP(5));
auto dlg_btns = new DialogButtons(this, {"OK"});
v_sizer->Add(dlg_btns , 0, wxEXPAND);
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &Input_Shaping_Damp_Test_Dlg::on_start, this);
//wxGetApp().UpdateDlgDarkUI(this);//FIXME: dark mode background color
wxGetApp().UpdateDlgDarkUI(this);
Layout();
Fit();
@ -1000,61 +1010,72 @@ void Input_Shaping_Damp_Test_Dlg::on_dpi_changed(const wxRect& suggested_rect) {
//
Junction_Deviation_Test_Dlg::Junction_Deviation_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
: DPIDialog(parent, id, _L("Junction Deviation test"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), m_plater(plater)
: DPIDialog(parent, id, _L("Junction Deviation test"), wxDefaultPosition, parent->FromDIP(wxSize(-1, 280)), wxDEFAULT_DIALOG_STYLE), m_plater(plater)
{
SetBackgroundColour(*wxWHITE); // make sure background color set for dialog
SetForegroundColour(wxColour("#363636"));
SetFont(Label::Body_14);
wxBoxSizer* v_sizer = new wxBoxSizer(wxVERTICAL);
SetSizer(v_sizer);
// Model selection
wxString m_rbModelChoices[] = { _L("Ringing Tower"), _L("Fast Tower") };
int m_rbModelNChoices = sizeof(m_rbModelChoices) / sizeof(wxString);
m_rbModel = new wxRadioBox(this, wxID_ANY, _L("Test model"), wxDefaultPosition, wxDefaultSize, m_rbModelNChoices, m_rbModelChoices, 1, wxRA_SPECIFY_ROWS);
m_rbModel->SetSelection(1);
v_sizer->Add(m_rbModel, 0, wxALL | wxEXPAND, 5);
auto labeled_box_model = new LabeledStaticBox(this, _L("Test model"));
auto model_box = new wxStaticBoxSizer(labeled_box_model, wxHORIZONTAL);
m_rbModel = new RadioGroup(this, { _L("Ringing Tower"), _L("Fast Tower") }, wxHORIZONTAL);
model_box->Add(m_rbModel, 0, wxALL | wxEXPAND, FromDIP(4));
v_sizer->Add(model_box, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
// Settings
wxString start_jd_str = _L("Start junction deviation: ");
wxString end_jd_str = _L("End junction deviation: ");
auto text_size = wxWindow::GetTextExtent(start_jd_str);
text_size.IncTo(wxWindow::GetTextExtent(end_jd_str));
text_size.x = text_size.x * 1.5;
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _L("Junction Deviation settings"));
int text_max = GetTextMax(this, std::vector<wxString>{start_jd_str, end_jd_str});
auto st_size = FromDIP(wxSize(text_size.x, -1));
auto ti_size = FromDIP(wxSize(90, -1));
auto st_size = FromDIP(wxSize(text_max, -1));
auto ti_size = FromDIP(wxSize(120, -1));
LabeledStaticBox* stb = new LabeledStaticBox(this, _L("Junction Deviation settings"));
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(stb, wxVERTICAL);
settings_sizer->AddSpacer(FromDIP(5));
// Start junction deviation
auto start_jd_sizer = new wxBoxSizer(wxHORIZONTAL);
auto start_jd_text = new wxStaticText(this, wxID_ANY, start_jd_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiJDStart = new TextInput(this, wxString::Format("%.3f", 0.000), _L("mm"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
m_tiJDStart = new TextInput(this, wxString::Format("%.3f", 0.000), _L("mm"), "", wxDefaultPosition, ti_size);
m_tiJDStart->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
start_jd_sizer->Add(start_jd_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
start_jd_sizer->Add(m_tiJDStart, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(start_jd_sizer);
start_jd_sizer->Add(start_jd_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
start_jd_sizer->Add(m_tiJDStart , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(start_jd_sizer, 0, wxLEFT, FromDIP(3));
// End junction deviation
auto end_jd_sizer = new wxBoxSizer(wxHORIZONTAL);
auto end_jd_text = new wxStaticText(this, wxID_ANY, end_jd_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
m_tiJDEnd = new TextInput(this, wxString::Format("%.3f", 0.250), _L("mm"), "", wxDefaultPosition, ti_size, wxTE_CENTRE);
m_tiJDEnd = new TextInput(this, wxString::Format("%.3f", 0.250), _L("mm"), "", wxDefaultPosition, ti_size);
m_tiJDEnd->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
end_jd_sizer->Add(end_jd_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
end_jd_sizer->Add(m_tiJDEnd, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
settings_sizer->Add(end_jd_sizer);
end_jd_sizer->Add(end_jd_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
end_jd_sizer->Add(m_tiJDEnd , 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
settings_sizer->Add(end_jd_sizer, 0, wxLEFT, FromDIP(3));
settings_sizer->AddSpacer(FromDIP(5));
// Add note about junction deviation
auto note_text = new wxStaticText(this, wxID_ANY, _L("Note: Lower values = sharper corners but slower speeds"),
wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
note_text->SetForegroundColour(wxColour(128, 128, 128));
settings_sizer->Add(note_text, 0, wxALL, 5);
settings_sizer->Add(note_text, 0, wxALL, FromDIP(5));
v_sizer->Add(settings_sizer);
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
v_sizer->Add(settings_sizer, 0, wxTOP | wxRIGHT | wxLEFT | wxEXPAND, FromDIP(10));
v_sizer->AddSpacer(FromDIP(5));
auto dlg_btns = new DialogButtons(this, {"OK"});
v_sizer->Add(dlg_btns , 0, wxEXPAND);
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &Junction_Deviation_Test_Dlg::on_start, this);
wxGetApp().UpdateDlgDarkUI(this);
Layout();
Fit();
}

View file

@ -3,13 +3,14 @@
#include "wxExtensions.hpp"
#include "GUI_Utils.hpp"
#include "Widgets/RadioBox.hpp"
#include "Widgets/Button.hpp"
#include "Widgets/RoundedRectangle.hpp"
#include "Widgets/Label.hpp"
#include "Widgets/CheckBox.hpp"
#include "Widgets/ComboBox.hpp"
#include "Widgets/TextInput.hpp"
#include "Widgets/LabeledStaticBox.hpp"
#include "Widgets/RadioGroup.hpp"
#include "GUI_App.hpp"
#include "wx/hyperlink.h"
#include <wx/radiobox.h>
@ -35,8 +36,8 @@ protected:
Calib_Params m_params;
wxRadioBox* m_rbExtruderType;
wxRadioBox* m_rbMethod;
RadioGroup* m_rbExtruderType;
RadioGroup* m_rbMethod;
TextInput* m_tiStartPA;
TextInput* m_tiEndPA;
TextInput* m_tiPAStep;
@ -60,7 +61,7 @@ protected:
virtual void on_filament_type_changed(wxCommandEvent& event);
Calib_Params m_params;
wxRadioBox* m_rbFilamentType;
RadioGroup* m_rbFilamentType;
TextInput* m_tiStart;
TextInput* m_tiEnd;
TextInput* m_tiStep;
@ -132,7 +133,7 @@ protected:
virtual void on_start(wxCommandEvent& event);
Calib_Params m_params;
wxRadioBox* m_rbModel;
RadioGroup* m_rbModel;
TextInput* m_tiFreqStartX;
TextInput* m_tiFreqEndX;
TextInput* m_tiFreqStartY;
@ -153,7 +154,7 @@ protected:
virtual void on_start(wxCommandEvent& event);
Calib_Params m_params;
wxRadioBox* m_rbModel;
RadioGroup* m_rbModel;
TextInput* m_tiFreqX;
TextInput* m_tiFreqY;
TextInput* m_tiDampingFactorStart;
@ -172,7 +173,7 @@ protected:
virtual void on_start(wxCommandEvent& event);
Calib_Params m_params;
wxRadioBox* m_rbModel;
RadioGroup* m_rbModel;
TextInput* m_tiJDStart;
TextInput* m_tiJDEnd;
Plater* m_plater;