Implemented #4931 - Added colored background for the Manipulation panel, if

option "Use colors for axes values in Manipulation panel" is enabled in Preferences -> GUI
+ Fix one more compilation warning in UnsavedChangesDialog.cpp
This commit is contained in:
YuSanka 2021-02-09 16:03:32 +01:00
parent 820c18923b
commit a1e49e7f8c
4 changed files with 37 additions and 4 deletions

View file

@ -123,6 +123,9 @@ void AppConfig::set_defaults()
if (get("default_action_on_select_preset").empty())
set("default_action_on_select_preset", "none"); // , "transfer", "discard" or "save"
if (get("color_mapinulation_panel").empty())
set("color_mapinulation_panel", "0");
}
#if ENABLE_CUSTOMIZABLE_FILES_ASSOCIATION_ON_WIN
else {

View file

@ -109,10 +109,13 @@ static void set_font_and_background_style(wxWindow* win, const wxFont& font)
win->SetBackgroundStyle(wxBG_STYLE_PAINT);
}
static const wxString axes_color_text[] = { "#990000", "#009900", "#000099" };
static const wxString axes_color_back[] = { "#f5dcdc", "#dcf5dc", "#dcdcf5" };
ObjectManipulation::ObjectManipulation(wxWindow* parent) :
OG_Settings(parent, true)
{
m_imperial_units = wxGetApp().app_config->get("use_inches") == "1";
m_use_colors = wxGetApp().app_config->get("color_mapinulation_panel") == "1";
m_manifold_warning_bmp = ScalableBitmap(parent, "exclamation");
@ -236,13 +239,14 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
// Add Axes labels with icons
static const char axes[] = { 'X', 'Y', 'Z' };
// std::vector<wxString> axes_color = {"#990000", "#009900","#000099"};
// std::vector<wxString> axes_color = {"#EE0000", "#00EE00", "#0000EE"};
for (size_t axis_idx = 0; axis_idx < sizeof(axes); axis_idx++) {
const char label = axes[axis_idx];
wxStaticText* axis_name = new wxStaticText(m_parent, wxID_ANY, wxString(label));
set_font_and_background_style(axis_name, wxGetApp().bold_font());
// axis_name->SetForegroundColour(wxColour(axes_color[axis_idx]));
//if (m_use_colors)
// axis_name->SetForegroundColour(wxColour(axes_color_text[axis_idx]));
sizer = new wxBoxSizer(wxHORIZONTAL);
// Under OSX we use font, smaller than default font, so
@ -481,8 +485,20 @@ void ObjectManipulation::update_ui_from_settings()
update(3/*meSize*/, m_new_size);
}
}
m_check_inch->SetValue(m_imperial_units);
if (m_use_colors != (wxGetApp().app_config->get("color_mapinulation_panel") == "1"))
{
m_use_colors = wxGetApp().app_config->get("color_mapinulation_panel") == "1";
// update colors for edit-boxes
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));
editor->SetBackgroundColour(m_use_colors ? wxColour(axes_color_back[axis_id]) : wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
if (++axis_id == 3)
axis_id = 0;
}
}
}
void ObjectManipulation::update_settings_value(const Selection& selection)
@ -1000,6 +1016,10 @@ ManipulationEditor::ManipulationEditor(ObjectManipulation* parent,
#ifdef __WXOSX__
this->OSXDisableAllSmartSubstitutions();
#endif // __WXOSX__
if (parent->use_colors()) {
// this->SetForegroundColour(wxColour(axes_color_text[axis]));
this->SetBackgroundColour(wxColour(axes_color_back[axis]));
}
// A name used to call handle_sidebar_focus_event()
m_full_opt_name = m_opt_key+"_"+axes[axis];

View file

@ -95,6 +95,7 @@ private:
wxStaticText* m_rotate_Label = nullptr;
bool m_imperial_units { false };
bool m_use_colors { false };
wxStaticText* m_position_unit { nullptr };
wxStaticText* m_size_unit { nullptr };
@ -162,7 +163,8 @@ public:
void Show(const bool show) override;
bool IsShown() override;
void UpdateAndShow(const bool show) override;
void update_ui_from_settings();
void update_ui_from_settings();
bool use_colors() { return m_use_colors; }
void set_dirty() { m_dirty = true; }
// Called from the App to update the UI if dirty.

View file

@ -297,6 +297,14 @@ void PreferencesDialog::build()
option = Option(def, "suppress_hyperlinks");
m_optgroup_gui->append_single_option_line(option);
def.label = L("Use colors for axes values in Manipulation panel");
def.type = coBool;
def.tooltip = L("If enabled, the axes names and axes values will be colorized according to the axes colors. "
"If disabled, old UI will be used.");
def.set_default_value(new ConfigOptionBool{ app_config->get("color_mapinulation_panel") == "1" });
option = Option(def, "color_mapinulation_panel");
m_optgroup_gui->append_single_option_line(option);
def.label = L("Use custom size for toolbar icons");
def.type = coBool;
def.tooltip = L("If enabled, you can change size of toolbar icons manually.");