This commit is contained in:
enricoturri1966 2020-11-18 13:05:04 +01:00
commit 0ed3262645
9 changed files with 512 additions and 480 deletions

File diff suppressed because it is too large Load diff

View file

@ -794,7 +794,7 @@ bool GUI_App::on_init_inner()
#ifndef __linux__
wxYield();
#endif
scrn->SetText(_L("Loading configuration..."));
scrn->SetText(_L("Loading configuration")+ dots);
}
preset_bundle = new PresetBundle();
@ -852,7 +852,7 @@ bool GUI_App::on_init_inner()
// application frame
if (scrn && is_editor())
scrn->SetText(_L("Preparing settings tabs..."));
scrn->SetText(_L("Preparing settings tabs") + dots);
mainframe = new MainFrame();
// hide settings tabs after first Layout

View file

@ -36,7 +36,7 @@ public:
"SL1 archive files (*.sl1, *.zip)|*.sl1;*.SL1;*.zip;*.ZIP",
wxDefaultPosition, wxDefaultSize, wxFLP_DEFAULT_STYLE | wxFD_OPEN | wxFD_FILE_MUST_EXIST);
szfilepck->Add(new wxStaticText(this, wxID_ANY, _(L("Import file: "))), 0, wxALIGN_CENTER);
szfilepck->Add(new wxStaticText(this, wxID_ANY, _L("Import file") + ": "), 0, wxALIGN_CENTER);
szfilepck->Add(m_filepicker, 1);
szvert->Add(szfilepck, 0, wxALL | wxEXPAND, 5);
@ -53,7 +53,7 @@ public:
inp_choices.size(), inp_choices.data(), wxCB_READONLY | wxCB_DROPDOWN);
szchoices->Add(m_import_dropdown);
szchoices->Add(new wxStaticText(this, wxID_ANY, _(L("Quality: "))), 0, wxALIGN_CENTER | wxALL, 5);
szchoices->Add(new wxStaticText(this, wxID_ANY, _L("Quality") + ": "), 0, wxALIGN_CENTER | wxALL, 5);
static const std::vector<wxString> qual_choices = {
_(L("Accurate")),

View file

@ -162,8 +162,8 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
#endif // ENABLE_GCODE_VIEWER
m_statusbar->embed(this);
m_statusbar->set_status_text(_L("Version") + " " +
SLIC3R_VERSION +
_L(" - Remember to check for updates at https://github.com/prusa3d/PrusaSlicer/releases"));
SLIC3R_VERSION + " - " +
_L("Remember to check for updates at https://github.com/prusa3d/PrusaSlicer/releases"));
// initialize tabpanel and menubar
init_tabpanel();
@ -1582,7 +1582,7 @@ void MainFrame::quick_slice(const int qs)
m_progress_dialog->Destroy();
m_progress_dialog = nullptr;
auto message = input_file_basename + _L(" was successfully sliced.");
auto message = format(_L("%1% was successfully sliced."), input_file_basename);
// wxTheApp->notify(message);
wxMessageDialog(this, message, _L("Slicing Done!"), wxOK | wxICON_INFORMATION).ShowModal();
// };

View file

@ -90,7 +90,7 @@ void OG_CustomCtrl::init_ctrl_lines()
height = m_bmp_blinking_sz.GetHeight() + m_v_gap;
ctrl_lines.emplace_back(CtrlLine(height, this, line, true));
}
else if (opt_group->label_width != 0 && !line.label.IsEmpty())
else if (opt_group->label_width != 0 && (!line.label.IsEmpty() || option_set.front().opt.gui_type == "legend") )
{
wxSize label_sz = GetTextExtent(line.label);
height = label_sz.y * (label_sz.GetWidth() > int(opt_group->label_width * m_em_unit) ? 2 : 1) + m_v_gap;
@ -135,7 +135,7 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/)
}
wxString label = line.label;
if (opt_group->label_width != 0 && !label.IsEmpty())
if (opt_group->label_width != 0)
h_pos += opt_group->label_width * m_em_unit + m_h_gap;
int blinking_button_width = m_bmp_blinking_sz.GetWidth() + m_h_gap;
@ -177,10 +177,13 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/)
GetTextExtent(label, &label_w, &label_h, 0, 0, &m_font);
h_pos += label_w + 1 + m_h_gap;
}
h_pos += 3 * blinking_button_width;
h_pos += (opt.opt.gui_type == "legend" ? 1 : 3) * blinking_button_width;
if (field == field_in)
break;
break;
if (opt.opt.gui_type == "legend")
h_pos += 2 * blinking_button_width;
h_pos += field->getWindow()->GetSize().x;
if (option_set.size() == 1 && option_set.front().opt.full_width)
@ -556,7 +559,8 @@ wxCoord OG_CustomCtrl::CtrlLine::draw_mode_bmp(wxDC& dc, wxCoord v_pos)
wxBitmap bmp = create_scaled_bitmap(bmp_name, ctrl, wxOSX ? 10 : 12);
wxCoord y_draw = v_pos + lround((height - get_bitmap_size(bmp).GetHeight()) / 2);
dc.DrawBitmap(bmp, 0, y_draw);
if (og_line.get_options().front().opt.gui_type != "legend")
dc.DrawBitmap(bmp, 0, y_draw);
return get_bitmap_size(bmp).GetWidth() + ctrl->m_h_gap;
}

View file

@ -106,11 +106,20 @@ OptionsGroup::OptionsGroup( wxWindow* _parent, const wxString& title,
bool is_tab_opt /* = false */,
column_t extra_clmn /* = nullptr */) :
m_parent(_parent), title(title),
m_show_modified_btns(is_tab_opt),
m_use_custom_ctrl(is_tab_opt),
staticbox(title!=""), extra_column(extra_clmn)
{
}
bool OptionsGroup::is_legend_line()
{
if (m_lines.size() == 1) {
const std::vector<Option>& option_set = m_lines.front().get_options();
return !option_set.empty() && option_set.front().opt.gui_type == "legend";
}
return false;
}
void OptionsGroup::show_field(const t_config_option_key& opt_key, bool show/* = true*/)
{
Field* field = get_field(opt_key);
@ -196,16 +205,20 @@ void OptionsGroup::activate_line(Line& line)
}
}
if (!custom_ctrl && m_show_modified_btns) {
custom_ctrl = new OG_CustomCtrl((wxWindow*)this->stb, this);
sizer->Add(custom_ctrl, 0, wxEXPAND | wxALL, wxOSX || !staticbox ? 0 : 5);
}
auto option_set = line.get_options();
bool is_legend_line = option_set.front().opt.gui_type == "legend";
if (!custom_ctrl && m_use_custom_ctrl) {
custom_ctrl = new OG_CustomCtrl(is_legend_line ? this->parent() : (wxWindow*)this->stb, this);
if (is_legend_line)
sizer->Add(custom_ctrl, 0, wxEXPAND | wxLEFT, wxOSX ? 0 : 10);
else
sizer->Add(custom_ctrl, 0, wxEXPAND | wxALL, wxOSX || !staticbox ? 0 : 5);
}
// Set sidetext width for a better alignment of options in line
// "m_show_modified_btns==true" means that options groups are in tabs
if (option_set.size() > 1 && m_show_modified_btns) {
if (option_set.size() > 1 && m_use_custom_ctrl) {
sidetext_width = Field::def_width_thinner();
}
@ -231,7 +244,7 @@ void OptionsGroup::activate_line(Line& line)
m_use_custom_ctrl_as_parent = true;
// if we have an extra column, build it
if (extra_column && !m_show_modified_btns)
if (extra_column)
{
m_extra_column_item_ptrs.push_back(extra_column(this->ctrl_parent(), line));
grid_sizer->Add(m_extra_column_item_ptrs.back(), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 3);
@ -511,7 +524,7 @@ Option ConfigOptionsGroup::get_option(const std::string& opt_key, int opt_index
std::pair<std::string, int> pair(opt_key, opt_index);
m_opt_map.emplace(opt_id, pair);
if (m_show_modified_btns) // fill group and category values just fro options from Settings Tab
if (m_use_custom_ctrl) // fill group and category values just for options from Settings Tab
wxGetApp().sidebar().get_searcher().add_key(opt_id, title, this->config_category());
return Option(*m_config->def()->get(opt_key), opt_id);

View file

@ -129,7 +129,7 @@ public:
#endif /* __WXGTK__ */
wxWindow* ctrl_parent() const {
return this->stb ? (this->custom_ctrl && m_use_custom_ctrl_as_parent ? (wxWindow*)this->custom_ctrl : (wxWindow*)this->stb) : this->parent();
return this->custom_ctrl && m_use_custom_ctrl_as_parent ? (wxWindow*)this->custom_ctrl : (this->stb ? (wxWindow*)this->stb : this->parent());
}
void append_line(const Line& line);
@ -173,10 +173,6 @@ public:
inline void disable() { for (auto& field : m_fields) field.second->disable(); }
void set_grid_vgap(int gap) { m_grid_sizer->SetVGap(gap); }
void set_show_modified_btns_val(bool show) {
m_show_modified_btns = show;
}
void clear_fields_except_of(const std::vector<std::string> left_fields);
void hide_labels() { label_width = 0; }
@ -187,6 +183,7 @@ public:
wxGridSizer* get_grid_sizer() { return m_grid_sizer; }
const std::vector<Line>& get_lines() { return m_lines; }
bool is_legend_line();
protected:
std::map<t_config_option_key, Option> m_options;
@ -203,7 +200,7 @@ protected:
bool m_disabled {false};
wxGridSizer* m_grid_sizer {nullptr};
// "true" if option is created in preset tabs
bool m_show_modified_btns{ false };
bool m_use_custom_ctrl{ false };
// "true" if control should be created on custom_ctrl
bool m_use_custom_ctrl_as_parent { false };

View file

@ -745,9 +745,9 @@ Sidebar::Sidebar(Plater *parent)
(*btn)->Hide();
};
init_scalable_btn(&p->btn_send_gcode , "export_gcode", _L("Send to printer ") + GUI::shortkey_ctrl_prefix() + "Shift+G");
init_scalable_btn(&p->btn_send_gcode , "export_gcode", _L("Send to printer") + " " +GUI::shortkey_ctrl_prefix() + "Shift+G");
// init_scalable_btn(&p->btn_eject_device, "eject_sd" , _L("Remove device ") + GUI::shortkey_ctrl_prefix() + "T");
init_scalable_btn(&p->btn_export_gcode_removable, "export_to_sd", _L("Export to SD card / Flash drive ") + GUI::shortkey_ctrl_prefix() + "U");
init_scalable_btn(&p->btn_export_gcode_removable, "export_to_sd", _L("Export to SD card / Flash drive") + " " + GUI::shortkey_ctrl_prefix() + "U");
// regular buttons "Slice now" and "Export G-code"

View file

@ -2372,13 +2372,11 @@ PageShp TabPrinter::build_kinematics_page()
if (m_use_silent_mode) {
// Legend for OptionsGroups
auto optgroup = page->new_optgroup("");
optgroup->set_show_modified_btns_val(false);
optgroup->label_width = 23;// 230;
auto line = Line{ "", "" };
ConfigOptionDef def;
def.type = coString;
def.width = 15;
def.width = Field::def_width();
def.gui_type = "legend";
def.mode = comAdvanced;
def.tooltip = L("Values in this column are for Normal mode");
@ -3783,7 +3781,7 @@ void Page::activate(ConfigOptionMode mode, std::function<void()> throw_if_cancel
for (auto group : m_optgroups) {
if (!group->activate(throw_if_canceled))
continue;
m_vsizer->Add(group->sizer, 0, wxEXPAND | wxALL, 10);
m_vsizer->Add(group->sizer, 0, wxEXPAND | (group->is_legend_line() ? (wxLEFT|wxTOP) : wxALL), 10);
group->update_visibility(mode);
group->reload_config();
throw_if_canceled();