Merge branch 'master' into tm_slice_index
This commit is contained in:
commit
f4b70e42d1
@ -57,6 +57,7 @@
|
|||||||
#include "BackgroundSlicingProcess.hpp"
|
#include "BackgroundSlicingProcess.hpp"
|
||||||
#include "ProgressStatusBar.hpp"
|
#include "ProgressStatusBar.hpp"
|
||||||
#include "PrintHostDialogs.hpp"
|
#include "PrintHostDialogs.hpp"
|
||||||
|
#include "ConfigWizard.hpp"
|
||||||
#include "../Utils/ASCIIFolding.hpp"
|
#include "../Utils/ASCIIFolding.hpp"
|
||||||
#include "../Utils/PrintHost.hpp"
|
#include "../Utils/PrintHost.hpp"
|
||||||
#include "../Utils/FixModelByWin10.hpp"
|
#include "../Utils/FixModelByWin10.hpp"
|
||||||
@ -233,9 +234,11 @@ wxBitmapComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(15 *
|
|||||||
auto selected_item = this->GetSelection();
|
auto selected_item = this->GetSelection();
|
||||||
|
|
||||||
auto marker = reinterpret_cast<Marker>(this->GetClientData(selected_item));
|
auto marker = reinterpret_cast<Marker>(this->GetClientData(selected_item));
|
||||||
if (marker == LABEL_ITEM_MARKER) {
|
if (marker == LABEL_ITEM_MARKER || marker == LABEL_ITEM_CONFIG_WIZARD) {
|
||||||
this->SetSelection(this->last_selected);
|
this->SetSelection(this->last_selected);
|
||||||
evt.StopPropagation();
|
evt.StopPropagation();
|
||||||
|
if (marker == LABEL_ITEM_CONFIG_WIZARD)
|
||||||
|
wxTheApp->CallAfter([]() { Slic3r::GUI::config_wizard(Slic3r::GUI::ConfigWizard::RR_USER); });
|
||||||
} else if ( this->last_selected != selected_item ||
|
} else if ( this->last_selected != selected_item ||
|
||||||
wxGetApp().get_tab(this->preset_type)->get_presets()->current_is_dirty() ) {
|
wxGetApp().get_tab(this->preset_type)->get_presets()->current_is_dirty() ) {
|
||||||
this->last_selected = selected_item;
|
this->last_selected = selected_item;
|
||||||
@ -317,9 +320,9 @@ PresetComboBox::~PresetComboBox()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PresetComboBox::set_label_marker(int item)
|
void PresetComboBox::set_label_marker(int item, LabelItemType label_item_type)
|
||||||
{
|
{
|
||||||
this->SetClientData(item, (void*)LABEL_ITEM_MARKER);
|
this->SetClientData(item, (void*)label_item_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PresetComboBox::check_selection()
|
void PresetComboBox::check_selection()
|
||||||
|
@ -48,14 +48,18 @@ public:
|
|||||||
|
|
||||||
wxButton* edit_btn { nullptr };
|
wxButton* edit_btn { nullptr };
|
||||||
|
|
||||||
void set_label_marker(int item);
|
enum LabelItemType {
|
||||||
|
LABEL_ITEM_MARKER = 0x4d,
|
||||||
|
LABEL_ITEM_CONFIG_WIZARD = 0x4e
|
||||||
|
};
|
||||||
|
|
||||||
|
void set_label_marker(int item, LabelItemType label_item_type = LABEL_ITEM_MARKER);
|
||||||
void set_extruder_idx(const int extr_idx) { extruder_idx = extr_idx; }
|
void set_extruder_idx(const int extr_idx) { extruder_idx = extr_idx; }
|
||||||
int get_extruder_idx() const { return extruder_idx; }
|
int get_extruder_idx() const { return extruder_idx; }
|
||||||
void check_selection();
|
void check_selection();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::size_t Marker;
|
typedef std::size_t Marker;
|
||||||
enum { LABEL_ITEM_MARKER = 0x4d };
|
|
||||||
|
|
||||||
Preset::Type preset_type;
|
Preset::Type preset_type;
|
||||||
int last_selected;
|
int last_selected;
|
||||||
|
@ -519,6 +519,7 @@ PresetCollection::PresetCollection(Preset::Type type, const std::vector<std::str
|
|||||||
m_edited_preset(type, "", false),
|
m_edited_preset(type, "", false),
|
||||||
m_idx_selected(0),
|
m_idx_selected(0),
|
||||||
m_bitmap_main_frame(new wxBitmap),
|
m_bitmap_main_frame(new wxBitmap),
|
||||||
|
m_bitmap_add(new wxBitmap),
|
||||||
m_bitmap_cache(new GUI::BitmapCache)
|
m_bitmap_cache(new GUI::BitmapCache)
|
||||||
{
|
{
|
||||||
// Insert just the default preset.
|
// Insert just the default preset.
|
||||||
@ -530,6 +531,8 @@ PresetCollection::~PresetCollection()
|
|||||||
{
|
{
|
||||||
delete m_bitmap_main_frame;
|
delete m_bitmap_main_frame;
|
||||||
m_bitmap_main_frame = nullptr;
|
m_bitmap_main_frame = nullptr;
|
||||||
|
delete m_bitmap_add;
|
||||||
|
m_bitmap_add = nullptr;
|
||||||
delete m_bitmap_cache;
|
delete m_bitmap_cache;
|
||||||
m_bitmap_cache = nullptr;
|
m_bitmap_cache = nullptr;
|
||||||
}
|
}
|
||||||
@ -798,6 +801,11 @@ bool PresetCollection::load_bitmap_default(const std::string &file_name)
|
|||||||
return m_bitmap_main_frame->LoadFile(wxString::FromUTF8(Slic3r::var(file_name).c_str()), wxBITMAP_TYPE_PNG);
|
return m_bitmap_main_frame->LoadFile(wxString::FromUTF8(Slic3r::var(file_name).c_str()), wxBITMAP_TYPE_PNG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PresetCollection::load_bitmap_add(const std::string &file_name)
|
||||||
|
{
|
||||||
|
return m_bitmap_add->LoadFile(wxString::FromUTF8(Slic3r::var(file_name).c_str()), wxBITMAP_TYPE_PNG);
|
||||||
|
}
|
||||||
|
|
||||||
const Preset* PresetCollection::get_selected_preset_parent() const
|
const Preset* PresetCollection::get_selected_preset_parent() const
|
||||||
{
|
{
|
||||||
const std::string &inherits = this->get_edited_preset().inherits();
|
const std::string &inherits = this->get_edited_preset().inherits();
|
||||||
@ -953,6 +961,30 @@ void PresetCollection::update_platter_ui(GUI::PresetComboBox *ui)
|
|||||||
selected_preset_item = ui->GetCount() - 1;
|
selected_preset_item = ui->GetCount() - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (m_type == Preset::TYPE_PRINTER) {
|
||||||
|
std::string bitmap_key = "";
|
||||||
|
// If the filament preset is not compatible and there is a "red flag" icon loaded, show it left
|
||||||
|
// to the filament color image.
|
||||||
|
if (wide_icons)
|
||||||
|
bitmap_key += "wide,";
|
||||||
|
bitmap_key += "add_printer";
|
||||||
|
wxBitmap *bmp = m_bitmap_cache->find(bitmap_key);
|
||||||
|
if (bmp == nullptr) {
|
||||||
|
// Create the bitmap with color bars.
|
||||||
|
std::vector<wxBitmap> bmps;
|
||||||
|
if (wide_icons)
|
||||||
|
// Paint a red flag for incompatible presets.
|
||||||
|
bmps.emplace_back(m_bitmap_cache->mkclear(16, 16));
|
||||||
|
// Paint the color bars.
|
||||||
|
bmps.emplace_back(m_bitmap_cache->mkclear(4, 16));
|
||||||
|
bmps.emplace_back(*m_bitmap_main_frame);
|
||||||
|
// Paint a lock at the system presets.
|
||||||
|
bmps.emplace_back(m_bitmap_cache->mkclear(6, 16));
|
||||||
|
bmps.emplace_back(m_bitmap_add ? *m_bitmap_add : wxNullBitmap);
|
||||||
|
bmp = m_bitmap_cache->insert(bitmap_key, bmps);
|
||||||
|
}
|
||||||
|
ui->set_label_marker(ui->Append("------- " + _(L("Add a new printer")) + " -------", *bmp), GUI::PresetComboBox::LABEL_ITEM_CONFIG_WIZARD);
|
||||||
|
}
|
||||||
|
|
||||||
ui->SetSelection(selected_preset_item);
|
ui->SetSelection(selected_preset_item);
|
||||||
ui->SetToolTip(ui->GetString(selected_preset_item));
|
ui->SetToolTip(ui->GetString(selected_preset_item));
|
||||||
@ -1013,6 +1045,17 @@ size_t PresetCollection::update_tab_ui(wxBitmapComboBox *ui, bool show_incompati
|
|||||||
selected_preset_item = ui->GetCount() - 1;
|
selected_preset_item = ui->GetCount() - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (m_type == Preset::TYPE_PRINTER) {
|
||||||
|
wxBitmap *bmp = m_bitmap_cache->find("add_printer_tab");
|
||||||
|
if (bmp == nullptr) {
|
||||||
|
// Create the bitmap with color bars.
|
||||||
|
std::vector<wxBitmap> bmps;
|
||||||
|
bmps.emplace_back(*m_bitmap_main_frame);
|
||||||
|
bmps.emplace_back(m_bitmap_add ? *m_bitmap_add : wxNullBitmap);
|
||||||
|
bmp = m_bitmap_cache->insert("add_printer_tab", bmps);
|
||||||
|
}
|
||||||
|
ui->Append("------- " + _(L("Add a new printer")) + " -------", *bmp);
|
||||||
|
}
|
||||||
ui->SetSelection(selected_preset_item);
|
ui->SetSelection(selected_preset_item);
|
||||||
ui->SetToolTip(ui->GetString(selected_preset_item));
|
ui->SetToolTip(ui->GetString(selected_preset_item));
|
||||||
ui->Thaw();
|
ui->Thaw();
|
||||||
|
@ -277,6 +277,9 @@ public:
|
|||||||
// Load default bitmap to be placed at the wxBitmapComboBox of a MainFrame.
|
// Load default bitmap to be placed at the wxBitmapComboBox of a MainFrame.
|
||||||
bool load_bitmap_default(const std::string &file_name);
|
bool load_bitmap_default(const std::string &file_name);
|
||||||
|
|
||||||
|
// Load "add new printer" bitmap to be placed at the wxBitmapComboBox of a MainFrame.
|
||||||
|
bool load_bitmap_add(const std::string &file_name);
|
||||||
|
|
||||||
// Compatible & incompatible marks, to be placed at the wxBitmapComboBox items.
|
// Compatible & incompatible marks, to be placed at the wxBitmapComboBox items.
|
||||||
void set_bitmap_compatible (const wxBitmap *bmp) { m_bitmap_compatible = bmp; }
|
void set_bitmap_compatible (const wxBitmap *bmp) { m_bitmap_compatible = bmp; }
|
||||||
void set_bitmap_incompatible(const wxBitmap *bmp) { m_bitmap_incompatible = bmp; }
|
void set_bitmap_incompatible(const wxBitmap *bmp) { m_bitmap_incompatible = bmp; }
|
||||||
@ -467,6 +470,8 @@ private:
|
|||||||
// Marks placed at the wxBitmapComboBox of a MainFrame.
|
// Marks placed at the wxBitmapComboBox of a MainFrame.
|
||||||
// These bitmaps are owned by PresetCollection.
|
// These bitmaps are owned by PresetCollection.
|
||||||
wxBitmap *m_bitmap_main_frame;
|
wxBitmap *m_bitmap_main_frame;
|
||||||
|
// "Add printer profile" icon, owned by PresetCollection.
|
||||||
|
wxBitmap *m_bitmap_add;
|
||||||
// Path to the directory to store the config files into.
|
// Path to the directory to store the config files into.
|
||||||
std::string m_dir_path;
|
std::string m_dir_path;
|
||||||
|
|
||||||
|
@ -107,6 +107,7 @@ PresetBundle::PresetBundle() :
|
|||||||
this->filaments .load_bitmap_default("spool.png");
|
this->filaments .load_bitmap_default("spool.png");
|
||||||
this->sla_materials.load_bitmap_default("package_green.png");
|
this->sla_materials.load_bitmap_default("package_green.png");
|
||||||
this->printers .load_bitmap_default("printer_empty.png");
|
this->printers .load_bitmap_default("printer_empty.png");
|
||||||
|
this->printers .load_bitmap_add("add.png");
|
||||||
this->load_compatible_bitmaps();
|
this->load_compatible_bitmaps();
|
||||||
|
|
||||||
// Re-activate the default presets, so their "edited" preset copies will be updated with the additional configuration values above.
|
// Re-activate the default presets, so their "edited" preset copies will be updated with the additional configuration values above.
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
#include "GUI_ObjectList.hpp"
|
#include "GUI_ObjectList.hpp"
|
||||||
|
#include "ConfigWizard.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
@ -252,6 +253,8 @@ void Tab::create_preset_tab()
|
|||||||
/*selected_string == "------- System presets -------" ||
|
/*selected_string == "------- System presets -------" ||
|
||||||
selected_string == "------- User presets -------"*/) {
|
selected_string == "------- User presets -------"*/) {
|
||||||
m_presets_choice->SetSelection(m_selected_preset_item);
|
m_presets_choice->SetSelection(m_selected_preset_item);
|
||||||
|
if (selected_string == "------- " + _(L("Add a new printer")) + " -------")
|
||||||
|
wxTheApp->CallAfter([]() { Slic3r::GUI::config_wizard(Slic3r::GUI::ConfigWizard::RR_USER); });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_selected_preset_item = selected_item;
|
m_selected_preset_item = selected_item;
|
||||||
|
Loading…
Reference in New Issue
Block a user