Merge branch 'master' of https://github.com/prusa3d/Slic3r into opengl_to_cpp

This commit is contained in:
Enrico Turri 2018-05-14 10:02:28 +02:00
commit 32063cbe23
12 changed files with 115 additions and 55 deletions

View File

@ -225,7 +225,13 @@ sub new {
$self->{btoolbar}->Add($self->{"btn_layer_editing"});
}
$self->{list} = Wx::ListView->new($self, -1, wxDefaultPosition, wxDefaultSize,
### Scrolled Window for info boxes
my $scrolled_window_sizer = Wx::BoxSizer->new(wxVERTICAL);
my $scrolled_window_panel = Wx::ScrolledWindow->new($self, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
$scrolled_window_panel->SetSizer($scrolled_window_sizer);
$scrolled_window_panel->SetScrollbars(1, 1, 1, 1);
$self->{list} = Wx::ListView->new($scrolled_window_panel, -1, wxDefaultPosition, wxDefaultSize,
wxLC_SINGLE_SEL | wxLC_REPORT | wxBORDER_SUNKEN | wxTAB_TRAVERSAL | wxWANTS_CHARS );
$self->{list}->InsertColumn(0, L("Name"), wxLIST_FORMAT_LEFT, 145);
$self->{list}->InsertColumn(1, L("Copies"), wxLIST_FORMAT_CENTER, 45);
@ -408,9 +414,9 @@ sub new {
my $object_info_sizer;
{
my $box = Wx::StaticBox->new($self, -1, L("Info"));
my $box = Wx::StaticBox->new($scrolled_window_panel, -1, L("Info"));
$object_info_sizer = Wx::StaticBoxSizer->new($box, wxVERTICAL);
$object_info_sizer->SetMinSize([350,-1]);
$object_info_sizer->SetMinSize([300,-1]);
my $grid_sizer = Wx::FlexGridSizer->new(3, 4, 5, 5);
$grid_sizer->SetFlexibleDirection(wxHORIZONTAL);
$grid_sizer->AddGrowableCol(1, 1);
@ -426,14 +432,14 @@ sub new {
);
while (my $field = shift @info) {
my $label = shift @info;
my $text = Wx::StaticText->new($self, -1, "$label:", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
my $text = Wx::StaticText->new($scrolled_window_panel, -1, "$label:", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
$text->SetFont($Slic3r::GUI::small_font);
$grid_sizer->Add($text, 0);
$self->{"object_info_$field"} = Wx::StaticText->new($self, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
$self->{"object_info_$field"} = Wx::StaticText->new($scrolled_window_panel, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
$self->{"object_info_$field"}->SetFont($Slic3r::GUI::small_font);
if ($field eq 'manifold') {
$self->{object_info_manifold_warning_icon} = Wx::StaticBitmap->new($self, -1, Wx::Bitmap->new(Slic3r::var("error.png"), wxBITMAP_TYPE_PNG));
$self->{object_info_manifold_warning_icon} = Wx::StaticBitmap->new($scrolled_window_panel, -1, Wx::Bitmap->new(Slic3r::var("error.png"), wxBITMAP_TYPE_PNG));
$self->{object_info_manifold_warning_icon}->Hide;
my $h_sizer = Wx::BoxSizer->new(wxHORIZONTAL);
@ -448,9 +454,9 @@ sub new {
my $print_info_sizer;
{
my $box = Wx::StaticBox->new($self, -1, L("Sliced Info"));
my $box = Wx::StaticBox->new($scrolled_window_panel, -1, L("Sliced Info"));
$print_info_sizer = Wx::StaticBoxSizer->new($box, wxVERTICAL);
$print_info_sizer->SetMinSize([350,-1]);
$print_info_sizer->SetMinSize([300,-1]);
my $grid_sizer = Wx::FlexGridSizer->new(2, 2, 5, 5);
$grid_sizer->SetFlexibleDirection(wxHORIZONTAL);
$grid_sizer->AddGrowableCol(1, 1);
@ -465,11 +471,11 @@ sub new {
);
while (my $field = shift @info) {
my $label = shift @info;
my $text = Wx::StaticText->new($self, -1, "$label:", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
my $text = Wx::StaticText->new($scrolled_window_panel, -1, "$label:", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
$text->SetFont($Slic3r::GUI::small_font);
$grid_sizer->Add($text, 0);
$self->{"print_info_$field"} = Wx::StaticText->new($self, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
$self->{"print_info_$field"} = Wx::StaticText->new($scrolled_window_panel, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
$self->{"print_info_$field"}->SetFont($Slic3r::GUI::small_font);
$grid_sizer->Add($self->{"print_info_$field"}, 0);
}
@ -484,18 +490,24 @@ sub new {
$buttons_sizer->Add($self->{btn_send_gcode}, 0, wxALIGN_RIGHT, 0);
$buttons_sizer->Add($self->{btn_export_gcode}, 0, wxALIGN_RIGHT, 0);
$scrolled_window_sizer->Add($self->{list}, 1, wxEXPAND, 5);
$scrolled_window_sizer->Add($object_info_sizer, 0, wxEXPAND, 0);
$scrolled_window_sizer->Add($print_info_sizer, 0, wxEXPAND, 0);
my $right_sizer = Wx::BoxSizer->new(wxVERTICAL);
$right_sizer->Add($presets, 0, wxEXPAND | wxTOP, 10) if defined $presets;
$right_sizer->Add($frequently_changed_parameters_sizer, 0, wxEXPAND | wxTOP, 0) if defined $frequently_changed_parameters_sizer;
$right_sizer->Add($buttons_sizer, 0, wxEXPAND | wxBOTTOM, 5);
$right_sizer->Add($self->{list}, 1, wxEXPAND, 5);
$right_sizer->Add($object_info_sizer, 0, wxEXPAND, 0);
$right_sizer->Add($print_info_sizer, 0, wxEXPAND, 0);
$right_sizer->Add($scrolled_window_panel, 1, wxEXPAND | wxALL, 1);
# Callback for showing / hiding the print info box.
$self->{"print_info_box_show"} = sub {
if ($right_sizer->IsShown(5) != $_[0]) {
$right_sizer->Show(5, $_[0]);
$self->Layout
# if ($right_sizer->IsShown(5) != $_[0]) {
# $right_sizer->Show(5, $_[0]);
# $self->Layout
# }
if ($scrolled_window_sizer->IsShown(2) != $_[0]) {
$scrolled_window_sizer->Show(2, $_[0]);
$scrolled_window_panel->Layout
}
};
# Show the box initially, let it be shown after the slicing is finished.
@ -700,7 +712,7 @@ sub load_files {
. "Instead of considering them as multiple objects, should I consider\n"
. "this file as a single object having multiple parts?\n"),
L('Multi-part object detected'), wxICON_WARNING | wxYES | wxNO);
$model->convert_multipart_object if $dialog->ShowModal(scalar(@$nozzle_dmrs)) == wxID_YES;
$model->convert_multipart_object(scalar(@$nozzle_dmrs)) if $dialog->ShowModal() == wxID_YES;
}
if ($one_by_one) {
@ -717,7 +729,7 @@ sub load_files {
. "Instead of considering them as multiple objects, should I consider\n"
. "these files to represent a single object having multiple parts?\n"),
L('Multi-part object detected'), wxICON_WARNING | wxYES | wxNO);
$new_model->convert_multipart_object if $dialog->ShowModal(scalar(@$nozzle_dmrs)) == wxID_YES;
$new_model->convert_multipart_object(scalar(@$nozzle_dmrs)) if $dialog->ShowModal() == wxID_YES;
push @obj_idx, $self->load_model_objects(@{$new_model->objects});
}

View File

@ -32,7 +32,7 @@ sub new {
$self->{on_instances_moved} = sub {};
$self->{on_wipe_tower_moved} = sub {};
$self->{objects_volumes_idxs} = ();
$self->{objects_volumes_idxs} = [];
$self->on_select(sub {
my ($volume_idx) = @_;
@ -188,8 +188,8 @@ sub update_volumes_selection {
foreach my $obj_idx (0..$#{$self->{model}->objects}) {
if ($self->{objects}[$obj_idx]->selected) {
my @volume_idxs = @{$self->{objects_volumes_idxs}[$obj_idx]};
$self->select_volume($_) for @volume_idxs;
my $volume_idxs = $self->{objects_volumes_idxs}->[$obj_idx];
$self->select_volume($_) for @{$volume_idxs};
}
}
}
@ -207,7 +207,7 @@ sub reload_scene {
$self->{reload_delayed} = 0;
$self->{objects_volumes_idxs} = ();
$self->{objects_volumes_idxs} = [];
foreach my $obj_idx (0..$#{$self->{model}->objects}) {
my @volume_idxs = $self->load_object($self->{model}, $self->{print}, $obj_idx);
push(@{$self->{objects_volumes_idxs}}, \@volume_idxs);

View File

@ -58,6 +58,13 @@ sub new {
[40,-1], wxALIGN_CENTRE_HORIZONTAL);
$z_label_high->SetFont($Slic3r::GUI::small_font);
my $z_label_low_idx = $self->{z_label_low_idx} = Wx::StaticText->new($self, -1, "", wxDefaultPosition,
[40,-1], wxALIGN_CENTRE_HORIZONTAL);
$z_label_low_idx->SetFont($Slic3r::GUI::small_font);
my $z_label_high_idx = $self->{z_label_high_idx} = Wx::StaticText->new($self, -1, "", wxDefaultPosition,
[40,-1], wxALIGN_CENTRE_HORIZONTAL);
$z_label_high_idx->SetFont($Slic3r::GUI::small_font);
$self->single_layer(0);
my $checkbox_singlelayer = $self->{checkbox_singlelayer} = Wx::CheckBox->new($self, -1, L("1 Layer"));
@ -103,11 +110,13 @@ sub new {
my $hsizer = Wx::BoxSizer->new(wxHORIZONTAL);
my $vsizer = Wx::BoxSizer->new(wxVERTICAL);
my $vsizer_outer = Wx::BoxSizer->new(wxVERTICAL);
$vsizer->Add($slider_low, 3, 0, 0);
$vsizer->Add($z_label_low, 0, 0, 0);
$vsizer->Add($slider_low, 3, wxALIGN_CENTER_HORIZONTAL, 0);
$vsizer->Add($z_label_low_idx, 0, wxALIGN_CENTER_HORIZONTAL, 0);
$vsizer->Add($z_label_low, 0, wxALIGN_CENTER_HORIZONTAL, 0);
$hsizer->Add($vsizer, 0, wxEXPAND, 0);
$vsizer = Wx::BoxSizer->new(wxVERTICAL);
$vsizer->Add($slider_high, 3, 0, 0);
$vsizer->Add($slider_high, 3, wxALIGN_CENTER_HORIZONTAL, 0);
$vsizer->Add($z_label_high_idx, 0, wxALIGN_CENTER_HORIZONTAL, 0);
$vsizer->Add($z_label_high, 0, 0, 0);
$hsizer->Add($vsizer, 0, wxEXPAND, 0);
$vsizer_outer->Add($hsizer, 3, wxALIGN_CENTER_HORIZONTAL, 0);
@ -325,6 +334,8 @@ sub load_print {
$self->slider_high->Hide;
$self->{z_label_low}->SetLabel("");
$self->{z_label_high}->SetLabel("");
$self->{z_label_low_idx}->SetLabel("");
$self->{z_label_high_idx}->SetLabel("");
$self->canvas->reset_legend_texture();
$self->canvas->Refresh; # clears canvas
return;
@ -427,6 +438,10 @@ sub set_z_range
return if !$self->enabled;
$self->{z_label_low}->SetLabel(sprintf '%.2f', $z_low);
$self->{z_label_high}->SetLabel(sprintf '%.2f', $z_high);
my $z_idx_low = 1 + $self->slider_low->GetValue;
my $z_idx_high = 1 + $self->slider_high->GetValue;
$self->{z_label_low_idx}->SetLabel(sprintf '%d', $z_idx_low);
$self->{z_label_high_idx}->SetLabel(sprintf '%d', $z_idx_high);
$self->canvas->set_toolpaths_range($z_low - 1e-6, $z_high + 1e-6);
$self->canvas->Refresh if $self->IsShown;
}

View File

@ -1 +1,3 @@
0.1.2 Wipe tower changes
0.1.1 Minor print speed adjustments
0.1.0 Initial

View File

@ -5,7 +5,7 @@
name = Prusa Research
# Configuration version of this file. Config file will only be installed, if the config_version differs.
# This means, the server may force the Slic3r configuration to be downgraded.
config_version = 0.1.0
config_version = 0.1.2
# Where to get the updates from?
config_update_url = https://raw.githubusercontent.com/prusa3d/Slic3r-settings/master/live/PrusaResearch/
@ -90,7 +90,7 @@ seam_position = nearest
skirts = 1
skirt_distance = 2
skirt_height = 3
small_perimeter_speed = 20
small_perimeter_speed = 25
solid_infill_below_area = 0
solid_infill_every_layers = 0
solid_infill_extruder = 1
@ -121,7 +121,8 @@ top_infill_extrusion_width = 0.45
top_solid_infill_speed = 40
travel_speed = 180
wipe_tower = 1
wipe_tower_per_color_wipe = 20
wipe_tower_bridging = 10
wipe_tower_rotation_angle = 0
wipe_tower_width = 60
wipe_tower_x = 180
wipe_tower_y = 140
@ -179,7 +180,7 @@ gap_fill_speed = 20
infill_acceleration = 800
infill_speed = 30
max_print_speed = 80
small_perimeter_speed = 15
small_perimeter_speed = 20
solid_infill_speed = 30
support_material_extrusion_width = 0.3
support_material_spacing = 1.5
@ -214,7 +215,7 @@ infill_speed = 20
max_print_speed = 100
perimeter_extrusion_width = 0
perimeter_speed = 20
small_perimeter_speed = 10
small_perimeter_speed = 15
solid_infill_extrusion_width = 0
solid_infill_speed = 20
support_material_speed = 20
@ -267,7 +268,7 @@ infill_acceleration = 1600
infill_speed = 40
perimeter_acceleration = 600
perimeter_speed = 25
small_perimeter_speed = 10
small_perimeter_speed = 15
solid_infill_speed = 40
top_solid_infill_speed = 30
@ -340,7 +341,7 @@ infill_acceleration = 1600
infill_speed = 40
perimeter_acceleration = 600
perimeter_speed = 25
small_perimeter_speed = 10
small_perimeter_speed = 15
solid_infill_speed = 40
support_material_extrusion_width = 0.2
top_solid_infill_speed = 30
@ -538,13 +539,17 @@ compatible_printers =
compatible_printers_condition =
end_filament_gcode = "; Filament-specific end gcode"
extrusion_multiplier = 1
filament_loading_speed = 28
filament_unloading_speed = 90
filament_toolchange_delay = 0
filament_ramming_parameters = "120 100 6.6 6.8 7.2 7.6 7.9 8.2 8.7 9.4 9.9 10.0| 0.05 6.6 0.45 6.8 0.95 7.8 1.45 8.3 1.95 9.7 2.45 10 2.95 7.6 3.45 7.6 3.95 7.6 4.45 7.6 4.95 7.6"
filament_cost = 0
filament_density = 0
filament_diameter = 1.75
filament_notes = ""
filament_settings_id =
filament_soluble = 0
min_print_speed = 5
min_print_speed = 15
slowdown_below_layer_time = 20
start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{else}30{endif}; Filament gcode"
@ -591,6 +596,7 @@ fan_always_on = 0
fan_below_layer_time = 20
filament_colour = #3A80CA
filament_max_volumetric_speed = 11
filament_ramming_parameters = "120 100 5.70968 6.03226 7 8.25806 9 9.19355 9.3871 9.77419 10.129 10.3226 10.4516 10.5161| 0.05 5.69677 0.45 6.15484 0.95 8.76774 1.45 9.20323 1.95 9.95806 2.45 10.3871 2.95 10.5677 3.45 7.6 3.95 7.6 4.45 7.6 4.95 7.6"
filament_type = ABS
first_layer_bed_temperature = 100
first_layer_temperature = 255
@ -637,7 +643,6 @@ first_layer_bed_temperature = 105
first_layer_temperature = 270
max_fan_speed = 20
min_fan_speed = 10
min_print_speed = 5
start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{else}45{endif}; Filament gcode"
temperature = 270
@ -651,7 +656,6 @@ extrusion_multiplier = 1.2
filament_colour = #804040
filament_max_volumetric_speed = 10
first_layer_temperature = 200
min_print_speed = 5
start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{else}10{endif}; Filament gcode"
temperature = 200
@ -763,6 +767,7 @@ fan_always_on = 0
filament_colour = #FFFFD7
filament_max_volumetric_speed = 10
filament_notes = "List of materials tested with standart PVA print settings for MK2:\n\nPrimaSelect PVA+\nICE FILAMENTS PVA 'NAUGHTY NATURAL'\nVerbatim BVOH"
filament_ramming_parameters = "120 100 8.3871 8.6129 8.93548 9.22581 9.48387 9.70968 9.87097 10.0323 10.2258 10.4194 10.6452 10.8065| 0.05 8.34193 0.45 8.73548 0.95 9.34836 1.45 9.78385 1.95 10.0871 2.45 10.5161 2.95 10.8903 3.45 7.6 3.95 7.6 4.45 7.6 4.95 7.6"
filament_soluble = 1
filament_type = PVA
first_layer_temperature = 195
@ -816,7 +821,6 @@ first_layer_bed_temperature = 60
first_layer_temperature = 240
max_fan_speed = 5
min_fan_speed = 0
min_print_speed = 5
start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{else}10{endif}; Filament gcode"
temperature = 250
@ -849,7 +853,6 @@ first_layer_bed_temperature = 60
first_layer_temperature = 215
max_fan_speed = 100
min_fan_speed = 100
min_print_speed = 15
start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{else}10{endif}; Filament gcode"
temperature = 210
@ -870,7 +873,6 @@ first_layer_bed_temperature = 100
first_layer_temperature = 220
max_fan_speed = 100
min_fan_speed = 100
min_print_speed = 15
start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{else}10{endif}; Filament gcode"
temperature = 220
@ -931,6 +933,9 @@ retract_lift_below = 199
retract_restart_extra = 0
retract_restart_extra_toolchange = 0
retract_speed = 80
parking_pos_retraction = 92
cooling_tube_length = 5
cooling_tube_retraction = 91.5
single_extruder_multi_material = 1
printer_model = MK2SMM

View File

@ -275,7 +275,7 @@ bool GCodePreviewData::empty() const
return extrusion.layers.empty() && travel.polylines.empty() && retraction.positions.empty() && unretraction.positions.empty();
}
const GCodePreviewData::Color& GCodePreviewData::get_extrusion_role_color(ExtrusionRole role) const
GCodePreviewData::Color GCodePreviewData::get_extrusion_role_color(ExtrusionRole role) const
{
return extrusion.role_colors[role];
}

View File

@ -187,7 +187,7 @@ public:
void reset();
bool empty() const;
const Color& get_extrusion_role_color(ExtrusionRole role) const;
Color get_extrusion_role_color(ExtrusionRole role) const;
Color get_height_color(float height) const;
Color get_width_color(float width) const;
Color get_feedrate_color(float feedrate) const;

View File

@ -111,6 +111,7 @@ PrintConfigDef::PrintConfigDef()
"with cooling (use a fan) before tweaking this.");
def->cli = "bridge-flow-ratio=f";
def->min = 0;
def->max = 2;
def->default_value = new ConfigOptionFloat(1);
def = this->add("bridge_speed", coFloat);

View File

@ -14,7 +14,7 @@
#include <boost/thread.hpp>
#define SLIC3R_FORK_NAME "Slic3r Prusa Edition"
#define SLIC3R_VERSION "1.40.0"
#define SLIC3R_VERSION "1.40.0-alpha"
#define SLIC3R_BUILD "UNKNOWN"
typedef int32_t coord_t;

View File

@ -2313,7 +2313,7 @@ void _3DScene::_load_gcode_extrusion_paths(const GCodePreviewData& preview_data,
return 0.0f;
}
static const GCodePreviewData::Color& path_color(const GCodePreviewData& data, const std::vector<float>& tool_colors, float value)
static GCodePreviewData::Color path_color(const GCodePreviewData& data, const std::vector<float>& tool_colors, float value)
{
switch (data.extrusion.view_type)
{
@ -2329,7 +2329,7 @@ void _3DScene::_load_gcode_extrusion_paths(const GCodePreviewData& preview_data,
return data.get_volumetric_rate_color(value);
case GCodePreviewData::Extrusion::Tool:
{
static GCodePreviewData::Color color;
GCodePreviewData::Color color;
::memcpy((void*)color.rgba, (const void*)(tool_colors.data() + (unsigned int)value * 4), 4 * sizeof(float));
return color;
}
@ -2366,7 +2366,6 @@ void _3DScene::_load_gcode_extrusion_paths(const GCodePreviewData& preview_data,
};
typedef std::vector<Filter> FiltersList;
size_t initial_volumes_count = volumes.volumes.size();
// detects filters
@ -2390,7 +2389,6 @@ void _3DScene::_load_gcode_extrusion_paths(const GCodePreviewData& preview_data,
for (Filter& filter : filters)
{
s_gcode_preview_volume_index.first_volumes.emplace_back(GCodePreviewVolumeIndex::Extrusion, (unsigned int)filter.role, (unsigned int)volumes.volumes.size());
GLVolume* volume = new GLVolume(Helper::path_color(preview_data, tool_colors, filter.value).rgba);
if (volume != nullptr)
{

View File

@ -82,10 +82,8 @@ namespace Slic3r { namespace GUI {
return std::regex_match(string, regex_pattern);
}
// boost::any Field::get_value_by_opt_type(wxString& str)
void Field::get_value_by_opt_type(wxString& str)
{
// boost::any m_value;
switch (m_opt.type){
case coInt:
m_value = wxAtoi(str);
@ -96,8 +94,25 @@ namespace Slic3r { namespace GUI {
case coFloat:{
if (m_opt.type == coPercent && str.Last() == '%')
str.RemoveLast();
else if (str.Last() == '%') {
wxString label = m_Label->GetLabel();
if (label.Last() == '\n') label.RemoveLast();
while (label.Last() == ' ') label.RemoveLast();
if (label.Last() == ':') label.RemoveLast();
show_error(m_parent, wxString::Format(_(L("%s doesn't support percentage")), label));
set_value(double_to_string(m_opt.min), true);
m_value = double(m_opt.min);
break;
}
double val;
str.ToCDouble(&val);
if (m_opt.min > val && val > m_opt.max)
{
show_error(m_parent, _(L("Input value is out of range")));
if (m_opt.min > val) val = m_opt.min;
if (val > m_opt.max) val = m_opt.max;
set_value(double_to_string(val), true);
}
m_value = val;
break; }
case coString:
@ -108,8 +123,6 @@ namespace Slic3r { namespace GUI {
default:
break;
}
// return m_value;
}
void TextCtrl::BUILD() {
@ -170,17 +183,32 @@ namespace Slic3r { namespace GUI {
//! to allow the default handling
event.Skip();
//! eliminating the g-code pop up text description
temp->GetToolTip()->Enable(false);
bool flag = false;
#ifdef __WXGTK__
// I have no idea why, but on GTK flag works in other way
flag = true;
#endif // __WXGTK__
temp->GetToolTip()->Enable(flag);
}), temp->GetId());
#if !defined(__WXGTK__)
temp->Bind(wxEVT_KILL_FOCUS, ([this, temp](wxEvent& e)
{
e.Skip();// on_kill_focus(e);
temp->GetToolTip()->Enable(true);
}), temp->GetId());
#endif // __WXGTK__
temp->Bind(wxEVT_TEXT, ([this](wxCommandEvent) { on_change_field(); }), temp->GetId());
// select all text using Ctrl+A
temp->Bind(wxEVT_CHAR, ([temp](wxKeyEvent& event)
{
if (wxGetKeyState(wxKeyCode('A')) && wxGetKeyState(WXK_CONTROL))
temp->SetSelection(-1, -1); //select all
event.Skip();
}));
// recast as a wxWindow to fit the calling convention
window = dynamic_cast<wxWindow*>(temp);
}
@ -188,9 +216,9 @@ namespace Slic3r { namespace GUI {
boost::any& TextCtrl::get_value()
{
wxString ret_str = static_cast<wxTextCtrl*>(window)->GetValue();
/*boost::any ret_val*/get_value_by_opt_type(ret_str);
get_value_by_opt_type(ret_str);
return m_value;//ret_val;
return m_value;
}
void TextCtrl::enable() { dynamic_cast<wxTextCtrl*>(window)->Enable(); dynamic_cast<wxTextCtrl*>(window)->SetEditable(true); }

View File

@ -124,7 +124,6 @@ public:
virtual wxWindow* getWindow() { return nullptr; }
bool is_matched(const std::string& string, const std::string& pattern);
// boost::any get_value_by_opt_type(wxString& str);
void get_value_by_opt_type(wxString& str);
/// Factory method for generating new derived classes.