This commit is contained in:
bubnikv 2019-04-10 10:16:12 +02:00
commit f4c8f91519
20 changed files with 201 additions and 46 deletions

View file

@ -1654,16 +1654,16 @@ Vec3d SLAPrint::relative_correction() const
{
Vec3d corr(1., 1., 1.);
if(printer_config().relative_correction.values.size() == 3) {
corr(X) = printer_config().relative_correction.values[X];
corr(Y) = printer_config().relative_correction.values[Y];
corr(Z) = printer_config().relative_correction.values[Z];
if(printer_config().relative_correction.values.size() == 2) {
corr(X) = printer_config().relative_correction.values[0];
corr(Y) = printer_config().relative_correction.values[0];
corr(Z) = printer_config().relative_correction.values[1];
}
if(material_config().material_correction.values.size() == 3) {
corr(X) *= material_config().material_correction.values[X];
corr(Y) *= material_config().material_correction.values[Y];
corr(Z) *= material_config().material_correction.values[Z];
if(material_config().material_correction.values.size() == 2) {
corr(X) *= material_config().material_correction.values[0];
corr(Y) *= material_config().material_correction.values[0];
corr(Z) *= material_config().material_correction.values[1];
}
return corr;

View file

@ -77,7 +77,7 @@ void ObjectSettings::update_settings_list()
{
auto opt_key = (line.get_options())[0].opt_id; //we assume that we have one option per line
auto btn = new wxBitmapButton(parent, wxID_ANY, create_scaled_bitmap(m_parent, "colorchange_delete_on.png"),
auto btn = new wxBitmapButton(parent, wxID_ANY, create_scaled_bitmap(m_parent, "cross"/*"colorchange_delete_on.png"*/),
wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
#ifdef __WXMSW__
btn->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));

View file

@ -61,7 +61,7 @@ DPIFrame(NULL, wxID_ANY, SLIC3R_BUILD, wxDefaultPosition, wxDefaultSize, wxDEFAU
/* Load default preset bitmaps before a tabpanel initialization,
* but after filling of an em_unit value
*/
wxGetApp().preset_bundle->load_default_preset_bitmaps();
wxGetApp().preset_bundle->load_default_preset_bitmaps(this);
// initialize tabpanel and menubar
init_tabpanel();
@ -273,9 +273,9 @@ void MainFrame::init_menubar()
wxMenuItem* item_open = append_menu_item(fileMenu, wxID_ANY, _(L("&Open Project")) + dots + "\tCtrl+O", _(L("Open a project file")),
[this](wxCommandEvent&) { if (m_plater) m_plater->load_project(); }, "brick_add.png");
wxMenuItem* item_save = append_menu_item(fileMenu, wxID_ANY, _(L("&Save Project")) + "\tCtrl+S", _(L("Save current project file")),
[this](wxCommandEvent&) { if (m_plater) m_plater->export_3mf(into_path(m_plater->get_project_filename())); }, "disk.png");
[this](wxCommandEvent&) { if (m_plater) m_plater->export_3mf(into_path(m_plater->get_project_filename())); }, "save");
wxMenuItem* item_save_as = append_menu_item(fileMenu, wxID_ANY, _(L("Save Project &as")) + dots + "\tCtrl+Alt+S", _(L("Save current project file as")),
[this](wxCommandEvent&) { if (m_plater) m_plater->export_3mf(); }, "disk.png");
[this](wxCommandEvent&) { if (m_plater) m_plater->export_3mf(); }, "save");
fileMenu->AppendSeparator();

View file

@ -799,16 +799,14 @@ bool PresetCollection::delete_current_preset()
return true;
}
void PresetCollection::load_bitmap_default(const std::string &file_name)
void PresetCollection::load_bitmap_default(wxWindow *window, const std::string &file_name)
{
// FIXME: pass window ptr for proper scaling
*m_bitmap_main_frame = create_scaled_bitmap(nullptr, file_name);
*m_bitmap_main_frame = create_scaled_bitmap(window, file_name);
}
void PresetCollection::load_bitmap_add(const std::string &file_name)
void PresetCollection::load_bitmap_add(wxWindow *window, const std::string &file_name)
{
// FIXME: pass window ptr for proper scaling
*m_bitmap_add = create_scaled_bitmap(nullptr, file_name);
*m_bitmap_add = create_scaled_bitmap(window, file_name);
}
const Preset* PresetCollection::get_selected_preset_parent() const

View file

@ -15,6 +15,7 @@ class wxBitmapComboBox;
class wxChoice;
class wxItemContainer;
class wxString;
class wxWindow;
namespace Slic3r {
@ -276,10 +277,10 @@ public:
bool delete_current_preset();
// Load default bitmap to be placed at the wxBitmapComboBox of a MainFrame.
void load_bitmap_default(const std::string &file_name);
void load_bitmap_default(wxWindow *window, const std::string &file_name);
// Load "add new printer" bitmap to be placed at the wxBitmapComboBox of a MainFrame.
void load_bitmap_add(const std::string &file_name);
void load_bitmap_add(wxWindow *window, const std::string &file_name);
// Compatible & incompatible marks, to be placed at the wxBitmapComboBox items.
void set_bitmap_compatible (const wxBitmap *bmp) { m_bitmap_compatible = bmp; }

View file

@ -396,13 +396,12 @@ void PresetBundle::export_selections(AppConfig &config)
config.set("presets", "printer", printers.get_selected_preset_name());
}
void PresetBundle::load_compatible_bitmaps()
void PresetBundle::load_compatible_bitmaps(wxWindow *window)
{
// FIXME: pass window ptr for proper scaling
*m_bitmapCompatible = create_scaled_bitmap(nullptr, "flag-green-icon.png");
*m_bitmapIncompatible = create_scaled_bitmap(nullptr, "flag-red-icon.png");
*m_bitmapLock = create_scaled_bitmap(nullptr, "sys_lock.png");
*m_bitmapLockOpen = create_scaled_bitmap(nullptr, "sys_unlock.png");
*m_bitmapCompatible = create_scaled_bitmap(window, "flag_green");
*m_bitmapIncompatible = create_scaled_bitmap(window, "flag_red");
*m_bitmapLock = create_scaled_bitmap(window, "lock_closed");
*m_bitmapLockOpen = create_scaled_bitmap(window, "sys_unlock.png");
prints .set_bitmap_compatible(m_bitmapCompatible);
filaments .set_bitmap_compatible(m_bitmapCompatible);
@ -1428,15 +1427,15 @@ bool PresetBundle::parse_color(const std::string &scolor, unsigned char *rgb_out
return true;
}
void PresetBundle::load_default_preset_bitmaps()
void PresetBundle::load_default_preset_bitmaps(wxWindow *window)
{
this->prints.load_bitmap_default("cog");
this->sla_prints.load_bitmap_default("cog");
this->filaments.load_bitmap_default("spool.png");
this->sla_materials.load_bitmap_default("package_green.png");
this->printers.load_bitmap_default("printer");
this->printers.load_bitmap_add("add.png");
this->load_compatible_bitmaps();
this->prints.load_bitmap_default(window, "cog");
this->sla_prints.load_bitmap_default(window, "cog");
this->filaments.load_bitmap_default(window, "spool.png");
this->sla_materials.load_bitmap_default(window, "resin");
this->printers.load_bitmap_default(window, "printer");
this->printers.load_bitmap_add(window, "add.png");
this->load_compatible_bitmaps(window);
}
void PresetBundle::update_platter_filament_ui(unsigned int idx_extruder, GUI::PresetComboBox *ui)

View file

@ -7,6 +7,8 @@
#include <set>
#include <boost/filesystem/path.hpp>
class wxWindow;
namespace Slic3r {
namespace GUI {
@ -127,7 +129,7 @@ public:
static bool parse_color(const std::string &scolor, unsigned char *rgb_out);
void load_default_preset_bitmaps();
void load_default_preset_bitmaps(wxWindow *window);
private:
std::string load_system_presets();
@ -148,7 +150,7 @@ private:
// If it is not an external config, then the config will be stored into the user profile directory.
void load_config_file_config(const std::string &name_or_path, bool is_external, DynamicPrintConfig &&config);
void load_config_file_config_bundle(const std::string &path, const boost::property_tree::ptree &tree);
void load_compatible_bitmaps();
void load_compatible_bitmaps(wxWindow *window);
DynamicPrintConfig full_fff_config() const;
DynamicPrintConfig full_sla_config() const;

View file

@ -116,16 +116,16 @@ void Tab::create_preset_tab()
//buttons
wxBitmap bmpMenu;
bmpMenu = create_scaled_bitmap(this, "disk.png");
bmpMenu = create_scaled_bitmap(this, "save");
m_btn_save_preset = new wxBitmapButton(panel, wxID_ANY, bmpMenu, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
if (wxMSW) m_btn_save_preset->SetBackgroundColour(color);
bmpMenu = create_scaled_bitmap(this, "delete.png");
bmpMenu = create_scaled_bitmap(this, "cross"/*"delete.png"*/);
m_btn_delete_preset = new wxBitmapButton(panel, wxID_ANY, bmpMenu, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
if (wxMSW) m_btn_delete_preset->SetBackgroundColour(color);
m_show_incompatible_presets = false;
m_bmp_show_incompatible_presets = create_scaled_bitmap(this, "flag-red-icon.png");
m_bmp_hide_incompatible_presets = create_scaled_bitmap(this, "flag-green-icon.png");
m_bmp_show_incompatible_presets = create_scaled_bitmap(this, "flag_red");
m_bmp_hide_incompatible_presets = create_scaled_bitmap(this, "flag_green");
m_btn_hide_incompatible_presets = new wxBitmapButton(panel, wxID_ANY, m_bmp_hide_incompatible_presets, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
if (wxMSW) m_btn_hide_incompatible_presets->SetBackgroundColour(color);
@ -148,13 +148,13 @@ void Tab::create_preset_tab()
// Determine the theme color of OS (dark or light)
auto luma = wxGetApp().get_colour_approx_luma(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
// Bitmaps to be shown on the "Revert to system" aka "Lock to system" button next to each input field.
m_bmp_value_lock = create_scaled_bitmap(this, "sys_lock.png");
m_bmp_value_unlock = create_scaled_bitmap(this, luma >= 128 ? "sys_unlock.png" : "sys_unlock_grey.png");
m_bmp_value_lock = create_scaled_bitmap(this, luma >= 128 ? "lock_closed" : "lock_closed_white");
m_bmp_value_unlock = create_scaled_bitmap(this, "lock_open");
m_bmp_non_system = &m_bmp_white_bullet;
// Bitmaps to be shown on the "Undo user changes" button next to each input field.
m_bmp_value_revert = create_scaled_bitmap(this, luma >= 128 ? "action_undo.png" : "action_undo_grey.png");
m_bmp_value_revert = create_scaled_bitmap(this, "undo");
m_bmp_white_bullet = create_scaled_bitmap(this, "bullet_white.png");
m_bmp_question = create_scaled_bitmap(this, "question_mark_01.png");
m_bmp_question = create_scaled_bitmap(this, "question");
fill_icon_descriptions();
set_tooltips_text();
@ -2007,7 +2007,8 @@ void TabPrinter::build_sla()
optgroup = page->new_optgroup(_(L("Corrections")));
line = Line{ m_config->def()->get("relative_correction")->full_label, "" };
std::vector<std::string> axes{ "X", "Y", "Z" };
// std::vector<std::string> axes{ "X", "Y", "Z" };
std::vector<std::string> axes{ "XY", "Z" };
int id = 0;
for (auto& axis : axes) {
auto opt = optgroup->get_option("relative_correction", id);
@ -3210,7 +3211,7 @@ void TabSLAMaterial::build()
m_presets = &m_preset_bundle->sla_materials;
load_initial_data();
auto page = add_options_page(_(L("Material")), "package_green.png");
auto page = add_options_page(_(L("Material")), "resin");
auto optgroup = page->new_optgroup(_(L("Layers")));
// optgroup->append_single_option_line("layer_height");

View file

@ -426,7 +426,12 @@ wxBitmap create_scaled_bitmap(wxWindow *win, const std::string& bmp_name_in, con
{
static Slic3r::GUI::BitmapCache cache;
#ifdef __APPLE__
const float scale_factor = win != nullptr ? win->GetContentScaleFactor() : 1.0f;
#else
(void)(win);
const float scale_factor = 1.0f;
#endif
unsigned int height, width = height = 0;
unsigned int& scale_base = is_horizontal ? width : height;