Merge branch 'master' into pm_support_spots_generator
This commit is contained in:
commit
e82856f4dd
@ -1289,6 +1289,7 @@ void GCodeProcessor::reset()
|
||||
m_options_z_corrector.reset();
|
||||
|
||||
m_spiral_vase_active = false;
|
||||
m_kissslicer_toolchange_time_correction = 0.0f;
|
||||
|
||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||
m_mm3_per_mm_compare.reset();
|
||||
@ -1347,6 +1348,8 @@ void GCodeProcessor::process_file(const std::string& filename, std::function<voi
|
||||
apply_config_simplify3d(filename);
|
||||
else if (m_producer == EProducer::SuperSlicer)
|
||||
apply_config_superslicer(filename);
|
||||
else if (m_producer == EProducer::KissSlicer)
|
||||
apply_config_kissslicer(filename);
|
||||
}
|
||||
|
||||
// process gcode
|
||||
@ -1529,6 +1532,82 @@ void GCodeProcessor::apply_config_superslicer(const std::string& filename)
|
||||
apply_config(config);
|
||||
}
|
||||
|
||||
void GCodeProcessor::apply_config_kissslicer(const std::string& filename)
|
||||
{
|
||||
size_t found_counter = 0;
|
||||
m_parser.parse_file_raw(filename, [this, &found_counter](GCodeReader& reader, const char* begin, const char* end) {
|
||||
auto detect_flavor = [this](const std::string_view comment) {
|
||||
static const std::string search_str = "firmware_type";
|
||||
const size_t pos = comment.find(search_str);
|
||||
if (pos != comment.npos) {
|
||||
std::vector<std::string> elements;
|
||||
boost::split(elements, comment, boost::is_any_of("="));
|
||||
if (elements.size() == 2) {
|
||||
try
|
||||
{
|
||||
switch (std::stoi(elements[1]))
|
||||
{
|
||||
default: { break; }
|
||||
case 1:
|
||||
case 2:
|
||||
case 3: { m_flavor = gcfMarlinLegacy; break; }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// invalid data, do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
auto detect_printer = [this](const std::string_view comment) {
|
||||
static const std::string search_str = "printer_name";
|
||||
const size_t pos = comment.find(search_str);
|
||||
if (pos != comment.npos) {
|
||||
std::vector<std::string> elements;
|
||||
boost::split(elements, comment, boost::is_any_of("="));
|
||||
if (elements.size() == 2) {
|
||||
elements[1] = boost::to_upper_copy(elements[1]);
|
||||
if (boost::contains(elements[1], "MK2.5") || boost::contains(elements[1], "MK3"))
|
||||
m_kissslicer_toolchange_time_correction = 18.0f; // MMU2
|
||||
else if (boost::contains(elements[1], "MK2"))
|
||||
m_kissslicer_toolchange_time_correction = 5.0f; // MMU
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
begin = skip_whitespaces(begin, end);
|
||||
if (begin != end) {
|
||||
if (*begin == ';') {
|
||||
// Comment.
|
||||
begin = skip_whitespaces(++begin, end);
|
||||
end = remove_eols(begin, end);
|
||||
if (begin != end) {
|
||||
const std::string_view comment(begin, end - begin);
|
||||
if (detect_flavor(comment) || detect_printer(comment))
|
||||
++found_counter;
|
||||
}
|
||||
|
||||
// we got the data,
|
||||
// force early exit to avoid parsing the entire file
|
||||
if (found_counter == 2)
|
||||
m_parser.quit_parsing();
|
||||
}
|
||||
else if (*begin == 'M' || *begin == 'G')
|
||||
// the header has been fully parsed, quit search
|
||||
m_parser.quit_parsing();
|
||||
}
|
||||
}
|
||||
);
|
||||
m_parser.reset();
|
||||
}
|
||||
|
||||
std::vector<float> GCodeProcessor::get_layers_time(PrintEstimatedStatistics::ETimeMode mode) const
|
||||
{
|
||||
return (mode < PrintEstimatedStatistics::ETimeMode::Count) ?
|
||||
@ -2559,7 +2638,7 @@ bool GCodeProcessor::process_bambustudio_tags(const std::string_view comment)
|
||||
bool GCodeProcessor::detect_producer(const std::string_view comment)
|
||||
{
|
||||
for (const auto& [id, search_string] : Producers) {
|
||||
size_t pos = comment.find(search_string);
|
||||
const size_t pos = comment.find(search_string);
|
||||
if (pos != comment.npos) {
|
||||
m_producer = id;
|
||||
BOOST_LOG_TRIVIAL(info) << "Detected gcode producer: " << search_string;
|
||||
@ -3615,7 +3694,8 @@ void GCodeProcessor::process_T(const std::string_view command)
|
||||
// T-1 is a valid gcode line for RepRap Firmwares (used to deselects all tools) see https://github.com/prusa3d/PrusaSlicer/issues/5677
|
||||
if ((m_flavor != gcfRepRapFirmware && m_flavor != gcfRepRapSprinter) || eid != -1)
|
||||
BOOST_LOG_TRIVIAL(error) << "GCodeProcessor encountered an invalid toolchange (" << command << ").";
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
unsigned char id = static_cast<unsigned char>(eid);
|
||||
if (m_extruder_id != id) {
|
||||
if (id >= m_result.extruder_colors.size())
|
||||
@ -3631,6 +3711,8 @@ void GCodeProcessor::process_T(const std::string_view command)
|
||||
float extra_time = get_filament_unload_time(static_cast<size_t>(old_extruder_id));
|
||||
m_time_processor.extruder_unloaded = false;
|
||||
extra_time += get_filament_load_time(static_cast<size_t>(m_extruder_id));
|
||||
if (m_producer == EProducer::KissSlicer && m_flavor == gcfMarlinLegacy)
|
||||
extra_time += m_kissslicer_toolchange_time_correction;
|
||||
simulate_st_synchronize(extra_time);
|
||||
|
||||
m_result.extruders_count = std::max<size_t>(m_result.extruders_count, m_extruder_id + 1);
|
||||
|
@ -575,6 +575,7 @@ namespace Slic3r {
|
||||
OptionsZCorrector m_options_z_corrector;
|
||||
size_t m_last_default_color_id;
|
||||
bool m_spiral_vase_active;
|
||||
float m_kissslicer_toolchange_time_correction;
|
||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> m_start_time;
|
||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||
@ -648,6 +649,7 @@ namespace Slic3r {
|
||||
void apply_config(const DynamicPrintConfig& config);
|
||||
void apply_config_simplify3d(const std::string& filename);
|
||||
void apply_config_superslicer(const std::string& filename);
|
||||
void apply_config_kissslicer(const std::string& filename);
|
||||
void process_gcode_line(const GCodeReader::GCodeLine& line, bool producers_enabled);
|
||||
|
||||
// Process tags embedded into comments
|
||||
|
@ -1055,12 +1055,12 @@ const std::string& PresetCollection::get_suffix_modified() {
|
||||
|
||||
// Return a preset by its name. If the preset is active, a temporary copy is returned.
|
||||
// If a preset is not found by its name, null is returned.
|
||||
Preset* PresetCollection::find_preset(const std::string &name, bool first_visible_if_not_found)
|
||||
Preset* PresetCollection::find_preset(const std::string &name, bool first_visible_if_not_found, bool respect_active_preset /*= true*/)
|
||||
{
|
||||
Preset key(m_type, name, false);
|
||||
auto it = this->find_preset_internal(name);
|
||||
// Ensure that a temporary copy is returned if the preset found is currently selected.
|
||||
return (it != m_presets.end() && it->name == key.name) ? &this->preset(it - m_presets.begin()) :
|
||||
return (it != m_presets.end() && it->name == key.name) ? &this->preset(it - m_presets.begin(), respect_active_preset) :
|
||||
first_visible_if_not_found ? &this->first_visible() : nullptr;
|
||||
}
|
||||
|
||||
|
@ -392,8 +392,8 @@ public:
|
||||
const Preset& default_preset(size_t idx = 0) const { assert(idx < m_num_default_presets); return m_presets[idx]; }
|
||||
virtual const Preset& default_preset_for(const DynamicPrintConfig & /* config */) const { return this->default_preset(); }
|
||||
// Return a preset by an index. If the preset is active, a temporary copy is returned.
|
||||
Preset& preset(size_t idx) { return (idx == m_idx_selected) ? m_edited_preset : m_presets[idx]; }
|
||||
const Preset& preset(size_t idx) const { return const_cast<PresetCollection*>(this)->preset(idx); }
|
||||
Preset& preset(size_t idx, bool respect_active_preset = true) { return (idx == m_idx_selected && respect_active_preset) ? m_edited_preset : m_presets[idx]; }
|
||||
const Preset& preset(size_t idx, bool respect_active_preset = true) const { return const_cast<PresetCollection*>(this)->preset(idx); }
|
||||
void discard_current_changes() {
|
||||
m_presets[m_idx_selected].reset_dirty();
|
||||
m_edited_preset = m_presets[m_idx_selected];
|
||||
@ -403,9 +403,9 @@ public:
|
||||
|
||||
// Return a preset by its name. If the preset is active, a temporary copy is returned.
|
||||
// If a preset is not found by its name, null is returned.
|
||||
Preset* find_preset(const std::string &name, bool first_visible_if_not_found = false);
|
||||
const Preset* find_preset(const std::string &name, bool first_visible_if_not_found = false) const
|
||||
{ return const_cast<PresetCollection*>(this)->find_preset(name, first_visible_if_not_found); }
|
||||
Preset* find_preset(const std::string &name, bool first_visible_if_not_found = false, bool respect_active_preset = true);
|
||||
const Preset* find_preset(const std::string &name, bool first_visible_if_not_found = false, bool respect_active_preset = true) const
|
||||
{ return const_cast<PresetCollection*>(this)->find_preset(name, first_visible_if_not_found, respect_active_preset); }
|
||||
|
||||
size_t first_visible_idx() const;
|
||||
// Return index of the first compatible preset. Certainly at least the '- default -' preset shall be compatible.
|
||||
|
@ -4173,7 +4173,7 @@ void GLCanvas3D::handle_sidebar_focus_event(const std::string& opt_key, bool foc
|
||||
|
||||
void GLCanvas3D::handle_layers_data_focus_event(const t_layer_height_range range, const EditorType type)
|
||||
{
|
||||
std::string field = "layer_" + std::to_string(type) + "_" + std::to_string(range.first) + "_" + std::to_string(range.second);
|
||||
std::string field = "layer_" + std::to_string(type) + "_" + float_to_string_decimal_point(range.first) + "_" + float_to_string_decimal_point(range.second);
|
||||
handle_sidebar_focus_event(field, true);
|
||||
}
|
||||
|
||||
|
@ -1609,7 +1609,8 @@ bool PlaterDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &fi
|
||||
|
||||
m_mainframe.Raise();
|
||||
m_mainframe.select_tab(size_t(0));
|
||||
m_plater.select_view_3D("3D");
|
||||
if (wxGetApp().is_editor())
|
||||
m_plater.select_view_3D("3D");
|
||||
bool res = m_plater.load_files(filenames);
|
||||
m_mainframe.update_title();
|
||||
return res;
|
||||
|
@ -231,7 +231,12 @@ static std::string suffix(Preset* preset)
|
||||
|
||||
wxString PresetComboBox::get_preset_name(const Preset & preset)
|
||||
{
|
||||
return from_u8(preset.name/* + suffix(preset)*/);
|
||||
return from_u8(preset.name);
|
||||
}
|
||||
|
||||
static wxString get_preset_name_with_suffix(const Preset & preset)
|
||||
{
|
||||
return from_u8(preset.name + Preset::suffix_modified());
|
||||
}
|
||||
|
||||
void PresetComboBox::update(std::string select_preset_name)
|
||||
@ -271,18 +276,32 @@ void PresetComboBox::update(std::string select_preset_name)
|
||||
auto bmp = get_bmp(bitmap_key, main_icon_name, "lock_closed", is_enabled, preset.is_compatible, preset.is_system || preset.is_default);
|
||||
assert(bmp);
|
||||
|
||||
if (!is_enabled)
|
||||
if (!is_enabled) {
|
||||
incomp_presets.emplace(get_preset_name(preset), bmp);
|
||||
if (preset.is_dirty && m_show_modif_preset_separately)
|
||||
incomp_presets.emplace(get_preset_name_with_suffix(preset), bmp);
|
||||
}
|
||||
else if (preset.is_default || preset.is_system)
|
||||
{
|
||||
Append(get_preset_name(preset), *bmp);
|
||||
validate_selection(preset.name == select_preset_name);
|
||||
if (preset.is_dirty && m_show_modif_preset_separately) {
|
||||
wxString preset_name = get_preset_name_with_suffix(preset);
|
||||
Append(preset_name, *bmp);
|
||||
validate_selection(into_u8(preset_name) == select_preset_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nonsys_presets.emplace(get_preset_name(preset), std::pair<wxBitmapBundle*, bool>(bmp, is_enabled));
|
||||
if (preset.name == select_preset_name || (select_preset_name.empty() && is_enabled))
|
||||
selected = get_preset_name(preset);
|
||||
if (preset.is_dirty && m_show_modif_preset_separately) {
|
||||
wxString preset_name = get_preset_name_with_suffix(preset);
|
||||
nonsys_presets.emplace(preset_name, std::pair<wxBitmapBundle*, bool>(bmp, is_enabled));
|
||||
if (preset_name == select_preset_name || (select_preset_name.empty() && is_enabled))
|
||||
selected = preset_name;
|
||||
}
|
||||
}
|
||||
if (i + 1 == m_collection->num_default_presets())
|
||||
set_label_marker(Append(separator(L("System presets")), NullBitmapBndl()));
|
||||
|
@ -31,6 +31,7 @@ class BitmapCache;
|
||||
class PresetComboBox : public BitmapComboBox
|
||||
{
|
||||
bool m_show_all { false };
|
||||
bool m_show_modif_preset_separately{ false };
|
||||
public:
|
||||
PresetComboBox(wxWindow* parent, Preset::Type preset_type, const wxSize& size = wxDefaultSize, PresetBundle* preset_bundle = nullptr);
|
||||
~PresetComboBox();
|
||||
@ -65,6 +66,7 @@ public:
|
||||
void edit_physical_printer();
|
||||
void add_physical_printer();
|
||||
bool del_physical_printer(const wxString& note_string = wxEmptyString);
|
||||
void show_modif_preset_separately() { m_show_modif_preset_separately = true; }
|
||||
|
||||
virtual wxString get_preset_name(const Preset& preset);
|
||||
Preset::Type get_type() { return m_type; }
|
||||
|
@ -79,12 +79,13 @@ static void make_string_bold(wxString& str)
|
||||
}
|
||||
|
||||
// preset(root) node
|
||||
ModelNode::ModelNode(Preset::Type preset_type, wxWindow* parent_win, const wxString& text, const std::string& icon_name) :
|
||||
ModelNode::ModelNode(Preset::Type preset_type, wxWindow* parent_win, const wxString& text, const std::string& icon_name, const wxString& new_val_column_text) :
|
||||
m_parent_win(parent_win),
|
||||
m_parent(nullptr),
|
||||
m_preset_type(preset_type),
|
||||
m_icon_name(icon_name),
|
||||
m_text(text)
|
||||
m_text(text),
|
||||
m_new_value(new_val_column_text)
|
||||
{
|
||||
UpdateIcons();
|
||||
}
|
||||
@ -128,20 +129,22 @@ wxBitmap ModelNode::get_bitmap(const wxString& color)
|
||||
}
|
||||
|
||||
// option node
|
||||
ModelNode::ModelNode(ModelNode* parent, const wxString& text, const wxString& old_value, const wxString& new_value) :
|
||||
ModelNode::ModelNode(ModelNode* parent, const wxString& text, const wxString& old_value, const wxString& mod_value, const wxString& new_value) :
|
||||
m_parent_win(parent->m_parent_win),
|
||||
m_parent(parent),
|
||||
m_old_color(old_value.StartsWith("#") ? old_value : ""),
|
||||
m_mod_color(mod_value.StartsWith("#") ? mod_value : ""),
|
||||
m_new_color(new_value.StartsWith("#") ? new_value : ""),
|
||||
m_container(false),
|
||||
m_text(text),
|
||||
m_icon_name("empty"),
|
||||
m_old_value(old_value),
|
||||
m_mod_value(mod_value),
|
||||
m_new_value(new_value)
|
||||
{
|
||||
// check if old/new_value is color
|
||||
if (m_old_color.IsEmpty()) {
|
||||
if (!m_new_color.IsEmpty())
|
||||
if (!m_mod_color.IsEmpty())
|
||||
m_old_value = _L("Undef");
|
||||
}
|
||||
else {
|
||||
@ -149,8 +152,17 @@ ModelNode::ModelNode(ModelNode* parent, const wxString& text, const wxString& ol
|
||||
m_old_value.Clear();
|
||||
}
|
||||
|
||||
if (m_new_color.IsEmpty()) {
|
||||
if (m_mod_color.IsEmpty()) {
|
||||
if (!m_old_color.IsEmpty())
|
||||
m_mod_value = _L("Undef");
|
||||
}
|
||||
else {
|
||||
m_mod_color_bmp = get_bitmap(m_mod_color);
|
||||
m_mod_value.Clear();
|
||||
}
|
||||
|
||||
if (m_new_color.IsEmpty()) {
|
||||
if (!m_old_color.IsEmpty() || !m_mod_color.IsEmpty())
|
||||
m_new_value = _L("Undef");
|
||||
}
|
||||
else {
|
||||
@ -160,7 +172,8 @@ ModelNode::ModelNode(ModelNode* parent, const wxString& text, const wxString& ol
|
||||
|
||||
// "color" strings
|
||||
color_string(m_old_value, def_text_color());
|
||||
color_string(m_new_value, orange);
|
||||
color_string(m_mod_value, orange);
|
||||
color_string(m_new_value, def_text_color());
|
||||
|
||||
UpdateIcons();
|
||||
}
|
||||
@ -179,12 +192,14 @@ void ModelNode::UpdateEnabling()
|
||||
if (!m_toggle) {
|
||||
change_text_color(m_text, def_text_color(), grey);
|
||||
change_text_color(m_old_value, def_text_color(), grey);
|
||||
change_text_color(m_new_value, orange,grey);
|
||||
change_text_color(m_mod_value, orange,grey);
|
||||
change_text_color(m_new_value, def_text_color(), grey);
|
||||
}
|
||||
else {
|
||||
change_text_color(m_text, grey, def_text_color());
|
||||
change_text_color(m_old_value, grey, def_text_color());
|
||||
change_text_color(m_new_value, grey, orange);
|
||||
change_text_color(m_mod_value, grey, orange);
|
||||
change_text_color(m_new_value, grey, def_text_color());
|
||||
}
|
||||
// update icons for the colors
|
||||
UpdateIcons();
|
||||
@ -195,6 +210,8 @@ void ModelNode::UpdateIcons()
|
||||
// update icons for the colors, if any exists
|
||||
if (!m_old_color.IsEmpty())
|
||||
m_old_color_bmp = get_bitmap(m_old_color);
|
||||
if (!m_mod_color.IsEmpty())
|
||||
m_mod_color_bmp = get_bitmap(m_mod_color);
|
||||
if (!m_new_color.IsEmpty())
|
||||
m_new_color_bmp = get_bitmap(m_new_color);
|
||||
|
||||
@ -223,13 +240,14 @@ DiffModel::DiffModel(wxWindow* parent) :
|
||||
{
|
||||
}
|
||||
|
||||
wxDataViewItem DiffModel::AddPreset(Preset::Type type, wxString preset_name, PrinterTechnology pt)
|
||||
wxDataViewItem DiffModel::AddPreset(Preset::Type type, wxString preset_name, PrinterTechnology pt, wxString new_preset_name/* = wxString()*/)
|
||||
{
|
||||
// "color" strings
|
||||
color_string(preset_name, def_text_color());
|
||||
make_string_bold(preset_name);
|
||||
make_string_bold(new_preset_name);
|
||||
|
||||
auto preset = new ModelNode(type, m_parent_win, preset_name, get_icon_name(type, pt));
|
||||
auto preset = new ModelNode(type, m_parent_win, preset_name, get_icon_name(type, pt), new_preset_name);
|
||||
m_preset_nodes.emplace_back(preset);
|
||||
|
||||
wxDataViewItem child((void*)preset);
|
||||
@ -239,9 +257,9 @@ wxDataViewItem DiffModel::AddPreset(Preset::Type type, wxString preset_name, Pri
|
||||
return child;
|
||||
}
|
||||
|
||||
ModelNode* DiffModel::AddOption(ModelNode* group_node, wxString option_name, wxString old_value, wxString new_value)
|
||||
ModelNode* DiffModel::AddOption(ModelNode* group_node, wxString option_name, wxString old_value, wxString mod_value, wxString new_value)
|
||||
{
|
||||
group_node->Append(std::make_unique<ModelNode>(group_node, option_name, old_value, new_value));
|
||||
group_node->Append(std::make_unique<ModelNode>(group_node, option_name, old_value, mod_value, new_value));
|
||||
ModelNode* option = group_node->GetChildren().back().get();
|
||||
wxDataViewItem group_item = wxDataViewItem((void*)group_node);
|
||||
ItemAdded(group_item, wxDataViewItem((void*)option));
|
||||
@ -250,27 +268,27 @@ ModelNode* DiffModel::AddOption(ModelNode* group_node, wxString option_name, wxS
|
||||
return option;
|
||||
}
|
||||
|
||||
ModelNode* DiffModel::AddOptionWithGroup(ModelNode* category_node, wxString group_name, wxString option_name, wxString old_value, wxString new_value)
|
||||
ModelNode* DiffModel::AddOptionWithGroup(ModelNode* category_node, wxString group_name, wxString option_name, wxString old_value, wxString mod_value, wxString new_value)
|
||||
{
|
||||
category_node->Append(std::make_unique<ModelNode>(category_node, group_name));
|
||||
ModelNode* group_node = category_node->GetChildren().back().get();
|
||||
ItemAdded(wxDataViewItem((void*)category_node), wxDataViewItem((void*)group_node));
|
||||
|
||||
return AddOption(group_node, option_name, old_value, new_value);
|
||||
return AddOption(group_node, option_name, old_value, mod_value, new_value);
|
||||
}
|
||||
|
||||
ModelNode* DiffModel::AddOptionWithGroupAndCategory(ModelNode* preset_node, wxString category_name, wxString group_name,
|
||||
wxString option_name, wxString old_value, wxString new_value, const std::string category_icon_name)
|
||||
wxString option_name, wxString old_value, wxString mod_value, wxString new_value, const std::string category_icon_name)
|
||||
{
|
||||
preset_node->Append(std::make_unique<ModelNode>(preset_node, category_name, category_icon_name));
|
||||
ModelNode* category_node = preset_node->GetChildren().back().get();
|
||||
ItemAdded(wxDataViewItem((void*)preset_node), wxDataViewItem((void*)category_node));
|
||||
|
||||
return AddOptionWithGroup(category_node, group_name, option_name, old_value, new_value);
|
||||
return AddOptionWithGroup(category_node, group_name, option_name, old_value, mod_value, new_value);
|
||||
}
|
||||
|
||||
wxDataViewItem DiffModel::AddOption(Preset::Type type, wxString category_name, wxString group_name, wxString option_name,
|
||||
wxString old_value, wxString new_value, const std::string category_icon_name)
|
||||
wxString old_value, wxString mod_value, wxString new_value, const std::string category_icon_name)
|
||||
{
|
||||
// "color" strings
|
||||
color_string(category_name, def_text_color());
|
||||
@ -290,12 +308,12 @@ wxDataViewItem DiffModel::AddOption(Preset::Type type, wxString category_name, w
|
||||
{
|
||||
for (std::unique_ptr<ModelNode> &group : category->GetChildren())
|
||||
if (group->text() == group_name)
|
||||
return wxDataViewItem((void*)AddOption(group.get(), option_name, old_value, new_value));
|
||||
return wxDataViewItem((void*)AddOption(group.get(), option_name, old_value, mod_value, new_value));
|
||||
|
||||
return wxDataViewItem((void*)AddOptionWithGroup(category.get(), group_name, option_name, old_value, new_value));
|
||||
return wxDataViewItem((void*)AddOptionWithGroup(category.get(), group_name, option_name, old_value, mod_value, new_value));
|
||||
}
|
||||
|
||||
return wxDataViewItem((void*)AddOptionWithGroupAndCategory(preset.get(), category_name, group_name, option_name, old_value, new_value, category_icon_name));
|
||||
return wxDataViewItem((void*)AddOptionWithGroupAndCategory(preset.get(), category_name, group_name, option_name, old_value, mod_value, new_value, category_icon_name));
|
||||
}
|
||||
|
||||
return wxDataViewItem(nullptr);
|
||||
@ -364,6 +382,9 @@ void DiffModel::GetValue(wxVariant& variant, const wxDataViewItem& item, unsigne
|
||||
case colOldValue:
|
||||
variant << wxDataViewIconText(node->m_old_value, node->m_old_color_bmp);
|
||||
break;
|
||||
case colModValue:
|
||||
variant << wxDataViewIconText(node->m_mod_value, node->m_mod_color_bmp);
|
||||
break;
|
||||
case colNewValue:
|
||||
variant << wxDataViewIconText(node->m_new_value, node->m_new_color_bmp);
|
||||
break;
|
||||
@ -374,6 +395,9 @@ void DiffModel::GetValue(wxVariant& variant, const wxDataViewItem& item, unsigne
|
||||
case colOldValue:
|
||||
variant << DataViewBitmapText(node->m_old_value, node->m_old_color_bmp);
|
||||
break;
|
||||
case colModValue:
|
||||
variant << DataViewBitmapText(node->m_mod_value, node->m_mod_color_bmp);
|
||||
break;
|
||||
case colNewValue:
|
||||
variant << DataViewBitmapText(node->m_new_value, node->m_new_color_bmp);
|
||||
break;
|
||||
@ -635,16 +659,17 @@ void DiffViewCtrl::Rescale(int em /*= 0*/)
|
||||
|
||||
void DiffViewCtrl::Append( const std::string& opt_key, Preset::Type type,
|
||||
wxString category_name, wxString group_name, wxString option_name,
|
||||
wxString old_value, wxString new_value, const std::string category_icon_name)
|
||||
wxString old_value, wxString mod_value, wxString new_value, const std::string category_icon_name)
|
||||
{
|
||||
ItemData item_data = { opt_key, option_name, old_value, new_value, type };
|
||||
ItemData item_data = { opt_key, option_name, old_value, mod_value, new_value, type };
|
||||
|
||||
wxString old_val = get_short_string(item_data.old_val);
|
||||
wxString mod_val = get_short_string(item_data.mod_val);
|
||||
wxString new_val = get_short_string(item_data.new_val);
|
||||
if (old_val != item_data.old_val || new_val != item_data.new_val)
|
||||
if (old_val != item_data.old_val || mod_val != item_data.mod_val || new_val != item_data.new_val)
|
||||
item_data.is_long = true;
|
||||
|
||||
m_items_map.emplace(model->AddOption(type, category_name, group_name, option_name, old_val, new_val, category_icon_name), item_data);
|
||||
m_items_map.emplace(model->AddOption(type, category_name, group_name, option_name, old_val, mod_val, new_val, category_icon_name), item_data);
|
||||
|
||||
}
|
||||
|
||||
@ -694,11 +719,11 @@ void DiffViewCtrl::context_menu(wxDataViewEvent& event)
|
||||
if (it == m_items_map.end() || !it->second.is_long)
|
||||
return;
|
||||
|
||||
size_t column_cnt = this->GetColumnCount();
|
||||
const wxString old_value_header = this->GetColumn(column_cnt - 2)->GetTitle();
|
||||
const wxString new_value_header = this->GetColumn(column_cnt - 1)->GetTitle();
|
||||
FullCompareDialog(it->second.opt_name, it->second.old_val, it->second.new_val,
|
||||
old_value_header, new_value_header).ShowModal();
|
||||
const wxString old_value_header = this->GetColumn(DiffModel::colOldValue)->GetTitle();
|
||||
const wxString mod_value_header = this->GetColumn(DiffModel::colModValue)->GetTitle();
|
||||
const wxString new_value_header = has_new_value_column() ? this->GetColumn(DiffModel::colNewValue)->GetTitle() : "";
|
||||
FullCompareDialog(it->second.opt_name, it->second.old_val, it->second.mod_val, it->second.new_val,
|
||||
old_value_header, mod_value_header, new_value_header).ShowModal();
|
||||
|
||||
#ifdef __WXOSX__
|
||||
wxWindow* parent = this->GetParent();
|
||||
@ -819,14 +844,22 @@ void UnsavedChangesDialog::build(Preset::Type type, PresetCollection* dependent_
|
||||
int border = 10;
|
||||
int em = em_unit();
|
||||
|
||||
bool add_new_value_column = !new_selected_preset.empty() && dependent_presets && dependent_presets->get_edited_preset().type == type &&
|
||||
new_selected_preset != dependent_presets->get_edited_preset().name;
|
||||
if (add_new_value_column && dependent_presets->get_edited_preset().type == Preset::TYPE_PRINTER &&
|
||||
dependent_presets->get_edited_preset().printer_technology() != dependent_presets->find_preset(new_selected_preset)->printer_technology())
|
||||
add_new_value_column = false;
|
||||
|
||||
m_action_line = new wxStaticText(this, wxID_ANY, "");
|
||||
m_action_line->SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Bold());
|
||||
|
||||
m_tree = new DiffViewCtrl(this, wxSize(em * 60, em * 30));
|
||||
m_tree = new DiffViewCtrl(this, wxSize(em * (add_new_value_column ? 80 : 60), em * 30));
|
||||
m_tree->AppendToggleColumn_(L"\u2714" , DiffModel::colToggle, wxLinux ? 9 : 6);
|
||||
m_tree->AppendBmpTextColumn("" , DiffModel::colIconText, 28);
|
||||
m_tree->AppendBmpTextColumn(_L("Old Value"), DiffModel::colOldValue, 12);
|
||||
m_tree->AppendBmpTextColumn(_L("New Value"), DiffModel::colNewValue, 12);
|
||||
m_tree->AppendBmpTextColumn(_L("Original Value"), DiffModel::colOldValue, 12);
|
||||
m_tree->AppendBmpTextColumn(_L("Modified Value"), DiffModel::colModValue, 12);
|
||||
if (add_new_value_column)
|
||||
m_tree->AppendBmpTextColumn(_L("New Value"), DiffModel::colNewValue, 12);
|
||||
|
||||
// Add Buttons
|
||||
wxFont btn_font = this->GetFont().Scaled(1.4f);
|
||||
@ -1222,7 +1255,7 @@ void UnsavedChangesDialog::update(Preset::Type type, PresetCollection* dependent
|
||||
}
|
||||
else {
|
||||
wxString action_msg;
|
||||
if (type == dependent_presets->type()) {
|
||||
if (dependent_presets && type == dependent_presets->type()) {
|
||||
action_msg = format_wxstr(_L("Preset \"%1%\" has the following unsaved changes:"), presets->get_edited_preset().name);
|
||||
}
|
||||
else {
|
||||
@ -1234,10 +1267,10 @@ void UnsavedChangesDialog::update(Preset::Type type, PresetCollection* dependent
|
||||
m_action_line->SetLabel(action_msg);
|
||||
}
|
||||
|
||||
update_tree(type, presets);
|
||||
update_tree(type, presets, new_selected_preset);
|
||||
}
|
||||
|
||||
void UnsavedChangesDialog::update_tree(Preset::Type type, PresetCollection* presets_)
|
||||
void UnsavedChangesDialog::update_tree(Preset::Type type, PresetCollection* presets_, const std::string& new_selected_preset)
|
||||
{
|
||||
// update searcher befofre update of tree
|
||||
wxGetApp().sidebar().check_and_update_searcher();
|
||||
@ -1262,12 +1295,13 @@ void UnsavedChangesDialog::update_tree(Preset::Type type, PresetCollection* pres
|
||||
{
|
||||
const DynamicPrintConfig& old_config = presets->get_selected_preset().config;
|
||||
const PrinterTechnology& old_pt = presets->get_selected_preset().printer_technology();
|
||||
const DynamicPrintConfig& new_config = presets->get_edited_preset().config;
|
||||
const DynamicPrintConfig& mod_config = presets->get_edited_preset().config;
|
||||
const DynamicPrintConfig& new_config = m_tree->has_new_value_column() ? presets->find_preset(new_selected_preset, false, false)->config : mod_config;
|
||||
type = presets->type();
|
||||
|
||||
const std::map<wxString, std::string>& category_icon_map = wxGetApp().get_tab(type)->get_category_icon_map();
|
||||
|
||||
m_tree->model->AddPreset(type, from_u8(presets->get_edited_preset().name), old_pt);
|
||||
m_tree->model->AddPreset(type, from_u8(presets->get_edited_preset().name), old_pt, from_u8(new_selected_preset));
|
||||
|
||||
// Collect dirty options.
|
||||
const bool deep_compare = (type == Preset::TYPE_PRINTER || type == Preset::TYPE_SLA_MATERIAL);
|
||||
@ -1275,12 +1309,13 @@ void UnsavedChangesDialog::update_tree(Preset::Type type, PresetCollection* pres
|
||||
|
||||
// process changes of extruders count
|
||||
if (type == Preset::TYPE_PRINTER && old_pt == ptFFF &&
|
||||
old_config.opt<ConfigOptionStrings>("extruder_colour")->values.size() != new_config.opt<ConfigOptionStrings>("extruder_colour")->values.size()) {
|
||||
old_config.opt<ConfigOptionStrings>("extruder_colour")->values.size() != mod_config.opt<ConfigOptionStrings>("extruder_colour")->values.size()) {
|
||||
wxString local_label = _L("Extruders count");
|
||||
wxString old_val = from_u8((boost::format("%1%") % old_config.opt<ConfigOptionStrings>("extruder_colour")->values.size()).str());
|
||||
wxString new_val = from_u8((boost::format("%1%") % new_config.opt<ConfigOptionStrings>("extruder_colour")->values.size()).str());
|
||||
wxString mod_val = from_u8((boost::format("%1%") % mod_config.opt<ConfigOptionStrings>("extruder_colour")->values.size()).str());
|
||||
wxString new_val = !m_tree->has_new_value_column() ? "" : from_u8((boost::format("%1%") % new_config.opt<ConfigOptionStrings>("extruder_colour")->values.size()).str());
|
||||
|
||||
m_tree->Append("extruders_count", type, _L("General"), _L("Capabilities"), local_label, old_val, new_val, category_icon_map.at("General"));
|
||||
m_tree->Append("extruders_count", type, _L("General"), _L("Capabilities"), local_label, old_val, mod_val, new_val, category_icon_map.at("General"));
|
||||
}
|
||||
|
||||
for (const std::string& opt_key : dirty_options) {
|
||||
@ -1293,7 +1328,8 @@ void UnsavedChangesDialog::update_tree(Preset::Type type, PresetCollection* pres
|
||||
}
|
||||
|
||||
m_tree->Append(opt_key, type, option.category_local, option.group_local, option.label_local,
|
||||
get_string_value(opt_key, old_config), get_string_value(opt_key, new_config), category_icon_map.at(option.category));
|
||||
get_string_value(opt_key, old_config), get_string_value(opt_key, mod_config),
|
||||
m_tree->has_new_value_column() ? get_string_value(opt_key, new_config) : "", category_icon_map.at(option.category));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1331,20 +1367,21 @@ void UnsavedChangesDialog::on_sys_color_changed()
|
||||
// FullCompareDialog
|
||||
//------------------------------------------
|
||||
|
||||
FullCompareDialog::FullCompareDialog(const wxString& option_name, const wxString& old_value, const wxString& new_value,
|
||||
const wxString& old_value_header, const wxString& new_value_header)
|
||||
FullCompareDialog::FullCompareDialog(const wxString& option_name, const wxString& old_value, const wxString& mod_value, const wxString& new_value,
|
||||
const wxString& old_value_header, const wxString& mod_value_header, const wxString& new_value_header)
|
||||
: wxDialog(nullptr, wxID_ANY, option_name, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||
{
|
||||
wxGetApp().UpdateDarkUI(this);
|
||||
|
||||
int border = 10;
|
||||
bool has_new_value_column = !new_value_header.IsEmpty();
|
||||
|
||||
wxStaticBoxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this);
|
||||
|
||||
wxFlexGridSizer* grid_sizer = new wxFlexGridSizer(2, 2, 1, 0);
|
||||
wxFlexGridSizer* grid_sizer = new wxFlexGridSizer(2, has_new_value_column ? 3 : 2, 1, 0);
|
||||
grid_sizer->SetFlexibleDirection(wxBOTH);
|
||||
grid_sizer->AddGrowableCol(0,1);
|
||||
grid_sizer->AddGrowableCol(1,1);
|
||||
for (size_t col = 0 ; col < grid_sizer->GetCols(); col++)
|
||||
grid_sizer->AddGrowableCol(col, 1);
|
||||
grid_sizer->AddGrowableRow(1,1);
|
||||
|
||||
auto add_header = [grid_sizer, border, this](wxString label) {
|
||||
@ -1354,7 +1391,9 @@ FullCompareDialog::FullCompareDialog(const wxString& option_name, const wxString
|
||||
};
|
||||
|
||||
add_header(old_value_header);
|
||||
add_header(new_value_header);
|
||||
add_header(mod_value_header);
|
||||
if (has_new_value_column)
|
||||
add_header(new_value_header);
|
||||
|
||||
auto get_set_from_val = [](wxString str) {
|
||||
if (str.Find("\n") == wxNOT_FOUND)
|
||||
@ -1370,11 +1409,14 @@ FullCompareDialog::FullCompareDialog(const wxString& option_name, const wxString
|
||||
};
|
||||
|
||||
std::set<wxString> old_set = get_set_from_val(old_value);
|
||||
std::set<wxString> mod_set = get_set_from_val(mod_value);
|
||||
std::set<wxString> new_set = get_set_from_val(new_value);
|
||||
std::set<wxString> old_new_diff_set;
|
||||
std::set<wxString> old_mod_diff_set;
|
||||
std::set<wxString> mod_old_diff_set;
|
||||
std::set<wxString> new_old_diff_set;
|
||||
|
||||
std::set_difference(old_set.begin(), old_set.end(), new_set.begin(), new_set.end(), std::inserter(old_new_diff_set, old_new_diff_set.begin()));
|
||||
std::set_difference(old_set.begin(), old_set.end(), mod_set.begin(), mod_set.end(), std::inserter(old_mod_diff_set, old_mod_diff_set.begin()));
|
||||
std::set_difference(mod_set.begin(), mod_set.end(), old_set.begin(), old_set.end(), std::inserter(mod_old_diff_set, mod_old_diff_set.begin()));
|
||||
std::set_difference(new_set.begin(), new_set.end(), old_set.begin(), old_set.end(), std::inserter(new_old_diff_set, new_old_diff_set.begin()));
|
||||
|
||||
auto add_value = [grid_sizer, border, this](wxString label, const std::set<wxString>& diff_set, bool is_colored = false) {
|
||||
@ -1391,8 +1433,10 @@ FullCompareDialog::FullCompareDialog(const wxString& option_name, const wxString
|
||||
|
||||
grid_sizer->Add(text, 1, wxALL | wxEXPAND, border);
|
||||
};
|
||||
add_value(old_value, old_new_diff_set);
|
||||
add_value(new_value, new_old_diff_set, true);
|
||||
add_value(old_value, old_mod_diff_set);
|
||||
add_value(mod_value, mod_old_diff_set, true);
|
||||
if (has_new_value_column)
|
||||
add_value(new_value, new_old_diff_set);
|
||||
|
||||
sizer->Add(grid_sizer, 1, wxEXPAND);
|
||||
|
||||
@ -1466,10 +1510,11 @@ DiffPresetDialog::DiffPresetDialog(MainFrame* mainframe)
|
||||
auto add_preset_combobox = [collection, sizer, new_type, em, this](PresetComboBox** cb_, PresetBundle* preset_bundle) {
|
||||
*cb_ = new PresetComboBox(this, new_type, wxSize(em * 35, -1), preset_bundle);
|
||||
PresetComboBox* cb = (*cb_);
|
||||
cb->show_modif_preset_separately();
|
||||
cb->set_selection_changed_function([this, new_type, preset_bundle, cb](int selection) {
|
||||
if (m_view_type == Preset::TYPE_INVALID) {
|
||||
std::string preset_name = cb->GetString(selection).ToUTF8().data();
|
||||
update_compatibility(Preset::remove_suffix_modified(preset_name), new_type, preset_bundle);
|
||||
update_compatibility(preset_name, new_type, preset_bundle);
|
||||
}
|
||||
update_tree();
|
||||
});
|
||||
@ -1491,7 +1536,7 @@ DiffPresetDialog::DiffPresetDialog(MainFrame* mainframe)
|
||||
std::string preset_name = get_selection(presets_left);
|
||||
presets_right->update(preset_name);
|
||||
if (m_view_type == Preset::TYPE_INVALID)
|
||||
update_compatibility(Preset::remove_suffix_modified(preset_name), presets_right->get_type(), m_preset_bundle_right.get());
|
||||
update_compatibility(preset_name, presets_right->get_type(), m_preset_bundle_right.get());
|
||||
update_tree();
|
||||
});
|
||||
}
|
||||
@ -1512,7 +1557,7 @@ DiffPresetDialog::DiffPresetDialog(MainFrame* mainframe)
|
||||
m_tree = new DiffViewCtrl(this, wxSize(em * 65, em * 40));
|
||||
m_tree->AppendBmpTextColumn("", DiffModel::colIconText, 35);
|
||||
m_tree->AppendBmpTextColumn(_L("Left Preset Value"), DiffModel::colOldValue, 15);
|
||||
m_tree->AppendBmpTextColumn(_L("Right Preset Value"),DiffModel::colNewValue, 15);
|
||||
m_tree->AppendBmpTextColumn(_L("Right Preset Value"),DiffModel::colModValue, 15);
|
||||
m_tree->Hide();
|
||||
|
||||
wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
|
||||
@ -1618,8 +1663,14 @@ void DiffPresetDialog::update_tree()
|
||||
Preset::Type type = preset_combos.presets_left->get_type();
|
||||
|
||||
const PresetCollection* presets = get_preset_collection(type);
|
||||
const Preset* left_preset = presets->find_preset(get_selection(preset_combos.presets_left));
|
||||
const Preset* right_preset = presets->find_preset(get_selection(preset_combos.presets_right));
|
||||
|
||||
std::string preset_name_full = get_selection(preset_combos.presets_left);
|
||||
std::string preset_name = Preset::remove_suffix_modified(preset_name_full);
|
||||
const Preset* left_preset = presets->find_preset(preset_name, false, preset_name_full.length() != preset_name.length());
|
||||
preset_name_full = get_selection(preset_combos.presets_right);
|
||||
preset_name = Preset::remove_suffix_modified(preset_name_full);
|
||||
const Preset* right_preset = presets->find_preset(preset_name, false, preset_name_full.length() != preset_name.length());
|
||||
|
||||
if (!left_preset || !right_preset) {
|
||||
bottom_info = _L("One of the presets doesn't found");
|
||||
preset_combos.equal_bmp->SetBitmap_(ScalableBitmap(this, "question"));
|
||||
@ -1668,7 +1719,7 @@ void DiffPresetDialog::update_tree()
|
||||
wxString left_val = from_u8((boost::format("%1%") % left_config.opt<ConfigOptionStrings>("extruder_colour")->values.size()).str());
|
||||
wxString right_val = from_u8((boost::format("%1%") % right_congig.opt<ConfigOptionStrings>("extruder_colour")->values.size()).str());
|
||||
|
||||
m_tree->Append("extruders_count", type, _L("General"), _L("Capabilities"), local_label, left_val, right_val, category_icon_map.at("General"));
|
||||
m_tree->Append("extruders_count", type, _L("General"), _L("Capabilities"), local_label, left_val, right_val, "", category_icon_map.at("General"));
|
||||
}
|
||||
|
||||
for (const std::string& opt_key : dirty_options) {
|
||||
@ -1678,14 +1729,14 @@ void DiffPresetDialog::update_tree()
|
||||
Search::Option option = searcher.get_option(opt_key, get_full_label(opt_key, left_config), type);
|
||||
if (option.opt_key() != opt_key) {
|
||||
// temporary solution, just for testing
|
||||
m_tree->Append(opt_key, type, _L("Undef category"), _L("Undef group"), opt_key, left_val, right_val, "question");
|
||||
m_tree->Append(opt_key, type, _L("Undef category"), _L("Undef group"), opt_key, left_val, right_val, "", "question");
|
||||
// When founded option isn't the correct one.
|
||||
// It can be for dirty_options: "default_print_profile", "printer_model", "printer_settings_id",
|
||||
// because of they don't exist in searcher
|
||||
continue;
|
||||
}
|
||||
m_tree->Append(opt_key, type, option.category_local, option.group_local, option.label_local,
|
||||
left_val, right_val, category_icon_map.at(option.category));
|
||||
left_val, right_val, "", category_icon_map.at(option.category));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@ class ModelNode
|
||||
std::string m_icon_name;
|
||||
// saved values for colors if they exist
|
||||
wxString m_old_color;
|
||||
wxString m_mod_color;
|
||||
wxString m_new_color;
|
||||
|
||||
#ifdef __linux__
|
||||
@ -56,14 +57,17 @@ public:
|
||||
#ifdef __linux__
|
||||
wxIcon m_icon;
|
||||
wxIcon m_old_color_bmp;
|
||||
wxIcon m_mod_color_bmp;
|
||||
wxIcon m_new_color_bmp;
|
||||
#else
|
||||
wxBitmap m_icon;
|
||||
wxBitmap m_old_color_bmp;
|
||||
wxBitmap m_mod_color_bmp;
|
||||
wxBitmap m_new_color_bmp;
|
||||
#endif //__linux__
|
||||
wxString m_text;
|
||||
wxString m_old_value;
|
||||
wxString m_mod_value;
|
||||
wxString m_new_value;
|
||||
|
||||
// TODO/FIXME:
|
||||
@ -78,7 +82,7 @@ public:
|
||||
bool m_container {true};
|
||||
|
||||
// preset(root) node
|
||||
ModelNode(Preset::Type preset_type, wxWindow* parent_win, const wxString& text, const std::string& icon_name);
|
||||
ModelNode(Preset::Type preset_type, wxWindow* parent_win, const wxString& text, const std::string& icon_name, const wxString& new_val_column_text);
|
||||
|
||||
// category node
|
||||
ModelNode(ModelNode* parent, const wxString& text, const std::string& icon_name);
|
||||
@ -87,7 +91,7 @@ public:
|
||||
ModelNode(ModelNode* parent, const wxString& text);
|
||||
|
||||
// option node
|
||||
ModelNode(ModelNode* parent, const wxString& text, const wxString& old_value, const wxString& new_value);
|
||||
ModelNode(ModelNode* parent, const wxString& text, const wxString& old_value, const wxString& mod_value, const wxString& new_value);
|
||||
|
||||
bool IsContainer() const { return m_container; }
|
||||
bool IsToggled() const { return m_toggle; }
|
||||
@ -122,17 +126,20 @@ class DiffModel : public wxDataViewModel
|
||||
ModelNode *AddOption(ModelNode *group_node,
|
||||
wxString option_name,
|
||||
wxString old_value,
|
||||
wxString mod_value,
|
||||
wxString new_value);
|
||||
ModelNode *AddOptionWithGroup(ModelNode *category_node,
|
||||
wxString group_name,
|
||||
wxString option_name,
|
||||
wxString old_value,
|
||||
wxString mod_value,
|
||||
wxString new_value);
|
||||
ModelNode *AddOptionWithGroupAndCategory(ModelNode *preset_node,
|
||||
wxString category_name,
|
||||
wxString group_name,
|
||||
wxString option_name,
|
||||
wxString old_value,
|
||||
wxString mod_value,
|
||||
wxString new_value,
|
||||
const std::string category_icon_name);
|
||||
|
||||
@ -141,6 +148,7 @@ public:
|
||||
colToggle,
|
||||
colIconText,
|
||||
colOldValue,
|
||||
colModValue,
|
||||
colNewValue,
|
||||
colMax
|
||||
};
|
||||
@ -150,9 +158,9 @@ public:
|
||||
|
||||
void SetAssociatedControl(wxDataViewCtrl* ctrl) { m_ctrl = ctrl; }
|
||||
|
||||
wxDataViewItem AddPreset(Preset::Type type, wxString preset_name, PrinterTechnology pt);
|
||||
wxDataViewItem AddPreset(Preset::Type type, wxString preset_name, PrinterTechnology pt, wxString new_preset_name = wxString());
|
||||
wxDataViewItem AddOption(Preset::Type type, wxString category_name, wxString group_name, wxString option_name,
|
||||
wxString old_value, wxString new_value, const std::string category_icon_name);
|
||||
wxString old_value, wxString mod_value, wxString new_value, const std::string category_icon_name);
|
||||
|
||||
void UpdateItemEnabling(wxDataViewItem item);
|
||||
bool IsEnabledItem(const wxDataViewItem& item);
|
||||
@ -193,6 +201,7 @@ class DiffViewCtrl : public wxDataViewCtrl
|
||||
std::string opt_key;
|
||||
wxString opt_name;
|
||||
wxString old_val;
|
||||
wxString mod_val;
|
||||
wxString new_val;
|
||||
Preset::Type type;
|
||||
bool is_long{ false };
|
||||
@ -217,7 +226,7 @@ public:
|
||||
void AppendToggleColumn_(const wxString& label, unsigned model_column, int width);
|
||||
void Rescale(int em = 0);
|
||||
void Append(const std::string& opt_key, Preset::Type type, wxString category_name, wxString group_name, wxString option_name,
|
||||
wxString old_value, wxString new_value, const std::string category_icon_name);
|
||||
wxString old_value, wxString mod_value, wxString new_value, const std::string category_icon_name);
|
||||
void Clear();
|
||||
|
||||
wxString get_short_string(wxString full_string);
|
||||
@ -227,6 +236,7 @@ public:
|
||||
void set_em_unit(int em) { m_em_unit = em; }
|
||||
bool has_unselected_options();
|
||||
bool has_long_strings() { return m_has_long_strings; }
|
||||
bool has_new_value_column() { return this->GetColumnCount() == DiffModel::colMax; }
|
||||
|
||||
std::vector<std::string> options(Preset::Type type, bool selected);
|
||||
std::vector<std::string> selected_options();
|
||||
@ -280,14 +290,14 @@ public:
|
||||
};
|
||||
|
||||
// show unsaved changes when preset is switching
|
||||
UnsavedChangesDialog(Preset::Type type, PresetCollection* dependent_presets, const std::string& new_selected_preset);
|
||||
UnsavedChangesDialog(Preset::Type type, PresetCollection* dependent_presets, const std::string& new_selected_preset = std::string());
|
||||
// show unsaved changes for all another cases
|
||||
UnsavedChangesDialog(const wxString& caption, const wxString& header, const std::string& app_config_key, int act_buttons);
|
||||
~UnsavedChangesDialog() {}
|
||||
|
||||
void build(Preset::Type type, PresetCollection* dependent_presets, const std::string& new_selected_preset, const wxString& header = "");
|
||||
void update(Preset::Type type, PresetCollection* dependent_presets, const std::string& new_selected_preset, const wxString& header);
|
||||
void update_tree(Preset::Type type, PresetCollection *presets);
|
||||
void update_tree(Preset::Type type, PresetCollection *presets, const std::string& new_selected_preset);
|
||||
void show_info_line(Action action, std::string preset_name = "");
|
||||
void update_config(Action action);
|
||||
void close(Action action);
|
||||
@ -320,8 +330,8 @@ protected:
|
||||
class FullCompareDialog : public wxDialog
|
||||
{
|
||||
public:
|
||||
FullCompareDialog(const wxString& option_name, const wxString& old_value, const wxString& new_value,
|
||||
const wxString& old_value_header, const wxString& new_value_header);
|
||||
FullCompareDialog(const wxString& option_name, const wxString& old_value, const wxString& mod_value, const wxString& new_value,
|
||||
const wxString& old_value_header, const wxString& mod_value_header, const wxString& new_value_header);
|
||||
~FullCompareDialog() {}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user