Merge branch 'master' into ender2-pro
This commit is contained in:
commit
2bba01f482
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -88,8 +88,8 @@ src/libslic3r/ExtrusionEntity.cpp
|
||||
src/libslic3r/Flow.cpp
|
||||
src/libslic3r/Format/3mf.cpp
|
||||
src/libslic3r/Format/AMF.cpp
|
||||
src/libslic3r/GCode/PostProcessor.cpp
|
||||
src/libslic3r/miniz_extension.cpp
|
||||
src/libslic3r/PostProcessor.cpp
|
||||
src/libslic3r/Preset.cpp
|
||||
src/libslic3r/Print.cpp
|
||||
src/libslic3r/SLA/Pad.cpp
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 52 KiB |
@ -1405,10 +1405,10 @@ void PrintConfigDef::init_fff_params()
|
||||
def->enum_values.push_back("10");
|
||||
def->enum_values.push_back("1000");
|
||||
def->enum_labels.push_back(L("0 (no open anchors)"));
|
||||
def->enum_labels.push_back("1 mm");
|
||||
def->enum_labels.push_back("2 mm");
|
||||
def->enum_labels.push_back("5 mm");
|
||||
def->enum_labels.push_back("10 mm");
|
||||
def->enum_labels.push_back(L("1 mm"));
|
||||
def->enum_labels.push_back(L("2 mm"));
|
||||
def->enum_labels.push_back(L("5 mm"));
|
||||
def->enum_labels.push_back(L("10 mm"));
|
||||
def->enum_labels.push_back(L("1000 (unlimited)"));
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloatOrPercent(600, true));
|
||||
@ -1428,10 +1428,10 @@ void PrintConfigDef::init_fff_params()
|
||||
def->gui_type = def_infill_anchor_min->gui_type;
|
||||
def->enum_values = def_infill_anchor_min->enum_values;
|
||||
def->enum_labels.push_back(L("0 (not anchored)"));
|
||||
def->enum_labels.push_back("1 mm");
|
||||
def->enum_labels.push_back("2 mm");
|
||||
def->enum_labels.push_back("5 mm");
|
||||
def->enum_labels.push_back("10 mm");
|
||||
def->enum_labels.push_back(L("1 mm"));
|
||||
def->enum_labels.push_back(L("2 mm"));
|
||||
def->enum_labels.push_back(L("5 mm"));
|
||||
def->enum_labels.push_back(L("10 mm"));
|
||||
def->enum_labels.push_back(L("1000 (unlimited)"));
|
||||
def->mode = def_infill_anchor_min->mode;
|
||||
def->set_default_value(new ConfigOptionFloatOrPercent(50, false));
|
||||
@ -2566,9 +2566,10 @@ void PrintConfigDef::init_fff_params()
|
||||
def->enum_values.push_back("0");
|
||||
def->enum_values.push_back("0.1");
|
||||
def->enum_values.push_back("0.2");
|
||||
def->enum_labels.push_back(L("same as top"));
|
||||
def->enum_labels.push_back(L("0.1"));
|
||||
def->enum_labels.push_back(L("0.2"));
|
||||
//TRN To be shown in Print Settings "Bottom contact Z distance". Have to be as short as possible
|
||||
def->enum_labels.push_back(L("Same as top"));
|
||||
def->enum_labels.push_back("0.1");
|
||||
def->enum_labels.push_back("0.2");
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloat(0));
|
||||
|
||||
@ -2650,7 +2651,8 @@ void PrintConfigDef::init_fff_params()
|
||||
def->min = -1;
|
||||
def->enum_values.push_back("-1");
|
||||
append(def->enum_values, support_material_interface_layers->enum_values);
|
||||
def->enum_labels.push_back(L("same as top"));
|
||||
//TRN To be shown in Print Settings "Bottom interface layers". Have to be as short as possible
|
||||
def->enum_labels.push_back(L("Same as top"));
|
||||
append(def->enum_labels, support_material_interface_layers->enum_labels);
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionInt(-1));
|
||||
|
@ -1800,7 +1800,7 @@ void PrintObject::discover_horizontal_shells()
|
||||
if (region_config.solid_infill_every_layers.value > 0 && region_config.fill_density.value > 0 &&
|
||||
(i % region_config.solid_infill_every_layers) == 0) {
|
||||
// Insert a solid internal layer. Mark stInternal surfaces as stInternalSolid or stInternalBridge.
|
||||
SurfaceType type = (region_config.fill_density == 100) ? stInternalSolid : stInternalBridge;
|
||||
SurfaceType type = (region_config.fill_density == 100 || region_config.solid_infill_every_layers == 1) ? stInternalSolid : stInternalBridge;
|
||||
for (Surface &surface : layerm->fill_surfaces.surfaces)
|
||||
if (surface.surface_type == stInternal)
|
||||
surface.surface_type = type;
|
||||
|
@ -1340,7 +1340,10 @@ namespace SupportMaterialInternal {
|
||||
// so we take the largest value and also apply safety offset to be ensure no gaps
|
||||
// are left in between
|
||||
Flow perimeter_bridge_flow = layerm.bridging_flow(frPerimeter);
|
||||
float w = float(std::max(perimeter_bridge_flow.scaled_width(), perimeter_bridge_flow.scaled_spacing()));
|
||||
//FIXME one may want to use a maximum of bridging flow width and normal flow width, as the perimeters are calculated using the normal flow
|
||||
// and then turned to bridging flow, thus their centerlines are derived from non-bridging flow and expanding them by a bridging flow
|
||||
// may not expand them to the edge of their respective islands.
|
||||
const float w = float(0.5 * std::max(perimeter_bridge_flow.scaled_width(), perimeter_bridge_flow.scaled_spacing())) + scaled<float>(0.001);
|
||||
for (Polyline &polyline : overhang_perimeters)
|
||||
if (polyline.is_straight()) {
|
||||
// This is a bridge
|
||||
@ -1355,7 +1358,7 @@ namespace SupportMaterialInternal {
|
||||
supported[j] = true;
|
||||
if (supported[0] && supported[1])
|
||||
// Offset a polyline into a thick line.
|
||||
polygons_append(bridges, offset(polyline, 0.5f * w + 10.f));
|
||||
polygons_append(bridges, offset(polyline, w));
|
||||
}
|
||||
bridges = union_(bridges);
|
||||
}
|
||||
@ -3044,7 +3047,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::generate_raf
|
||||
raft = diff(expand(raft, step), trimming);
|
||||
} else
|
||||
raft = diff(raft, trimming);
|
||||
if (contacts != nullptr)
|
||||
if (! interface_polygons.empty())
|
||||
columns_base->polygons = diff(columns_base->polygons, interface_polygons);
|
||||
}
|
||||
if (! brim.empty()) {
|
||||
|
@ -627,7 +627,7 @@ PageMaterials::PageMaterials(ConfigWizard *parent, Materials *materials, wxStrin
|
||||
|
||||
|
||||
list_printer->SetMinSize(wxSize(23*em, list_h));
|
||||
list_type->SetMinSize(wxSize(8*em, list_h));
|
||||
list_type->SetMinSize(wxSize(13*em, list_h));
|
||||
list_vendor->SetMinSize(wxSize(13*em, list_h));
|
||||
list_profile->SetMinSize(wxSize(23*em, list_h));
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "libslic3r/libslic3r.h"
|
||||
#include "DoubleSlider.hpp"
|
||||
#include "DoubleSlider_Utils.hpp"
|
||||
#include "libslic3r/GCode.hpp"
|
||||
#include "GUI.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
@ -27,7 +26,6 @@
|
||||
#include <cmath>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <random>
|
||||
#include "Field.hpp"
|
||||
#include "format.hpp"
|
||||
#include "NotificationManager.hpp"
|
||||
@ -2562,7 +2560,7 @@ std::string TickCodeInfo::get_color_for_tick(TickCode tick, Type type, const int
|
||||
if (mode == SingleExtruder && type == ColorChange && m_use_default_colors) {
|
||||
#if 1
|
||||
if (ticks.empty())
|
||||
return get_opposite_color((*m_colors)[0]);
|
||||
return color_generator.get_opposite_color((*m_colors)[0]);
|
||||
|
||||
auto before_tick_it = std::lower_bound(ticks.begin(), ticks.end(), tick);
|
||||
if (before_tick_it == ticks.end())
|
||||
@ -2571,24 +2569,24 @@ std::string TickCodeInfo::get_color_for_tick(TickCode tick, Type type, const int
|
||||
if (--before_tick_it; before_tick_it->type == ColorChange)
|
||||
break;
|
||||
if (before_tick_it->type == ColorChange)
|
||||
return get_opposite_color(before_tick_it->color);
|
||||
return get_opposite_color((*m_colors)[0]);
|
||||
return color_generator.get_opposite_color(before_tick_it->color);
|
||||
return color_generator.get_opposite_color((*m_colors)[0]);
|
||||
}
|
||||
|
||||
if (before_tick_it == ticks.begin())
|
||||
{
|
||||
const std::string& frst_color = (*m_colors)[0];
|
||||
if (before_tick_it->type == ColorChange)
|
||||
return get_opposite_color(frst_color, before_tick_it->color);
|
||||
return color_generator.get_opposite_color(frst_color, before_tick_it->color);
|
||||
|
||||
auto next_tick_it = before_tick_it;
|
||||
while (next_tick_it != ticks.end())
|
||||
if (++next_tick_it; next_tick_it->type == ColorChange)
|
||||
break;
|
||||
if (next_tick_it->type == ColorChange)
|
||||
return get_opposite_color(frst_color, next_tick_it->color);
|
||||
return color_generator.get_opposite_color(frst_color, next_tick_it->color);
|
||||
|
||||
return get_opposite_color(frst_color);
|
||||
return color_generator.get_opposite_color(frst_color);
|
||||
}
|
||||
|
||||
std::string frst_color = "";
|
||||
@ -2609,13 +2607,13 @@ std::string TickCodeInfo::get_color_for_tick(TickCode tick, Type type, const int
|
||||
|
||||
if (before_tick_it->type == ColorChange) {
|
||||
if (frst_color.empty())
|
||||
return get_opposite_color(before_tick_it->color);
|
||||
return get_opposite_color(before_tick_it->color, frst_color);
|
||||
return color_generator.get_opposite_color(before_tick_it->color);
|
||||
return color_generator.get_opposite_color(before_tick_it->color, frst_color);
|
||||
}
|
||||
|
||||
if (frst_color.empty())
|
||||
return get_opposite_color((*m_colors)[0]);
|
||||
return get_opposite_color((*m_colors)[0], frst_color);
|
||||
return color_generator.get_opposite_color((*m_colors)[0]);
|
||||
return color_generator.get_opposite_color((*m_colors)[0], frst_color);
|
||||
#else
|
||||
const std::vector<std::string>& colors = ColorPrintColors::get();
|
||||
if (ticks.empty())
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "libslic3r/CustomGCode.hpp"
|
||||
#include "wxExtensions.hpp"
|
||||
#include "DoubleSlider_Utils.hpp"
|
||||
|
||||
#include <wx/window.h>
|
||||
#include <wx/control.h>
|
||||
@ -118,6 +119,7 @@ class TickCodeInfo
|
||||
// int m_default_color_idx = 0;
|
||||
|
||||
std::vector<std::string>* m_colors {nullptr};
|
||||
ColorGenerator color_generator;
|
||||
|
||||
std::string get_color_for_tick(TickCode tick, Type type, const int extruder);
|
||||
|
||||
|
@ -1,173 +1,191 @@
|
||||
#include <stdio.h>
|
||||
#include <random>
|
||||
|
||||
#include "wx/colour.h"
|
||||
|
||||
// next code is borrowed from https://stackoverflow.com/questions/3018313/algorithm-to-convert-rgb-to-hsv-and-hsv-to-rgb-in-range-0-255-for-both
|
||||
|
||||
typedef struct {
|
||||
double r; // a fraction between 0 and 1
|
||||
double g; // a fraction between 0 and 1
|
||||
double b; // a fraction between 0 and 1
|
||||
} rgb;
|
||||
|
||||
typedef struct {
|
||||
double h; // angle in degrees
|
||||
double s; // a fraction between 0 and 1
|
||||
double v; // a fraction between 0 and 1
|
||||
} hsv;
|
||||
|
||||
static hsv rgb2hsv(rgb in);
|
||||
static rgb hsv2rgb(hsv in);
|
||||
|
||||
hsv rgb2hsv(rgb in)
|
||||
class ColorGenerator
|
||||
{
|
||||
hsv out;
|
||||
double min, max, delta;
|
||||
// Some of next code is borrowed from https://stackoverflow.com/questions/3018313/algorithm-to-convert-rgb-to-hsv-and-hsv-to-rgb-in-range-0-255-for-both
|
||||
typedef struct {
|
||||
double r; // a fraction between 0 and 1
|
||||
double g; // a fraction between 0 and 1
|
||||
double b; // a fraction between 0 and 1
|
||||
} rgb;
|
||||
|
||||
min = in.r < in.g ? in.r : in.g;
|
||||
min = min < in.b ? min : in.b;
|
||||
typedef struct {
|
||||
double h; // angle in degrees
|
||||
double s; // a fraction between 0 and 1
|
||||
double v; // a fraction between 0 and 1
|
||||
} hsv;
|
||||
|
||||
max = in.r > in.g ? in.r : in.g;
|
||||
max = max > in.b ? max : in.b;
|
||||
//static hsv rgb2hsv(rgb in);
|
||||
//static rgb hsv2rgb(hsv in);
|
||||
|
||||
out.v = max; // v
|
||||
delta = max - min;
|
||||
if (delta < 0.00001)
|
||||
hsv rgb2hsv(rgb in)
|
||||
{
|
||||
out.s = 0;
|
||||
out.h = 0; // undefined, maybe nan?
|
||||
hsv out;
|
||||
double min, max, delta;
|
||||
|
||||
min = in.r < in.g ? in.r : in.g;
|
||||
min = min < in.b ? min : in.b;
|
||||
|
||||
max = in.r > in.g ? in.r : in.g;
|
||||
max = max > in.b ? max : in.b;
|
||||
|
||||
out.v = max; // v
|
||||
delta = max - min;
|
||||
if (delta < 0.00001)
|
||||
{
|
||||
out.s = 0;
|
||||
out.h = 0; // undefined, maybe nan?
|
||||
return out;
|
||||
}
|
||||
if (max > 0.0) { // NOTE: if Max is == 0, this divide would cause a crash
|
||||
out.s = (delta / max); // s
|
||||
}
|
||||
else {
|
||||
// if max is 0, then r = g = b = 0
|
||||
// s = 0, h is undefined
|
||||
out.s = 0.0;
|
||||
out.h = NAN; // its now undefined
|
||||
return out;
|
||||
}
|
||||
if (in.r >= max) // > is bogus, just keeps compilor happy
|
||||
out.h = (in.g - in.b) / delta; // between yellow & magenta
|
||||
else
|
||||
if (in.g >= max)
|
||||
out.h = 2.0 + (in.b - in.r) / delta; // between cyan & yellow
|
||||
else
|
||||
out.h = 4.0 + (in.r - in.g) / delta; // between magenta & cyan
|
||||
|
||||
out.h *= 60.0; // degrees
|
||||
|
||||
if (out.h < 0.0)
|
||||
out.h += 360.0;
|
||||
|
||||
return out;
|
||||
}
|
||||
if( max > 0.0 ) { // NOTE: if Max is == 0, this divide would cause a crash
|
||||
out.s = (delta / max); // s
|
||||
} else {
|
||||
// if max is 0, then r = g = b = 0
|
||||
// s = 0, h is undefined
|
||||
out.s = 0.0;
|
||||
out.h = NAN; // its now undefined
|
||||
|
||||
hsv rgb2hsv(const std::string& str_clr_in)
|
||||
{
|
||||
wxColour clr(str_clr_in);
|
||||
rgb in = { clr.Red() / 255.0, clr.Green() / 255.0, clr.Blue() / 255.0 };
|
||||
return rgb2hsv(in);
|
||||
}
|
||||
|
||||
|
||||
rgb hsv2rgb(hsv in)
|
||||
{
|
||||
double hh, p, q, t, ff;
|
||||
long i;
|
||||
rgb out;
|
||||
|
||||
if (in.s <= 0.0) { // < is bogus, just shuts up warnings
|
||||
out.r = in.v;
|
||||
out.g = in.v;
|
||||
out.b = in.v;
|
||||
return out;
|
||||
}
|
||||
hh = in.h;
|
||||
if (hh >= 360.0) hh -= 360.0;//hh = 0.0;
|
||||
hh /= 60.0;
|
||||
i = (long)hh;
|
||||
ff = hh - i;
|
||||
p = in.v * (1.0 - in.s);
|
||||
q = in.v * (1.0 - (in.s * ff));
|
||||
t = in.v * (1.0 - (in.s * (1.0 - ff)));
|
||||
|
||||
switch (i) {
|
||||
case 0:
|
||||
out.r = in.v;
|
||||
out.g = t;
|
||||
out.b = p;
|
||||
break;
|
||||
case 1:
|
||||
out.r = q;
|
||||
out.g = in.v;
|
||||
out.b = p;
|
||||
break;
|
||||
case 2:
|
||||
out.r = p;
|
||||
out.g = in.v;
|
||||
out.b = t;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
out.r = p;
|
||||
out.g = q;
|
||||
out.b = in.v;
|
||||
break;
|
||||
case 4:
|
||||
out.r = t;
|
||||
out.g = p;
|
||||
out.b = in.v;
|
||||
break;
|
||||
case 5:
|
||||
default:
|
||||
out.r = in.v;
|
||||
out.g = p;
|
||||
out.b = q;
|
||||
break;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
if( in.r >= max ) // > is bogus, just keeps compilor happy
|
||||
out.h = ( in.g - in.b ) / delta; // between yellow & magenta
|
||||
else
|
||||
if( in.g >= max )
|
||||
out.h = 2.0 + ( in.b - in.r ) / delta; // between cyan & yellow
|
||||
else
|
||||
out.h = 4.0 + ( in.r - in.g ) / delta; // between magenta & cyan
|
||||
|
||||
out.h *= 60.0; // degrees
|
||||
std::random_device rd;
|
||||
|
||||
if( out.h < 0.0 )
|
||||
out.h += 360.0;
|
||||
public:
|
||||
|
||||
return out;
|
||||
}
|
||||
ColorGenerator() {}
|
||||
~ColorGenerator() {}
|
||||
|
||||
hsv rgb2hsv(const std::string& str_clr_in)
|
||||
{
|
||||
wxColour clr(str_clr_in);
|
||||
rgb in = { clr.Red() / 255.0, clr.Green() / 255.0, clr.Blue() / 255.0 };
|
||||
return rgb2hsv(in);
|
||||
}
|
||||
double rand_val()
|
||||
{
|
||||
std::mt19937 rand_generator(rd());
|
||||
|
||||
|
||||
rgb hsv2rgb(hsv in)
|
||||
{
|
||||
double hh, p, q, t, ff;
|
||||
long i;
|
||||
rgb out;
|
||||
|
||||
if(in.s <= 0.0) { // < is bogus, just shuts up warnings
|
||||
out.r = in.v;
|
||||
out.g = in.v;
|
||||
out.b = in.v;
|
||||
return out;
|
||||
// this value will be used for Saturation and Value
|
||||
// to avoid extremely light/dark colors, take this value from range [0.65; 1.0]
|
||||
std::uniform_real_distribution<double> distrib(0.65, 1.0);
|
||||
return distrib(rand_generator);
|
||||
}
|
||||
hh = in.h;
|
||||
if (hh >= 360.0) hh -= 360.0;//hh = 0.0;
|
||||
hh /= 60.0;
|
||||
i = (long)hh;
|
||||
ff = hh - i;
|
||||
p = in.v * (1.0 - in.s);
|
||||
q = in.v * (1.0 - (in.s * ff));
|
||||
t = in.v * (1.0 - (in.s * (1.0 - ff)));
|
||||
|
||||
switch(i) {
|
||||
case 0:
|
||||
out.r = in.v;
|
||||
out.g = t;
|
||||
out.b = p;
|
||||
break;
|
||||
case 1:
|
||||
out.r = q;
|
||||
out.g = in.v;
|
||||
out.b = p;
|
||||
break;
|
||||
case 2:
|
||||
out.r = p;
|
||||
out.g = in.v;
|
||||
out.b = t;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
out.r = p;
|
||||
out.g = q;
|
||||
out.b = in.v;
|
||||
break;
|
||||
case 4:
|
||||
out.r = t;
|
||||
out.g = p;
|
||||
out.b = in.v;
|
||||
break;
|
||||
case 5:
|
||||
default:
|
||||
out.r = in.v;
|
||||
out.g = p;
|
||||
out.b = q;
|
||||
break;
|
||||
std::string get_opposite_color(const std::string& color)
|
||||
{
|
||||
std::string opp_color = "";
|
||||
|
||||
hsv hsv_clr = rgb2hsv(color);
|
||||
hsv_clr.h += 65; // 65 instead 60 to avoid circle values
|
||||
hsv_clr.s = rand_val();
|
||||
hsv_clr.v = rand_val();
|
||||
|
||||
rgb rgb_opp_color = hsv2rgb(hsv_clr);
|
||||
|
||||
wxString clr_str = wxString::Format(wxT("#%02X%02X%02X"), (unsigned char)(rgb_opp_color.r * 255), (unsigned char)(rgb_opp_color.g * 255), (unsigned char)(rgb_opp_color.b * 255));
|
||||
opp_color = clr_str.ToStdString();
|
||||
|
||||
return opp_color;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
double rand_val()
|
||||
{
|
||||
return 0.1 * (10 - rand() % 8);
|
||||
}
|
||||
std::string get_opposite_color(const std::string& color_frst, const std::string& color_scnd)
|
||||
{
|
||||
std::string opp_color = "";
|
||||
|
||||
std::string get_opposite_color(const std::string& color)
|
||||
{
|
||||
std::string opp_color = "";
|
||||
hsv hsv_frst = rgb2hsv(color_frst);
|
||||
hsv hsv_scnd = rgb2hsv(color_scnd);
|
||||
|
||||
hsv hsv_clr = rgb2hsv(color);
|
||||
hsv_clr.h += 65; // 65 instead 60 to avoid circle values
|
||||
hsv_clr.s = rand_val();
|
||||
hsv_clr.v = rand_val();
|
||||
double delta_h = fabs(hsv_frst.h - hsv_scnd.h);
|
||||
double start_h = delta_h > 180 ? std::min<double>(hsv_scnd.h, hsv_frst.h) : std::max<double>(hsv_scnd.h, hsv_frst.h);
|
||||
start_h += 5; // to avoid circle change of colors for 120 deg
|
||||
if (delta_h < 180)
|
||||
delta_h = 360 - delta_h;
|
||||
|
||||
rgb rgb_opp_color = hsv2rgb(hsv_clr);
|
||||
hsv hsv_opp = hsv{ start_h + 0.5 * delta_h, rand_val(), rand_val() };
|
||||
rgb rgb_opp_color = hsv2rgb(hsv_opp);
|
||||
|
||||
wxString clr_str = wxString::Format(wxT("#%02X%02X%02X"), (unsigned char)(rgb_opp_color.r * 255), (unsigned char)(rgb_opp_color.g * 255), (unsigned char)(rgb_opp_color.b * 255));
|
||||
opp_color = clr_str.ToStdString();
|
||||
wxString clr_str = wxString::Format(wxT("#%02X%02X%02X"), (unsigned char)(rgb_opp_color.r * 255), (unsigned char)(rgb_opp_color.g * 255), (unsigned char)(rgb_opp_color.b * 255));
|
||||
opp_color = clr_str.ToStdString();
|
||||
|
||||
return opp_color;
|
||||
}
|
||||
|
||||
std::string get_opposite_color(const std::string& color_frst, const std::string& color_scnd)
|
||||
{
|
||||
std::string opp_color = "";
|
||||
|
||||
hsv hsv_frst = rgb2hsv(color_frst);
|
||||
hsv hsv_scnd = rgb2hsv(color_scnd);
|
||||
|
||||
double delta_h = fabs(hsv_frst.h - hsv_scnd.h);
|
||||
double start_h = delta_h > 180 ? std::min<double>(hsv_scnd.h, hsv_frst.h) : std::max<double>(hsv_scnd.h, hsv_frst.h);
|
||||
start_h += 5; // to avoid circle change of colors for 120 deg
|
||||
if (delta_h < 180)
|
||||
delta_h = 360 - delta_h;
|
||||
|
||||
hsv hsv_opp = hsv{ start_h + 0.5 * delta_h, rand_val(), rand_val() };
|
||||
rgb rgb_opp_color = hsv2rgb(hsv_opp);
|
||||
|
||||
wxString clr_str = wxString::Format(wxT("#%02X%02X%02X"), (unsigned char)(rgb_opp_color.r * 255), (unsigned char)(rgb_opp_color.g * 255), (unsigned char)(rgb_opp_color.b * 255));
|
||||
opp_color = clr_str.ToStdString();
|
||||
|
||||
return opp_color;
|
||||
}
|
||||
return opp_color;
|
||||
}
|
||||
};
|
@ -352,7 +352,7 @@ void show_substitutions_info(const PresetsConfigSubstitutions& presets_config_su
|
||||
add_config_substitutions(substitution.substitutions, changes);
|
||||
}
|
||||
|
||||
InfoDialog msg(nullptr, _L("Configuration bundle was loaded, however some configuration values were not recognized."), substitution_message(changes));
|
||||
InfoDialog msg(nullptr, _L("Configuration bundle was loaded, however some configuration values were not recognized."), substitution_message(changes), true);
|
||||
msg.ShowModal();
|
||||
}
|
||||
|
||||
@ -363,7 +363,7 @@ void show_substitutions_info(const ConfigSubstitutions& config_substitutions, co
|
||||
|
||||
InfoDialog msg(nullptr,
|
||||
format_wxstr(_L("Configuration file \"%1%\" was loaded, however some configuration values were not recognized."), from_u8(filename)),
|
||||
substitution_message(changes));
|
||||
substitution_message(changes), true);
|
||||
msg.ShowModal();
|
||||
}
|
||||
|
||||
|
@ -948,26 +948,31 @@ bool GUI_App::check_older_app_config(Semver current_version, bool backup)
|
||||
return false;
|
||||
BOOST_LOG_TRIVIAL(info) << "last app config file used: " << m_older_data_dir_path;
|
||||
// ask about using older data folder
|
||||
RichMessageDialog msg(nullptr, backup ?
|
||||
wxString::Format(_L("PrusaSlicer detected another configuration folder at %s."
|
||||
"\nIts version is %s."
|
||||
"\nLast version you used in current configuration folder is %s."
|
||||
"\nPlease note that PrusaSlicer uses different folders to save configuration of alpha, beta and full release versions."
|
||||
"\nWould you like to copy found configuration to your current configuration folder?"
|
||||
|
||||
"\n\nIf you select yes, PrusaSlicer will copy all profiles and other files from found folder to the current one. Overwriting any existing file with matching name."
|
||||
"\nIf you select no, you will continue with current configuration.")
|
||||
, m_older_data_dir_path, last_semver.to_string(), current_version.to_string())
|
||||
: wxString::Format(_L("PrusaSlicer detected another configuration folder at %s."
|
||||
"\nIts version is %s."
|
||||
"\nThere is no configuration file in current configuration folder."
|
||||
"\nPlease note that PrusaSlicer uses different folders to save configuration of alpha, beta and full release versions."
|
||||
"\nWould you like to copy found configuration to your current configuration folder?"
|
||||
InfoDialog msg(nullptr
|
||||
, format_wxstr(_L("You are opening %1% version %2%."), SLIC3R_APP_NAME, SLIC3R_VERSION)
|
||||
, backup ?
|
||||
format_wxstr(_L(
|
||||
"The active configuration was created by <b>%1% %2%</b>,"
|
||||
"\nwhile a newer configuration was found in <b>%3%</b>"
|
||||
"\ncreated by <b>%1% %4%</b>."
|
||||
"\n\nShall the newer configuration be imported?"
|
||||
"\nIf so, your active configuration will backed up before importing the new configuration."
|
||||
)
|
||||
, SLIC3R_APP_NAME, current_version.to_string(), m_older_data_dir_path, last_semver.to_string())
|
||||
: format_wxstr(_L(
|
||||
"An existing configuration was found in <b>%3%</b>"
|
||||
"\ncreated by <b>%1% %2%</b>."
|
||||
"\n\nShall this configuration be imported?"
|
||||
)
|
||||
, SLIC3R_APP_NAME, last_semver.to_string(), m_older_data_dir_path)
|
||||
, true, wxYES_NO);
|
||||
|
||||
if (backup) {
|
||||
msg.SetButtonLabel(wxID_YES, _L("Import"));
|
||||
msg.SetButtonLabel(wxID_NO, _L("Don't import"));
|
||||
}
|
||||
|
||||
"\n\nIf you select yes, PrusaSlicer will copy all profiles and other files from found folder to the current one."
|
||||
"\nIf you select no, you will start with clean installation with configuration wizard.")
|
||||
, m_older_data_dir_path, last_semver.to_string())
|
||||
, _L("PrusaSlicer"), /*wxICON_QUESTION | */wxYES_NO);
|
||||
if (msg.ShowModal() == wxID_YES) {
|
||||
std::string snapshot_id;
|
||||
if (backup) {
|
||||
@ -2162,9 +2167,9 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
|
||||
local_menu->Append(config_id_base + ConfigMenuLanguage, _L("&Language"));
|
||||
if (is_editor()) {
|
||||
local_menu->AppendSeparator();
|
||||
local_menu->Append(config_id_base + ConfigMenuFlashFirmware, _L("Flash printer &firmware"), _L("Upload a firmware image into an Arduino based printer"));
|
||||
local_menu->Append(config_id_base + ConfigMenuFlashFirmware, _L("Flash Printer &Firmware"), _L("Upload a firmware image into an Arduino based printer"));
|
||||
// TODO: for when we're able to flash dictionaries
|
||||
// local_menu->Append(config_id_base + FirmwareMenuDict, _L("Flash language file"), _L("Upload a language dictionary file into a Prusa printer"));
|
||||
// local_menu->Append(config_id_base + FirmwareMenuDict, _L("Flash Language File"), _L("Upload a language dictionary file into a Prusa printer"));
|
||||
}
|
||||
|
||||
local_menu->Bind(wxEVT_MENU, [this, config_id_base](wxEvent &event) {
|
||||
|
@ -349,7 +349,8 @@ void ObjectList::get_selection_indexes(std::vector<int>& obj_idxs, std::vector<i
|
||||
{
|
||||
wxDataViewItemArray sels;
|
||||
GetSelections(sels);
|
||||
assert(!sels.IsEmpty());
|
||||
if (sels.IsEmpty())
|
||||
return;
|
||||
|
||||
if ( m_objects_model->GetItemType(sels[0]) & itVolume ||
|
||||
(sels.Count()==1 && m_objects_model->GetItemType(m_objects_model->GetParent(sels[0])) & itVolume) ) {
|
||||
@ -424,7 +425,7 @@ MeshErrorsInfo ObjectList::get_mesh_errors_info(const int obj_idx, const int vol
|
||||
if (!stats.manifold()) {
|
||||
remaining_info = format_wxstr(_L_PLURAL("%1$d open edge", "%1$d open edges", stats.open_edges), stats.open_edges);
|
||||
|
||||
tooltip += _L("Remaning errors") + ":\n";
|
||||
tooltip += _L("Remaining errors") + ":\n";
|
||||
tooltip += "\t" + format_wxstr(_L_PLURAL("%1$d open edge", "%1$d open edges", stats.open_edges), stats.open_edges) + "\n";
|
||||
}
|
||||
|
||||
@ -1556,7 +1557,7 @@ void ObjectList::load_modifier(ModelObject& model_object, std::vector<ModelVolum
|
||||
for (auto object : model.objects) {
|
||||
if (model_object.origin_translation != Vec3d::Zero()) {
|
||||
object->center_around_origin();
|
||||
Vec3d delta = model_object.origin_translation - object->origin_translation;
|
||||
const Vec3d delta = model_object.origin_translation - object->origin_translation;
|
||||
for (auto volume : object->volumes) {
|
||||
volume->translate(delta);
|
||||
}
|
||||
@ -1570,6 +1571,12 @@ void ObjectList::load_modifier(ModelObject& model_object, std::vector<ModelVolum
|
||||
new_volume->name = boost::filesystem::path(input_file).filename().string();
|
||||
// set a default extruder value, since user can't add it manually
|
||||
new_volume->config.set_key_value("extruder", new ConfigOptionInt(0));
|
||||
// update source data
|
||||
new_volume->source.input_file = input_file;
|
||||
new_volume->source.object_idx = obj_idx;
|
||||
new_volume->source.volume_idx = int(model_object.volumes.size()) - 1;
|
||||
if (model.objects.size() == 1 && model.objects.front()->volumes.size() == 1)
|
||||
new_volume->source.mesh_offset = model.objects.front()->volumes.front()->source.mesh_offset;
|
||||
|
||||
if (from_galery) {
|
||||
// Transform the new modifier to be aligned with the print bed.
|
||||
|
@ -1094,7 +1094,7 @@ static wxMenu* generate_help_menu()
|
||||
else
|
||||
append_menu_item(helpMenu, wxID_ANY, wxString::Format(_L("&About %s"), GCODEVIEWER_APP_NAME), _L("Show about dialog"),
|
||||
[](wxCommandEvent&) { Slic3r::GUI::about(); });
|
||||
append_menu_item(helpMenu, wxID_ANY, _L("Show Tip of the day"), _L("Opens Tip of the day notification in bottom right corner or shows another tip if already opened."),
|
||||
append_menu_item(helpMenu, wxID_ANY, _L("Show Tip of the Day"), _L("Opens Tip of the day notification in bottom right corner or shows another tip if already opened."),
|
||||
[](wxCommandEvent&) { wxGetApp().plater()->get_notification_manager()->push_hint_notification(false); });
|
||||
helpMenu->AppendSeparator();
|
||||
append_menu_item(helpMenu, wxID_ANY, _L("Keyboard Shortcuts") + sep + "&?", _L("Show the list of the keyboard shortcuts"),
|
||||
@ -1188,9 +1188,9 @@ void MainFrame::init_menubar_as_editor()
|
||||
[this](wxCommandEvent&) { save_project(); }, "save", nullptr,
|
||||
[this](){return m_plater != nullptr && can_save(); }, this);
|
||||
#ifdef __APPLE__
|
||||
append_menu_item(fileMenu, wxID_ANY, _L("Save project &as") + dots + "\tCtrl+Shift+S", _L("Save current project file as"),
|
||||
append_menu_item(fileMenu, wxID_ANY, _L("Save Project &as") + dots + "\tCtrl+Shift+S", _L("Save current project file as"),
|
||||
#else
|
||||
append_menu_item(fileMenu, wxID_ANY, _L("Save project &as") + dots + "\tCtrl+Alt+S", _L("Save current project file as"),
|
||||
append_menu_item(fileMenu, wxID_ANY, _L("Save Project &as") + dots + "\tCtrl+Alt+S", _L("Save current project file as"),
|
||||
#endif // __APPLE__
|
||||
[this](wxCommandEvent&) { save_project_as(); }, "save", nullptr,
|
||||
[this](){return m_plater != nullptr && can_save_as(); }, this);
|
||||
@ -1202,11 +1202,11 @@ void MainFrame::init_menubar_as_editor()
|
||||
[this](wxCommandEvent&) { if (m_plater) m_plater->add_model(); }, "import_plater", nullptr,
|
||||
[this](){return m_plater != nullptr; }, this);
|
||||
|
||||
append_menu_item(import_menu, wxID_ANY, _L("Import STL (imperial units)"), _L("Load an model saved with imperial units"),
|
||||
append_menu_item(import_menu, wxID_ANY, _L("Import STL (Imperial Units)"), _L("Load an model saved with imperial units"),
|
||||
[this](wxCommandEvent&) { if (m_plater) m_plater->add_model(true); }, "import_plater", nullptr,
|
||||
[this](){return m_plater != nullptr; }, this);
|
||||
|
||||
append_menu_item(import_menu, wxID_ANY, _L("Import SL1 / SL1S archive") + dots, _L("Load an SL1 / Sl1S archive"),
|
||||
append_menu_item(import_menu, wxID_ANY, _L("Import SL1 / SL1S Archive") + dots, _L("Load an SL1 / Sl1S archive"),
|
||||
[this](wxCommandEvent&) { if (m_plater) m_plater->import_sl1_archive(); }, "import_plater", nullptr,
|
||||
[this](){return m_plater != nullptr && !m_plater->is_any_job_running(); }, this);
|
||||
|
||||
@ -1214,7 +1214,7 @@ void MainFrame::init_menubar_as_editor()
|
||||
append_menu_item(import_menu, wxID_ANY, _L("Import &Config") + dots + "\tCtrl+L", _L("Load exported configuration file"),
|
||||
[this](wxCommandEvent&) { load_config_file(); }, "import_config", nullptr,
|
||||
[]() {return true; }, this);
|
||||
append_menu_item(import_menu, wxID_ANY, _L("Import Config from &project") + dots +"\tCtrl+Alt+L", _L("Load configuration from project file"),
|
||||
append_menu_item(import_menu, wxID_ANY, _L("Import Config from &Project") + dots +"\tCtrl+Alt+L", _L("Load configuration from project file"),
|
||||
[this](wxCommandEvent&) { if (m_plater) m_plater->extract_config_from_project(); }, "import_config", nullptr,
|
||||
[]() {return true; }, this);
|
||||
import_menu->AppendSeparator();
|
||||
@ -1232,22 +1232,22 @@ void MainFrame::init_menubar_as_editor()
|
||||
[this](wxCommandEvent&) { if (m_plater) m_plater->send_gcode(); }, "export_gcode", nullptr,
|
||||
[this](){return can_send_gcode(); }, this);
|
||||
m_changeable_menu_items.push_back(item_send_gcode);
|
||||
append_menu_item(export_menu, wxID_ANY, _L("Export G-code to SD card / Flash drive") + dots + "\tCtrl+U", _L("Export current plate as G-code to SD card / Flash drive"),
|
||||
append_menu_item(export_menu, wxID_ANY, _L("Export G-code to SD Card / Flash Drive") + dots + "\tCtrl+U", _L("Export current plate as G-code to SD card / Flash drive"),
|
||||
[this](wxCommandEvent&) { if (m_plater) m_plater->export_gcode(true); }, "export_to_sd", nullptr,
|
||||
[this]() {return can_export_gcode_sd(); }, this);
|
||||
export_menu->AppendSeparator();
|
||||
append_menu_item(export_menu, wxID_ANY, _L("Export plate as &STL") + dots, _L("Export current plate as STL"),
|
||||
append_menu_item(export_menu, wxID_ANY, _L("Export Plate as &STL") + dots, _L("Export current plate as STL"),
|
||||
[this](wxCommandEvent&) { if (m_plater) m_plater->export_stl(); }, "export_plater", nullptr,
|
||||
[this](){return can_export_model(); }, this);
|
||||
append_menu_item(export_menu, wxID_ANY, _L("Export plate as STL &including supports") + dots, _L("Export current plate as STL including supports"),
|
||||
append_menu_item(export_menu, wxID_ANY, _L("Export Plate as STL &Including Supports") + dots, _L("Export current plate as STL including supports"),
|
||||
[this](wxCommandEvent&) { if (m_plater) m_plater->export_stl(true); }, "export_plater", nullptr,
|
||||
[this](){return can_export_supports(); }, this);
|
||||
// Deprecating AMF export. Let's wait for user feedback.
|
||||
// append_menu_item(export_menu, wxID_ANY, _L("Export plate as &AMF") + dots, _L("Export current plate as AMF"),
|
||||
// append_menu_item(export_menu, wxID_ANY, _L("Export Plate as &AMF") + dots, _L("Export current plate as AMF"),
|
||||
// [this](wxCommandEvent&) { if (m_plater) m_plater->export_amf(); }, "export_plater", nullptr,
|
||||
// [this](){return can_export_model(); }, this);
|
||||
export_menu->AppendSeparator();
|
||||
append_menu_item(export_menu, wxID_ANY, _L("Export &toolpaths as OBJ") + dots, _L("Export toolpaths as OBJ"),
|
||||
append_menu_item(export_menu, wxID_ANY, _L("Export &Toolpaths as OBJ") + dots, _L("Export toolpaths as OBJ"),
|
||||
[this](wxCommandEvent&) { if (m_plater) m_plater->export_toolpaths_to_obj(); }, "export_plater", nullptr,
|
||||
[this]() {return can_export_toolpaths(); }, this);
|
||||
export_menu->AppendSeparator();
|
||||
@ -1262,7 +1262,7 @@ void MainFrame::init_menubar_as_editor()
|
||||
[]() {return true; }, this);
|
||||
append_submenu(fileMenu, export_menu, wxID_ANY, _L("&Export"), "");
|
||||
|
||||
append_menu_item(fileMenu, wxID_ANY, _L("Ejec&t SD card / Flash drive") + dots + "\tCtrl+T", _L("Eject SD card / Flash drive after the G-code was exported to it."),
|
||||
append_menu_item(fileMenu, wxID_ANY, _L("Ejec&t SD Card / Flash Drive") + dots + "\tCtrl+T", _L("Eject SD card / Flash drive after the G-code was exported to it."),
|
||||
[this](wxCommandEvent&) { if (m_plater) m_plater->eject_drive(); }, "eject_sd", nullptr,
|
||||
[this]() {return can_eject(); }, this);
|
||||
|
||||
@ -1298,7 +1298,7 @@ void MainFrame::init_menubar_as_editor()
|
||||
[this](wxCommandEvent&) { repair_stl(); }, "wrench", nullptr,
|
||||
[]() { return true; }, this);
|
||||
fileMenu->AppendSeparator();
|
||||
append_menu_item(fileMenu, wxID_ANY, _L("&G-code preview") + dots, _L("Open G-code viewer"),
|
||||
append_menu_item(fileMenu, wxID_ANY, _L("&G-code Preview") + dots, _L("Open G-code viewer"),
|
||||
[this](wxCommandEvent&) { start_new_gcodeviewer_open_file(this); }, "", nullptr);
|
||||
fileMenu->AppendSeparator();
|
||||
append_menu_item(fileMenu, wxID_EXIT, _L("&Quit"), wxString::Format(_L("Quit %s"), SLIC3R_APP_NAME),
|
||||
@ -1316,17 +1316,17 @@ void MainFrame::init_menubar_as_editor()
|
||||
#else
|
||||
wxString hotkey_delete = "Del";
|
||||
#endif
|
||||
append_menu_item(editMenu, wxID_ANY, _L("&Select all") + sep + GUI::shortkey_ctrl_prefix() + sep_space + "A",
|
||||
append_menu_item(editMenu, wxID_ANY, _L("&Select All") + sep + GUI::shortkey_ctrl_prefix() + sep_space + "A",
|
||||
_L("Selects all objects"), [this](wxCommandEvent&) { m_plater->select_all(); },
|
||||
"", nullptr, [this](){return can_select(); }, this);
|
||||
append_menu_item(editMenu, wxID_ANY, _L("D&eselect all") + sep + "Esc",
|
||||
append_menu_item(editMenu, wxID_ANY, _L("D&eselect All") + sep + "Esc",
|
||||
_L("Deselects all objects"), [this](wxCommandEvent&) { m_plater->deselect_all(); },
|
||||
"", nullptr, [this](){return can_deselect(); }, this);
|
||||
editMenu->AppendSeparator();
|
||||
append_menu_item(editMenu, wxID_ANY, _L("&Delete selected") + sep + hotkey_delete,
|
||||
append_menu_item(editMenu, wxID_ANY, _L("&Delete Selected") + sep + hotkey_delete,
|
||||
_L("Deletes the current selection"),[this](wxCommandEvent&) { m_plater->remove_selected(); },
|
||||
"remove_menu", nullptr, [this](){return can_delete(); }, this);
|
||||
append_menu_item(editMenu, wxID_ANY, _L("Delete &all") + sep + GUI::shortkey_ctrl_prefix() + sep_space + hotkey_delete,
|
||||
append_menu_item(editMenu, wxID_ANY, _L("Delete &All") + sep + GUI::shortkey_ctrl_prefix() + sep_space + hotkey_delete,
|
||||
_L("Deletes all objects"), [this](wxCommandEvent&) { m_plater->reset_with_confirm(); },
|
||||
"delete_all_menu", nullptr, [this](){return can_delete_all(); }, this);
|
||||
|
||||
@ -1348,11 +1348,11 @@ void MainFrame::init_menubar_as_editor()
|
||||
|
||||
editMenu->AppendSeparator();
|
||||
#ifdef __APPLE__
|
||||
append_menu_item(editMenu, wxID_ANY, _L("Re&load from disk") + dots + "\tCtrl+Shift+R",
|
||||
append_menu_item(editMenu, wxID_ANY, _L("Re&load from Disk") + dots + "\tCtrl+Shift+R",
|
||||
_L("Reload the plater from disk"), [this](wxCommandEvent&) { m_plater->reload_all_from_disk(); },
|
||||
"", nullptr, [this]() {return !m_plater->model().objects.empty(); }, this);
|
||||
#else
|
||||
append_menu_item(editMenu, wxID_ANY, _L("Re&load from disk") + sep + "F5",
|
||||
append_menu_item(editMenu, wxID_ANY, _L("Re&load from Disk") + sep + "F5",
|
||||
_L("Reload the plater from disk"), [this](wxCommandEvent&) { m_plater->reload_all_from_disk(); },
|
||||
"", nullptr, [this]() {return !m_plater->model().objects.empty(); }, this);
|
||||
#endif // __APPLE__
|
||||
@ -1410,11 +1410,11 @@ void MainFrame::init_menubar_as_editor()
|
||||
[this](wxCommandEvent&) { m_printhost_queue_dlg->Show(); }, "upload_queue", nullptr, []() {return true; }, this);
|
||||
|
||||
windowMenu->AppendSeparator();
|
||||
append_menu_item(windowMenu, wxID_ANY, _L("Open new instance") + "\tCtrl+Shift+I", _L("Open a new PrusaSlicer instance"),
|
||||
append_menu_item(windowMenu, wxID_ANY, _L("Open New Instance") + "\tCtrl+Shift+I", _L("Open a new PrusaSlicer instance"),
|
||||
[](wxCommandEvent&) { start_new_slicer(); }, "", nullptr, [this]() {return m_plater != nullptr && wxGetApp().app_config->get("single_instance") != "1"; }, this);
|
||||
|
||||
windowMenu->AppendSeparator();
|
||||
append_menu_item(windowMenu, wxID_ANY, _L("Compare presets")/* + "\tCtrl+F"*/, _L("Compare presets"),
|
||||
append_menu_item(windowMenu, wxID_ANY, _L("Compare Presets")/* + "\tCtrl+F"*/, _L("Compare presets"),
|
||||
[this](wxCommandEvent&) { diff_dialog.show();}, "compare", nullptr, []() {return true; }, this);
|
||||
}
|
||||
|
||||
@ -1424,15 +1424,15 @@ void MainFrame::init_menubar_as_editor()
|
||||
viewMenu = new wxMenu();
|
||||
add_common_view_menu_items(viewMenu, this, std::bind(&MainFrame::can_change_view, this));
|
||||
viewMenu->AppendSeparator();
|
||||
append_menu_check_item(viewMenu, wxID_ANY, _L("Show &labels") + sep + "E", _L("Show object/instance labels in 3D scene"),
|
||||
append_menu_check_item(viewMenu, wxID_ANY, _L("Show &Labels") + sep + "E", _L("Show object/instance labels in 3D scene"),
|
||||
[this](wxCommandEvent&) { m_plater->show_view3D_labels(!m_plater->are_view3D_labels_shown()); }, this,
|
||||
[this]() { return m_plater->is_view3D_shown(); }, [this]() { return m_plater->are_view3D_labels_shown(); }, this);
|
||||
append_menu_check_item(viewMenu, wxID_ANY, _L("&Collapse sidebar") + sep + "Shift+" + sep_space + "Tab", _L("Collapse sidebar"),
|
||||
append_menu_check_item(viewMenu, wxID_ANY, _L("&Collapse Sidebar") + sep + "Shift+" + sep_space + "Tab", _L("Collapse sidebar"),
|
||||
[this](wxCommandEvent&) { m_plater->collapse_sidebar(!m_plater->is_sidebar_collapsed()); }, this,
|
||||
[]() { return true; }, [this]() { return m_plater->is_sidebar_collapsed(); }, this);
|
||||
#ifndef __APPLE__
|
||||
// OSX adds its own menu item to toggle fullscreen.
|
||||
append_menu_check_item(viewMenu, wxID_ANY, _L("&Full screen") + "\t" + "F11", _L("Full screen"),
|
||||
append_menu_check_item(viewMenu, wxID_ANY, _L("&Fullscreen") + "\t" + "F11", _L("Fullscreen"),
|
||||
[this](wxCommandEvent&) { this->ShowFullScreen(!this->IsFullScreen(),
|
||||
// wxFULLSCREEN_ALL: wxFULLSCREEN_NOMENUBAR | wxFULLSCREEN_NOTOOLBAR | wxFULLSCREEN_NOSTATUSBAR | wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION
|
||||
wxFULLSCREEN_NOSTATUSBAR | wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION); },
|
||||
@ -1519,16 +1519,16 @@ void MainFrame::init_menubar_as_gcodeviewer()
|
||||
[this](wxCommandEvent&) { if (m_plater != nullptr) m_plater->load_gcode(); }, "open", nullptr,
|
||||
[this]() {return m_plater != nullptr; }, this);
|
||||
#ifdef __APPLE__
|
||||
append_menu_item(fileMenu, wxID_ANY, _L("Re&load from disk") + dots + "\tCtrl+Shift+R",
|
||||
append_menu_item(fileMenu, wxID_ANY, _L("Re&load from Disk") + dots + "\tCtrl+Shift+R",
|
||||
_L("Reload the plater from disk"), [this](wxCommandEvent&) { m_plater->reload_gcode_from_disk(); },
|
||||
"", nullptr, [this]() { return !m_plater->get_last_loaded_gcode().empty(); }, this);
|
||||
#else
|
||||
append_menu_item(fileMenu, wxID_ANY, _L("Re&load from disk") + sep + "F5",
|
||||
append_menu_item(fileMenu, wxID_ANY, _L("Re&load from Disk") + sep + "F5",
|
||||
_L("Reload the plater from disk"), [this](wxCommandEvent&) { m_plater->reload_gcode_from_disk(); },
|
||||
"", nullptr, [this]() { return !m_plater->get_last_loaded_gcode().empty(); }, this);
|
||||
#endif // __APPLE__
|
||||
fileMenu->AppendSeparator();
|
||||
append_menu_item(fileMenu, wxID_ANY, _L("Export &toolpaths as OBJ") + dots, _L("Export toolpaths as OBJ"),
|
||||
append_menu_item(fileMenu, wxID_ANY, _L("Export &Toolpaths as OBJ") + dots, _L("Export toolpaths as OBJ"),
|
||||
[this](wxCommandEvent&) { if (m_plater != nullptr) m_plater->export_toolpaths_to_obj(); }, "export_plater", nullptr,
|
||||
[this]() {return can_export_toolpaths(); }, this);
|
||||
append_menu_item(fileMenu, wxID_ANY, _L("Open &PrusaSlicer") + dots, _L("Open PrusaSlicer"),
|
||||
|
@ -63,6 +63,15 @@ MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &he
|
||||
SetSizerAndFit(main_sizer);
|
||||
}
|
||||
|
||||
void MsgDialog::SetButtonLabel(wxWindowID btn_id, const wxString& label, bool set_focus/* = false*/)
|
||||
{
|
||||
if (wxButton* btn = get_button(btn_id)) {
|
||||
btn->SetLabel(label);
|
||||
if (set_focus)
|
||||
btn->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
wxButton* MsgDialog::add_button(wxWindowID btn_id, bool set_focus /*= false*/, const wxString& label/* = wxString()*/)
|
||||
{
|
||||
wxButton* btn = new wxButton(this, btn_id, label);
|
||||
@ -98,7 +107,7 @@ void MsgDialog::finalize()
|
||||
|
||||
|
||||
// Text shown as HTML, so that mouse selection and Ctrl-V to copy will work.
|
||||
static void add_msg_content(wxWindow* parent, wxBoxSizer* content_sizer, wxString msg, bool monospaced_font = false)
|
||||
static void add_msg_content(wxWindow* parent, wxBoxSizer* content_sizer, wxString msg, bool monospaced_font = false, bool is_marked_msg = false)
|
||||
{
|
||||
wxHtmlWindow* html = new wxHtmlWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO);
|
||||
|
||||
@ -136,8 +145,7 @@ static void add_msg_content(wxWindow* parent, wxBoxSizer* content_sizer, wxStrin
|
||||
int em = wxGetApp().em_unit();
|
||||
|
||||
// if message containes the table
|
||||
bool is_marked = msg.Contains("<tr>");
|
||||
if (is_marked) {
|
||||
if (msg.Contains("<tr>")) {
|
||||
int lines = msg.Freq('\n') + 1;
|
||||
int pos = 0;
|
||||
while (pos < (int)msg.Len() && pos != wxNOT_FOUND) {
|
||||
@ -155,7 +163,7 @@ static void add_msg_content(wxWindow* parent, wxBoxSizer* content_sizer, wxStrin
|
||||
}
|
||||
html->SetMinSize(page_size);
|
||||
|
||||
std::string msg_escaped = xml_escape(msg.ToUTF8().data(), is_marked);
|
||||
std::string msg_escaped = xml_escape(msg.ToUTF8().data(), is_marked_msg);
|
||||
boost::replace_all(msg_escaped, "\r\n", "<br>");
|
||||
boost::replace_all(msg_escaped, "\n", "<br>");
|
||||
if (monospaced_font)
|
||||
@ -243,11 +251,11 @@ int RichMessageDialog::ShowModal()
|
||||
|
||||
// InfoDialog
|
||||
|
||||
InfoDialog::InfoDialog(wxWindow* parent, const wxString &title, const wxString& msg)
|
||||
: MsgDialog(parent, wxString::Format(_L("%s information"), SLIC3R_APP_NAME), title, wxOK | wxICON_INFORMATION)
|
||||
InfoDialog::InfoDialog(wxWindow* parent, const wxString &title, const wxString& msg, bool is_marked_msg/* = false*/, long style/* = wxOK | wxICON_INFORMATION*/)
|
||||
: MsgDialog(parent, wxString::Format(_L("%s information"), SLIC3R_APP_NAME), title, style)
|
||||
, msg(msg)
|
||||
{
|
||||
add_msg_content(this, content_sizer, msg);
|
||||
add_msg_content(this, content_sizer, msg, false, is_marked_msg);
|
||||
finalize();
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ struct MsgDialog : wxDialog
|
||||
MsgDialog &operator=(const MsgDialog &) = delete;
|
||||
virtual ~MsgDialog() = default;
|
||||
|
||||
// TODO: refactor with CreateStdDialogButtonSizer usage
|
||||
void SetButtonLabel(wxWindowID btn_id, const wxString& label, bool set_focus = false);
|
||||
|
||||
protected:
|
||||
enum {
|
||||
@ -111,6 +111,7 @@ public:
|
||||
class MessageDialog : public MsgDialog
|
||||
{
|
||||
public:
|
||||
// NOTE! Don't change a signature of contsrucor. It have to be tha same as for wxMessageDialog
|
||||
MessageDialog( wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption = wxEmptyString,
|
||||
@ -130,6 +131,7 @@ class RichMessageDialog : public MsgDialog
|
||||
bool m_checkBoxValue{ false };
|
||||
|
||||
public:
|
||||
// NOTE! Don't change a signature of contsrucor. It have to be tha same as for wxRichMessageDialog
|
||||
RichMessageDialog( wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption = wxEmptyString,
|
||||
@ -293,7 +295,9 @@ public:
|
||||
const wxString& message,
|
||||
const wxString& caption = wxEmptyString,
|
||||
long style = wxOK)
|
||||
: wxRichMessageDialog(parent, message, caption, style) {}
|
||||
: wxRichMessageDialog(parent, message, caption, style) {
|
||||
this->SetEscapeId(wxID_CANCEL);
|
||||
}
|
||||
~RichMessageDialog() {}
|
||||
};
|
||||
#endif
|
||||
@ -302,7 +306,7 @@ public:
|
||||
class InfoDialog : public MsgDialog
|
||||
{
|
||||
public:
|
||||
InfoDialog(wxWindow *parent, const wxString &title, const wxString &msg);
|
||||
InfoDialog(wxWindow *parent, const wxString &title, const wxString &msg, bool is_marked = false, long style = wxOK| wxICON_INFORMATION);
|
||||
InfoDialog(InfoDialog&&) = delete;
|
||||
InfoDialog(const InfoDialog&) = delete;
|
||||
InfoDialog&operator=(InfoDialog&&) = delete;
|
||||
|
@ -984,6 +984,8 @@ bool OptionsGroup::launch_browser(const std::string& path_end)
|
||||
RichMessageDialog dialog(parent, _L("Open hyperlink in default browser?"), _L("PrusaSlicer: Open hyperlink"), wxYES_NO);
|
||||
dialog.ShowCheckBox(_L("Remember my choice"));
|
||||
int answer = dialog.ShowModal();
|
||||
if (answer == wxID_CANCEL)
|
||||
return false;
|
||||
|
||||
if (dialog.IsCheckBoxChecked()) {
|
||||
wxString preferences_item = _L("Suppress to open hyperlink in browser");
|
||||
|
@ -223,6 +223,9 @@ ObjectInfo::ObjectInfo(wxWindow *parent) :
|
||||
Add(sizer_manifold, 0, wxEXPAND | wxTOP, 4);
|
||||
|
||||
sla_hidden_items = { label_volume, info_volume, /*label_materials, info_materials*/ };
|
||||
|
||||
// Fixes layout issues on plater, short BitmapComboBoxes with some Windows scaling, see GH issue #7414.
|
||||
this->Show(false);
|
||||
}
|
||||
|
||||
void ObjectInfo::show_sizer(bool show)
|
||||
@ -3648,12 +3651,12 @@ void Plater::priv::reload_from_disk()
|
||||
if (has_source || has_name) {
|
||||
int new_volume_idx = -1;
|
||||
int new_object_idx = -1;
|
||||
if (has_source) {
|
||||
// take idxs from source
|
||||
new_volume_idx = old_volume->source.volume_idx;
|
||||
new_object_idx = old_volume->source.object_idx;
|
||||
}
|
||||
else {
|
||||
// if (has_source) {
|
||||
// // take idxs from source
|
||||
// new_volume_idx = old_volume->source.volume_idx;
|
||||
// new_object_idx = old_volume->source.object_idx;
|
||||
// }
|
||||
// else {
|
||||
// take idxs from the 1st matching volume
|
||||
for (size_t o = 0; o < new_model.objects.size(); ++o) {
|
||||
ModelObject* obj = new_model.objects[o];
|
||||
@ -3669,39 +3672,40 @@ void Plater::priv::reload_from_disk()
|
||||
if (found)
|
||||
break;
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
if (new_object_idx < 0 && (int)new_model.objects.size() <= new_object_idx) {
|
||||
if (new_object_idx < 0 || int(new_model.objects.size()) <= new_object_idx) {
|
||||
fail_list.push_back(from_u8(has_source ? old_volume->source.input_file : old_volume->name));
|
||||
continue;
|
||||
}
|
||||
ModelObject* new_model_object = new_model.objects[new_object_idx];
|
||||
if (new_volume_idx < 0 && (int)new_model.objects.size() <= new_volume_idx) {
|
||||
if (new_volume_idx < 0 || int(new_model_object->volumes.size()) <= new_volume_idx) {
|
||||
fail_list.push_back(from_u8(has_source ? old_volume->source.input_file : old_volume->name));
|
||||
continue;
|
||||
}
|
||||
if (new_volume_idx < (int)new_model_object->volumes.size()) {
|
||||
old_model_object->add_volume(*new_model_object->volumes[new_volume_idx]);
|
||||
ModelVolume* new_volume = old_model_object->volumes.back();
|
||||
new_volume->set_new_unique_id();
|
||||
new_volume->config.apply(old_volume->config);
|
||||
new_volume->set_type(old_volume->type());
|
||||
new_volume->set_material_id(old_volume->material_id());
|
||||
new_volume->set_transformation(old_volume->get_transformation());
|
||||
new_volume->translate(new_volume->get_transformation().get_matrix(true) * (new_volume->source.mesh_offset - old_volume->source.mesh_offset));
|
||||
assert(! old_volume->source.is_converted_from_inches || ! old_volume->source.is_converted_from_meters);
|
||||
if (old_volume->source.is_converted_from_inches)
|
||||
new_volume->convert_from_imperial_units();
|
||||
else if (old_volume->source.is_converted_from_meters)
|
||||
new_volume->convert_from_meters();
|
||||
std::swap(old_model_object->volumes[sel_v.volume_idx], old_model_object->volumes.back());
|
||||
old_model_object->delete_volume(old_model_object->volumes.size() - 1);
|
||||
if (!sinking)
|
||||
old_model_object->ensure_on_bed();
|
||||
old_model_object->sort_volumes(wxGetApp().app_config->get("order_volumes") == "1");
|
||||
|
||||
sla::reproject_points_and_holes(old_model_object);
|
||||
}
|
||||
old_model_object->add_volume(*new_model_object->volumes[new_volume_idx]);
|
||||
ModelVolume* new_volume = old_model_object->volumes.back();
|
||||
new_volume->set_new_unique_id();
|
||||
new_volume->config.apply(old_volume->config);
|
||||
new_volume->set_type(old_volume->type());
|
||||
new_volume->set_material_id(old_volume->material_id());
|
||||
new_volume->set_transformation(old_volume->get_transformation());
|
||||
new_volume->translate(new_volume->get_transformation().get_matrix(true) * (new_volume->source.mesh_offset - old_volume->source.mesh_offset));
|
||||
new_volume->source.object_idx = old_volume->source.object_idx;
|
||||
new_volume->source.volume_idx = old_volume->source.volume_idx;
|
||||
assert(! old_volume->source.is_converted_from_inches || ! old_volume->source.is_converted_from_meters);
|
||||
if (old_volume->source.is_converted_from_inches)
|
||||
new_volume->convert_from_imperial_units();
|
||||
else if (old_volume->source.is_converted_from_meters)
|
||||
new_volume->convert_from_meters();
|
||||
std::swap(old_model_object->volumes[sel_v.volume_idx], old_model_object->volumes.back());
|
||||
old_model_object->delete_volume(old_model_object->volumes.size() - 1);
|
||||
if (!sinking)
|
||||
old_model_object->ensure_on_bed();
|
||||
old_model_object->sort_volumes(wxGetApp().app_config->get("order_volumes") == "1");
|
||||
|
||||
sla::reproject_points_and_holes(old_model_object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ void PreferencesDialog::build(size_t selected_tab)
|
||||
|
||||
def.label = L("Sequential slider applied only to top layer");
|
||||
def.type = coBool;
|
||||
def.tooltip = L("If enabled, changes made using the sequential slider, in preview, apply only to gcode top layer."
|
||||
def.tooltip = L("If enabled, changes made using the sequential slider, in preview, apply only to gcode top layer. "
|
||||
"If disabled, changes made using the sequential slider, in preview, apply to the whole gcode.");
|
||||
def.set_default_value(new ConfigOptionBool{ app_config->get("seq_top_layer_only") == "1" });
|
||||
option = Option(def, "seq_top_layer_only");
|
||||
@ -485,7 +485,7 @@ void PreferencesDialog::build(size_t selected_tab)
|
||||
{
|
||||
def.label = L("Use system menu for application");
|
||||
def.type = coBool;
|
||||
def.tooltip = L("If enabled, application will use the standart Windows system menu,\n"
|
||||
def.tooltip = L("If enabled, application will use the standard Windows system menu,\n"
|
||||
"but on some combination of display scales it can looks ugly. If disabled, old UI will be used.");
|
||||
def.set_default_value(new ConfigOptionBool{ app_config->get("sys_menu_enabled") == "1" });
|
||||
option = Option(def, "sys_menu_enabled");
|
||||
|
@ -289,7 +289,9 @@ void Tab::create_preset_tab()
|
||||
// There is used just additional sizer for m_mode_sizer with right alignment
|
||||
if (m_mode_sizer) {
|
||||
auto mode_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
mode_sizer->Add(m_mode_sizer, 1, wxALIGN_RIGHT);
|
||||
// Don't set the 2nd parameter to 1, making the sizer rubbery scalable in Y axis may lead
|
||||
// to wrong vertical size assigned to wxBitmapComboBoxes, see GH issue #7176.
|
||||
mode_sizer->Add(m_mode_sizer, 0, wxALIGN_RIGHT);
|
||||
m_hsizer->Add(mode_sizer, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, wxOSX ? 15 : 10);
|
||||
}
|
||||
|
||||
|
@ -893,16 +893,12 @@ void UnsavedChangesDialog::build(Preset::Type type, PresetCollection* dependent_
|
||||
return;
|
||||
wxString preferences_item = m_app_config_key == "default_action_on_new_project" ? _L("Ask for unsaved changes when creating new project") :
|
||||
m_app_config_key == "default_action_on_select_preset" ? _L("Ask for unsaved changes when selecting new preset") :
|
||||
_L("Ask for unsaved changes when ??closing application??") ;
|
||||
_L("Ask to save unsaved changes when closing the application or when loading a new project") ;
|
||||
wxString action = m_app_config_key == "default_action_on_new_project" ? _L("You will not be asked about the unsaved changes the next time you create new project") :
|
||||
m_app_config_key == "default_action_on_select_preset" ? _L("You will not be asked about the unsaved changes the next time you switch a preset") :
|
||||
_L("You will not be asked about the unsaved changes the next time you: \n"
|
||||
"- close the application,\n"
|
||||
"- load project,\n"
|
||||
"- process Undo / Redo with a change of print technology,\n"
|
||||
"- take/load snapshot,\n"
|
||||
"- load config file/bundle,\n"
|
||||
"- export config_bundle") ;
|
||||
"- Closing PrusaSlicer while some presets are modified,\n"
|
||||
"- Loading a new project while some presets are modified") ;
|
||||
wxString msg = _L("PrusaSlicer will remember your action.") + "\n\n" + action + "\n\n" +
|
||||
format_wxstr(_L("Visit \"Preferences\" and check \"%1%\"\nto be asked about unsaved changes again."), preferences_item);
|
||||
|
||||
@ -1494,7 +1490,7 @@ DiffPresetDialog::DiffPresetDialog(MainFrame* mainframe)
|
||||
});
|
||||
}
|
||||
|
||||
m_show_all_presets = new wxCheckBox(this, wxID_ANY, _L("Show all preset (including incompatible)"));
|
||||
m_show_all_presets = new wxCheckBox(this, wxID_ANY, _L("Show all presets (including incompatible)"));
|
||||
m_show_all_presets->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent&) {
|
||||
bool show_all = m_show_all_presets->GetValue();
|
||||
for (auto preset_combos : m_preset_combos) {
|
||||
@ -1555,7 +1551,7 @@ void DiffPresetDialog::update_bundles_from_app()
|
||||
|
||||
void DiffPresetDialog::show(Preset::Type type /* = Preset::TYPE_INVALID*/)
|
||||
{
|
||||
this->SetTitle(type == Preset::TYPE_INVALID ? _L("Compare Presets") : format_wxstr(_L("Compare %1% Presets"), wxGetApp().get_tab(type)->name()));
|
||||
this->SetTitle(_L("Compare Presets"));
|
||||
m_view_type = type;
|
||||
|
||||
update_bundles_from_app();
|
||||
|
Loading…
Reference in New Issue
Block a user