Merge branch 'dev' of https://github.com/prusa3d/PrusaSlicer into et_reload_from_disk

This commit is contained in:
Enrico Turri 2019-09-06 16:06:37 +02:00
commit 9cf3793aac
19 changed files with 238 additions and 240 deletions

View file

@ -57,7 +57,7 @@ wxBitmap* BitmapCache::insert(const std::string &bitmap_key, size_t width, size_
m_map[bitmap_key] = bitmap;
} else {
bitmap = it->second;
if (bitmap->GetWidth() != width || bitmap->GetHeight() != height)
if (size_t(bitmap->GetWidth()) != width || size_t(bitmap->GetHeight()) != height)
bitmap->Create(width, height);
}
#ifndef BROKEN_ALPHA
@ -194,7 +194,7 @@ wxBitmap* BitmapCache::insert_raw_rgba(const std::string &bitmap_key, unsigned w
return this->insert(bitmap_key, wxImage_to_wxBitmap_with_alpha(std::move(image), scale));
}
wxBitmap* BitmapCache::load_png(const std::string &bitmap_name, unsigned int width, unsigned int height,
wxBitmap* BitmapCache::load_png(const std::string &bitmap_name, unsigned width, unsigned height,
const bool grayscale/* = false*/)
{
std::string bitmap_key = bitmap_name + ( height !=0 ?
@ -211,10 +211,10 @@ wxBitmap* BitmapCache::load_png(const std::string &bitmap_name, unsigned int wid
image.GetWidth() == 0 || image.GetHeight() == 0)
return nullptr;
if (height != 0 && image.GetHeight() != height)
width = int(0.5f + float(image.GetWidth()) * height / image.GetHeight());
else if (width != 0 && image.GetWidth() != width)
height = int(0.5f + float(image.GetHeight()) * width / image.GetWidth());
if (height != 0 && unsigned(image.GetHeight()) != height)
width = unsigned(0.5f + float(image.GetWidth()) * height / image.GetHeight());
else if (width != 0 && unsigned(image.GetWidth()) != width)
height = unsigned(0.5f + float(image.GetHeight()) * width / image.GetWidth());
if (height != 0 && width != 0)
image.Rescale(width, height, wxIMAGE_QUALITY_BILINEAR);

View file

@ -32,9 +32,9 @@ public:
wxBitmap* insert_raw_rgba(const std::string &bitmap_key, unsigned width, unsigned height, const unsigned char *raw_data, float scale = 1.0f, const bool grayscale = false);
// Load png from resources/icons. bitmap_key is given without the .png suffix. Bitmap will be rescaled to provided height/width if nonzero.
wxBitmap* load_png(const std::string &bitmap_key, unsigned int width = 0, unsigned int height = 0, const bool grayscale = false);
wxBitmap* load_png(const std::string &bitmap_key, unsigned width = 0, unsigned height = 0, const bool grayscale = false);
// Load svg from resources/icons. bitmap_key is given without the .svg suffix. SVG will be rasterized to provided height/width.
wxBitmap* load_svg(const std::string &bitmap_key, unsigned int width = 0, unsigned int height = 0, float scale = 1.0f, const bool grayscale = false);
wxBitmap* load_svg(const std::string &bitmap_key, unsigned width = 0, unsigned height = 0, float scale = 1.0f, const bool grayscale = false);
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); }

View file

@ -189,7 +189,7 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
case coFloatOrPercent: {
if (m_opt.type == coFloatOrPercent && !str.IsEmpty() && str.Last() != '%')
{
double val;
double val = 0.;
// Replace the first occurence of comma in decimal number.
str.Replace(",", ".", false);
if (check_value && !str.ToCDouble(&val))
@ -198,7 +198,7 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
set_value(double_to_string(val), true);
}
else if (check_value && ((m_opt.sidetext.rfind("mm/s") != std::string::npos && val > m_opt.max) ||
m_opt.sidetext.rfind("mm ") != std::string::npos && val > 1) &&
(m_opt.sidetext.rfind("mm ") != std::string::npos && val > 1)) &&
(m_value.empty() || std::string(str.ToUTF8().data()) != boost::any_cast<std::string>(m_value)))
{
const std::string sidetext = m_opt.sidetext.rfind("mm/s") != std::string::npos ? "mm/s" : "mm";

View file

@ -60,10 +60,6 @@
#endif // ENABLE_RENDER_STATISTICS
static const float TRACKBALLSIZE = 0.8f;
static const float GROUND_Z = -0.02f;
static const float GIZMO_RESET_BUTTON_HEIGHT = 22.0f;
static const float GIZMO_RESET_BUTTON_WIDTH = 70.f;
static const float DEFAULT_BG_DARK_COLOR[3] = { 0.478f, 0.478f, 0.478f };
static const float DEFAULT_BG_LIGHT_COLOR[3] = { 0.753f, 0.753f, 0.753f };

View file

@ -434,7 +434,6 @@ private:
bool m_initialized;
bool m_apply_zoom_to_volumes_filter;
mutable std::vector<int> m_hover_volume_idxs;
bool m_warning_texture_enabled;
bool m_legend_texture_enabled;
bool m_picking_enabled;
bool m_moving_enabled;

View file

@ -1074,8 +1074,8 @@ const std::vector<std::string>& ObjectList::get_options_for_bundle(const wxStrin
static bool improper_category(const std::string& category, const int extruders_cnt, const bool is_object_settings = true)
{
return category.empty() ||
extruders_cnt == 1 && (category == "Extruders" || category == "Wipe options" ) ||
!is_object_settings && category == "Support material";
(extruders_cnt == 1 && (category == "Extruders" || category == "Wipe options" )) ||
(!is_object_settings && category == "Support material");
}
void ObjectList::get_options_menu(settings_menu_hierarchy& settings_menu, const bool is_part)

View file

@ -668,7 +668,7 @@ void ObjectManipulation::update_mirror_buttons_visibility()
wxGetApp().CallAfter([this, new_states]{
for (int i=0; i<3; ++i) {
if (new_states[i] != m_mirror_buttons[i].second) {
const ScalableBitmap* bmp;
const ScalableBitmap* bmp = nullptr;
switch (new_states[i]) {
case mbHidden : bmp = &m_mirror_bitmap_hidden; m_mirror_buttons[i].first->Enable(false); break;
case mbShown : bmp = &m_mirror_bitmap_off; m_mirror_buttons[i].first->Enable(true); break;

View file

@ -363,12 +363,14 @@ private:
MutableHistoryInterval& operator=(const MutableHistoryInterval &rhs);
};
#ifdef SLIC3R_UNDOREDO_DEBUG
static inline std::string ptr_to_string(const void* ptr)
{
char buf[64];
sprintf(buf, "%p", ptr);
return buf;
}
#endif
// Smaller objects (Model, ModelObject, ModelInstance, ModelVolume, DynamicPrintConfig)
// are mutable and there is not tracking of the changes, therefore a snapshot needs to be