Added preset grouping to all presets ComboBoxes
Changed icons for action_undo, sys_lock and sys_unlock. There are used same icons for all OS now. Deleted/Commented temporarily used wxDataViewTreeCtrl
This commit is contained in:
parent
e7520c3d18
commit
762306d985
Binary file not shown.
Before Width: | Height: | Size: 616 B After Width: | Height: | Size: 491 B |
Binary file not shown.
Before Width: | Height: | Size: 448 B After Width: | Height: | Size: 510 B |
Binary file not shown.
Before Width: | Height: | Size: 454 B After Width: | Height: | Size: 419 B |
@ -31,7 +31,10 @@ public:
|
|||||||
|
|
||||||
static wxBitmap mksolid(size_t width, size_t height, unsigned char r, unsigned char g, unsigned char b, unsigned char transparency);
|
static wxBitmap mksolid(size_t width, size_t height, unsigned char r, unsigned char g, unsigned char b, unsigned char transparency);
|
||||||
static wxBitmap mksolid(size_t width, size_t height, const unsigned char rgb[3]) { return mksolid(width, height, rgb[0], rgb[1], rgb[2], wxALPHA_OPAQUE); }
|
static wxBitmap mksolid(size_t width, size_t height, const unsigned char rgb[3]) { return mksolid(width, height, rgb[0], rgb[1], rgb[2], wxALPHA_OPAQUE); }
|
||||||
static wxBitmap mkclear(size_t width, size_t height) { return mksolid(width, height, 0, 0, 0, wxALPHA_TRANSPARENT); }
|
static wxBitmap mkclear(size_t width, size_t height) {
|
||||||
|
wxColour bg_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
|
||||||
|
return mksolid(width, height, bg_clr.Red(), bg_clr.Green(), bg_clr.Blue()/*, 0, 0, 0*/, wxALPHA_TRANSPARENT);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<std::string, wxBitmap*> m_map;
|
std::map<std::string, wxBitmap*> m_map;
|
||||||
|
@ -512,16 +512,44 @@ void PresetCollection::update_platter_ui(wxBitmapComboBox *ui)
|
|||||||
// Otherwise fill in the list from scratch.
|
// Otherwise fill in the list from scratch.
|
||||||
ui->Freeze();
|
ui->Freeze();
|
||||||
ui->Clear();
|
ui->Clear();
|
||||||
|
std::map<wxString, bool> nonsys_presets;
|
||||||
|
wxString selected = "";
|
||||||
for (size_t i = this->m_presets.front().is_visible ? 0 : 1; i < this->m_presets.size(); ++ i) {
|
for (size_t i = this->m_presets.front().is_visible ? 0 : 1; i < this->m_presets.size(); ++ i) {
|
||||||
const Preset &preset = this->m_presets[i];
|
const Preset &preset = this->m_presets[i];
|
||||||
if (! preset.is_visible || (! preset.is_compatible && i != m_idx_selected))
|
if (! preset.is_visible || (! preset.is_compatible && i != m_idx_selected))
|
||||||
continue;
|
continue;
|
||||||
const wxBitmap *bmp = (i == 0 || preset.is_compatible) ? m_bitmap_main_frame : m_bitmap_incompatible;
|
const wxBitmap *bmp = (i == 0 || preset.is_compatible) ? m_bitmap_main_frame : m_bitmap_incompatible;
|
||||||
ui->Append(wxString::FromUTF8((preset.name + (preset.is_dirty ? g_suffix_modified : "")).c_str()),
|
// ui->Append(wxString::FromUTF8((preset.name + (preset.is_dirty ? g_suffix_modified : "")).c_str()),
|
||||||
(bmp == 0) ? (m_bitmap_main_frame ? *m_bitmap_main_frame : wxNullBitmap) : *bmp);
|
// (bmp == 0) ? (m_bitmap_main_frame ? *m_bitmap_main_frame : wxNullBitmap) : *bmp);
|
||||||
if (i == m_idx_selected)
|
// if (i == m_idx_selected)
|
||||||
ui->SetSelection(ui->GetCount() - 1);
|
// ui->SetSelection(ui->GetCount() - 1);
|
||||||
}
|
|
||||||
|
if (preset.is_default || preset.is_system){
|
||||||
|
ui->Append(wxString::FromUTF8((preset.name + (preset.is_dirty ? g_suffix_modified : "")).c_str()),
|
||||||
|
(bmp == 0) ? (m_bitmap_main_frame ? *m_bitmap_main_frame : wxNullBitmap) : *bmp);
|
||||||
|
if (i == m_idx_selected)
|
||||||
|
ui->SetSelection(ui->GetCount() - 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nonsys_presets.emplace(wxString::FromUTF8((preset.name + (preset.is_dirty ? g_suffix_modified : "")).c_str()), preset.is_compatible);
|
||||||
|
if (i == m_idx_selected)
|
||||||
|
selected = wxString::FromUTF8((preset.name + (preset.is_dirty ? g_suffix_modified : "")).c_str());
|
||||||
|
}
|
||||||
|
if (preset.is_default)
|
||||||
|
ui->Append("------------------------------------", wxNullBitmap);
|
||||||
|
}
|
||||||
|
if (!nonsys_presets.empty())
|
||||||
|
{
|
||||||
|
ui->Append("------------------------------------", wxNullBitmap);
|
||||||
|
for (std::map<wxString, bool>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
|
||||||
|
const wxBitmap *bmp = it->second ? m_bitmap_compatible : m_bitmap_incompatible;
|
||||||
|
ui->Append(it->first,
|
||||||
|
(bmp == 0) ? (m_bitmap_main_frame ? *m_bitmap_main_frame : wxNullBitmap) : *bmp);
|
||||||
|
if (it->first == selected)
|
||||||
|
ui->SetSelection(ui->GetCount() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
ui->Thaw();
|
ui->Thaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -556,11 +584,11 @@ void PresetCollection::update_tab_ui(wxBitmapComboBox *ui, bool show_incompatibl
|
|||||||
selected = wxString::FromUTF8((preset.name + (preset.is_dirty ? g_suffix_modified : "")).c_str());
|
selected = wxString::FromUTF8((preset.name + (preset.is_dirty ? g_suffix_modified : "")).c_str());
|
||||||
}
|
}
|
||||||
if (preset.is_default)
|
if (preset.is_default)
|
||||||
ui->Append("______________________", wxNullBitmap);
|
ui->Append("------------------------------------", wxNullBitmap);
|
||||||
}
|
}
|
||||||
if (!nonsys_presets.empty())
|
if (!nonsys_presets.empty())
|
||||||
{
|
{
|
||||||
ui->Append("______________________", wxNullBitmap);
|
ui->Append("------------------------------------", wxNullBitmap);
|
||||||
for (std::map<wxString, bool>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
|
for (std::map<wxString, bool>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
|
||||||
const wxBitmap *bmp = it->second ? m_bitmap_compatible : m_bitmap_incompatible;
|
const wxBitmap *bmp = it->second ? m_bitmap_compatible : m_bitmap_incompatible;
|
||||||
ui->Append(it->first,
|
ui->Append(it->first,
|
||||||
|
@ -986,6 +986,8 @@ void PresetBundle::update_platter_filament_ui(unsigned int idx_extruder, wxBitma
|
|||||||
// and draw a red flag in front of the selected preset.
|
// and draw a red flag in front of the selected preset.
|
||||||
bool wide_icons = selected_preset != nullptr && ! selected_preset->is_compatible && m_bitmapIncompatible != nullptr;
|
bool wide_icons = selected_preset != nullptr && ! selected_preset->is_compatible && m_bitmapIncompatible != nullptr;
|
||||||
assert(selected_preset != nullptr);
|
assert(selected_preset != nullptr);
|
||||||
|
std::map<wxString, wxBitmap> nonsys_presets;
|
||||||
|
wxString selected_str = "";
|
||||||
for (int i = this->filaments().front().is_visible ? 0 : 1; i < int(this->filaments().size()); ++ i) {
|
for (int i = this->filaments().front().is_visible ? 0 : 1; i < int(this->filaments().size()); ++ i) {
|
||||||
const Preset &preset = this->filaments.preset(i);
|
const Preset &preset = this->filaments.preset(i);
|
||||||
bool selected = this->filament_presets[idx_extruder] == preset.name;
|
bool selected = this->filament_presets[idx_extruder] == preset.name;
|
||||||
@ -1023,10 +1025,36 @@ void PresetBundle::update_platter_filament_ui(unsigned int idx_extruder, wxBitma
|
|||||||
(preset.is_dirty ? *m_bitmapLockOpen : *m_bitmapLock) : m_bitmapCache->mkclear(16, 16));
|
(preset.is_dirty ? *m_bitmapLockOpen : *m_bitmapLock) : m_bitmapCache->mkclear(16, 16));
|
||||||
bitmap = m_bitmapCache->insert(bitmap_key, bmps);
|
bitmap = m_bitmapCache->insert(bitmap_key, bmps);
|
||||||
}
|
}
|
||||||
ui->Append(wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str()), (bitmap == 0) ? wxNullBitmap : *bitmap);
|
// ui->Append(wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str()), (bitmap == 0) ? wxNullBitmap : *bitmap);
|
||||||
if (selected)
|
// if (selected)
|
||||||
ui->SetSelection(ui->GetCount() - 1);
|
// ui->SetSelection(ui->GetCount() - 1);
|
||||||
|
|
||||||
|
if (preset.is_default || preset.is_system){
|
||||||
|
ui->Append(wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str()),
|
||||||
|
(bitmap == 0) ? wxNullBitmap : *bitmap);
|
||||||
|
if (selected)
|
||||||
|
ui->SetSelection(ui->GetCount() - 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nonsys_presets.emplace(wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str()),
|
||||||
|
(bitmap == 0) ? wxNullBitmap : *bitmap);
|
||||||
|
if (selected)
|
||||||
|
selected_str = wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str());
|
||||||
|
}
|
||||||
|
if (preset.is_default)
|
||||||
|
ui->Append("------------------------------------", wxNullBitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!nonsys_presets.empty())
|
||||||
|
{
|
||||||
|
ui->Append("------------------------------------", wxNullBitmap);
|
||||||
|
for (std::map<wxString, wxBitmap>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
|
||||||
|
ui->Append(it->first, it->second);
|
||||||
|
if (it->first == selected_str)
|
||||||
|
ui->SetSelection(ui->GetCount() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
ui->Thaw();
|
ui->Thaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ void Tab::create_preset_tab(PresetBundle *preset_bundle)
|
|||||||
|
|
||||||
// preset chooser
|
// preset chooser
|
||||||
m_presets_choice = new wxBitmapComboBox(panel, wxID_ANY, "", wxDefaultPosition, wxSize(270, -1), 0, 0,wxCB_READONLY);
|
m_presets_choice = new wxBitmapComboBox(panel, wxID_ANY, "", wxDefaultPosition, wxSize(270, -1), 0, 0,wxCB_READONLY);
|
||||||
|
/*
|
||||||
m_cc_presets_choice = new wxComboCtrl(panel, wxID_ANY, L(""), wxDefaultPosition, wxDefaultSize/*wxSize(270, -1)*/, wxCB_READONLY);
|
m_cc_presets_choice = new wxComboCtrl(panel, wxID_ANY, L(""), wxDefaultPosition, wxDefaultSize, wxCB_READONLY);
|
||||||
wxDataViewTreeCtrlComboPopup* popup = new wxDataViewTreeCtrlComboPopup;
|
wxDataViewTreeCtrlComboPopup* popup = new wxDataViewTreeCtrlComboPopup;
|
||||||
if (popup != nullptr)
|
if (popup != nullptr)
|
||||||
{
|
{
|
||||||
@ -73,8 +73,7 @@ void Tab::create_preset_tab(PresetBundle *preset_bundle)
|
|||||||
icons->Add(*new wxIcon(from_u8(Slic3r::var("flag-green-icon.png")), wxBITMAP_TYPE_PNG));
|
icons->Add(*new wxIcon(from_u8(Slic3r::var("flag-green-icon.png")), wxBITMAP_TYPE_PNG));
|
||||||
icons->Add(*new wxIcon(from_u8(Slic3r::var("flag-red-icon.png")), wxBITMAP_TYPE_PNG));
|
icons->Add(*new wxIcon(from_u8(Slic3r::var("flag-red-icon.png")), wxBITMAP_TYPE_PNG));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
|
auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
|
||||||
|
|
||||||
//buttons
|
//buttons
|
||||||
@ -119,14 +118,16 @@ void Tab::create_preset_tab(PresetBundle *preset_bundle)
|
|||||||
m_hsizer->AddSpacer(64);
|
m_hsizer->AddSpacer(64);
|
||||||
m_hsizer->Add(m_undo_to_sys_btn, 0, wxALIGN_CENTER_VERTICAL);
|
m_hsizer->Add(m_undo_to_sys_btn, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
m_hsizer->Add(m_undo_btn, 0, wxALIGN_CENTER_VERTICAL);
|
m_hsizer->Add(m_undo_btn, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
m_hsizer->AddSpacer(64);
|
// m_hsizer->AddSpacer(64);
|
||||||
m_hsizer->Add(m_cc_presets_choice, 1, wxLEFT | wxRIGHT | wxTOP | wxALIGN_CENTER_VERTICAL, 3);
|
// m_hsizer->Add(m_cc_presets_choice, 1, wxLEFT | wxRIGHT | wxTOP | wxALIGN_CENTER_VERTICAL, 3);
|
||||||
|
|
||||||
//Horizontal sizer to hold the tree and the selected page.
|
//Horizontal sizer to hold the tree and the selected page.
|
||||||
m_hsizer = new wxBoxSizer(wxHORIZONTAL);
|
m_hsizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
sizer->Add(m_hsizer, 1, wxEXPAND, 0);
|
sizer->Add(m_hsizer, 1, wxEXPAND, 0);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
//temporary left vertical sizer
|
//temporary left vertical sizer
|
||||||
m_left_sizer = new wxBoxSizer(wxVERTICAL);
|
m_left_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
@ -153,7 +154,7 @@ void Tab::create_preset_tab(PresetBundle *preset_bundle)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
//left vertical sizer
|
//left vertical sizer
|
||||||
m_left_sizer = new wxBoxSizer(wxVERTICAL);
|
m_left_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
@ -202,8 +203,8 @@ void Tab::load_initial_data()
|
|||||||
{
|
{
|
||||||
m_config = &m_presets->get_edited_preset().config;
|
m_config = &m_presets->get_edited_preset().config;
|
||||||
m_nonsys_btn_icon = m_presets->get_selected_preset_parent() == nullptr ?
|
m_nonsys_btn_icon = m_presets->get_selected_preset_parent() == nullptr ?
|
||||||
"bullet_white.png" :
|
"bullet_white.png" : "sys_unlock.png";
|
||||||
wxMSW ? "sys_unlock.png" : "lock_open.png";
|
// wxMSW ? "sys_unlock.png" : "lock_open.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
PageShp Tab::add_options_page(wxString title, std::string icon, bool is_extruder_pages/* = false*/)
|
PageShp Tab::add_options_page(wxString title, std::string icon, bool is_extruder_pages/* = false*/)
|
||||||
@ -331,8 +332,8 @@ void Tab::update_changed_ui()
|
|||||||
{
|
{
|
||||||
bool is_nonsys_value = false;
|
bool is_nonsys_value = false;
|
||||||
bool is_modified_value = true;
|
bool is_modified_value = true;
|
||||||
std::string sys_icon = wxMSW ? "sys_lock.png" : "lock.png";
|
std::string sys_icon = /*wxMSW ? */"sys_lock.png"/* : "lock.png"*/;
|
||||||
std::string icon = wxMSW ? "action_undo.png" : "arrow_undo.png";
|
std::string icon = /*wxMSW ? */"action_undo.png"/* : "arrow_undo.png"*/;
|
||||||
wxColour& color = *get_sys_label_clr();
|
wxColour& color = *get_sys_label_clr();
|
||||||
if (find(m_sys_options.begin(), m_sys_options.end(), opt_key) == m_sys_options.end()) {
|
if (find(m_sys_options.begin(), m_sys_options.end(), opt_key) == m_sys_options.end()) {
|
||||||
is_nonsys_value = true;
|
is_nonsys_value = true;
|
||||||
@ -478,9 +479,9 @@ void Tab::update_changed_tree_ui()
|
|||||||
void Tab::update_undo_buttons()
|
void Tab::update_undo_buttons()
|
||||||
{
|
{
|
||||||
const std::string& undo_icon = !m_is_modified_values ? "bullet_white.png" :
|
const std::string& undo_icon = !m_is_modified_values ? "bullet_white.png" :
|
||||||
wxMSW ? "action_undo.png" : "arrow_undo.png";
|
/*wxMSW ? */"action_undo.png"/* : "arrow_undo.png"*/;
|
||||||
const std::string& undo_to_sys_icon = m_is_nonsys_values ? m_nonsys_btn_icon :
|
const std::string& undo_to_sys_icon = m_is_nonsys_values ? m_nonsys_btn_icon :
|
||||||
wxMSW ? "sys_lock.png" : "lock.png";
|
/*wxMSW ? */"sys_lock.png"/* : "lock.png"*/;
|
||||||
|
|
||||||
m_undo_btn->SetBitmap(wxBitmap(from_u8(var(undo_icon)), wxBITMAP_TYPE_PNG));
|
m_undo_btn->SetBitmap(wxBitmap(from_u8(var(undo_icon)), wxBITMAP_TYPE_PNG));
|
||||||
m_undo_to_sys_btn->SetBitmap(wxBitmap(from_u8(var(undo_to_sys_icon)), wxBITMAP_TYPE_PNG));
|
m_undo_to_sys_btn->SetBitmap(wxBitmap(from_u8(var(undo_to_sys_icon)), wxBITMAP_TYPE_PNG));
|
||||||
@ -552,8 +553,8 @@ void Tab::update_dirty(){
|
|||||||
void Tab::update_tab_ui()
|
void Tab::update_tab_ui()
|
||||||
{
|
{
|
||||||
m_presets->update_tab_ui(m_presets_choice, m_show_incompatible_presets);
|
m_presets->update_tab_ui(m_presets_choice, m_show_incompatible_presets);
|
||||||
update_tab_presets(m_cc_presets_choice, m_show_incompatible_presets);
|
// update_tab_presets(m_cc_presets_choice, m_show_incompatible_presets);
|
||||||
update_presetsctrl(m_presetctrl, m_show_incompatible_presets);
|
// update_presetsctrl(m_presetctrl, m_show_incompatible_presets);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load a provied DynamicConfig into the tab, modifying the active preset.
|
// Load a provied DynamicConfig into the tab, modifying the active preset.
|
||||||
@ -1786,7 +1787,7 @@ void Tab::load_current_preset()
|
|||||||
const Preset* parent = m_presets->get_selected_preset_parent();
|
const Preset* parent = m_presets->get_selected_preset_parent();
|
||||||
m_nonsys_btn_icon = parent == nullptr ?
|
m_nonsys_btn_icon = parent == nullptr ?
|
||||||
"bullet_white.png" :
|
"bullet_white.png" :
|
||||||
wxMSW ? "sys_unlock.png" : "lock_open.png";
|
/*wxMSW ? */"sys_unlock.png"/* : "lock_open.png"*/;
|
||||||
|
|
||||||
// use CallAfter because some field triggers schedule on_change calls using CallAfter,
|
// use CallAfter because some field triggers schedule on_change calls using CallAfter,
|
||||||
// and we don't want them to be called after this update_dirty() as they would mark the
|
// and we don't want them to be called after this update_dirty() as they would mark the
|
||||||
|
Loading…
Reference in New Issue
Block a user