ENH: [STUDIO-1477] indicators for that has object configs
Change-Id: I4556b049cd6aa128a05f69c00fa14d8ea5bb3f39
This commit is contained in:
parent
536df6ca23
commit
2f7946333d
|
@ -16,6 +16,7 @@
|
||||||
#include "Widgets/Label.hpp"
|
#include "Widgets/Label.hpp"
|
||||||
#include "Widgets/SwitchButton.hpp"
|
#include "Widgets/SwitchButton.hpp"
|
||||||
#include "Widgets/Button.hpp"
|
#include "Widgets/Button.hpp"
|
||||||
|
#include "GUI_Factories.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
@ -676,6 +677,43 @@ void ParamsPanel::switch_to_object(bool with_tips)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ParamsPanel::notify_object_config_changed()
|
||||||
|
{
|
||||||
|
auto & model = wxGetApp().model();
|
||||||
|
bool has_config = false;
|
||||||
|
for (auto obj : model.objects) {
|
||||||
|
if (!obj->config.empty()) {
|
||||||
|
SettingsFactory::Bundle cat_options = SettingsFactory::get_bundle(&obj->config.get(), true);
|
||||||
|
if (cat_options.size() > 0) {
|
||||||
|
has_config = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (auto volume : obj->volumes) {
|
||||||
|
if (!volume->config.empty()) {
|
||||||
|
SettingsFactory::Bundle cat_options = SettingsFactory::get_bundle(&volume->config.get(), true);
|
||||||
|
if (cat_options.size() > 0) {
|
||||||
|
has_config = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (has_config) break;
|
||||||
|
}
|
||||||
|
if (has_config == m_has_object_config) return;
|
||||||
|
m_has_object_config = has_config;
|
||||||
|
if (has_config)
|
||||||
|
m_mode_region->SetTextColor2(StateColor(std::pair{*wxWHITE, (int) StateColor::Checked}, std::pair{wxGetApp().get_label_clr_modified(), 0}));
|
||||||
|
else
|
||||||
|
m_mode_region->SetTextColor2(StateColor());
|
||||||
|
m_mode_region->Rescale();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ParamsPanel::switch_to_object_if_has_object_configs()
|
||||||
|
{
|
||||||
|
if (m_has_object_config) m_mode_region->SetValue(true);
|
||||||
|
}
|
||||||
|
|
||||||
void ParamsPanel::free_sizers()
|
void ParamsPanel::free_sizers()
|
||||||
{
|
{
|
||||||
if (m_top_sizer)
|
if (m_top_sizer)
|
||||||
|
|
|
@ -120,6 +120,8 @@ class ParamsPanel : public wxPanel
|
||||||
|
|
||||||
wxPanel* m_current_tab { nullptr };
|
wxPanel* m_current_tab { nullptr };
|
||||||
|
|
||||||
|
bool m_has_object_config { false };
|
||||||
|
|
||||||
struct Highlighter
|
struct Highlighter
|
||||||
{
|
{
|
||||||
void set_timer_owner(wxEvtHandler *owner, int timerid = wxID_ANY);
|
void set_timer_owner(wxEvtHandler *owner, int timerid = wxID_ANY);
|
||||||
|
@ -154,6 +156,9 @@ class ParamsPanel : public wxPanel
|
||||||
void switch_to_global();
|
void switch_to_global();
|
||||||
void switch_to_object(bool with_tips = false);
|
void switch_to_object(bool with_tips = false);
|
||||||
|
|
||||||
|
void notify_object_config_changed();
|
||||||
|
void switch_to_object_if_has_object_configs();
|
||||||
|
|
||||||
StaticBox* get_top_panel() { return m_top_panel; }
|
StaticBox* get_top_panel() { return m_top_panel; }
|
||||||
|
|
||||||
wxPanel* filament_panel() { return m_tab_filament; }
|
wxPanel* filament_panel() { return m_tab_filament; }
|
||||||
|
|
|
@ -3801,6 +3801,8 @@ void Plater::priv::object_list_changed()
|
||||||
bool can_slice = !model.objects.empty() && !export_in_progress && model_fits && part_plate->has_printable_instances();
|
bool can_slice = !model.objects.empty() && !export_in_progress && model_fits && part_plate->has_printable_instances();
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": can_slice %1%, model_fits= %2%, export_in_progress %3%, has_printable_instances %4% ")%can_slice %model_fits %export_in_progress %part_plate->has_printable_instances();
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": can_slice %1%, model_fits= %2%, export_in_progress %3%, has_printable_instances %4% ")%can_slice %model_fits %export_in_progress %part_plate->has_printable_instances();
|
||||||
main_frame->update_slice_print_status(MainFrame::eEventObjectUpdate, can_slice);
|
main_frame->update_slice_print_status(MainFrame::eEventObjectUpdate, can_slice);
|
||||||
|
|
||||||
|
wxGetApp().params_panel()->notify_object_config_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::priv::select_curr_plate_all()
|
void Plater::priv::select_curr_plate_all()
|
||||||
|
@ -7394,6 +7396,8 @@ void Plater::load_project(wxString const& filename2,
|
||||||
else
|
else
|
||||||
p->dirty_state.update_from_undo_redo_stack(true);
|
p->dirty_state.update_from_undo_redo_stack(true);
|
||||||
up_to_date(true, true);
|
up_to_date(true, true);
|
||||||
|
|
||||||
|
wxGetApp().params_panel()->switch_to_object_if_has_object_configs();
|
||||||
}
|
}
|
||||||
|
|
||||||
// BBS: save logic
|
// BBS: save logic
|
||||||
|
|
|
@ -2234,7 +2234,7 @@ void TabPrintModel::on_value_change(const std::string& opt_key, const boost::any
|
||||||
config.second->touch();
|
config.second->touch();
|
||||||
notify_changed(config.first);
|
notify_changed(config.first);
|
||||||
}
|
}
|
||||||
|
wxGetApp().params_panel()->notify_object_config_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabPrintModel::reload_config()
|
void TabPrintModel::reload_config()
|
||||||
|
|
|
@ -463,7 +463,7 @@ public:
|
||||||
|
|
||||||
void reset_model_config();
|
void reset_model_config();
|
||||||
|
|
||||||
bool has_key(std::string const & key);
|
bool has_key(std::string const &key);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void activate_selected_page(std::function<void()> throw_if_canceled);
|
virtual void activate_selected_page(std::function<void()> throw_if_canceled);
|
||||||
|
|
|
@ -33,6 +33,11 @@ void SwitchButton::SetTextColor(StateColor const& color)
|
||||||
text_color = color;
|
text_color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SwitchButton::SetTextColor2(StateColor const &color)
|
||||||
|
{
|
||||||
|
text_color2 = color;
|
||||||
|
}
|
||||||
|
|
||||||
void SwitchButton::SetTrackColor(StateColor const& color)
|
void SwitchButton::SetTrackColor(StateColor const& color)
|
||||||
{
|
{
|
||||||
track_color = color;
|
track_color = color;
|
||||||
|
@ -116,7 +121,7 @@ void SwitchButton::Rescale()
|
||||||
}
|
}
|
||||||
memdc.SetTextForeground(text_color.colorForStates(state ^ StateColor::Checked));
|
memdc.SetTextForeground(text_color.colorForStates(state ^ StateColor::Checked));
|
||||||
memdc.DrawText(labels[0], {BS + (thumbSize.x - textSize[0].x) / 2, BS + (thumbSize.y - textSize[0].y) / 2});
|
memdc.DrawText(labels[0], {BS + (thumbSize.x - textSize[0].x) / 2, BS + (thumbSize.y - textSize[0].y) / 2});
|
||||||
memdc.SetTextForeground(text_color.colorForStates(state));
|
memdc.SetTextForeground(text_color2.count() == 0 ? text_color.colorForStates(state) : text_color2.colorForStates(state));
|
||||||
memdc.DrawText(labels[1], {trackSize.x - thumbSize.x - BS + (thumbSize.x - textSize[1].x) / 2, BS + (thumbSize.y - textSize[1].y) / 2});
|
memdc.DrawText(labels[1], {trackSize.x - thumbSize.x - BS + (thumbSize.x - textSize[1].x) / 2, BS + (thumbSize.y - textSize[1].y) / 2});
|
||||||
memdc.SelectObject(wxNullBitmap);
|
memdc.SelectObject(wxNullBitmap);
|
||||||
#ifdef __WXOSX__
|
#ifdef __WXOSX__
|
||||||
|
|
|
@ -16,7 +16,9 @@ public:
|
||||||
|
|
||||||
void SetTextColor(StateColor const &color);
|
void SetTextColor(StateColor const &color);
|
||||||
|
|
||||||
void SetTrackColor(StateColor const &color);
|
void SetTextColor2(StateColor const &color);
|
||||||
|
|
||||||
|
void SetTrackColor(StateColor const &color);
|
||||||
|
|
||||||
void SetThumbColor(StateColor const &color);
|
void SetThumbColor(StateColor const &color);
|
||||||
|
|
||||||
|
@ -32,7 +34,8 @@ private:
|
||||||
ScalableBitmap m_off;
|
ScalableBitmap m_off;
|
||||||
|
|
||||||
wxString labels[2];
|
wxString labels[2];
|
||||||
StateColor text_color;
|
StateColor text_color;
|
||||||
|
StateColor text_color2;
|
||||||
StateColor track_color;
|
StateColor track_color;
|
||||||
StateColor thumb_color;
|
StateColor thumb_color;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue