mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-20 07:11:12 -06:00
Update the codes to 01.01.00.10 for the formal release
1. first formal version of macos 2. add the bambu networking plugin install logic 3. auto compute the wipe volume when filament change 4. add the logic of wiping into support 5. refine the GUI layout and icons, improve the gui apperance in lots of small places 6. serveral improve to support 7. support AMS auto-mapping 8. disable lots of unstable features: such as params table, media file download, HMS 9. fix serveral kinds of bugs 10. update the document of building 11. ...
This commit is contained in:
parent
e1528e4299
commit
e9e4d75877
267 changed files with 10326 additions and 32228 deletions
|
@ -14,14 +14,14 @@ static const int UNLOAD_STEP_COUNT = 3;
|
|||
static const wxColour AMS_TRAY_DEFAULT_COL = wxColour(255, 255, 255);
|
||||
|
||||
static wxString FILAMENT_LOAD_STEP_STRING[LOAD_STEP_COUNT] = {
|
||||
_L("Heat the nozzle to target \ntemperature"),
|
||||
_L("Heat the nozzle to target temperature"),
|
||||
_L("Cut filament"),
|
||||
_L("Pull back current filament"),
|
||||
_L("Push new filament \ninto extruder"),
|
||||
_L("Push new filament into extruder"),
|
||||
_L("Purge old filament"),
|
||||
};
|
||||
|
||||
static wxString FILAMENT_UNLOAD_STEP_STRING[UNLOAD_STEP_COUNT] = {_L("Heat the nozzle to target \ntemperature"), _L("Cut filament"), _L("Pull back current filament")};
|
||||
static wxString FILAMENT_UNLOAD_STEP_STRING[UNLOAD_STEP_COUNT] = {_L("Heat the nozzle to target temperature"), _L("Cut filament"), _L("Pull back current filament")};
|
||||
|
||||
wxDEFINE_EVENT(EVT_AMS_LOAD, SimpleEvent);
|
||||
wxDEFINE_EVENT(EVT_AMS_UNLOAD, SimpleEvent);
|
||||
|
@ -1138,13 +1138,6 @@ void AmsCans::SelectCan(std::string canid)
|
|||
|
||||
void AmsCans::SetAmsStep(wxString canid, AMSPassRoadType type, AMSPassRoadSTEP step)
|
||||
{
|
||||
auto tag_can_index = -1;
|
||||
for (auto i = 0; i < m_can_road_list.GetCount(); i++) {
|
||||
CanRoads *road = m_can_road_list[i];
|
||||
if (canid == road->canRoad->m_info.can_id) { tag_can_index = road->canRoad->m_canindex; }
|
||||
}
|
||||
|
||||
if (tag_can_index == -1) return;
|
||||
|
||||
if (step == AMSPassRoadSTEP::AMS_ROAD_STEP_NONE) {
|
||||
for (auto i = 0; i < m_can_road_list.GetCount(); i++) {
|
||||
|
@ -1157,6 +1150,14 @@ void AmsCans::SetAmsStep(wxString canid, AMSPassRoadType type, AMSPassRoadSTEP s
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
auto tag_can_index = -1;
|
||||
for (auto i = 0; i < m_can_road_list.GetCount(); i++) {
|
||||
CanRoads *road = m_can_road_list[i];
|
||||
if (canid == road->canRoad->m_info.can_id) { tag_can_index = road->canRoad->m_canindex; }
|
||||
}
|
||||
if (tag_can_index == -1) return;
|
||||
|
||||
// get colour
|
||||
auto tag_colour = *wxWHITE;
|
||||
for (auto i = 0; i < m_can_lib_list.GetCount(); i++) {
|
||||
|
@ -1430,6 +1431,7 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons
|
|||
amswin->SetSizer(m_sizer_body);
|
||||
amswin->Layout();
|
||||
amswin->Fit();
|
||||
|
||||
//Thaw();
|
||||
|
||||
SetSize(amswin->GetSize());
|
||||
|
@ -1503,7 +1505,7 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons
|
|||
m_simplebook_calibration->AddPage(m_calibration_err_panel, wxEmptyString, false);
|
||||
|
||||
AddPage(amswin, wxEmptyString, false);
|
||||
AddPage(m_in_calibration_panel, wxEmptyString, false);
|
||||
AddPage(m_simplebook_calibration, wxEmptyString, false);
|
||||
|
||||
UpdateStepCtrl();
|
||||
|
||||
|
@ -1518,11 +1520,11 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons
|
|||
|
||||
void AMSControl::init_scaled_buttons()
|
||||
{
|
||||
m_button_extruder_feed->SetMinSize(wxSize(FromDIP(54), FromDIP(24)));
|
||||
m_button_extruder_feed->SetMinSize(wxSize(-1, FromDIP(24)));
|
||||
m_button_extruder_feed->SetCornerRadius(FromDIP(11));
|
||||
m_button_extruder_back->SetMinSize(wxSize(FromDIP(54), FromDIP(24)));
|
||||
m_button_extruder_back->SetMinSize(wxSize(-1, FromDIP(24)));
|
||||
m_button_extruder_back->SetCornerRadius(FromDIP(11));
|
||||
m_button_ams_setting->SetMinSize(wxSize(FromDIP(88), FromDIP(33)));
|
||||
m_button_ams_setting->SetMinSize(wxSize(-1, FromDIP(33)));
|
||||
m_button_ams_setting->SetCornerRadius(FromDIP(12));
|
||||
}
|
||||
|
||||
|
@ -1651,9 +1653,9 @@ void AMSControl::StopRridLoading(wxString amsid, wxString canid)
|
|||
void AMSControl::msw_rescale()
|
||||
{
|
||||
m_extruder->msw_rescale();
|
||||
m_button_extruder_back->SetMinSize(wxSize(FromDIP(54), FromDIP(24)));
|
||||
m_button_extruder_feed->SetMinSize(wxSize(FromDIP(54), FromDIP(24)));
|
||||
m_button_ams_setting->SetMinSize(wxSize(FromDIP(88), FromDIP(33)));
|
||||
m_button_extruder_back->SetMinSize(wxSize(-1, FromDIP(24)));
|
||||
m_button_extruder_feed->SetMinSize(wxSize(-1, FromDIP(24)));
|
||||
m_button_ams_setting->SetMinSize(wxSize(-1, FromDIP(33)));
|
||||
|
||||
for (auto i = 0; i < m_ams_cans_list.GetCount(); i++) {
|
||||
AmsCansWindow *cans = m_ams_cans_list[i];
|
||||
|
@ -1689,6 +1691,13 @@ void AMSControl::CreateAms()
|
|||
Thaw();
|
||||
}
|
||||
|
||||
void AMSControl::Reset()
|
||||
{
|
||||
m_current_ams = "";
|
||||
m_current_senect = "";
|
||||
}
|
||||
|
||||
|
||||
void AMSControl::UpdateAms(std::vector<AMSinfo> info, bool keep_selection)
|
||||
{
|
||||
std::string curr_ams_id = GetCurentAms();
|
||||
|
|
|
@ -490,6 +490,7 @@ public:
|
|||
void on_ams_setting_click(wxCommandEvent &event);
|
||||
void on_clibration_again_click(wxMouseEvent &event);
|
||||
void on_clibration_cancel_click(wxMouseEvent &event);
|
||||
void Reset();
|
||||
|
||||
void post_event(wxEvent &&event);
|
||||
|
||||
|
|
|
@ -151,7 +151,6 @@ void Button::render(wxDC& dc)
|
|||
wxSize szIcon;
|
||||
wxSize szContent = textSize;
|
||||
|
||||
|
||||
ScalableBitmap icon;
|
||||
if (m_selected || ((states & (int)StateColor::State::Hovered) != 0))
|
||||
icon = active_icon;
|
||||
|
@ -217,7 +216,10 @@ void Button::messureSize()
|
|||
if (szIcon.y > szContent.y)
|
||||
szContent.y = szIcon.y;
|
||||
}
|
||||
wxWindow::SetMinSize(szContent + paddingSize * 2);
|
||||
wxSize size = szContent + paddingSize * 2;
|
||||
if (minSize.GetHeight() > 0)
|
||||
size.SetHeight(minSize.GetHeight());
|
||||
wxWindow::SetMinSize(size);
|
||||
}
|
||||
|
||||
void Button::mouseDown(wxMouseEvent& event)
|
||||
|
|
|
@ -4,9 +4,12 @@
|
|||
|
||||
CheckBox::CheckBox(wxWindow* parent)
|
||||
: wxBitmapToggleButton(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE)
|
||||
, m_on(this, "check_on", 16)
|
||||
, m_half(this, "check_half", 16)
|
||||
, m_off(this, "check_off", 16)
|
||||
, m_on(this, "check_on", 16)
|
||||
, m_half(this, "check_half", 16)
|
||||
, m_off(this, "check_off", 16)
|
||||
, m_on_disabled(this, "check_on_disabled", 16)
|
||||
, m_half_disabled(this, "check_half_disabled", 16)
|
||||
, m_off_disabled(this, "check_off_disabled", 16)
|
||||
{
|
||||
//SetBackgroundStyle(wxBG_STYLE_TRANSPARENT);
|
||||
if (parent)
|
||||
|
@ -40,4 +43,5 @@ void CheckBox::Rescale()
|
|||
void CheckBox::update()
|
||||
{
|
||||
SetBitmap((m_half_checked ? m_half : GetValue() ? m_on : m_off).bmp());
|
||||
}
|
||||
SetBitmapDisabled((m_half_checked ? m_half_disabled : GetValue() ? m_on_disabled : m_off_disabled).bmp());
|
||||
}
|
||||
|
|
|
@ -21,10 +21,13 @@ private:
|
|||
void update();
|
||||
|
||||
private:
|
||||
ScalableBitmap m_on;
|
||||
ScalableBitmap m_half;
|
||||
ScalableBitmap m_off;
|
||||
bool m_half_checked = false;
|
||||
ScalableBitmap m_on;
|
||||
ScalableBitmap m_half;
|
||||
ScalableBitmap m_off;
|
||||
ScalableBitmap m_on_disabled;
|
||||
ScalableBitmap m_half_disabled;
|
||||
ScalableBitmap m_off_disabled;
|
||||
bool m_half_checked = false;
|
||||
};
|
||||
|
||||
#endif // !slic3r_GUI_CheckBox_hpp_
|
||||
|
|
|
@ -35,6 +35,33 @@ wxFont Label::Body_14 = Label::sysFont(14, false);
|
|||
wxFont Label::Body_13 = Label::sysFont(13, false);
|
||||
wxFont Label::Body_12 = Label::sysFont(12, false);
|
||||
wxFont Label::Body_10 = Label::sysFont(10, false);
|
||||
wxFont Label::Body_9 = Label::sysFont(9, false);
|
||||
|
||||
wxSize Label::split_lines(wxDC &dc, int width, const wxString &text, wxString &multiline_text)
|
||||
{
|
||||
multiline_text = text;
|
||||
if (width > 0 && dc.GetTextExtent(text).x > width) {
|
||||
size_t start = 0;
|
||||
while (true) {
|
||||
size_t idx = size_t(-1);
|
||||
for (size_t i = start; i < multiline_text.Len(); i++) {
|
||||
if (multiline_text[i] == ' ') {
|
||||
if (dc.GetTextExtent(multiline_text.SubString(start, i)).x < width)
|
||||
idx = i;
|
||||
else {
|
||||
if (idx == size_t(-1)) idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (idx == size_t(-1)) break;
|
||||
multiline_text[idx] = '\n';
|
||||
start = idx + 1;
|
||||
if (dc.GetTextExtent(multiline_text.Mid(start)).x < width) break;
|
||||
}
|
||||
}
|
||||
return dc.GetMultiLineTextExtent(multiline_text);
|
||||
}
|
||||
|
||||
Label::Label(wxString const &text, wxWindow *parent) : Label(Body_16, text, parent) {}
|
||||
|
||||
|
|
|
@ -29,8 +29,11 @@ public:
|
|||
static wxFont Body_13;
|
||||
static wxFont Body_12;
|
||||
static wxFont Body_10;
|
||||
static wxFont Body_9;
|
||||
|
||||
static wxFont sysFont(int size, bool bold = false);
|
||||
|
||||
static wxSize split_lines(wxDC &dc, int width, const wxString &text, wxString &multiline_text);
|
||||
};
|
||||
|
||||
#endif // !slic3r_GUI_Label_hpp_
|
||||
|
|
|
@ -165,7 +165,11 @@ void SideButton::paintEvent(wxPaintEvent& evt)
|
|||
{
|
||||
// depending on your system you may need to look at double-buffered dcs
|
||||
wxPaintDC dc(this);
|
||||
#ifdef __WXMSW__
|
||||
wxGCDC dc2(dc);
|
||||
#else
|
||||
wxDC & dc2(dc);
|
||||
#endif
|
||||
render(dc2);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,9 +42,18 @@ bool SidePopup::Show( bool show )
|
|||
void SidePopup::Popup(wxWindow* focus)
|
||||
{
|
||||
Create();
|
||||
int screenwidth = wxSystemSettings::GetMetric(wxSYS_SCREEN_X,NULL);
|
||||
int max_width = 0;
|
||||
for (auto btn : btn_list)
|
||||
{
|
||||
max_width = std::max(btn->GetMinSize().x, max_width);
|
||||
}
|
||||
if (focus) {
|
||||
wxPoint pos = focus->ClientToScreen(wxPoint(0, -6));
|
||||
Position(pos, {0, focus->GetSize().y + 12});
|
||||
if (pos.x + max_width > screenwidth)
|
||||
Position({pos.x - (pos.x + max_width - screenwidth),pos.y}, {0, focus->GetSize().y + 12});
|
||||
else
|
||||
Position(pos, {0, focus->GetSize().y + 12});
|
||||
}
|
||||
wxPopupTransientWindow::Popup();
|
||||
}
|
||||
|
|
|
@ -242,36 +242,35 @@ void StepIndicator::doRender(wxDC &dc)
|
|||
states = clr_step.Disabled;
|
||||
}
|
||||
|
||||
int font_height = radius * 2;
|
||||
if (steps.size() > 0)
|
||||
font_height = dc.GetTextExtent(steps[0]).y;
|
||||
int textWidth = size.x - radius * 5;
|
||||
dc.SetFont(GetFont());
|
||||
wxString firstLine;
|
||||
if (step == 0) dc.SetFont(GetFont().Bold());
|
||||
wxSize firstLineSize = Label::split_lines(dc, textWidth, steps.front(), firstLine);
|
||||
wxString lastLine;
|
||||
if (step == steps.size() - 1) dc.SetFont(GetFont().Bold());
|
||||
wxSize lastLineSize = Label::split_lines(dc, textWidth, steps.back(), lastLine);
|
||||
int firstPadding = std::max(0, firstLineSize.y / 2 - radius);
|
||||
int lastPadding = std::max(0, lastLineSize.y / 2 - radius);
|
||||
|
||||
int itemWidth = steps.size() == 1 ? size.y : (size.y - font_height) / (steps.size() - 1);
|
||||
wxRect rcBar = {radius - bar_width / 2, radius, bar_width, size.y - radius * 4};
|
||||
wxRect rcBar = {radius * 2 - bar_width / 2, radius * 2 + firstPadding, bar_width, size.y - radius * 6 - firstPadding - lastPadding};
|
||||
int itemWidth = steps.size() == 1 ? size.y : rcBar.height / (steps.size() - 1);
|
||||
|
||||
// Draw thin bar stick
|
||||
dc.SetPen(wxPen(clr_bar.colorForStates(states)));
|
||||
dc.SetBrush(wxBrush(clr_bar.colorForStates(states)));
|
||||
dc.DrawRectangle(rcBar);
|
||||
int circleX = radius;
|
||||
int circleY = radius;
|
||||
|
||||
int circleX = radius * 2;
|
||||
int circleY = radius * 3 + firstPadding;
|
||||
dc.SetPen(wxPen(clr_step.colorForStates(states)));
|
||||
dc.SetBrush(wxBrush(clr_step.colorForStates(states)));
|
||||
for (int i = 0; i < steps.size(); ++i) {
|
||||
bool disabled = step > i;
|
||||
bool checked = step == i;
|
||||
// Draw circle point & texts in it
|
||||
dc.DrawEllipse(circleX - radius, circleY - radius, radius * 2, radius * 2);
|
||||
dc.SetTextForeground(clr_text.colorForStates(states
|
||||
| (disabled ? StateColor::Disabled : checked ? StateColor::Checked : 0)));
|
||||
dc.SetFont(checked ? GetFont().Bold() : GetFont());
|
||||
wxSize textSize = dc.GetTextExtent(steps[i]);
|
||||
|
||||
|
||||
if (steps[i].Find("\n") >= 0) {
|
||||
dc.DrawText(steps[i], circleX + radius * 3, circleY - textSize.y / 4);
|
||||
} else {
|
||||
dc.DrawText(steps[i], circleX + radius * 3, circleY - (textSize.y/2));
|
||||
}
|
||||
|
||||
// Draw content ( icon or text ) in circle
|
||||
if (disabled) {
|
||||
wxSize sz = bmp_ok.GetBmpSize();
|
||||
dc.DrawBitmap(bmp_ok.bmp(), circleX - radius, circleY - radius);
|
||||
|
@ -283,6 +282,22 @@ void StepIndicator::doRender(wxDC &dc)
|
|||
wxSize sz = dc.GetTextExtent(tip);
|
||||
dc.DrawText(tip, circleX - sz.x / 2, circleY - sz.y / 2 + 1);
|
||||
}
|
||||
// Draw step text
|
||||
dc.SetTextForeground(clr_text.colorForStates(states
|
||||
| (disabled ? StateColor::Disabled : checked ? StateColor::Checked : 0)));
|
||||
dc.SetFont(checked ? GetFont().Bold() : GetFont());
|
||||
wxString text;
|
||||
wxSize textSize;
|
||||
if (i == 0) {
|
||||
text = firstLine;
|
||||
textSize = firstLineSize;
|
||||
} else if (i == steps.size() - 1) {
|
||||
text = lastLine;
|
||||
textSize = lastLineSize;
|
||||
} else {
|
||||
textSize = Label::split_lines(dc, textWidth, steps[i], text);
|
||||
}
|
||||
dc.DrawText(text, circleX + radius * 3, circleY - (textSize.y / 2));
|
||||
circleY += itemWidth;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ class StepCtrlBase : public StaticBox
|
|||
{
|
||||
protected:
|
||||
wxFont font_tip;
|
||||
StateColor clr_bar;
|
||||
StateColor clr_bar;
|
||||
StateColor clr_step;
|
||||
StateColor clr_text;
|
||||
StateColor clr_tip;
|
||||
|
|
|
@ -88,16 +88,16 @@ void TempInput::Create(wxWindow *parent, wxString text, wxString label, wxString
|
|||
if (!AllisNum(temp.ToStdString())) return;
|
||||
if (max_temp <= 0) return;
|
||||
|
||||
auto tempint = std::stoi(temp.ToStdString());
|
||||
if ((tempint > max_temp || tempint < min_temp) && !warning_mode) {
|
||||
if (tempint > max_temp)
|
||||
Warning(true, WARNING_TOO_HIGH);
|
||||
else if (tempint < min_temp)
|
||||
Warning(true, WARNING_TOO_LOW);
|
||||
return;
|
||||
} else {
|
||||
Warning(false);
|
||||
}
|
||||
/* auto tempint = std::stoi(temp.ToStdString());
|
||||
if ((tempint > max_temp || tempint < min_temp) && !warning_mode) {
|
||||
if (tempint > max_temp)
|
||||
Warning(true, WARNING_TOO_HIGH);
|
||||
else if (tempint < min_temp)
|
||||
Warning(true, WARNING_TOO_LOW);
|
||||
return;
|
||||
} else {
|
||||
Warning(false);
|
||||
}*/
|
||||
SetFinish();
|
||||
});
|
||||
text_ctrl->Bind(wxEVT_TEXT_ENTER, [this](wxCommandEvent &e) {
|
||||
|
@ -428,22 +428,28 @@ void TempInput::render(wxDC &dc)
|
|||
auto text = wxWindow::GetLabel();
|
||||
dc.SetFont(::Label::Head_14);
|
||||
labelSize = dc.GetMultiLineTextExtent(wxWindow::GetLabel());
|
||||
dc.SetTextForeground(label_color.colorForStates((int) StateColor::Normal));
|
||||
if (!IsEnabled())
|
||||
|
||||
if (!IsEnabled()) {
|
||||
dc.SetTextForeground(wxColour(0xAC, 0xAC, 0xAC));
|
||||
dc.SetTextBackground(background_color.colorForStates((int) StateColor::Disabled));
|
||||
else
|
||||
}
|
||||
else {
|
||||
dc.SetTextForeground(wxColour(0x32, 0x3A, 0x3D));
|
||||
dc.SetTextBackground(background_color.colorForStates((int) states));
|
||||
|
||||
if (!text.IsEmpty()) {
|
||||
wxSize textSize = text_ctrl->GetSize();
|
||||
if (align_right) {
|
||||
if (pt.x + labelSize.x > size.x) text = wxControl::Ellipsize(text, dc, wxELLIPSIZE_END, size.x - pt.x);
|
||||
pt.y = (size.y - labelSize.y) / 2;
|
||||
} else {
|
||||
pt.y = (size.y - labelSize.y) / 2;
|
||||
}
|
||||
dc.DrawText(text, pt);
|
||||
}
|
||||
|
||||
|
||||
/*if (!text.IsEmpty()) {
|
||||
|
||||
}*/
|
||||
wxSize textSize = text_ctrl->GetSize();
|
||||
if (align_right) {
|
||||
if (pt.x + labelSize.x > size.x) text = wxControl::Ellipsize(text, dc, wxELLIPSIZE_END, size.x - pt.x);
|
||||
pt.y = (size.y - labelSize.y) / 2;
|
||||
} else {
|
||||
pt.y = (size.y - labelSize.y) / 2;
|
||||
}
|
||||
dc.DrawText(text, pt);
|
||||
|
||||
// separator
|
||||
dc.SetFont(::Label::Body_12);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue