mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-25 03:42:05 +00:00
Merge branch 'main' into dev/bbl-network-upd
# Conflicts: # src/slic3r/GUI/SelectMachine.cpp
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
#pragma once
|
||||
#include <wx/wxprec.h>
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
@@ -311,4 +310,4 @@ void MyScrollbar::OnMouseWheel(wxMouseEvent &event)
|
||||
}
|
||||
Refresh();
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,10 +38,10 @@ SpinInput::SpinInput(wxWindow *parent,
|
||||
const wxPoint &pos,
|
||||
const wxSize & size,
|
||||
long style,
|
||||
int min, int max, int initial)
|
||||
int min, int max, int initial, const int& step)
|
||||
: SpinInput()
|
||||
{
|
||||
Create(parent, text, label, pos, size, style, min, max, initial);
|
||||
Create(parent, text, label, pos, size, style, min, max, initial, step);
|
||||
}
|
||||
|
||||
void SpinInput::Create(wxWindow *parent,
|
||||
@@ -50,7 +50,7 @@ void SpinInput::Create(wxWindow *parent,
|
||||
const wxPoint &pos,
|
||||
const wxSize & size,
|
||||
long style,
|
||||
int min, int max, int initial)
|
||||
int min, int max, int initial, int step)
|
||||
{
|
||||
StaticBox::Create(parent, wxID_ANY, pos, size);
|
||||
SetFont(Label::Body_12);
|
||||
@@ -76,6 +76,7 @@ void SpinInput::Create(wxWindow *parent,
|
||||
if (text.ToLong(&initialFromText)) initial = initialFromText;
|
||||
SetRange(min, max);
|
||||
SetValue(initial);
|
||||
SetStep(step);
|
||||
messureSize();
|
||||
}
|
||||
|
||||
@@ -229,7 +230,7 @@ Button *SpinInput::createButton(bool inc)
|
||||
btn->DisableFocusFromKeyboard();
|
||||
btn->Bind(wxEVT_LEFT_DOWN, [=](auto &e) {
|
||||
delta = inc ? 1 : -1;
|
||||
SetValue(val + delta);
|
||||
SetValue(val + delta * step);
|
||||
text_ctrl->SetFocus();
|
||||
if (!btn->HasCapture())
|
||||
btn->CaptureMouse();
|
||||
@@ -241,7 +242,7 @@ Button *SpinInput::createButton(bool inc)
|
||||
delta = inc ? 1 : -1;
|
||||
if (!btn->HasCapture())
|
||||
btn->CaptureMouse();
|
||||
SetValue(val + delta);
|
||||
SetValue(val + delta * step);
|
||||
sendSpinEvent();
|
||||
});
|
||||
btn->Bind(wxEVT_LEFT_UP, [=](auto &e) {
|
||||
@@ -259,7 +260,7 @@ void SpinInput::onTimer(wxTimerEvent &evnet) {
|
||||
delta /= 2;
|
||||
return;
|
||||
}
|
||||
SetValue(val + delta);
|
||||
SetValue(val + delta * step);
|
||||
sendSpinEvent();
|
||||
}
|
||||
|
||||
@@ -293,7 +294,7 @@ void SpinInput::onTextEnter(wxCommandEvent &event)
|
||||
void SpinInput::mouseWheelMoved(wxMouseEvent &event)
|
||||
{
|
||||
auto delta = event.GetWheelRotation() < 0 ? 1 : -1;
|
||||
SetValue(val + delta);
|
||||
SetValue(val + delta * step);
|
||||
sendSpinEvent();
|
||||
text_ctrl->SetFocus();
|
||||
}
|
||||
@@ -305,10 +306,10 @@ void SpinInput::keyPressed(wxKeyEvent &event)
|
||||
case WXK_DOWN:
|
||||
long value;
|
||||
if (!text_ctrl->GetValue().ToLong(&value)) { value = val; }
|
||||
if (event.GetKeyCode() == WXK_DOWN && value > min) {
|
||||
--value;
|
||||
} else if (event.GetKeyCode() == WXK_UP && value + 1 < max) {
|
||||
++value;
|
||||
if (event.GetKeyCode() == WXK_DOWN && value - step >= min) {
|
||||
value = value - step;
|
||||
} else if (event.GetKeyCode() == WXK_UP && value + step <= max) {
|
||||
value = value + step;
|
||||
}
|
||||
if (value != val) {
|
||||
SetValue(value);
|
||||
|
||||
@@ -23,6 +23,7 @@ class SpinInput : public wxNavigationEnabled<StaticBox>
|
||||
int min;
|
||||
int max;
|
||||
int delta;
|
||||
int step;
|
||||
|
||||
static const int SpinInputWidth = 200;
|
||||
static const int SpinInputHeight = 50;
|
||||
@@ -36,7 +37,7 @@ public:
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize & size = wxDefaultSize,
|
||||
long style = 0,
|
||||
int min = 0, int max = 100, int initial = 0);
|
||||
int min = 0, int max = 100, int initial = 0, const int& step = 1);
|
||||
|
||||
void Create(wxWindow * parent,
|
||||
wxString text,
|
||||
@@ -46,7 +47,8 @@ public:
|
||||
long style = 0,
|
||||
int min = 0,
|
||||
int max = 100,
|
||||
int initial = 0);
|
||||
int initial = 0,
|
||||
int step = 1);
|
||||
|
||||
void SetCornerRadius(double radius);
|
||||
|
||||
@@ -70,6 +72,10 @@ public:
|
||||
|
||||
int GetValue () const;
|
||||
|
||||
void SetStep(int value) { step = value; };
|
||||
|
||||
int GetStep() { return step; };
|
||||
|
||||
void SetRange(int min, int max);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -234,7 +234,7 @@ void StateColor::append(unsigned long color, int states)
|
||||
{
|
||||
if ((color & 0xff000000) == 0)
|
||||
color |= 0xff000000;
|
||||
wxColour cl; cl.SetRGBA(color & 0xff00ff00 | ((color & 0xff) << 16) | ((color >> 16) & 0xff));
|
||||
wxColour cl; cl.SetRGBA((color & 0xff00ff00) | ((color & 0xff) << 16) | ((color >> 16) & 0xff));
|
||||
append(cl, states);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ void StateHandler::update_binds()
|
||||
int diff = bind_states ^ bind_states_;
|
||||
State states[] = {Enabled, Checked, Focused, Hovered, Pressed};
|
||||
wxEventType events[] = {EVT_ENABLE_CHANGED, wxEVT_CHECKBOX, wxEVT_SET_FOCUS, wxEVT_ENTER_WINDOW, wxEVT_LEFT_DOWN};
|
||||
wxEventType events2[] = {{0}, {0}, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP};
|
||||
wxEventType events2[] = {0, 0, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP};
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
int s = states[i];
|
||||
if (diff & s) {
|
||||
@@ -74,7 +74,7 @@ void StateHandler::set_state(int state, int mask)
|
||||
{
|
||||
if ((states_ & mask) == (state & mask)) return;
|
||||
int old = states_;
|
||||
states_ = states_ & ~mask | state & mask;
|
||||
states_ = (states_ & ~mask) | (state & mask);
|
||||
if (old != states_ && (old | states2_) != (states_ | states2_)) {
|
||||
if (parent_)
|
||||
parent_->changed(states_ | states2_);
|
||||
@@ -94,7 +94,7 @@ void StateHandler::changed(wxEvent &event)
|
||||
{
|
||||
event.Skip();
|
||||
wxEventType events[] = {EVT_ENABLE_CHANGED, wxEVT_CHECKBOX, wxEVT_SET_FOCUS, wxEVT_ENTER_WINDOW, wxEVT_LEFT_DOWN};
|
||||
wxEventType events2[] = {{0}, {0}, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP};
|
||||
wxEventType events2[] = {0, 0, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP};
|
||||
int old = states_;
|
||||
// some events are from another window (ex: text_ctrl of TextInput), save state in states2_ to avoid conflicts
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
|
||||
Reference in New Issue
Block a user