DarkMode for MSW ()

* MSW specific: Dark Mode: First implementation

* Use menu instead of NoteBook

* Implemented MessageDialog
+ Fixed DarkMode for all dialogs and ColorPicker

* MSW DarkMode: Added missed updates for the switching between modes

* MSW DarkMode: Updated all existed context menus after switching of the mode
+ Added markers for the menu item witch is related to the selected tab

* Used wxFrame instead of wxDialog for SettingsDialog
(this change allow us to use menu bar in SettingsDialog)

+ fix for  - Prusa Slicer 2.3.1 not activating non-modal settings window if settings window is minimized

* Implemented "Always use Dark mode colors" preference option

* Fixes for non_MSW build

* Next fixes for non-MSW builds

* Preferences: Fixed selection of the Settings Layout for non-MSW platforms
+ Updated DarkMode for colorpickers

* Windows DarkMode next fixes

* MSWDarkMode: Suppress to use system color to the PrusaSlicer
Select "Preferences -> Use Dark color mode (experimental)" to allow dark mode for the application

* Fixed MSW build

* MSWDarkMode: Upadteed color mode for ExtruderSequenceDialog and for dialogs related to the DoubleSlider

* Implemented Auto recreation of the PrusaSlicer when color mode is changed.

* Preferences: Added option "Set settings tabs as menu items (experimental)"
This commit is contained in:
Oleksandra Yushchenko 2021-06-18 19:46:04 +02:00 committed by GitHub
parent 65f440c2ba
commit fd071421cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 2011 additions and 443 deletions

View file

@ -1,6 +1,7 @@
#include "GUI_ObjectManipulation.hpp"
#include "GUI_ObjectList.hpp"
#include "I18N.hpp"
#include "BitmapComboBox.hpp"
#include "GLCanvas3D.hpp"
#include "OptionsGroup.hpp"
@ -12,6 +13,7 @@
#include "Selection.hpp"
#include "Plater.hpp"
#include "MainFrame.hpp"
#include "MsgDialog.hpp"
#include <boost/algorithm/string.hpp>
#include "slic3r/Utils/FixModelByWin10.hpp"
@ -64,7 +66,7 @@ static choice_ctrl* create_word_local_combo(wxWindow *parent)
temp->SetTextCtrlStyle(wxTE_READONLY);
temp->Create(parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr);
#else
temp = new choice_ctrl(parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr, wxCB_READONLY);
temp = new choice_ctrl(parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr, wxCB_READONLY | wxBORDER_SIMPLE);
#endif //__WXOSX__
temp->SetFont(Slic3r::GUI::wxGetApp().normal_font());
@ -198,7 +200,7 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
auto add_label = [this, height](wxStaticText** label, const std::string& name, wxSizer* reciver = nullptr)
{
*label = new wxStaticText(m_parent, wxID_ANY, _(name) + ":");
set_font_and_background_style(m_move_Label, wxGetApp().normal_font());
set_font_and_background_style(*label, wxGetApp().normal_font());
wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->SetMinSize(wxSize(-1, height));
@ -513,7 +515,14 @@ void ObjectManipulation::update_ui_from_settings()
int axis_id = 0;
for (ManipulationEditor* editor : m_editors) {
// editor->SetForegroundColour(m_use_colors ? wxColour(axes_color_text[axis_id]) : wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
#ifdef _WIN32
if (m_use_colors)
editor->SetBackgroundColour(wxColour(axes_color_back[axis_id]));
else
wxGetApp().UpdateDarkUI(editor);
#else
editor->SetBackgroundColour(m_use_colors ? wxColour(axes_color_back[axis_id]) : wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
#endif /* _WIN32 */
if (++axis_id == 3)
axis_id = 0;
}
@ -949,7 +958,8 @@ void ObjectManipulation::set_uniform_scaling(const bool new_value)
// Is the angle close to a multiple of 90 degrees?
if (! Geometry::is_rotation_ninety_degrees(volume->get_instance_rotation())) {
// Cannot apply scaling in the world coordinate system.
wxMessageDialog dlg(GUI::wxGetApp().mainframe,
//wxMessageDialog dlg(GUI::wxGetApp().mainframe,
MessageDialog dlg(GUI::wxGetApp().mainframe,
_L("The currently manipulated object is tilted (rotation angles are not multiples of 90°).\n"
"Non-uniform scaling of tilted objects is only possible in the World coordinate system,\n"
"once the rotation is embedded into the object coordinates.") + "\n" +
@ -1015,6 +1025,14 @@ void ObjectManipulation::msw_rescale()
void ObjectManipulation::sys_color_changed()
{
#ifdef _WIN32
get_og()->sys_color_changed();
wxGetApp().UpdateDarkUI(m_word_local_combo);
wxGetApp().UpdateDarkUI(m_check_inch);
for (ManipulationEditor* editor : m_editors)
editor->sys_color_changed(this);
#endif
// btn...->msw_rescale() updates icon on button, so use it
m_mirror_bitmap_on.msw_rescale();
m_mirror_bitmap_off.msw_rescale();
@ -1026,8 +1044,6 @@ void ObjectManipulation::sys_color_changed()
for (int id = 0; id < 3; ++id)
m_mirror_buttons[id].first->msw_rescale();
get_og()->sys_color_changed();
}
static const char axes[] = { 'x', 'y', 'z' };
@ -1035,7 +1051,11 @@ ManipulationEditor::ManipulationEditor(ObjectManipulation* parent,
const std::string& opt_key,
int axis) :
wxTextCtrl(parent->parent(), wxID_ANY, wxEmptyString, wxDefaultPosition,
wxSize((wxOSX ? 5 : 6)*int(wxGetApp().em_unit()), wxDefaultCoord), wxTE_PROCESS_ENTER),
wxSize((wxOSX ? 5 : 6)*int(wxGetApp().em_unit()), wxDefaultCoord), wxTE_PROCESS_ENTER
#ifdef _WIN32
| wxBORDER_SIMPLE
#endif
),
m_opt_key(opt_key),
m_axis(axis)
{
@ -1044,8 +1064,9 @@ ManipulationEditor::ManipulationEditor(ObjectManipulation* parent,
this->OSXDisableAllSmartSubstitutions();
#endif // __WXOSX__
if (parent->use_colors()) {
// this->SetForegroundColour(wxColour(axes_color_text[axis]));
this->SetBackgroundColour(wxColour(axes_color_back[axis]));
} else {
wxGetApp().UpdateDarkUI(this);
}
// A name used to call handle_sidebar_focus_event()
@ -1094,6 +1115,12 @@ void ManipulationEditor::msw_rescale()
SetMinSize(wxSize(5 * em, wxDefaultCoord));
}
void ManipulationEditor::sys_color_changed(ObjectManipulation* parent)
{
if (!parent->use_colors())
wxGetApp().UpdateDarkUI(this);
}
double ManipulationEditor::get_value()
{
wxString str = GetValue();