Color mixing feature (#15347)

# Description

This PR ports the color mixing feature from BambuStudio.
The port is based on the previous work by @ianalexis in #15231.
This PR completes the port and fixes various bugs.

Several improvements were also made during the porting process.

WIP


# Screenshots/Recordings/Graphs

<!--
> Please attach relevant screenshots to showcase the UI changes.
> Please attach images that can help explain the changes.
-->

## Tests

<!--
> Please describe the tests that you have conducted to verify the
changes made in this PR.
-->

<!--
> A guide for users on how to download the artifacts from this PR.
-->

[How to Download Pull Requests Artifacts for
Testing](https://www.orcaslicer.com/wiki/how_to_download_pr_artifacts)
This commit is contained in:
SoftFever
2026-08-25 22:10:49 +08:00
committed by GitHub
109 changed files with 38066 additions and 306 deletions
+16
View File
@@ -9,6 +9,8 @@
#include "../GUI_Utils.hpp"
#endif
wxDEFINE_EVENT(EVT_SPINCTRL_TEXT, wxCommandEvent);
BEGIN_EVENT_TABLE(SpinInput, StaticBox)
EVT_KEY_DOWN(SpinInput::keyPressed)
@@ -74,6 +76,7 @@ void SpinInput::Create(wxWindow *parent,
state_handler.attach_child(text_ctrl);
text_ctrl->Bind(wxEVT_KILL_FOCUS, &SpinInput::onTextLostFocus, this);
text_ctrl->Bind(wxEVT_TEXT_ENTER, &SpinInput::onTextEnter, this);
text_ctrl->Bind(wxEVT_TEXT, &SpinInput::onTextChanged, this);
text_ctrl->Bind(wxEVT_KEY_DOWN, &SpinInput::keyPressed, this);
text_ctrl->Bind(wxEVT_RIGHT_DOWN, [](auto &e) {}); // disable context menu
button_inc = createButton(true);
@@ -300,6 +303,19 @@ void SpinInput::onTextEnter(wxCommandEvent &event)
ProcessEventLocally(event);
}
void SpinInput::onTextChanged(wxCommandEvent &event)
{
long value;
if (text_ctrl->GetValue().ToLong(&value)) {
wxCommandEvent e(EVT_SPINCTRL_TEXT, GetId());
e.SetEventObject(this);
e.SetInt((int) value);
e.SetString(text_ctrl->GetValue());
GetEventHandler()->ProcessEvent(e);
}
event.Skip();
}
void SpinInput::mouseWheelMoved(wxMouseEvent &event)
{
auto delta = event.GetWheelRotation() < 0 ? 1 : -1;