From 1869b0657df161bb22410219bbda3da5aa55494b Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 3 Apr 2018 22:56:49 -0500 Subject: [PATCH 001/112] Propagate invalidation results from dependent invalidations. Mostly Fixes #4364 --- xs/src/libslic3r/Print.cpp | 2 +- xs/src/libslic3r/PrintObject.cpp | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp index c1fe435a8..d413806f9 100644 --- a/xs/src/libslic3r/Print.cpp +++ b/xs/src/libslic3r/Print.cpp @@ -288,7 +288,7 @@ Print::invalidate_step(PrintStep step) // propagate to dependent steps if (step == psSkirt) { - this->invalidate_step(psBrim); + invalidated |= this->invalidate_step(psBrim); } return invalidated; diff --git a/xs/src/libslic3r/PrintObject.cpp b/xs/src/libslic3r/PrintObject.cpp index 8c8e76b09..9f93a1da1 100644 --- a/xs/src/libslic3r/PrintObject.cpp +++ b/xs/src/libslic3r/PrintObject.cpp @@ -288,25 +288,25 @@ PrintObject::invalidate_step(PrintObjectStep step) // propagate to dependent steps if (step == posPerimeters) { - this->invalidate_step(posPrepareInfill); - this->_print->invalidate_step(psSkirt); - this->_print->invalidate_step(psBrim); + invalidated |= this->invalidate_step(posPrepareInfill); + invalidated |= this->_print->invalidate_step(psSkirt); + invalidated |= this->_print->invalidate_step(psBrim); } else if (step == posDetectSurfaces) { - this->invalidate_step(posPrepareInfill); + invalidated |= this->invalidate_step(posPrepareInfill); } else if (step == posPrepareInfill) { - this->invalidate_step(posInfill); + invalidated |= this->invalidate_step(posInfill); } else if (step == posInfill) { - this->_print->invalidate_step(psSkirt); - this->_print->invalidate_step(psBrim); + invalidated |= this->_print->invalidate_step(psSkirt); + invalidated |= this->_print->invalidate_step(psBrim); } else if (step == posSlice) { - this->invalidate_step(posPerimeters); - this->invalidate_step(posDetectSurfaces); - this->invalidate_step(posSupportMaterial); + invalidated |= this->invalidate_step(posPerimeters); + invalidated |= this->invalidate_step(posDetectSurfaces); + invalidated |= this->invalidate_step(posSupportMaterial); }else if (step == posLayers) { - this->invalidate_step(posSlice); + invalidated |= this->invalidate_step(posSlice); } else if (step == posSupportMaterial) { - this->_print->invalidate_step(psSkirt); - this->_print->invalidate_step(psBrim); + invalidated |= this->_print->invalidate_step(psSkirt); + invalidated |= this->_print->invalidate_step(psBrim); } return invalidated; From 7b8369d00e775a8225cc9f426f7f47613565c2fd Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 3 Apr 2018 23:04:44 -0500 Subject: [PATCH 002/112] Adding a simple test to show that changing the skirt count invalidates the skirt step. --- xs/t/20_print.t | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/xs/t/20_print.t b/xs/t/20_print.t index e535cdd8c..22f14112d 100644 --- a/xs/t/20_print.t +++ b/xs/t/20_print.t @@ -4,15 +4,30 @@ use strict; use warnings; use Slic3r::XS; -use Test::More tests => 5; +use Test::More tests => 6; { - my $print = Slic3r::Print->new; - isa_ok $print, 'Slic3r::Print'; - isa_ok $print->config, 'Slic3r::Config::Static::Ref'; - isa_ok $print->default_object_config, 'Slic3r::Config::Static::Ref'; - isa_ok $print->default_region_config, 'Slic3r::Config::Static::Ref'; - isa_ok $print->placeholder_parser, 'Slic3r::GCode::PlaceholderParser::Ref'; + { + my $print = Slic3r::Print->new; + isa_ok $print, 'Slic3r::Print'; + isa_ok $print->config, 'Slic3r::Config::Static::Ref'; + isa_ok $print->default_object_config, 'Slic3r::Config::Static::Ref'; + isa_ok $print->default_region_config, 'Slic3r::Config::Static::Ref'; + isa_ok $print->placeholder_parser, 'Slic3r::GCode::PlaceholderParser::Ref'; + } + + { + my $print = Slic3r::Print->new; + my $config = Slic3r::Config->new; + $config->set('skirts', 0); + $print->apply_config($config); + $config->set('skirts', 1); + $print->set_step_started(Slic3r::Print::State::STEP_SKIRT); + $print->set_step_done(Slic3r::Print::State::STEP_SKIRT); + my $invalid = $print->apply_config($config); + ok $invalid, 'applying skirt config invalidates skirt step'; + } + } __END__ From 331764431e1704861a5cbe51ee3bc7fa4eaec5b7 Mon Sep 17 00:00:00 2001 From: Benjamin Landers Date: Wed, 4 Apr 2018 20:39:37 -0700 Subject: [PATCH 003/112] Makes post process scripts able to pass args along with filename (#4363) Any whitespace is the boundrary between the args/filename. Whitespace can be escaped by putting a exxclamation point in front of it. And exclamation points can be escaped by putting an exclamation point in front of the exclamation point to be escaped. I thought about adding another box for arguments, but I think that would make it more confusing to use. The only worry I have with this method is peoples existing scripts with whitespace in the name. --- lib/Slic3r/Print.pm | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 586bd8a8d..23799e8be 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -71,6 +71,34 @@ sub process { } } +sub escaped_split { + my ($line) = @_; + + # Free up three characters for temporary replacement + $line =~ s/%/%%/g; + $line =~ s/#/##/g; + $line =~ s/\?/\?\?/g; + + # replace escaped !'s + $line =~ s/\!\!/%#\?/g; + + # split on non-escaped whitespace + my @split = split /(?<=[^\!])\s+/, $line, -1; + + for my $part (@split) { + # replace escaped whitespace with the whitespace + $part =~ s/\!(\s+)/$1/g; + + # resub temp symbols + $part =~ s/%#\?/\!/g; + $part =~ s/%%/%/g; + $part =~ s/##/#/g; + $part =~ s/\?\?/\?/g; + } + + return @split; +} + sub export_gcode { my $self = shift; my %params = @_; @@ -121,11 +149,14 @@ sub export_gcode { $self->config->setenv; for my $script (@{$self->config->post_process}) { Slic3r::debugf " '%s' '%s'\n", $script, $output_file; + my @parsed_script = escaped_split $script; + my $executable = shift @parsed_script ; + push @parsed_script, $output_file; # -x doesn't return true on Windows except for .exe files - if (($^O eq 'MSWin32') ? !(-e $script) : !(-x $script)) { - die "The configured post-processing script is not executable: check permissions. ($script)\n"; + if (($^O eq 'MSWin32') ? !(-e $executable) : !(-x $executable)) { + die "The configured post-processing script is not executable: check permissions or escape whitespace/exclamation points. ($executable) \n"; } - system($script, $output_file); + system($executable, @parsed_script); } } } From 6454abfd5fbeb7140edcadee6a4b358e93fba35b Mon Sep 17 00:00:00 2001 From: DN Date: Wed, 4 Apr 2018 21:43:58 -0600 Subject: [PATCH 004/112] Raft pattern angles (#3001) (#4334) Fixes #3001 --- lib/Slic3r/Print/SupportMaterial.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r/Print/SupportMaterial.pm b/lib/Slic3r/Print/SupportMaterial.pm index d3be45394..202d010e1 100644 --- a/lib/Slic3r/Print/SupportMaterial.pm +++ b/lib/Slic3r/Print/SupportMaterial.pm @@ -753,7 +753,9 @@ sub generate_toolpaths { # interface and contact infill if (@$interface || @$contact_infill) { - $fillers{interface}->set_angle(deg2rad($interface_angle)); + # make interface layers alternate angles by 90 degrees + my $alternate_angle = $interface_angle + (90 * (($layer_id + 1) % 2)); + $fillers{interface}->set_angle(deg2rad($alternate_angle)); $fillers{interface}->set_min_spacing($_interface_flow->spacing); # find centerline of the external loop From c3cb01eb93dd9b078b627acbc77acf526efb4637 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 10 Apr 2018 17:58:33 -0500 Subject: [PATCH 005/112] look for octoprint as a octoprint service, not http. Reference: https://github.com/foosel/OctoPrint/wiki/Plugin:-Discovery#zeroconf-service-_octoprint_tcp Fixes #4375 --- lib/Slic3r/GUI/PresetEditor.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Slic3r/GUI/PresetEditor.pm b/lib/Slic3r/GUI/PresetEditor.pm index 00a100fa1..88cf6af68 100644 --- a/lib/Slic3r/GUI/PresetEditor.pm +++ b/lib/Slic3r/GUI/PresetEditor.pm @@ -1323,7 +1323,7 @@ sub build { # look for devices my $entries; { - my $res = Net::Bonjour->new('http'); + my $res = Net::Bonjour->new('octoprint'); $res->discover; $entries = [ $res->entries ]; } From 548ce534addf4efa871553b1185b4cbb7fa39592 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Thu, 12 Apr 2018 20:23:47 -0500 Subject: [PATCH 006/112] added another couple tests to catch a few more expressions according to spec. --- xs/t/24_gcodemath.t | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/xs/t/24_gcodemath.t b/xs/t/24_gcodemath.t index 8989b2b55..ba8159969 100644 --- a/xs/t/24_gcodemath.t +++ b/xs/t/24_gcodemath.t @@ -4,7 +4,7 @@ use strict; use warnings; use Slic3r::XS; -use Test::More tests => 7; +use Test::More tests => 10; { { my $test_string = "{if{3 == 4}} string"; @@ -25,6 +25,13 @@ use Test::More tests => 7; my $result = Slic3r::ConditionalGCode::apply_math($test_string); is $result, " string", 'If statement with nested bracket removes itself only on resulting true, does not strip text outside of brackets.'; } + + { + my $test_string = "{if 3 > 2} string"; + + my $result = Slic3r::ConditionalGCode::apply_math($test_string); + is $result, " string", 'If statement with nested bracket removes itself only on resulting true, does not strip text outside of brackets.'; + } { my $test_string = "{if{3 == 3}}string"; @@ -49,4 +56,18 @@ use Test::More tests => 7; my $result = Slic3r::ConditionalGCode::apply_math($test_string); is $result, "M104 S{a}; Sets temp to 20", 'string (minus brackets) on failure to parse.'; } + { + my $config = Slic3r::Config->new; + $config->set('infill_extruder', 2); + $config->normalize; + my $test_string = "{if [infill_extruder] == 2}M104 S210"; + my $pp = Slic3r::GCode::PlaceholderParser->new; + $pp->apply_config($config); + my $interim = $pp->process($test_string); + is $interim, "{if 2 == 2}M104 S210", 'Placeholder parser works inside conditional gcode.'; + + my $result = Slic3r::ConditionalGCode::apply_math($interim); + is $result, "M104 S210", 'If statement with nested bracket removes itself only on resulting true, does not strip text outside of brackets.'; + } + } From ea29a22cd6faa9dbe91a9e357e2f639263be9df0 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Thu, 12 Apr 2018 21:15:23 -0500 Subject: [PATCH 007/112] Adds Printer config option to force the use of set-and-wait gcode semantics (if supported by firmware). Fixes #3268 --- lib/Slic3r/GUI/PresetEditor.pm | 3 +++ xs/src/libslic3r/GCodeWriter.cpp | 3 ++- xs/src/libslic3r/PrintConfig.cpp | 13 +++++++++++++ xs/src/libslic3r/PrintConfig.hpp | 4 ++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r/GUI/PresetEditor.pm b/lib/Slic3r/GUI/PresetEditor.pm index 88cf6af68..39f206134 100644 --- a/lib/Slic3r/GUI/PresetEditor.pm +++ b/lib/Slic3r/GUI/PresetEditor.pm @@ -1217,6 +1217,7 @@ sub options { retract_length_toolchange retract_restart_extra_toolchange retract_lift_above retract_lift_below printer_settings_id printer_notes + use_set_and_wait_bed use_set_and_wait_extruder ); } @@ -1369,6 +1370,8 @@ sub build { $optgroup->append_single_option_line('pressure_advance'); $optgroup->append_single_option_line('vibration_limit'); $optgroup->append_single_option_line('z_steps_per_mm'); + $optgroup->append_single_option_line('use_set_and_wait_extruder'); + $optgroup->append_single_option_line('use_set_and_wait_bed'); } } { diff --git a/xs/src/libslic3r/GCodeWriter.cpp b/xs/src/libslic3r/GCodeWriter.cpp index 3bb218547..e4b011412 100644 --- a/xs/src/libslic3r/GCodeWriter.cpp +++ b/xs/src/libslic3r/GCodeWriter.cpp @@ -107,7 +107,7 @@ GCodeWriter::postamble() const std::string GCodeWriter::set_temperature(unsigned int temperature, bool wait, int tool) const { - + wait = this->config.use_set_and_wait_extruder ? true : wait; std::string code, comment; if (wait && FLAVOR_IS_NOT(gcfTeacup) && FLAVOR_IS_NOT(gcfMakerWare) && FLAVOR_IS_NOT(gcfSailfish)) { code = "M109"; @@ -143,6 +143,7 @@ std::string GCodeWriter::set_bed_temperature(unsigned int temperature, bool wait) const { std::string code, comment; + wait = this->config.use_set_and_wait_bed ? true : wait; if (wait && FLAVOR_IS_NOT(gcfTeacup)) { if (FLAVOR_IS(gcfMakerWare) || FLAVOR_IS(gcfSailfish)) { code = "M109"; diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index 1c6069662..142f5b0b3 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -1631,6 +1631,19 @@ PrintConfigDef::PrintConfigDef() def->cli = "use-relative-e-distances!"; def->default_value = new ConfigOptionBool(false); + def = this->add("use_set_and_wait_extruder", coBool); + def->label = "Use Set-and-Wait GCode (Extruder)"; + def->tooltip = "If your firmware supports a set and wait gcode for temperature changes, use it for automatically inserted temperature gcode for all extruders. Does not affect custom gcode."; + def->cli = "use-set-and-wait-extruder!"; + def->default_value = new ConfigOptionBool(false); + + def = this->add("use_set_and_wait_bed", coBool); + def->label = "Use Set-and-Wait GCode (Bed)"; + def->tooltip = "If your firmware supports a set and wait gcode for temperature changes, use it for automatically inserted temperature gcode for the heatbed. Does not affect custom gcode."; + def->cli = "use-set-and-wait-heatbed!"; + def->default_value = new ConfigOptionBool(false); + + def = this->add("use_volumetric_e", coBool); def->label = "Use volumetric E"; def->tooltip = "This experimental setting uses outputs the E values in cubic millimeters instead of linear millimeters. If your firmware doesn't already know filament diameter(s), you can put commands like 'M200 D[filament_diameter_0] T0' in your start G-code in order to turn volumetric mode on and use the filament diameter associated to the filament selected in Slic3r. This is only supported in recent Marlin."; diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index f989c5f52..4b99924cb 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -349,6 +349,8 @@ class GCodeConfig : public virtual StaticPrintConfig ConfigOptionBool use_firmware_retraction; ConfigOptionBool use_relative_e_distances; ConfigOptionBool use_volumetric_e; + ConfigOptionBool use_set_and_wait_extruder; + ConfigOptionBool use_set_and_wait_bed; GCodeConfig(bool initialize = true) : StaticPrintConfig() { if (initialize) @@ -390,6 +392,8 @@ class GCodeConfig : public virtual StaticPrintConfig OPT_PTR(use_firmware_retraction); OPT_PTR(use_relative_e_distances); OPT_PTR(use_volumetric_e); + OPT_PTR(use_set_and_wait_extruder); + OPT_PTR(use_set_and_wait_bed); return NULL; }; From f12340a324985e58a3a8b29db6c25b697d8443eb Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Thu, 12 Apr 2018 21:20:58 -0500 Subject: [PATCH 008/112] Fix path for travis. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c04d6b864..b84f9a871 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![](var/Slic3r_128px.png) Slic3r [![Build Status](https://travis-ci.org/alexrj/Slic3r.svg?branch=master)](https://travis-ci.org/alexrj/Slic3r) [![Build status](https://ci.appveyor.com/api/projects/status/8iqmeat6cj158vo6?svg=true)](https://ci.appveyor.com/project/lordofhyphens/slic3r) [![Build Status](http://osx-build.slic3r.org:8080/buildStatus/icon?job=Slic3r)](http://osx-build.slic3r.org:8080/job/Slic3r) +![](var/Slic3r_128px.png) Slic3r [![Build Status](https://travis-ci.org/slic3r/Slic3r.svg?branch=master)](https://travis-ci.org/alexrj/Slic3r) [![Build status](https://ci.appveyor.com/api/projects/status/8iqmeat6cj158vo6?svg=true)](https://ci.appveyor.com/project/lordofhyphens/slic3r) [![Build Status](http://osx-build.slic3r.org:8080/buildStatus/icon?job=Slic3r)](http://osx-build.slic3r.org:8080/job/Slic3r) ====== We have automated builds for Windows (64-bit) and OSX (>= 10.7). [Get a fresh build now](http://dl.slic3r.org/dev/) and stay up-to-date with the development! From df993c5020f36a58184012f2bdf335d82b71711d Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Thu, 12 Apr 2018 21:21:31 -0500 Subject: [PATCH 009/112] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b84f9a871..496e4dfa2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![](var/Slic3r_128px.png) Slic3r [![Build Status](https://travis-ci.org/slic3r/Slic3r.svg?branch=master)](https://travis-ci.org/alexrj/Slic3r) [![Build status](https://ci.appveyor.com/api/projects/status/8iqmeat6cj158vo6?svg=true)](https://ci.appveyor.com/project/lordofhyphens/slic3r) [![Build Status](http://osx-build.slic3r.org:8080/buildStatus/icon?job=Slic3r)](http://osx-build.slic3r.org:8080/job/Slic3r) +![](var/Slic3r_128px.png) Slic3r [![Build Status](https://travis-ci.org/slic3r/Slic3r.svg?branch=master)](https://travis-ci.org/slic3r/Slic3r) [![Build status](https://ci.appveyor.com/api/projects/status/8iqmeat6cj158vo6?svg=true)](https://ci.appveyor.com/project/lordofhyphens/slic3r) [![Build Status](http://osx-build.slic3r.org:8080/buildStatus/icon?job=Slic3r)](http://osx-build.slic3r.org:8080/job/Slic3r) ====== We have automated builds for Windows (64-bit) and OSX (>= 10.7). [Get a fresh build now](http://dl.slic3r.org/dev/) and stay up-to-date with the development! From a46aa09755f14190f87eba7ceaa8e2f53b893ce2 Mon Sep 17 00:00:00 2001 From: Jaggz H Date: Sat, 14 Apr 2018 12:28:55 -0700 Subject: [PATCH 010/112] Added max-support-layers (support_material_max_layers) (#4148) * Added max-support-layers (support_material_max_layers) * Revised tooltip text for support_material_max_layers * Disable support_material_max_layers if no support. --- lib/Slic3r/GUI/PresetEditor.pm | 7 ++++++- lib/Slic3r/Print/SupportMaterial.pm | 2 ++ xs/src/libslic3r/PrintConfig.cpp | 10 ++++++++++ xs/src/libslic3r/PrintConfig.hpp | 2 ++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r/GUI/PresetEditor.pm b/lib/Slic3r/GUI/PresetEditor.pm index 39f206134..c68753021 100644 --- a/lib/Slic3r/GUI/PresetEditor.pm +++ b/lib/Slic3r/GUI/PresetEditor.pm @@ -456,7 +456,7 @@ sub options { first_layer_acceleration default_acceleration skirts skirt_distance skirt_height min_skirt_length brim_connections_width brim_width interior_brim_width - support_material support_material_threshold support_material_enforce_layers + support_material support_material_threshold support_material_max_layers support_material_enforce_layers raft_layers support_material_pattern support_material_spacing support_material_angle support_material_interface_layers support_material_interface_spacing @@ -600,6 +600,7 @@ sub build { my $optgroup = $page->new_optgroup('Support material'); $optgroup->append_single_option_line('support_material'); $optgroup->append_single_option_line('support_material_threshold'); + $optgroup->append_single_option_line('support_material_max_layers'); $optgroup->append_single_option_line('support_material_enforce_layers'); } { @@ -926,6 +927,10 @@ sub _update { support_material_interface_layers dont_support_bridges support_material_extrusion_width support_material_interface_extrusion_width support_material_contact_distance); + + # Disable features that need support to be enabled. + $self->get_field($_)->toggle($config->support_material) + for qw(support_material_max_layers); $self->get_field($_)->toggle($have_support_material && $have_support_interface) for qw(support_material_interface_spacing support_material_interface_extruder diff --git a/lib/Slic3r/Print/SupportMaterial.pm b/lib/Slic3r/Print/SupportMaterial.pm index 202d010e1..7f080cbed 100644 --- a/lib/Slic3r/Print/SupportMaterial.pm +++ b/lib/Slic3r/Print/SupportMaterial.pm @@ -133,6 +133,8 @@ sub contact_area { last; } my $layer = $object->get_layer($layer_id); + last if $conf->support_material_max_layers + && $layer_id > $conf->support_material_max_layers; if ($buildplate_only) { # Collect the top surfaces up to this layer and merge them. diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index 142f5b0b3..aeb240792 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -1394,6 +1394,16 @@ PrintConfigDef::PrintConfigDef() def->enum_labels.push_back("0.2 (detachable)"); def->default_value = new ConfigOptionFloat(0.2); + def = this->add("support_material_max_layers", coInt); + def->label = "Max layer count for supports"; + def->category = "Support material"; + def->tooltip = "Disable support generation above this layer. Setting this to 0 will disable this feature."; + def->sidetext = "layers"; + def->cli = "support-material-max-layers=f"; + def->full_label = "Maximum layer count for support generation"; + def->min = 0; + def->default_value = new ConfigOptionInt(0); + def = this->add("support_material_enforce_layers", coInt); def->label = "Enforce support for the first"; def->category = "Support material"; diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index 4b99924cb..0aa65ba28 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -171,6 +171,7 @@ class PrintObjectConfig : public virtual StaticPrintConfig ConfigOptionInt support_material_angle; ConfigOptionBool support_material_buildplate_only; ConfigOptionFloat support_material_contact_distance; + ConfigOptionInt support_material_max_layers; ConfigOptionInt support_material_enforce_layers; ConfigOptionInt support_material_extruder; ConfigOptionFloatOrPercent support_material_extrusion_width; @@ -208,6 +209,7 @@ class PrintObjectConfig : public virtual StaticPrintConfig OPT_PTR(support_material_angle); OPT_PTR(support_material_buildplate_only); OPT_PTR(support_material_contact_distance); + OPT_PTR(support_material_max_layers); OPT_PTR(support_material_enforce_layers); OPT_PTR(support_material_extruder); OPT_PTR(support_material_extrusion_width); From 7457cfdac27eea2ce6b34e45758fcf97b3c13fec Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 14 Apr 2018 14:52:46 -0500 Subject: [PATCH 011/112] Outputs (bridge) in verbose gcode if path extruded is marked as bridge. Fixes #4380 --- xs/src/libslic3r/GCode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xs/src/libslic3r/GCode.cpp b/xs/src/libslic3r/GCode.cpp index 4507ed5dd..38119a1a4 100644 --- a/xs/src/libslic3r/GCode.cpp +++ b/xs/src/libslic3r/GCode.cpp @@ -503,8 +503,8 @@ std::string GCode::_extrude(ExtrusionPath path, std::string description, double speed) { path.simplify(SCALED_RESOLUTION); - std::string gcode; + description = path.is_bridge() ? description + " (bridge)" : description; // go to first point of extrusion path if (!this->_last_pos_defined || !this->_last_pos.coincides_with(path.first_point())) { From c206ae77a3c967ec9d5d4595975149d588083b71 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 17 Apr 2018 21:55:44 -0500 Subject: [PATCH 012/112] Checks to see if config option has been changed before going any further for several config options. N of 1 testing indicates that it may help with latency. --- lib/Slic3r/GUI/PresetEditor.pm | 210 ++++++++++++++++++--------------- 1 file changed, 114 insertions(+), 96 deletions(-) diff --git a/lib/Slic3r/GUI/PresetEditor.pm b/lib/Slic3r/GUI/PresetEditor.pm index c68753021..7ba3691b5 100644 --- a/lib/Slic3r/GUI/PresetEditor.pm +++ b/lib/Slic3r/GUI/PresetEditor.pm @@ -4,7 +4,7 @@ use warnings; use utf8; use File::Basename qw(basename); -use List::Util qw(first); +use List::Util qw(first any); use Wx qw(:bookctrl :dialog :keycode :icon :id :misc :panel :sizer :treectrl :window :button wxTheApp); use Wx::Event qw(EVT_BUTTON EVT_CHOICE EVT_KEY_DOWN EVT_TREE_SEL_CHANGED EVT_CHECKBOX); @@ -147,12 +147,11 @@ sub on_value_change { # propagate event to the parent sub _on_value_change { my ($self, $opt_key) = @_; - wxTheApp->CallAfter(sub { $self->current_preset->_dirty_config->apply($self->config); $self->{on_value_change}->($opt_key) if $self->{on_value_change}; $self->load_presets; - $self->_update; + $self->_update($opt_key); }); } @@ -794,122 +793,141 @@ sub reload_config { } sub _update { - my ($self) = @_; - + my ($self, $key) = @_; + my $opt_key = $key; + $opt_key = "all_keys" if (length($key // '') == 0); my $config = $self->{config}; - - if ($config->spiral_vase && !($config->perimeters == 1 && $config->top_solid_layers == 0 && $config->fill_density == 0 && $config->support_material == 0)) { - my $dialog = Wx::MessageDialog->new($self, - "The Spiral Vase mode requires:\n" - . "- one perimeter\n" - . "- no top solid layers\n" - . "- 0% fill density\n" - . "- no support material\n" - . "\nShall I adjust those settings in order to enable Spiral Vase?", - 'Spiral Vase', wxICON_WARNING | wxYES | wxNO); - if ($dialog->ShowModal() == wxID_YES) { - my $new_conf = Slic3r::Config->new; - $new_conf->set("perimeters", 1); - $new_conf->set("top_solid_layers", 0); - $new_conf->set("fill_density", 0); - $new_conf->set("support_material", 0); - $self->_load_config($new_conf); - } else { - my $new_conf = Slic3r::Config->new; - $new_conf->set("spiral_vase", 0); - $self->_load_config($new_conf); - } - } - - if ($config->support_material) { - # Ask only once. - if (! $self->{support_material_overhangs_queried}) { - $self->{support_material_overhangs_queried} = 1; - if ($config->overhangs != 1) { - my $dialog = Wx::MessageDialog->new($self, - "Supports work better, if the following feature is enabled:\n" - . "- Detect bridging perimeters\n" - . "\nShall I adjust those settings for supports?", - 'Support Generator', wxICON_WARNING | wxYES | wxNO | wxCANCEL); - my $answer = $dialog->ShowModal(); + if (any { /$opt_key/ } qw(all_keys spiral_vase perimeters top_solid_layers fill_density support_material)) { + if ($config->spiral_vase && !($config->perimeters == 1 && $config->top_solid_layers == 0 && $config->fill_density == 0 && $config->support_material == 0)) { + my $dialog = Wx::MessageDialog->new($self, + "The Spiral Vase mode requires:\n" + . "- one perimeter\n" + . "- no top solid layers\n" + . "- 0% fill density\n" + . "- no support material\n" + . "\nShall I adjust those settings in order to enable Spiral Vase?", + 'Spiral Vase', wxICON_WARNING | wxYES | wxNO); + if ($dialog->ShowModal() == wxID_YES) { my $new_conf = Slic3r::Config->new; - if ($answer == wxID_YES) { - # Enable "detect bridging perimeters". - $new_conf->set("overhangs", 1); - } elsif ($answer == wxID_NO) { - # Do nothing, leave supports on and "detect bridging perimeters" off. - } elsif ($answer == wxID_CANCEL) { - # Disable supports. - $new_conf->set("support_material", 0); - $self->{support_material_overhangs_queried} = 0; - } + $new_conf->set("perimeters", 1); + $new_conf->set("top_solid_layers", 0); + $new_conf->set("fill_density", 0); + $new_conf->set("support_material", 0); + $self->_load_config($new_conf); + } else { + my $new_conf = Slic3r::Config->new; + $new_conf->set("spiral_vase", 0); $self->_load_config($new_conf); } } - } else { - $self->{support_material_overhangs_queried} = 0; + } + + if (any { /$opt_key/ } qw(all_keys support_material)) { + if ($config->support_material) { + # Ask only once. + if (! $self->{support_material_overhangs_queried}) { + $self->{support_material_overhangs_queried} = 1; + if ($config->overhangs != 1) { + my $dialog = Wx::MessageDialog->new($self, + "Supports work better, if the following feature is enabled:\n" + . "- Detect bridging perimeters\n" + . "\nShall I adjust those settings for supports?", + 'Support Generator', wxICON_WARNING | wxYES | wxNO | wxCANCEL); + my $answer = $dialog->ShowModal(); + my $new_conf = Slic3r::Config->new; + if ($answer == wxID_YES) { + # Enable "detect bridging perimeters". + $new_conf->set("overhangs", 1); + } elsif ($answer == wxID_NO) { + # Do nothing, leave supports on and "detect bridging perimeters" off. + } elsif ($answer == wxID_CANCEL) { + # Disable supports. + $new_conf->set("support_material", 0); + $self->{support_material_overhangs_queried} = 0; + } + $self->_load_config($new_conf); + } + } + } else { + $self->{support_material_overhangs_queried} = 0; + } } - if ($config->fill_density == 100 - && !first { $_ eq $config->fill_pattern } @{$Slic3r::Config::Options->{top_infill_pattern}{values}}) { - my $dialog = Wx::MessageDialog->new($self, - "The " . $config->fill_pattern . " infill pattern is not supposed to work at 100% density.\n" - . "\nShall I switch to rectilinear fill pattern?", - 'Infill', wxICON_WARNING | wxYES | wxNO); - - my $new_conf = Slic3r::Config->new; - if ($dialog->ShowModal() == wxID_YES) { - $new_conf->set("fill_pattern", 'rectilinear'); - } else { - $new_conf->set("fill_density", 40); + if (any { /$opt_key/ } qw(all_keys fill_density fill_pattern top_infill_pattern)) { + if ($config->fill_density == 100 + && !first { $_ eq $config->fill_pattern } @{$Slic3r::Config::Options->{top_infill_pattern}{values}}) { + my $dialog = Wx::MessageDialog->new($self, + "The " . $config->fill_pattern . " infill pattern is not supposed to work at 100% density.\n" + . "\nShall I switch to rectilinear fill pattern?", + 'Infill', wxICON_WARNING | wxYES | wxNO); + + my $new_conf = Slic3r::Config->new; + if ($dialog->ShowModal() == wxID_YES) { + $new_conf->set("fill_pattern", 'rectilinear'); + } else { + $new_conf->set("fill_density", 40); + } + $self->_load_config($new_conf); } - $self->_load_config($new_conf); } + my $have_perimeters = $config->perimeters > 0; - $self->get_field($_)->toggle($have_perimeters) - for qw(extra_perimeters thin_walls overhangs seam_position external_perimeters_first - external_perimeter_extrusion_width - perimeter_speed small_perimeter_speed external_perimeter_speed); + if (any { /$opt_key/ } qw(all_keys perimeters)) { + $self->get_field($_)->toggle($have_perimeters) + for qw(extra_perimeters thin_walls overhangs seam_position external_perimeters_first + external_perimeter_extrusion_width + perimeter_speed small_perimeter_speed external_perimeter_speed); + } my $have_adaptive_slicing = $config->adaptive_slicing; - $self->get_field($_)->toggle($have_adaptive_slicing) - for qw(adaptive_slicing_quality match_horizontal_surfaces); - $self->get_field($_)->toggle(!$have_adaptive_slicing) - for qw(layer_height); - + if (any { /$opt_key/ } qw(all_keys adaptive_slicing)) { + $self->get_field($_)->toggle($have_adaptive_slicing) + for qw(adaptive_slicing_quality match_horizontal_surfaces); + $self->get_field($_)->toggle(!$have_adaptive_slicing) + for qw(layer_height); + } + my $have_infill = $config->fill_density > 0; - # infill_extruder uses the same logic as in Print::extruders() - $self->get_field($_)->toggle($have_infill) - for qw(fill_pattern infill_every_layers infill_only_where_needed solid_infill_every_layers - solid_infill_below_area infill_extruder); - + if (any { /$opt_key/ } qw(all_keys fill_density)) { + # infill_extruder uses the same logic as in Print::extruders() + $self->get_field($_)->toggle($have_infill) + for qw(fill_pattern infill_every_layers infill_only_where_needed solid_infill_every_layers + solid_infill_below_area infill_extruder); + } + my $have_solid_infill = ($config->top_solid_layers > 0) || ($config->bottom_solid_layers > 0); - # solid_infill_extruder uses the same logic as in Print::extruders() - $self->get_field($_)->toggle($have_solid_infill) - for qw(top_infill_pattern bottom_infill_pattern infill_first solid_infill_extruder - solid_infill_extrusion_width solid_infill_speed); - - $self->get_field($_)->toggle($have_infill || $have_solid_infill) - for qw(fill_angle infill_extrusion_width infill_speed bridge_speed); - - $self->get_field('fill_gaps')->toggle($have_perimeters && $have_infill); - $self->get_field('gap_fill_speed')->toggle($have_perimeters && $have_infill && $config->fill_gaps); - + if (any { /$opt_key/ } qw(all_keys top_solid_layers bottom_solid_layers)) { + # solid_infill_extruder uses the same logic as in Print::extruders() + $self->get_field($_)->toggle($have_solid_infill) + for qw(top_infill_pattern bottom_infill_pattern infill_first solid_infill_extruder + solid_infill_extrusion_width solid_infill_speed); + } + + if (any { /$opt_key/ } qw(all_keys top_solid_layers bottom_solid_layers fill_density)) { + $self->get_field($_)->toggle($have_infill || $have_solid_infill) + for qw(fill_angle infill_extrusion_width infill_speed bridge_speed); + } + + if (any { /$opt_key/ } qw(all_keys fill_density perimeters)) { + $self->get_field('fill_gaps')->toggle($have_perimeters && $have_infill); + $self->get_field('gap_fill_speed')->toggle($have_perimeters && $have_infill && $config->fill_gaps); + } + my $have_top_solid_infill = $config->top_solid_layers > 0; $self->get_field($_)->toggle($have_top_solid_infill) for qw(top_infill_extrusion_width top_solid_infill_speed); - + my $have_autospeed = any { $config->get("${_}_speed") eq '0' } - qw(perimeter external_perimeter small_perimeter - infill solid_infill top_solid_infill gap_fill support_material - support_material_interface); + qw(perimeter external_perimeter small_perimeter + infill solid_infill top_solid_infill gap_fill support_material + support_material_interface); $self->get_field('max_print_speed')->toggle($have_autospeed); - + my $have_default_acceleration = $config->default_acceleration > 0; $self->get_field($_)->toggle($have_default_acceleration) for qw(perimeter_acceleration infill_acceleration bridge_acceleration first_layer_acceleration); - + my $have_skirt = $config->skirts > 0 || $config->min_skirt_length > 0; $self->get_field($_)->toggle($have_skirt) for qw(skirt_distance skirt_height); From 72db3392c833b2f6b6b4acd5857efefc80edd2c8 Mon Sep 17 00:00:00 2001 From: Oekn5w <38046255+Oekn5w@users.noreply.github.com> Date: Mon, 23 Apr 2018 19:04:47 +0200 Subject: [PATCH 013/112] "Reload from disk" - UI function overhaul (#4388) * C++ backend work to support reloading modifier files * UI update preserving configs and volumes of modifiers (those are not reloaded) * clarifying variable names * Setting up variables in the GUI enviroment * Implementation of added variables in (new ModelVolume(*)) funcion * Implementation of new reload function * Overhaul of the reload function, also renaming of some variables * Rewriting the main loop of the reload function, explicitly differentiating between the original file and later added parts and modifiers pointing to other files * Whitespace cleanup * Added dialog to choose from different reload behaviors, added hide and default option in preferences, copied volumes are matched the new object's origin translation --- lib/Slic3r/GUI.pm | 5 +- lib/Slic3r/GUI/Plater.pm | 177 +++++++++++++++++++--- lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm | 12 +- lib/Slic3r/GUI/Preferences.pm | 19 ++- lib/Slic3r/GUI/ReloadDialog.pm | 60 ++++++++ xs/src/libslic3r/Model.cpp | 16 +- xs/src/libslic3r/Model.hpp | 7 +- xs/xsp/Model.xsp | 14 ++ 8 files changed, 281 insertions(+), 29 deletions(-) create mode 100644 lib/Slic3r/GUI/ReloadDialog.pm diff --git a/lib/Slic3r/GUI.pm b/lib/Slic3r/GUI.pm index c8cd20c5c..6d2e5e3a8 100644 --- a/lib/Slic3r/GUI.pm +++ b/lib/Slic3r/GUI.pm @@ -52,6 +52,7 @@ use Slic3r::GUI::Preset; use Slic3r::GUI::PresetEditor; use Slic3r::GUI::PresetEditorDialog; use Slic3r::GUI::SLAPrintOptions; +use Slic3r::GUI::ReloadDialog; our $have_OpenGL = eval "use Slic3r::GUI::3DScene; 1"; our $have_LWP = eval "use LWP::UserAgent; 1"; @@ -91,7 +92,9 @@ our $Settings = { color_toolpaths_by => 'role', tabbed_preset_editors => 1, show_host => 0, - nudge_val => 1 + nudge_val => 1, + reload_hide_dialog => 0, + reload_behavior => 0 }, }; diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index ef364b08c..8b2c26d0d 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -1177,7 +1177,7 @@ sub add_tin { sub load_file { my $self = shift; - my ($input_file, $obj_idx) = @_; + my ($input_file, $obj_idx_to_load) = @_; $Slic3r::GUI::Settings->{recent}{skein_directory} = dirname($input_file); wxTheApp->save_settings; @@ -1203,14 +1203,27 @@ sub load_file { } } - if (defined $obj_idx) { - return () if $obj_idx >= $model->objects_count; - @obj_idx = $self->load_model_objects($model->get_object($obj_idx)); + for my $obj_idx (0..($model->objects_count-1)) { + my $object = $model->objects->[$obj_idx]; + $object->set_input_file($input_file); + for my $vol_idx (0..($object->volumes_count-1)) { + my $volume = $object->get_volume($vol_idx); + $volume->set_input_file($input_file); + $volume->set_input_file_obj_idx($obj_idx); + $volume->set_input_file_obj_idx($vol_idx); + } + } + + my $i = 0; + + if (defined $obj_idx_to_load) { + return () if $obj_idx_to_load >= $model->objects_count; + @obj_idx = $self->load_model_objects($model->get_object($obj_idx_to_load)); + $i = $obj_idx_to_load; } else { @obj_idx = $self->load_model_objects(@{$model->objects}); } - my $i = 0; foreach my $obj_idx (@obj_idx) { $self->{objects}[$obj_idx]->input_file($input_file); $self->{objects}[$obj_idx]->input_file_obj_idx($i++); @@ -2306,26 +2319,141 @@ sub reload_from_disk { my ($obj_idx, $object) = $self->selected_object; return if !defined $obj_idx; - return if !$object->input_file - || !-e $object->input_file; + if (!$object->input_file) { + Slic3r::GUI::warning_catcher($self)->("The selected object couldn't be reloaded because it isn't referenced to its input file any more. This is the case after performing operations like cut or split."); + return; + } + if (!-e $object->input_file) { + Slic3r::GUI::warning_catcher($self)->("The selected object couldn't be reloaded because the file doesn't exist anymore on the disk."); + return; + } # Only reload the selected object and not all objects from the input file. my @new_obj_idx = $self->load_file($object->input_file, $object->input_file_obj_idx); - return if !@new_obj_idx; - - my $model_object = $self->{model}->objects->[$obj_idx]; - foreach my $new_obj_idx (@new_obj_idx) { - my $o = $self->{model}->objects->[$new_obj_idx]; - $o->clear_instances; - $o->add_instance($_) for @{$model_object->instances}; - - if ($o->volumes_count == $model_object->volumes_count) { - for my $i (0..($o->volumes_count-1)) { - $o->get_volume($i)->config->apply($model_object->get_volume($i)->config); - } + if (!@new_obj_idx) { + Slic3r::GUI::warning_catcher($self)->("The selected object couldn't be reloaded because the new file doesn't contain the object."); + return; + } + + my $org_obj = $self->{model}->objects->[$obj_idx]; + + # check if the object is dependant of more than one file + my $org_obj_has_modifiers=0; + for my $i (0..($org_obj->volumes_count-1)) { + if ($org_obj->input_file ne $org_obj->get_volume($i)->input_file) { + $org_obj_has_modifiers=1; + last; + } + } + + my $reload_behavior = $Slic3r::GUI::Settings->{_}{reload_behavior}; + + # ask the user how to proceed, if option is selected in preferences + if ($org_obj_has_modifiers && !$Slic3r::GUI::Settings->{_}{reload_hide_dialog}) { + my $dlg = Slic3r::GUI::ReloadDialog->new(undef,$reload_behavior); + my $res = $dlg->ShowModal; + if ($res==wxID_CANCEL) { + $self->remove($_) for @new_obj_idx; + $dlg->Destroy; + return; + } + $reload_behavior = $dlg->GetSelection; + my $save = 0; + if ($reload_behavior != $Slic3r::GUI::Settings->{_}{reload_behavior}) { + $Slic3r::GUI::Settings->{_}{reload_behavior} = $reload_behavior; + $save = 1; + } + if ($dlg->GetHideOnNext) { + $Slic3r::GUI::Settings->{_}{reload_hide_dialog} = 1; + $save = 1; + } + Slic3r::GUI->save_settings if $save; + $dlg->Destroy; + } + + my $volume_unmatched=0; + + foreach my $new_obj_idx (@new_obj_idx) { + my $new_obj = $self->{model}->objects->[$new_obj_idx]; + $new_obj->clear_instances; + $new_obj->add_instance($_) for @{$org_obj->instances}; + $new_obj->config->apply($org_obj->config); + + my $new_vol_idx = 0; + my $org_vol_idx = 0; + my $new_vol_count=$new_obj->volumes_count; + my $org_vol_count=$org_obj->volumes_count; + + while ($new_vol_idx<=$new_vol_count-1) { + if (($org_vol_idx<=$org_vol_count-1) && ($org_obj->get_volume($org_vol_idx)->input_file eq $new_obj->input_file)) { + # apply config from the matching volumes + $new_obj->get_volume($new_vol_idx++)->config->apply($org_obj->get_volume($org_vol_idx++)->config); + } else { + # reload has more volumes than original (first file), apply config from the first volume + $new_obj->get_volume($new_vol_idx++)->config->apply($org_obj->get_volume(0)->config); + $volume_unmatched=1; + } + } + $org_vol_idx=$org_vol_count if $reload_behavior==2; # Reload behavior: discard + while (($org_vol_idx<=$org_vol_count-1) && ($org_obj->get_volume($org_vol_idx)->input_file eq $new_obj->input_file)) { + # original has more volumes (first file), skip those + $org_vol_idx++; + $volume_unmatched=1; + } + while ($org_vol_idx<=$org_vol_count-1) { + if ($reload_behavior==1) { # Reload behavior: copy + my $new_volume = $new_obj->add_volume($org_obj->get_volume($org_vol_idx)); + $new_volume->mesh->translate(@{$org_obj->origin_translation->negative}); + $new_volume->mesh->translate(@{$new_obj->origin_translation}); + if ($new_volume->name =~ m/link to path\z/) { + my $new_name = $new_volume->name; + $new_name =~ s/ - no link to path$/ - copied/; + $new_volume->set_name($new_name); + }elsif(!($new_volume->name =~ m/copied\z/)) { + $new_volume->set_name($new_volume->name . " - copied"); + } + }else{ # Reload behavior: Reload all, also fallback solution if ini was manually edited to a wrong value + if ($org_obj->get_volume($org_vol_idx)->input_file) { + my $model = eval { Slic3r::Model->read_from_file($org_obj->get_volume($org_vol_idx)->input_file) }; + if ($@) { + $org_obj->get_volume($org_vol_idx)->set_input_file(""); + }elsif ($org_obj->get_volume($org_vol_idx)->input_file_obj_idx > ($model->objects_count-1)) { + # Object Index for that part / modifier not found in current version of the file + $org_obj->get_volume($org_vol_idx)->set_input_file(""); + }else{ + my $prt_mod_obj = $model->objects->[$org_obj->get_volume($org_vol_idx)->input_file_obj_idx]; + if ($org_obj->get_volume($org_vol_idx)->input_file_vol_idx > ($prt_mod_obj->volumes_count-1)) { + # Volume Index for that part / modifier not found in current version of the file + $org_obj->get_volume($org_vol_idx)->set_input_file(""); + }else{ + # all checks passed, load new mesh and copy metadata + my $new_volume = $new_obj->add_volume($prt_mod_obj->get_volume($org_obj->get_volume($org_vol_idx)->input_file_vol_idx)); + $new_volume->set_input_file($org_obj->get_volume($org_vol_idx)->input_file); + $new_volume->set_input_file_obj_idx($org_obj->get_volume($org_vol_idx)->input_file_obj_idx); + $new_volume->set_input_file_vol_idx($org_obj->get_volume($org_vol_idx)->input_file_vol_idx); + $new_volume->config->apply($org_obj->get_volume($org_vol_idx)->config); + $new_volume->set_modifier($org_obj->get_volume($org_vol_idx)->modifier); + $new_volume->mesh->translate(@{$new_obj->origin_translation}); + } + } + } + if (!$org_obj->get_volume($org_vol_idx)->input_file) { + my $new_volume = $new_obj->add_volume($org_obj->get_volume($org_vol_idx)); # error -> copy old mesh + $new_volume->mesh->translate(@{$org_obj->origin_translation->negative}); + $new_volume->mesh->translate(@{$new_obj->origin_translation}); + if ($new_volume->name =~ m/copied\z/) { + my $new_name = $new_volume->name; + $new_name =~ s/ - copied$/ - no link to path/; + $new_volume->set_name($new_name); + }elsif(!($new_volume->name =~ m/link to path\z/)) { + $new_volume->set_name($new_volume->name . " - no link to path"); + } + $volume_unmatched=1; + } + } + $org_vol_idx++; } } - $self->remove($obj_idx); # TODO: refresh object list which contains wrong count and scale @@ -2336,8 +2464,17 @@ sub reload_from_disk { # When porting to C++ we'll probably have cleaner ways to do this. $self->make_thumbnail($_-1) for @new_obj_idx; + # update print + $self->stop_background_process; + $self->{print}->reload_object($_-1) for @new_obj_idx; + $self->on_model_change; + # Empty the redo stack $self->{redo_stack} = []; + + if ($volume_unmatched) { + Slic3r::GUI::warning_catcher($self)->("At least 1 volume couldn't be matched between the original object and the reloaded one."); + } } sub export_object_stl { diff --git a/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm b/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm index bfd858f5c..35c1af28b 100644 --- a/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm +++ b/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm @@ -353,11 +353,17 @@ sub on_btn_load { next; } - foreach my $object (@{$model->objects}) { - foreach my $volume (@{$object->volumes}) { - my $new_volume = $self->{model_object}->add_volume($volume); + for my $obj_idx (0..($model->objects_count-1)) { + my $object = $model->objects->[$obj_idx]; + for my $vol_idx (0..($object->volumes_count-1)) { + my $new_volume = $self->{model_object}->add_volume($object->get_volume($vol_idx)); $new_volume->set_modifier($is_modifier); $new_volume->set_name(basename($input_file)); + + # input_file needed to reload / update modifiers' volumes + $new_volume->set_input_file($input_file); + $new_volume->set_input_file_obj_idx($obj_idx); + $new_volume->set_input_file_vol_idx($vol_idx); # apply the same translation we applied to the object $new_volume->mesh->translate(@{$self->{model_object}->origin_translation}); diff --git a/lib/Slic3r/GUI/Preferences.pm b/lib/Slic3r/GUI/Preferences.pm index 23da73d8d..e63ca8cbc 100644 --- a/lib/Slic3r/GUI/Preferences.pm +++ b/lib/Slic3r/GUI/Preferences.pm @@ -92,6 +92,23 @@ sub new { tooltip => 'In 2D plater, Move objects using keyboard by nudge value of', default => $Slic3r::GUI::Settings->{_}{nudge_val}, )); + $optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new( # reload hide dialog + opt_id => 'reload_hide_dialog', + type => 'bool', + label => 'Hide Dialog on Reload', + tooltip => 'When checked, the dialog on reloading files with added parts & modifiers is suppressed. The reload is performed according to the option given in \'Default Reload Behavior\'', + default => $Slic3r::GUI::Settings->{_}{reload_hide_dialog}, + )); + $optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new( # default reload behavior + opt_id => 'reload_behavior', + type => 'select', + label => 'Default Reload Behavior', + tooltip => 'Choose the default behavior of the \'Reload from disk\' function regarding additional parts and modifiers.', + labels => ['Reload all','Reload main, copy added','Reload main, discard added'], + values => [0, 1, 2], + default => $Slic3r::GUI::Settings->{_}{reload_behavior}, + width => 180, + )); $optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new( # colorscheme opt_id => 'colorscheme', type => 'select', @@ -100,7 +117,7 @@ sub new { labels => ['Default','Solarized'], # add more schemes, if you want in ColorScheme.pm. values => ['getDefault','getSolarized'], # add more schemes, if you want - those are the names of the corresponding function in ColorScheme.pm. default => $Slic3r::GUI::Settings->{_}{colorscheme} // 'getDefault', - width => 130, + width => 180, )); my $sizer = Wx::BoxSizer->new(wxVERTICAL); diff --git a/lib/Slic3r/GUI/ReloadDialog.pm b/lib/Slic3r/GUI/ReloadDialog.pm new file mode 100644 index 000000000..bb11bf089 --- /dev/null +++ b/lib/Slic3r/GUI/ReloadDialog.pm @@ -0,0 +1,60 @@ +# A tiny dialog to select how to reload an object that has additional parts or modifiers. + +package Slic3r::GUI::ReloadDialog; +use strict; +use warnings; +use utf8; + +use Wx qw(:button :dialog :id :misc :sizer :choicebook wxTAB_TRAVERSAL); +use Wx::Event qw(EVT_CLOSE); +use base 'Wx::Dialog'; + +sub new { + my $class = shift; + my ($parent,$default_selection) = @_; + my $self = $class->SUPER::new($parent, -1, "Additional parts and modifiers detected", wxDefaultPosition, [350,100], wxDEFAULT_DIALOG_STYLE); + + # label + my $text = Wx::StaticText->new($self, -1, "Additional parts and modifiers are loaded in the current model. \n\nHow do you want to proceed?", wxDefaultPosition, wxDefaultSize); + + # selector + $self->{choice} = my $choice = Wx::Choice->new($self, -1, wxDefaultPosition, wxDefaultSize, []); + $choice->Append("Reload all linked files"); + $choice->Append("Reload main file, copy added parts & modifiers"); + $choice->Append("Reload main file, discard added parts & modifiers"); + $choice->SetSelection($default_selection); + + # checkbox + $self->{checkbox} = my $checkbox = Wx::CheckBox->new($self, -1, "Don't ask again"); + + my $vsizer = Wx::BoxSizer->new(wxVERTICAL); + my $hsizer = Wx::BoxSizer->new(wxHORIZONTAL); + $vsizer->Add($text, 0, wxEXPAND | wxALL, 10); + $vsizer->Add($choice, 0, wxEXPAND | wxALL, 10); + $hsizer->Add($checkbox, 1, wxEXPAND | wxALL, 10); + $hsizer->Add($self->CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL, 10); + $vsizer->Add($hsizer, 0, wxEXPAND | wxALL, 0); + + $self->SetSizer($vsizer); + $self->SetMinSize($self->GetSize); + $vsizer->SetSizeHints($self); + + # needed to actually free memory + EVT_CLOSE($self, sub { + $self->EndModal(wxID_CANCEL); + $self->Destroy; + }); + + return $self; +} + +sub GetSelection { + my ($self) = @_; + return $self->{choice}->GetSelection; +} +sub GetHideOnNext { + my ($self) = @_; + return $self->{checkbox}->GetValue; +} + +1; diff --git a/xs/src/libslic3r/Model.cpp b/xs/src/libslic3r/Model.cpp index aa29858af..2d809db65 100644 --- a/xs/src/libslic3r/Model.cpp +++ b/xs/src/libslic3r/Model.cpp @@ -936,12 +936,18 @@ ModelObject::print_info() const ModelVolume::ModelVolume(ModelObject* object, const TriangleMesh &mesh) -: mesh(mesh), modifier(false), object(object) +: mesh(mesh), modifier(false), input_file(""), object(object) {} ModelVolume::ModelVolume(ModelObject* object, const ModelVolume &other) -: name(other.name), mesh(other.mesh), config(other.config), - modifier(other.modifier), object(object) +: name(other.name), + mesh(other.mesh), + config(other.config), + modifier(other.modifier), + input_file(other.input_file), + input_file_obj_idx(other.input_file_obj_idx), + input_file_vol_idx(other.input_file_vol_idx), + object(object) { this->material_id(other.material_id()); } @@ -959,6 +965,10 @@ ModelVolume::swap(ModelVolume &other) std::swap(this->mesh, other.mesh); std::swap(this->config, other.config); std::swap(this->modifier, other.modifier); + + std::swap(this->input_file, other.input_file); + std::swap(this->input_file_obj_idx, other.input_file_obj_idx); + std::swap(this->input_file_vol_idx, other.input_file_vol_idx); } t_model_material_id diff --git a/xs/src/libslic3r/Model.hpp b/xs/src/libslic3r/Model.hpp index db6299ee4..30cbf5e0d 100644 --- a/xs/src/libslic3r/Model.hpp +++ b/xs/src/libslic3r/Model.hpp @@ -457,7 +457,12 @@ class ModelVolume DynamicPrintConfig config; ///< Configuration parameters specific to an object model geometry or a modifier volume, ///< overriding the global Slic3r settings and the ModelObject settings. - + + /// Input file path needed for reloading the volume from disk + std::string input_file; ///< Input file path + int input_file_obj_idx; ///< Input file object index + int input_file_vol_idx; ///< Input file volume index + bool modifier; ///< Is it an object to be printed, or a modifier volume? /// Get the parent object owning this modifier volume. diff --git a/xs/xsp/Model.xsp b/xs/xsp/Model.xsp index 6772aee07..67bca3fd3 100644 --- a/xs/xsp/Model.xsp +++ b/xs/xsp/Model.xsp @@ -258,6 +258,20 @@ ModelMaterial::attributes() %code%{ RETVAL = THIS->name; %}; void set_name(std::string value) %code%{ THIS->name = value; %}; + + std::string input_file() + %code%{ RETVAL = THIS->input_file; %}; + void set_input_file(std::string value) + %code%{ THIS->input_file = value; %}; + int input_file_obj_idx() + %code%{ RETVAL = THIS->input_file_obj_idx; %}; + void set_input_file_obj_idx(int obj_idx) + %code%{ THIS->input_file_obj_idx = obj_idx; %}; + int input_file_vol_idx() + %code%{ RETVAL = THIS->input_file_vol_idx; %}; + void set_input_file_vol_idx(int vol_idx) + %code%{ THIS->input_file_vol_idx = vol_idx; %}; + t_model_material_id material_id(); void set_material_id(t_model_material_id material_id) %code%{ THIS->material_id(material_id); %}; From ecfc175c41eaa3069eab18a318b35a4d58517f69 Mon Sep 17 00:00:00 2001 From: Robert Sanchez Date: Mon, 23 Apr 2018 11:11:45 -0700 Subject: [PATCH 014/112] Added icon files for MacOS (#4376) * Added icon files for MacOS Added icons designed by Akira Yasuda for STL and GCODE files. Modified plist generator to include references to icons and dmg creator to include them. * Update make_dmg.sh * Fix tabs/spacing --- README.md | 52 ++++++++-------- package/osx/make_dmg.sh | 2 + package/osx/plist.sh | 129 +++++++++++++++++++++++----------------- var/gcode.icns | Bin 0 -> 116397 bytes var/gcode.ico | Bin 0 -> 120914 bytes var/slt.ico | Bin 0 -> 116921 bytes var/stl.icns | Bin 0 -> 68486 bytes 7 files changed, 101 insertions(+), 82 deletions(-) create mode 100755 var/gcode.icns create mode 100755 var/gcode.ico create mode 100755 var/slt.ico create mode 100755 var/stl.icns diff --git a/README.md b/README.md index 496e4dfa2..d0404855a 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ The core parts of Slic3r are written in C++11, with multithreading. The graphica You can download a precompiled package from [slic3r.org](http://slic3r.org/) (releases) or from [dl.slicr3r.org](http://dl.slic3r.org/dev/) (automated builds). -If you want to compile the source yourself follow the instructions on one of these wiki pages: +If you want to compile the source yourself follow the instructions on one of these wiki pages: * [Linux](https://github.com/alexrj/Slic3r/wiki/Running-Slic3r-from-git-on-GNU-Linux) * [Windows](https://github.com/alexrj/Slic3r/wiki/Running-Slic3r-from-git-on-Windows) * [Mac OSX](https://github.com/alexrj/Slic3r/wiki/Running-Slic3r-from-git-on-OS-X) @@ -58,7 +58,7 @@ Sure! You can do the following to find things that are available to help with: * Development * [Low Effort tasks](https://github.com/alexrj/Slic3r/labels/Low%20Effort): pick one of them! * [More available tasks](https://github.com/alexrj/Slic3r/milestone/31): let's discuss together before you start working on them - * Please comment in the related GitHub issue that you are working on it so that other people know. + * Please comment in the related GitHub issue that you are working on it so that other people know. * Contribute to the [Manual](http://manual.slic3r.org/)! (see its [GitHub repository](https://github.com/alexrj/Slic3r-Manual)) * You can also find us in #slic3r on [FreeNode](https://webchat.freenode.net): talk to _Sound_, _LoH_ or the other members of the Slic3r community. * Add an [issue](https://github.com/alexrj/Slic3r/issues) to the GitHub tracker if it isn't already present. @@ -84,12 +84,12 @@ The main author of Slic3r is Alessandro Ranellucci (@alexrj, *Sound* in IRC, [@a Joseph Lenox (@lordofhyphens, *Loh* in IRC) is the current co-maintainer. -Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark Hindess, Petr Ledvina, Y. Sapir, Mike Sheldrake, Kliment Yanev and numerous others. Original manual by Gary Hodgson. Slic3r logo designed by Corey Daniels, Silk Icon Set designed by Mark James. +Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark Hindess, Petr Ledvina, Y. Sapir, Mike Sheldrake, Kliment Yanev and numerous others. Original manual by Gary Hodgson. Slic3r logo designed by Corey Daniels, Silk Icon Set designed by Mark James, stl and gcode file icons designed by Akira Yasuda. ### How can I invoke Slic3r using the command line? Usage: slic3r.pl [ OPTIONS ] [ file.stl ] [ file2.stl ] ... - + --help Output this usage screen and exit --version Output the version of Slic3r and exit --save Save configuration to the specified file @@ -108,16 +108,16 @@ Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark them as _upper.stl and _lower.stl --split Split the shells contained in given STL file into several STL files --info Output information about the supplied file(s) and exit - + -j, --threads Number of threads to use (1+, default: 2) - + GUI options: --gui Forces the GUI launch instead of command line slicing (if you supply a model file, it will be loaded into the plater) - --no-gui Forces the command line slicing instead of gui. + --no-gui Forces the command line slicing instead of gui. This takes precedence over --gui if both are present. --autosave Automatically export current configuration to the specified file - + Output options: --output-filename-format Output file name format; all config options enclosed in brackets @@ -128,7 +128,7 @@ Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark --export-svg Export a SVG file containing slices instead of G-code. -m, --merge If multiple files are supplied, they will be composed into a single print rather than processed individually. - + Printer options: --bed-shape Coordinates in mm of the bed's points (default: 0x0,200x0,200x200,0x200) --has-heatbed This will provide automatic generation of bed heating gcode @@ -149,7 +149,7 @@ Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark default: 0) --pressure-advance Adjust pressure using the experimental advance algorithm (K constant, set zero to disable; default: 0) - + Filament options: --filament-diameter Diameter in mm of your raw filament (default: 3) --extrusion-multiplier @@ -162,7 +162,7 @@ Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark --bed-temperature Heated bed temperature in degree Celsius, set 0 to disable (default: 0) --first-layer-bed-temperature Heated bed temperature for the first layer, in degree Celsius, set 0 to disable (default: same as --bed-temperature) - + Speed options: --travel-speed Speed of non-print moves in mm/s (default: 130) --perimeter-speed Speed of print moves for perimeters in mm/s (default: 30) @@ -186,7 +186,7 @@ Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark --gap-fill-speed Speed of gap fill print moves in mm/s (default: 20) --first-layer-speed Speed of print moves for bottom layer, expressed either as an absolute value or as a percentage over normal speeds (default: 30%) - + Acceleration options: --perimeter-acceleration Overrides firmware's default acceleration for perimeters. (mm/s^2, set zero @@ -203,7 +203,7 @@ Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark --default-acceleration Acceleration will be reset to this value after the specific settings above have been applied. (mm/s^2, set zero to disable; default: 0) - + Accuracy options: --layer-height Layer height in mm (default: 0.3) --first-layer-height Layer height for first layer (mm or %, default: 0.35) @@ -211,7 +211,7 @@ Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark Infill every N layers (default: 1) --solid-infill-every-layers Force a solid layer every N layers (default: 0) - + Print options: --perimeters Number of perimeters/horizontal skins (range: 0+, default: 3) --top-solid-layers Number of solid layers to do for top surfaces (range: 0+, default: 3) @@ -242,14 +242,14 @@ Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark --infill-only-where-needed Only infill under ceilings (default: no) --infill-first Make infill before perimeters (default: no) - + Quality options (slower slicing): --extra-perimeters Add more perimeters when needed (default: yes) --avoid-crossing-perimeters Optimize travel moves so that no perimeters are crossed (default: no) --thin-walls Detect single-width walls (default: yes) --overhangs Experimental option to use bridge flow, speed and fan for overhangs (default: yes) - + Support material options: --support-material Generate support material for overhangs --support-material-threshold @@ -274,7 +274,7 @@ Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark regardless of --support-material and threshold (0+, default: 0) --dont-support-bridges Experimental option for preventing support material from being generated under bridged areas (default: yes) - + Retraction options: --retract-length Length of retraction in mm when pausing extrusion (default: 1) --retract-speed Speed for retraction in mm/s (default: 30) @@ -289,14 +289,14 @@ Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark --retract-layer-change Enforce a retraction before each Z move (default: no) --wipe Wipe the nozzle while doing a retraction (default: no) - + Retraction options for multi-extruder setups: --retract-length-toolchange Length of retraction in mm when disabling tool (default: 10) --retract-restart-extra-toolchange Additional amount of filament in mm to push after switching tool (default: 0) - + Cooling options: --cooling Enable fan and cooling control --min-fan-speed Minimum fan speed (default: 35%) @@ -310,7 +310,7 @@ Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark --disable-fan-first-layers Disable fan for the first N layers (default: 1) --fan-always-on Keep fan always on at min fan speed, even for layers that don't need cooling - + Skirt options: --skirts Number of skirts to draw (0+, default: 1) --skirt-distance Distance in mm between innermost skirt and object @@ -320,7 +320,7 @@ Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark of filament on the first layer, for each extruder (mm, 0+, default: 0) --brim-width Width of the brim that will get added to each object to help adhesion (mm, default: 0) - + Transform options: --scale Factor for scaling input object (default: 1) --rotate Rotation angle in degrees (0-360, default: 0) @@ -328,11 +328,11 @@ Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark --duplicate-grid Number of items with grid arrangement (default: 1,1) --duplicate-distance Distance in mm between copies (default: 6) --dont-arrange Don't arrange the objects on the build plate. The model coordinates - define the absolute positions on the build plate. + define the absolute positions on the build plate. The option --print-center will be ignored. --xy-size-compensation Grow/shrink objects by the configured absolute distance (mm, default: 0) - + Sequential printing options: --complete-objects When printing multiple objects and/or copies, complete each one before starting the next one; watch out for extruder collisions (default: no) @@ -340,11 +340,11 @@ Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark (default: 20) --extruder-clearance-height Maximum vertical extruder depth; i.e. vertical distance from extruder tip and carriage bottom (default: 20) - + Miscellaneous options: --notes Notes to be added as comments to the output file --resolution Minimum detail resolution (mm, set zero for full resolution, default: 0) - + Flow options (advanced): --extrusion-width Set extrusion width manually; it accepts either an absolute value in mm (like 0.65) or a percentage over layer height (like 200%) @@ -364,7 +364,7 @@ Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark Set a different extrusion width for support material --infill-overlap Overlap between infill and perimeters (default: 15%) --bridge-flow-ratio Multiplier for extrusion when bridging (> 0, default: 1) - + Multiple extruder options: --extruder-offset Offset of each extruder, if firmware doesn't handle the displacement (can be specified multiple times, default: 0x0) diff --git a/package/osx/make_dmg.sh b/package/osx/make_dmg.sh index 57720f150..305298ab2 100755 --- a/package/osx/make_dmg.sh +++ b/package/osx/make_dmg.sh @@ -79,6 +79,8 @@ mkdir -p $resourcefolder echo "Copying resources..." cp -rf $SLIC3R_DIR/var $resourcefolder/ mv $resourcefolder/var/Slic3r.icns $resourcefolder +mv $resourcefolder/var/stl.icns $resourcefolder +mv $resourcefolder/var/gcode.icns $resourcefolder echo "Copying Slic3r..." cp $SLIC3R_DIR/slic3r.pl $macosfolder/slic3r.pl diff --git a/package/osx/plist.sh b/package/osx/plist.sh index 2d305f405..8c62d2088 100644 --- a/package/osx/plist.sh +++ b/package/osx/plist.sh @@ -36,66 +36,83 @@ cat << EOF >> $plistfile CFBundleVersion ${SLIC3R_BUILD_ID} CFBundleDocumentTypes - - - CFBundleTypeExtensions - - stl - STL - - CFBundleTypeIconFile - Slic3r.icns - CFBundleTypeName - STL - CFBundleTypeRole - Viewer - LISsAppleDefaultForType - - LSHandlerRank - Alternate - - - CFBundleTypeExtensions - - obj - OBJ - - CFBundleTypeIconFile - Slic3r.icns - CFBundleTypeName - STL - CFBundleTypeRole - Viewer - LISsAppleDefaultForType - - LSHandlerRank - Alternate - - - CFBundleTypeExtensions - - amf - AMF - - CFBundleTypeIconFile - Slic3r.icns - CFBundleTypeName - STL - CFBundleTypeRole - Viewer - LISsAppleDefaultForType - - LSHandlerRank - Alternate - - - LSMinimumSystemVersion - 10.7 + + + CFBundleTypeExtensions + + stl + STL + + CFBundleTypeIconFile + stl.icns + CFBundleTypeName + STL + CFBundleTypeRole + Viewer + LISsAppleDefaultForType + + LSHandlerRank + Alternate + + + CFBundleTypeExtensions + + obj + OBJ + + CFBundleTypeIconFile + Slic3r.icns + CFBundleTypeName + STL + CFBundleTypeRole + Viewer + LISsAppleDefaultForType + + LSHandlerRank + Alternate + + + CFBundleTypeExtensions + + amf + AMF + + CFBundleTypeIconFile + Slic3r.icns + CFBundleTypeName + STL + CFBundleTypeRole + Viewer + LISsAppleDefaultForType + + LSHandlerRank + Alternate + + + CFBundleTypeExtensions + + gcode + GCODE + + CFBundleTypeIconFile + gcode.icns + CFBundleTypeName + GCODE + CFBundleTypeRole + Editor + LISsAppleDefaultForType + + LSHandlerRank + Alternate + + + LSMinimumSystemVersion + 10.7 NSPrincipalClass NSApplication NSHighResolutionCapable - + EOF diff --git a/var/gcode.icns b/var/gcode.icns new file mode 100755 index 0000000000000000000000000000000000000000..d5be3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w2{eNHp0R8`yzrX!%b71`af#C-N#^3J_pr5P&#vd^L{&f!k{`Zq^ z_Pfmi|NGaY4+PBrKO6r8#^3Ms0N{Us|NZM80PcUk<32xK4EW!_9(}<55AeUAcC_CC z0Q?W|zkl5WfdBoD`}}k<;D7&m^a1xj!2f>Q(S8R2@IS!+{&f!k{`WiX^V7wE|NZOH z2i*Sv|NCi2`yBwl{{a8{*F6CE-|x83PZ$3&|NB|~+3%Z~{)hhlYsydZ-~Mm(Px;rQ z4+L^bG+Vds-rZlfeT7SO`Xl-$@4ETW1MKq`Z(xsyH+TJ^zdsy5ZNZu?J9qE-OSj!S zx2#z(ZTuhk{D2J51ONZ&f$Lw_0T}RS*8!My{^I4oZ|5&u`g-yE-FNqYoE;wx>hn8I z9{!K=|5y8FtkW;5Yw<8vWggrF9`@gfDOLDm-b=mg>a31yTCJ*rNP&2-Qk4K%;051=fvn}~~ zs3}aKVWfONq&%(fstp~K=P}}MqsQbiD?Ti zbRV>)`=Ff@+tLh&r(5nv^v3A;IA{oCt(0%X7xJpcdz literal 0 HcmV?d00001 diff --git a/var/gcode.ico b/var/gcode.ico new file mode 100755 index 0000000000000000000000000000000000000000..b119b38f48b7ef59b528983284ce34fb980b60ad GIT binary patch literal 120914 zcmbSyWmr{R)a^P!r-U>d>5?*NI3TTrw6uVfNJ#e~r9q^WR6-Ex<|U;>Kw3a)1PSRl zG4B-E}waLpO=$_gostR(t-aoej@X|9UJdUT$YD%g;sg$TuTO_W*AELq% zsf`jzy4<6-EqZAytgdADoO>g}WL=|NZw*oY@mk`#RaPn7-Q$i>l5fH4Jt?hG{I6u| zvTdi)&1NU?%*ONErH!rU&g<4c8E>;1&Hww;@-c`18(&D2~Nx=wMe{$JC^2fTz`7qR<^6Rtmw&Q_2L;k)+n%^F~j89G~$Hm3f zIM25hdd>O#X&=*+z3hJX?wyxvNnqA{b#!|%GL@SRER1QyNk@NoCP zQ^LL*#UHOWm1WOHbR3F&M`IHRP)ZN*;5Yx>!!750Mr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ry{G;Bb z%<_+ZYpy4QF}SYysEf@HN8Ehr`@m5BwjAqaFewMWc?RpUa{evL$TbKshS|a1Z?g#M z_bEfvAM#yeZsY~O&-FdX1K9D;5JS)rKk1O~kKb2im%nN6A7zj4bG!pF7@bLvqkrsw zaGxUTGTJ`&q(AT+pXWS(ej9X?=kb5>9Eg$w4>1SpX6&V`_-$9Dz?<-T+_cDE$A8x- z`YF;PWkV7_g_{jc)e~*3qX|D9`8NRlrkgjpPVgN)hVk}ot~HH>_#?)*-b0Ki-WgJD_5@4ywUHNF>AKAWZ7~(_B5zZU)Y|ofAB7CG(NAszZ~mn-MPc{wGQe1 zsosba=kxroth>he48F^8Q$DZ0&-U!@-TT^f#QM?ZU%6_vZXX;!enM;0ww=BXAKPiM zQTV+2{)=@f@9S&b(Wd+!YZcH|-2uJD{swIwj*&mX7##IGpI6^!TS|O5hF%MHDc@oI zh&~?8GNawm$MNtk+m48~H}WSopwCWvPhyOy71mT64ZGpRyRhl-?u?nU^!~iw?%;hs zANev4Hevl{j^z^{u1Ci;=Z>EU#~coTYH~lYl1DmyL-=GZ6^9E3$Zp+ z2x!}Zb>1A82e3S36+)T#zLlH+I*y_A8yvuKMEj9LQ z@b07Ee*4W!{XWO>t$mlj$M?CmDc*f{;o|w0>bpGV`%xv7@hR3S>!H3IhE_aU2|F=| ICAC=o4|PdXm;e9( literal 0 HcmV?d00001 diff --git a/var/slt.ico b/var/slt.ico new file mode 100755 index 0000000000000000000000000000000000000000..274c69979a8bdc7bbe6658e7d228e4083ac99b17 GIT binary patch literal 116921 zcmbq)gIEL*n+RI*#EueML>XW;CmR% z|6MBsz@#<=5E1#`>!O?Bb1e8x^#5I>0HC-M0-(U>>+$U20ASb&0p1wssgn^i5radM zX=X zmN!O8Dcjuuo|R?L{r~e=WDDI{kt+LIHulFZ{Ex;^-;wao8qcKwvm^6t(jr@{f0cb7 zUmdKOm(~vupCm{*|LpxB<{U-(AJ&ns05#1tK{x91x3}O1=@ImZeBepQ2Lw9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Jj$_A;;rponWZ~fSK>b6fAK#at@`3sUkCV-heL@`_-VL!4ZPx+(R&C+F`inH%4Uhwy2Zlc5};}CG*n=^RL1+2R; zbLLE1ym+zd&*X2T&-;HlI6d%v$Sn?`TaSeY@@4|<=-yNp~r3R^|-Ajpe5EO^iyQ!5WqqDDatsp zR9(AvB~JtYwBzX4uOHXPurJF!$1Z)oW`BNeOR{hF+s)c5|Jg=g^r3@? zkEpg6#!d0O{yxgH*w_cuf6*G=pQov6gP{G9g?(C47b?bku?!kF!B!@78Gz^Y_c6A5 zpZPrCmow~xxr>TUUe5KX4Qef8q_J*u-%(@veOsLa&+G4FY!LVi{P`qBK8a_4y_38) z;y!K{9OgF47+wpzKXn-tqv|UtJMg^z{;E~0xNi1{`X4z>QS4(G#$zt;XLeu>+`V|h=90n~QLXkMG`wB`F4 zTZ3ExTa0-g=DOWrUjMQAnCY~W{TWnw$KS;`|LN0b2;bAczaI5kyvyHJbt0e;QgIDcjCKG&R;y&T7MU5 eyzeS-9us)2vd{H*H*qQMRp6bNH@%V}!~X}MByGh2 literal 0 HcmV?d00001 diff --git a/var/stl.icns b/var/stl.icns new file mode 100755 index 0000000000000000000000000000000000000000..a969895986fb598721fc51bbac1adcea17f822eb GIT binary patch literal 68486 zcmbTdbChR2w=G<@yKLLGZQHhO+qP|+UFNUUg)W<2Hotz}^WJmrchC9f-m#OBtc;nA zwRf`Tm{}vSGO>370)`E@GGXKd0&+G60s?}wRwN{ZhlzmsTSql_^>Va!WG4Ju2l{uZ z@VB)5Yoc3OnmPjk0spQ3&0vs_|6qU+O&n~U|7imPLi(GDO-#+qfx!M{1OE#P0tE8c z0{#2^3*~h2cQ})8g>NMw=6_KC9`0Wq{s$Wj5*YYD)3-7Z+`qbjgMk47f9nGM5EPV@ zRQ%u5cOuX~?*Zf#`4^x91Pu)IA6PvgRN(&({tE#4F968@2mt*r0O)@Qr0jTe;^YPB zN04Kn@3}5GgeHU>;{6Id&H-j(8@Hwmb+v_Lo`=o&BI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Ra~=L79pZ>oJ9(Lk~LYHG0rhkG%+asie+&taPwigzoyL8Qs^n|CGAh zV^KY{H`KQo=R$x;KU%iFbN~PV literal 0 HcmV?d00001 From 3dfe61de4823f78ccade383529706bdcdf9bc097 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 24 Apr 2018 08:07:32 -0500 Subject: [PATCH 015/112] experiment to stub out C++ only GUI --- src/CMakeLists.txt | 58 ++++++++++++++++------------ src/GUI/GUI.cpp | 22 +++++++++++ src/GUI/GUI.hpp | 10 +++++ src/GUI/MainFrame.cpp | 90 +++++++++++++++++++++++++++++++++++++++++++ src/GUI/MainFrame.hpp | 31 +++++++++++++++ src/slic3r.cpp | 6 +++ 6 files changed, 193 insertions(+), 24 deletions(-) create mode 100644 src/GUI/GUI.cpp create mode 100644 src/GUI/GUI.hpp create mode 100644 src/GUI/MainFrame.cpp create mode 100644 src/GUI/MainFrame.hpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fb34b5ae8..0bdf4397a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 3.10) project (slic3r) # only on newer GCCs: -ftemplate-backtrace-limit=0 @@ -17,14 +17,17 @@ IF(CMAKE_HOST_APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_NO_CXX11_RVALUE_REFERENCES -DBOOST_THREAD_USES_MOVE") set(CMAKE_EXE_LINKER_FLAGS "-framework IOKit -framework CoreFoundation -lc++") ELSE(CMAKE_HOST_APPLE) - set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++") +# set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -L.") ENDIF(CMAKE_HOST_APPLE) -set(Boost_USE_STATIC_LIBS ON) -set(Boost_USE_STATIC_RUNTIME ON) -set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + +set(Boost_USE_STATIC_LIBS OFF) +set(Boost_USE_STATIC_RUNTIME OFF) +find_package(Threads REQUIRED) + find_package(Boost COMPONENTS system thread filesystem) set(LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/../xs/src/) +set(GUI_LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/GUI/) include_directories(${LIBDIR}) include_directories(${LIBDIR}/libslic3r) @@ -53,6 +56,7 @@ add_library(libslic3r STATIC ${LIBDIR}/libslic3r/Fill/FillHoneycomb.cpp ${LIBDIR}/libslic3r/Fill/FillPlanePath.cpp ${LIBDIR}/libslic3r/Fill/FillRectilinear.cpp + ${LIBDIR}/libslic3r/Fill/FillGyroid.cpp ${LIBDIR}/libslic3r/Flow.cpp ${LIBDIR}/libslic3r/GCode.cpp ${LIBDIR}/libslic3r/GCode/CoolingBuffer.cpp @@ -122,29 +126,29 @@ add_library(poly2tri STATIC ) add_executable(slic3r slic3r.cpp) -set_target_properties(slic3r PROPERTIES LINK_SEARCH_START_STATIC 1) -set_target_properties(slic3r PROPERTIES LINK_SEARCH_END_STATIC 1) +#set_target_properties(slic3r PROPERTIES LINK_SEARCH_START_STATIC 1) +#set_target_properties(slic3r PROPERTIES LINK_SEARCH_END_STATIC 1) -add_executable(extrude-tin utils/extrude-tin.cpp) -set_target_properties(extrude-tin PROPERTIES LINK_SEARCH_START_STATIC 1) -set_target_properties(extrude-tin PROPERTIES LINK_SEARCH_END_STATIC 1) +#add_executable(extrude-tin utils/extrude-tin.cpp) +#set_target_properties(extrude-tin PROPERTIES LINK_SEARCH_START_STATIC 1) +#set_target_properties(extrude-tin PROPERTIES LINK_SEARCH_END_STATIC 1) -set(wxWidgets_USE_STATIC) -SET(wxWidgets_USE_LIBS) +set(Boost_USE_STATIC_LIBS OFF) +set(Boost_USE_STATIC_RUNTIME OFF) -set(Boost_USE_STATIC_LIBS ON) -set(Boost_USE_STATIC_RUNTIME ON) -set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") find_library(bsystem_l boost_system) -add_library(bsystem STATIC IMPORTED) +add_library(bsystem SHARED IMPORTED) set_target_properties(bsystem PROPERTIES IMPORTED_LOCATION ${bsystem_l}) find_library(bthread_l boost_thread) -add_library(bthread STATIC IMPORTED) +add_library(bthread SHARED IMPORTED) set_target_properties(bthread PROPERTIES IMPORTED_LOCATION ${bthread_l}) include_directories(${Boost_INCLUDE_DIRS}) -#find_package(wxWidgets) -#disable wx for the time being - we're not building any of the gui yet +set(wxWidgets_USE_STATIC OFF) +set(wxWidgets_USE_UNICODE ON) + +find_package(wxWidgets COMPONENTS base aui core) + IF(CMAKE_HOST_UNIX) #set(Boost_LIBRARIES bsystem bthread bfilesystem) ENDIF(CMAKE_HOST_UNIX) @@ -154,9 +158,15 @@ target_link_libraries (slic3r libslic3r admesh BSpline clipper expat polypartiti IF(wxWidgets_FOUND) MESSAGE("wx found!") INCLUDE("${wxWidgets_USE_FILE}") - add_library(slic3r_gui STATIC ${LIBDIR}/slic3r/GUI/3DScene.cpp ${LIBDIR}/slic3r/GUI/GUI.cpp) + include_directories(${GUI_LIBDIR}) + include_directories(${wxWidgets_INCLUDE}) + + add_library(slic3r_gui STATIC + ${GUI_LIBDIR}/MainFrame.cpp + ${GUI_LIBDIR}/GUI.cpp + ) #only build GUI lib if building with wx - target_link_libraries (slic3r slic3r-gui ${wxWidgets_LIBRARIES}) + target_link_libraries (slic3r slic3r_gui ${wxWidgets_LIBRARIES}) ELSE(wxWidgets_FOUND) # For convenience. When we cannot continue, inform the user MESSAGE("wx not found!") @@ -169,8 +179,8 @@ IF (WIN32) ${LIBDIR}/boost/nowide/iostream.cpp ) - target_link_libraries(slic3r boost-nowide) - target_link_libraries(extrude-tin boost-nowide) + target_link_libraries(slic3r STATIC boost-nowide) +# target_link_libraries(extrude-tin boost-nowide) ENDIF(WIN32) -target_link_libraries (extrude-tin libslic3r admesh BSpline clipper expat polypartition poly2tri ${Boost_LIBRARIES}) +#target_link_libraries (extrude-tin libslic3r admesh BSpline clipper expat polypartition poly2tri ${Boost_LIBRARIES}) diff --git a/src/GUI/GUI.cpp b/src/GUI/GUI.cpp new file mode 100644 index 000000000..3c669754f --- /dev/null +++ b/src/GUI/GUI.cpp @@ -0,0 +1,22 @@ +#include +#ifndef WX_PRECOMP + #include +#endif + +#include "MainFrame.hpp" +#include "GUI.hpp" +//using namespace Slic3r; + + +enum +{ + ID_Hello = 1 +}; +bool Slic3rGUI::OnInit() +{ + MainFrame *frame = new MainFrame( "Slic3r", wxDefaultPosition, wxDefaultSize); + + frame->Show( true ); + return true; +} + diff --git a/src/GUI/GUI.hpp b/src/GUI/GUI.hpp new file mode 100644 index 000000000..d287c9a9b --- /dev/null +++ b/src/GUI/GUI.hpp @@ -0,0 +1,10 @@ +#ifndef GUI_HPP +#define GUI_HPP +#include "MainFrame.hpp" +class Slic3rGUI: public wxApp +{ +public: + virtual bool OnInit(); +}; + +#endif // GUI_HPP diff --git a/src/GUI/MainFrame.cpp b/src/GUI/MainFrame.cpp new file mode 100644 index 000000000..d21d2767e --- /dev/null +++ b/src/GUI/MainFrame.cpp @@ -0,0 +1,90 @@ +#include "MainFrame.hpp" + +wxBEGIN_EVENT_TABLE(MainFrame, wxFrame) +wxEND_EVENT_TABLE() + +MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size) + : wxFrame(NULL, wxID_ANY, title, pos, size), loaded(false), + tabpanel(NULL) +{ + // Set icon to either the .ico if windows or png for everything else. + + this->init_tabpanel(); + this->init_menubar(); + + wxToolTip::SetAutoPop(TOOLTIP_TIMER); + + // STUB: Initialize status bar with text. + /* # initialize status bar + $self->{statusbar} = Slic3r::GUI::ProgressStatusBar->new($self, -1); + $self->{statusbar}->SetStatusText("Version $Slic3r::VERSION - Remember to check for updates at http://slic3r.org/"); + $self->SetStatusBar($self->{statusbar}); */ + + this->loaded = 1; + + // Initialize layout + { + wxSizer* sizer = new wxBoxSizer(wxVERTICAL); + sizer->Add(this->tabpanel, 1, wxEXPAND); + sizer->SetSizeHints(this); + this->Fit(); + this->SetMinSize(wxSize(760, 490)); + this->SetSize(this->GetMinSize()); + wxTheApp->SetTopWindow(this); + this->Show(); + this->Layout(); + } + +} + +/// Private initialization function for the main frame tab panel. +void MainFrame::init_tabpanel() +{ + this->tabpanel = new wxAuiNotebook(this, -1, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TOP); + auto panel = this->tabpanel; + + panel->Bind(wxEVT_AUINOTEBOOK_PAGE_CHANGED, ([=](wxAuiNotebookEvent& e) + { + auto panel = this->tabpanel->GetPage(this->tabpanel->GetSelection()); + if panel->can('OnActivate') panel->OnActivate(); + }), panel->GetId()); + +// this->plater = Slic3r::GUI::Plater(panel, _("Plater")); +// this->controller = Slic3r::GUI::Controller(panel, _("Controller")); + +/* +sub _init_tabpanel { + my ($self) = @_; + + $self->{tabpanel} = my $panel = Wx::AuiNotebook->new($self, -1, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TOP); + EVT_AUINOTEBOOK_PAGE_CHANGED($self, $self->{tabpanel}, sub { + my $panel = $self->{tabpanel}->GetPage($self->{tabpanel}->GetSelection); + $panel->OnActivate if $panel->can('OnActivate'); + if ($self->{tabpanel}->GetSelection > 1) { + $self->{tabpanel}->SetWindowStyle($self->{tabpanel}->GetWindowStyleFlag | wxAUI_NB_CLOSE_ON_ACTIVE_TAB); + } elsif(($Slic3r::GUI::Settings->{_}{show_host} == 0) && ($self->{tabpanel}->GetSelection == 1)){ + $self->{tabpanel}->SetWindowStyle($self->{tabpanel}->GetWindowStyleFlag | wxAUI_NB_CLOSE_ON_ACTIVE_TAB); + } else { + $self->{tabpanel}->SetWindowStyle($self->{tabpanel}->GetWindowStyleFlag & ~wxAUI_NB_CLOSE_ON_ACTIVE_TAB); + } + }); + EVT_AUINOTEBOOK_PAGE_CLOSE($self, $self->{tabpanel}, sub { + my $panel = $self->{tabpanel}->GetPage($self->{tabpanel}->GetSelection); + if ($panel->isa('Slic3r::GUI::PresetEditor')) { + delete $self->{preset_editor_tabs}{$panel->name}; + } + wxTheApp->CallAfter(sub { + $self->{tabpanel}->SetSelection(0); + }); + }); + + $panel->AddPage($self->{plater} = Slic3r::GUI::Plater->new($panel), "Plater"); + $panel->AddPage($self->{controller} = Slic3r::GUI::Controller->new($panel), "Controller") + if ($Slic3r::GUI::Settings->{_}{show_host}); +*/ + +} + +void MainFrame::init_menubar() +{ +} diff --git a/src/GUI/MainFrame.hpp b/src/GUI/MainFrame.hpp new file mode 100644 index 000000000..a1b32feb8 --- /dev/null +++ b/src/GUI/MainFrame.hpp @@ -0,0 +1,31 @@ + +#ifndef MAINFRAME_HPP +#define MAINFRAME_HPP +#include +#ifndef WX_PRECOMP + #include +#endif +#include +#include + +constexpr unsigned int TOOLTIP_TIMER = 32767; + +class MainFrame: public wxFrame +{ +public: + MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size); +private: + wxDECLARE_EVENT_TABLE(); + + void init_menubar(); //< Routine to intialize all top-level menu items. + void init_tabpanel(); //< Routine to initialize all of the tabs. + + bool loaded; //< Main frame itself has finished loading. + // STUB: preset editor tabs storage + // STUB: Statusbar reference + + wxAuiNotebook* tabpanel; + +}; + +#endif // MAINFRAME_HPP diff --git a/src/slic3r.cpp b/src/slic3r.cpp index bf2fb2be7..558d3f810 100644 --- a/src/slic3r.cpp +++ b/src/slic3r.cpp @@ -13,6 +13,7 @@ #include #include #include +#include "GUI/GUI.hpp" using namespace Slic3r; @@ -39,6 +40,11 @@ main(int argc, char **argv) cli_config.apply(config, true); DynamicPrintConfig print_config; + + Slic3rGUI *gui = new Slic3rGUI; + + Slic3rGUI::SetInstance(gui); + wxEntry(argc, argv); // load config files supplied via --load for (const std::string &file : cli_config.load.values) { From a06755c3dd27d345faf308ba79aed53d039ff77b Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 24 Apr 2018 16:05:47 -0500 Subject: [PATCH 016/112] Exercise build environment. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 864d76b3c..4f2b0580b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,7 @@ branches: only: - master - xsgui + - cppgui cache: apt: true directories: From b04d58ecef7d6afe3cd6947b846ca6eb96708277 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 24 Apr 2018 17:21:18 -0500 Subject: [PATCH 017/112] Stubbing out more of the UI. --- src/GUI/Controller.hpp | 15 +++++++++++++++ src/GUI/GUI.cpp | 7 ++++--- src/GUI/GUI.hpp | 7 ++++++- src/GUI/MainFrame.cpp | 24 ++++++++++++++++++++---- src/GUI/MainFrame.hpp | 15 +++++++++++++++ src/GUI/Plater.hpp | 17 +++++++++++++++++ src/GUI/Settings.hpp | 15 +++++++++++++++ src/slic3r.cpp | 6 ++++-- 8 files changed, 96 insertions(+), 10 deletions(-) create mode 100644 src/GUI/Controller.hpp create mode 100644 src/GUI/Plater.hpp create mode 100644 src/GUI/Settings.hpp diff --git a/src/GUI/Controller.hpp b/src/GUI/Controller.hpp new file mode 100644 index 000000000..ef3650886 --- /dev/null +++ b/src/GUI/Controller.hpp @@ -0,0 +1,15 @@ +#ifndef CONTROLLER_UI_HPP +#define CONTROLLER_UI_HPP + +namespace Slic3r { namespace GUI { + +class Controller : public wxPanel { +public: + Controller(wxWindow* parent, const wxString& title) : + wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, title) + { } +}; + +}} // Namespace Slic3r::GUI + +#endif // CONTROLLER_UI_HPP diff --git a/src/GUI/GUI.cpp b/src/GUI/GUI.cpp index 3c669754f..7c249b3b0 100644 --- a/src/GUI/GUI.cpp +++ b/src/GUI/GUI.cpp @@ -5,18 +5,19 @@ #include "MainFrame.hpp" #include "GUI.hpp" -//using namespace Slic3r; +namespace Slic3r { namespace GUI { enum { ID_Hello = 1 }; -bool Slic3rGUI::OnInit() +bool App::OnInit() { - MainFrame *frame = new MainFrame( "Slic3r", wxDefaultPosition, wxDefaultSize); + MainFrame *frame = new MainFrame( "Slic3r", wxDefaultPosition, wxDefaultSize, this->gui_config); frame->Show( true ); return true; } +}} // namespace Slic3r::GUI diff --git a/src/GUI/GUI.hpp b/src/GUI/GUI.hpp index d287c9a9b..1339d1d34 100644 --- a/src/GUI/GUI.hpp +++ b/src/GUI/GUI.hpp @@ -1,10 +1,15 @@ #ifndef GUI_HPP #define GUI_HPP #include "MainFrame.hpp" -class Slic3rGUI: public wxApp + +namespace Slic3r { namespace GUI { +class App: public wxApp { + std::shared_ptr gui_config; // GUI-specific configuration options public: virtual bool OnInit(); + App(std::shared_ptr config) : wxApp(), gui_config(config) {} }; +}} // namespace Slic3r::GUI #endif // GUI_HPP diff --git a/src/GUI/MainFrame.cpp b/src/GUI/MainFrame.cpp index d21d2767e..c3684c27b 100644 --- a/src/GUI/MainFrame.cpp +++ b/src/GUI/MainFrame.cpp @@ -1,11 +1,17 @@ #include "MainFrame.hpp" +#include "Plater.hpp" +#include "Controller.hpp" + +namespace Slic3r { namespace GUI { wxBEGIN_EVENT_TABLE(MainFrame, wxFrame) wxEND_EVENT_TABLE() MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size) + : MainFrame(title, pos, size, nullptr) {} +MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size, std::shared_ptr config) : wxFrame(NULL, wxID_ANY, title, pos, size), loaded(false), - tabpanel(NULL) + tabpanel(nullptr), controller(nullptr), plater(nullptr), gui_config(config) { // Set icon to either the .ico if windows or png for everything else. @@ -46,11 +52,19 @@ void MainFrame::init_tabpanel() panel->Bind(wxEVT_AUINOTEBOOK_PAGE_CHANGED, ([=](wxAuiNotebookEvent& e) { auto panel = this->tabpanel->GetPage(this->tabpanel->GetSelection()); - if panel->can('OnActivate') panel->OnActivate(); + auto tabpanel = this->tabpanel; + // todo: trigger processing for activation(?) + if (tabpanel->GetSelection() > 1) { + tabpanel->SetWindowStyle(tabpanel->GetWindowStyleFlag() | wxAUI_NB_CLOSE_ON_ACTIVE_TAB); + } else if (this->gui_config->show_host == false && tabpanel->GetSelection() == 1) { + tabpanel->SetWindowStyle(tabpanel->GetWindowStyleFlag() | wxAUI_NB_CLOSE_ON_ACTIVE_TAB); + } else { + tabpanel->SetWindowStyle(tabpanel->GetWindowStyleFlag() | ~wxAUI_NB_CLOSE_ON_ACTIVE_TAB); + } }), panel->GetId()); -// this->plater = Slic3r::GUI::Plater(panel, _("Plater")); -// this->controller = Slic3r::GUI::Controller(panel, _("Controller")); + this->plater = new Slic3r::GUI::Plater(panel, _("Plater")); + this->controller = new Slic3r::GUI::Controller(panel, _("Controller")); /* sub _init_tabpanel { @@ -88,3 +102,5 @@ sub _init_tabpanel { void MainFrame::init_menubar() { } + +}} // Namespace Slic3r::GUI diff --git a/src/GUI/MainFrame.hpp b/src/GUI/MainFrame.hpp index a1b32feb8..8631ac78a 100644 --- a/src/GUI/MainFrame.hpp +++ b/src/GUI/MainFrame.hpp @@ -8,12 +8,21 @@ #include #include +#include + +#include "Controller.hpp" +#include "Plater.hpp" +#include "Settings.hpp" + +namespace Slic3r { namespace GUI { + constexpr unsigned int TOOLTIP_TIMER = 32767; class MainFrame: public wxFrame { public: MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size); + MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size, std::shared_ptr gui_config); private: wxDECLARE_EVENT_TABLE(); @@ -25,7 +34,13 @@ private: // STUB: Statusbar reference wxAuiNotebook* tabpanel; + Controller* controller; + Plater* plater; + + + std::shared_ptr gui_config; }; +}} // Namespace Slic3r::GUI #endif // MAINFRAME_HPP diff --git a/src/GUI/Plater.hpp b/src/GUI/Plater.hpp new file mode 100644 index 000000000..bf7aa917a --- /dev/null +++ b/src/GUI/Plater.hpp @@ -0,0 +1,17 @@ +#ifndef PLATER_HPP +#define PLATER_HPP + +namespace Slic3r { namespace GUI { + +class Plater : public wxPanel +{ +public: + Plater(wxWindow* parent, const wxString& title) : + wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, title) + { } + +}; + +} } // Namespace Slic3r::GUI + +#endif // PLATER_HPP diff --git a/src/GUI/Settings.hpp b/src/GUI/Settings.hpp new file mode 100644 index 000000000..07e219406 --- /dev/null +++ b/src/GUI/Settings.hpp @@ -0,0 +1,15 @@ +#ifndef SETTINGS_HPP +#define SETTINGS_HPP +namespace Slic3r { namespace GUI { + +/// Stub class to hold onto GUI-specific settings options. +/// TODO: Incorporate a copy of Slic3r::Config +class Settings { + public: + bool show_host; + Settings(): show_host(false) {} //< Show host/controller tab +}; + +}} //namespace Slic3r::GUI + +#endif // SETTINGS_HPP diff --git a/src/slic3r.cpp b/src/slic3r.cpp index 558d3f810..9dc862400 100644 --- a/src/slic3r.cpp +++ b/src/slic3r.cpp @@ -41,9 +41,11 @@ main(int argc, char **argv) DynamicPrintConfig print_config; - Slic3rGUI *gui = new Slic3rGUI; + std::shared_ptr gui_config = std::make_shared(); - Slic3rGUI::SetInstance(gui); + GUI::App *gui = new GUI::App(gui_config); + + GUI::App::SetInstance(gui); wxEntry(argc, argv); // load config files supplied via --load From 2c93cf9019bbed3cf4f923699b719fa7afd6cb3a Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 24 Apr 2018 17:26:59 -0500 Subject: [PATCH 018/112] Ignore CMake-generated files, static libraries, coredumps, and the odd git-renamed file. --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index c8c13aed4..8cac56759 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,9 @@ package/osx/Slic3r*.app *.dmg *.swp *.swo +CMakeFiles +*.orig +*.a +core +CMakeCache.txt +*.cmake From 17daf0d908e3993b14bc34fee412191046b7d692 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 24 Apr 2018 17:32:40 -0500 Subject: [PATCH 019/112] Try to get travis to build cppgui instead. --- .travis.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4f2b0580b..a0f8c92c9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,8 @@ install: script: - bash package/linux/travis-setup.sh - perlbrew switch slic3r-perl -- perl ./Build.PL +- cmake src/ +- make -j4 after_success: - eval $(perl -Mlocal::lib=$TRAVIS_BUILD_DIR/local-lib) - LD_LIBRARY_PATH=$WXDIR/lib package/linux/make_archive.sh linux-x64 @@ -37,6 +38,10 @@ addons: - libgtk2.0-0 - libgtk2.0-dev - freeglut3 + - cmake + - wx3.0-headers + - libwxgtk3.0-dev + - wx-common ssh_known_hosts: dl.slic3r.org notifications: irc: From d8a743d1779fbd7a5cd85abf2321eedf916c6614 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 24 Apr 2018 18:35:29 -0500 Subject: [PATCH 020/112] If M190, M109, M104, or M140 commands are not present in end gcode, append commands to shut off all hotends and the bed (same as start gcode). --- lib/Slic3r/Print/GCode.pm | 20 ++++++++++++++++++++ xs/src/libslic3r/PrintConfig.cpp | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/Slic3r/Print/GCode.pm b/lib/Slic3r/Print/GCode.pm index f3e423fba..39eeafa9f 100644 --- a/lib/Slic3r/Print/GCode.pm +++ b/lib/Slic3r/Print/GCode.pm @@ -153,6 +153,10 @@ sub export { foreach my $start_gcode (@{ $self->config->start_filament_gcode }) { # process filament gcode in order $include_start_extruder_temp = $include_start_extruder_temp && ($start_gcode !~ /M(?:109|104)/i); } + my $include_end_extruder_temp = $self->config->end_gcode !~ /M(?:109|104)/i; + foreach my $end_gcode (@{ $self->config->end_filament_gcode }) { # process filament gcode in order + $include_end_extruder_temp = $include_end_extruder_temp && ($end_gcode !~ /M(?:109|104)/i); + } $self->_print_first_layer_temperature(0) if $include_start_extruder_temp; printf $fh "%s\n", Slic3r::ConditionalGCode::apply_math($gcodegen->placeholder_parser->process($self->config->start_gcode)); @@ -301,6 +305,12 @@ sub export { printf $fh "%s\n", Slic3r::ConditionalGCode::apply_math($gcodegen->placeholder_parser->process($end_gcode)); } printf $fh "%s\n", Slic3r::ConditionalGCode::apply_math($gcodegen->placeholder_parser->process($self->config->end_gcode)); + + $self->_print_off_temperature(0) + if $include_end_extruder_temp; + print $fh $self->_gcodegen->writer->set_bed_temperature(0, 0) + if $include_end_extruder_temp; + print $fh $gcodegen->writer->update_progress($gcodegen->layer_count, $gcodegen->layer_count, 1); # 100% print $fh $gcodegen->writer->postamble; @@ -356,6 +366,16 @@ sub _print_first_layer_temperature { } } +sub _print_off_temperature { + my ($self, $wait) = @_; + + for my $t (@{$self->print->extruders}) { + printf {$self->fh} $self->_gcodegen->writer->set_temperature(0, $wait, $t) + } +} + + + # Called per object's layer. # First a $gcode string is collected, # then filtered and finally written to a file $fh. diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index aeb240792..0287c12bf 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -221,7 +221,7 @@ PrintConfigDef::PrintConfigDef() def = this->add("end_gcode", coString); def->label = "End G-code"; - def->tooltip = "This end procedure is inserted at the end of the output file. Note that you can use placeholder variables for all Slic3r settings."; + def->tooltip = "This end procedure is inserted at the end of the output file. Note that you can use placeholder variables for all Slic3r settings. If Slic3r detects M104, M109, M140 or M190 in your custom codes, such commands will not be prepended automatically so you're free to customize the order of heating commands and other custom actions."; def->cli = "end-gcode=s"; def->multiline = true; def->full_width = true; @@ -230,7 +230,7 @@ PrintConfigDef::PrintConfigDef() def = this->add("end_filament_gcode", coStrings); def->label = "End G-code"; - def->tooltip = "This end procedure is inserted at the end of the output file, before the printer end gcode. Note that you can use placeholder variables for all Slic3r settings. If you have multiple extruders, the gcode is processed in extruder order."; + def->tooltip = "This end procedure is inserted at the end of the output file, before the printer end gcode. Note that you can use placeholder variables for all Slic3r settings. If you have multiple extruders, the gcode is processed in extruder order. If Slic3r detects M104, M109, M140 or M190 in your custom codes, such commands will not be prepended automatically so you're free to customize the order of heating commands and other custom actions."; def->cli = "end-filament-gcode=s@"; def->multiline = true; def->full_width = true; From 0ea8853f6f91d791a724b0d9334d7685083d8e43 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 24 Apr 2018 18:49:14 -0500 Subject: [PATCH 021/112] Build Experiment - see if build completes without sudo: required. (#4051) --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 864d76b3c..f76e6822f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,7 +44,6 @@ notifications: on_success: change on_failure: always use_notice: true -sudo: required dist: trusty env: matrix: From 44dc572bf70eb337f027c469fda01526bf8241e0 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 24 Apr 2018 19:00:25 -0500 Subject: [PATCH 022/112] Use heatbed config option to determine whether to auto-include M140 S0 at end. --- lib/Slic3r/Print/GCode.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Slic3r/Print/GCode.pm b/lib/Slic3r/Print/GCode.pm index 39eeafa9f..c98880496 100644 --- a/lib/Slic3r/Print/GCode.pm +++ b/lib/Slic3r/Print/GCode.pm @@ -308,8 +308,10 @@ sub export { $self->_print_off_temperature(0) if $include_end_extruder_temp; - print $fh $self->_gcodegen->writer->set_bed_temperature(0, 0) - if $include_end_extruder_temp; + # set bed temperature + if ($self->config->has_heatbed && $self->config->start_gcode !~ /M(?:190|140)/i) { + printf $fh $gcodegen->writer->set_bed_temperature(0, 0); + } print $fh $gcodegen->writer->update_progress($gcodegen->layer_count, $gcodegen->layer_count, 1); # 100% print $fh $gcodegen->writer->postamble; From bc145c5c732374d3c53bc7696c35a45fd0723f1e Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 24 Apr 2018 19:03:56 -0500 Subject: [PATCH 023/112] Use end_gcode, not start_code for determining to append bed cool command. --- lib/Slic3r/Print/GCode.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Slic3r/Print/GCode.pm b/lib/Slic3r/Print/GCode.pm index c98880496..514d9f785 100644 --- a/lib/Slic3r/Print/GCode.pm +++ b/lib/Slic3r/Print/GCode.pm @@ -309,7 +309,7 @@ sub export { $self->_print_off_temperature(0) if $include_end_extruder_temp; # set bed temperature - if ($self->config->has_heatbed && $self->config->start_gcode !~ /M(?:190|140)/i) { + if (($self->config->has_heatbed) && $self->config->end_gcode !~ /M(?:190|140)/i) { printf $fh $gcodegen->writer->set_bed_temperature(0, 0); } From 19bc2eabdcc5c4bee704a0073f5d5e40b68171a6 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 24 Apr 2018 20:17:04 -0500 Subject: [PATCH 024/112] Tab panel initializes. --- src/GUI/MainFrame.cpp | 78 +++++++++++++++++++++------------------- src/GUI/MainFrame.hpp | 4 +++ src/GUI/PresetEditor.hpp | 11 ++++++ src/slic3r.cpp | 2 ++ 4 files changed, 58 insertions(+), 37 deletions(-) create mode 100644 src/GUI/PresetEditor.hpp diff --git a/src/GUI/MainFrame.cpp b/src/GUI/MainFrame.cpp index c3684c27b..8c2575cf8 100644 --- a/src/GUI/MainFrame.cpp +++ b/src/GUI/MainFrame.cpp @@ -1,6 +1,4 @@ #include "MainFrame.hpp" -#include "Plater.hpp" -#include "Controller.hpp" namespace Slic3r { namespace GUI { @@ -11,7 +9,7 @@ MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& si : MainFrame(title, pos, size, nullptr) {} MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size, std::shared_ptr config) : wxFrame(NULL, wxID_ANY, title, pos, size), loaded(false), - tabpanel(nullptr), controller(nullptr), plater(nullptr), gui_config(config) + tabpanel(nullptr), controller(nullptr), plater(nullptr), gui_config(config), preset_editor_tabs(std::map()) { // Set icon to either the .ico if windows or png for everything else. @@ -40,7 +38,34 @@ MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& si this->Show(); this->Layout(); } - +/* + # declare events + EVT_CLOSE($self, sub { + my (undef, $event) = @_; + + if ($event->CanVeto) { + if (!$self->{plater}->prompt_unsaved_changes) { + $event->Veto; + return; + } + + if ($self->{controller} && $self->{controller}->printing) { + my $confirm = Wx::MessageDialog->new($self, "You are currently printing. Do you want to stop printing and continue anyway?", + 'Unfinished Print', wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT); + if ($confirm->ShowModal == wxID_NO) { + $event->Veto; + return; + } + } + } + + # save window size + wxTheApp->save_window_pos($self, "main_frame"); + + # propagate event + $event->Skip; + }); +*/ } /// Private initialization function for the main frame tab panel. @@ -51,9 +76,8 @@ void MainFrame::init_tabpanel() panel->Bind(wxEVT_AUINOTEBOOK_PAGE_CHANGED, ([=](wxAuiNotebookEvent& e) { - auto panel = this->tabpanel->GetPage(this->tabpanel->GetSelection()); auto tabpanel = this->tabpanel; - // todo: trigger processing for activation(?) + // TODO: trigger processing for activation event if (tabpanel->GetSelection() > 1) { tabpanel->SetWindowStyle(tabpanel->GetWindowStyleFlag() | wxAUI_NB_CLOSE_ON_ACTIVE_TAB); } else if (this->gui_config->show_host == false && tabpanel->GetSelection() == 1) { @@ -63,40 +87,20 @@ void MainFrame::init_tabpanel() } }), panel->GetId()); + panel->Bind(wxEVT_AUINOTEBOOK_PAGE_CLOSE, ([=](wxAuiNotebookEvent& e) + { + if (typeid(panel) == typeid(Slic3r::GUI::PresetEditor)) { + wxDELETE(this->preset_editor_tabs[panel->GetId()]); + } + wxTheApp->CallAfter([=] { this->tabpanel->SetSelection(0); }); + }), panel->GetId()); + this->plater = new Slic3r::GUI::Plater(panel, _("Plater")); this->controller = new Slic3r::GUI::Controller(panel, _("Controller")); - -/* -sub _init_tabpanel { - my ($self) = @_; - - $self->{tabpanel} = my $panel = Wx::AuiNotebook->new($self, -1, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TOP); - EVT_AUINOTEBOOK_PAGE_CHANGED($self, $self->{tabpanel}, sub { - my $panel = $self->{tabpanel}->GetPage($self->{tabpanel}->GetSelection); - $panel->OnActivate if $panel->can('OnActivate'); - if ($self->{tabpanel}->GetSelection > 1) { - $self->{tabpanel}->SetWindowStyle($self->{tabpanel}->GetWindowStyleFlag | wxAUI_NB_CLOSE_ON_ACTIVE_TAB); - } elsif(($Slic3r::GUI::Settings->{_}{show_host} == 0) && ($self->{tabpanel}->GetSelection == 1)){ - $self->{tabpanel}->SetWindowStyle($self->{tabpanel}->GetWindowStyleFlag | wxAUI_NB_CLOSE_ON_ACTIVE_TAB); - } else { - $self->{tabpanel}->SetWindowStyle($self->{tabpanel}->GetWindowStyleFlag & ~wxAUI_NB_CLOSE_ON_ACTIVE_TAB); - } - }); - EVT_AUINOTEBOOK_PAGE_CLOSE($self, $self->{tabpanel}, sub { - my $panel = $self->{tabpanel}->GetPage($self->{tabpanel}->GetSelection); - if ($panel->isa('Slic3r::GUI::PresetEditor')) { - delete $self->{preset_editor_tabs}{$panel->name}; - } - wxTheApp->CallAfter(sub { - $self->{tabpanel}->SetSelection(0); - }); - }); - - $panel->AddPage($self->{plater} = Slic3r::GUI::Plater->new($panel), "Plater"); - $panel->AddPage($self->{controller} = Slic3r::GUI::Controller->new($panel), "Controller") - if ($Slic3r::GUI::Settings->{_}{show_host}); -*/ + panel->AddPage(this->plater, this->plater->GetName()); + if (this->gui_config->show_host) panel->AddPage(this->controller, this->controller->GetName()); + } void MainFrame::init_menubar() diff --git a/src/GUI/MainFrame.hpp b/src/GUI/MainFrame.hpp index 8631ac78a..76a2146eb 100644 --- a/src/GUI/MainFrame.hpp +++ b/src/GUI/MainFrame.hpp @@ -9,9 +9,12 @@ #include #include +#include + #include "Controller.hpp" #include "Plater.hpp" +#include "PresetEditor.hpp" #include "Settings.hpp" namespace Slic3r { namespace GUI { @@ -39,6 +42,7 @@ private: std::shared_ptr gui_config; + std::map preset_editor_tabs; }; diff --git a/src/GUI/PresetEditor.hpp b/src/GUI/PresetEditor.hpp new file mode 100644 index 000000000..8d6359eab --- /dev/null +++ b/src/GUI/PresetEditor.hpp @@ -0,0 +1,11 @@ +#ifndef PRESETEDITOR_HPP +#define PRESETEDITOR_HPP + +namespace Slic3r { namespace GUI { + +class PresetEditor : public wxPanel { + +}; + +}} // namespace Slic3r::GUI +#endif // PRESETEDITOR_HPP diff --git a/src/slic3r.cpp b/src/slic3r.cpp index 9dc862400..82a04a1f1 100644 --- a/src/slic3r.cpp +++ b/src/slic3r.cpp @@ -44,6 +44,8 @@ main(int argc, char **argv) std::shared_ptr gui_config = std::make_shared(); GUI::App *gui = new GUI::App(gui_config); + + gui_config->show_host = true; GUI::App::SetInstance(gui); wxEntry(argc, argv); From 1d4b369e733689c871a0e4f5b509c642151f8ef3 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 24 Apr 2018 20:19:31 -0500 Subject: [PATCH 025/112] Relaxed cmake version. --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0bdf4397a..30ba81484 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.10) +cmake_minimum_required (VERSION 3.9) project (slic3r) # only on newer GCCs: -ftemplate-backtrace-limit=0 From 7d9079ef62c8c1a347039d3e4a4ab28bb4a888fd Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 24 Apr 2018 20:27:24 -0500 Subject: [PATCH 026/112] set cc to gcc not g++ --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e04403854..dae9f3102 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ install: - export BOOST_DIR=$HOME/boost_1_63_0 - export SLIC3R_STATIC=1 - export CXX=g++-4.9 -- export CC=g++-4.9 +- export CC=gcc-4.9 - source $HOME/perl5/perlbrew/etc/bashrc script: - bash package/linux/travis-setup.sh From 221432d2eadea311d8f4cc22cf17a455308ce28e Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 24 Apr 2018 22:46:26 -0500 Subject: [PATCH 027/112] stub out more menus --- src/GUI/GUI.cpp | 3 +++ src/GUI/GUI.hpp | 15 +++++++++++- src/GUI/MainFrame.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++ src/GUI/MainFrame.hpp | 12 ++++++++++ 4 files changed, 84 insertions(+), 1 deletion(-) diff --git a/src/GUI/GUI.cpp b/src/GUI/GUI.cpp index 7c249b3b0..b2a1e280b 100644 --- a/src/GUI/GUI.cpp +++ b/src/GUI/GUI.cpp @@ -17,6 +17,9 @@ bool App::OnInit() MainFrame *frame = new MainFrame( "Slic3r", wxDefaultPosition, wxDefaultSize, this->gui_config); frame->Show( true ); + + this->SetAppName("Slic3r"); + return true; } diff --git a/src/GUI/GUI.hpp b/src/GUI/GUI.hpp index 1339d1d34..d4ee0461b 100644 --- a/src/GUI/GUI.hpp +++ b/src/GUI/GUI.hpp @@ -3,12 +3,25 @@ #include "MainFrame.hpp" namespace Slic3r { namespace GUI { + +enum class PresetID { + PRINT = 0, + FILAMENT = 1, + PRINTER = 2 +}; + class App: public wxApp { - std::shared_ptr gui_config; // GUI-specific configuration options public: virtual bool OnInit(); App(std::shared_ptr config) : wxApp(), gui_config(config) {} + + void check_version(bool manual) { /* stub */} + +private: + std::shared_ptr gui_config; // GUI-specific configuration options + Notifier* notifier; + }; }} // namespace Slic3r::GUI diff --git a/src/GUI/MainFrame.cpp b/src/GUI/MainFrame.cpp index 8c2575cf8..56afce0dd 100644 --- a/src/GUI/MainFrame.cpp +++ b/src/GUI/MainFrame.cpp @@ -1,4 +1,6 @@ #include "MainFrame.hpp" +#include +#include namespace Slic3r { namespace GUI { @@ -105,6 +107,59 @@ void MainFrame::init_tabpanel() void MainFrame::init_menubar() { + + wxMenu* menuFile = new wxMenu(); + { + } + + wxMenu* menuPlater = new wxMenu(); + { + } + wxMenu* menuObject = new wxMenu(); + { + } + wxMenu* menuSettings = new wxMenu(); + { + } + wxMenu* menuView = new wxMenu(); + { + } + wxMenu* menuWindow = new wxMenu(); + { + } + wxMenu* menuHelp = new wxMenu(); + { + // TODO: Reimplement config wizard + //menuHelp->AppendSeparator(); + append_menu_item(menuHelp, _("Slic3r &Website"), _("Open the Slic3r website in your browser"), [=](wxCommandEvent& e) + { + wxLaunchDefaultBrowser("http://www.slic3r.org"); + }); + append_menu_item(menuHelp, _("Check for &Updates..."), _("Check for new Slic3r versions"), [=](wxCommandEvent& e) + { +// parent->check_version(true); + }); + append_menu_item(menuHelp, _("Slic3r &Manual"), _("Open the Slic3r manual in your browser"), [=](wxCommandEvent& e) + { + wxLaunchDefaultBrowser("http://manual.slic3r.org/"); + }); + append_menu_item(menuHelp, _("&About Slic3r"), _("Show about dialog"), [=](wxCommandEvent& e) + { + }, wxID_ABOUT); + + } + + wxMenuBar* menubar = new wxMenuBar(); + menubar->Append(menuFile, _("&File")); + menubar->Append(menuPlater, _("&Plater")); + menubar->Append(menuObject, _("&Object")); + menubar->Append(menuSettings, _("&Settings")); + menubar->Append(menuView, _("&View")); + menubar->Append(menuWindow, _("&Window")); + menubar->Append(menuHelp, _("&Help")); + + this->SetMenuBar(menubar); + } }} // Namespace Slic3r::GUI diff --git a/src/GUI/MainFrame.hpp b/src/GUI/MainFrame.hpp index 76a2146eb..e4014a27c 100644 --- a/src/GUI/MainFrame.hpp +++ b/src/GUI/MainFrame.hpp @@ -16,9 +16,21 @@ #include "Plater.hpp" #include "PresetEditor.hpp" #include "Settings.hpp" +#include "GUI.hpp" namespace Slic3r { namespace GUI { +template +void append_menu_item(wxMenu* menu, const wxString& name,const wxString& help, T lambda, int id = wxID_ANY, const wxBitmap& icon = wxBitmap(), const wxString& accel = "") { + wxMenuItem* tmp = menu->Append(wxID_ANY, name, help); + wxAcceleratorEntry* a = new wxAcceleratorEntry(); + if (a->FromString(accel)) + tmp->SetAccel(a); // set the accelerator if and only if the accelerator is fine + tmp->SetHelp(help); + + menu->Bind(wxEVT_MENU, lambda, tmp->GetId(), tmp->GetId()); +} + constexpr unsigned int TOOLTIP_TIMER = 32767; class MainFrame: public wxFrame From 7211acc32df098b24365ea8b44b40c5287010865 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 24 Apr 2018 23:00:53 -0500 Subject: [PATCH 028/112] stubbed Notifier class and misc helper function --- src/CMakeLists.txt | 1 + src/GUI/GUI.hpp | 1 + src/GUI/MainFrame.cpp | 3 ++- src/GUI/Notifier.hpp | 15 +++++++++++++++ src/GUI/misc_ui.cpp | 15 +++++++++++++++ src/GUI/misc_ui.hpp | 15 +++++++++++++++ 6 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 src/GUI/Notifier.hpp create mode 100644 src/GUI/misc_ui.cpp create mode 100644 src/GUI/misc_ui.hpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 30ba81484..bd8f28ffb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -164,6 +164,7 @@ IF(wxWidgets_FOUND) add_library(slic3r_gui STATIC ${GUI_LIBDIR}/MainFrame.cpp ${GUI_LIBDIR}/GUI.cpp + ${GUI_LIBDIR}/misc_ui.cpp ) #only build GUI lib if building with wx target_link_libraries (slic3r slic3r_gui ${wxWidgets_LIBRARIES}) diff --git a/src/GUI/GUI.hpp b/src/GUI/GUI.hpp index d4ee0461b..c693e847b 100644 --- a/src/GUI/GUI.hpp +++ b/src/GUI/GUI.hpp @@ -1,6 +1,7 @@ #ifndef GUI_HPP #define GUI_HPP #include "MainFrame.hpp" +#include "Notifier.hpp" namespace Slic3r { namespace GUI { diff --git a/src/GUI/MainFrame.cpp b/src/GUI/MainFrame.cpp index 56afce0dd..547c0757b 100644 --- a/src/GUI/MainFrame.cpp +++ b/src/GUI/MainFrame.cpp @@ -1,4 +1,5 @@ #include "MainFrame.hpp" +#include "misc_ui.hpp" #include #include @@ -137,7 +138,7 @@ void MainFrame::init_menubar() }); append_menu_item(menuHelp, _("Check for &Updates..."), _("Check for new Slic3r versions"), [=](wxCommandEvent& e) { -// parent->check_version(true); + check_version(true); }); append_menu_item(menuHelp, _("Slic3r &Manual"), _("Open the Slic3r manual in your browser"), [=](wxCommandEvent& e) { diff --git a/src/GUI/Notifier.hpp b/src/GUI/Notifier.hpp new file mode 100644 index 000000000..f7a9c0d92 --- /dev/null +++ b/src/GUI/Notifier.hpp @@ -0,0 +1,15 @@ +#ifndef NOTIFIER_HPP +#define NOTIFIER_HPP + +namespace Slic3r { namespace GUI { + +/// Class to perform window manager notifications using Growl and/or DBus XWindow + +class Notifier { +public: + Notifier() { } +}; + +}} // Namespace Slic3r::GUI + +#endif // NOTIFIER_HPP diff --git a/src/GUI/misc_ui.cpp b/src/GUI/misc_ui.cpp new file mode 100644 index 000000000..b509cf097 --- /dev/null +++ b/src/GUI/misc_ui.cpp @@ -0,0 +1,15 @@ +#include "misc_ui.hpp" +namespace Slic3r { namespace GUI { + + +#ifdef SLIC3R_DEV +void check_version(bool manual) { +} +#else +void check_version(bool manual) { +} + +#endif + +}} // namespace Slic3r::GUI + diff --git a/src/GUI/misc_ui.hpp b/src/GUI/misc_ui.hpp new file mode 100644 index 000000000..83ef2646c --- /dev/null +++ b/src/GUI/misc_ui.hpp @@ -0,0 +1,15 @@ +#ifndef MISC_UI_HPP +#define MISC_UI_HPP + +/// Common static (that is, free-standing) functions, not part of an object hierarchy. + +namespace Slic3r { namespace GUI { + +/// Performs a check via the Internet for a new version of Slic3r. +/// If this version of Slic3r was compiled with SLIC3R_DEV, check the development +/// space instead of release. +void check_version(bool manual = false); + +}} // namespace Slic3r::GUI + +#endif // MISC_UI_HPP From 137716b8a36c2c46fd8dd06dc5aa010f81a57623 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 24 Apr 2018 23:52:13 -0500 Subject: [PATCH 029/112] added misc utility functions for the UI, including functions to get user home (for slic3r directory) and path to var. --- src/GUI/GUI.hpp | 5 ++++- src/GUI/MainFrame.cpp | 5 +++++ src/GUI/misc_ui.cpp | 15 +++++++++++++++ src/GUI/misc_ui.hpp | 31 ++++++++++++++++++++++++++++++- 4 files changed, 54 insertions(+), 2 deletions(-) diff --git a/src/GUI/GUI.hpp b/src/GUI/GUI.hpp index c693e847b..e6c89b90f 100644 --- a/src/GUI/GUI.hpp +++ b/src/GUI/GUI.hpp @@ -2,14 +2,17 @@ #define GUI_HPP #include "MainFrame.hpp" #include "Notifier.hpp" +#include namespace Slic3r { namespace GUI { +// Friendly indices for the preset lists. enum class PresetID { PRINT = 0, FILAMENT = 1, PRINTER = 2 }; +using preset_list = std::vector; class App: public wxApp { @@ -22,7 +25,7 @@ public: private: std::shared_ptr gui_config; // GUI-specific configuration options Notifier* notifier; - + std::vector presets { preset_list(), preset_list(), preset_list() }; }; }} // namespace Slic3r::GUI diff --git a/src/GUI/MainFrame.cpp b/src/GUI/MainFrame.cpp index 547c0757b..f006423b1 100644 --- a/src/GUI/MainFrame.cpp +++ b/src/GUI/MainFrame.cpp @@ -15,6 +15,11 @@ MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& si tabpanel(nullptr), controller(nullptr), plater(nullptr), gui_config(config), preset_editor_tabs(std::map()) { // Set icon to either the .ico if windows or png for everything else. + if (the_os == OS::Windows) + this->SetIcon(wxIcon(var("Slic3r.ico"), wxBITMAP_TYPE_ICO)); + else + this->SetIcon(wxIcon(var("Slic3r_128px.png"), wxBITMAP_TYPE_PNG)); + this->init_tabpanel(); this->init_menubar(); diff --git a/src/GUI/misc_ui.cpp b/src/GUI/misc_ui.cpp index b509cf097..278f6e4d7 100644 --- a/src/GUI/misc_ui.cpp +++ b/src/GUI/misc_ui.cpp @@ -11,5 +11,20 @@ void check_version(bool manual) { #endif +const wxString var(const wxString& in) { + wxFileName f(wxStandardPaths::Get().GetExecutablePath()); + wxString appPath(f.GetPath()); + + // replace center string with path to VAR in actual distribution later + return appPath + "/../var/" + in; +} + +/// Returns the path to Slic3r's default user data directory. +const wxString home(const wxString& in) { + if (the_os == OS::Windows) + return wxGetHomeDir() + "/" + in + "/"; + return wxGetHomeDir() + "/." + in + "/"; +} + }} // namespace Slic3r::GUI diff --git a/src/GUI/misc_ui.hpp b/src/GUI/misc_ui.hpp index 83ef2646c..cc92e5a03 100644 --- a/src/GUI/misc_ui.hpp +++ b/src/GUI/misc_ui.hpp @@ -1,15 +1,44 @@ #ifndef MISC_UI_HPP #define MISC_UI_HPP +#include +#ifndef WX_PRECOMP + #include +#endif + +#include +#include + /// Common static (that is, free-standing) functions, not part of an object hierarchy. namespace Slic3r { namespace GUI { +enum class OS { Linux, Mac, Windows } ; +// constants to reduce the proliferation of macros in the rest of the code +#ifdef __WIN32 +constexpr OS the_os = OS::Windows; +#elif __APPLE__ +constexpr OS the_os = OS::Mac; +#elif __linux__ +constexpr OS the_os = OS::Linux; +#endif + +#ifdef SLIC3R_DEV +constexpr bool isDev = true; +#else +constexpr bool isDev = false; +#endif + /// Performs a check via the Internet for a new version of Slic3r. -/// If this version of Slic3r was compiled with SLIC3R_DEV, check the development +/// If this version of Slic3r was compiled with -DSLIC3R_DEV, check the development /// space instead of release. void check_version(bool manual = false); +const wxString var(const wxString& in); + +/// Always returns path to home directory. +const wxString home(const wxString& in = "Slic3r"); + }} // namespace Slic3r::GUI #endif // MISC_UI_HPP From 0682c75541d2b484dd3cfcbc4c9640e3bab192cc Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 24 Apr 2018 23:56:09 -0500 Subject: [PATCH 030/112] point cmake to boost_root --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dae9f3102..7c46228f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,10 @@ install: script: - bash package/linux/travis-setup.sh - perlbrew switch slic3r-perl -- cmake src/ +- cmake -DBOOST_ROOT=$BOOST_DIR src/ +- cd src - make -j4 +- cd .. after_success: - eval $(perl -Mlocal::lib=$TRAVIS_BUILD_DIR/local-lib) - LD_LIBRARY_PATH=$WXDIR/lib package/linux/make_archive.sh linux-x64 From 9eefa5708934a439cd46c2bffa1c5c7a65fb701c Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Wed, 25 Apr 2018 00:10:15 -0500 Subject: [PATCH 031/112] Less magic --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7c46228f4..54876ed57 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,9 +11,7 @@ script: - bash package/linux/travis-setup.sh - perlbrew switch slic3r-perl - cmake -DBOOST_ROOT=$BOOST_DIR src/ -- cd src - make -j4 -- cd .. after_success: - eval $(perl -Mlocal::lib=$TRAVIS_BUILD_DIR/local-lib) - LD_LIBRARY_PATH=$WXDIR/lib package/linux/make_archive.sh linux-x64 From cb5456f528a6de03e6382138a15ee32a0899e2a9 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Wed, 25 Apr 2018 00:20:02 -0500 Subject: [PATCH 032/112] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 54876ed57..738368ffc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ script: - bash package/linux/travis-setup.sh - perlbrew switch slic3r-perl - cmake -DBOOST_ROOT=$BOOST_DIR src/ -- make -j4 +- make after_success: - eval $(perl -Mlocal::lib=$TRAVIS_BUILD_DIR/local-lib) - LD_LIBRARY_PATH=$WXDIR/lib package/linux/make_archive.sh linux-x64 From a677002886ee7dea234381c43ef277ca6b61d86e Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Wed, 25 Apr 2018 00:30:47 -0500 Subject: [PATCH 033/112] Update GUI.hpp --- src/GUI/GUI.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GUI/GUI.hpp b/src/GUI/GUI.hpp index e6c89b90f..82d6de746 100644 --- a/src/GUI/GUI.hpp +++ b/src/GUI/GUI.hpp @@ -3,6 +3,7 @@ #include "MainFrame.hpp" #include "Notifier.hpp" #include +#include namespace Slic3r { namespace GUI { From 78228025500280130e4f900553c561571c0f0605 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Wed, 25 Apr 2018 18:22:52 -0500 Subject: [PATCH 034/112] Rearrange initializer list in constructors to match the class order. --- xs/src/libslic3r/Model.cpp | 4 ++-- xs/src/libslic3r/PrintObject.cpp | 4 ++-- xs/src/libslic3r/SVG.hpp | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/xs/src/libslic3r/Model.cpp b/xs/src/libslic3r/Model.cpp index 2d809db65..f6f49e391 100644 --- a/xs/src/libslic3r/Model.cpp +++ b/xs/src/libslic3r/Model.cpp @@ -936,17 +936,17 @@ ModelObject::print_info() const ModelVolume::ModelVolume(ModelObject* object, const TriangleMesh &mesh) -: mesh(mesh), modifier(false), input_file(""), object(object) +: mesh(mesh), input_file(""), modifier(false), object(object) {} ModelVolume::ModelVolume(ModelObject* object, const ModelVolume &other) : name(other.name), mesh(other.mesh), config(other.config), - modifier(other.modifier), input_file(other.input_file), input_file_obj_idx(other.input_file_obj_idx), input_file_vol_idx(other.input_file_vol_idx), + modifier(other.modifier), object(object) { this->material_id(other.material_id()); diff --git a/xs/src/libslic3r/PrintObject.cpp b/xs/src/libslic3r/PrintObject.cpp index 9f93a1da1..8b6082643 100644 --- a/xs/src/libslic3r/PrintObject.cpp +++ b/xs/src/libslic3r/PrintObject.cpp @@ -9,9 +9,9 @@ namespace Slic3r { PrintObject::PrintObject(Print* print, ModelObject* model_object, const BoundingBoxf3 &modobj_bbox) : typed_slices(false), + layer_height_spline(model_object->layer_height_spline), _print(print), - _model_object(model_object), - layer_height_spline(model_object->layer_height_spline) + _model_object(model_object) { // Compute the translation to be applied to our meshes so that we work with smaller coordinates { diff --git a/xs/src/libslic3r/SVG.hpp b/xs/src/libslic3r/SVG.hpp index 83bb586c9..fbb5e3727 100644 --- a/xs/src/libslic3r/SVG.hpp +++ b/xs/src/libslic3r/SVG.hpp @@ -19,16 +19,16 @@ class SVG bool flipY; SVG(const char* afilename) : - arrows(false), fill("grey"), stroke("black"), filename(afilename), flipY(false) + arrows(false), fill("grey"), stroke("black"), flipY(false), filename(afilename) { open(filename); } SVG(const char* afilename, const BoundingBox &bbox, const coord_t bbox_offset = scale_(1.), bool aflipY = false) : - arrows(false), fill("grey"), stroke("black"), filename(afilename), origin(bbox.min - Point(bbox_offset, bbox_offset)), flipY(aflipY) + arrows(false), fill("grey"), stroke("black"), origin(bbox.min - Point(bbox_offset, bbox_offset)), flipY(aflipY), filename(afilename) { open(filename, bbox, bbox_offset, aflipY); } SVG(const std::string &filename) : - arrows(false), fill("grey"), stroke("black"), filename(filename), flipY(false) + arrows(false), fill("grey"), stroke("black"), flipY(false), filename(filename) { open(filename); } SVG(const std::string &filename, const BoundingBox &bbox, const coord_t bbox_offset = scale_(1.), bool aflipY = false) : - arrows(false), fill("grey"), stroke("black"), filename(filename), origin(bbox.min - Point(bbox_offset, bbox_offset)), flipY(aflipY) + arrows(false), fill("grey"), stroke("black"), origin(bbox.min - Point(bbox_offset, bbox_offset)), flipY(aflipY), filename(filename) { open(filename, bbox, bbox_offset, aflipY); } ~SVG() { if (f != NULL) Close(); } From 5619e41dd1ac8fb6363dd265b34bf79ba5bb0f7f Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Wed, 25 Apr 2018 18:50:33 -0500 Subject: [PATCH 035/112] Reordered initializer list. --- xs/src/libslic3r/PrintObject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xs/src/libslic3r/PrintObject.cpp b/xs/src/libslic3r/PrintObject.cpp index 8b6082643..6d60f3c6f 100644 --- a/xs/src/libslic3r/PrintObject.cpp +++ b/xs/src/libslic3r/PrintObject.cpp @@ -8,8 +8,8 @@ namespace Slic3r { PrintObject::PrintObject(Print* print, ModelObject* model_object, const BoundingBoxf3 &modobj_bbox) -: typed_slices(false), - layer_height_spline(model_object->layer_height_spline), +: layer_height_spline(model_object->layer_height_spline), + typed_slices(false), _print(print), _model_object(model_object) { From 8a93fbbd0c6ae6742997ca32d363719e3980d613 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Wed, 25 Apr 2018 18:50:51 -0500 Subject: [PATCH 036/112] Changed a few comments to doxygen format. --- xs/src/libslic3r/Print.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xs/src/libslic3r/Print.hpp b/xs/src/libslic3r/Print.hpp index 196565b57..7f83c684f 100644 --- a/xs/src/libslic3r/Print.hpp +++ b/xs/src/libslic3r/Print.hpp @@ -75,20 +75,20 @@ class PrintObject friend class Print; public: - // map of (vectors of volume ids), indexed by region_id - /* (we use map instead of vector so that we don't have to worry about - resizing it and the [] operator adds new items automagically) */ + /// map of (vectors of volume ids), indexed by region_id + /// (we use map instead of vector so that we don't have to worry about + /// resizing it and the [] operator adds new items automagically) std::map< size_t,std::vector > region_volumes; - PrintObjectConfig config; + PrintObjectConfig config; //< Configuration t_layer_height_ranges layer_height_ranges; LayerHeightSpline layer_height_spline; - // this is set to true when LayerRegion->slices is split in top/internal/bottom - // so that next call to make_perimeters() performs a union() before computing loops + /// this is set to true when LayerRegion->slices is split in top/internal/bottom + /// so that next call to make_perimeters() performs a union() before computing loops bool typed_slices; - Point3 size; // XYZ in scaled coordinates + Point3 size; //< XYZ in scaled coordinates // scaled coordinates to add to copies (to compensate for the alignment // operated when creating the object but still preserving a coherent API From 5fc089ef993cea0da56c674b8770c2739088f320 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Thu, 26 Apr 2018 21:43:00 -0500 Subject: [PATCH 037/112] Stub out more of the interface, working our way out from GUI::App::OnInit() --- src/CMakeLists.txt | 3 +- src/GUI/GUI.cpp | 137 +++++++++++++++++++++++++++++++++++++++++- src/GUI/GUI.hpp | 15 ++++- src/GUI/MainFrame.hpp | 9 --- src/GUI/Preset.hpp | 17 ++++++ src/GUI/Settings.cpp | 15 +++++ src/GUI/Settings.hpp | 49 ++++++++++++++- src/GUI/misc_ui.cpp | 59 ++++++++++++++++++ src/GUI/misc_ui.hpp | 25 ++++++++ 9 files changed, 312 insertions(+), 17 deletions(-) create mode 100644 src/GUI/Preset.hpp create mode 100644 src/GUI/Settings.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bd8f28ffb..15382d8b8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -136,7 +136,7 @@ add_executable(slic3r slic3r.cpp) set(Boost_USE_STATIC_LIBS OFF) set(Boost_USE_STATIC_RUNTIME OFF) -find_library(bsystem_l boost_system) +find_library(bsystem_l boost_system log) add_library(bsystem SHARED IMPORTED) set_target_properties(bsystem PROPERTIES IMPORTED_LOCATION ${bsystem_l}) find_library(bthread_l boost_thread) @@ -164,6 +164,7 @@ IF(wxWidgets_FOUND) add_library(slic3r_gui STATIC ${GUI_LIBDIR}/MainFrame.cpp ${GUI_LIBDIR}/GUI.cpp + ${GUI_LIBDIR}/Settings.cpp ${GUI_LIBDIR}/misc_ui.cpp ) #only build GUI lib if building with wx diff --git a/src/GUI/GUI.cpp b/src/GUI/GUI.cpp index b2a1e280b..67d5485c1 100644 --- a/src/GUI/GUI.cpp +++ b/src/GUI/GUI.cpp @@ -2,9 +2,13 @@ #ifndef WX_PRECOMP #include #endif +#include + #include "MainFrame.hpp" #include "GUI.hpp" +#include "misc_ui.hpp" +#include "Preset.hpp" namespace Slic3r { namespace GUI { @@ -14,13 +18,142 @@ enum }; bool App::OnInit() { - MainFrame *frame = new MainFrame( "Slic3r", wxDefaultPosition, wxDefaultSize, this->gui_config); - frame->Show( true ); this->SetAppName("Slic3r"); + // TODO: Call a logging function with channel GUI, severity info + + this->notifier = std::unique_ptr(); + + wxString datadir {decode_path(wxStandardPaths::Get().GetUserDataDir())}; + wxString enc_datadir = encode_path(datadir); + std::cerr << datadir << "\n"; + + // TODO: Call a logging function with channel GUI, severity info for datadir path + + /* Check to make sure if datadir exists + * + */ + + // Load settings + this->gui_config->save_settings(); + this->load_presets(); + + + wxImage::AddHandler(new wxPNGHandler()); + MainFrame *frame = new MainFrame( "Slic3r", wxDefaultPosition, wxDefaultSize, this->gui_config); + this->SetTopWindow(frame); + frame->Show( true ); + + // Load init bundle + // + + // Run the wizard if we don't have an initial config + /* + $self->check_version + if $self->have_version_check + && ($Settings->{_}{version_check} // 1) + && (!$Settings->{_}{last_version_check} || (time - $Settings->{_}{last_version_check}) >= 86400); + */ + + // run callback functions during idle + /* + EVT_IDLE($frame, sub { + while (my $cb = shift @cb) { + $cb->(); + } + }); + */ + + // Handle custom version check event + /* + EVT_COMMAND($self, -1, $VERSION_CHECK_EVENT, sub { + my ($self, $event) = @_; + my ($success, $response, $manual_check) = @{$event->GetData}; + + if ($success) { + if ($response =~ /^obsolete ?= ?([a-z0-9.-]+,)*\Q$Slic3r::VERSION\E(?:,|$)/) { + my $res = Wx::MessageDialog->new(undef, "A new version is available. Do you want to open the Slic3r website now?", + 'Update', wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxICON_INFORMATION | wxICON_ERROR)->ShowModal; + Wx::LaunchDefaultBrowser('http://slic3r.org/') if $res == wxID_YES; + } else { + Slic3r::GUI::show_info(undef, "You're using the latest version. No updates are available.") if $manual_check; + } + $Settings->{_}{last_version_check} = time(); + $self->save_settings; + } else { + Slic3r::GUI::show_error(undef, "Failed to check for updates. Try later.") if $manual_check; + } + }); + */ return true; } +void App::save_window_pos(const wxTopLevelWindow* window, const wxString& name ) { + this->gui_config->window_pos[name] = + std::make_tuple( + window->GetScreenPosition(), + window->GetSize(), + window->IsMaximized()); + + this->gui_config->save_settings(); +} + +void App::restore_window_pos(wxTopLevelWindow* window, const wxString& name ) { + try { + auto tmp = gui_config->window_pos[name]; + const auto& size = std::get<1>(tmp); + const auto& pos = std::get<0>(tmp); + window->SetSize(size); + + auto display = wxDisplay().GetClientArea(); + if (((pos.x + size.x / 2) < display.GetRight()) && (pos.y + size.y/2 < display.GetBottom())) + window->Move(pos); + + window->Maximize(std::get<2>(tmp)); + } + catch (std::out_of_range e) { + // config was empty + } +} + +void App::load_presets() { +/* + for my $group (qw(printer filament print)) { + my $presets = $self->{presets}{$group}; + + # keep external or dirty presets + @$presets = grep { ($_->external && $_->file_exists) || $_->dirty } @$presets; + + my $dir = "$Slic3r::GUI::datadir/$group"; + opendir my $dh, Slic3r::encode_path($dir) + or die "Failed to read directory $dir (errno: $!)\n"; + foreach my $file (grep /\.ini$/i, readdir $dh) { + $file = Slic3r::decode_path($file); + my $name = basename($file); + $name =~ s/\.ini$//i; + + # skip if we already have it + next if any { $_->name eq $name } @$presets; + + push @$presets, Slic3r::GUI::Preset->new( + group => $group, + name => $name, + file => "$dir/$file", + ); + } + closedir $dh; + + @$presets = sort { $a->name cmp $b->name } @$presets; + + unshift @$presets, Slic3r::GUI::Preset->new( + group => $group, + default => 1, + name => '- default -', + ); + } +*/ +} + }} // namespace Slic3r::GUI diff --git a/src/GUI/GUI.hpp b/src/GUI/GUI.hpp index 82d6de746..219970806 100644 --- a/src/GUI/GUI.hpp +++ b/src/GUI/GUI.hpp @@ -1,9 +1,11 @@ #ifndef GUI_HPP #define GUI_HPP +#include #include "MainFrame.hpp" #include "Notifier.hpp" #include -#include +#include + namespace Slic3r { namespace GUI { @@ -21,12 +23,19 @@ public: virtual bool OnInit(); App(std::shared_ptr config) : wxApp(), gui_config(config) {} - void check_version(bool manual) { /* stub */} + /// Save position, size, and maximize state for a TopLevelWindow (includes Frames) by name in Settings. + void save_window_pos(const wxTopLevelWindow* window, const wxString& name ); + + /// Move/resize a named TopLevelWindow (includes Frames) from Settings + void restore_window_pos(wxTopLevelWindow* window, const wxString& name ); private: std::shared_ptr gui_config; // GUI-specific configuration options - Notifier* notifier; + std::unique_ptr notifier {nullptr}; std::vector presets { preset_list(), preset_list(), preset_list() }; + + void load_presets(); + }; }} // namespace Slic3r::GUI diff --git a/src/GUI/MainFrame.hpp b/src/GUI/MainFrame.hpp index e4014a27c..085cc3922 100644 --- a/src/GUI/MainFrame.hpp +++ b/src/GUI/MainFrame.hpp @@ -20,16 +20,7 @@ namespace Slic3r { namespace GUI { -template -void append_menu_item(wxMenu* menu, const wxString& name,const wxString& help, T lambda, int id = wxID_ANY, const wxBitmap& icon = wxBitmap(), const wxString& accel = "") { - wxMenuItem* tmp = menu->Append(wxID_ANY, name, help); - wxAcceleratorEntry* a = new wxAcceleratorEntry(); - if (a->FromString(accel)) - tmp->SetAccel(a); // set the accelerator if and only if the accelerator is fine - tmp->SetHelp(help); - menu->Bind(wxEVT_MENU, lambda, tmp->GetId(), tmp->GetId()); -} constexpr unsigned int TOOLTIP_TIMER = 32767; diff --git a/src/GUI/Preset.hpp b/src/GUI/Preset.hpp new file mode 100644 index 000000000..e169c4827 --- /dev/null +++ b/src/GUI/Preset.hpp @@ -0,0 +1,17 @@ +#ifndef PRESET_HPP +#define PRESET_HPP + +#include "PrintConfig.hpp" + +namespace Slic3r { namespace GUI { + +class Preset { + +private: + Slic3r::DynamicPrintConfig config { Slic3r::DynamicPrintConfig() }; + +}; + +}} // namespace Slic3r::GUI + +#endif // PRESET_HPP diff --git a/src/GUI/Settings.cpp b/src/GUI/Settings.cpp new file mode 100644 index 000000000..8affa6886 --- /dev/null +++ b/src/GUI/Settings.cpp @@ -0,0 +1,15 @@ +#include "Settings.hpp" + +namespace Slic3r { namespace GUI { + +void Settings::save_settings() { +/* +sub save_settings { + my ($self) = @_; + Slic3r::Config->write_ini("$datadir/slic3r.ini", $Settings); +} + +*/ +} + +}} // namespace Slic3r::GUI diff --git a/src/GUI/Settings.hpp b/src/GUI/Settings.hpp index 07e219406..9c135cec3 100644 --- a/src/GUI/Settings.hpp +++ b/src/GUI/Settings.hpp @@ -1,13 +1,58 @@ #ifndef SETTINGS_HPP #define SETTINGS_HPP + +#include +#ifndef WX_PRECOMP + #include +#endif +#include +#include + +#include "libslic3r.h" + namespace Slic3r { namespace GUI { +enum class PathColor { + role +}; + +enum class ColorScheme { + solarized, slic3r +}; + +enum class ReloadBehavior { + all, copy, discard +}; + /// Stub class to hold onto GUI-specific settings options. /// TODO: Incorporate a copy of Slic3r::Config class Settings { public: - bool show_host; - Settings(): show_host(false) {} //< Show host/controller tab + bool show_host {false}; + bool version_check {true}; + bool autocenter {true}; + bool autoalignz {true}; + bool invert_zoom {false}; + bool background_processing {false}; + + bool preset_editor_tabs {false}; + + bool hide_reload_dialog {false}; + + ReloadBehavior reload {ReloadBehavior::all}; + ColorScheme color {ColorScheme::slic3r}; + PathColor color_toolpaths_by {PathColor::role}; + + float nudge {1.0}; //< 2D plater nudge amount in mm + + unsigned int threads {1}; //< Number of threads to use when slicing + + const wxString version { wxString(SLIC3R_VERSION) }; + + void save_settings(); + + /// Storage for window positions + std::map > window_pos { std::map >() }; }; }} //namespace Slic3r::GUI diff --git a/src/GUI/misc_ui.cpp b/src/GUI/misc_ui.cpp index 278f6e4d7..ef00fa2d3 100644 --- a/src/GUI/misc_ui.cpp +++ b/src/GUI/misc_ui.cpp @@ -1,4 +1,6 @@ #include "misc_ui.hpp" +#include + namespace Slic3r { namespace GUI { @@ -26,5 +28,62 @@ const wxString home(const wxString& in) { return wxGetHomeDir() + "/." + in + "/"; } + +wxString decode_path(const wxString& in) { + // TODO Stub + return in; +} + +wxString encode_path(const wxString& in) { + // TODO Stub + return in; +} +/* +sub append_submenu { + my ($self, $menu, $string, $description, $submenu, $id, $icon) = @_; + + $id //= &Wx::NewId(); + my $item = Wx::MenuItem->new($menu, $id, $string, $description // ''); + $self->set_menu_item_icon($item, $icon); + $item->SetSubMenu($submenu); + $menu->Append($item); + + return $item; +} +*/ + +/* +sub scan_serial_ports { + my ($self) = @_; + + my @ports = (); + + if ($^O eq 'MSWin32') { + # Windows + if (eval "use Win32::TieRegistry; 1") { + my $ts = Win32::TieRegistry->new("HKEY_LOCAL_MACHINE\\HARDWARE\\DEVICEMAP\\SERIALCOMM", + { Access => 'KEY_READ' }); + if ($ts) { + # when no serial ports are available, the registry key doesn't exist and + # TieRegistry->new returns undef + $ts->Tie(\my %reg); + push @ports, sort values %reg; + } + } + } else { + # UNIX and OS X + push @ports, glob '/dev/{ttyUSB,ttyACM,tty.,cu.,rfcomm}*'; + } + + return grep !/Bluetooth|FireFly/, @ports; +} +*/ +/* +sub show_error { + my ($parent, $message) = @_; + Wx::MessageDialog->new($parent, $message, 'Error', wxOK | wxICON_ERROR)->ShowModal; +} +*/ + }} // namespace Slic3r::GUI diff --git a/src/GUI/misc_ui.hpp b/src/GUI/misc_ui.hpp index cc92e5a03..5276a3f8c 100644 --- a/src/GUI/misc_ui.hpp +++ b/src/GUI/misc_ui.hpp @@ -39,6 +39,31 @@ const wxString var(const wxString& in); /// Always returns path to home directory. const wxString home(const wxString& in = "Slic3r"); +template +void append_menu_item(wxMenu* menu, const wxString& name,const wxString& help, T lambda, int id = wxID_ANY, const wxString& icon = "", const wxString& accel = "") { + wxMenuItem* tmp = menu->Append(wxID_ANY, name, help); + wxAcceleratorEntry* a = new wxAcceleratorEntry(); + if (!accel.IsEmpty()) { + a->FromString(accel); + tmp->SetAccel(a); // set the accelerator if and only if the accelerator is fine + } + tmp->SetHelp(help); + if (!icon.IsEmpty()) + tmp->SetBitmap(wxBitmap(var(icon))); + + menu->Bind(wxEVT_MENU, lambda, tmp->GetId(), tmp->GetId()); +} + +/* +sub CallAfter { + my ($self, $cb) = @_; + push @cb, $cb; +} +*/ + +wxString decode_path(const wxString& in); +wxString encode_path(const wxString& in); + }} // namespace Slic3r::GUI #endif // MISC_UI_HPP From 2ec07cb93c6336cb1e6a1af29c94ca5e1abffe78 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 28 Apr 2018 12:32:54 -0500 Subject: [PATCH 038/112] Added CATCH v2.2.2 header --- src/test/catch.hpp | 13050 ++++++++++++++++ .../libslic3r/{Config.cpp => ConfigBase.cpp} | 0 .../libslic3r/{Config.hpp => ConfigBase.hpp} | 0 3 files changed, 13050 insertions(+) create mode 100644 src/test/catch.hpp rename xs/src/libslic3r/{Config.cpp => ConfigBase.cpp} (100%) rename xs/src/libslic3r/{Config.hpp => ConfigBase.hpp} (100%) diff --git a/src/test/catch.hpp b/src/test/catch.hpp new file mode 100644 index 000000000..ecd8907ea --- /dev/null +++ b/src/test/catch.hpp @@ -0,0 +1,13050 @@ +/* + * Catch v2.2.2 + * Generated: 2018-04-06 12:05:03.186665 + * ---------------------------------------------------------- + * This file has been merged from multiple headers. Please don't edit it directly + * Copyright (c) 2018 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ +#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED +#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED +// start catch.hpp + + +#define CATCH_VERSION_MAJOR 2 +#define CATCH_VERSION_MINOR 2 +#define CATCH_VERSION_PATCH 2 + +#ifdef __clang__ +# pragma clang system_header +#elif defined __GNUC__ +# pragma GCC system_header +#endif + +// start catch_suppress_warnings.h + +#ifdef __clang__ +# ifdef __ICC // icpc defines the __clang__ macro +# pragma warning(push) +# pragma warning(disable: 161 1682) +# else // __ICC +# pragma clang diagnostic ignored "-Wunused-variable" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpadded" +# pragma clang diagnostic ignored "-Wswitch-enum" +# pragma clang diagnostic ignored "-Wcovered-switch-default" +# endif +#elif defined __GNUC__ +# pragma GCC diagnostic ignored "-Wparentheses" +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-variable" +# pragma GCC diagnostic ignored "-Wpadded" +#endif +// end catch_suppress_warnings.h +#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER) +# define CATCH_IMPL +# define CATCH_CONFIG_ALL_PARTS +#endif + +// In the impl file, we want to have access to all parts of the headers +// Can also be used to sanely support PCHs +#if defined(CATCH_CONFIG_ALL_PARTS) +# define CATCH_CONFIG_EXTERNAL_INTERFACES +# if defined(CATCH_CONFIG_DISABLE_MATCHERS) +# undef CATCH_CONFIG_DISABLE_MATCHERS +# endif +# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER +#endif + +#if !defined(CATCH_CONFIG_IMPL_ONLY) +// start catch_platform.h + +#ifdef __APPLE__ +# include +# if TARGET_OS_OSX == 1 +# define CATCH_PLATFORM_MAC +# elif TARGET_OS_IPHONE == 1 +# define CATCH_PLATFORM_IPHONE +# endif + +#elif defined(linux) || defined(__linux) || defined(__linux__) +# define CATCH_PLATFORM_LINUX + +#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) +# define CATCH_PLATFORM_WINDOWS +#endif + +// end catch_platform.h + +#ifdef CATCH_IMPL +# ifndef CLARA_CONFIG_MAIN +# define CLARA_CONFIG_MAIN_NOT_DEFINED +# define CLARA_CONFIG_MAIN +# endif +#endif + +// start catch_user_interfaces.h + +namespace Catch { + unsigned int rngSeed(); +} + +// end catch_user_interfaces.h +// start catch_tag_alias_autoregistrar.h + +// start catch_common.h + +// start catch_compiler_capabilities.h + +// Detect a number of compiler features - by compiler +// The following features are defined: +// +// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported? +// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported? +// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported? +// **************** +// Note to maintainers: if new toggles are added please document them +// in configuration.md, too +// **************** + +// In general each macro has a _NO_ form +// (e.g. CATCH_CONFIG_NO_POSIX_SIGNALS) which disables the feature. +// Many features, at point of detection, define an _INTERNAL_ macro, so they +// can be combined, en-mass, with the _NO_ forms later. + +#ifdef __cplusplus + +# if __cplusplus >= 201402L +# define CATCH_CPP14_OR_GREATER +# endif + +# if __cplusplus >= 201703L +# define CATCH_CPP17_OR_GREATER +# endif + +#endif + +#if defined(CATCH_CPP17_OR_GREATER) +# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS +#endif + +#ifdef __clang__ + +# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + _Pragma( "clang diagnostic push" ) \ + _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ + _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") +# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + _Pragma( "clang diagnostic pop" ) + +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + _Pragma( "clang diagnostic push" ) \ + _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) +# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ + _Pragma( "clang diagnostic pop" ) + +#endif // __clang__ + +//////////////////////////////////////////////////////////////////////////////// +// Assume that non-Windows platforms support posix signals by default +#if !defined(CATCH_PLATFORM_WINDOWS) + #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS +#endif + +//////////////////////////////////////////////////////////////////////////////// +// We know some environments not to support full POSIX signals +#if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__) + #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +#endif + +#ifdef __OS400__ +# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +# define CATCH_CONFIG_COLOUR_NONE +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Cygwin +#ifdef __CYGWIN__ + +// Required for some versions of Cygwin to declare gettimeofday +// see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin +# define _BSD_SOURCE + +#endif // __CYGWIN__ + +//////////////////////////////////////////////////////////////////////////////// +// Visual C++ +#ifdef _MSC_VER + +# if _MSC_VER >= 1900 // Visual Studio 2015 or newer +# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS +# endif + +// Universal Windows platform does not support SEH +// Or console colours (or console at all...) +# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) +# define CATCH_CONFIG_COLOUR_NONE +# else +# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH +# endif + +#endif // _MSC_VER + +//////////////////////////////////////////////////////////////////////////////// + +// DJGPP +#ifdef __DJGPP__ +# define CATCH_INTERNAL_CONFIG_NO_WCHAR +#endif // __DJGPP__ + +//////////////////////////////////////////////////////////////////////////////// + +// Use of __COUNTER__ is suppressed during code analysis in +// CLion/AppCode 2017.2.x and former, because __COUNTER__ is not properly +// handled by it. +// Otherwise all supported compilers support COUNTER macro, +// but user still might want to turn it off +#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L ) + #define CATCH_INTERNAL_CONFIG_COUNTER +#endif + +#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) +# define CATCH_CONFIG_COUNTER +#endif +#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) +# define CATCH_CONFIG_WINDOWS_SEH +#endif +// This is set by default, because we assume that unix compilers are posix-signal-compatible by default. +#if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS) +# define CATCH_CONFIG_POSIX_SIGNALS +#endif +// This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions. +#if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR) +# define CATCH_CONFIG_WCHAR +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) +# define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS +#endif + +#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS +# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS +#endif +#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS +# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS +#endif + +// end catch_compiler_capabilities.h +#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line +#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) +#ifdef CATCH_CONFIG_COUNTER +# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ ) +#else +# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ ) +#endif + +#include +#include +#include + +namespace Catch { + + struct CaseSensitive { enum Choice { + Yes, + No + }; }; + + class NonCopyable { + NonCopyable( NonCopyable const& ) = delete; + NonCopyable( NonCopyable && ) = delete; + NonCopyable& operator = ( NonCopyable const& ) = delete; + NonCopyable& operator = ( NonCopyable && ) = delete; + + protected: + NonCopyable(); + virtual ~NonCopyable(); + }; + + struct SourceLineInfo { + + SourceLineInfo() = delete; + SourceLineInfo( char const* _file, std::size_t _line ) noexcept + : file( _file ), + line( _line ) + {} + + SourceLineInfo( SourceLineInfo const& other ) = default; + SourceLineInfo( SourceLineInfo && ) = default; + SourceLineInfo& operator = ( SourceLineInfo const& ) = default; + SourceLineInfo& operator = ( SourceLineInfo && ) = default; + + bool empty() const noexcept; + bool operator == ( SourceLineInfo const& other ) const noexcept; + bool operator < ( SourceLineInfo const& other ) const noexcept; + + char const* file; + std::size_t line; + }; + + std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ); + + // Use this in variadic streaming macros to allow + // >> +StreamEndStop + // as well as + // >> stuff +StreamEndStop + struct StreamEndStop { + std::string operator+() const; + }; + template + T const& operator + ( T const& value, StreamEndStop ) { + return value; + } +} + +#define CATCH_INTERNAL_LINEINFO \ + ::Catch::SourceLineInfo( __FILE__, static_cast( __LINE__ ) ) + +// end catch_common.h +namespace Catch { + + struct RegistrarForTagAliases { + RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ); + }; + +} // end namespace Catch + +#define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + +// end catch_tag_alias_autoregistrar.h +// start catch_test_registry.h + +// start catch_interfaces_testcase.h + +#include +#include + +namespace Catch { + + class TestSpec; + + struct ITestInvoker { + virtual void invoke () const = 0; + virtual ~ITestInvoker(); + }; + + using ITestCasePtr = std::shared_ptr; + + class TestCase; + struct IConfig; + + struct ITestCaseRegistry { + virtual ~ITestCaseRegistry(); + virtual std::vector const& getAllTests() const = 0; + virtual std::vector const& getAllTestsSorted( IConfig const& config ) const = 0; + }; + + bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); + std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); + std::vector const& getAllTestCasesSorted( IConfig const& config ); + +} + +// end catch_interfaces_testcase.h +// start catch_stringref.h + +#include +#include +#include + +namespace Catch { + + class StringData; + + /// A non-owning string class (similar to the forthcoming std::string_view) + /// Note that, because a StringRef may be a substring of another string, + /// it may not be null terminated. c_str() must return a null terminated + /// string, however, and so the StringRef will internally take ownership + /// (taking a copy), if necessary. In theory this ownership is not externally + /// visible - but it does mean (substring) StringRefs should not be shared between + /// threads. + class StringRef { + public: + using size_type = std::size_t; + + private: + friend struct StringRefTestAccess; + + char const* m_start; + size_type m_size; + + char* m_data = nullptr; + + void takeOwnership(); + + static constexpr char const* const s_empty = ""; + + public: // construction/ assignment + StringRef() noexcept + : StringRef( s_empty, 0 ) + {} + + StringRef( StringRef const& other ) noexcept + : m_start( other.m_start ), + m_size( other.m_size ) + {} + + StringRef( StringRef&& other ) noexcept + : m_start( other.m_start ), + m_size( other.m_size ), + m_data( other.m_data ) + { + other.m_data = nullptr; + } + + StringRef( char const* rawChars ) noexcept; + + StringRef( char const* rawChars, size_type size ) noexcept + : m_start( rawChars ), + m_size( size ) + {} + + StringRef( std::string const& stdString ) noexcept + : m_start( stdString.c_str() ), + m_size( stdString.size() ) + {} + + ~StringRef() noexcept { + delete[] m_data; + } + + auto operator = ( StringRef const &other ) noexcept -> StringRef& { + delete[] m_data; + m_data = nullptr; + m_start = other.m_start; + m_size = other.m_size; + return *this; + } + + operator std::string() const; + + void swap( StringRef& other ) noexcept; + + public: // operators + auto operator == ( StringRef const& other ) const noexcept -> bool; + auto operator != ( StringRef const& other ) const noexcept -> bool; + + auto operator[] ( size_type index ) const noexcept -> char; + + public: // named queries + auto empty() const noexcept -> bool { + return m_size == 0; + } + auto size() const noexcept -> size_type { + return m_size; + } + + auto numberOfCharacters() const noexcept -> size_type; + auto c_str() const -> char const*; + + public: // substrings and searches + auto substr( size_type start, size_type size ) const noexcept -> StringRef; + + // Returns the current start pointer. + // Note that the pointer can change when if the StringRef is a substring + auto currentData() const noexcept -> char const*; + + private: // ownership queries - may not be consistent between calls + auto isOwned() const noexcept -> bool; + auto isSubstring() const noexcept -> bool; + }; + + auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string; + auto operator + ( StringRef const& lhs, char const* rhs ) -> std::string; + auto operator + ( char const* lhs, StringRef const& rhs ) -> std::string; + + auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&; + auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&; + + inline auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { + return StringRef( rawChars, size ); + } + +} // namespace Catch + +// end catch_stringref.h +namespace Catch { + +template +class TestInvokerAsMethod : public ITestInvoker { + void (C::*m_testAsMethod)(); +public: + TestInvokerAsMethod( void (C::*testAsMethod)() ) noexcept : m_testAsMethod( testAsMethod ) {} + + void invoke() const override { + C obj; + (obj.*m_testAsMethod)(); + } +}; + +auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker*; + +template +auto makeTestInvoker( void (C::*testAsMethod)() ) noexcept -> ITestInvoker* { + return new(std::nothrow) TestInvokerAsMethod( testAsMethod ); +} + +struct NameAndTags { + NameAndTags( StringRef const& name_ = StringRef(), StringRef const& tags_ = StringRef() ) noexcept; + StringRef name; + StringRef tags; +}; + +struct AutoReg : NonCopyable { + AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept; + ~AutoReg(); +}; + +} // end namespace Catch + +#if defined(CATCH_CONFIG_DISABLE) + #define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \ + static void TestName() + #define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \ + namespace{ \ + struct TestName : ClassName { \ + void test(); \ + }; \ + } \ + void TestName::test() + +#endif + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \ + static void TestName(); \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, "", Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + static void TestName() + #define INTERNAL_CATCH_TESTCASE( ... ) \ + INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ ) + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &QualifiedMethod ), CATCH_INTERNAL_LINEINFO, "&" #QualifiedMethod, Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ \ + struct TestName : ClassName{ \ + void test(); \ + }; \ + Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ + } \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + void TestName::test() + #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \ + INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ ) + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, "", Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + +// end catch_test_registry.h +// start catch_capture.hpp + +// start catch_assertionhandler.h + +// start catch_assertioninfo.h + +// start catch_result_type.h + +namespace Catch { + + // ResultWas::OfType enum + struct ResultWas { enum OfType { + Unknown = -1, + Ok = 0, + Info = 1, + Warning = 2, + + FailureBit = 0x10, + + ExpressionFailed = FailureBit | 1, + ExplicitFailure = FailureBit | 2, + + Exception = 0x100 | FailureBit, + + ThrewException = Exception | 1, + DidntThrowException = Exception | 2, + + FatalErrorCondition = 0x200 | FailureBit + + }; }; + + bool isOk( ResultWas::OfType resultType ); + bool isJustInfo( int flags ); + + // ResultDisposition::Flags enum + struct ResultDisposition { enum Flags { + Normal = 0x01, + + ContinueOnFailure = 0x02, // Failures fail test, but execution continues + FalseTest = 0x04, // Prefix expression with ! + SuppressFail = 0x08 // Failures are reported but do not fail the test + }; }; + + ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ); + + bool shouldContinueOnFailure( int flags ); + inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; } + bool shouldSuppressFailure( int flags ); + +} // end namespace Catch + +// end catch_result_type.h +namespace Catch { + + struct AssertionInfo + { + StringRef macroName; + SourceLineInfo lineInfo; + StringRef capturedExpression; + ResultDisposition::Flags resultDisposition; + + // We want to delete this constructor but a compiler bug in 4.8 means + // the struct is then treated as non-aggregate + //AssertionInfo() = delete; + }; + +} // end namespace Catch + +// end catch_assertioninfo.h +// start catch_decomposer.h + +// start catch_tostring.h + +#include +#include +#include +#include +// start catch_stream.h + +#include +#include +#include + +namespace Catch { + + std::ostream& cout(); + std::ostream& cerr(); + std::ostream& clog(); + + class StringRef; + + struct IStream { + virtual ~IStream(); + virtual std::ostream& stream() const = 0; + }; + + auto makeStream( StringRef const &filename ) -> IStream const*; + + class ReusableStringStream { + std::size_t m_index; + std::ostream* m_oss; + public: + ReusableStringStream(); + ~ReusableStringStream(); + + auto str() const -> std::string; + + template + auto operator << ( T const& value ) -> ReusableStringStream& { + *m_oss << value; + return *this; + } + auto get() -> std::ostream& { return *m_oss; } + + static void cleanup(); + }; +} + +// end catch_stream.h + +#ifdef __OBJC__ +// start catch_objc_arc.hpp + +#import + +#ifdef __has_feature +#define CATCH_ARC_ENABLED __has_feature(objc_arc) +#else +#define CATCH_ARC_ENABLED 0 +#endif + +void arcSafeRelease( NSObject* obj ); +id performOptionalSelector( id obj, SEL sel ); + +#if !CATCH_ARC_ENABLED +inline void arcSafeRelease( NSObject* obj ) { + [obj release]; +} +inline id performOptionalSelector( id obj, SEL sel ) { + if( [obj respondsToSelector: sel] ) + return [obj performSelector: sel]; + return nil; +} +#define CATCH_UNSAFE_UNRETAINED +#define CATCH_ARC_STRONG +#else +inline void arcSafeRelease( NSObject* ){} +inline id performOptionalSelector( id obj, SEL sel ) { +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" +#endif + if( [obj respondsToSelector: sel] ) + return [obj performSelector: sel]; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + return nil; +} +#define CATCH_UNSAFE_UNRETAINED __unsafe_unretained +#define CATCH_ARC_STRONG __strong +#endif + +// end catch_objc_arc.hpp +#endif + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless +#endif + +// We need a dummy global operator<< so we can bring it into Catch namespace later +struct Catch_global_namespace_dummy {}; +std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy); + +namespace Catch { + // Bring in operator<< from global namespace into Catch namespace + using ::operator<<; + + namespace Detail { + + extern const std::string unprintableString; + + std::string rawMemoryToString( const void *object, std::size_t size ); + + template + std::string rawMemoryToString( const T& object ) { + return rawMemoryToString( &object, sizeof(object) ); + } + + template + class IsStreamInsertable { + template + static auto test(int) + -> decltype(std::declval() << std::declval(), std::true_type()); + + template + static auto test(...)->std::false_type; + + public: + static const bool value = decltype(test(0))::value; + }; + + template + std::string convertUnknownEnumToString( E e ); + + template + typename std::enable_if::value, std::string>::type convertUnstreamable( T const& value ) { +#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER) + (void)value; + return Detail::unprintableString; +#else + return CATCH_CONFIG_FALLBACK_STRINGIFIER(value); +#endif + } + template + typename std::enable_if::value, std::string>::type convertUnstreamable( T const& value ) { + return convertUnknownEnumToString( value ); + } + +#if defined(_MANAGED) + //! Convert a CLR string to a utf8 std::string + template + std::string clrReferenceToString( T^ ref ) { + if (ref == nullptr) + return std::string("null"); + auto bytes = System::Text::Encoding::UTF8->GetBytes(ref->ToString()); + cli::pin_ptr p = &bytes[0]; + return std::string(reinterpret_cast(p), bytes->Length); + } +#endif + + } // namespace Detail + + // If we decide for C++14, change these to enable_if_ts + template + struct StringMaker { + template + static + typename std::enable_if<::Catch::Detail::IsStreamInsertable::value, std::string>::type + convert(const Fake& value) { + ReusableStringStream rss; + rss << value; + return rss.str(); + } + + template + static + typename std::enable_if::value, std::string>::type + convert( const Fake& value ) { + return Detail::convertUnstreamable( value ); + } + }; + + namespace Detail { + + // This function dispatches all stringification requests inside of Catch. + // Should be preferably called fully qualified, like ::Catch::Detail::stringify + template + std::string stringify(const T& e) { + return ::Catch::StringMaker::type>::type>::convert(e); + } + + template + std::string convertUnknownEnumToString( E e ) { + return ::Catch::Detail::stringify(static_cast::type>(e)); + } + +#if defined(_MANAGED) + template + std::string stringify( T^ e ) { + return ::Catch::StringMaker::convert(e); + } +#endif + + } // namespace Detail + + // Some predefined specializations + + template<> + struct StringMaker { + static std::string convert(const std::string& str); + }; +#ifdef CATCH_CONFIG_WCHAR + template<> + struct StringMaker { + static std::string convert(const std::wstring& wstr); + }; +#endif + + template<> + struct StringMaker { + static std::string convert(char const * str); + }; + template<> + struct StringMaker { + static std::string convert(char * str); + }; + +#ifdef CATCH_CONFIG_WCHAR + template<> + struct StringMaker { + static std::string convert(wchar_t const * str); + }; + template<> + struct StringMaker { + static std::string convert(wchar_t * str); + }; +#endif + + // TBD: Should we use `strnlen` to ensure that we don't go out of the buffer, + // while keeping string semantics? + template + struct StringMaker { + static std::string convert(char const* str) { + return ::Catch::Detail::stringify(std::string{ str }); + } + }; + template + struct StringMaker { + static std::string convert(signed char const* str) { + return ::Catch::Detail::stringify(std::string{ reinterpret_cast(str) }); + } + }; + template + struct StringMaker { + static std::string convert(unsigned char const* str) { + return ::Catch::Detail::stringify(std::string{ reinterpret_cast(str) }); + } + }; + + template<> + struct StringMaker { + static std::string convert(int value); + }; + template<> + struct StringMaker { + static std::string convert(long value); + }; + template<> + struct StringMaker { + static std::string convert(long long value); + }; + template<> + struct StringMaker { + static std::string convert(unsigned int value); + }; + template<> + struct StringMaker { + static std::string convert(unsigned long value); + }; + template<> + struct StringMaker { + static std::string convert(unsigned long long value); + }; + + template<> + struct StringMaker { + static std::string convert(bool b); + }; + + template<> + struct StringMaker { + static std::string convert(char c); + }; + template<> + struct StringMaker { + static std::string convert(signed char c); + }; + template<> + struct StringMaker { + static std::string convert(unsigned char c); + }; + + template<> + struct StringMaker { + static std::string convert(std::nullptr_t); + }; + + template<> + struct StringMaker { + static std::string convert(float value); + }; + template<> + struct StringMaker { + static std::string convert(double value); + }; + + template + struct StringMaker { + template + static std::string convert(U* p) { + if (p) { + return ::Catch::Detail::rawMemoryToString(p); + } else { + return "nullptr"; + } + } + }; + + template + struct StringMaker { + static std::string convert(R C::* p) { + if (p) { + return ::Catch::Detail::rawMemoryToString(p); + } else { + return "nullptr"; + } + } + }; + +#if defined(_MANAGED) + template + struct StringMaker { + static std::string convert( T^ ref ) { + return ::Catch::Detail::clrReferenceToString(ref); + } + }; +#endif + + namespace Detail { + template + std::string rangeToString(InputIterator first, InputIterator last) { + ReusableStringStream rss; + rss << "{ "; + if (first != last) { + rss << ::Catch::Detail::stringify(*first); + for (++first; first != last; ++first) + rss << ", " << ::Catch::Detail::stringify(*first); + } + rss << " }"; + return rss.str(); + } + } + +#ifdef __OBJC__ + template<> + struct StringMaker { + static std::string convert(NSString * nsstring) { + if (!nsstring) + return "nil"; + return std::string("@") + [nsstring UTF8String]; + } + }; + template<> + struct StringMaker { + static std::string convert(NSObject* nsObject) { + return ::Catch::Detail::stringify([nsObject description]); + } + + }; + namespace Detail { + inline std::string stringify( NSString* nsstring ) { + return StringMaker::convert( nsstring ); + } + + } // namespace Detail +#endif // __OBJC__ + +} // namespace Catch + +////////////////////////////////////////////////////// +// Separate std-lib types stringification, so it can be selectively enabled +// This means that we do not bring in + +#if defined(CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS) +# define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER +# define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER +# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER +#endif + +// Separate std::pair specialization +#if defined(CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER) +#include +namespace Catch { + template + struct StringMaker > { + static std::string convert(const std::pair& pair) { + ReusableStringStream rss; + rss << "{ " + << ::Catch::Detail::stringify(pair.first) + << ", " + << ::Catch::Detail::stringify(pair.second) + << " }"; + return rss.str(); + } + }; +} +#endif // CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER + +// Separate std::tuple specialization +#if defined(CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER) +#include +namespace Catch { + namespace Detail { + template< + typename Tuple, + std::size_t N = 0, + bool = (N < std::tuple_size::value) + > + struct TupleElementPrinter { + static void print(const Tuple& tuple, std::ostream& os) { + os << (N ? ", " : " ") + << ::Catch::Detail::stringify(std::get(tuple)); + TupleElementPrinter::print(tuple, os); + } + }; + + template< + typename Tuple, + std::size_t N + > + struct TupleElementPrinter { + static void print(const Tuple&, std::ostream&) {} + }; + + } + + template + struct StringMaker> { + static std::string convert(const std::tuple& tuple) { + ReusableStringStream rss; + rss << '{'; + Detail::TupleElementPrinter>::print(tuple, rss.get()); + rss << " }"; + return rss.str(); + } + }; +} +#endif // CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER + +namespace Catch { + struct not_this_one {}; // Tag type for detecting which begin/ end are being selected + + // Import begin/ end from std here so they are considered alongside the fallback (...) overloads in this namespace + using std::begin; + using std::end; + + not_this_one begin( ... ); + not_this_one end( ... ); + + template + struct is_range { + static const bool value = + !std::is_same())), not_this_one>::value && + !std::is_same())), not_this_one>::value; + }; + +#if defined(_MANAGED) // Managed types are never ranges + template + struct is_range { + static const bool value = false; + }; +#endif + + template + std::string rangeToString( Range const& range ) { + return ::Catch::Detail::rangeToString( begin( range ), end( range ) ); + } + + // Handle vector specially + template + std::string rangeToString( std::vector const& v ) { + ReusableStringStream rss; + rss << "{ "; + bool first = true; + for( bool b : v ) { + if( first ) + first = false; + else + rss << ", "; + rss << ::Catch::Detail::stringify( b ); + } + rss << " }"; + return rss.str(); + } + + template + struct StringMaker::value && !::Catch::Detail::IsStreamInsertable::value>::type> { + static std::string convert( R const& range ) { + return rangeToString( range ); + } + }; + + template + struct StringMaker { + static std::string convert(T const(&arr)[SZ]) { + return rangeToString(arr); + } + }; + +} // namespace Catch + +// Separate std::chrono::duration specialization +#if defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) +#include +#include +#include + +namespace Catch { + +template +struct ratio_string { + static std::string symbol(); +}; + +template +std::string ratio_string::symbol() { + Catch::ReusableStringStream rss; + rss << '[' << Ratio::num << '/' + << Ratio::den << ']'; + return rss.str(); +} +template <> +struct ratio_string { + static std::string symbol(); +}; +template <> +struct ratio_string { + static std::string symbol(); +}; +template <> +struct ratio_string { + static std::string symbol(); +}; +template <> +struct ratio_string { + static std::string symbol(); +}; +template <> +struct ratio_string { + static std::string symbol(); +}; +template <> +struct ratio_string { + static std::string symbol(); +}; + + //////////// + // std::chrono::duration specializations + template + struct StringMaker> { + static std::string convert(std::chrono::duration const& duration) { + ReusableStringStream rss; + rss << duration.count() << ' ' << ratio_string::symbol() << 's'; + return rss.str(); + } + }; + template + struct StringMaker>> { + static std::string convert(std::chrono::duration> const& duration) { + ReusableStringStream rss; + rss << duration.count() << " s"; + return rss.str(); + } + }; + template + struct StringMaker>> { + static std::string convert(std::chrono::duration> const& duration) { + ReusableStringStream rss; + rss << duration.count() << " m"; + return rss.str(); + } + }; + template + struct StringMaker>> { + static std::string convert(std::chrono::duration> const& duration) { + ReusableStringStream rss; + rss << duration.count() << " h"; + return rss.str(); + } + }; + + //////////// + // std::chrono::time_point specialization + // Generic time_point cannot be specialized, only std::chrono::time_point + template + struct StringMaker> { + static std::string convert(std::chrono::time_point const& time_point) { + return ::Catch::Detail::stringify(time_point.time_since_epoch()) + " since epoch"; + } + }; + // std::chrono::time_point specialization + template + struct StringMaker> { + static std::string convert(std::chrono::time_point const& time_point) { + auto converted = std::chrono::system_clock::to_time_t(time_point); + +#ifdef _MSC_VER + std::tm timeInfo = {}; + gmtime_s(&timeInfo, &converted); +#else + std::tm* timeInfo = std::gmtime(&converted); +#endif + + auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); + char timeStamp[timeStampSize]; + const char * const fmt = "%Y-%m-%dT%H:%M:%SZ"; + +#ifdef _MSC_VER + std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); +#else + std::strftime(timeStamp, timeStampSize, fmt, timeInfo); +#endif + return std::string(timeStamp); + } + }; +} +#endif // CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +// end catch_tostring.h +#include + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4389) // '==' : signed/unsigned mismatch +#pragma warning(disable:4018) // more "signed/unsigned mismatch" +#pragma warning(disable:4312) // Converting int to T* using reinterpret_cast (issue on x64 platform) +#pragma warning(disable:4180) // qualifier applied to function type has no meaning +#endif + +namespace Catch { + + struct ITransientExpression { + auto isBinaryExpression() const -> bool { return m_isBinaryExpression; } + auto getResult() const -> bool { return m_result; } + virtual void streamReconstructedExpression( std::ostream &os ) const = 0; + + ITransientExpression( bool isBinaryExpression, bool result ) + : m_isBinaryExpression( isBinaryExpression ), + m_result( result ) + {} + + // We don't actually need a virtual destructor, but many static analysers + // complain if it's not here :-( + virtual ~ITransientExpression(); + + bool m_isBinaryExpression; + bool m_result; + + }; + + void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ); + + template + class BinaryExpr : public ITransientExpression { + LhsT m_lhs; + StringRef m_op; + RhsT m_rhs; + + void streamReconstructedExpression( std::ostream &os ) const override { + formatReconstructedExpression + ( os, Catch::Detail::stringify( m_lhs ), m_op, Catch::Detail::stringify( m_rhs ) ); + } + + public: + BinaryExpr( bool comparisonResult, LhsT lhs, StringRef op, RhsT rhs ) + : ITransientExpression{ true, comparisonResult }, + m_lhs( lhs ), + m_op( op ), + m_rhs( rhs ) + {} + }; + + template + class UnaryExpr : public ITransientExpression { + LhsT m_lhs; + + void streamReconstructedExpression( std::ostream &os ) const override { + os << Catch::Detail::stringify( m_lhs ); + } + + public: + explicit UnaryExpr( LhsT lhs ) + : ITransientExpression{ false, lhs ? true : false }, + m_lhs( lhs ) + {} + }; + + // Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int) + template + auto compareEqual( LhsT const& lhs, RhsT const& rhs ) -> bool { return static_cast(lhs == rhs); } + template + auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast( rhs ); } + template + auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast( rhs ); } + template + auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) == rhs; } + template + auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) == rhs; } + + template + auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return static_cast(lhs != rhs); } + template + auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast( rhs ); } + template + auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast( rhs ); } + template + auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) != rhs; } + template + auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) != rhs; } + + template + class ExprLhs { + LhsT m_lhs; + public: + explicit ExprLhs( LhsT lhs ) : m_lhs( lhs ) {} + + template + auto operator == ( RhsT const& rhs ) -> BinaryExpr const { + return { compareEqual( m_lhs, rhs ), m_lhs, "==", rhs }; + } + auto operator == ( bool rhs ) -> BinaryExpr const { + return { m_lhs == rhs, m_lhs, "==", rhs }; + } + + template + auto operator != ( RhsT const& rhs ) -> BinaryExpr const { + return { compareNotEqual( m_lhs, rhs ), m_lhs, "!=", rhs }; + } + auto operator != ( bool rhs ) -> BinaryExpr const { + return { m_lhs != rhs, m_lhs, "!=", rhs }; + } + + template + auto operator > ( RhsT const& rhs ) -> BinaryExpr const { + return { static_cast(m_lhs > rhs), m_lhs, ">", rhs }; + } + template + auto operator < ( RhsT const& rhs ) -> BinaryExpr const { + return { static_cast(m_lhs < rhs), m_lhs, "<", rhs }; + } + template + auto operator >= ( RhsT const& rhs ) -> BinaryExpr const { + return { static_cast(m_lhs >= rhs), m_lhs, ">=", rhs }; + } + template + auto operator <= ( RhsT const& rhs ) -> BinaryExpr const { + return { static_cast(m_lhs <= rhs), m_lhs, "<=", rhs }; + } + + auto makeUnaryExpr() const -> UnaryExpr { + return UnaryExpr{ m_lhs }; + } + }; + + void handleExpression( ITransientExpression const& expr ); + + template + void handleExpression( ExprLhs const& expr ) { + handleExpression( expr.makeUnaryExpr() ); + } + + struct Decomposer { + template + auto operator <= ( T const& lhs ) -> ExprLhs { + return ExprLhs{ lhs }; + } + + auto operator <=( bool value ) -> ExprLhs { + return ExprLhs{ value }; + } + }; + +} // end namespace Catch + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +// end catch_decomposer.h +// start catch_interfaces_capture.h + +#include + +namespace Catch { + + class AssertionResult; + struct AssertionInfo; + struct SectionInfo; + struct SectionEndInfo; + struct MessageInfo; + struct Counts; + struct BenchmarkInfo; + struct BenchmarkStats; + struct AssertionReaction; + + struct ITransientExpression; + + struct IResultCapture { + + virtual ~IResultCapture(); + + virtual bool sectionStarted( SectionInfo const& sectionInfo, + Counts& assertions ) = 0; + virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0; + virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0; + + virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0; + virtual void benchmarkEnded( BenchmarkStats const& stats ) = 0; + + virtual void pushScopedMessage( MessageInfo const& message ) = 0; + virtual void popScopedMessage( MessageInfo const& message ) = 0; + + virtual void handleFatalErrorCondition( StringRef message ) = 0; + + virtual void handleExpr + ( AssertionInfo const& info, + ITransientExpression const& expr, + AssertionReaction& reaction ) = 0; + virtual void handleMessage + ( AssertionInfo const& info, + ResultWas::OfType resultType, + StringRef const& message, + AssertionReaction& reaction ) = 0; + virtual void handleUnexpectedExceptionNotThrown + ( AssertionInfo const& info, + AssertionReaction& reaction ) = 0; + virtual void handleUnexpectedInflightException + ( AssertionInfo const& info, + std::string const& message, + AssertionReaction& reaction ) = 0; + virtual void handleIncomplete + ( AssertionInfo const& info ) = 0; + virtual void handleNonExpr + ( AssertionInfo const &info, + ResultWas::OfType resultType, + AssertionReaction &reaction ) = 0; + + virtual bool lastAssertionPassed() = 0; + virtual void assertionPassed() = 0; + + // Deprecated, do not use: + virtual std::string getCurrentTestName() const = 0; + virtual const AssertionResult* getLastResult() const = 0; + virtual void exceptionEarlyReported() = 0; + }; + + IResultCapture& getResultCapture(); +} + +// end catch_interfaces_capture.h +namespace Catch { + + struct TestFailureException{}; + struct AssertionResultData; + struct IResultCapture; + class RunContext; + + class LazyExpression { + friend class AssertionHandler; + friend struct AssertionStats; + friend class RunContext; + + ITransientExpression const* m_transientExpression = nullptr; + bool m_isNegated; + public: + LazyExpression( bool isNegated ); + LazyExpression( LazyExpression const& other ); + LazyExpression& operator = ( LazyExpression const& ) = delete; + + explicit operator bool() const; + + friend auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream&; + }; + + struct AssertionReaction { + bool shouldDebugBreak = false; + bool shouldThrow = false; + }; + + class AssertionHandler { + AssertionInfo m_assertionInfo; + AssertionReaction m_reaction; + bool m_completed = false; + IResultCapture& m_resultCapture; + + public: + AssertionHandler + ( StringRef macroName, + SourceLineInfo const& lineInfo, + StringRef capturedExpression, + ResultDisposition::Flags resultDisposition ); + ~AssertionHandler() { + if ( !m_completed ) { + m_resultCapture.handleIncomplete( m_assertionInfo ); + } + } + + template + void handleExpr( ExprLhs const& expr ) { + handleExpr( expr.makeUnaryExpr() ); + } + void handleExpr( ITransientExpression const& expr ); + + void handleMessage(ResultWas::OfType resultType, StringRef const& message); + + void handleExceptionThrownAsExpected(); + void handleUnexpectedExceptionNotThrown(); + void handleExceptionNotThrownAsExpected(); + void handleThrowingCallSkipped(); + void handleUnexpectedInflightException(); + + void complete(); + void setCompleted(); + + // query + auto allowThrows() const -> bool; + }; + + void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString ); + +} // namespace Catch + +// end catch_assertionhandler.h +// start catch_message.h + +#include + +namespace Catch { + + struct MessageInfo { + MessageInfo( std::string const& _macroName, + SourceLineInfo const& _lineInfo, + ResultWas::OfType _type ); + + std::string macroName; + std::string message; + SourceLineInfo lineInfo; + ResultWas::OfType type; + unsigned int sequence; + + bool operator == ( MessageInfo const& other ) const; + bool operator < ( MessageInfo const& other ) const; + private: + static unsigned int globalCount; + }; + + struct MessageStream { + + template + MessageStream& operator << ( T const& value ) { + m_stream << value; + return *this; + } + + ReusableStringStream m_stream; + }; + + struct MessageBuilder : MessageStream { + MessageBuilder( std::string const& macroName, + SourceLineInfo const& lineInfo, + ResultWas::OfType type ); + + template + MessageBuilder& operator << ( T const& value ) { + m_stream << value; + return *this; + } + + MessageInfo m_info; + }; + + class ScopedMessage { + public: + explicit ScopedMessage( MessageBuilder const& builder ); + ~ScopedMessage(); + + MessageInfo m_info; + }; + +} // end namespace Catch + +// end catch_message.h +#if !defined(CATCH_CONFIG_DISABLE) + +#if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION) + #define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__ +#else + #define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION" +#endif + +#if defined(CATCH_CONFIG_FAST_COMPILE) + +/////////////////////////////////////////////////////////////////////////////// +// Another way to speed-up compilation is to omit local try-catch for REQUIRE* +// macros. +#define INTERNAL_CATCH_TRY +#define INTERNAL_CATCH_CATCH( capturer ) + +#else // CATCH_CONFIG_FAST_COMPILE + +#define INTERNAL_CATCH_TRY try +#define INTERNAL_CATCH_CATCH( handler ) catch(...) { handler.handleUnexpectedInflightException(); } + +#endif + +#define INTERNAL_CATCH_REACT( handler ) handler.complete(); + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_TEST( macroName, resultDisposition, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \ + INTERNAL_CATCH_TRY { \ + CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); \ + CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ + } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( (void)0, false && static_cast( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look + // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&. + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_IF( macroName, resultDisposition, ... ) \ + INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \ + if( Catch::getResultCapture().lastAssertionPassed() ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_ELSE( macroName, resultDisposition, ... ) \ + INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \ + if( !Catch::getResultCapture().lastAssertionPassed() ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_NO_THROW( macroName, resultDisposition, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \ + try { \ + static_cast(__VA_ARGS__); \ + catchAssertionHandler.handleExceptionNotThrownAsExpected(); \ + } \ + catch( ... ) { \ + catchAssertionHandler.handleUnexpectedInflightException(); \ + } \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_THROWS( macroName, resultDisposition, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition); \ + if( catchAssertionHandler.allowThrows() ) \ + try { \ + static_cast(__VA_ARGS__); \ + catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ + } \ + catch( ... ) { \ + catchAssertionHandler.handleExceptionThrownAsExpected(); \ + } \ + else \ + catchAssertionHandler.handleThrowingCallSkipped(); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(expr) ", " CATCH_INTERNAL_STRINGIFY(exceptionType), resultDisposition ); \ + if( catchAssertionHandler.allowThrows() ) \ + try { \ + static_cast(expr); \ + catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ + } \ + catch( exceptionType const& ) { \ + catchAssertionHandler.handleExceptionThrownAsExpected(); \ + } \ + catch( ... ) { \ + catchAssertionHandler.handleUnexpectedInflightException(); \ + } \ + else \ + catchAssertionHandler.handleThrowingCallSkipped(); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \ + catchAssertionHandler.handleMessage( messageType, ( Catch::MessageStream() << __VA_ARGS__ + ::Catch::StreamEndStop() ).m_stream.str() ); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_INFO( macroName, log ) \ + Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log ); + +/////////////////////////////////////////////////////////////////////////////// +// Although this is matcher-based, it can be used with just a string +#define INTERNAL_CATCH_THROWS_STR_MATCHES( macroName, resultDisposition, matcher, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ + if( catchAssertionHandler.allowThrows() ) \ + try { \ + static_cast(__VA_ARGS__); \ + catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ + } \ + catch( ... ) { \ + Catch::handleExceptionMatchExpr( catchAssertionHandler, matcher, #matcher ); \ + } \ + else \ + catchAssertionHandler.handleThrowingCallSkipped(); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +#endif // CATCH_CONFIG_DISABLE + +// end catch_capture.hpp +// start catch_section.h + +// start catch_section_info.h + +// start catch_totals.h + +#include + +namespace Catch { + + struct Counts { + Counts operator - ( Counts const& other ) const; + Counts& operator += ( Counts const& other ); + + std::size_t total() const; + bool allPassed() const; + bool allOk() const; + + std::size_t passed = 0; + std::size_t failed = 0; + std::size_t failedButOk = 0; + }; + + struct Totals { + + Totals operator - ( Totals const& other ) const; + Totals& operator += ( Totals const& other ); + + Totals delta( Totals const& prevTotals ) const; + + int error = 0; + Counts assertions; + Counts testCases; + }; +} + +// end catch_totals.h +#include + +namespace Catch { + + struct SectionInfo { + SectionInfo + ( SourceLineInfo const& _lineInfo, + std::string const& _name, + std::string const& _description = std::string() ); + + std::string name; + std::string description; + SourceLineInfo lineInfo; + }; + + struct SectionEndInfo { + SectionEndInfo( SectionInfo const& _sectionInfo, Counts const& _prevAssertions, double _durationInSeconds ); + + SectionInfo sectionInfo; + Counts prevAssertions; + double durationInSeconds; + }; + +} // end namespace Catch + +// end catch_section_info.h +// start catch_timer.h + +#include + +namespace Catch { + + auto getCurrentNanosecondsSinceEpoch() -> uint64_t; + auto getEstimatedClockResolution() -> uint64_t; + + class Timer { + uint64_t m_nanoseconds = 0; + public: + void start(); + auto getElapsedNanoseconds() const -> uint64_t; + auto getElapsedMicroseconds() const -> uint64_t; + auto getElapsedMilliseconds() const -> unsigned int; + auto getElapsedSeconds() const -> double; + }; + +} // namespace Catch + +// end catch_timer.h +#include + +namespace Catch { + + class Section : NonCopyable { + public: + Section( SectionInfo const& info ); + ~Section(); + + // This indicates whether the section should be executed or not + explicit operator bool() const; + + private: + SectionInfo m_info; + + std::string m_name; + Counts m_assertions; + bool m_sectionIncluded; + Timer m_timer; + }; + +} // end namespace Catch + + #define INTERNAL_CATCH_SECTION( ... ) \ + if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) + +// end catch_section.h +// start catch_benchmark.h + +#include +#include + +namespace Catch { + + class BenchmarkLooper { + + std::string m_name; + std::size_t m_count = 0; + std::size_t m_iterationsToRun = 1; + uint64_t m_resolution; + Timer m_timer; + + static auto getResolution() -> uint64_t; + public: + // Keep most of this inline as it's on the code path that is being timed + BenchmarkLooper( StringRef name ) + : m_name( name ), + m_resolution( getResolution() ) + { + reportStart(); + m_timer.start(); + } + + explicit operator bool() { + if( m_count < m_iterationsToRun ) + return true; + return needsMoreIterations(); + } + + void increment() { + ++m_count; + } + + void reportStart(); + auto needsMoreIterations() -> bool; + }; + +} // end namespace Catch + +#define BENCHMARK( name ) \ + for( Catch::BenchmarkLooper looper( name ); looper; looper.increment() ) + +// end catch_benchmark.h +// start catch_interfaces_exception.h + +// start catch_interfaces_registry_hub.h + +#include +#include + +namespace Catch { + + class TestCase; + struct ITestCaseRegistry; + struct IExceptionTranslatorRegistry; + struct IExceptionTranslator; + struct IReporterRegistry; + struct IReporterFactory; + struct ITagAliasRegistry; + class StartupExceptionRegistry; + + using IReporterFactoryPtr = std::shared_ptr; + + struct IRegistryHub { + virtual ~IRegistryHub(); + + virtual IReporterRegistry const& getReporterRegistry() const = 0; + virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0; + virtual ITagAliasRegistry const& getTagAliasRegistry() const = 0; + + virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() = 0; + + virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const = 0; + }; + + struct IMutableRegistryHub { + virtual ~IMutableRegistryHub(); + virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) = 0; + virtual void registerListener( IReporterFactoryPtr const& factory ) = 0; + virtual void registerTest( TestCase const& testInfo ) = 0; + virtual void registerTranslator( const IExceptionTranslator* translator ) = 0; + virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0; + virtual void registerStartupException() noexcept = 0; + }; + + IRegistryHub& getRegistryHub(); + IMutableRegistryHub& getMutableRegistryHub(); + void cleanUp(); + std::string translateActiveException(); + +} + +// end catch_interfaces_registry_hub.h +#if defined(CATCH_CONFIG_DISABLE) + #define INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( translatorName, signature) \ + static std::string translatorName( signature ) +#endif + +#include +#include +#include + +namespace Catch { + using exceptionTranslateFunction = std::string(*)(); + + struct IExceptionTranslator; + using ExceptionTranslators = std::vector>; + + struct IExceptionTranslator { + virtual ~IExceptionTranslator(); + virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0; + }; + + struct IExceptionTranslatorRegistry { + virtual ~IExceptionTranslatorRegistry(); + + virtual std::string translateActiveException() const = 0; + }; + + class ExceptionTranslatorRegistrar { + template + class ExceptionTranslator : public IExceptionTranslator { + public: + + ExceptionTranslator( std::string(*translateFunction)( T& ) ) + : m_translateFunction( translateFunction ) + {} + + std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override { + try { + if( it == itEnd ) + std::rethrow_exception(std::current_exception()); + else + return (*it)->translate( it+1, itEnd ); + } + catch( T& ex ) { + return m_translateFunction( ex ); + } + } + + protected: + std::string(*m_translateFunction)( T& ); + }; + + public: + template + ExceptionTranslatorRegistrar( std::string(*translateFunction)( T& ) ) { + getMutableRegistryHub().registerTranslator + ( new ExceptionTranslator( translateFunction ) ); + } + }; +} + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \ + static std::string translatorName( signature ); \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); } \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + static std::string translatorName( signature ) + +#define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION2( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature ) + +// end catch_interfaces_exception.h +// start catch_approx.h + +#include +#include + +namespace Catch { +namespace Detail { + + class Approx { + private: + bool equalityComparisonImpl(double other) const; + + public: + explicit Approx ( double value ); + + static Approx custom(); + + template ::value>::type> + Approx operator()( T const& value ) { + Approx approx( static_cast(value) ); + approx.epsilon( m_epsilon ); + approx.margin( m_margin ); + approx.scale( m_scale ); + return approx; + } + + template ::value>::type> + explicit Approx( T const& value ): Approx(static_cast(value)) + {} + + template ::value>::type> + friend bool operator == ( const T& lhs, Approx const& rhs ) { + auto lhs_v = static_cast(lhs); + return rhs.equalityComparisonImpl(lhs_v); + } + + template ::value>::type> + friend bool operator == ( Approx const& lhs, const T& rhs ) { + return operator==( rhs, lhs ); + } + + template ::value>::type> + friend bool operator != ( T const& lhs, Approx const& rhs ) { + return !operator==( lhs, rhs ); + } + + template ::value>::type> + friend bool operator != ( Approx const& lhs, T const& rhs ) { + return !operator==( rhs, lhs ); + } + + template ::value>::type> + friend bool operator <= ( T const& lhs, Approx const& rhs ) { + return static_cast(lhs) < rhs.m_value || lhs == rhs; + } + + template ::value>::type> + friend bool operator <= ( Approx const& lhs, T const& rhs ) { + return lhs.m_value < static_cast(rhs) || lhs == rhs; + } + + template ::value>::type> + friend bool operator >= ( T const& lhs, Approx const& rhs ) { + return static_cast(lhs) > rhs.m_value || lhs == rhs; + } + + template ::value>::type> + friend bool operator >= ( Approx const& lhs, T const& rhs ) { + return lhs.m_value > static_cast(rhs) || lhs == rhs; + } + + template ::value>::type> + Approx& epsilon( T const& newEpsilon ) { + double epsilonAsDouble = static_cast(newEpsilon); + if( epsilonAsDouble < 0 || epsilonAsDouble > 1.0 ) { + throw std::domain_error + ( "Invalid Approx::epsilon: " + + Catch::Detail::stringify( epsilonAsDouble ) + + ", Approx::epsilon has to be between 0 and 1" ); + } + m_epsilon = epsilonAsDouble; + return *this; + } + + template ::value>::type> + Approx& margin( T const& newMargin ) { + double marginAsDouble = static_cast(newMargin); + if( marginAsDouble < 0 ) { + throw std::domain_error + ( "Invalid Approx::margin: " + + Catch::Detail::stringify( marginAsDouble ) + + ", Approx::Margin has to be non-negative." ); + + } + m_margin = marginAsDouble; + return *this; + } + + template ::value>::type> + Approx& scale( T const& newScale ) { + m_scale = static_cast(newScale); + return *this; + } + + std::string toString() const; + + private: + double m_epsilon; + double m_margin; + double m_scale; + double m_value; + }; +} + +template<> +struct StringMaker { + static std::string convert(Catch::Detail::Approx const& value); +}; + +} // end namespace Catch + +// end catch_approx.h +// start catch_string_manip.h + +#include +#include + +namespace Catch { + + bool startsWith( std::string const& s, std::string const& prefix ); + bool startsWith( std::string const& s, char prefix ); + bool endsWith( std::string const& s, std::string const& suffix ); + bool endsWith( std::string const& s, char suffix ); + bool contains( std::string const& s, std::string const& infix ); + void toLowerInPlace( std::string& s ); + std::string toLower( std::string const& s ); + std::string trim( std::string const& str ); + bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ); + + struct pluralise { + pluralise( std::size_t count, std::string const& label ); + + friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ); + + std::size_t m_count; + std::string m_label; + }; +} + +// end catch_string_manip.h +#ifndef CATCH_CONFIG_DISABLE_MATCHERS +// start catch_capture_matchers.h + +// start catch_matchers.h + +#include +#include + +namespace Catch { +namespace Matchers { + namespace Impl { + + template struct MatchAllOf; + template struct MatchAnyOf; + template struct MatchNotOf; + + class MatcherUntypedBase { + public: + MatcherUntypedBase() = default; + MatcherUntypedBase ( MatcherUntypedBase const& ) = default; + MatcherUntypedBase& operator = ( MatcherUntypedBase const& ) = delete; + std::string toString() const; + + protected: + virtual ~MatcherUntypedBase(); + virtual std::string describe() const = 0; + mutable std::string m_cachedToString; + }; + + template + struct MatcherMethod { + virtual bool match( ObjectT const& arg ) const = 0; + }; + template + struct MatcherMethod { + virtual bool match( PtrT* arg ) const = 0; + }; + + template + struct MatcherBase : MatcherUntypedBase, MatcherMethod { + + MatchAllOf operator && ( MatcherBase const& other ) const; + MatchAnyOf operator || ( MatcherBase const& other ) const; + MatchNotOf operator ! () const; + }; + + template + struct MatchAllOf : MatcherBase { + bool match( ArgT const& arg ) const override { + for( auto matcher : m_matchers ) { + if (!matcher->match(arg)) + return false; + } + return true; + } + std::string describe() const override { + std::string description; + description.reserve( 4 + m_matchers.size()*32 ); + description += "( "; + bool first = true; + for( auto matcher : m_matchers ) { + if( first ) + first = false; + else + description += " and "; + description += matcher->toString(); + } + description += " )"; + return description; + } + + MatchAllOf& operator && ( MatcherBase const& other ) { + m_matchers.push_back( &other ); + return *this; + } + + std::vector const*> m_matchers; + }; + template + struct MatchAnyOf : MatcherBase { + + bool match( ArgT const& arg ) const override { + for( auto matcher : m_matchers ) { + if (matcher->match(arg)) + return true; + } + return false; + } + std::string describe() const override { + std::string description; + description.reserve( 4 + m_matchers.size()*32 ); + description += "( "; + bool first = true; + for( auto matcher : m_matchers ) { + if( first ) + first = false; + else + description += " or "; + description += matcher->toString(); + } + description += " )"; + return description; + } + + MatchAnyOf& operator || ( MatcherBase const& other ) { + m_matchers.push_back( &other ); + return *this; + } + + std::vector const*> m_matchers; + }; + + template + struct MatchNotOf : MatcherBase { + + MatchNotOf( MatcherBase const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {} + + bool match( ArgT const& arg ) const override { + return !m_underlyingMatcher.match( arg ); + } + + std::string describe() const override { + return "not " + m_underlyingMatcher.toString(); + } + MatcherBase const& m_underlyingMatcher; + }; + + template + MatchAllOf MatcherBase::operator && ( MatcherBase const& other ) const { + return MatchAllOf() && *this && other; + } + template + MatchAnyOf MatcherBase::operator || ( MatcherBase const& other ) const { + return MatchAnyOf() || *this || other; + } + template + MatchNotOf MatcherBase::operator ! () const { + return MatchNotOf( *this ); + } + + } // namespace Impl + +} // namespace Matchers + +using namespace Matchers; +using Matchers::Impl::MatcherBase; + +} // namespace Catch + +// end catch_matchers.h +// start catch_matchers_floating.h + +#include +#include + +namespace Catch { +namespace Matchers { + + namespace Floating { + + enum class FloatingPointKind : uint8_t; + + struct WithinAbsMatcher : MatcherBase { + WithinAbsMatcher(double target, double margin); + bool match(double const& matchee) const override; + std::string describe() const override; + private: + double m_target; + double m_margin; + }; + + struct WithinUlpsMatcher : MatcherBase { + WithinUlpsMatcher(double target, int ulps, FloatingPointKind baseType); + bool match(double const& matchee) const override; + std::string describe() const override; + private: + double m_target; + int m_ulps; + FloatingPointKind m_type; + }; + + } // namespace Floating + + // The following functions create the actual matcher objects. + // This allows the types to be inferred + Floating::WithinUlpsMatcher WithinULP(double target, int maxUlpDiff); + Floating::WithinUlpsMatcher WithinULP(float target, int maxUlpDiff); + Floating::WithinAbsMatcher WithinAbs(double target, double margin); + +} // namespace Matchers +} // namespace Catch + +// end catch_matchers_floating.h +// start catch_matchers_generic.hpp + +#include +#include + +namespace Catch { +namespace Matchers { +namespace Generic { + +namespace Detail { + std::string finalizeDescription(const std::string& desc); +} + +template +class PredicateMatcher : public MatcherBase { + std::function m_predicate; + std::string m_description; +public: + + PredicateMatcher(std::function const& elem, std::string const& descr) + :m_predicate(std::move(elem)), + m_description(Detail::finalizeDescription(descr)) + {} + + bool match( T const& item ) const override { + return m_predicate(item); + } + + std::string describe() const override { + return m_description; + } +}; + +} // namespace Generic + + // The following functions create the actual matcher objects. + // The user has to explicitly specify type to the function, because + // infering std::function is hard (but possible) and + // requires a lot of TMP. + template + Generic::PredicateMatcher Predicate(std::function const& predicate, std::string const& description = "") { + return Generic::PredicateMatcher(predicate, description); + } + +} // namespace Matchers +} // namespace Catch + +// end catch_matchers_generic.hpp +// start catch_matchers_string.h + +#include + +namespace Catch { +namespace Matchers { + + namespace StdString { + + struct CasedString + { + CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity ); + std::string adjustString( std::string const& str ) const; + std::string caseSensitivitySuffix() const; + + CaseSensitive::Choice m_caseSensitivity; + std::string m_str; + }; + + struct StringMatcherBase : MatcherBase { + StringMatcherBase( std::string const& operation, CasedString const& comparator ); + std::string describe() const override; + + CasedString m_comparator; + std::string m_operation; + }; + + struct EqualsMatcher : StringMatcherBase { + EqualsMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + struct ContainsMatcher : StringMatcherBase { + ContainsMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + struct StartsWithMatcher : StringMatcherBase { + StartsWithMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + struct EndsWithMatcher : StringMatcherBase { + EndsWithMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + + struct RegexMatcher : MatcherBase { + RegexMatcher( std::string regex, CaseSensitive::Choice caseSensitivity ); + bool match( std::string const& matchee ) const override; + std::string describe() const override; + + private: + std::string m_regex; + CaseSensitive::Choice m_caseSensitivity; + }; + + } // namespace StdString + + // The following functions create the actual matcher objects. + // This allows the types to be inferred + + StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + StdString::RegexMatcher Matches( std::string const& regex, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + +} // namespace Matchers +} // namespace Catch + +// end catch_matchers_string.h +// start catch_matchers_vector.h + +#include + +namespace Catch { +namespace Matchers { + + namespace Vector { + namespace Detail { + template + size_t count(InputIterator first, InputIterator last, T const& item) { + size_t cnt = 0; + for (; first != last; ++first) { + if (*first == item) { + ++cnt; + } + } + return cnt; + } + template + bool contains(InputIterator first, InputIterator last, T const& item) { + for (; first != last; ++first) { + if (*first == item) { + return true; + } + } + return false; + } + } + + template + struct ContainsElementMatcher : MatcherBase> { + + ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {} + + bool match(std::vector const &v) const override { + for (auto const& el : v) { + if (el == m_comparator) { + return true; + } + } + return false; + } + + std::string describe() const override { + return "Contains: " + ::Catch::Detail::stringify( m_comparator ); + } + + T const& m_comparator; + }; + + template + struct ContainsMatcher : MatcherBase> { + + ContainsMatcher(std::vector const &comparator) : m_comparator( comparator ) {} + + bool match(std::vector const &v) const override { + // !TBD: see note in EqualsMatcher + if (m_comparator.size() > v.size()) + return false; + for (auto const& comparator : m_comparator) { + auto present = false; + for (const auto& el : v) { + if (el == comparator) { + present = true; + break; + } + } + if (!present) { + return false; + } + } + return true; + } + std::string describe() const override { + return "Contains: " + ::Catch::Detail::stringify( m_comparator ); + } + + std::vector const& m_comparator; + }; + + template + struct EqualsMatcher : MatcherBase> { + + EqualsMatcher(std::vector const &comparator) : m_comparator( comparator ) {} + + bool match(std::vector const &v) const override { + // !TBD: This currently works if all elements can be compared using != + // - a more general approach would be via a compare template that defaults + // to using !=. but could be specialised for, e.g. std::vector etc + // - then just call that directly + if (m_comparator.size() != v.size()) + return false; + for (std::size_t i = 0; i < v.size(); ++i) + if (m_comparator[i] != v[i]) + return false; + return true; + } + std::string describe() const override { + return "Equals: " + ::Catch::Detail::stringify( m_comparator ); + } + std::vector const& m_comparator; + }; + + template + struct UnorderedEqualsMatcher : MatcherBase> { + UnorderedEqualsMatcher(std::vector const& target) : m_target(target) {} + bool match(std::vector const& vec) const override { + // Note: This is a reimplementation of std::is_permutation, + // because I don't want to include inside the common path + if (m_target.size() != vec.size()) { + return false; + } + auto lfirst = m_target.begin(), llast = m_target.end(); + auto rfirst = vec.begin(), rlast = vec.end(); + // Cut common prefix to optimize checking of permuted parts + while (lfirst != llast && *lfirst != *rfirst) { + ++lfirst; ++rfirst; + } + if (lfirst == llast) { + return true; + } + + for (auto mid = lfirst; mid != llast; ++mid) { + // Skip already counted items + if (Detail::contains(lfirst, mid, *mid)) { + continue; + } + size_t num_vec = Detail::count(rfirst, rlast, *mid); + if (num_vec == 0 || Detail::count(lfirst, llast, *mid) != num_vec) { + return false; + } + } + + return true; + } + + std::string describe() const override { + return "UnorderedEquals: " + ::Catch::Detail::stringify(m_target); + } + private: + std::vector const& m_target; + }; + + } // namespace Vector + + // The following functions create the actual matcher objects. + // This allows the types to be inferred + + template + Vector::ContainsMatcher Contains( std::vector const& comparator ) { + return Vector::ContainsMatcher( comparator ); + } + + template + Vector::ContainsElementMatcher VectorContains( T const& comparator ) { + return Vector::ContainsElementMatcher( comparator ); + } + + template + Vector::EqualsMatcher Equals( std::vector const& comparator ) { + return Vector::EqualsMatcher( comparator ); + } + + template + Vector::UnorderedEqualsMatcher UnorderedEquals(std::vector const& target) { + return Vector::UnorderedEqualsMatcher(target); + } + +} // namespace Matchers +} // namespace Catch + +// end catch_matchers_vector.h +namespace Catch { + + template + class MatchExpr : public ITransientExpression { + ArgT const& m_arg; + MatcherT m_matcher; + StringRef m_matcherString; + public: + MatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef matcherString ) + : ITransientExpression{ true, matcher.match( arg ) }, + m_arg( arg ), + m_matcher( matcher ), + m_matcherString( matcherString ) + {} + + void streamReconstructedExpression( std::ostream &os ) const override { + auto matcherAsString = m_matcher.toString(); + os << Catch::Detail::stringify( m_arg ) << ' '; + if( matcherAsString == Detail::unprintableString ) + os << m_matcherString; + else + os << matcherAsString; + } + }; + + using StringMatcher = Matchers::Impl::MatcherBase; + + void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ); + + template + auto makeMatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef matcherString ) -> MatchExpr { + return MatchExpr( arg, matcher, matcherString ); + } + +} // namespace Catch + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CHECK_THAT( macroName, matcher, resultDisposition, arg ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(arg) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ + INTERNAL_CATCH_TRY { \ + catchAssertionHandler.handleExpr( Catch::makeMatchExpr( arg, matcher, #matcher ) ); \ + } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_THROWS_MATCHES( macroName, exceptionType, resultDisposition, matcher, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(exceptionType) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ + if( catchAssertionHandler.allowThrows() ) \ + try { \ + static_cast(__VA_ARGS__ ); \ + catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ + } \ + catch( exceptionType const& ex ) { \ + catchAssertionHandler.handleExpr( Catch::makeMatchExpr( ex, matcher, #matcher ) ); \ + } \ + catch( ... ) { \ + catchAssertionHandler.handleUnexpectedInflightException(); \ + } \ + else \ + catchAssertionHandler.handleThrowingCallSkipped(); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +// end catch_capture_matchers.h +#endif + +// These files are included here so the single_include script doesn't put them +// in the conditionally compiled sections +// start catch_test_case_info.h + +#include +#include +#include + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + +namespace Catch { + + struct ITestInvoker; + + struct TestCaseInfo { + enum SpecialProperties{ + None = 0, + IsHidden = 1 << 1, + ShouldFail = 1 << 2, + MayFail = 1 << 3, + Throws = 1 << 4, + NonPortable = 1 << 5, + Benchmark = 1 << 6 + }; + + TestCaseInfo( std::string const& _name, + std::string const& _className, + std::string const& _description, + std::vector const& _tags, + SourceLineInfo const& _lineInfo ); + + friend void setTags( TestCaseInfo& testCaseInfo, std::vector tags ); + + bool isHidden() const; + bool throws() const; + bool okToFail() const; + bool expectedToFail() const; + + std::string tagsAsString() const; + + std::string name; + std::string className; + std::string description; + std::vector tags; + std::vector lcaseTags; + SourceLineInfo lineInfo; + SpecialProperties properties; + }; + + class TestCase : public TestCaseInfo { + public: + + TestCase( ITestInvoker* testCase, TestCaseInfo&& info ); + + TestCase withName( std::string const& _newName ) const; + + void invoke() const; + + TestCaseInfo const& getTestCaseInfo() const; + + bool operator == ( TestCase const& other ) const; + bool operator < ( TestCase const& other ) const; + + private: + std::shared_ptr test; + }; + + TestCase makeTestCase( ITestInvoker* testCase, + std::string const& className, + NameAndTags const& nameAndTags, + SourceLineInfo const& lineInfo ); +} + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +// end catch_test_case_info.h +// start catch_interfaces_runner.h + +namespace Catch { + + struct IRunner { + virtual ~IRunner(); + virtual bool aborting() const = 0; + }; +} + +// end catch_interfaces_runner.h + +#ifdef __OBJC__ +// start catch_objc.hpp + +#import + +#include + +// NB. Any general catch headers included here must be included +// in catch.hpp first to make sure they are included by the single +// header for non obj-usage + +/////////////////////////////////////////////////////////////////////////////// +// This protocol is really only here for (self) documenting purposes, since +// all its methods are optional. +@protocol OcFixture + +@optional + +-(void) setUp; +-(void) tearDown; + +@end + +namespace Catch { + + class OcMethod : public ITestInvoker { + + public: + OcMethod( Class cls, SEL sel ) : m_cls( cls ), m_sel( sel ) {} + + virtual void invoke() const { + id obj = [[m_cls alloc] init]; + + performOptionalSelector( obj, @selector(setUp) ); + performOptionalSelector( obj, m_sel ); + performOptionalSelector( obj, @selector(tearDown) ); + + arcSafeRelease( obj ); + } + private: + virtual ~OcMethod() {} + + Class m_cls; + SEL m_sel; + }; + + namespace Detail{ + + inline std::string getAnnotation( Class cls, + std::string const& annotationName, + std::string const& testCaseName ) { + NSString* selStr = [[NSString alloc] initWithFormat:@"Catch_%s_%s", annotationName.c_str(), testCaseName.c_str()]; + SEL sel = NSSelectorFromString( selStr ); + arcSafeRelease( selStr ); + id value = performOptionalSelector( cls, sel ); + if( value ) + return [(NSString*)value UTF8String]; + return ""; + } + } + + inline std::size_t registerTestMethods() { + std::size_t noTestMethods = 0; + int noClasses = objc_getClassList( nullptr, 0 ); + + Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses); + objc_getClassList( classes, noClasses ); + + for( int c = 0; c < noClasses; c++ ) { + Class cls = classes[c]; + { + u_int count; + Method* methods = class_copyMethodList( cls, &count ); + for( u_int m = 0; m < count ; m++ ) { + SEL selector = method_getName(methods[m]); + std::string methodName = sel_getName(selector); + if( startsWith( methodName, "Catch_TestCase_" ) ) { + std::string testCaseName = methodName.substr( 15 ); + std::string name = Detail::getAnnotation( cls, "Name", testCaseName ); + std::string desc = Detail::getAnnotation( cls, "Description", testCaseName ); + const char* className = class_getName( cls ); + + getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, name.c_str(), desc.c_str(), SourceLineInfo("",0) ) ); + noTestMethods++; + } + } + free(methods); + } + } + return noTestMethods; + } + +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) + + namespace Matchers { + namespace Impl { + namespace NSStringMatchers { + + struct StringHolder : MatcherBase{ + StringHolder( NSString* substr ) : m_substr( [substr copy] ){} + StringHolder( StringHolder const& other ) : m_substr( [other.m_substr copy] ){} + StringHolder() { + arcSafeRelease( m_substr ); + } + + bool match( NSString* arg ) const override { + return false; + } + + NSString* CATCH_ARC_STRONG m_substr; + }; + + struct Equals : StringHolder { + Equals( NSString* substr ) : StringHolder( substr ){} + + bool match( NSString* str ) const override { + return (str != nil || m_substr == nil ) && + [str isEqualToString:m_substr]; + } + + std::string describe() const override { + return "equals string: " + Catch::Detail::stringify( m_substr ); + } + }; + + struct Contains : StringHolder { + Contains( NSString* substr ) : StringHolder( substr ){} + + bool match( NSString* str ) const { + return (str != nil || m_substr == nil ) && + [str rangeOfString:m_substr].location != NSNotFound; + } + + std::string describe() const override { + return "contains string: " + Catch::Detail::stringify( m_substr ); + } + }; + + struct StartsWith : StringHolder { + StartsWith( NSString* substr ) : StringHolder( substr ){} + + bool match( NSString* str ) const override { + return (str != nil || m_substr == nil ) && + [str rangeOfString:m_substr].location == 0; + } + + std::string describe() const override { + return "starts with: " + Catch::Detail::stringify( m_substr ); + } + }; + struct EndsWith : StringHolder { + EndsWith( NSString* substr ) : StringHolder( substr ){} + + bool match( NSString* str ) const override { + return (str != nil || m_substr == nil ) && + [str rangeOfString:m_substr].location == [str length] - [m_substr length]; + } + + std::string describe() const override { + return "ends with: " + Catch::Detail::stringify( m_substr ); + } + }; + + } // namespace NSStringMatchers + } // namespace Impl + + inline Impl::NSStringMatchers::Equals + Equals( NSString* substr ){ return Impl::NSStringMatchers::Equals( substr ); } + + inline Impl::NSStringMatchers::Contains + Contains( NSString* substr ){ return Impl::NSStringMatchers::Contains( substr ); } + + inline Impl::NSStringMatchers::StartsWith + StartsWith( NSString* substr ){ return Impl::NSStringMatchers::StartsWith( substr ); } + + inline Impl::NSStringMatchers::EndsWith + EndsWith( NSString* substr ){ return Impl::NSStringMatchers::EndsWith( substr ); } + + } // namespace Matchers + + using namespace Matchers; + +#endif // CATCH_CONFIG_DISABLE_MATCHERS + +} // namespace Catch + +/////////////////////////////////////////////////////////////////////////////// +#define OC_MAKE_UNIQUE_NAME( root, uniqueSuffix ) root##uniqueSuffix +#define OC_TEST_CASE2( name, desc, uniqueSuffix ) \ ++(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Name_test_, uniqueSuffix ) \ +{ \ +return @ name; \ +} \ ++(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Description_test_, uniqueSuffix ) \ +{ \ +return @ desc; \ +} \ +-(void) OC_MAKE_UNIQUE_NAME( Catch_TestCase_test_, uniqueSuffix ) + +#define OC_TEST_CASE( name, desc ) OC_TEST_CASE2( name, desc, __LINE__ ) + +// end catch_objc.hpp +#endif + +#ifdef CATCH_CONFIG_EXTERNAL_INTERFACES +// start catch_external_interfaces.h + +// start catch_reporter_bases.hpp + +// start catch_interfaces_reporter.h + +// start catch_config.hpp + +// start catch_test_spec_parser.h + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + +// start catch_test_spec.h + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + +// start catch_wildcard_pattern.h + +namespace Catch +{ + class WildcardPattern { + enum WildcardPosition { + NoWildcard = 0, + WildcardAtStart = 1, + WildcardAtEnd = 2, + WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd + }; + + public: + + WildcardPattern( std::string const& pattern, CaseSensitive::Choice caseSensitivity ); + virtual ~WildcardPattern() = default; + virtual bool matches( std::string const& str ) const; + + private: + std::string adjustCase( std::string const& str ) const; + CaseSensitive::Choice m_caseSensitivity; + WildcardPosition m_wildcard = NoWildcard; + std::string m_pattern; + }; +} + +// end catch_wildcard_pattern.h +#include +#include +#include + +namespace Catch { + + class TestSpec { + struct Pattern { + virtual ~Pattern(); + virtual bool matches( TestCaseInfo const& testCase ) const = 0; + }; + using PatternPtr = std::shared_ptr; + + class NamePattern : public Pattern { + public: + NamePattern( std::string const& name ); + virtual ~NamePattern(); + virtual bool matches( TestCaseInfo const& testCase ) const override; + private: + WildcardPattern m_wildcardPattern; + }; + + class TagPattern : public Pattern { + public: + TagPattern( std::string const& tag ); + virtual ~TagPattern(); + virtual bool matches( TestCaseInfo const& testCase ) const override; + private: + std::string m_tag; + }; + + class ExcludedPattern : public Pattern { + public: + ExcludedPattern( PatternPtr const& underlyingPattern ); + virtual ~ExcludedPattern(); + virtual bool matches( TestCaseInfo const& testCase ) const override; + private: + PatternPtr m_underlyingPattern; + }; + + struct Filter { + std::vector m_patterns; + + bool matches( TestCaseInfo const& testCase ) const; + }; + + public: + bool hasFilters() const; + bool matches( TestCaseInfo const& testCase ) const; + + private: + std::vector m_filters; + + friend class TestSpecParser; + }; +} + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +// end catch_test_spec.h +// start catch_interfaces_tag_alias_registry.h + +#include + +namespace Catch { + + struct TagAlias; + + struct ITagAliasRegistry { + virtual ~ITagAliasRegistry(); + // Nullptr if not present + virtual TagAlias const* find( std::string const& alias ) const = 0; + virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const = 0; + + static ITagAliasRegistry const& get(); + }; + +} // end namespace Catch + +// end catch_interfaces_tag_alias_registry.h +namespace Catch { + + class TestSpecParser { + enum Mode{ None, Name, QuotedName, Tag, EscapedName }; + Mode m_mode = None; + bool m_exclusion = false; + std::size_t m_start = std::string::npos, m_pos = 0; + std::string m_arg; + std::vector m_escapeChars; + TestSpec::Filter m_currentFilter; + TestSpec m_testSpec; + ITagAliasRegistry const* m_tagAliases = nullptr; + + public: + TestSpecParser( ITagAliasRegistry const& tagAliases ); + + TestSpecParser& parse( std::string const& arg ); + TestSpec testSpec(); + + private: + void visitChar( char c ); + void startNewMode( Mode mode, std::size_t start ); + void escape(); + std::string subString() const; + + template + void addPattern() { + std::string token = subString(); + for( std::size_t i = 0; i < m_escapeChars.size(); ++i ) + token = token.substr( 0, m_escapeChars[i]-m_start-i ) + token.substr( m_escapeChars[i]-m_start-i+1 ); + m_escapeChars.clear(); + if( startsWith( token, "exclude:" ) ) { + m_exclusion = true; + token = token.substr( 8 ); + } + if( !token.empty() ) { + TestSpec::PatternPtr pattern = std::make_shared( token ); + if( m_exclusion ) + pattern = std::make_shared( pattern ); + m_currentFilter.m_patterns.push_back( pattern ); + } + m_exclusion = false; + m_mode = None; + } + + void addFilter(); + }; + TestSpec parseTestSpec( std::string const& arg ); + +} // namespace Catch + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +// end catch_test_spec_parser.h +// start catch_interfaces_config.h + +#include +#include +#include +#include + +namespace Catch { + + enum class Verbosity { + Quiet = 0, + Normal, + High + }; + + struct WarnAbout { enum What { + Nothing = 0x00, + NoAssertions = 0x01, + NoTests = 0x02 + }; }; + + struct ShowDurations { enum OrNot { + DefaultForReporter, + Always, + Never + }; }; + struct RunTests { enum InWhatOrder { + InDeclarationOrder, + InLexicographicalOrder, + InRandomOrder + }; }; + struct UseColour { enum YesOrNo { + Auto, + Yes, + No + }; }; + struct WaitForKeypress { enum When { + Never, + BeforeStart = 1, + BeforeExit = 2, + BeforeStartAndExit = BeforeStart | BeforeExit + }; }; + + class TestSpec; + + struct IConfig : NonCopyable { + + virtual ~IConfig(); + + virtual bool allowThrows() const = 0; + virtual std::ostream& stream() const = 0; + virtual std::string name() const = 0; + virtual bool includeSuccessfulResults() const = 0; + virtual bool shouldDebugBreak() const = 0; + virtual bool warnAboutMissingAssertions() const = 0; + virtual bool warnAboutNoTests() const = 0; + virtual int abortAfter() const = 0; + virtual bool showInvisibles() const = 0; + virtual ShowDurations::OrNot showDurations() const = 0; + virtual TestSpec const& testSpec() const = 0; + virtual bool hasTestFilters() const = 0; + virtual RunTests::InWhatOrder runOrder() const = 0; + virtual unsigned int rngSeed() const = 0; + virtual int benchmarkResolutionMultiple() const = 0; + virtual UseColour::YesOrNo useColour() const = 0; + virtual std::vector const& getSectionsToRun() const = 0; + virtual Verbosity verbosity() const = 0; + }; + + using IConfigPtr = std::shared_ptr; +} + +// end catch_interfaces_config.h +// Libstdc++ doesn't like incomplete classes for unique_ptr + +#include +#include +#include + +#ifndef CATCH_CONFIG_CONSOLE_WIDTH +#define CATCH_CONFIG_CONSOLE_WIDTH 80 +#endif + +namespace Catch { + + struct IStream; + + struct ConfigData { + bool listTests = false; + bool listTags = false; + bool listReporters = false; + bool listTestNamesOnly = false; + + bool showSuccessfulTests = false; + bool shouldDebugBreak = false; + bool noThrow = false; + bool showHelp = false; + bool showInvisibles = false; + bool filenamesAsTags = false; + bool libIdentify = false; + + int abortAfter = -1; + unsigned int rngSeed = 0; + int benchmarkResolutionMultiple = 100; + + Verbosity verbosity = Verbosity::Normal; + WarnAbout::What warnings = WarnAbout::Nothing; + ShowDurations::OrNot showDurations = ShowDurations::DefaultForReporter; + RunTests::InWhatOrder runOrder = RunTests::InDeclarationOrder; + UseColour::YesOrNo useColour = UseColour::Auto; + WaitForKeypress::When waitForKeypress = WaitForKeypress::Never; + + std::string outputFilename; + std::string name; + std::string processName; + + std::vector reporterNames; + std::vector testsOrTags; + std::vector sectionsToRun; + }; + + class Config : public IConfig { + public: + + Config() = default; + Config( ConfigData const& data ); + virtual ~Config() = default; + + std::string const& getFilename() const; + + bool listTests() const; + bool listTestNamesOnly() const; + bool listTags() const; + bool listReporters() const; + + std::string getProcessName() const; + + std::vector const& getReporterNames() const; + std::vector const& getTestsOrTags() const; + std::vector const& getSectionsToRun() const override; + + virtual TestSpec const& testSpec() const override; + bool hasTestFilters() const override; + + bool showHelp() const; + + // IConfig interface + bool allowThrows() const override; + std::ostream& stream() const override; + std::string name() const override; + bool includeSuccessfulResults() const override; + bool warnAboutMissingAssertions() const override; + bool warnAboutNoTests() const override; + ShowDurations::OrNot showDurations() const override; + RunTests::InWhatOrder runOrder() const override; + unsigned int rngSeed() const override; + int benchmarkResolutionMultiple() const override; + UseColour::YesOrNo useColour() const override; + bool shouldDebugBreak() const override; + int abortAfter() const override; + bool showInvisibles() const override; + Verbosity verbosity() const override; + + private: + + IStream const* openStream(); + ConfigData m_data; + + std::unique_ptr m_stream; + TestSpec m_testSpec; + bool m_hasTestFilters = false; + }; + +} // end namespace Catch + +// end catch_config.hpp +// start catch_assertionresult.h + +#include + +namespace Catch { + + struct AssertionResultData + { + AssertionResultData() = delete; + + AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression ); + + std::string message; + mutable std::string reconstructedExpression; + LazyExpression lazyExpression; + ResultWas::OfType resultType; + + std::string reconstructExpression() const; + }; + + class AssertionResult { + public: + AssertionResult() = delete; + AssertionResult( AssertionInfo const& info, AssertionResultData const& data ); + + bool isOk() const; + bool succeeded() const; + ResultWas::OfType getResultType() const; + bool hasExpression() const; + bool hasMessage() const; + std::string getExpression() const; + std::string getExpressionInMacro() const; + bool hasExpandedExpression() const; + std::string getExpandedExpression() const; + std::string getMessage() const; + SourceLineInfo getSourceInfo() const; + StringRef getTestMacroName() const; + + //protected: + AssertionInfo m_info; + AssertionResultData m_resultData; + }; + +} // end namespace Catch + +// end catch_assertionresult.h +// start catch_option.hpp + +namespace Catch { + + // An optional type + template + class Option { + public: + Option() : nullableValue( nullptr ) {} + Option( T const& _value ) + : nullableValue( new( storage ) T( _value ) ) + {} + Option( Option const& _other ) + : nullableValue( _other ? new( storage ) T( *_other ) : nullptr ) + {} + + ~Option() { + reset(); + } + + Option& operator= ( Option const& _other ) { + if( &_other != this ) { + reset(); + if( _other ) + nullableValue = new( storage ) T( *_other ); + } + return *this; + } + Option& operator = ( T const& _value ) { + reset(); + nullableValue = new( storage ) T( _value ); + return *this; + } + + void reset() { + if( nullableValue ) + nullableValue->~T(); + nullableValue = nullptr; + } + + T& operator*() { return *nullableValue; } + T const& operator*() const { return *nullableValue; } + T* operator->() { return nullableValue; } + const T* operator->() const { return nullableValue; } + + T valueOr( T const& defaultValue ) const { + return nullableValue ? *nullableValue : defaultValue; + } + + bool some() const { return nullableValue != nullptr; } + bool none() const { return nullableValue == nullptr; } + + bool operator !() const { return nullableValue == nullptr; } + explicit operator bool() const { + return some(); + } + + private: + T *nullableValue; + alignas(alignof(T)) char storage[sizeof(T)]; + }; + +} // end namespace Catch + +// end catch_option.hpp +#include +#include +#include +#include +#include + +namespace Catch { + + struct ReporterConfig { + explicit ReporterConfig( IConfigPtr const& _fullConfig ); + + ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream ); + + std::ostream& stream() const; + IConfigPtr fullConfig() const; + + private: + std::ostream* m_stream; + IConfigPtr m_fullConfig; + }; + + struct ReporterPreferences { + bool shouldRedirectStdOut = false; + }; + + template + struct LazyStat : Option { + LazyStat& operator=( T const& _value ) { + Option::operator=( _value ); + used = false; + return *this; + } + void reset() { + Option::reset(); + used = false; + } + bool used = false; + }; + + struct TestRunInfo { + TestRunInfo( std::string const& _name ); + std::string name; + }; + struct GroupInfo { + GroupInfo( std::string const& _name, + std::size_t _groupIndex, + std::size_t _groupsCount ); + + std::string name; + std::size_t groupIndex; + std::size_t groupsCounts; + }; + + struct AssertionStats { + AssertionStats( AssertionResult const& _assertionResult, + std::vector const& _infoMessages, + Totals const& _totals ); + + AssertionStats( AssertionStats const& ) = default; + AssertionStats( AssertionStats && ) = default; + AssertionStats& operator = ( AssertionStats const& ) = default; + AssertionStats& operator = ( AssertionStats && ) = default; + virtual ~AssertionStats(); + + AssertionResult assertionResult; + std::vector infoMessages; + Totals totals; + }; + + struct SectionStats { + SectionStats( SectionInfo const& _sectionInfo, + Counts const& _assertions, + double _durationInSeconds, + bool _missingAssertions ); + SectionStats( SectionStats const& ) = default; + SectionStats( SectionStats && ) = default; + SectionStats& operator = ( SectionStats const& ) = default; + SectionStats& operator = ( SectionStats && ) = default; + virtual ~SectionStats(); + + SectionInfo sectionInfo; + Counts assertions; + double durationInSeconds; + bool missingAssertions; + }; + + struct TestCaseStats { + TestCaseStats( TestCaseInfo const& _testInfo, + Totals const& _totals, + std::string const& _stdOut, + std::string const& _stdErr, + bool _aborting ); + + TestCaseStats( TestCaseStats const& ) = default; + TestCaseStats( TestCaseStats && ) = default; + TestCaseStats& operator = ( TestCaseStats const& ) = default; + TestCaseStats& operator = ( TestCaseStats && ) = default; + virtual ~TestCaseStats(); + + TestCaseInfo testInfo; + Totals totals; + std::string stdOut; + std::string stdErr; + bool aborting; + }; + + struct TestGroupStats { + TestGroupStats( GroupInfo const& _groupInfo, + Totals const& _totals, + bool _aborting ); + TestGroupStats( GroupInfo const& _groupInfo ); + + TestGroupStats( TestGroupStats const& ) = default; + TestGroupStats( TestGroupStats && ) = default; + TestGroupStats& operator = ( TestGroupStats const& ) = default; + TestGroupStats& operator = ( TestGroupStats && ) = default; + virtual ~TestGroupStats(); + + GroupInfo groupInfo; + Totals totals; + bool aborting; + }; + + struct TestRunStats { + TestRunStats( TestRunInfo const& _runInfo, + Totals const& _totals, + bool _aborting ); + + TestRunStats( TestRunStats const& ) = default; + TestRunStats( TestRunStats && ) = default; + TestRunStats& operator = ( TestRunStats const& ) = default; + TestRunStats& operator = ( TestRunStats && ) = default; + virtual ~TestRunStats(); + + TestRunInfo runInfo; + Totals totals; + bool aborting; + }; + + struct BenchmarkInfo { + std::string name; + }; + struct BenchmarkStats { + BenchmarkInfo info; + std::size_t iterations; + uint64_t elapsedTimeInNanoseconds; + }; + + struct IStreamingReporter { + virtual ~IStreamingReporter() = default; + + // Implementing class must also provide the following static methods: + // static std::string getDescription(); + // static std::set getSupportedVerbosities() + + virtual ReporterPreferences getPreferences() const = 0; + + virtual void noMatchingTestCases( std::string const& spec ) = 0; + + virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0; + virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0; + + virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0; + virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0; + + // *** experimental *** + virtual void benchmarkStarting( BenchmarkInfo const& ) {} + + virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0; + + // The return value indicates if the messages buffer should be cleared: + virtual bool assertionEnded( AssertionStats const& assertionStats ) = 0; + + // *** experimental *** + virtual void benchmarkEnded( BenchmarkStats const& ) {} + + virtual void sectionEnded( SectionStats const& sectionStats ) = 0; + virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0; + virtual void testGroupEnded( TestGroupStats const& testGroupStats ) = 0; + virtual void testRunEnded( TestRunStats const& testRunStats ) = 0; + + virtual void skipTest( TestCaseInfo const& testInfo ) = 0; + + // Default empty implementation provided + virtual void fatalErrorEncountered( StringRef name ); + + virtual bool isMulti() const; + }; + using IStreamingReporterPtr = std::unique_ptr; + + struct IReporterFactory { + virtual ~IReporterFactory(); + virtual IStreamingReporterPtr create( ReporterConfig const& config ) const = 0; + virtual std::string getDescription() const = 0; + }; + using IReporterFactoryPtr = std::shared_ptr; + + struct IReporterRegistry { + using FactoryMap = std::map; + using Listeners = std::vector; + + virtual ~IReporterRegistry(); + virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const = 0; + virtual FactoryMap const& getFactories() const = 0; + virtual Listeners const& getListeners() const = 0; + }; + + void addReporter( IStreamingReporterPtr& existingReporter, IStreamingReporterPtr&& additionalReporter ); + +} // end namespace Catch + +// end catch_interfaces_reporter.h +#include +#include +#include +#include +#include +#include +#include + +namespace Catch { + void prepareExpandedExpression(AssertionResult& result); + + // Returns double formatted as %.3f (format expected on output) + std::string getFormattedDuration( double duration ); + + template + struct StreamingReporterBase : IStreamingReporter { + + StreamingReporterBase( ReporterConfig const& _config ) + : m_config( _config.fullConfig() ), + stream( _config.stream() ) + { + m_reporterPrefs.shouldRedirectStdOut = false; + if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) ) + throw std::domain_error( "Verbosity level not supported by this reporter" ); + } + + ReporterPreferences getPreferences() const override { + return m_reporterPrefs; + } + + static std::set getSupportedVerbosities() { + return { Verbosity::Normal }; + } + + ~StreamingReporterBase() override = default; + + void noMatchingTestCases(std::string const&) override {} + + void testRunStarting(TestRunInfo const& _testRunInfo) override { + currentTestRunInfo = _testRunInfo; + } + void testGroupStarting(GroupInfo const& _groupInfo) override { + currentGroupInfo = _groupInfo; + } + + void testCaseStarting(TestCaseInfo const& _testInfo) override { + currentTestCaseInfo = _testInfo; + } + void sectionStarting(SectionInfo const& _sectionInfo) override { + m_sectionStack.push_back(_sectionInfo); + } + + void sectionEnded(SectionStats const& /* _sectionStats */) override { + m_sectionStack.pop_back(); + } + void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override { + currentTestCaseInfo.reset(); + } + void testGroupEnded(TestGroupStats const& /* _testGroupStats */) override { + currentGroupInfo.reset(); + } + void testRunEnded(TestRunStats const& /* _testRunStats */) override { + currentTestCaseInfo.reset(); + currentGroupInfo.reset(); + currentTestRunInfo.reset(); + } + + void skipTest(TestCaseInfo const&) override { + // Don't do anything with this by default. + // It can optionally be overridden in the derived class. + } + + IConfigPtr m_config; + std::ostream& stream; + + LazyStat currentTestRunInfo; + LazyStat currentGroupInfo; + LazyStat currentTestCaseInfo; + + std::vector m_sectionStack; + ReporterPreferences m_reporterPrefs; + }; + + template + struct CumulativeReporterBase : IStreamingReporter { + template + struct Node { + explicit Node( T const& _value ) : value( _value ) {} + virtual ~Node() {} + + using ChildNodes = std::vector>; + T value; + ChildNodes children; + }; + struct SectionNode { + explicit SectionNode(SectionStats const& _stats) : stats(_stats) {} + virtual ~SectionNode() = default; + + bool operator == (SectionNode const& other) const { + return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo; + } + bool operator == (std::shared_ptr const& other) const { + return operator==(*other); + } + + SectionStats stats; + using ChildSections = std::vector>; + using Assertions = std::vector; + ChildSections childSections; + Assertions assertions; + std::string stdOut; + std::string stdErr; + }; + + struct BySectionInfo { + BySectionInfo( SectionInfo const& other ) : m_other( other ) {} + BySectionInfo( BySectionInfo const& other ) : m_other( other.m_other ) {} + bool operator() (std::shared_ptr const& node) const { + return ((node->stats.sectionInfo.name == m_other.name) && + (node->stats.sectionInfo.lineInfo == m_other.lineInfo)); + } + void operator=(BySectionInfo const&) = delete; + + private: + SectionInfo const& m_other; + }; + + using TestCaseNode = Node; + using TestGroupNode = Node; + using TestRunNode = Node; + + CumulativeReporterBase( ReporterConfig const& _config ) + : m_config( _config.fullConfig() ), + stream( _config.stream() ) + { + m_reporterPrefs.shouldRedirectStdOut = false; + if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) ) + throw std::domain_error( "Verbosity level not supported by this reporter" ); + } + ~CumulativeReporterBase() override = default; + + ReporterPreferences getPreferences() const override { + return m_reporterPrefs; + } + + static std::set getSupportedVerbosities() { + return { Verbosity::Normal }; + } + + void testRunStarting( TestRunInfo const& ) override {} + void testGroupStarting( GroupInfo const& ) override {} + + void testCaseStarting( TestCaseInfo const& ) override {} + + void sectionStarting( SectionInfo const& sectionInfo ) override { + SectionStats incompleteStats( sectionInfo, Counts(), 0, false ); + std::shared_ptr node; + if( m_sectionStack.empty() ) { + if( !m_rootSection ) + m_rootSection = std::make_shared( incompleteStats ); + node = m_rootSection; + } + else { + SectionNode& parentNode = *m_sectionStack.back(); + auto it = + std::find_if( parentNode.childSections.begin(), + parentNode.childSections.end(), + BySectionInfo( sectionInfo ) ); + if( it == parentNode.childSections.end() ) { + node = std::make_shared( incompleteStats ); + parentNode.childSections.push_back( node ); + } + else + node = *it; + } + m_sectionStack.push_back( node ); + m_deepestSection = std::move(node); + } + + void assertionStarting(AssertionInfo const&) override {} + + bool assertionEnded(AssertionStats const& assertionStats) override { + assert(!m_sectionStack.empty()); + // AssertionResult holds a pointer to a temporary DecomposedExpression, + // which getExpandedExpression() calls to build the expression string. + // Our section stack copy of the assertionResult will likely outlive the + // temporary, so it must be expanded or discarded now to avoid calling + // a destroyed object later. + prepareExpandedExpression(const_cast( assertionStats.assertionResult ) ); + SectionNode& sectionNode = *m_sectionStack.back(); + sectionNode.assertions.push_back(assertionStats); + return true; + } + void sectionEnded(SectionStats const& sectionStats) override { + assert(!m_sectionStack.empty()); + SectionNode& node = *m_sectionStack.back(); + node.stats = sectionStats; + m_sectionStack.pop_back(); + } + void testCaseEnded(TestCaseStats const& testCaseStats) override { + auto node = std::make_shared(testCaseStats); + assert(m_sectionStack.size() == 0); + node->children.push_back(m_rootSection); + m_testCases.push_back(node); + m_rootSection.reset(); + + assert(m_deepestSection); + m_deepestSection->stdOut = testCaseStats.stdOut; + m_deepestSection->stdErr = testCaseStats.stdErr; + } + void testGroupEnded(TestGroupStats const& testGroupStats) override { + auto node = std::make_shared(testGroupStats); + node->children.swap(m_testCases); + m_testGroups.push_back(node); + } + void testRunEnded(TestRunStats const& testRunStats) override { + auto node = std::make_shared(testRunStats); + node->children.swap(m_testGroups); + m_testRuns.push_back(node); + testRunEndedCumulative(); + } + virtual void testRunEndedCumulative() = 0; + + void skipTest(TestCaseInfo const&) override {} + + IConfigPtr m_config; + std::ostream& stream; + std::vector m_assertions; + std::vector>> m_sections; + std::vector> m_testCases; + std::vector> m_testGroups; + + std::vector> m_testRuns; + + std::shared_ptr m_rootSection; + std::shared_ptr m_deepestSection; + std::vector> m_sectionStack; + ReporterPreferences m_reporterPrefs; + }; + + template + char const* getLineOfChars() { + static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0}; + if( !*line ) { + std::memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 ); + line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0; + } + return line; + } + + struct TestEventListenerBase : StreamingReporterBase { + TestEventListenerBase( ReporterConfig const& _config ); + + void assertionStarting(AssertionInfo const&) override; + bool assertionEnded(AssertionStats const&) override; + }; + +} // end namespace Catch + +// end catch_reporter_bases.hpp +// start catch_console_colour.h + +namespace Catch { + + struct Colour { + enum Code { + None = 0, + + White, + Red, + Green, + Blue, + Cyan, + Yellow, + Grey, + + Bright = 0x10, + + BrightRed = Bright | Red, + BrightGreen = Bright | Green, + LightGrey = Bright | Grey, + BrightWhite = Bright | White, + BrightYellow = Bright | Yellow, + + // By intention + FileName = LightGrey, + Warning = BrightYellow, + ResultError = BrightRed, + ResultSuccess = BrightGreen, + ResultExpectedFailure = Warning, + + Error = BrightRed, + Success = Green, + + OriginalExpression = Cyan, + ReconstructedExpression = BrightYellow, + + SecondaryText = LightGrey, + Headers = White + }; + + // Use constructed object for RAII guard + Colour( Code _colourCode ); + Colour( Colour&& other ) noexcept; + Colour& operator=( Colour&& other ) noexcept; + ~Colour(); + + // Use static method for one-shot changes + static void use( Code _colourCode ); + + private: + bool m_moved = false; + }; + + std::ostream& operator << ( std::ostream& os, Colour const& ); + +} // end namespace Catch + +// end catch_console_colour.h +// start catch_reporter_registrars.hpp + + +namespace Catch { + + template + class ReporterRegistrar { + + class ReporterFactory : public IReporterFactory { + + virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override { + return std::unique_ptr( new T( config ) ); + } + + virtual std::string getDescription() const override { + return T::getDescription(); + } + }; + + public: + + explicit ReporterRegistrar( std::string const& name ) { + getMutableRegistryHub().registerReporter( name, std::make_shared() ); + } + }; + + template + class ListenerRegistrar { + + class ListenerFactory : public IReporterFactory { + + virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override { + return std::unique_ptr( new T( config ) ); + } + virtual std::string getDescription() const override { + return std::string(); + } + }; + + public: + + ListenerRegistrar() { + getMutableRegistryHub().registerListener( std::make_shared() ); + } + }; +} + +#if !defined(CATCH_CONFIG_DISABLE) + +#define CATCH_REGISTER_REPORTER( name, reporterType ) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::ReporterRegistrar catch_internal_RegistrarFor##reporterType( name ); } \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + +#define CATCH_REGISTER_LISTENER( listenerType ) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::ListenerRegistrar catch_internal_RegistrarFor##listenerType; } \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS +#else // CATCH_CONFIG_DISABLE + +#define CATCH_REGISTER_REPORTER(name, reporterType) +#define CATCH_REGISTER_LISTENER(listenerType) + +#endif // CATCH_CONFIG_DISABLE + +// end catch_reporter_registrars.hpp +// Allow users to base their work off existing reporters +// start catch_reporter_compact.h + +namespace Catch { + + struct CompactReporter : StreamingReporterBase { + + using StreamingReporterBase::StreamingReporterBase; + + ~CompactReporter() override; + + static std::string getDescription(); + + ReporterPreferences getPreferences() const override; + + void noMatchingTestCases(std::string const& spec) override; + + void assertionStarting(AssertionInfo const&) override; + + bool assertionEnded(AssertionStats const& _assertionStats) override; + + void sectionEnded(SectionStats const& _sectionStats) override; + + void testRunEnded(TestRunStats const& _testRunStats) override; + + }; + +} // end namespace Catch + +// end catch_reporter_compact.h +// start catch_reporter_console.h + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch + // Note that 4062 (not all labels are handled + // and default is missing) is enabled +#endif + +namespace Catch { + // Fwd decls + struct SummaryColumn; + class TablePrinter; + + struct ConsoleReporter : StreamingReporterBase { + std::unique_ptr m_tablePrinter; + + ConsoleReporter(ReporterConfig const& config); + ~ConsoleReporter() override; + static std::string getDescription(); + + void noMatchingTestCases(std::string const& spec) override; + + void assertionStarting(AssertionInfo const&) override; + + bool assertionEnded(AssertionStats const& _assertionStats) override; + + void sectionStarting(SectionInfo const& _sectionInfo) override; + void sectionEnded(SectionStats const& _sectionStats) override; + + void benchmarkStarting(BenchmarkInfo const& info) override; + void benchmarkEnded(BenchmarkStats const& stats) override; + + void testCaseEnded(TestCaseStats const& _testCaseStats) override; + void testGroupEnded(TestGroupStats const& _testGroupStats) override; + void testRunEnded(TestRunStats const& _testRunStats) override; + + private: + + void lazyPrint(); + + void lazyPrintWithoutClosingBenchmarkTable(); + void lazyPrintRunInfo(); + void lazyPrintGroupInfo(); + void printTestCaseAndSectionHeader(); + + void printClosedHeader(std::string const& _name); + void printOpenHeader(std::string const& _name); + + // if string has a : in first line will set indent to follow it on + // subsequent lines + void printHeaderString(std::string const& _string, std::size_t indent = 0); + + void printTotals(Totals const& totals); + void printSummaryRow(std::string const& label, std::vector const& cols, std::size_t row); + + void printTotalsDivider(Totals const& totals); + void printSummaryDivider(); + + private: + bool m_headerPrinted = false; + }; + +} // end namespace Catch + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + +// end catch_reporter_console.h +// start catch_reporter_junit.h + +// start catch_xmlwriter.h + +#include + +namespace Catch { + + class XmlEncode { + public: + enum ForWhat { ForTextNodes, ForAttributes }; + + XmlEncode( std::string const& str, ForWhat forWhat = ForTextNodes ); + + void encodeTo( std::ostream& os ) const; + + friend std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ); + + private: + std::string m_str; + ForWhat m_forWhat; + }; + + class XmlWriter { + public: + + class ScopedElement { + public: + ScopedElement( XmlWriter* writer ); + + ScopedElement( ScopedElement&& other ) noexcept; + ScopedElement& operator=( ScopedElement&& other ) noexcept; + + ~ScopedElement(); + + ScopedElement& writeText( std::string const& text, bool indent = true ); + + template + ScopedElement& writeAttribute( std::string const& name, T const& attribute ) { + m_writer->writeAttribute( name, attribute ); + return *this; + } + + private: + mutable XmlWriter* m_writer = nullptr; + }; + + XmlWriter( std::ostream& os = Catch::cout() ); + ~XmlWriter(); + + XmlWriter( XmlWriter const& ) = delete; + XmlWriter& operator=( XmlWriter const& ) = delete; + + XmlWriter& startElement( std::string const& name ); + + ScopedElement scopedElement( std::string const& name ); + + XmlWriter& endElement(); + + XmlWriter& writeAttribute( std::string const& name, std::string const& attribute ); + + XmlWriter& writeAttribute( std::string const& name, bool attribute ); + + template + XmlWriter& writeAttribute( std::string const& name, T const& attribute ) { + ReusableStringStream rss; + rss << attribute; + return writeAttribute( name, rss.str() ); + } + + XmlWriter& writeText( std::string const& text, bool indent = true ); + + XmlWriter& writeComment( std::string const& text ); + + void writeStylesheetRef( std::string const& url ); + + XmlWriter& writeBlankLine(); + + void ensureTagClosed(); + + private: + + void writeDeclaration(); + + void newlineIfNecessary(); + + bool m_tagIsOpen = false; + bool m_needsNewline = false; + std::vector m_tags; + std::string m_indent; + std::ostream& m_os; + }; + +} + +// end catch_xmlwriter.h +namespace Catch { + + class JunitReporter : public CumulativeReporterBase { + public: + JunitReporter(ReporterConfig const& _config); + + ~JunitReporter() override; + + static std::string getDescription(); + + void noMatchingTestCases(std::string const& /*spec*/) override; + + void testRunStarting(TestRunInfo const& runInfo) override; + + void testGroupStarting(GroupInfo const& groupInfo) override; + + void testCaseStarting(TestCaseInfo const& testCaseInfo) override; + bool assertionEnded(AssertionStats const& assertionStats) override; + + void testCaseEnded(TestCaseStats const& testCaseStats) override; + + void testGroupEnded(TestGroupStats const& testGroupStats) override; + + void testRunEndedCumulative() override; + + void writeGroup(TestGroupNode const& groupNode, double suiteTime); + + void writeTestCase(TestCaseNode const& testCaseNode); + + void writeSection(std::string const& className, + std::string const& rootName, + SectionNode const& sectionNode); + + void writeAssertions(SectionNode const& sectionNode); + void writeAssertion(AssertionStats const& stats); + + XmlWriter xml; + Timer suiteTimer; + std::string stdOutForSuite; + std::string stdErrForSuite; + unsigned int unexpectedExceptions = 0; + bool m_okToFail = false; + }; + +} // end namespace Catch + +// end catch_reporter_junit.h +// start catch_reporter_xml.h + +namespace Catch { + class XmlReporter : public StreamingReporterBase { + public: + XmlReporter(ReporterConfig const& _config); + + ~XmlReporter() override; + + static std::string getDescription(); + + virtual std::string getStylesheetRef() const; + + void writeSourceInfo(SourceLineInfo const& sourceInfo); + + public: // StreamingReporterBase + + void noMatchingTestCases(std::string const& s) override; + + void testRunStarting(TestRunInfo const& testInfo) override; + + void testGroupStarting(GroupInfo const& groupInfo) override; + + void testCaseStarting(TestCaseInfo const& testInfo) override; + + void sectionStarting(SectionInfo const& sectionInfo) override; + + void assertionStarting(AssertionInfo const&) override; + + bool assertionEnded(AssertionStats const& assertionStats) override; + + void sectionEnded(SectionStats const& sectionStats) override; + + void testCaseEnded(TestCaseStats const& testCaseStats) override; + + void testGroupEnded(TestGroupStats const& testGroupStats) override; + + void testRunEnded(TestRunStats const& testRunStats) override; + + private: + Timer m_testCaseTimer; + XmlWriter m_xml; + int m_sectionDepth = 0; + }; + +} // end namespace Catch + +// end catch_reporter_xml.h + +// end catch_external_interfaces.h +#endif + +#endif // ! CATCH_CONFIG_IMPL_ONLY + +#ifdef CATCH_IMPL +// start catch_impl.hpp + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wweak-vtables" +#endif + +// Keep these here for external reporters +// start catch_test_case_tracker.h + +#include +#include +#include + +namespace Catch { +namespace TestCaseTracking { + + struct NameAndLocation { + std::string name; + SourceLineInfo location; + + NameAndLocation( std::string const& _name, SourceLineInfo const& _location ); + }; + + struct ITracker; + + using ITrackerPtr = std::shared_ptr; + + struct ITracker { + virtual ~ITracker(); + + // static queries + virtual NameAndLocation const& nameAndLocation() const = 0; + + // dynamic queries + virtual bool isComplete() const = 0; // Successfully completed or failed + virtual bool isSuccessfullyCompleted() const = 0; + virtual bool isOpen() const = 0; // Started but not complete + virtual bool hasChildren() const = 0; + + virtual ITracker& parent() = 0; + + // actions + virtual void close() = 0; // Successfully complete + virtual void fail() = 0; + virtual void markAsNeedingAnotherRun() = 0; + + virtual void addChild( ITrackerPtr const& child ) = 0; + virtual ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) = 0; + virtual void openChild() = 0; + + // Debug/ checking + virtual bool isSectionTracker() const = 0; + virtual bool isIndexTracker() const = 0; + }; + + class TrackerContext { + + enum RunState { + NotStarted, + Executing, + CompletedCycle + }; + + ITrackerPtr m_rootTracker; + ITracker* m_currentTracker = nullptr; + RunState m_runState = NotStarted; + + public: + + static TrackerContext& instance(); + + ITracker& startRun(); + void endRun(); + + void startCycle(); + void completeCycle(); + + bool completedCycle() const; + ITracker& currentTracker(); + void setCurrentTracker( ITracker* tracker ); + }; + + class TrackerBase : public ITracker { + protected: + enum CycleState { + NotStarted, + Executing, + ExecutingChildren, + NeedsAnotherRun, + CompletedSuccessfully, + Failed + }; + + class TrackerHasName { + NameAndLocation m_nameAndLocation; + public: + TrackerHasName( NameAndLocation const& nameAndLocation ); + bool operator ()( ITrackerPtr const& tracker ) const; + }; + + using Children = std::vector; + NameAndLocation m_nameAndLocation; + TrackerContext& m_ctx; + ITracker* m_parent; + Children m_children; + CycleState m_runState = NotStarted; + + public: + TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); + + NameAndLocation const& nameAndLocation() const override; + bool isComplete() const override; + bool isSuccessfullyCompleted() const override; + bool isOpen() const override; + bool hasChildren() const override; + + void addChild( ITrackerPtr const& child ) override; + + ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) override; + ITracker& parent() override; + + void openChild() override; + + bool isSectionTracker() const override; + bool isIndexTracker() const override; + + void open(); + + void close() override; + void fail() override; + void markAsNeedingAnotherRun() override; + + private: + void moveToParent(); + void moveToThis(); + }; + + class SectionTracker : public TrackerBase { + std::vector m_filters; + public: + SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); + + bool isSectionTracker() const override; + + static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ); + + void tryOpen(); + + void addInitialFilters( std::vector const& filters ); + void addNextFilters( std::vector const& filters ); + }; + + class IndexTracker : public TrackerBase { + int m_size; + int m_index = -1; + public: + IndexTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent, int size ); + + bool isIndexTracker() const override; + void close() override; + + static IndexTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation, int size ); + + int index() const; + + void moveNext(); + }; + +} // namespace TestCaseTracking + +using TestCaseTracking::ITracker; +using TestCaseTracking::TrackerContext; +using TestCaseTracking::SectionTracker; +using TestCaseTracking::IndexTracker; + +} // namespace Catch + +// end catch_test_case_tracker.h + +// start catch_leak_detector.h + +namespace Catch { + + struct LeakDetector { + LeakDetector(); + }; + +} +// end catch_leak_detector.h +// Cpp files will be included in the single-header file here +// start catch_approx.cpp + +#include +#include + +namespace { + +// Performs equivalent check of std::fabs(lhs - rhs) <= margin +// But without the subtraction to allow for INFINITY in comparison +bool marginComparison(double lhs, double rhs, double margin) { + return (lhs + margin >= rhs) && (rhs + margin >= lhs); +} + +} + +namespace Catch { +namespace Detail { + + Approx::Approx ( double value ) + : m_epsilon( std::numeric_limits::epsilon()*100 ), + m_margin( 0.0 ), + m_scale( 0.0 ), + m_value( value ) + {} + + Approx Approx::custom() { + return Approx( 0 ); + } + + std::string Approx::toString() const { + ReusableStringStream rss; + rss << "Approx( " << ::Catch::Detail::stringify( m_value ) << " )"; + return rss.str(); + } + + bool Approx::equalityComparisonImpl(const double other) const { + // First try with fixed margin, then compute margin based on epsilon, scale and Approx's value + // Thanks to Richard Harris for his help refining the scaled margin value + return marginComparison(m_value, other, m_margin) || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(m_value))); + } + +} // end namespace Detail + +std::string StringMaker::convert(Catch::Detail::Approx const& value) { + return value.toString(); +} + +} // end namespace Catch +// end catch_approx.cpp +// start catch_assertionhandler.cpp + +// start catch_context.h + +#include + +namespace Catch { + + struct IResultCapture; + struct IRunner; + struct IConfig; + struct IMutableContext; + + using IConfigPtr = std::shared_ptr; + + struct IContext + { + virtual ~IContext(); + + virtual IResultCapture* getResultCapture() = 0; + virtual IRunner* getRunner() = 0; + virtual IConfigPtr const& getConfig() const = 0; + }; + + struct IMutableContext : IContext + { + virtual ~IMutableContext(); + virtual void setResultCapture( IResultCapture* resultCapture ) = 0; + virtual void setRunner( IRunner* runner ) = 0; + virtual void setConfig( IConfigPtr const& config ) = 0; + + private: + static IMutableContext *currentContext; + friend IMutableContext& getCurrentMutableContext(); + friend void cleanUpContext(); + static void createContext(); + }; + + inline IMutableContext& getCurrentMutableContext() + { + if( !IMutableContext::currentContext ) + IMutableContext::createContext(); + return *IMutableContext::currentContext; + } + + inline IContext& getCurrentContext() + { + return getCurrentMutableContext(); + } + + void cleanUpContext(); +} + +// end catch_context.h +// start catch_debugger.h + +namespace Catch { + bool isDebuggerActive(); +} + +#ifdef CATCH_PLATFORM_MAC + + #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ + +#elif defined(CATCH_PLATFORM_LINUX) + // If we can use inline assembler, do it because this allows us to break + // directly at the location of the failing check instead of breaking inside + // raise() called from it, i.e. one stack frame below. + #if defined(__GNUC__) && (defined(__i386) || defined(__x86_64)) + #define CATCH_TRAP() asm volatile ("int $3") /* NOLINT */ + #else // Fall back to the generic way. + #include + + #define CATCH_TRAP() raise(SIGTRAP) + #endif +#elif defined(_MSC_VER) + #define CATCH_TRAP() __debugbreak() +#elif defined(__MINGW32__) + extern "C" __declspec(dllimport) void __stdcall DebugBreak(); + #define CATCH_TRAP() DebugBreak() +#endif + +#ifdef CATCH_TRAP + #define CATCH_BREAK_INTO_DEBUGGER() if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } +#else + namespace Catch { + inline void doNothing() {} + } + #define CATCH_BREAK_INTO_DEBUGGER() Catch::doNothing() +#endif + +// end catch_debugger.h +// start catch_run_context.h + +// start catch_fatal_condition.h + +// start catch_windows_h_proxy.h + + +#if defined(CATCH_PLATFORM_WINDOWS) + +#if !defined(NOMINMAX) && !defined(CATCH_CONFIG_NO_NOMINMAX) +# define CATCH_DEFINED_NOMINMAX +# define NOMINMAX +#endif +#if !defined(WIN32_LEAN_AND_MEAN) && !defined(CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN) +# define CATCH_DEFINED_WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif + +#ifdef __AFXDLL +#include +#else +#include +#endif + +#ifdef CATCH_DEFINED_NOMINMAX +# undef NOMINMAX +#endif +#ifdef CATCH_DEFINED_WIN32_LEAN_AND_MEAN +# undef WIN32_LEAN_AND_MEAN +#endif + +#endif // defined(CATCH_PLATFORM_WINDOWS) + +// end catch_windows_h_proxy.h +#if defined( CATCH_CONFIG_WINDOWS_SEH ) + +namespace Catch { + + struct FatalConditionHandler { + + static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo); + FatalConditionHandler(); + static void reset(); + ~FatalConditionHandler(); + + private: + static bool isSet; + static ULONG guaranteeSize; + static PVOID exceptionHandlerHandle; + }; + +} // namespace Catch + +#elif defined ( CATCH_CONFIG_POSIX_SIGNALS ) + +#include + +namespace Catch { + + struct FatalConditionHandler { + + static bool isSet; + static struct sigaction oldSigActions[]; + static stack_t oldSigStack; + static char altStackMem[]; + + static void handleSignal( int sig ); + + FatalConditionHandler(); + ~FatalConditionHandler(); + static void reset(); + }; + +} // namespace Catch + +#else + +namespace Catch { + struct FatalConditionHandler { + void reset(); + }; +} + +#endif + +// end catch_fatal_condition.h +#include + +namespace Catch { + + struct IMutableContext; + + /////////////////////////////////////////////////////////////////////////// + + class RunContext : public IResultCapture, public IRunner { + + public: + RunContext( RunContext const& ) = delete; + RunContext& operator =( RunContext const& ) = delete; + + explicit RunContext( IConfigPtr const& _config, IStreamingReporterPtr&& reporter ); + + ~RunContext() override; + + void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount ); + void testGroupEnded( std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount ); + + Totals runTest(TestCase const& testCase); + + IConfigPtr config() const; + IStreamingReporter& reporter() const; + + public: // IResultCapture + + // Assertion handlers + void handleExpr + ( AssertionInfo const& info, + ITransientExpression const& expr, + AssertionReaction& reaction ) override; + void handleMessage + ( AssertionInfo const& info, + ResultWas::OfType resultType, + StringRef const& message, + AssertionReaction& reaction ) override; + void handleUnexpectedExceptionNotThrown + ( AssertionInfo const& info, + AssertionReaction& reaction ) override; + void handleUnexpectedInflightException + ( AssertionInfo const& info, + std::string const& message, + AssertionReaction& reaction ) override; + void handleIncomplete + ( AssertionInfo const& info ) override; + void handleNonExpr + ( AssertionInfo const &info, + ResultWas::OfType resultType, + AssertionReaction &reaction ) override; + + bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override; + + void sectionEnded( SectionEndInfo const& endInfo ) override; + void sectionEndedEarly( SectionEndInfo const& endInfo ) override; + + void benchmarkStarting( BenchmarkInfo const& info ) override; + void benchmarkEnded( BenchmarkStats const& stats ) override; + + void pushScopedMessage( MessageInfo const& message ) override; + void popScopedMessage( MessageInfo const& message ) override; + + std::string getCurrentTestName() const override; + + const AssertionResult* getLastResult() const override; + + void exceptionEarlyReported() override; + + void handleFatalErrorCondition( StringRef message ) override; + + bool lastAssertionPassed() override; + + void assertionPassed() override; + + public: + // !TBD We need to do this another way! + bool aborting() const final; + + private: + + void runCurrentTest( std::string& redirectedCout, std::string& redirectedCerr ); + void invokeActiveTestCase(); + + void resetAssertionInfo(); + bool testForMissingAssertions( Counts& assertions ); + + void assertionEnded( AssertionResult const& result ); + void reportExpr + ( AssertionInfo const &info, + ResultWas::OfType resultType, + ITransientExpression const *expr, + bool negated ); + + void populateReaction( AssertionReaction& reaction ); + + private: + + void handleUnfinishedSections(); + + TestRunInfo m_runInfo; + IMutableContext& m_context; + TestCase const* m_activeTestCase = nullptr; + ITracker* m_testCaseTracker; + Option m_lastResult; + + IConfigPtr m_config; + Totals m_totals; + IStreamingReporterPtr m_reporter; + std::vector m_messages; + AssertionInfo m_lastAssertionInfo; + std::vector m_unfinishedSections; + std::vector m_activeSections; + TrackerContext m_trackerContext; + bool m_lastAssertionPassed = false; + bool m_shouldReportUnexpected = true; + bool m_includeSuccessfulResults; + }; + +} // end namespace Catch + +// end catch_run_context.h +namespace Catch { + + auto operator <<( std::ostream& os, ITransientExpression const& expr ) -> std::ostream& { + expr.streamReconstructedExpression( os ); + return os; + } + + LazyExpression::LazyExpression( bool isNegated ) + : m_isNegated( isNegated ) + {} + + LazyExpression::LazyExpression( LazyExpression const& other ) : m_isNegated( other.m_isNegated ) {} + + LazyExpression::operator bool() const { + return m_transientExpression != nullptr; + } + + auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream& { + if( lazyExpr.m_isNegated ) + os << "!"; + + if( lazyExpr ) { + if( lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression() ) + os << "(" << *lazyExpr.m_transientExpression << ")"; + else + os << *lazyExpr.m_transientExpression; + } + else { + os << "{** error - unchecked empty expression requested **}"; + } + return os; + } + + AssertionHandler::AssertionHandler + ( StringRef macroName, + SourceLineInfo const& lineInfo, + StringRef capturedExpression, + ResultDisposition::Flags resultDisposition ) + : m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition }, + m_resultCapture( getResultCapture() ) + {} + + void AssertionHandler::handleExpr( ITransientExpression const& expr ) { + m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction ); + } + void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef const& message) { + m_resultCapture.handleMessage( m_assertionInfo, resultType, message, m_reaction ); + } + + auto AssertionHandler::allowThrows() const -> bool { + return getCurrentContext().getConfig()->allowThrows(); + } + + void AssertionHandler::complete() { + setCompleted(); + if( m_reaction.shouldDebugBreak ) { + + // If you find your debugger stopping you here then go one level up on the + // call-stack for the code that caused it (typically a failed assertion) + + // (To go back to the test and change execution, jump over the throw, next) + CATCH_BREAK_INTO_DEBUGGER(); + } + if( m_reaction.shouldThrow ) + throw Catch::TestFailureException(); + } + void AssertionHandler::setCompleted() { + m_completed = true; + } + + void AssertionHandler::handleUnexpectedInflightException() { + m_resultCapture.handleUnexpectedInflightException( m_assertionInfo, Catch::translateActiveException(), m_reaction ); + } + + void AssertionHandler::handleExceptionThrownAsExpected() { + m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction); + } + void AssertionHandler::handleExceptionNotThrownAsExpected() { + m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction); + } + + void AssertionHandler::handleUnexpectedExceptionNotThrown() { + m_resultCapture.handleUnexpectedExceptionNotThrown( m_assertionInfo, m_reaction ); + } + + void AssertionHandler::handleThrowingCallSkipped() { + m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction); + } + + // This is the overload that takes a string and infers the Equals matcher from it + // The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp + void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString ) { + handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString ); + } + +} // namespace Catch +// end catch_assertionhandler.cpp +// start catch_assertionresult.cpp + +namespace Catch { + AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression): + lazyExpression(_lazyExpression), + resultType(_resultType) {} + + std::string AssertionResultData::reconstructExpression() const { + + if( reconstructedExpression.empty() ) { + if( lazyExpression ) { + ReusableStringStream rss; + rss << lazyExpression; + reconstructedExpression = rss.str(); + } + } + return reconstructedExpression; + } + + AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data ) + : m_info( info ), + m_resultData( data ) + {} + + // Result was a success + bool AssertionResult::succeeded() const { + return Catch::isOk( m_resultData.resultType ); + } + + // Result was a success, or failure is suppressed + bool AssertionResult::isOk() const { + return Catch::isOk( m_resultData.resultType ) || shouldSuppressFailure( m_info.resultDisposition ); + } + + ResultWas::OfType AssertionResult::getResultType() const { + return m_resultData.resultType; + } + + bool AssertionResult::hasExpression() const { + return m_info.capturedExpression[0] != 0; + } + + bool AssertionResult::hasMessage() const { + return !m_resultData.message.empty(); + } + + std::string AssertionResult::getExpression() const { + if( isFalseTest( m_info.resultDisposition ) ) + return "!(" + m_info.capturedExpression + ")"; + else + return m_info.capturedExpression; + } + + std::string AssertionResult::getExpressionInMacro() const { + std::string expr; + if( m_info.macroName[0] == 0 ) + expr = m_info.capturedExpression; + else { + expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 ); + expr += m_info.macroName; + expr += "( "; + expr += m_info.capturedExpression; + expr += " )"; + } + return expr; + } + + bool AssertionResult::hasExpandedExpression() const { + return hasExpression() && getExpandedExpression() != getExpression(); + } + + std::string AssertionResult::getExpandedExpression() const { + std::string expr = m_resultData.reconstructExpression(); + return expr.empty() + ? getExpression() + : expr; + } + + std::string AssertionResult::getMessage() const { + return m_resultData.message; + } + SourceLineInfo AssertionResult::getSourceInfo() const { + return m_info.lineInfo; + } + + StringRef AssertionResult::getTestMacroName() const { + return m_info.macroName; + } + +} // end namespace Catch +// end catch_assertionresult.cpp +// start catch_benchmark.cpp + +namespace Catch { + + auto BenchmarkLooper::getResolution() -> uint64_t { + return getEstimatedClockResolution() * getCurrentContext().getConfig()->benchmarkResolutionMultiple(); + } + + void BenchmarkLooper::reportStart() { + getResultCapture().benchmarkStarting( { m_name } ); + } + auto BenchmarkLooper::needsMoreIterations() -> bool { + auto elapsed = m_timer.getElapsedNanoseconds(); + + // Exponentially increasing iterations until we're confident in our timer resolution + if( elapsed < m_resolution ) { + m_iterationsToRun *= 10; + return true; + } + + getResultCapture().benchmarkEnded( { { m_name }, m_count, elapsed } ); + return false; + } + +} // end namespace Catch +// end catch_benchmark.cpp +// start catch_capture_matchers.cpp + +namespace Catch { + + using StringMatcher = Matchers::Impl::MatcherBase; + + // This is the general overload that takes a any string matcher + // There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers + // the Equals matcher (so the header does not mention matchers) + void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ) { + std::string exceptionMessage = Catch::translateActiveException(); + MatchExpr expr( exceptionMessage, matcher, matcherString ); + handler.handleExpr( expr ); + } + +} // namespace Catch +// end catch_capture_matchers.cpp +// start catch_commandline.cpp + +// start catch_commandline.h + +// start catch_clara.h + +// Use Catch's value for console width (store Clara's off to the side, if present) +#ifdef CLARA_CONFIG_CONSOLE_WIDTH +#define CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH +#undef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH +#endif +#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CONFIG_CONSOLE_WIDTH-1 + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wweak-vtables" +#pragma clang diagnostic ignored "-Wexit-time-destructors" +#pragma clang diagnostic ignored "-Wshadow" +#endif + +// start clara.hpp +// Copyright 2017 Two Blue Cubes Ltd. All rights reserved. +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See https://github.com/philsquared/Clara for more details + +// Clara v1.1.4 + + +#ifndef CATCH_CLARA_CONFIG_CONSOLE_WIDTH +#define CATCH_CLARA_CONFIG_CONSOLE_WIDTH 80 +#endif + +#ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH +#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CLARA_CONFIG_CONSOLE_WIDTH +#endif + +#ifndef CLARA_CONFIG_OPTIONAL_TYPE +#ifdef __has_include +#if __has_include() && __cplusplus >= 201703L +#include +#define CLARA_CONFIG_OPTIONAL_TYPE std::optional +#endif +#endif +#endif + +// ----------- #included from clara_textflow.hpp ----------- + +// TextFlowCpp +// +// A single-header library for wrapping and laying out basic text, by Phil Nash +// +// This work is licensed under the BSD 2-Clause license. +// See the accompanying LICENSE file, or the one at https://opensource.org/licenses/BSD-2-Clause +// +// This project is hosted at https://github.com/philsquared/textflowcpp + + +#include +#include +#include +#include + +#ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH +#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80 +#endif + +namespace Catch { namespace clara { namespace TextFlow { + + inline auto isWhitespace( char c ) -> bool { + static std::string chars = " \t\n\r"; + return chars.find( c ) != std::string::npos; + } + inline auto isBreakableBefore( char c ) -> bool { + static std::string chars = "[({<|"; + return chars.find( c ) != std::string::npos; + } + inline auto isBreakableAfter( char c ) -> bool { + static std::string chars = "])}>.,:;*+-=&/\\"; + return chars.find( c ) != std::string::npos; + } + + class Columns; + + class Column { + std::vector m_strings; + size_t m_width = CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH; + size_t m_indent = 0; + size_t m_initialIndent = std::string::npos; + + public: + class iterator { + friend Column; + + Column const& m_column; + size_t m_stringIndex = 0; + size_t m_pos = 0; + + size_t m_len = 0; + size_t m_end = 0; + bool m_suffix = false; + + iterator( Column const& column, size_t stringIndex ) + : m_column( column ), + m_stringIndex( stringIndex ) + {} + + auto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; } + + auto isBoundary( size_t at ) const -> bool { + assert( at > 0 ); + assert( at <= line().size() ); + + return at == line().size() || + ( isWhitespace( line()[at] ) && !isWhitespace( line()[at-1] ) ) || + isBreakableBefore( line()[at] ) || + isBreakableAfter( line()[at-1] ); + } + + void calcLength() { + assert( m_stringIndex < m_column.m_strings.size() ); + + m_suffix = false; + auto width = m_column.m_width-indent(); + m_end = m_pos; + while( m_end < line().size() && line()[m_end] != '\n' ) + ++m_end; + + if( m_end < m_pos + width ) { + m_len = m_end - m_pos; + } + else { + size_t len = width; + while (len > 0 && !isBoundary(m_pos + len)) + --len; + while (len > 0 && isWhitespace( line()[m_pos + len - 1] )) + --len; + + if (len > 0) { + m_len = len; + } else { + m_suffix = true; + m_len = width - 1; + } + } + } + + auto indent() const -> size_t { + auto initial = m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos; + return initial == std::string::npos ? m_column.m_indent : initial; + } + + auto addIndentAndSuffix(std::string const &plain) const -> std::string { + return std::string( indent(), ' ' ) + (m_suffix ? plain + "-" : plain); + } + + public: + explicit iterator( Column const& column ) : m_column( column ) { + assert( m_column.m_width > m_column.m_indent ); + assert( m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent ); + calcLength(); + if( m_len == 0 ) + m_stringIndex++; // Empty string + } + + auto operator *() const -> std::string { + assert( m_stringIndex < m_column.m_strings.size() ); + assert( m_pos <= m_end ); + if( m_pos + m_column.m_width < m_end ) + return addIndentAndSuffix(line().substr(m_pos, m_len)); + else + return addIndentAndSuffix(line().substr(m_pos, m_end - m_pos)); + } + + auto operator ++() -> iterator& { + m_pos += m_len; + if( m_pos < line().size() && line()[m_pos] == '\n' ) + m_pos += 1; + else + while( m_pos < line().size() && isWhitespace( line()[m_pos] ) ) + ++m_pos; + + if( m_pos == line().size() ) { + m_pos = 0; + ++m_stringIndex; + } + if( m_stringIndex < m_column.m_strings.size() ) + calcLength(); + return *this; + } + auto operator ++(int) -> iterator { + iterator prev( *this ); + operator++(); + return prev; + } + + auto operator ==( iterator const& other ) const -> bool { + return + m_pos == other.m_pos && + m_stringIndex == other.m_stringIndex && + &m_column == &other.m_column; + } + auto operator !=( iterator const& other ) const -> bool { + return !operator==( other ); + } + }; + using const_iterator = iterator; + + explicit Column( std::string const& text ) { m_strings.push_back( text ); } + + auto width( size_t newWidth ) -> Column& { + assert( newWidth > 0 ); + m_width = newWidth; + return *this; + } + auto indent( size_t newIndent ) -> Column& { + m_indent = newIndent; + return *this; + } + auto initialIndent( size_t newIndent ) -> Column& { + m_initialIndent = newIndent; + return *this; + } + + auto width() const -> size_t { return m_width; } + auto begin() const -> iterator { return iterator( *this ); } + auto end() const -> iterator { return { *this, m_strings.size() }; } + + inline friend std::ostream& operator << ( std::ostream& os, Column const& col ) { + bool first = true; + for( auto line : col ) { + if( first ) + first = false; + else + os << "\n"; + os << line; + } + return os; + } + + auto operator + ( Column const& other ) -> Columns; + + auto toString() const -> std::string { + std::ostringstream oss; + oss << *this; + return oss.str(); + } + }; + + class Spacer : public Column { + + public: + explicit Spacer( size_t spaceWidth ) : Column( "" ) { + width( spaceWidth ); + } + }; + + class Columns { + std::vector m_columns; + + public: + + class iterator { + friend Columns; + struct EndTag {}; + + std::vector const& m_columns; + std::vector m_iterators; + size_t m_activeIterators; + + iterator( Columns const& columns, EndTag ) + : m_columns( columns.m_columns ), + m_activeIterators( 0 ) + { + m_iterators.reserve( m_columns.size() ); + + for( auto const& col : m_columns ) + m_iterators.push_back( col.end() ); + } + + public: + explicit iterator( Columns const& columns ) + : m_columns( columns.m_columns ), + m_activeIterators( m_columns.size() ) + { + m_iterators.reserve( m_columns.size() ); + + for( auto const& col : m_columns ) + m_iterators.push_back( col.begin() ); + } + + auto operator ==( iterator const& other ) const -> bool { + return m_iterators == other.m_iterators; + } + auto operator !=( iterator const& other ) const -> bool { + return m_iterators != other.m_iterators; + } + auto operator *() const -> std::string { + std::string row, padding; + + for( size_t i = 0; i < m_columns.size(); ++i ) { + auto width = m_columns[i].width(); + if( m_iterators[i] != m_columns[i].end() ) { + std::string col = *m_iterators[i]; + row += padding + col; + if( col.size() < width ) + padding = std::string( width - col.size(), ' ' ); + else + padding = ""; + } + else { + padding += std::string( width, ' ' ); + } + } + return row; + } + auto operator ++() -> iterator& { + for( size_t i = 0; i < m_columns.size(); ++i ) { + if (m_iterators[i] != m_columns[i].end()) + ++m_iterators[i]; + } + return *this; + } + auto operator ++(int) -> iterator { + iterator prev( *this ); + operator++(); + return prev; + } + }; + using const_iterator = iterator; + + auto begin() const -> iterator { return iterator( *this ); } + auto end() const -> iterator { return { *this, iterator::EndTag() }; } + + auto operator += ( Column const& col ) -> Columns& { + m_columns.push_back( col ); + return *this; + } + auto operator + ( Column const& col ) -> Columns { + Columns combined = *this; + combined += col; + return combined; + } + + inline friend std::ostream& operator << ( std::ostream& os, Columns const& cols ) { + + bool first = true; + for( auto line : cols ) { + if( first ) + first = false; + else + os << "\n"; + os << line; + } + return os; + } + + auto toString() const -> std::string { + std::ostringstream oss; + oss << *this; + return oss.str(); + } + }; + + inline auto Column::operator + ( Column const& other ) -> Columns { + Columns cols; + cols += *this; + cols += other; + return cols; + } +}}} // namespace Catch::clara::TextFlow + +// ----------- end of #include from clara_textflow.hpp ----------- +// ........... back in clara.hpp + +#include +#include +#include + +#if !defined(CATCH_PLATFORM_WINDOWS) && ( defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) ) +#define CATCH_PLATFORM_WINDOWS +#endif + +namespace Catch { namespace clara { +namespace detail { + + // Traits for extracting arg and return type of lambdas (for single argument lambdas) + template + struct UnaryLambdaTraits : UnaryLambdaTraits {}; + + template + struct UnaryLambdaTraits { + static const bool isValid = false; + }; + + template + struct UnaryLambdaTraits { + static const bool isValid = true; + using ArgType = typename std::remove_const::type>::type; + using ReturnType = ReturnT; + }; + + class TokenStream; + + // Transport for raw args (copied from main args, or supplied via init list for testing) + class Args { + friend TokenStream; + std::string m_exeName; + std::vector m_args; + + public: + Args( int argc, char const* const* argv ) + : m_exeName(argv[0]), + m_args(argv + 1, argv + argc) {} + + Args( std::initializer_list args ) + : m_exeName( *args.begin() ), + m_args( args.begin()+1, args.end() ) + {} + + auto exeName() const -> std::string { + return m_exeName; + } + }; + + // Wraps a token coming from a token stream. These may not directly correspond to strings as a single string + // may encode an option + its argument if the : or = form is used + enum class TokenType { + Option, Argument + }; + struct Token { + TokenType type; + std::string token; + }; + + inline auto isOptPrefix( char c ) -> bool { + return c == '-' +#ifdef CATCH_PLATFORM_WINDOWS + || c == '/' +#endif + ; + } + + // Abstracts iterators into args as a stream of tokens, with option arguments uniformly handled + class TokenStream { + using Iterator = std::vector::const_iterator; + Iterator it; + Iterator itEnd; + std::vector m_tokenBuffer; + + void loadBuffer() { + m_tokenBuffer.resize( 0 ); + + // Skip any empty strings + while( it != itEnd && it->empty() ) + ++it; + + if( it != itEnd ) { + auto const &next = *it; + if( isOptPrefix( next[0] ) ) { + auto delimiterPos = next.find_first_of( " :=" ); + if( delimiterPos != std::string::npos ) { + m_tokenBuffer.push_back( { TokenType::Option, next.substr( 0, delimiterPos ) } ); + m_tokenBuffer.push_back( { TokenType::Argument, next.substr( delimiterPos + 1 ) } ); + } else { + if( next[1] != '-' && next.size() > 2 ) { + std::string opt = "- "; + for( size_t i = 1; i < next.size(); ++i ) { + opt[1] = next[i]; + m_tokenBuffer.push_back( { TokenType::Option, opt } ); + } + } else { + m_tokenBuffer.push_back( { TokenType::Option, next } ); + } + } + } else { + m_tokenBuffer.push_back( { TokenType::Argument, next } ); + } + } + } + + public: + explicit TokenStream( Args const &args ) : TokenStream( args.m_args.begin(), args.m_args.end() ) {} + + TokenStream( Iterator it, Iterator itEnd ) : it( it ), itEnd( itEnd ) { + loadBuffer(); + } + + explicit operator bool() const { + return !m_tokenBuffer.empty() || it != itEnd; + } + + auto count() const -> size_t { return m_tokenBuffer.size() + (itEnd - it); } + + auto operator*() const -> Token { + assert( !m_tokenBuffer.empty() ); + return m_tokenBuffer.front(); + } + + auto operator->() const -> Token const * { + assert( !m_tokenBuffer.empty() ); + return &m_tokenBuffer.front(); + } + + auto operator++() -> TokenStream & { + if( m_tokenBuffer.size() >= 2 ) { + m_tokenBuffer.erase( m_tokenBuffer.begin() ); + } else { + if( it != itEnd ) + ++it; + loadBuffer(); + } + return *this; + } + }; + + class ResultBase { + public: + enum Type { + Ok, LogicError, RuntimeError + }; + + protected: + ResultBase( Type type ) : m_type( type ) {} + virtual ~ResultBase() = default; + + virtual void enforceOk() const = 0; + + Type m_type; + }; + + template + class ResultValueBase : public ResultBase { + public: + auto value() const -> T const & { + enforceOk(); + return m_value; + } + + protected: + ResultValueBase( Type type ) : ResultBase( type ) {} + + ResultValueBase( ResultValueBase const &other ) : ResultBase( other ) { + if( m_type == ResultBase::Ok ) + new( &m_value ) T( other.m_value ); + } + + ResultValueBase( Type, T const &value ) : ResultBase( Ok ) { + new( &m_value ) T( value ); + } + + auto operator=( ResultValueBase const &other ) -> ResultValueBase & { + if( m_type == ResultBase::Ok ) + m_value.~T(); + ResultBase::operator=(other); + if( m_type == ResultBase::Ok ) + new( &m_value ) T( other.m_value ); + return *this; + } + + ~ResultValueBase() override { + if( m_type == Ok ) + m_value.~T(); + } + + union { + T m_value; + }; + }; + + template<> + class ResultValueBase : public ResultBase { + protected: + using ResultBase::ResultBase; + }; + + template + class BasicResult : public ResultValueBase { + public: + template + explicit BasicResult( BasicResult const &other ) + : ResultValueBase( other.type() ), + m_errorMessage( other.errorMessage() ) + { + assert( type() != ResultBase::Ok ); + } + + template + static auto ok( U const &value ) -> BasicResult { return { ResultBase::Ok, value }; } + static auto ok() -> BasicResult { return { ResultBase::Ok }; } + static auto logicError( std::string const &message ) -> BasicResult { return { ResultBase::LogicError, message }; } + static auto runtimeError( std::string const &message ) -> BasicResult { return { ResultBase::RuntimeError, message }; } + + explicit operator bool() const { return m_type == ResultBase::Ok; } + auto type() const -> ResultBase::Type { return m_type; } + auto errorMessage() const -> std::string { return m_errorMessage; } + + protected: + void enforceOk() const override { + + // Errors shouldn't reach this point, but if they do + // the actual error message will be in m_errorMessage + assert( m_type != ResultBase::LogicError ); + assert( m_type != ResultBase::RuntimeError ); + if( m_type != ResultBase::Ok ) + std::abort(); + } + + std::string m_errorMessage; // Only populated if resultType is an error + + BasicResult( ResultBase::Type type, std::string const &message ) + : ResultValueBase(type), + m_errorMessage(message) + { + assert( m_type != ResultBase::Ok ); + } + + using ResultValueBase::ResultValueBase; + using ResultBase::m_type; + }; + + enum class ParseResultType { + Matched, NoMatch, ShortCircuitAll, ShortCircuitSame + }; + + class ParseState { + public: + + ParseState( ParseResultType type, TokenStream const &remainingTokens ) + : m_type(type), + m_remainingTokens( remainingTokens ) + {} + + auto type() const -> ParseResultType { return m_type; } + auto remainingTokens() const -> TokenStream { return m_remainingTokens; } + + private: + ParseResultType m_type; + TokenStream m_remainingTokens; + }; + + using Result = BasicResult; + using ParserResult = BasicResult; + using InternalParseResult = BasicResult; + + struct HelpColumns { + std::string left; + std::string right; + }; + + template + inline auto convertInto( std::string const &source, T& target ) -> ParserResult { + std::stringstream ss; + ss << source; + ss >> target; + if( ss.fail() ) + return ParserResult::runtimeError( "Unable to convert '" + source + "' to destination type" ); + else + return ParserResult::ok( ParseResultType::Matched ); + } + inline auto convertInto( std::string const &source, std::string& target ) -> ParserResult { + target = source; + return ParserResult::ok( ParseResultType::Matched ); + } + inline auto convertInto( std::string const &source, bool &target ) -> ParserResult { + std::string srcLC = source; + std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast( ::tolower(c) ); } ); + if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on") + target = true; + else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off") + target = false; + else + return ParserResult::runtimeError( "Expected a boolean value but did not recognise: '" + source + "'" ); + return ParserResult::ok( ParseResultType::Matched ); + } +#ifdef CLARA_CONFIG_OPTIONAL_TYPE + template + inline auto convertInto( std::string const &source, CLARA_CONFIG_OPTIONAL_TYPE& target ) -> ParserResult { + T temp; + auto result = convertInto( source, temp ); + if( result ) + target = std::move(temp); + return result; + } +#endif // CLARA_CONFIG_OPTIONAL_TYPE + + struct NonCopyable { + NonCopyable() = default; + NonCopyable( NonCopyable const & ) = delete; + NonCopyable( NonCopyable && ) = delete; + NonCopyable &operator=( NonCopyable const & ) = delete; + NonCopyable &operator=( NonCopyable && ) = delete; + }; + + struct BoundRef : NonCopyable { + virtual ~BoundRef() = default; + virtual auto isContainer() const -> bool { return false; } + virtual auto isFlag() const -> bool { return false; } + }; + struct BoundValueRefBase : BoundRef { + virtual auto setValue( std::string const &arg ) -> ParserResult = 0; + }; + struct BoundFlagRefBase : BoundRef { + virtual auto setFlag( bool flag ) -> ParserResult = 0; + virtual auto isFlag() const -> bool { return true; } + }; + + template + struct BoundValueRef : BoundValueRefBase { + T &m_ref; + + explicit BoundValueRef( T &ref ) : m_ref( ref ) {} + + auto setValue( std::string const &arg ) -> ParserResult override { + return convertInto( arg, m_ref ); + } + }; + + template + struct BoundValueRef> : BoundValueRefBase { + std::vector &m_ref; + + explicit BoundValueRef( std::vector &ref ) : m_ref( ref ) {} + + auto isContainer() const -> bool override { return true; } + + auto setValue( std::string const &arg ) -> ParserResult override { + T temp; + auto result = convertInto( arg, temp ); + if( result ) + m_ref.push_back( temp ); + return result; + } + }; + + struct BoundFlagRef : BoundFlagRefBase { + bool &m_ref; + + explicit BoundFlagRef( bool &ref ) : m_ref( ref ) {} + + auto setFlag( bool flag ) -> ParserResult override { + m_ref = flag; + return ParserResult::ok( ParseResultType::Matched ); + } + }; + + template + struct LambdaInvoker { + static_assert( std::is_same::value, "Lambda must return void or clara::ParserResult" ); + + template + static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult { + return lambda( arg ); + } + }; + + template<> + struct LambdaInvoker { + template + static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult { + lambda( arg ); + return ParserResult::ok( ParseResultType::Matched ); + } + }; + + template + inline auto invokeLambda( L const &lambda, std::string const &arg ) -> ParserResult { + ArgType temp{}; + auto result = convertInto( arg, temp ); + return !result + ? result + : LambdaInvoker::ReturnType>::invoke( lambda, temp ); + } + + template + struct BoundLambda : BoundValueRefBase { + L m_lambda; + + static_assert( UnaryLambdaTraits::isValid, "Supplied lambda must take exactly one argument" ); + explicit BoundLambda( L const &lambda ) : m_lambda( lambda ) {} + + auto setValue( std::string const &arg ) -> ParserResult override { + return invokeLambda::ArgType>( m_lambda, arg ); + } + }; + + template + struct BoundFlagLambda : BoundFlagRefBase { + L m_lambda; + + static_assert( UnaryLambdaTraits::isValid, "Supplied lambda must take exactly one argument" ); + static_assert( std::is_same::ArgType, bool>::value, "flags must be boolean" ); + + explicit BoundFlagLambda( L const &lambda ) : m_lambda( lambda ) {} + + auto setFlag( bool flag ) -> ParserResult override { + return LambdaInvoker::ReturnType>::invoke( m_lambda, flag ); + } + }; + + enum class Optionality { Optional, Required }; + + struct Parser; + + class ParserBase { + public: + virtual ~ParserBase() = default; + virtual auto validate() const -> Result { return Result::ok(); } + virtual auto parse( std::string const& exeName, TokenStream const &tokens) const -> InternalParseResult = 0; + virtual auto cardinality() const -> size_t { return 1; } + + auto parse( Args const &args ) const -> InternalParseResult { + return parse( args.exeName(), TokenStream( args ) ); + } + }; + + template + class ComposableParserImpl : public ParserBase { + public: + template + auto operator|( T const &other ) const -> Parser; + + template + auto operator+( T const &other ) const -> Parser; + }; + + // Common code and state for Args and Opts + template + class ParserRefImpl : public ComposableParserImpl { + protected: + Optionality m_optionality = Optionality::Optional; + std::shared_ptr m_ref; + std::string m_hint; + std::string m_description; + + explicit ParserRefImpl( std::shared_ptr const &ref ) : m_ref( ref ) {} + + public: + template + ParserRefImpl( T &ref, std::string const &hint ) + : m_ref( std::make_shared>( ref ) ), + m_hint( hint ) + {} + + template + ParserRefImpl( LambdaT const &ref, std::string const &hint ) + : m_ref( std::make_shared>( ref ) ), + m_hint(hint) + {} + + auto operator()( std::string const &description ) -> DerivedT & { + m_description = description; + return static_cast( *this ); + } + + auto optional() -> DerivedT & { + m_optionality = Optionality::Optional; + return static_cast( *this ); + }; + + auto required() -> DerivedT & { + m_optionality = Optionality::Required; + return static_cast( *this ); + }; + + auto isOptional() const -> bool { + return m_optionality == Optionality::Optional; + } + + auto cardinality() const -> size_t override { + if( m_ref->isContainer() ) + return 0; + else + return 1; + } + + auto hint() const -> std::string { return m_hint; } + }; + + class ExeName : public ComposableParserImpl { + std::shared_ptr m_name; + std::shared_ptr m_ref; + + template + static auto makeRef(LambdaT const &lambda) -> std::shared_ptr { + return std::make_shared>( lambda) ; + } + + public: + ExeName() : m_name( std::make_shared( "" ) ) {} + + explicit ExeName( std::string &ref ) : ExeName() { + m_ref = std::make_shared>( ref ); + } + + template + explicit ExeName( LambdaT const& lambda ) : ExeName() { + m_ref = std::make_shared>( lambda ); + } + + // The exe name is not parsed out of the normal tokens, but is handled specially + auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override { + return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) ); + } + + auto name() const -> std::string { return *m_name; } + auto set( std::string const& newName ) -> ParserResult { + + auto lastSlash = newName.find_last_of( "\\/" ); + auto filename = ( lastSlash == std::string::npos ) + ? newName + : newName.substr( lastSlash+1 ); + + *m_name = filename; + if( m_ref ) + return m_ref->setValue( filename ); + else + return ParserResult::ok( ParseResultType::Matched ); + } + }; + + class Arg : public ParserRefImpl { + public: + using ParserRefImpl::ParserRefImpl; + + auto parse( std::string const &, TokenStream const &tokens ) const -> InternalParseResult override { + auto validationResult = validate(); + if( !validationResult ) + return InternalParseResult( validationResult ); + + auto remainingTokens = tokens; + auto const &token = *remainingTokens; + if( token.type != TokenType::Argument ) + return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) ); + + assert( !m_ref->isFlag() ); + auto valueRef = static_cast( m_ref.get() ); + + auto result = valueRef->setValue( remainingTokens->token ); + if( !result ) + return InternalParseResult( result ); + else + return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) ); + } + }; + + inline auto normaliseOpt( std::string const &optName ) -> std::string { +#ifdef CATCH_PLATFORM_WINDOWS + if( optName[0] == '/' ) + return "-" + optName.substr( 1 ); + else +#endif + return optName; + } + + class Opt : public ParserRefImpl { + protected: + std::vector m_optNames; + + public: + template + explicit Opt( LambdaT const &ref ) : ParserRefImpl( std::make_shared>( ref ) ) {} + + explicit Opt( bool &ref ) : ParserRefImpl( std::make_shared( ref ) ) {} + + template + Opt( LambdaT const &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {} + + template + Opt( T &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {} + + auto operator[]( std::string const &optName ) -> Opt & { + m_optNames.push_back( optName ); + return *this; + } + + auto getHelpColumns() const -> std::vector { + std::ostringstream oss; + bool first = true; + for( auto const &opt : m_optNames ) { + if (first) + first = false; + else + oss << ", "; + oss << opt; + } + if( !m_hint.empty() ) + oss << " <" << m_hint << ">"; + return { { oss.str(), m_description } }; + } + + auto isMatch( std::string const &optToken ) const -> bool { + auto normalisedToken = normaliseOpt( optToken ); + for( auto const &name : m_optNames ) { + if( normaliseOpt( name ) == normalisedToken ) + return true; + } + return false; + } + + using ParserBase::parse; + + auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override { + auto validationResult = validate(); + if( !validationResult ) + return InternalParseResult( validationResult ); + + auto remainingTokens = tokens; + if( remainingTokens && remainingTokens->type == TokenType::Option ) { + auto const &token = *remainingTokens; + if( isMatch(token.token ) ) { + if( m_ref->isFlag() ) { + auto flagRef = static_cast( m_ref.get() ); + auto result = flagRef->setFlag( true ); + if( !result ) + return InternalParseResult( result ); + if( result.value() == ParseResultType::ShortCircuitAll ) + return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) ); + } else { + auto valueRef = static_cast( m_ref.get() ); + ++remainingTokens; + if( !remainingTokens ) + return InternalParseResult::runtimeError( "Expected argument following " + token.token ); + auto const &argToken = *remainingTokens; + if( argToken.type != TokenType::Argument ) + return InternalParseResult::runtimeError( "Expected argument following " + token.token ); + auto result = valueRef->setValue( argToken.token ); + if( !result ) + return InternalParseResult( result ); + if( result.value() == ParseResultType::ShortCircuitAll ) + return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) ); + } + return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) ); + } + } + return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) ); + } + + auto validate() const -> Result override { + if( m_optNames.empty() ) + return Result::logicError( "No options supplied to Opt" ); + for( auto const &name : m_optNames ) { + if( name.empty() ) + return Result::logicError( "Option name cannot be empty" ); +#ifdef CATCH_PLATFORM_WINDOWS + if( name[0] != '-' && name[0] != '/' ) + return Result::logicError( "Option name must begin with '-' or '/'" ); +#else + if( name[0] != '-' ) + return Result::logicError( "Option name must begin with '-'" ); +#endif + } + return ParserRefImpl::validate(); + } + }; + + struct Help : Opt { + Help( bool &showHelpFlag ) + : Opt([&]( bool flag ) { + showHelpFlag = flag; + return ParserResult::ok( ParseResultType::ShortCircuitAll ); + }) + { + static_cast( *this ) + ("display usage information") + ["-?"]["-h"]["--help"] + .optional(); + } + }; + + struct Parser : ParserBase { + + mutable ExeName m_exeName; + std::vector m_options; + std::vector m_args; + + auto operator|=( ExeName const &exeName ) -> Parser & { + m_exeName = exeName; + return *this; + } + + auto operator|=( Arg const &arg ) -> Parser & { + m_args.push_back(arg); + return *this; + } + + auto operator|=( Opt const &opt ) -> Parser & { + m_options.push_back(opt); + return *this; + } + + auto operator|=( Parser const &other ) -> Parser & { + m_options.insert(m_options.end(), other.m_options.begin(), other.m_options.end()); + m_args.insert(m_args.end(), other.m_args.begin(), other.m_args.end()); + return *this; + } + + template + auto operator|( T const &other ) const -> Parser { + return Parser( *this ) |= other; + } + + // Forward deprecated interface with '+' instead of '|' + template + auto operator+=( T const &other ) -> Parser & { return operator|=( other ); } + template + auto operator+( T const &other ) const -> Parser { return operator|( other ); } + + auto getHelpColumns() const -> std::vector { + std::vector cols; + for (auto const &o : m_options) { + auto childCols = o.getHelpColumns(); + cols.insert( cols.end(), childCols.begin(), childCols.end() ); + } + return cols; + } + + void writeToStream( std::ostream &os ) const { + if (!m_exeName.name().empty()) { + os << "usage:\n" << " " << m_exeName.name() << " "; + bool required = true, first = true; + for( auto const &arg : m_args ) { + if (first) + first = false; + else + os << " "; + if( arg.isOptional() && required ) { + os << "["; + required = false; + } + os << "<" << arg.hint() << ">"; + if( arg.cardinality() == 0 ) + os << " ... "; + } + if( !required ) + os << "]"; + if( !m_options.empty() ) + os << " options"; + os << "\n\nwhere options are:" << std::endl; + } + + auto rows = getHelpColumns(); + size_t consoleWidth = CATCH_CLARA_CONFIG_CONSOLE_WIDTH; + size_t optWidth = 0; + for( auto const &cols : rows ) + optWidth = (std::max)(optWidth, cols.left.size() + 2); + + optWidth = (std::min)(optWidth, consoleWidth/2); + + for( auto const &cols : rows ) { + auto row = + TextFlow::Column( cols.left ).width( optWidth ).indent( 2 ) + + TextFlow::Spacer(4) + + TextFlow::Column( cols.right ).width( consoleWidth - 7 - optWidth ); + os << row << std::endl; + } + } + + friend auto operator<<( std::ostream &os, Parser const &parser ) -> std::ostream& { + parser.writeToStream( os ); + return os; + } + + auto validate() const -> Result override { + for( auto const &opt : m_options ) { + auto result = opt.validate(); + if( !result ) + return result; + } + for( auto const &arg : m_args ) { + auto result = arg.validate(); + if( !result ) + return result; + } + return Result::ok(); + } + + using ParserBase::parse; + + auto parse( std::string const& exeName, TokenStream const &tokens ) const -> InternalParseResult override { + + struct ParserInfo { + ParserBase const* parser = nullptr; + size_t count = 0; + }; + const size_t totalParsers = m_options.size() + m_args.size(); + assert( totalParsers < 512 ); + // ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do + ParserInfo parseInfos[512]; + + { + size_t i = 0; + for (auto const &opt : m_options) parseInfos[i++].parser = &opt; + for (auto const &arg : m_args) parseInfos[i++].parser = &arg; + } + + m_exeName.set( exeName ); + + auto result = InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) ); + while( result.value().remainingTokens() ) { + bool tokenParsed = false; + + for( size_t i = 0; i < totalParsers; ++i ) { + auto& parseInfo = parseInfos[i]; + if( parseInfo.parser->cardinality() == 0 || parseInfo.count < parseInfo.parser->cardinality() ) { + result = parseInfo.parser->parse(exeName, result.value().remainingTokens()); + if (!result) + return result; + if (result.value().type() != ParseResultType::NoMatch) { + tokenParsed = true; + ++parseInfo.count; + break; + } + } + } + + if( result.value().type() == ParseResultType::ShortCircuitAll ) + return result; + if( !tokenParsed ) + return InternalParseResult::runtimeError( "Unrecognised token: " + result.value().remainingTokens()->token ); + } + // !TBD Check missing required options + return result; + } + }; + + template + template + auto ComposableParserImpl::operator|( T const &other ) const -> Parser { + return Parser() | static_cast( *this ) | other; + } +} // namespace detail + +// A Combined parser +using detail::Parser; + +// A parser for options +using detail::Opt; + +// A parser for arguments +using detail::Arg; + +// Wrapper for argc, argv from main() +using detail::Args; + +// Specifies the name of the executable +using detail::ExeName; + +// Convenience wrapper for option parser that specifies the help option +using detail::Help; + +// enum of result types from a parse +using detail::ParseResultType; + +// Result type for parser operation +using detail::ParserResult; + +}} // namespace Catch::clara + +// end clara.hpp +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +// Restore Clara's value for console width, if present +#ifdef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH +#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH +#undef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH +#endif + +// end catch_clara.h +namespace Catch { + + clara::Parser makeCommandLineParser( ConfigData& config ); + +} // end namespace Catch + +// end catch_commandline.h +#include +#include + +namespace Catch { + + clara::Parser makeCommandLineParser( ConfigData& config ) { + + using namespace clara; + + auto const setWarning = [&]( std::string const& warning ) { + auto warningSet = [&]() { + if( warning == "NoAssertions" ) + return WarnAbout::NoAssertions; + + if ( warning == "NoTests" ) + return WarnAbout::NoTests; + + return WarnAbout::Nothing; + }(); + + if (warningSet == WarnAbout::Nothing) + return ParserResult::runtimeError( "Unrecognised warning: '" + warning + "'" ); + config.warnings = static_cast( config.warnings | warningSet ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const loadTestNamesFromFile = [&]( std::string const& filename ) { + std::ifstream f( filename.c_str() ); + if( !f.is_open() ) + return ParserResult::runtimeError( "Unable to load input file: '" + filename + "'" ); + + std::string line; + while( std::getline( f, line ) ) { + line = trim(line); + if( !line.empty() && !startsWith( line, '#' ) ) { + if( !startsWith( line, '"' ) ) + line = '"' + line + '"'; + config.testsOrTags.push_back( line + ',' ); + } + } + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setTestOrder = [&]( std::string const& order ) { + if( startsWith( "declared", order ) ) + config.runOrder = RunTests::InDeclarationOrder; + else if( startsWith( "lexical", order ) ) + config.runOrder = RunTests::InLexicographicalOrder; + else if( startsWith( "random", order ) ) + config.runOrder = RunTests::InRandomOrder; + else + return clara::ParserResult::runtimeError( "Unrecognised ordering: '" + order + "'" ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setRngSeed = [&]( std::string const& seed ) { + if( seed != "time" ) + return clara::detail::convertInto( seed, config.rngSeed ); + config.rngSeed = static_cast( std::time(nullptr) ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setColourUsage = [&]( std::string const& useColour ) { + auto mode = toLower( useColour ); + + if( mode == "yes" ) + config.useColour = UseColour::Yes; + else if( mode == "no" ) + config.useColour = UseColour::No; + else if( mode == "auto" ) + config.useColour = UseColour::Auto; + else + return ParserResult::runtimeError( "colour mode must be one of: auto, yes or no. '" + useColour + "' not recognised" ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setWaitForKeypress = [&]( std::string const& keypress ) { + auto keypressLc = toLower( keypress ); + if( keypressLc == "start" ) + config.waitForKeypress = WaitForKeypress::BeforeStart; + else if( keypressLc == "exit" ) + config.waitForKeypress = WaitForKeypress::BeforeExit; + else if( keypressLc == "both" ) + config.waitForKeypress = WaitForKeypress::BeforeStartAndExit; + else + return ParserResult::runtimeError( "keypress argument must be one of: start, exit or both. '" + keypress + "' not recognised" ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setVerbosity = [&]( std::string const& verbosity ) { + auto lcVerbosity = toLower( verbosity ); + if( lcVerbosity == "quiet" ) + config.verbosity = Verbosity::Quiet; + else if( lcVerbosity == "normal" ) + config.verbosity = Verbosity::Normal; + else if( lcVerbosity == "high" ) + config.verbosity = Verbosity::High; + else + return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + "'" ); + return ParserResult::ok( ParseResultType::Matched ); + }; + + auto cli + = ExeName( config.processName ) + | Help( config.showHelp ) + | Opt( config.listTests ) + ["-l"]["--list-tests"] + ( "list all/matching test cases" ) + | Opt( config.listTags ) + ["-t"]["--list-tags"] + ( "list all/matching tags" ) + | Opt( config.showSuccessfulTests ) + ["-s"]["--success"] + ( "include successful tests in output" ) + | Opt( config.shouldDebugBreak ) + ["-b"]["--break"] + ( "break into debugger on failure" ) + | Opt( config.noThrow ) + ["-e"]["--nothrow"] + ( "skip exception tests" ) + | Opt( config.showInvisibles ) + ["-i"]["--invisibles"] + ( "show invisibles (tabs, newlines)" ) + | Opt( config.outputFilename, "filename" ) + ["-o"]["--out"] + ( "output filename" ) + | Opt( config.reporterNames, "name" ) + ["-r"]["--reporter"] + ( "reporter to use (defaults to console)" ) + | Opt( config.name, "name" ) + ["-n"]["--name"] + ( "suite name" ) + | Opt( [&]( bool ){ config.abortAfter = 1; } ) + ["-a"]["--abort"] + ( "abort at first failure" ) + | Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" ) + ["-x"]["--abortx"] + ( "abort after x failures" ) + | Opt( setWarning, "warning name" ) + ["-w"]["--warn"] + ( "enable warnings" ) + | Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" ) + ["-d"]["--durations"] + ( "show test durations" ) + | Opt( loadTestNamesFromFile, "filename" ) + ["-f"]["--input-file"] + ( "load test names to run from a file" ) + | Opt( config.filenamesAsTags ) + ["-#"]["--filenames-as-tags"] + ( "adds a tag for the filename" ) + | Opt( config.sectionsToRun, "section name" ) + ["-c"]["--section"] + ( "specify section to run" ) + | Opt( setVerbosity, "quiet|normal|high" ) + ["-v"]["--verbosity"] + ( "set output verbosity" ) + | Opt( config.listTestNamesOnly ) + ["--list-test-names-only"] + ( "list all/matching test cases names only" ) + | Opt( config.listReporters ) + ["--list-reporters"] + ( "list all reporters" ) + | Opt( setTestOrder, "decl|lex|rand" ) + ["--order"] + ( "test case order (defaults to decl)" ) + | Opt( setRngSeed, "'time'|number" ) + ["--rng-seed"] + ( "set a specific seed for random numbers" ) + | Opt( setColourUsage, "yes|no" ) + ["--use-colour"] + ( "should output be colourised" ) + | Opt( config.libIdentify ) + ["--libidentify"] + ( "report name and version according to libidentify standard" ) + | Opt( setWaitForKeypress, "start|exit|both" ) + ["--wait-for-keypress"] + ( "waits for a keypress before exiting" ) + | Opt( config.benchmarkResolutionMultiple, "multiplier" ) + ["--benchmark-resolution-multiple"] + ( "multiple of clock resolution to run benchmarks" ) + + | Arg( config.testsOrTags, "test name|pattern|tags" ) + ( "which test or tests to use" ); + + return cli; + } + +} // end namespace Catch +// end catch_commandline.cpp +// start catch_common.cpp + +#include +#include + +namespace Catch { + + bool SourceLineInfo::empty() const noexcept { + return file[0] == '\0'; + } + bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept { + return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0); + } + bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept { + return line < other.line || ( line == other.line && (std::strcmp(file, other.file) < 0)); + } + + std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) { +#ifndef __GNUG__ + os << info.file << '(' << info.line << ')'; +#else + os << info.file << ':' << info.line; +#endif + return os; + } + + std::string StreamEndStop::operator+() const { + return std::string(); + } + + NonCopyable::NonCopyable() = default; + NonCopyable::~NonCopyable() = default; + +} +// end catch_common.cpp +// start catch_config.cpp + +// start catch_enforce.h + +#include + +#define CATCH_PREPARE_EXCEPTION( type, msg ) \ + type( ( Catch::ReusableStringStream() << msg ).str() ) +#define CATCH_INTERNAL_ERROR( msg ) \ + throw CATCH_PREPARE_EXCEPTION( std::logic_error, CATCH_INTERNAL_LINEINFO << ": Internal Catch error: " << msg); +#define CATCH_ERROR( msg ) \ + throw CATCH_PREPARE_EXCEPTION( std::domain_error, msg ) +#define CATCH_ENFORCE( condition, msg ) \ + do{ if( !(condition) ) CATCH_ERROR( msg ); } while(false) + +// end catch_enforce.h +namespace Catch { + + Config::Config( ConfigData const& data ) + : m_data( data ), + m_stream( openStream() ) + { + TestSpecParser parser(ITagAliasRegistry::get()); + if (data.testsOrTags.empty()) { + parser.parse("~[.]"); // All not hidden tests + } + else { + m_hasTestFilters = true; + for( auto const& testOrTags : data.testsOrTags ) + parser.parse( testOrTags ); + } + m_testSpec = parser.testSpec(); + } + + std::string const& Config::getFilename() const { + return m_data.outputFilename ; + } + + bool Config::listTests() const { return m_data.listTests; } + bool Config::listTestNamesOnly() const { return m_data.listTestNamesOnly; } + bool Config::listTags() const { return m_data.listTags; } + bool Config::listReporters() const { return m_data.listReporters; } + + std::string Config::getProcessName() const { return m_data.processName; } + + std::vector const& Config::getReporterNames() const { return m_data.reporterNames; } + std::vector const& Config::getTestsOrTags() const { return m_data.testsOrTags; } + std::vector const& Config::getSectionsToRun() const { return m_data.sectionsToRun; } + + TestSpec const& Config::testSpec() const { return m_testSpec; } + bool Config::hasTestFilters() const { return m_hasTestFilters; } + + bool Config::showHelp() const { return m_data.showHelp; } + + // IConfig interface + bool Config::allowThrows() const { return !m_data.noThrow; } + std::ostream& Config::stream() const { return m_stream->stream(); } + std::string Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; } + bool Config::includeSuccessfulResults() const { return m_data.showSuccessfulTests; } + bool Config::warnAboutMissingAssertions() const { return !!(m_data.warnings & WarnAbout::NoAssertions); } + bool Config::warnAboutNoTests() const { return !!(m_data.warnings & WarnAbout::NoTests); } + ShowDurations::OrNot Config::showDurations() const { return m_data.showDurations; } + RunTests::InWhatOrder Config::runOrder() const { return m_data.runOrder; } + unsigned int Config::rngSeed() const { return m_data.rngSeed; } + int Config::benchmarkResolutionMultiple() const { return m_data.benchmarkResolutionMultiple; } + UseColour::YesOrNo Config::useColour() const { return m_data.useColour; } + bool Config::shouldDebugBreak() const { return m_data.shouldDebugBreak; } + int Config::abortAfter() const { return m_data.abortAfter; } + bool Config::showInvisibles() const { return m_data.showInvisibles; } + Verbosity Config::verbosity() const { return m_data.verbosity; } + + IStream const* Config::openStream() { + return Catch::makeStream(m_data.outputFilename); + } + +} // end namespace Catch +// end catch_config.cpp +// start catch_console_colour.cpp + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif + +// start catch_errno_guard.h + +namespace Catch { + + class ErrnoGuard { + public: + ErrnoGuard(); + ~ErrnoGuard(); + private: + int m_oldErrno; + }; + +} + +// end catch_errno_guard.h +#include + +namespace Catch { + namespace { + + struct IColourImpl { + virtual ~IColourImpl() = default; + virtual void use( Colour::Code _colourCode ) = 0; + }; + + struct NoColourImpl : IColourImpl { + void use( Colour::Code ) {} + + static IColourImpl* instance() { + static NoColourImpl s_instance; + return &s_instance; + } + }; + + } // anon namespace +} // namespace Catch + +#if !defined( CATCH_CONFIG_COLOUR_NONE ) && !defined( CATCH_CONFIG_COLOUR_WINDOWS ) && !defined( CATCH_CONFIG_COLOUR_ANSI ) +# ifdef CATCH_PLATFORM_WINDOWS +# define CATCH_CONFIG_COLOUR_WINDOWS +# else +# define CATCH_CONFIG_COLOUR_ANSI +# endif +#endif + +#if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) ///////////////////////////////////////// + +namespace Catch { +namespace { + + class Win32ColourImpl : public IColourImpl { + public: + Win32ColourImpl() : stdoutHandle( GetStdHandle(STD_OUTPUT_HANDLE) ) + { + CONSOLE_SCREEN_BUFFER_INFO csbiInfo; + GetConsoleScreenBufferInfo( stdoutHandle, &csbiInfo ); + originalForegroundAttributes = csbiInfo.wAttributes & ~( BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY ); + originalBackgroundAttributes = csbiInfo.wAttributes & ~( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY ); + } + + virtual void use( Colour::Code _colourCode ) override { + switch( _colourCode ) { + case Colour::None: return setTextAttribute( originalForegroundAttributes ); + case Colour::White: return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE ); + case Colour::Red: return setTextAttribute( FOREGROUND_RED ); + case Colour::Green: return setTextAttribute( FOREGROUND_GREEN ); + case Colour::Blue: return setTextAttribute( FOREGROUND_BLUE ); + case Colour::Cyan: return setTextAttribute( FOREGROUND_BLUE | FOREGROUND_GREEN ); + case Colour::Yellow: return setTextAttribute( FOREGROUND_RED | FOREGROUND_GREEN ); + case Colour::Grey: return setTextAttribute( 0 ); + + case Colour::LightGrey: return setTextAttribute( FOREGROUND_INTENSITY ); + case Colour::BrightRed: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED ); + case Colour::BrightGreen: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN ); + case Colour::BrightWhite: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE ); + case Colour::BrightYellow: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN ); + + case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" ); + + default: + CATCH_ERROR( "Unknown colour requested" ); + } + } + + private: + void setTextAttribute( WORD _textAttribute ) { + SetConsoleTextAttribute( stdoutHandle, _textAttribute | originalBackgroundAttributes ); + } + HANDLE stdoutHandle; + WORD originalForegroundAttributes; + WORD originalBackgroundAttributes; + }; + + IColourImpl* platformColourInstance() { + static Win32ColourImpl s_instance; + + IConfigPtr config = getCurrentContext().getConfig(); + UseColour::YesOrNo colourMode = config + ? config->useColour() + : UseColour::Auto; + if( colourMode == UseColour::Auto ) + colourMode = UseColour::Yes; + return colourMode == UseColour::Yes + ? &s_instance + : NoColourImpl::instance(); + } + +} // end anon namespace +} // end namespace Catch + +#elif defined( CATCH_CONFIG_COLOUR_ANSI ) ////////////////////////////////////// + +#include + +namespace Catch { +namespace { + + // use POSIX/ ANSI console terminal codes + // Thanks to Adam Strzelecki for original contribution + // (http://github.com/nanoant) + // https://github.com/philsquared/Catch/pull/131 + class PosixColourImpl : public IColourImpl { + public: + virtual void use( Colour::Code _colourCode ) override { + switch( _colourCode ) { + case Colour::None: + case Colour::White: return setColour( "[0m" ); + case Colour::Red: return setColour( "[0;31m" ); + case Colour::Green: return setColour( "[0;32m" ); + case Colour::Blue: return setColour( "[0;34m" ); + case Colour::Cyan: return setColour( "[0;36m" ); + case Colour::Yellow: return setColour( "[0;33m" ); + case Colour::Grey: return setColour( "[1;30m" ); + + case Colour::LightGrey: return setColour( "[0;37m" ); + case Colour::BrightRed: return setColour( "[1;31m" ); + case Colour::BrightGreen: return setColour( "[1;32m" ); + case Colour::BrightWhite: return setColour( "[1;37m" ); + case Colour::BrightYellow: return setColour( "[1;33m" ); + + case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" ); + default: CATCH_INTERNAL_ERROR( "Unknown colour requested" ); + } + } + static IColourImpl* instance() { + static PosixColourImpl s_instance; + return &s_instance; + } + + private: + void setColour( const char* _escapeCode ) { + Catch::cout() << '\033' << _escapeCode; + } + }; + + bool useColourOnPlatform() { + return +#ifdef CATCH_PLATFORM_MAC + !isDebuggerActive() && +#endif +#if !(defined(__DJGPP__) && defined(__STRICT_ANSI__)) + isatty(STDOUT_FILENO) +#else + false +#endif + ; + } + IColourImpl* platformColourInstance() { + ErrnoGuard guard; + IConfigPtr config = getCurrentContext().getConfig(); + UseColour::YesOrNo colourMode = config + ? config->useColour() + : UseColour::Auto; + if( colourMode == UseColour::Auto ) + colourMode = useColourOnPlatform() + ? UseColour::Yes + : UseColour::No; + return colourMode == UseColour::Yes + ? PosixColourImpl::instance() + : NoColourImpl::instance(); + } + +} // end anon namespace +} // end namespace Catch + +#else // not Windows or ANSI /////////////////////////////////////////////// + +namespace Catch { + + static IColourImpl* platformColourInstance() { return NoColourImpl::instance(); } + +} // end namespace Catch + +#endif // Windows/ ANSI/ None + +namespace Catch { + + Colour::Colour( Code _colourCode ) { use( _colourCode ); } + Colour::Colour( Colour&& rhs ) noexcept { + m_moved = rhs.m_moved; + rhs.m_moved = true; + } + Colour& Colour::operator=( Colour&& rhs ) noexcept { + m_moved = rhs.m_moved; + rhs.m_moved = true; + return *this; + } + + Colour::~Colour(){ if( !m_moved ) use( None ); } + + void Colour::use( Code _colourCode ) { + static IColourImpl* impl = platformColourInstance(); + impl->use( _colourCode ); + } + + std::ostream& operator << ( std::ostream& os, Colour const& ) { + return os; + } + +} // end namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + +// end catch_console_colour.cpp +// start catch_context.cpp + +namespace Catch { + + class Context : public IMutableContext, NonCopyable { + + public: // IContext + virtual IResultCapture* getResultCapture() override { + return m_resultCapture; + } + virtual IRunner* getRunner() override { + return m_runner; + } + + virtual IConfigPtr const& getConfig() const override { + return m_config; + } + + virtual ~Context() override; + + public: // IMutableContext + virtual void setResultCapture( IResultCapture* resultCapture ) override { + m_resultCapture = resultCapture; + } + virtual void setRunner( IRunner* runner ) override { + m_runner = runner; + } + virtual void setConfig( IConfigPtr const& config ) override { + m_config = config; + } + + friend IMutableContext& getCurrentMutableContext(); + + private: + IConfigPtr m_config; + IRunner* m_runner = nullptr; + IResultCapture* m_resultCapture = nullptr; + }; + + IMutableContext *IMutableContext::currentContext = nullptr; + + void IMutableContext::createContext() + { + currentContext = new Context(); + } + + void cleanUpContext() { + delete IMutableContext::currentContext; + IMutableContext::currentContext = nullptr; + } + IContext::~IContext() = default; + IMutableContext::~IMutableContext() = default; + Context::~Context() = default; +} +// end catch_context.cpp +// start catch_debug_console.cpp + +// start catch_debug_console.h + +#include + +namespace Catch { + void writeToDebugConsole( std::string const& text ); +} + +// end catch_debug_console.h +#ifdef CATCH_PLATFORM_WINDOWS + + namespace Catch { + void writeToDebugConsole( std::string const& text ) { + ::OutputDebugStringA( text.c_str() ); + } + } + +#else + + namespace Catch { + void writeToDebugConsole( std::string const& text ) { + // !TBD: Need a version for Mac/ XCode and other IDEs + Catch::cout() << text; + } + } + +#endif // Platform +// end catch_debug_console.cpp +// start catch_debugger.cpp + +#ifdef CATCH_PLATFORM_MAC + +# include +# include +# include +# include +# include +# include +# include + +namespace Catch { + + // The following function is taken directly from the following technical note: + // http://developer.apple.com/library/mac/#qa/qa2004/qa1361.html + + // Returns true if the current process is being debugged (either + // running under the debugger or has a debugger attached post facto). + bool isDebuggerActive(){ + + int mib[4]; + struct kinfo_proc info; + std::size_t size; + + // Initialize the flags so that, if sysctl fails for some bizarre + // reason, we get a predictable result. + + info.kp_proc.p_flag = 0; + + // Initialize mib, which tells sysctl the info we want, in this case + // we're looking for information about a specific process ID. + + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PID; + mib[3] = getpid(); + + // Call sysctl. + + size = sizeof(info); + if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, nullptr, 0) != 0 ) { + Catch::cerr() << "\n** Call to sysctl failed - unable to determine if debugger is active **\n" << std::endl; + return false; + } + + // We're being debugged if the P_TRACED flag is set. + + return ( (info.kp_proc.p_flag & P_TRACED) != 0 ); + } + } // namespace Catch + +#elif defined(CATCH_PLATFORM_LINUX) + #include + #include + + namespace Catch{ + // The standard POSIX way of detecting a debugger is to attempt to + // ptrace() the process, but this needs to be done from a child and not + // this process itself to still allow attaching to this process later + // if wanted, so is rather heavy. Under Linux we have the PID of the + // "debugger" (which doesn't need to be gdb, of course, it could also + // be strace, for example) in /proc/$PID/status, so just get it from + // there instead. + bool isDebuggerActive(){ + // Libstdc++ has a bug, where std::ifstream sets errno to 0 + // This way our users can properly assert over errno values + ErrnoGuard guard; + std::ifstream in("/proc/self/status"); + for( std::string line; std::getline(in, line); ) { + static const int PREFIX_LEN = 11; + if( line.compare(0, PREFIX_LEN, "TracerPid:\t") == 0 ) { + // We're traced if the PID is not 0 and no other PID starts + // with 0 digit, so it's enough to check for just a single + // character. + return line.length() > PREFIX_LEN && line[PREFIX_LEN] != '0'; + } + } + + return false; + } + } // namespace Catch +#elif defined(_MSC_VER) + extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent(); + namespace Catch { + bool isDebuggerActive() { + return IsDebuggerPresent() != 0; + } + } +#elif defined(__MINGW32__) + extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent(); + namespace Catch { + bool isDebuggerActive() { + return IsDebuggerPresent() != 0; + } + } +#else + namespace Catch { + bool isDebuggerActive() { return false; } + } +#endif // Platform +// end catch_debugger.cpp +// start catch_decomposer.cpp + +namespace Catch { + + ITransientExpression::~ITransientExpression() = default; + + void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) { + if( lhs.size() + rhs.size() < 40 && + lhs.find('\n') == std::string::npos && + rhs.find('\n') == std::string::npos ) + os << lhs << " " << op << " " << rhs; + else + os << lhs << "\n" << op << "\n" << rhs; + } +} +// end catch_decomposer.cpp +// start catch_errno_guard.cpp + +#include + +namespace Catch { + ErrnoGuard::ErrnoGuard():m_oldErrno(errno){} + ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; } +} +// end catch_errno_guard.cpp +// start catch_exception_translator_registry.cpp + +// start catch_exception_translator_registry.h + +#include +#include +#include + +namespace Catch { + + class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry { + public: + ~ExceptionTranslatorRegistry(); + virtual void registerTranslator( const IExceptionTranslator* translator ); + virtual std::string translateActiveException() const override; + std::string tryTranslators() const; + + private: + std::vector> m_translators; + }; +} + +// end catch_exception_translator_registry.h +#ifdef __OBJC__ +#import "Foundation/Foundation.h" +#endif + +namespace Catch { + + ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() { + } + + void ExceptionTranslatorRegistry::registerTranslator( const IExceptionTranslator* translator ) { + m_translators.push_back( std::unique_ptr( translator ) ); + } + + std::string ExceptionTranslatorRegistry::translateActiveException() const { + try { +#ifdef __OBJC__ + // In Objective-C try objective-c exceptions first + @try { + return tryTranslators(); + } + @catch (NSException *exception) { + return Catch::Detail::stringify( [exception description] ); + } +#else + // Compiling a mixed mode project with MSVC means that CLR + // exceptions will be caught in (...) as well. However, these + // do not fill-in std::current_exception and thus lead to crash + // when attempting rethrow. + // /EHa switch also causes structured exceptions to be caught + // here, but they fill-in current_exception properly, so + // at worst the output should be a little weird, instead of + // causing a crash. + if (std::current_exception() == nullptr) { + return "Non C++ exception. Possibly a CLR exception."; + } + return tryTranslators(); +#endif + } + catch( TestFailureException& ) { + std::rethrow_exception(std::current_exception()); + } + catch( std::exception& ex ) { + return ex.what(); + } + catch( std::string& msg ) { + return msg; + } + catch( const char* msg ) { + return msg; + } + catch(...) { + return "Unknown exception"; + } + } + + std::string ExceptionTranslatorRegistry::tryTranslators() const { + if( m_translators.empty() ) + std::rethrow_exception(std::current_exception()); + else + return m_translators[0]->translate( m_translators.begin()+1, m_translators.end() ); + } +} +// end catch_exception_translator_registry.cpp +// start catch_fatal_condition.cpp + +#if defined(__GNUC__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif + +#if defined( CATCH_CONFIG_WINDOWS_SEH ) || defined( CATCH_CONFIG_POSIX_SIGNALS ) + +namespace { + // Report the error condition + void reportFatal( char const * const message ) { + Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message ); + } +} + +#endif // signals/SEH handling + +#if defined( CATCH_CONFIG_WINDOWS_SEH ) + +namespace Catch { + struct SignalDefs { DWORD id; const char* name; }; + + // There is no 1-1 mapping between signals and windows exceptions. + // Windows can easily distinguish between SO and SigSegV, + // but SigInt, SigTerm, etc are handled differently. + static SignalDefs signalDefs[] = { + { EXCEPTION_ILLEGAL_INSTRUCTION, "SIGILL - Illegal instruction signal" }, + { EXCEPTION_STACK_OVERFLOW, "SIGSEGV - Stack overflow" }, + { EXCEPTION_ACCESS_VIOLATION, "SIGSEGV - Segmentation violation signal" }, + { EXCEPTION_INT_DIVIDE_BY_ZERO, "Divide by zero error" }, + }; + + LONG CALLBACK FatalConditionHandler::handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) { + for (auto const& def : signalDefs) { + if (ExceptionInfo->ExceptionRecord->ExceptionCode == def.id) { + reportFatal(def.name); + } + } + // If its not an exception we care about, pass it along. + // This stops us from eating debugger breaks etc. + return EXCEPTION_CONTINUE_SEARCH; + } + + FatalConditionHandler::FatalConditionHandler() { + isSet = true; + // 32k seems enough for Catch to handle stack overflow, + // but the value was found experimentally, so there is no strong guarantee + guaranteeSize = 32 * 1024; + exceptionHandlerHandle = nullptr; + // Register as first handler in current chain + exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException); + // Pass in guarantee size to be filled + SetThreadStackGuarantee(&guaranteeSize); + } + + void FatalConditionHandler::reset() { + if (isSet) { + RemoveVectoredExceptionHandler(exceptionHandlerHandle); + SetThreadStackGuarantee(&guaranteeSize); + exceptionHandlerHandle = nullptr; + isSet = false; + } + } + + FatalConditionHandler::~FatalConditionHandler() { + reset(); + } + +bool FatalConditionHandler::isSet = false; +ULONG FatalConditionHandler::guaranteeSize = 0; +PVOID FatalConditionHandler::exceptionHandlerHandle = nullptr; + +} // namespace Catch + +#elif defined( CATCH_CONFIG_POSIX_SIGNALS ) + +namespace Catch { + + struct SignalDefs { + int id; + const char* name; + }; + static SignalDefs signalDefs[] = { + { SIGINT, "SIGINT - Terminal interrupt signal" }, + { SIGILL, "SIGILL - Illegal instruction signal" }, + { SIGFPE, "SIGFPE - Floating point error signal" }, + { SIGSEGV, "SIGSEGV - Segmentation violation signal" }, + { SIGTERM, "SIGTERM - Termination request signal" }, + { SIGABRT, "SIGABRT - Abort (abnormal termination) signal" } + }; + + void FatalConditionHandler::handleSignal( int sig ) { + char const * name = ""; + for (auto const& def : signalDefs) { + if (sig == def.id) { + name = def.name; + break; + } + } + reset(); + reportFatal(name); + raise( sig ); + } + + FatalConditionHandler::FatalConditionHandler() { + isSet = true; + stack_t sigStack; + sigStack.ss_sp = altStackMem; + sigStack.ss_size = SIGSTKSZ; + sigStack.ss_flags = 0; + sigaltstack(&sigStack, &oldSigStack); + struct sigaction sa = { }; + + sa.sa_handler = handleSignal; + sa.sa_flags = SA_ONSTACK; + for (std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i) { + sigaction(signalDefs[i].id, &sa, &oldSigActions[i]); + } + } + + FatalConditionHandler::~FatalConditionHandler() { + reset(); + } + + void FatalConditionHandler::reset() { + if( isSet ) { + // Set signals back to previous values -- hopefully nobody overwrote them in the meantime + for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) { + sigaction(signalDefs[i].id, &oldSigActions[i], nullptr); + } + // Return the old stack + sigaltstack(&oldSigStack, nullptr); + isSet = false; + } + } + + bool FatalConditionHandler::isSet = false; + struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {}; + stack_t FatalConditionHandler::oldSigStack = {}; + char FatalConditionHandler::altStackMem[SIGSTKSZ] = {}; + +} // namespace Catch + +#else + +namespace Catch { + void FatalConditionHandler::reset() {} +} + +#endif // signals/SEH handling + +#if defined(__GNUC__) +# pragma GCC diagnostic pop +#endif +// end catch_fatal_condition.cpp +// start catch_interfaces_capture.cpp + +namespace Catch { + IResultCapture::~IResultCapture() = default; +} +// end catch_interfaces_capture.cpp +// start catch_interfaces_config.cpp + +namespace Catch { + IConfig::~IConfig() = default; +} +// end catch_interfaces_config.cpp +// start catch_interfaces_exception.cpp + +namespace Catch { + IExceptionTranslator::~IExceptionTranslator() = default; + IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default; +} +// end catch_interfaces_exception.cpp +// start catch_interfaces_registry_hub.cpp + +namespace Catch { + IRegistryHub::~IRegistryHub() = default; + IMutableRegistryHub::~IMutableRegistryHub() = default; +} +// end catch_interfaces_registry_hub.cpp +// start catch_interfaces_reporter.cpp + +// start catch_reporter_multi.h + +namespace Catch { + + class MultipleReporters : public IStreamingReporter { + using Reporters = std::vector; + Reporters m_reporters; + + public: + void add( IStreamingReporterPtr&& reporter ); + + public: // IStreamingReporter + + ReporterPreferences getPreferences() const override; + + void noMatchingTestCases( std::string const& spec ) override; + + static std::set getSupportedVerbosities(); + + void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override; + void benchmarkEnded( BenchmarkStats const& benchmarkStats ) override; + + void testRunStarting( TestRunInfo const& testRunInfo ) override; + void testGroupStarting( GroupInfo const& groupInfo ) override; + void testCaseStarting( TestCaseInfo const& testInfo ) override; + void sectionStarting( SectionInfo const& sectionInfo ) override; + void assertionStarting( AssertionInfo const& assertionInfo ) override; + + // The return value indicates if the messages buffer should be cleared: + bool assertionEnded( AssertionStats const& assertionStats ) override; + void sectionEnded( SectionStats const& sectionStats ) override; + void testCaseEnded( TestCaseStats const& testCaseStats ) override; + void testGroupEnded( TestGroupStats const& testGroupStats ) override; + void testRunEnded( TestRunStats const& testRunStats ) override; + + void skipTest( TestCaseInfo const& testInfo ) override; + bool isMulti() const override; + + }; + +} // end namespace Catch + +// end catch_reporter_multi.h +namespace Catch { + + ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig ) + : m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {} + + ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream ) + : m_stream( &_stream ), m_fullConfig( _fullConfig ) {} + + std::ostream& ReporterConfig::stream() const { return *m_stream; } + IConfigPtr ReporterConfig::fullConfig() const { return m_fullConfig; } + + TestRunInfo::TestRunInfo( std::string const& _name ) : name( _name ) {} + + GroupInfo::GroupInfo( std::string const& _name, + std::size_t _groupIndex, + std::size_t _groupsCount ) + : name( _name ), + groupIndex( _groupIndex ), + groupsCounts( _groupsCount ) + {} + + AssertionStats::AssertionStats( AssertionResult const& _assertionResult, + std::vector const& _infoMessages, + Totals const& _totals ) + : assertionResult( _assertionResult ), + infoMessages( _infoMessages ), + totals( _totals ) + { + assertionResult.m_resultData.lazyExpression.m_transientExpression = _assertionResult.m_resultData.lazyExpression.m_transientExpression; + + if( assertionResult.hasMessage() ) { + // Copy message into messages list. + // !TBD This should have been done earlier, somewhere + MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() ); + builder << assertionResult.getMessage(); + builder.m_info.message = builder.m_stream.str(); + + infoMessages.push_back( builder.m_info ); + } + } + + AssertionStats::~AssertionStats() = default; + + SectionStats::SectionStats( SectionInfo const& _sectionInfo, + Counts const& _assertions, + double _durationInSeconds, + bool _missingAssertions ) + : sectionInfo( _sectionInfo ), + assertions( _assertions ), + durationInSeconds( _durationInSeconds ), + missingAssertions( _missingAssertions ) + {} + + SectionStats::~SectionStats() = default; + + TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo, + Totals const& _totals, + std::string const& _stdOut, + std::string const& _stdErr, + bool _aborting ) + : testInfo( _testInfo ), + totals( _totals ), + stdOut( _stdOut ), + stdErr( _stdErr ), + aborting( _aborting ) + {} + + TestCaseStats::~TestCaseStats() = default; + + TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo, + Totals const& _totals, + bool _aborting ) + : groupInfo( _groupInfo ), + totals( _totals ), + aborting( _aborting ) + {} + + TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo ) + : groupInfo( _groupInfo ), + aborting( false ) + {} + + TestGroupStats::~TestGroupStats() = default; + + TestRunStats::TestRunStats( TestRunInfo const& _runInfo, + Totals const& _totals, + bool _aborting ) + : runInfo( _runInfo ), + totals( _totals ), + aborting( _aborting ) + {} + + TestRunStats::~TestRunStats() = default; + + void IStreamingReporter::fatalErrorEncountered( StringRef ) {} + bool IStreamingReporter::isMulti() const { return false; } + + IReporterFactory::~IReporterFactory() = default; + IReporterRegistry::~IReporterRegistry() = default; + + void addReporter( IStreamingReporterPtr& existingReporter, IStreamingReporterPtr&& additionalReporter ) { + + if( !existingReporter ) { + existingReporter = std::move( additionalReporter ); + return; + } + + MultipleReporters* multi = nullptr; + + if( existingReporter->isMulti() ) { + multi = static_cast( existingReporter.get() ); + } + else { + auto newMulti = std::unique_ptr( new MultipleReporters ); + newMulti->add( std::move( existingReporter ) ); + multi = newMulti.get(); + existingReporter = std::move( newMulti ); + } + multi->add( std::move( additionalReporter ) ); + } + +} // end namespace Catch +// end catch_interfaces_reporter.cpp +// start catch_interfaces_runner.cpp + +namespace Catch { + IRunner::~IRunner() = default; +} +// end catch_interfaces_runner.cpp +// start catch_interfaces_testcase.cpp + +namespace Catch { + ITestInvoker::~ITestInvoker() = default; + ITestCaseRegistry::~ITestCaseRegistry() = default; +} +// end catch_interfaces_testcase.cpp +// start catch_leak_detector.cpp + +#ifdef CATCH_CONFIG_WINDOWS_CRTDBG +#include + +namespace Catch { + + LeakDetector::LeakDetector() { + int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); + flag |= _CRTDBG_LEAK_CHECK_DF; + flag |= _CRTDBG_ALLOC_MEM_DF; + _CrtSetDbgFlag(flag); + _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); + // Change this to leaking allocation's number to break there + _CrtSetBreakAlloc(-1); + } +} + +#else + + Catch::LeakDetector::LeakDetector() {} + +#endif +// end catch_leak_detector.cpp +// start catch_list.cpp + +// start catch_list.h + +#include + +namespace Catch { + + std::size_t listTests( Config const& config ); + + std::size_t listTestsNamesOnly( Config const& config ); + + struct TagInfo { + void add( std::string const& spelling ); + std::string all() const; + + std::set spellings; + std::size_t count = 0; + }; + + std::size_t listTags( Config const& config ); + + std::size_t listReporters( Config const& /*config*/ ); + + Option list( Config const& config ); + +} // end namespace Catch + +// end catch_list.h +// start catch_text.h + +namespace Catch { + using namespace clara::TextFlow; +} + +// end catch_text.h +#include +#include +#include + +namespace Catch { + + std::size_t listTests( Config const& config ) { + TestSpec testSpec = config.testSpec(); + if( config.hasTestFilters() ) + Catch::cout() << "Matching test cases:\n"; + else { + Catch::cout() << "All available test cases:\n"; + } + + auto matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); + for( auto const& testCaseInfo : matchedTestCases ) { + Colour::Code colour = testCaseInfo.isHidden() + ? Colour::SecondaryText + : Colour::None; + Colour colourGuard( colour ); + + Catch::cout() << Column( testCaseInfo.name ).initialIndent( 2 ).indent( 4 ) << "\n"; + if( config.verbosity() >= Verbosity::High ) { + Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl; + std::string description = testCaseInfo.description; + if( description.empty() ) + description = "(NO DESCRIPTION)"; + Catch::cout() << Column( description ).indent(4) << std::endl; + } + if( !testCaseInfo.tags.empty() ) + Catch::cout() << Column( testCaseInfo.tagsAsString() ).indent( 6 ) << "\n"; + } + + if( !config.hasTestFilters() ) + Catch::cout() << pluralise( matchedTestCases.size(), "test case" ) << '\n' << std::endl; + else + Catch::cout() << pluralise( matchedTestCases.size(), "matching test case" ) << '\n' << std::endl; + return matchedTestCases.size(); + } + + std::size_t listTestsNamesOnly( Config const& config ) { + TestSpec testSpec = config.testSpec(); + std::size_t matchedTests = 0; + std::vector matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); + for( auto const& testCaseInfo : matchedTestCases ) { + matchedTests++; + if( startsWith( testCaseInfo.name, '#' ) ) + Catch::cout() << '"' << testCaseInfo.name << '"'; + else + Catch::cout() << testCaseInfo.name; + if ( config.verbosity() >= Verbosity::High ) + Catch::cout() << "\t@" << testCaseInfo.lineInfo; + Catch::cout() << std::endl; + } + return matchedTests; + } + + void TagInfo::add( std::string const& spelling ) { + ++count; + spellings.insert( spelling ); + } + + std::string TagInfo::all() const { + std::string out; + for( auto const& spelling : spellings ) + out += "[" + spelling + "]"; + return out; + } + + std::size_t listTags( Config const& config ) { + TestSpec testSpec = config.testSpec(); + if( config.hasTestFilters() ) + Catch::cout() << "Tags for matching test cases:\n"; + else { + Catch::cout() << "All available tags:\n"; + } + + std::map tagCounts; + + std::vector matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); + for( auto const& testCase : matchedTestCases ) { + for( auto const& tagName : testCase.getTestCaseInfo().tags ) { + std::string lcaseTagName = toLower( tagName ); + auto countIt = tagCounts.find( lcaseTagName ); + if( countIt == tagCounts.end() ) + countIt = tagCounts.insert( std::make_pair( lcaseTagName, TagInfo() ) ).first; + countIt->second.add( tagName ); + } + } + + for( auto const& tagCount : tagCounts ) { + ReusableStringStream rss; + rss << " " << std::setw(2) << tagCount.second.count << " "; + auto str = rss.str(); + auto wrapper = Column( tagCount.second.all() ) + .initialIndent( 0 ) + .indent( str.size() ) + .width( CATCH_CONFIG_CONSOLE_WIDTH-10 ); + Catch::cout() << str << wrapper << '\n'; + } + Catch::cout() << pluralise( tagCounts.size(), "tag" ) << '\n' << std::endl; + return tagCounts.size(); + } + + std::size_t listReporters( Config const& /*config*/ ) { + Catch::cout() << "Available reporters:\n"; + IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); + std::size_t maxNameLen = 0; + for( auto const& factoryKvp : factories ) + maxNameLen = (std::max)( maxNameLen, factoryKvp.first.size() ); + + for( auto const& factoryKvp : factories ) { + Catch::cout() + << Column( factoryKvp.first + ":" ) + .indent(2) + .width( 5+maxNameLen ) + + Column( factoryKvp.second->getDescription() ) + .initialIndent(0) + .indent(2) + .width( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen-8 ) + << "\n"; + } + Catch::cout() << std::endl; + return factories.size(); + } + + Option list( Config const& config ) { + Option listedCount; + if( config.listTests() ) + listedCount = listedCount.valueOr(0) + listTests( config ); + if( config.listTestNamesOnly() ) + listedCount = listedCount.valueOr(0) + listTestsNamesOnly( config ); + if( config.listTags() ) + listedCount = listedCount.valueOr(0) + listTags( config ); + if( config.listReporters() ) + listedCount = listedCount.valueOr(0) + listReporters( config ); + return listedCount; + } + +} // end namespace Catch +// end catch_list.cpp +// start catch_matchers.cpp + +namespace Catch { +namespace Matchers { + namespace Impl { + + std::string MatcherUntypedBase::toString() const { + if( m_cachedToString.empty() ) + m_cachedToString = describe(); + return m_cachedToString; + } + + MatcherUntypedBase::~MatcherUntypedBase() = default; + + } // namespace Impl +} // namespace Matchers + +using namespace Matchers; +using Matchers::Impl::MatcherBase; + +} // namespace Catch +// end catch_matchers.cpp +// start catch_matchers_floating.cpp + +#include +#include +#include +#include + +namespace Catch { +namespace Matchers { +namespace Floating { +enum class FloatingPointKind : uint8_t { + Float, + Double +}; +} +} +} + +namespace { + +template +struct Converter; + +template <> +struct Converter { + static_assert(sizeof(float) == sizeof(int32_t), "Important ULP matcher assumption violated"); + Converter(float f) { + std::memcpy(&i, &f, sizeof(f)); + } + int32_t i; +}; + +template <> +struct Converter { + static_assert(sizeof(double) == sizeof(int64_t), "Important ULP matcher assumption violated"); + Converter(double d) { + std::memcpy(&i, &d, sizeof(d)); + } + int64_t i; +}; + +template +auto convert(T t) -> Converter { + return Converter(t); +} + +template +bool almostEqualUlps(FP lhs, FP rhs, int maxUlpDiff) { + // Comparison with NaN should always be false. + // This way we can rule it out before getting into the ugly details + if (std::isnan(lhs) || std::isnan(rhs)) { + return false; + } + + auto lc = convert(lhs); + auto rc = convert(rhs); + + if ((lc.i < 0) != (rc.i < 0)) { + // Potentially we can have +0 and -0 + return lhs == rhs; + } + + auto ulpDiff = std::abs(lc.i - rc.i); + return ulpDiff <= maxUlpDiff; +} + +} + +namespace Catch { +namespace Matchers { +namespace Floating { + WithinAbsMatcher::WithinAbsMatcher(double target, double margin) + :m_target{ target }, m_margin{ margin } { + if (m_margin < 0) { + throw std::domain_error("Allowed margin difference has to be >= 0"); + } + } + + // Performs equivalent check of std::fabs(lhs - rhs) <= margin + // But without the subtraction to allow for INFINITY in comparison + bool WithinAbsMatcher::match(double const& matchee) const { + return (matchee + m_margin >= m_target) && (m_target + m_margin >= matchee); + } + + std::string WithinAbsMatcher::describe() const { + return "is within " + ::Catch::Detail::stringify(m_margin) + " of " + ::Catch::Detail::stringify(m_target); + } + + WithinUlpsMatcher::WithinUlpsMatcher(double target, int ulps, FloatingPointKind baseType) + :m_target{ target }, m_ulps{ ulps }, m_type{ baseType } { + if (m_ulps < 0) { + throw std::domain_error("Allowed ulp difference has to be >= 0"); + } + } + + bool WithinUlpsMatcher::match(double const& matchee) const { + switch (m_type) { + case FloatingPointKind::Float: + return almostEqualUlps(static_cast(matchee), static_cast(m_target), m_ulps); + case FloatingPointKind::Double: + return almostEqualUlps(matchee, m_target, m_ulps); + default: + throw std::domain_error("Unknown FloatingPointKind value"); + } + } + + std::string WithinUlpsMatcher::describe() const { + return "is within " + std::to_string(m_ulps) + " ULPs of " + ::Catch::Detail::stringify(m_target) + ((m_type == FloatingPointKind::Float)? "f" : ""); + } + +}// namespace Floating + +Floating::WithinUlpsMatcher WithinULP(double target, int maxUlpDiff) { + return Floating::WithinUlpsMatcher(target, maxUlpDiff, Floating::FloatingPointKind::Double); +} + +Floating::WithinUlpsMatcher WithinULP(float target, int maxUlpDiff) { + return Floating::WithinUlpsMatcher(target, maxUlpDiff, Floating::FloatingPointKind::Float); +} + +Floating::WithinAbsMatcher WithinAbs(double target, double margin) { + return Floating::WithinAbsMatcher(target, margin); +} + +} // namespace Matchers +} // namespace Catch + +// end catch_matchers_floating.cpp +// start catch_matchers_generic.cpp + +std::string Catch::Matchers::Generic::Detail::finalizeDescription(const std::string& desc) { + if (desc.empty()) { + return "matches undescribed predicate"; + } else { + return "matches predicate: \"" + desc + '"'; + } +} +// end catch_matchers_generic.cpp +// start catch_matchers_string.cpp + +#include + +namespace Catch { +namespace Matchers { + + namespace StdString { + + CasedString::CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity ) + : m_caseSensitivity( caseSensitivity ), + m_str( adjustString( str ) ) + {} + std::string CasedString::adjustString( std::string const& str ) const { + return m_caseSensitivity == CaseSensitive::No + ? toLower( str ) + : str; + } + std::string CasedString::caseSensitivitySuffix() const { + return m_caseSensitivity == CaseSensitive::No + ? " (case insensitive)" + : std::string(); + } + + StringMatcherBase::StringMatcherBase( std::string const& operation, CasedString const& comparator ) + : m_comparator( comparator ), + m_operation( operation ) { + } + + std::string StringMatcherBase::describe() const { + std::string description; + description.reserve(5 + m_operation.size() + m_comparator.m_str.size() + + m_comparator.caseSensitivitySuffix().size()); + description += m_operation; + description += ": \""; + description += m_comparator.m_str; + description += "\""; + description += m_comparator.caseSensitivitySuffix(); + return description; + } + + EqualsMatcher::EqualsMatcher( CasedString const& comparator ) : StringMatcherBase( "equals", comparator ) {} + + bool EqualsMatcher::match( std::string const& source ) const { + return m_comparator.adjustString( source ) == m_comparator.m_str; + } + + ContainsMatcher::ContainsMatcher( CasedString const& comparator ) : StringMatcherBase( "contains", comparator ) {} + + bool ContainsMatcher::match( std::string const& source ) const { + return contains( m_comparator.adjustString( source ), m_comparator.m_str ); + } + + StartsWithMatcher::StartsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "starts with", comparator ) {} + + bool StartsWithMatcher::match( std::string const& source ) const { + return startsWith( m_comparator.adjustString( source ), m_comparator.m_str ); + } + + EndsWithMatcher::EndsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "ends with", comparator ) {} + + bool EndsWithMatcher::match( std::string const& source ) const { + return endsWith( m_comparator.adjustString( source ), m_comparator.m_str ); + } + + RegexMatcher::RegexMatcher(std::string regex, CaseSensitive::Choice caseSensitivity): m_regex(std::move(regex)), m_caseSensitivity(caseSensitivity) {} + + bool RegexMatcher::match(std::string const& matchee) const { + auto flags = std::regex::ECMAScript; // ECMAScript is the default syntax option anyway + if (m_caseSensitivity == CaseSensitive::Choice::No) { + flags |= std::regex::icase; + } + auto reg = std::regex(m_regex, flags); + return std::regex_match(matchee, reg); + } + + std::string RegexMatcher::describe() const { + return "matches " + ::Catch::Detail::stringify(m_regex) + ((m_caseSensitivity == CaseSensitive::Choice::Yes)? " case sensitively" : " case insensitively"); + } + + } // namespace StdString + + StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity ) { + return StdString::EqualsMatcher( StdString::CasedString( str, caseSensitivity) ); + } + StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity ) { + return StdString::ContainsMatcher( StdString::CasedString( str, caseSensitivity) ); + } + StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) { + return StdString::EndsWithMatcher( StdString::CasedString( str, caseSensitivity) ); + } + StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) { + return StdString::StartsWithMatcher( StdString::CasedString( str, caseSensitivity) ); + } + + StdString::RegexMatcher Matches(std::string const& regex, CaseSensitive::Choice caseSensitivity) { + return StdString::RegexMatcher(regex, caseSensitivity); + } + +} // namespace Matchers +} // namespace Catch +// end catch_matchers_string.cpp +// start catch_message.cpp + +// start catch_uncaught_exceptions.h + +namespace Catch { + bool uncaught_exceptions(); +} // end namespace Catch + +// end catch_uncaught_exceptions.h +namespace Catch { + + MessageInfo::MessageInfo( std::string const& _macroName, + SourceLineInfo const& _lineInfo, + ResultWas::OfType _type ) + : macroName( _macroName ), + lineInfo( _lineInfo ), + type( _type ), + sequence( ++globalCount ) + {} + + bool MessageInfo::operator==( MessageInfo const& other ) const { + return sequence == other.sequence; + } + + bool MessageInfo::operator<( MessageInfo const& other ) const { + return sequence < other.sequence; + } + + // This may need protecting if threading support is added + unsigned int MessageInfo::globalCount = 0; + + //////////////////////////////////////////////////////////////////////////// + + Catch::MessageBuilder::MessageBuilder( std::string const& macroName, + SourceLineInfo const& lineInfo, + ResultWas::OfType type ) + :m_info(macroName, lineInfo, type) {} + + //////////////////////////////////////////////////////////////////////////// + + ScopedMessage::ScopedMessage( MessageBuilder const& builder ) + : m_info( builder.m_info ) + { + m_info.message = builder.m_stream.str(); + getResultCapture().pushScopedMessage( m_info ); + } + + ScopedMessage::~ScopedMessage() { + if ( !uncaught_exceptions() ){ + getResultCapture().popScopedMessage(m_info); + } + } +} // end namespace Catch +// end catch_message.cpp +// start catch_random_number_generator.cpp + +// start catch_random_number_generator.h + +#include + +namespace Catch { + + struct IConfig; + + void seedRng( IConfig const& config ); + + unsigned int rngSeed(); + + struct RandomNumberGenerator { + using result_type = unsigned int; + + static constexpr result_type (min)() { return 0; } + static constexpr result_type (max)() { return 1000000; } + + result_type operator()( result_type n ) const; + result_type operator()() const; + + template + static void shuffle( V& vector ) { + RandomNumberGenerator rng; + std::shuffle( vector.begin(), vector.end(), rng ); + } + }; + +} + +// end catch_random_number_generator.h +#include + +namespace Catch { + + void seedRng( IConfig const& config ) { + if( config.rngSeed() != 0 ) + std::srand( config.rngSeed() ); + } + unsigned int rngSeed() { + return getCurrentContext().getConfig()->rngSeed(); + } + + RandomNumberGenerator::result_type RandomNumberGenerator::operator()( result_type n ) const { + return std::rand() % n; + } + RandomNumberGenerator::result_type RandomNumberGenerator::operator()() const { + return std::rand() % (max)(); + } + +} +// end catch_random_number_generator.cpp +// start catch_registry_hub.cpp + +// start catch_test_case_registry_impl.h + +#include +#include +#include +#include + +namespace Catch { + + class TestCase; + struct IConfig; + + std::vector sortTests( IConfig const& config, std::vector const& unsortedTestCases ); + bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); + + void enforceNoDuplicateTestCases( std::vector const& functions ); + + std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); + std::vector const& getAllTestCasesSorted( IConfig const& config ); + + class TestRegistry : public ITestCaseRegistry { + public: + virtual ~TestRegistry() = default; + + virtual void registerTest( TestCase const& testCase ); + + std::vector const& getAllTests() const override; + std::vector const& getAllTestsSorted( IConfig const& config ) const override; + + private: + std::vector m_functions; + mutable RunTests::InWhatOrder m_currentSortOrder = RunTests::InDeclarationOrder; + mutable std::vector m_sortedFunctions; + std::size_t m_unnamedCount = 0; + std::ios_base::Init m_ostreamInit; // Forces cout/ cerr to be initialised + }; + + /////////////////////////////////////////////////////////////////////////// + + class TestInvokerAsFunction : public ITestInvoker { + void(*m_testAsFunction)(); + public: + TestInvokerAsFunction( void(*testAsFunction)() ) noexcept; + + void invoke() const override; + }; + + std::string extractClassName( StringRef const& classOrQualifiedMethodName ); + + /////////////////////////////////////////////////////////////////////////// + +} // end namespace Catch + +// end catch_test_case_registry_impl.h +// start catch_reporter_registry.h + +#include + +namespace Catch { + + class ReporterRegistry : public IReporterRegistry { + + public: + + ~ReporterRegistry() override; + + IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override; + + void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ); + void registerListener( IReporterFactoryPtr const& factory ); + + FactoryMap const& getFactories() const override; + Listeners const& getListeners() const override; + + private: + FactoryMap m_factories; + Listeners m_listeners; + }; +} + +// end catch_reporter_registry.h +// start catch_tag_alias_registry.h + +// start catch_tag_alias.h + +#include + +namespace Catch { + + struct TagAlias { + TagAlias(std::string const& _tag, SourceLineInfo _lineInfo); + + std::string tag; + SourceLineInfo lineInfo; + }; + +} // end namespace Catch + +// end catch_tag_alias.h +#include + +namespace Catch { + + class TagAliasRegistry : public ITagAliasRegistry { + public: + ~TagAliasRegistry() override; + TagAlias const* find( std::string const& alias ) const override; + std::string expandAliases( std::string const& unexpandedTestSpec ) const override; + void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ); + + private: + std::map m_registry; + }; + +} // end namespace Catch + +// end catch_tag_alias_registry.h +// start catch_startup_exception_registry.h + +#include +#include + +namespace Catch { + + class StartupExceptionRegistry { + public: + void add(std::exception_ptr const& exception) noexcept; + std::vector const& getExceptions() const noexcept; + private: + std::vector m_exceptions; + }; + +} // end namespace Catch + +// end catch_startup_exception_registry.h +namespace Catch { + + namespace { + + class RegistryHub : public IRegistryHub, public IMutableRegistryHub, + private NonCopyable { + + public: // IRegistryHub + RegistryHub() = default; + IReporterRegistry const& getReporterRegistry() const override { + return m_reporterRegistry; + } + ITestCaseRegistry const& getTestCaseRegistry() const override { + return m_testCaseRegistry; + } + IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() override { + return m_exceptionTranslatorRegistry; + } + ITagAliasRegistry const& getTagAliasRegistry() const override { + return m_tagAliasRegistry; + } + StartupExceptionRegistry const& getStartupExceptionRegistry() const override { + return m_exceptionRegistry; + } + + public: // IMutableRegistryHub + void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) override { + m_reporterRegistry.registerReporter( name, factory ); + } + void registerListener( IReporterFactoryPtr const& factory ) override { + m_reporterRegistry.registerListener( factory ); + } + void registerTest( TestCase const& testInfo ) override { + m_testCaseRegistry.registerTest( testInfo ); + } + void registerTranslator( const IExceptionTranslator* translator ) override { + m_exceptionTranslatorRegistry.registerTranslator( translator ); + } + void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override { + m_tagAliasRegistry.add( alias, tag, lineInfo ); + } + void registerStartupException() noexcept override { + m_exceptionRegistry.add(std::current_exception()); + } + + private: + TestRegistry m_testCaseRegistry; + ReporterRegistry m_reporterRegistry; + ExceptionTranslatorRegistry m_exceptionTranslatorRegistry; + TagAliasRegistry m_tagAliasRegistry; + StartupExceptionRegistry m_exceptionRegistry; + }; + + // Single, global, instance + RegistryHub*& getTheRegistryHub() { + static RegistryHub* theRegistryHub = nullptr; + if( !theRegistryHub ) + theRegistryHub = new RegistryHub(); + return theRegistryHub; + } + } + + IRegistryHub& getRegistryHub() { + return *getTheRegistryHub(); + } + IMutableRegistryHub& getMutableRegistryHub() { + return *getTheRegistryHub(); + } + void cleanUp() { + delete getTheRegistryHub(); + getTheRegistryHub() = nullptr; + cleanUpContext(); + ReusableStringStream::cleanup(); + } + std::string translateActiveException() { + return getRegistryHub().getExceptionTranslatorRegistry().translateActiveException(); + } + +} // end namespace Catch +// end catch_registry_hub.cpp +// start catch_reporter_registry.cpp + +namespace Catch { + + ReporterRegistry::~ReporterRegistry() = default; + + IStreamingReporterPtr ReporterRegistry::create( std::string const& name, IConfigPtr const& config ) const { + auto it = m_factories.find( name ); + if( it == m_factories.end() ) + return nullptr; + return it->second->create( ReporterConfig( config ) ); + } + + void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) { + m_factories.emplace(name, factory); + } + void ReporterRegistry::registerListener( IReporterFactoryPtr const& factory ) { + m_listeners.push_back( factory ); + } + + IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const { + return m_factories; + } + IReporterRegistry::Listeners const& ReporterRegistry::getListeners() const { + return m_listeners; + } + +} +// end catch_reporter_registry.cpp +// start catch_result_type.cpp + +namespace Catch { + + bool isOk( ResultWas::OfType resultType ) { + return ( resultType & ResultWas::FailureBit ) == 0; + } + bool isJustInfo( int flags ) { + return flags == ResultWas::Info; + } + + ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) { + return static_cast( static_cast( lhs ) | static_cast( rhs ) ); + } + + bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; } + bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; } + +} // end namespace Catch +// end catch_result_type.cpp +// start catch_run_context.cpp + +#include +#include +#include + +namespace Catch { + + class RedirectedStream { + std::ostream& m_originalStream; + std::ostream& m_redirectionStream; + std::streambuf* m_prevBuf; + + public: + RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream ) + : m_originalStream( originalStream ), + m_redirectionStream( redirectionStream ), + m_prevBuf( m_originalStream.rdbuf() ) + { + m_originalStream.rdbuf( m_redirectionStream.rdbuf() ); + } + ~RedirectedStream() { + m_originalStream.rdbuf( m_prevBuf ); + } + }; + + class RedirectedStdOut { + ReusableStringStream m_rss; + RedirectedStream m_cout; + public: + RedirectedStdOut() : m_cout( Catch::cout(), m_rss.get() ) {} + auto str() const -> std::string { return m_rss.str(); } + }; + + // StdErr has two constituent streams in C++, std::cerr and std::clog + // This means that we need to redirect 2 streams into 1 to keep proper + // order of writes + class RedirectedStdErr { + ReusableStringStream m_rss; + RedirectedStream m_cerr; + RedirectedStream m_clog; + public: + RedirectedStdErr() + : m_cerr( Catch::cerr(), m_rss.get() ), + m_clog( Catch::clog(), m_rss.get() ) + {} + auto str() const -> std::string { return m_rss.str(); } + }; + + RunContext::RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter) + : m_runInfo(_config->name()), + m_context(getCurrentMutableContext()), + m_config(_config), + m_reporter(std::move(reporter)), + m_lastAssertionInfo{ StringRef(), SourceLineInfo("",0), StringRef(), ResultDisposition::Normal }, + m_includeSuccessfulResults( m_config->includeSuccessfulResults() ) + { + m_context.setRunner(this); + m_context.setConfig(m_config); + m_context.setResultCapture(this); + m_reporter->testRunStarting(m_runInfo); + } + + RunContext::~RunContext() { + m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, aborting())); + } + + void RunContext::testGroupStarting(std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount) { + m_reporter->testGroupStarting(GroupInfo(testSpec, groupIndex, groupsCount)); + } + + void RunContext::testGroupEnded(std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount) { + m_reporter->testGroupEnded(TestGroupStats(GroupInfo(testSpec, groupIndex, groupsCount), totals, aborting())); + } + + Totals RunContext::runTest(TestCase const& testCase) { + Totals prevTotals = m_totals; + + std::string redirectedCout; + std::string redirectedCerr; + + auto const& testInfo = testCase.getTestCaseInfo(); + + m_reporter->testCaseStarting(testInfo); + + m_activeTestCase = &testCase; + + ITracker& rootTracker = m_trackerContext.startRun(); + assert(rootTracker.isSectionTracker()); + static_cast(rootTracker).addInitialFilters(m_config->getSectionsToRun()); + do { + m_trackerContext.startCycle(); + m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(testInfo.name, testInfo.lineInfo)); + runCurrentTest(redirectedCout, redirectedCerr); + } while (!m_testCaseTracker->isSuccessfullyCompleted() && !aborting()); + + Totals deltaTotals = m_totals.delta(prevTotals); + if (testInfo.expectedToFail() && deltaTotals.testCases.passed > 0) { + deltaTotals.assertions.failed++; + deltaTotals.testCases.passed--; + deltaTotals.testCases.failed++; + } + m_totals.testCases += deltaTotals.testCases; + m_reporter->testCaseEnded(TestCaseStats(testInfo, + deltaTotals, + redirectedCout, + redirectedCerr, + aborting())); + + m_activeTestCase = nullptr; + m_testCaseTracker = nullptr; + + return deltaTotals; + } + + IConfigPtr RunContext::config() const { + return m_config; + } + + IStreamingReporter& RunContext::reporter() const { + return *m_reporter; + } + + void RunContext::assertionEnded(AssertionResult const & result) { + if (result.getResultType() == ResultWas::Ok) { + m_totals.assertions.passed++; + m_lastAssertionPassed = true; + } else if (!result.isOk()) { + m_lastAssertionPassed = false; + if( m_activeTestCase->getTestCaseInfo().okToFail() ) + m_totals.assertions.failedButOk++; + else + m_totals.assertions.failed++; + } + else { + m_lastAssertionPassed = true; + } + + // We have no use for the return value (whether messages should be cleared), because messages were made scoped + // and should be let to clear themselves out. + static_cast(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals))); + + // Reset working state + resetAssertionInfo(); + m_lastResult = result; + } + void RunContext::resetAssertionInfo() { + m_lastAssertionInfo.macroName = StringRef(); + m_lastAssertionInfo.capturedExpression = "{Unknown expression after the reported line}"_sr; + } + + bool RunContext::sectionStarted(SectionInfo const & sectionInfo, Counts & assertions) { + ITracker& sectionTracker = SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(sectionInfo.name, sectionInfo.lineInfo)); + if (!sectionTracker.isOpen()) + return false; + m_activeSections.push_back(§ionTracker); + + m_lastAssertionInfo.lineInfo = sectionInfo.lineInfo; + + m_reporter->sectionStarting(sectionInfo); + + assertions = m_totals.assertions; + + return true; + } + + bool RunContext::testForMissingAssertions(Counts& assertions) { + if (assertions.total() != 0) + return false; + if (!m_config->warnAboutMissingAssertions()) + return false; + if (m_trackerContext.currentTracker().hasChildren()) + return false; + m_totals.assertions.failed++; + assertions.failed++; + return true; + } + + void RunContext::sectionEnded(SectionEndInfo const & endInfo) { + Counts assertions = m_totals.assertions - endInfo.prevAssertions; + bool missingAssertions = testForMissingAssertions(assertions); + + if (!m_activeSections.empty()) { + m_activeSections.back()->close(); + m_activeSections.pop_back(); + } + + m_reporter->sectionEnded(SectionStats(endInfo.sectionInfo, assertions, endInfo.durationInSeconds, missingAssertions)); + m_messages.clear(); + } + + void RunContext::sectionEndedEarly(SectionEndInfo const & endInfo) { + if (m_unfinishedSections.empty()) + m_activeSections.back()->fail(); + else + m_activeSections.back()->close(); + m_activeSections.pop_back(); + + m_unfinishedSections.push_back(endInfo); + } + void RunContext::benchmarkStarting( BenchmarkInfo const& info ) { + m_reporter->benchmarkStarting( info ); + } + void RunContext::benchmarkEnded( BenchmarkStats const& stats ) { + m_reporter->benchmarkEnded( stats ); + } + + void RunContext::pushScopedMessage(MessageInfo const & message) { + m_messages.push_back(message); + } + + void RunContext::popScopedMessage(MessageInfo const & message) { + m_messages.erase(std::remove(m_messages.begin(), m_messages.end(), message), m_messages.end()); + } + + std::string RunContext::getCurrentTestName() const { + return m_activeTestCase + ? m_activeTestCase->getTestCaseInfo().name + : std::string(); + } + + const AssertionResult * RunContext::getLastResult() const { + return &(*m_lastResult); + } + + void RunContext::exceptionEarlyReported() { + m_shouldReportUnexpected = false; + } + + void RunContext::handleFatalErrorCondition( StringRef message ) { + // First notify reporter that bad things happened + m_reporter->fatalErrorEncountered(message); + + // Don't rebuild the result -- the stringification itself can cause more fatal errors + // Instead, fake a result data. + AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } ); + tempResult.message = message; + AssertionResult result(m_lastAssertionInfo, tempResult); + + assertionEnded(result); + + handleUnfinishedSections(); + + // Recreate section for test case (as we will lose the one that was in scope) + auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); + SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description); + + Counts assertions; + assertions.failed = 1; + SectionStats testCaseSectionStats(testCaseSection, assertions, 0, false); + m_reporter->sectionEnded(testCaseSectionStats); + + auto const& testInfo = m_activeTestCase->getTestCaseInfo(); + + Totals deltaTotals; + deltaTotals.testCases.failed = 1; + deltaTotals.assertions.failed = 1; + m_reporter->testCaseEnded(TestCaseStats(testInfo, + deltaTotals, + std::string(), + std::string(), + false)); + m_totals.testCases.failed++; + testGroupEnded(std::string(), m_totals, 1, 1); + m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false)); + } + + bool RunContext::lastAssertionPassed() { + return m_lastAssertionPassed; + } + + void RunContext::assertionPassed() { + m_lastAssertionPassed = true; + ++m_totals.assertions.passed; + resetAssertionInfo(); + } + + bool RunContext::aborting() const { + return m_totals.assertions.failed == static_cast(m_config->abortAfter()); + } + + void RunContext::runCurrentTest(std::string & redirectedCout, std::string & redirectedCerr) { + auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); + SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description); + m_reporter->sectionStarting(testCaseSection); + Counts prevAssertions = m_totals.assertions; + double duration = 0; + m_shouldReportUnexpected = true; + m_lastAssertionInfo = { "TEST_CASE"_sr, testCaseInfo.lineInfo, StringRef(), ResultDisposition::Normal }; + + seedRng(*m_config); + + Timer timer; + try { + if (m_reporter->getPreferences().shouldRedirectStdOut) { + RedirectedStdOut redirectedStdOut; + RedirectedStdErr redirectedStdErr; + timer.start(); + invokeActiveTestCase(); + redirectedCout += redirectedStdOut.str(); + redirectedCerr += redirectedStdErr.str(); + + } else { + timer.start(); + invokeActiveTestCase(); + } + duration = timer.getElapsedSeconds(); + } catch (TestFailureException&) { + // This just means the test was aborted due to failure + } catch (...) { + // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions + // are reported without translation at the point of origin. + if( m_shouldReportUnexpected ) { + AssertionReaction dummyReaction; + handleUnexpectedInflightException( m_lastAssertionInfo, translateActiveException(), dummyReaction ); + } + } + Counts assertions = m_totals.assertions - prevAssertions; + bool missingAssertions = testForMissingAssertions(assertions); + + m_testCaseTracker->close(); + handleUnfinishedSections(); + m_messages.clear(); + + SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions); + m_reporter->sectionEnded(testCaseSectionStats); + } + + void RunContext::invokeActiveTestCase() { + FatalConditionHandler fatalConditionHandler; // Handle signals + m_activeTestCase->invoke(); + fatalConditionHandler.reset(); + } + + void RunContext::handleUnfinishedSections() { + // If sections ended prematurely due to an exception we stored their + // infos here so we can tear them down outside the unwind process. + for (auto it = m_unfinishedSections.rbegin(), + itEnd = m_unfinishedSections.rend(); + it != itEnd; + ++it) + sectionEnded(*it); + m_unfinishedSections.clear(); + } + + void RunContext::handleExpr( + AssertionInfo const& info, + ITransientExpression const& expr, + AssertionReaction& reaction + ) { + m_reporter->assertionStarting( info ); + + bool negated = isFalseTest( info.resultDisposition ); + bool result = expr.getResult() != negated; + + if( result ) { + if (!m_includeSuccessfulResults) { + assertionPassed(); + } + else { + reportExpr(info, ResultWas::Ok, &expr, negated); + } + } + else { + reportExpr(info, ResultWas::ExpressionFailed, &expr, negated ); + populateReaction( reaction ); + } + } + void RunContext::reportExpr( + AssertionInfo const &info, + ResultWas::OfType resultType, + ITransientExpression const *expr, + bool negated ) { + + m_lastAssertionInfo = info; + AssertionResultData data( resultType, LazyExpression( negated ) ); + + AssertionResult assertionResult{ info, data }; + assertionResult.m_resultData.lazyExpression.m_transientExpression = expr; + + assertionEnded( assertionResult ); + } + + void RunContext::handleMessage( + AssertionInfo const& info, + ResultWas::OfType resultType, + StringRef const& message, + AssertionReaction& reaction + ) { + m_reporter->assertionStarting( info ); + + m_lastAssertionInfo = info; + + AssertionResultData data( resultType, LazyExpression( false ) ); + data.message = message; + AssertionResult assertionResult{ m_lastAssertionInfo, data }; + assertionEnded( assertionResult ); + if( !assertionResult.isOk() ) + populateReaction( reaction ); + } + void RunContext::handleUnexpectedExceptionNotThrown( + AssertionInfo const& info, + AssertionReaction& reaction + ) { + handleNonExpr(info, Catch::ResultWas::DidntThrowException, reaction); + } + + void RunContext::handleUnexpectedInflightException( + AssertionInfo const& info, + std::string const& message, + AssertionReaction& reaction + ) { + m_lastAssertionInfo = info; + + AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) ); + data.message = message; + AssertionResult assertionResult{ info, data }; + assertionEnded( assertionResult ); + populateReaction( reaction ); + } + + void RunContext::populateReaction( AssertionReaction& reaction ) { + reaction.shouldDebugBreak = m_config->shouldDebugBreak(); + reaction.shouldThrow = aborting() || (m_lastAssertionInfo.resultDisposition & ResultDisposition::Normal); + } + + void RunContext::handleIncomplete( + AssertionInfo const& info + ) { + m_lastAssertionInfo = info; + + AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) ); + data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE"; + AssertionResult assertionResult{ info, data }; + assertionEnded( assertionResult ); + } + void RunContext::handleNonExpr( + AssertionInfo const &info, + ResultWas::OfType resultType, + AssertionReaction &reaction + ) { + m_lastAssertionInfo = info; + + AssertionResultData data( resultType, LazyExpression( false ) ); + AssertionResult assertionResult{ info, data }; + assertionEnded( assertionResult ); + + if( !assertionResult.isOk() ) + populateReaction( reaction ); + } + + IResultCapture& getResultCapture() { + if (auto* capture = getCurrentContext().getResultCapture()) + return *capture; + else + CATCH_INTERNAL_ERROR("No result capture instance"); + } +} +// end catch_run_context.cpp +// start catch_section.cpp + +namespace Catch { + + Section::Section( SectionInfo const& info ) + : m_info( info ), + m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) ) + { + m_timer.start(); + } + + Section::~Section() { + if( m_sectionIncluded ) { + SectionEndInfo endInfo( m_info, m_assertions, m_timer.getElapsedSeconds() ); + if( uncaught_exceptions() ) + getResultCapture().sectionEndedEarly( endInfo ); + else + getResultCapture().sectionEnded( endInfo ); + } + } + + // This indicates whether the section should be executed or not + Section::operator bool() const { + return m_sectionIncluded; + } + +} // end namespace Catch +// end catch_section.cpp +// start catch_section_info.cpp + +namespace Catch { + + SectionInfo::SectionInfo + ( SourceLineInfo const& _lineInfo, + std::string const& _name, + std::string const& _description ) + : name( _name ), + description( _description ), + lineInfo( _lineInfo ) + {} + + SectionEndInfo::SectionEndInfo( SectionInfo const& _sectionInfo, Counts const& _prevAssertions, double _durationInSeconds ) + : sectionInfo( _sectionInfo ), prevAssertions( _prevAssertions ), durationInSeconds( _durationInSeconds ) + {} + +} // end namespace Catch +// end catch_section_info.cpp +// start catch_session.cpp + +// start catch_session.h + +#include + +namespace Catch { + + class Session : NonCopyable { + public: + + Session(); + ~Session() override; + + void showHelp() const; + void libIdentify(); + + int applyCommandLine( int argc, char const * const * argv ); + + void useConfigData( ConfigData const& configData ); + + int run( int argc, char* argv[] ); + #if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(UNICODE) + int run( int argc, wchar_t* const argv[] ); + #endif + int run(); + + clara::Parser const& cli() const; + void cli( clara::Parser const& newParser ); + ConfigData& configData(); + Config& config(); + private: + int runInternal(); + + clara::Parser m_cli; + ConfigData m_configData; + std::shared_ptr m_config; + bool m_startupExceptions = false; + }; + +} // end namespace Catch + +// end catch_session.h +// start catch_version.h + +#include + +namespace Catch { + + // Versioning information + struct Version { + Version( Version const& ) = delete; + Version& operator=( Version const& ) = delete; + Version( unsigned int _majorVersion, + unsigned int _minorVersion, + unsigned int _patchNumber, + char const * const _branchName, + unsigned int _buildNumber ); + + unsigned int const majorVersion; + unsigned int const minorVersion; + unsigned int const patchNumber; + + // buildNumber is only used if branchName is not null + char const * const branchName; + unsigned int const buildNumber; + + friend std::ostream& operator << ( std::ostream& os, Version const& version ); + }; + + Version const& libraryVersion(); +} + +// end catch_version.h +#include +#include + +namespace Catch { + + namespace { + const int MaxExitCode = 255; + + IStreamingReporterPtr createReporter(std::string const& reporterName, IConfigPtr const& config) { + auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config); + CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << "'"); + + return reporter; + } + +#ifndef CATCH_CONFIG_DEFAULT_REPORTER +#define CATCH_CONFIG_DEFAULT_REPORTER "console" +#endif + + IStreamingReporterPtr makeReporter(std::shared_ptr const& config) { + auto const& reporterNames = config->getReporterNames(); + if (reporterNames.empty()) + return createReporter(CATCH_CONFIG_DEFAULT_REPORTER, config); + + IStreamingReporterPtr reporter; + for (auto const& name : reporterNames) + addReporter(reporter, createReporter(name, config)); + return reporter; + } + +#undef CATCH_CONFIG_DEFAULT_REPORTER + + void addListeners(IStreamingReporterPtr& reporters, IConfigPtr const& config) { + auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners(); + for (auto const& listener : listeners) + addReporter(reporters, listener->create(Catch::ReporterConfig(config))); + } + + Catch::Totals runTests(std::shared_ptr const& config) { + IStreamingReporterPtr reporter = makeReporter(config); + addListeners(reporter, config); + + RunContext context(config, std::move(reporter)); + + Totals totals; + + context.testGroupStarting(config->name(), 1, 1); + + TestSpec testSpec = config->testSpec(); + + auto const& allTestCases = getAllTestCasesSorted(*config); + for (auto const& testCase : allTestCases) { + if (!context.aborting() && matchTest(testCase, testSpec, *config)) + totals += context.runTest(testCase); + else + context.reporter().skipTest(testCase); + } + + if (config->warnAboutNoTests() && totals.testCases.total() == 0) { + ReusableStringStream testConfig; + + bool first = true; + for (const auto& input : config->getTestsOrTags()) { + if (!first) { testConfig << ' '; } + first = false; + testConfig << input; + } + + context.reporter().noMatchingTestCases(testConfig.str()); + totals.error = -1; + } + + context.testGroupEnded(config->name(), totals, 1, 1); + return totals; + } + + void applyFilenamesAsTags(Catch::IConfig const& config) { + auto& tests = const_cast&>(getAllTestCasesSorted(config)); + for (auto& testCase : tests) { + auto tags = testCase.tags; + + std::string filename = testCase.lineInfo.file; + auto lastSlash = filename.find_last_of("\\/"); + if (lastSlash != std::string::npos) { + filename.erase(0, lastSlash); + filename[0] = '#'; + } + + auto lastDot = filename.find_last_of('.'); + if (lastDot != std::string::npos) { + filename.erase(lastDot); + } + + tags.push_back(std::move(filename)); + setTags(testCase, tags); + } + } + + } // anon namespace + + Session::Session() { + static bool alreadyInstantiated = false; + if( alreadyInstantiated ) { + try { CATCH_INTERNAL_ERROR( "Only one instance of Catch::Session can ever be used" ); } + catch(...) { getMutableRegistryHub().registerStartupException(); } + } + + const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions(); + if ( !exceptions.empty() ) { + m_startupExceptions = true; + Colour colourGuard( Colour::Red ); + Catch::cerr() << "Errors occurred during startup!" << '\n'; + // iterate over all exceptions and notify user + for ( const auto& ex_ptr : exceptions ) { + try { + std::rethrow_exception(ex_ptr); + } catch ( std::exception const& ex ) { + Catch::cerr() << Column( ex.what() ).indent(2) << '\n'; + } + } + } + + alreadyInstantiated = true; + m_cli = makeCommandLineParser( m_configData ); + } + Session::~Session() { + Catch::cleanUp(); + } + + void Session::showHelp() const { + Catch::cout() + << "\nCatch v" << libraryVersion() << "\n" + << m_cli << std::endl + << "For more detailed usage please see the project docs\n" << std::endl; + } + void Session::libIdentify() { + Catch::cout() + << std::left << std::setw(16) << "description: " << "A Catch test executable\n" + << std::left << std::setw(16) << "category: " << "testframework\n" + << std::left << std::setw(16) << "framework: " << "Catch Test\n" + << std::left << std::setw(16) << "version: " << libraryVersion() << std::endl; + } + + int Session::applyCommandLine( int argc, char const * const * argv ) { + if( m_startupExceptions ) + return 1; + + auto result = m_cli.parse( clara::Args( argc, argv ) ); + if( !result ) { + Catch::cerr() + << Colour( Colour::Red ) + << "\nError(s) in input:\n" + << Column( result.errorMessage() ).indent( 2 ) + << "\n\n"; + Catch::cerr() << "Run with -? for usage\n" << std::endl; + return MaxExitCode; + } + + if( m_configData.showHelp ) + showHelp(); + if( m_configData.libIdentify ) + libIdentify(); + m_config.reset(); + return 0; + } + + void Session::useConfigData( ConfigData const& configData ) { + m_configData = configData; + m_config.reset(); + } + + int Session::run( int argc, char* argv[] ) { + if( m_startupExceptions ) + return 1; + int returnCode = applyCommandLine( argc, argv ); + if( returnCode == 0 ) + returnCode = run(); + return returnCode; + } + +#if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(UNICODE) + int Session::run( int argc, wchar_t* const argv[] ) { + + char **utf8Argv = new char *[ argc ]; + + for ( int i = 0; i < argc; ++i ) { + int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, NULL, 0, NULL, NULL ); + + utf8Argv[ i ] = new char[ bufSize ]; + + WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, NULL, NULL ); + } + + int returnCode = run( argc, utf8Argv ); + + for ( int i = 0; i < argc; ++i ) + delete [] utf8Argv[ i ]; + + delete [] utf8Argv; + + return returnCode; + } +#endif + int Session::run() { + if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) { + Catch::cout() << "...waiting for enter/ return before starting" << std::endl; + static_cast(std::getchar()); + } + int exitCode = runInternal(); + if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) { + Catch::cout() << "...waiting for enter/ return before exiting, with code: " << exitCode << std::endl; + static_cast(std::getchar()); + } + return exitCode; + } + + clara::Parser const& Session::cli() const { + return m_cli; + } + void Session::cli( clara::Parser const& newParser ) { + m_cli = newParser; + } + ConfigData& Session::configData() { + return m_configData; + } + Config& Session::config() { + if( !m_config ) + m_config = std::make_shared( m_configData ); + return *m_config; + } + + int Session::runInternal() { + if( m_startupExceptions ) + return 1; + + if( m_configData.showHelp || m_configData.libIdentify ) + return 0; + + try + { + config(); // Force config to be constructed + + seedRng( *m_config ); + + if( m_configData.filenamesAsTags ) + applyFilenamesAsTags( *m_config ); + + // Handle list request + if( Option listed = list( config() ) ) + return static_cast( *listed ); + + auto totals = runTests( m_config ); + // Note that on unices only the lower 8 bits are usually used, clamping + // the return value to 255 prevents false negative when some multiple + // of 256 tests has failed + return (std::min) (MaxExitCode, (std::max) (totals.error, static_cast(totals.assertions.failed))); + } + catch( std::exception& ex ) { + Catch::cerr() << ex.what() << std::endl; + return MaxExitCode; + } + } + +} // end namespace Catch +// end catch_session.cpp +// start catch_startup_exception_registry.cpp + +namespace Catch { + void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept { + try { + m_exceptions.push_back(exception); + } + catch(...) { + // If we run out of memory during start-up there's really not a lot more we can do about it + std::terminate(); + } + } + + std::vector const& StartupExceptionRegistry::getExceptions() const noexcept { + return m_exceptions; + } + +} // end namespace Catch +// end catch_startup_exception_registry.cpp +// start catch_stream.cpp + +#include +#include +#include +#include +#include +#include + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif + +namespace Catch { + + Catch::IStream::~IStream() = default; + + namespace detail { namespace { + template + class StreamBufImpl : public std::streambuf { + char data[bufferSize]; + WriterF m_writer; + + public: + StreamBufImpl() { + setp( data, data + sizeof(data) ); + } + + ~StreamBufImpl() noexcept { + StreamBufImpl::sync(); + } + + private: + int overflow( int c ) override { + sync(); + + if( c != EOF ) { + if( pbase() == epptr() ) + m_writer( std::string( 1, static_cast( c ) ) ); + else + sputc( static_cast( c ) ); + } + return 0; + } + + int sync() override { + if( pbase() != pptr() ) { + m_writer( std::string( pbase(), static_cast( pptr() - pbase() ) ) ); + setp( pbase(), epptr() ); + } + return 0; + } + }; + + /////////////////////////////////////////////////////////////////////////// + + struct OutputDebugWriter { + + void operator()( std::string const&str ) { + writeToDebugConsole( str ); + } + }; + + /////////////////////////////////////////////////////////////////////////// + + class FileStream : public IStream { + mutable std::ofstream m_ofs; + public: + FileStream( StringRef filename ) { + m_ofs.open( filename.c_str() ); + CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << "'" ); + } + ~FileStream() override = default; + public: // IStream + std::ostream& stream() const override { + return m_ofs; + } + }; + + /////////////////////////////////////////////////////////////////////////// + + class CoutStream : public IStream { + mutable std::ostream m_os; + public: + // Store the streambuf from cout up-front because + // cout may get redirected when running tests + CoutStream() : m_os( Catch::cout().rdbuf() ) {} + ~CoutStream() override = default; + + public: // IStream + std::ostream& stream() const override { return m_os; } + }; + + /////////////////////////////////////////////////////////////////////////// + + class DebugOutStream : public IStream { + std::unique_ptr> m_streamBuf; + mutable std::ostream m_os; + public: + DebugOutStream() + : m_streamBuf( new StreamBufImpl() ), + m_os( m_streamBuf.get() ) + {} + + ~DebugOutStream() override = default; + + public: // IStream + std::ostream& stream() const override { return m_os; } + }; + + }} // namespace anon::detail + + /////////////////////////////////////////////////////////////////////////// + + auto makeStream( StringRef const &filename ) -> IStream const* { + if( filename.empty() ) + return new detail::CoutStream(); + else if( filename[0] == '%' ) { + if( filename == "%debug" ) + return new detail::DebugOutStream(); + else + CATCH_ERROR( "Unrecognised stream: '" << filename << "'" ); + } + else + return new detail::FileStream( filename ); + } + + // This class encapsulates the idea of a pool of ostringstreams that can be reused. + struct StringStreams { + std::vector> m_streams; + std::vector m_unused; + std::ostringstream m_referenceStream; // Used for copy state/ flags from + static StringStreams* s_instance; + + auto add() -> std::size_t { + if( m_unused.empty() ) { + m_streams.push_back( std::unique_ptr( new std::ostringstream ) ); + return m_streams.size()-1; + } + else { + auto index = m_unused.back(); + m_unused.pop_back(); + return index; + } + } + + void release( std::size_t index ) { + m_streams[index]->copyfmt( m_referenceStream ); // Restore initial flags and other state + m_unused.push_back(index); + } + + // !TBD: put in TLS + static auto instance() -> StringStreams& { + if( !s_instance ) + s_instance = new StringStreams(); + return *s_instance; + } + static void cleanup() { + delete s_instance; + s_instance = nullptr; + } + }; + + StringStreams* StringStreams::s_instance = nullptr; + + void ReusableStringStream::cleanup() { + StringStreams::cleanup(); + } + + ReusableStringStream::ReusableStringStream() + : m_index( StringStreams::instance().add() ), + m_oss( StringStreams::instance().m_streams[m_index].get() ) + {} + + ReusableStringStream::~ReusableStringStream() { + static_cast( m_oss )->str(""); + m_oss->clear(); + StringStreams::instance().release( m_index ); + } + + auto ReusableStringStream::str() const -> std::string { + return static_cast( m_oss )->str(); + } + + /////////////////////////////////////////////////////////////////////////// + +#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement these functions + std::ostream& cout() { return std::cout; } + std::ostream& cerr() { return std::cerr; } + std::ostream& clog() { return std::clog; } +#endif +} + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif +// end catch_stream.cpp +// start catch_string_manip.cpp + +#include +#include +#include +#include + +namespace Catch { + + bool startsWith( std::string const& s, std::string const& prefix ) { + return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin()); + } + bool startsWith( std::string const& s, char prefix ) { + return !s.empty() && s[0] == prefix; + } + bool endsWith( std::string const& s, std::string const& suffix ) { + return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin()); + } + bool endsWith( std::string const& s, char suffix ) { + return !s.empty() && s[s.size()-1] == suffix; + } + bool contains( std::string const& s, std::string const& infix ) { + return s.find( infix ) != std::string::npos; + } + char toLowerCh(char c) { + return static_cast( std::tolower( c ) ); + } + void toLowerInPlace( std::string& s ) { + std::transform( s.begin(), s.end(), s.begin(), toLowerCh ); + } + std::string toLower( std::string const& s ) { + std::string lc = s; + toLowerInPlace( lc ); + return lc; + } + std::string trim( std::string const& str ) { + static char const* whitespaceChars = "\n\r\t "; + std::string::size_type start = str.find_first_not_of( whitespaceChars ); + std::string::size_type end = str.find_last_not_of( whitespaceChars ); + + return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string(); + } + + bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) { + bool replaced = false; + std::size_t i = str.find( replaceThis ); + while( i != std::string::npos ) { + replaced = true; + str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() ); + if( i < str.size()-withThis.size() ) + i = str.find( replaceThis, i+withThis.size() ); + else + i = std::string::npos; + } + return replaced; + } + + pluralise::pluralise( std::size_t count, std::string const& label ) + : m_count( count ), + m_label( label ) + {} + + std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) { + os << pluraliser.m_count << ' ' << pluraliser.m_label; + if( pluraliser.m_count != 1 ) + os << 's'; + return os; + } + +} +// end catch_string_manip.cpp +// start catch_stringref.cpp + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif + +#include +#include +#include + +namespace { + const uint32_t byte_2_lead = 0xC0; + const uint32_t byte_3_lead = 0xE0; + const uint32_t byte_4_lead = 0xF0; +} + +namespace Catch { + StringRef::StringRef( char const* rawChars ) noexcept + : StringRef( rawChars, static_cast(std::strlen(rawChars) ) ) + {} + + StringRef::operator std::string() const { + return std::string( m_start, m_size ); + } + + void StringRef::swap( StringRef& other ) noexcept { + std::swap( m_start, other.m_start ); + std::swap( m_size, other.m_size ); + std::swap( m_data, other.m_data ); + } + + auto StringRef::c_str() const -> char const* { + if( isSubstring() ) + const_cast( this )->takeOwnership(); + return m_start; + } + auto StringRef::currentData() const noexcept -> char const* { + return m_start; + } + + auto StringRef::isOwned() const noexcept -> bool { + return m_data != nullptr; + } + auto StringRef::isSubstring() const noexcept -> bool { + return m_start[m_size] != '\0'; + } + + void StringRef::takeOwnership() { + if( !isOwned() ) { + m_data = new char[m_size+1]; + memcpy( m_data, m_start, m_size ); + m_data[m_size] = '\0'; + m_start = m_data; + } + } + auto StringRef::substr( size_type start, size_type size ) const noexcept -> StringRef { + if( start < m_size ) + return StringRef( m_start+start, size ); + else + return StringRef(); + } + auto StringRef::operator == ( StringRef const& other ) const noexcept -> bool { + return + size() == other.size() && + (std::strncmp( m_start, other.m_start, size() ) == 0); + } + auto StringRef::operator != ( StringRef const& other ) const noexcept -> bool { + return !operator==( other ); + } + + auto StringRef::operator[](size_type index) const noexcept -> char { + return m_start[index]; + } + + auto StringRef::numberOfCharacters() const noexcept -> size_type { + size_type noChars = m_size; + // Make adjustments for uft encodings + for( size_type i=0; i < m_size; ++i ) { + char c = m_start[i]; + if( ( c & byte_2_lead ) == byte_2_lead ) { + noChars--; + if (( c & byte_3_lead ) == byte_3_lead ) + noChars--; + if( ( c & byte_4_lead ) == byte_4_lead ) + noChars--; + } + } + return noChars; + } + + auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string { + std::string str; + str.reserve( lhs.size() + rhs.size() ); + str += lhs; + str += rhs; + return str; + } + auto operator + ( StringRef const& lhs, const char* rhs ) -> std::string { + return std::string( lhs ) + std::string( rhs ); + } + auto operator + ( char const* lhs, StringRef const& rhs ) -> std::string { + return std::string( lhs ) + std::string( rhs ); + } + + auto operator << ( std::ostream& os, StringRef const& str ) -> std::ostream& { + return os.write(str.currentData(), str.size()); + } + + auto operator+=( std::string& lhs, StringRef const& rhs ) -> std::string& { + lhs.append(rhs.currentData(), rhs.size()); + return lhs; + } + +} // namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif +// end catch_stringref.cpp +// start catch_tag_alias.cpp + +namespace Catch { + TagAlias::TagAlias(std::string const & _tag, SourceLineInfo _lineInfo): tag(_tag), lineInfo(_lineInfo) {} +} +// end catch_tag_alias.cpp +// start catch_tag_alias_autoregistrar.cpp + +namespace Catch { + + RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) { + try { + getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo); + } catch (...) { + // Do not throw when constructing global objects, instead register the exception to be processed later + getMutableRegistryHub().registerStartupException(); + } + } + +} +// end catch_tag_alias_autoregistrar.cpp +// start catch_tag_alias_registry.cpp + +#include + +namespace Catch { + + TagAliasRegistry::~TagAliasRegistry() {} + + TagAlias const* TagAliasRegistry::find( std::string const& alias ) const { + auto it = m_registry.find( alias ); + if( it != m_registry.end() ) + return &(it->second); + else + return nullptr; + } + + std::string TagAliasRegistry::expandAliases( std::string const& unexpandedTestSpec ) const { + std::string expandedTestSpec = unexpandedTestSpec; + for( auto const& registryKvp : m_registry ) { + std::size_t pos = expandedTestSpec.find( registryKvp.first ); + if( pos != std::string::npos ) { + expandedTestSpec = expandedTestSpec.substr( 0, pos ) + + registryKvp.second.tag + + expandedTestSpec.substr( pos + registryKvp.first.size() ); + } + } + return expandedTestSpec; + } + + void TagAliasRegistry::add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) { + CATCH_ENFORCE( startsWith(alias, "[@") && endsWith(alias, ']'), + "error: tag alias, '" << alias << "' is not of the form [@alias name].\n" << lineInfo ); + + CATCH_ENFORCE( m_registry.insert(std::make_pair(alias, TagAlias(tag, lineInfo))).second, + "error: tag alias, '" << alias << "' already registered.\n" + << "\tFirst seen at: " << find(alias)->lineInfo << "\n" + << "\tRedefined at: " << lineInfo ); + } + + ITagAliasRegistry::~ITagAliasRegistry() {} + + ITagAliasRegistry const& ITagAliasRegistry::get() { + return getRegistryHub().getTagAliasRegistry(); + } + +} // end namespace Catch +// end catch_tag_alias_registry.cpp +// start catch_test_case_info.cpp + +#include +#include +#include +#include + +namespace Catch { + + TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) { + if( startsWith( tag, '.' ) || + tag == "!hide" ) + return TestCaseInfo::IsHidden; + else if( tag == "!throws" ) + return TestCaseInfo::Throws; + else if( tag == "!shouldfail" ) + return TestCaseInfo::ShouldFail; + else if( tag == "!mayfail" ) + return TestCaseInfo::MayFail; + else if( tag == "!nonportable" ) + return TestCaseInfo::NonPortable; + else if( tag == "!benchmark" ) + return static_cast( TestCaseInfo::Benchmark | TestCaseInfo::IsHidden ); + else + return TestCaseInfo::None; + } + bool isReservedTag( std::string const& tag ) { + return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( tag[0] ); + } + void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) { + CATCH_ENFORCE( !isReservedTag(tag), + "Tag name: [" << tag << "] is not allowed.\n" + << "Tag names starting with non alpha-numeric characters are reserved\n" + << _lineInfo ); + } + + TestCase makeTestCase( ITestInvoker* _testCase, + std::string const& _className, + NameAndTags const& nameAndTags, + SourceLineInfo const& _lineInfo ) + { + bool isHidden = false; + + // Parse out tags + std::vector tags; + std::string desc, tag; + bool inTag = false; + std::string _descOrTags = nameAndTags.tags; + for (char c : _descOrTags) { + if( !inTag ) { + if( c == '[' ) + inTag = true; + else + desc += c; + } + else { + if( c == ']' ) { + TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag ); + if( ( prop & TestCaseInfo::IsHidden ) != 0 ) + isHidden = true; + else if( prop == TestCaseInfo::None ) + enforceNotReservedTag( tag, _lineInfo ); + + tags.push_back( tag ); + tag.clear(); + inTag = false; + } + else + tag += c; + } + } + if( isHidden ) { + tags.push_back( "." ); + } + + TestCaseInfo info( nameAndTags.name, _className, desc, tags, _lineInfo ); + return TestCase( _testCase, std::move(info) ); + } + + void setTags( TestCaseInfo& testCaseInfo, std::vector tags ) { + std::sort(begin(tags), end(tags)); + tags.erase(std::unique(begin(tags), end(tags)), end(tags)); + testCaseInfo.lcaseTags.clear(); + + for( auto const& tag : tags ) { + std::string lcaseTag = toLower( tag ); + testCaseInfo.properties = static_cast( testCaseInfo.properties | parseSpecialTag( lcaseTag ) ); + testCaseInfo.lcaseTags.push_back( lcaseTag ); + } + testCaseInfo.tags = std::move(tags); + } + + TestCaseInfo::TestCaseInfo( std::string const& _name, + std::string const& _className, + std::string const& _description, + std::vector const& _tags, + SourceLineInfo const& _lineInfo ) + : name( _name ), + className( _className ), + description( _description ), + lineInfo( _lineInfo ), + properties( None ) + { + setTags( *this, _tags ); + } + + bool TestCaseInfo::isHidden() const { + return ( properties & IsHidden ) != 0; + } + bool TestCaseInfo::throws() const { + return ( properties & Throws ) != 0; + } + bool TestCaseInfo::okToFail() const { + return ( properties & (ShouldFail | MayFail ) ) != 0; + } + bool TestCaseInfo::expectedToFail() const { + return ( properties & (ShouldFail ) ) != 0; + } + + std::string TestCaseInfo::tagsAsString() const { + std::string ret; + // '[' and ']' per tag + std::size_t full_size = 2 * tags.size(); + for (const auto& tag : tags) { + full_size += tag.size(); + } + ret.reserve(full_size); + for (const auto& tag : tags) { + ret.push_back('['); + ret.append(tag); + ret.push_back(']'); + } + + return ret; + } + + TestCase::TestCase( ITestInvoker* testCase, TestCaseInfo&& info ) : TestCaseInfo( std::move(info) ), test( testCase ) {} + + TestCase TestCase::withName( std::string const& _newName ) const { + TestCase other( *this ); + other.name = _newName; + return other; + } + + void TestCase::invoke() const { + test->invoke(); + } + + bool TestCase::operator == ( TestCase const& other ) const { + return test.get() == other.test.get() && + name == other.name && + className == other.className; + } + + bool TestCase::operator < ( TestCase const& other ) const { + return name < other.name; + } + + TestCaseInfo const& TestCase::getTestCaseInfo() const + { + return *this; + } + +} // end namespace Catch +// end catch_test_case_info.cpp +// start catch_test_case_registry_impl.cpp + +#include + +namespace Catch { + + std::vector sortTests( IConfig const& config, std::vector const& unsortedTestCases ) { + + std::vector sorted = unsortedTestCases; + + switch( config.runOrder() ) { + case RunTests::InLexicographicalOrder: + std::sort( sorted.begin(), sorted.end() ); + break; + case RunTests::InRandomOrder: + seedRng( config ); + RandomNumberGenerator::shuffle( sorted ); + break; + case RunTests::InDeclarationOrder: + // already in declaration order + break; + } + return sorted; + } + bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ) { + return testSpec.matches( testCase ) && ( config.allowThrows() || !testCase.throws() ); + } + + void enforceNoDuplicateTestCases( std::vector const& functions ) { + std::set seenFunctions; + for( auto const& function : functions ) { + auto prev = seenFunctions.insert( function ); + CATCH_ENFORCE( prev.second, + "error: TEST_CASE( \"" << function.name << "\" ) already defined.\n" + << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n" + << "\tRedefined at " << function.getTestCaseInfo().lineInfo ); + } + } + + std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ) { + std::vector filtered; + filtered.reserve( testCases.size() ); + for( auto const& testCase : testCases ) + if( matchTest( testCase, testSpec, config ) ) + filtered.push_back( testCase ); + return filtered; + } + std::vector const& getAllTestCasesSorted( IConfig const& config ) { + return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config ); + } + + void TestRegistry::registerTest( TestCase const& testCase ) { + std::string name = testCase.getTestCaseInfo().name; + if( name.empty() ) { + ReusableStringStream rss; + rss << "Anonymous test case " << ++m_unnamedCount; + return registerTest( testCase.withName( rss.str() ) ); + } + m_functions.push_back( testCase ); + } + + std::vector const& TestRegistry::getAllTests() const { + return m_functions; + } + std::vector const& TestRegistry::getAllTestsSorted( IConfig const& config ) const { + if( m_sortedFunctions.empty() ) + enforceNoDuplicateTestCases( m_functions ); + + if( m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) { + m_sortedFunctions = sortTests( config, m_functions ); + m_currentSortOrder = config.runOrder(); + } + return m_sortedFunctions; + } + + /////////////////////////////////////////////////////////////////////////// + TestInvokerAsFunction::TestInvokerAsFunction( void(*testAsFunction)() ) noexcept : m_testAsFunction( testAsFunction ) {} + + void TestInvokerAsFunction::invoke() const { + m_testAsFunction(); + } + + std::string extractClassName( StringRef const& classOrQualifiedMethodName ) { + std::string className = classOrQualifiedMethodName; + if( startsWith( className, '&' ) ) + { + std::size_t lastColons = className.rfind( "::" ); + std::size_t penultimateColons = className.rfind( "::", lastColons-1 ); + if( penultimateColons == std::string::npos ) + penultimateColons = 1; + className = className.substr( penultimateColons, lastColons-penultimateColons ); + } + return className; + } + +} // end namespace Catch +// end catch_test_case_registry_impl.cpp +// start catch_test_case_tracker.cpp + +#include +#include +#include +#include +#include + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif + +namespace Catch { +namespace TestCaseTracking { + + NameAndLocation::NameAndLocation( std::string const& _name, SourceLineInfo const& _location ) + : name( _name ), + location( _location ) + {} + + ITracker::~ITracker() = default; + + TrackerContext& TrackerContext::instance() { + static TrackerContext s_instance; + return s_instance; + } + + ITracker& TrackerContext::startRun() { + m_rootTracker = std::make_shared( NameAndLocation( "{root}", CATCH_INTERNAL_LINEINFO ), *this, nullptr ); + m_currentTracker = nullptr; + m_runState = Executing; + return *m_rootTracker; + } + + void TrackerContext::endRun() { + m_rootTracker.reset(); + m_currentTracker = nullptr; + m_runState = NotStarted; + } + + void TrackerContext::startCycle() { + m_currentTracker = m_rootTracker.get(); + m_runState = Executing; + } + void TrackerContext::completeCycle() { + m_runState = CompletedCycle; + } + + bool TrackerContext::completedCycle() const { + return m_runState == CompletedCycle; + } + ITracker& TrackerContext::currentTracker() { + return *m_currentTracker; + } + void TrackerContext::setCurrentTracker( ITracker* tracker ) { + m_currentTracker = tracker; + } + + TrackerBase::TrackerHasName::TrackerHasName( NameAndLocation const& nameAndLocation ) : m_nameAndLocation( nameAndLocation ) {} + bool TrackerBase::TrackerHasName::operator ()( ITrackerPtr const& tracker ) const { + return + tracker->nameAndLocation().name == m_nameAndLocation.name && + tracker->nameAndLocation().location == m_nameAndLocation.location; + } + + TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) + : m_nameAndLocation( nameAndLocation ), + m_ctx( ctx ), + m_parent( parent ) + {} + + NameAndLocation const& TrackerBase::nameAndLocation() const { + return m_nameAndLocation; + } + bool TrackerBase::isComplete() const { + return m_runState == CompletedSuccessfully || m_runState == Failed; + } + bool TrackerBase::isSuccessfullyCompleted() const { + return m_runState == CompletedSuccessfully; + } + bool TrackerBase::isOpen() const { + return m_runState != NotStarted && !isComplete(); + } + bool TrackerBase::hasChildren() const { + return !m_children.empty(); + } + + void TrackerBase::addChild( ITrackerPtr const& child ) { + m_children.push_back( child ); + } + + ITrackerPtr TrackerBase::findChild( NameAndLocation const& nameAndLocation ) { + auto it = std::find_if( m_children.begin(), m_children.end(), TrackerHasName( nameAndLocation ) ); + return( it != m_children.end() ) + ? *it + : nullptr; + } + ITracker& TrackerBase::parent() { + assert( m_parent ); // Should always be non-null except for root + return *m_parent; + } + + void TrackerBase::openChild() { + if( m_runState != ExecutingChildren ) { + m_runState = ExecutingChildren; + if( m_parent ) + m_parent->openChild(); + } + } + + bool TrackerBase::isSectionTracker() const { return false; } + bool TrackerBase::isIndexTracker() const { return false; } + + void TrackerBase::open() { + m_runState = Executing; + moveToThis(); + if( m_parent ) + m_parent->openChild(); + } + + void TrackerBase::close() { + + // Close any still open children (e.g. generators) + while( &m_ctx.currentTracker() != this ) + m_ctx.currentTracker().close(); + + switch( m_runState ) { + case NeedsAnotherRun: + break; + + case Executing: + m_runState = CompletedSuccessfully; + break; + case ExecutingChildren: + if( m_children.empty() || m_children.back()->isComplete() ) + m_runState = CompletedSuccessfully; + break; + + case NotStarted: + case CompletedSuccessfully: + case Failed: + CATCH_INTERNAL_ERROR( "Illogical state: " << m_runState ); + + default: + CATCH_INTERNAL_ERROR( "Unknown state: " << m_runState ); + } + moveToParent(); + m_ctx.completeCycle(); + } + void TrackerBase::fail() { + m_runState = Failed; + if( m_parent ) + m_parent->markAsNeedingAnotherRun(); + moveToParent(); + m_ctx.completeCycle(); + } + void TrackerBase::markAsNeedingAnotherRun() { + m_runState = NeedsAnotherRun; + } + + void TrackerBase::moveToParent() { + assert( m_parent ); + m_ctx.setCurrentTracker( m_parent ); + } + void TrackerBase::moveToThis() { + m_ctx.setCurrentTracker( this ); + } + + SectionTracker::SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) + : TrackerBase( nameAndLocation, ctx, parent ) + { + if( parent ) { + while( !parent->isSectionTracker() ) + parent = &parent->parent(); + + SectionTracker& parentSection = static_cast( *parent ); + addNextFilters( parentSection.m_filters ); + } + } + + bool SectionTracker::isSectionTracker() const { return true; } + + SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) { + std::shared_ptr section; + + ITracker& currentTracker = ctx.currentTracker(); + if( ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) { + assert( childTracker ); + assert( childTracker->isSectionTracker() ); + section = std::static_pointer_cast( childTracker ); + } + else { + section = std::make_shared( nameAndLocation, ctx, ¤tTracker ); + currentTracker.addChild( section ); + } + if( !ctx.completedCycle() ) + section->tryOpen(); + return *section; + } + + void SectionTracker::tryOpen() { + if( !isComplete() && (m_filters.empty() || m_filters[0].empty() || m_filters[0] == m_nameAndLocation.name ) ) + open(); + } + + void SectionTracker::addInitialFilters( std::vector const& filters ) { + if( !filters.empty() ) { + m_filters.push_back(""); // Root - should never be consulted + m_filters.push_back(""); // Test Case - not a section filter + m_filters.insert( m_filters.end(), filters.begin(), filters.end() ); + } + } + void SectionTracker::addNextFilters( std::vector const& filters ) { + if( filters.size() > 1 ) + m_filters.insert( m_filters.end(), ++filters.begin(), filters.end() ); + } + + IndexTracker::IndexTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent, int size ) + : TrackerBase( nameAndLocation, ctx, parent ), + m_size( size ) + {} + + bool IndexTracker::isIndexTracker() const { return true; } + + IndexTracker& IndexTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation, int size ) { + std::shared_ptr tracker; + + ITracker& currentTracker = ctx.currentTracker(); + if( ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) { + assert( childTracker ); + assert( childTracker->isIndexTracker() ); + tracker = std::static_pointer_cast( childTracker ); + } + else { + tracker = std::make_shared( nameAndLocation, ctx, ¤tTracker, size ); + currentTracker.addChild( tracker ); + } + + if( !ctx.completedCycle() && !tracker->isComplete() ) { + if( tracker->m_runState != ExecutingChildren && tracker->m_runState != NeedsAnotherRun ) + tracker->moveNext(); + tracker->open(); + } + + return *tracker; + } + + int IndexTracker::index() const { return m_index; } + + void IndexTracker::moveNext() { + m_index++; + m_children.clear(); + } + + void IndexTracker::close() { + TrackerBase::close(); + if( m_runState == CompletedSuccessfully && m_index < m_size-1 ) + m_runState = Executing; + } + +} // namespace TestCaseTracking + +using TestCaseTracking::ITracker; +using TestCaseTracking::TrackerContext; +using TestCaseTracking::SectionTracker; +using TestCaseTracking::IndexTracker; + +} // namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif +// end catch_test_case_tracker.cpp +// start catch_test_registry.cpp + +namespace Catch { + + auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker* { + return new(std::nothrow) TestInvokerAsFunction( testAsFunction ); + } + + NameAndTags::NameAndTags( StringRef const& name_ , StringRef const& tags_ ) noexcept : name( name_ ), tags( tags_ ) {} + + AutoReg::AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept { + try { + getMutableRegistryHub() + .registerTest( + makeTestCase( + invoker, + extractClassName( classOrMethod ), + nameAndTags, + lineInfo)); + } catch (...) { + // Do not throw when constructing global objects, instead register the exception to be processed later + getMutableRegistryHub().registerStartupException(); + } + } + + AutoReg::~AutoReg() = default; +} +// end catch_test_registry.cpp +// start catch_test_spec.cpp + +#include +#include +#include +#include + +namespace Catch { + + TestSpec::Pattern::~Pattern() = default; + TestSpec::NamePattern::~NamePattern() = default; + TestSpec::TagPattern::~TagPattern() = default; + TestSpec::ExcludedPattern::~ExcludedPattern() = default; + + TestSpec::NamePattern::NamePattern( std::string const& name ) + : m_wildcardPattern( toLower( name ), CaseSensitive::No ) + {} + bool TestSpec::NamePattern::matches( TestCaseInfo const& testCase ) const { + return m_wildcardPattern.matches( toLower( testCase.name ) ); + } + + TestSpec::TagPattern::TagPattern( std::string const& tag ) : m_tag( toLower( tag ) ) {} + bool TestSpec::TagPattern::matches( TestCaseInfo const& testCase ) const { + return std::find(begin(testCase.lcaseTags), + end(testCase.lcaseTags), + m_tag) != end(testCase.lcaseTags); + } + + TestSpec::ExcludedPattern::ExcludedPattern( PatternPtr const& underlyingPattern ) : m_underlyingPattern( underlyingPattern ) {} + bool TestSpec::ExcludedPattern::matches( TestCaseInfo const& testCase ) const { return !m_underlyingPattern->matches( testCase ); } + + bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const { + // All patterns in a filter must match for the filter to be a match + for( auto const& pattern : m_patterns ) { + if( !pattern->matches( testCase ) ) + return false; + } + return true; + } + + bool TestSpec::hasFilters() const { + return !m_filters.empty(); + } + bool TestSpec::matches( TestCaseInfo const& testCase ) const { + // A TestSpec matches if any filter matches + for( auto const& filter : m_filters ) + if( filter.matches( testCase ) ) + return true; + return false; + } +} +// end catch_test_spec.cpp +// start catch_test_spec_parser.cpp + +namespace Catch { + + TestSpecParser::TestSpecParser( ITagAliasRegistry const& tagAliases ) : m_tagAliases( &tagAliases ) {} + + TestSpecParser& TestSpecParser::parse( std::string const& arg ) { + m_mode = None; + m_exclusion = false; + m_start = std::string::npos; + m_arg = m_tagAliases->expandAliases( arg ); + m_escapeChars.clear(); + for( m_pos = 0; m_pos < m_arg.size(); ++m_pos ) + visitChar( m_arg[m_pos] ); + if( m_mode == Name ) + addPattern(); + return *this; + } + TestSpec TestSpecParser::testSpec() { + addFilter(); + return m_testSpec; + } + + void TestSpecParser::visitChar( char c ) { + if( m_mode == None ) { + switch( c ) { + case ' ': return; + case '~': m_exclusion = true; return; + case '[': return startNewMode( Tag, ++m_pos ); + case '"': return startNewMode( QuotedName, ++m_pos ); + case '\\': return escape(); + default: startNewMode( Name, m_pos ); break; + } + } + if( m_mode == Name ) { + if( c == ',' ) { + addPattern(); + addFilter(); + } + else if( c == '[' ) { + if( subString() == "exclude:" ) + m_exclusion = true; + else + addPattern(); + startNewMode( Tag, ++m_pos ); + } + else if( c == '\\' ) + escape(); + } + else if( m_mode == EscapedName ) + m_mode = Name; + else if( m_mode == QuotedName && c == '"' ) + addPattern(); + else if( m_mode == Tag && c == ']' ) + addPattern(); + } + void TestSpecParser::startNewMode( Mode mode, std::size_t start ) { + m_mode = mode; + m_start = start; + } + void TestSpecParser::escape() { + if( m_mode == None ) + m_start = m_pos; + m_mode = EscapedName; + m_escapeChars.push_back( m_pos ); + } + std::string TestSpecParser::subString() const { return m_arg.substr( m_start, m_pos - m_start ); } + + void TestSpecParser::addFilter() { + if( !m_currentFilter.m_patterns.empty() ) { + m_testSpec.m_filters.push_back( m_currentFilter ); + m_currentFilter = TestSpec::Filter(); + } + } + + TestSpec parseTestSpec( std::string const& arg ) { + return TestSpecParser( ITagAliasRegistry::get() ).parse( arg ).testSpec(); + } + +} // namespace Catch +// end catch_test_spec_parser.cpp +// start catch_timer.cpp + +#include + +static const uint64_t nanosecondsInSecond = 1000000000; + +namespace Catch { + + auto getCurrentNanosecondsSinceEpoch() -> uint64_t { + return std::chrono::duration_cast( std::chrono::high_resolution_clock::now().time_since_epoch() ).count(); + } + + auto estimateClockResolution() -> uint64_t { + uint64_t sum = 0; + static const uint64_t iterations = 1000000; + + auto startTime = getCurrentNanosecondsSinceEpoch(); + + for( std::size_t i = 0; i < iterations; ++i ) { + + uint64_t ticks; + uint64_t baseTicks = getCurrentNanosecondsSinceEpoch(); + do { + ticks = getCurrentNanosecondsSinceEpoch(); + } while( ticks == baseTicks ); + + auto delta = ticks - baseTicks; + sum += delta; + + // If we have been calibrating for over 3 seconds -- the clock + // is terrible and we should move on. + // TBD: How to signal that the measured resolution is probably wrong? + if (ticks > startTime + 3 * nanosecondsInSecond) { + return sum / i; + } + } + + // We're just taking the mean, here. To do better we could take the std. dev and exclude outliers + // - and potentially do more iterations if there's a high variance. + return sum/iterations; + } + auto getEstimatedClockResolution() -> uint64_t { + static auto s_resolution = estimateClockResolution(); + return s_resolution; + } + + void Timer::start() { + m_nanoseconds = getCurrentNanosecondsSinceEpoch(); + } + auto Timer::getElapsedNanoseconds() const -> uint64_t { + return getCurrentNanosecondsSinceEpoch() - m_nanoseconds; + } + auto Timer::getElapsedMicroseconds() const -> uint64_t { + return getElapsedNanoseconds()/1000; + } + auto Timer::getElapsedMilliseconds() const -> unsigned int { + return static_cast(getElapsedMicroseconds()/1000); + } + auto Timer::getElapsedSeconds() const -> double { + return getElapsedMicroseconds()/1000000.0; + } + +} // namespace Catch +// end catch_timer.cpp +// start catch_tostring.cpp + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +# pragma clang diagnostic ignored "-Wglobal-constructors" +#endif + +// Enable specific decls locally +#if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) +#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER +#endif + +#include +#include + +namespace Catch { + +namespace Detail { + + const std::string unprintableString = "{?}"; + + namespace { + const int hexThreshold = 255; + + struct Endianness { + enum Arch { Big, Little }; + + static Arch which() { + union _{ + int asInt; + char asChar[sizeof (int)]; + } u; + + u.asInt = 1; + return ( u.asChar[sizeof(int)-1] == 1 ) ? Big : Little; + } + }; + } + + std::string rawMemoryToString( const void *object, std::size_t size ) { + // Reverse order for little endian architectures + int i = 0, end = static_cast( size ), inc = 1; + if( Endianness::which() == Endianness::Little ) { + i = end-1; + end = inc = -1; + } + + unsigned char const *bytes = static_cast(object); + ReusableStringStream rss; + rss << "0x" << std::setfill('0') << std::hex; + for( ; i != end; i += inc ) + rss << std::setw(2) << static_cast(bytes[i]); + return rss.str(); + } +} + +template +std::string fpToString( T value, int precision ) { + if (std::isnan(value)) { + return "nan"; + } + + ReusableStringStream rss; + rss << std::setprecision( precision ) + << std::fixed + << value; + std::string d = rss.str(); + std::size_t i = d.find_last_not_of( '0' ); + if( i != std::string::npos && i != d.size()-1 ) { + if( d[i] == '.' ) + i++; + d = d.substr( 0, i+1 ); + } + return d; +} + +//// ======================================================= //// +// +// Out-of-line defs for full specialization of StringMaker +// +//// ======================================================= //// + +std::string StringMaker::convert(const std::string& str) { + if (!getCurrentContext().getConfig()->showInvisibles()) { + return '"' + str + '"'; + } + + std::string s("\""); + for (char c : str) { + switch (c) { + case '\n': + s.append("\\n"); + break; + case '\t': + s.append("\\t"); + break; + default: + s.push_back(c); + break; + } + } + s.append("\""); + return s; +} + +#ifdef CATCH_CONFIG_WCHAR +std::string StringMaker::convert(const std::wstring& wstr) { + std::string s; + s.reserve(wstr.size()); + for (auto c : wstr) { + s += (c <= 0xff) ? static_cast(c) : '?'; + } + return ::Catch::Detail::stringify(s); +} +#endif + +std::string StringMaker::convert(char const* str) { + if (str) { + return ::Catch::Detail::stringify(std::string{ str }); + } else { + return{ "{null string}" }; + } +} +std::string StringMaker::convert(char* str) { + if (str) { + return ::Catch::Detail::stringify(std::string{ str }); + } else { + return{ "{null string}" }; + } +} +#ifdef CATCH_CONFIG_WCHAR +std::string StringMaker::convert(wchar_t const * str) { + if (str) { + return ::Catch::Detail::stringify(std::wstring{ str }); + } else { + return{ "{null string}" }; + } +} +std::string StringMaker::convert(wchar_t * str) { + if (str) { + return ::Catch::Detail::stringify(std::wstring{ str }); + } else { + return{ "{null string}" }; + } +} +#endif + +std::string StringMaker::convert(int value) { + return ::Catch::Detail::stringify(static_cast(value)); +} +std::string StringMaker::convert(long value) { + return ::Catch::Detail::stringify(static_cast(value)); +} +std::string StringMaker::convert(long long value) { + ReusableStringStream rss; + rss << value; + if (value > Detail::hexThreshold) { + rss << " (0x" << std::hex << value << ')'; + } + return rss.str(); +} + +std::string StringMaker::convert(unsigned int value) { + return ::Catch::Detail::stringify(static_cast(value)); +} +std::string StringMaker::convert(unsigned long value) { + return ::Catch::Detail::stringify(static_cast(value)); +} +std::string StringMaker::convert(unsigned long long value) { + ReusableStringStream rss; + rss << value; + if (value > Detail::hexThreshold) { + rss << " (0x" << std::hex << value << ')'; + } + return rss.str(); +} + +std::string StringMaker::convert(bool b) { + return b ? "true" : "false"; +} + +std::string StringMaker::convert(char value) { + if (value == '\r') { + return "'\\r'"; + } else if (value == '\f') { + return "'\\f'"; + } else if (value == '\n') { + return "'\\n'"; + } else if (value == '\t') { + return "'\\t'"; + } else if ('\0' <= value && value < ' ') { + return ::Catch::Detail::stringify(static_cast(value)); + } else { + char chstr[] = "' '"; + chstr[1] = value; + return chstr; + } +} +std::string StringMaker::convert(signed char c) { + return ::Catch::Detail::stringify(static_cast(c)); +} +std::string StringMaker::convert(unsigned char c) { + return ::Catch::Detail::stringify(static_cast(c)); +} + +std::string StringMaker::convert(std::nullptr_t) { + return "nullptr"; +} + +std::string StringMaker::convert(float value) { + return fpToString(value, 5) + 'f'; +} +std::string StringMaker::convert(double value) { + return fpToString(value, 10); +} + +std::string ratio_string::symbol() { return "a"; } +std::string ratio_string::symbol() { return "f"; } +std::string ratio_string::symbol() { return "p"; } +std::string ratio_string::symbol() { return "n"; } +std::string ratio_string::symbol() { return "u"; } +std::string ratio_string::symbol() { return "m"; } + +} // end namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + +// end catch_tostring.cpp +// start catch_totals.cpp + +namespace Catch { + + Counts Counts::operator - ( Counts const& other ) const { + Counts diff; + diff.passed = passed - other.passed; + diff.failed = failed - other.failed; + diff.failedButOk = failedButOk - other.failedButOk; + return diff; + } + + Counts& Counts::operator += ( Counts const& other ) { + passed += other.passed; + failed += other.failed; + failedButOk += other.failedButOk; + return *this; + } + + std::size_t Counts::total() const { + return passed + failed + failedButOk; + } + bool Counts::allPassed() const { + return failed == 0 && failedButOk == 0; + } + bool Counts::allOk() const { + return failed == 0; + } + + Totals Totals::operator - ( Totals const& other ) const { + Totals diff; + diff.assertions = assertions - other.assertions; + diff.testCases = testCases - other.testCases; + return diff; + } + + Totals& Totals::operator += ( Totals const& other ) { + assertions += other.assertions; + testCases += other.testCases; + return *this; + } + + Totals Totals::delta( Totals const& prevTotals ) const { + Totals diff = *this - prevTotals; + if( diff.assertions.failed > 0 ) + ++diff.testCases.failed; + else if( diff.assertions.failedButOk > 0 ) + ++diff.testCases.failedButOk; + else + ++diff.testCases.passed; + return diff; + } + +} +// end catch_totals.cpp +// start catch_uncaught_exceptions.cpp + +#include + +namespace Catch { + bool uncaught_exceptions() { +#if defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) + return std::uncaught_exceptions() > 0; +#else + return std::uncaught_exception(); +#endif + } +} // end namespace Catch +// end catch_uncaught_exceptions.cpp +// start catch_version.cpp + +#include + +namespace Catch { + + Version::Version + ( unsigned int _majorVersion, + unsigned int _minorVersion, + unsigned int _patchNumber, + char const * const _branchName, + unsigned int _buildNumber ) + : majorVersion( _majorVersion ), + minorVersion( _minorVersion ), + patchNumber( _patchNumber ), + branchName( _branchName ), + buildNumber( _buildNumber ) + {} + + std::ostream& operator << ( std::ostream& os, Version const& version ) { + os << version.majorVersion << '.' + << version.minorVersion << '.' + << version.patchNumber; + // branchName is never null -> 0th char is \0 if it is empty + if (version.branchName[0]) { + os << '-' << version.branchName + << '.' << version.buildNumber; + } + return os; + } + + Version const& libraryVersion() { + static Version version( 2, 2, 2, "", 0 ); + return version; + } + +} +// end catch_version.cpp +// start catch_wildcard_pattern.cpp + +#include + +namespace Catch { + + WildcardPattern::WildcardPattern( std::string const& pattern, + CaseSensitive::Choice caseSensitivity ) + : m_caseSensitivity( caseSensitivity ), + m_pattern( adjustCase( pattern ) ) + { + if( startsWith( m_pattern, '*' ) ) { + m_pattern = m_pattern.substr( 1 ); + m_wildcard = WildcardAtStart; + } + if( endsWith( m_pattern, '*' ) ) { + m_pattern = m_pattern.substr( 0, m_pattern.size()-1 ); + m_wildcard = static_cast( m_wildcard | WildcardAtEnd ); + } + } + + bool WildcardPattern::matches( std::string const& str ) const { + switch( m_wildcard ) { + case NoWildcard: + return m_pattern == adjustCase( str ); + case WildcardAtStart: + return endsWith( adjustCase( str ), m_pattern ); + case WildcardAtEnd: + return startsWith( adjustCase( str ), m_pattern ); + case WildcardAtBothEnds: + return contains( adjustCase( str ), m_pattern ); + default: + CATCH_INTERNAL_ERROR( "Unknown enum" ); + } + } + + std::string WildcardPattern::adjustCase( std::string const& str ) const { + return m_caseSensitivity == CaseSensitive::No ? toLower( str ) : str; + } +} +// end catch_wildcard_pattern.cpp +// start catch_xmlwriter.cpp + +#include + +using uchar = unsigned char; + +namespace Catch { + +namespace { + + size_t trailingBytes(unsigned char c) { + if ((c & 0xE0) == 0xC0) { + return 2; + } + if ((c & 0xF0) == 0xE0) { + return 3; + } + if ((c & 0xF8) == 0xF0) { + return 4; + } + CATCH_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered"); + } + + uint32_t headerValue(unsigned char c) { + if ((c & 0xE0) == 0xC0) { + return c & 0x1F; + } + if ((c & 0xF0) == 0xE0) { + return c & 0x0F; + } + if ((c & 0xF8) == 0xF0) { + return c & 0x07; + } + CATCH_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered"); + } + + void hexEscapeChar(std::ostream& os, unsigned char c) { + os << "\\x" + << std::uppercase << std::hex << std::setfill('0') << std::setw(2) + << static_cast(c); + } + +} // anonymous namespace + + XmlEncode::XmlEncode( std::string const& str, ForWhat forWhat ) + : m_str( str ), + m_forWhat( forWhat ) + {} + + void XmlEncode::encodeTo( std::ostream& os ) const { + // Apostrophe escaping not necessary if we always use " to write attributes + // (see: http://www.w3.org/TR/xml/#syntax) + + for( std::size_t idx = 0; idx < m_str.size(); ++ idx ) { + uchar c = m_str[idx]; + switch (c) { + case '<': os << "<"; break; + case '&': os << "&"; break; + + case '>': + // See: http://www.w3.org/TR/xml/#syntax + if (idx > 2 && m_str[idx - 1] == ']' && m_str[idx - 2] == ']') + os << ">"; + else + os << c; + break; + + case '\"': + if (m_forWhat == ForAttributes) + os << """; + else + os << c; + break; + + default: + // Check for control characters and invalid utf-8 + + // Escape control characters in standard ascii + // see http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0 + if (c < 0x09 || (c > 0x0D && c < 0x20) || c == 0x7F) { + hexEscapeChar(os, c); + break; + } + + // Plain ASCII: Write it to stream + if (c < 0x7F) { + os << c; + break; + } + + // UTF-8 territory + // Check if the encoding is valid and if it is not, hex escape bytes. + // Important: We do not check the exact decoded values for validity, only the encoding format + // First check that this bytes is a valid lead byte: + // This means that it is not encoded as 1111 1XXX + // Or as 10XX XXXX + if (c < 0xC0 || + c >= 0xF8) { + hexEscapeChar(os, c); + break; + } + + auto encBytes = trailingBytes(c); + // Are there enough bytes left to avoid accessing out-of-bounds memory? + if (idx + encBytes - 1 >= m_str.size()) { + hexEscapeChar(os, c); + break; + } + // The header is valid, check data + // The next encBytes bytes must together be a valid utf-8 + // This means: bitpattern 10XX XXXX and the extracted value is sane (ish) + bool valid = true; + uint32_t value = headerValue(c); + for (std::size_t n = 1; n < encBytes; ++n) { + uchar nc = m_str[idx + n]; + valid &= ((nc & 0xC0) == 0x80); + value = (value << 6) | (nc & 0x3F); + } + + if ( + // Wrong bit pattern of following bytes + (!valid) || + // Overlong encodings + (value < 0x80) || + (0x80 <= value && value < 0x800 && encBytes > 2) || + (0x800 < value && value < 0x10000 && encBytes > 3) || + // Encoded value out of range + (value >= 0x110000) + ) { + hexEscapeChar(os, c); + break; + } + + // If we got here, this is in fact a valid(ish) utf-8 sequence + for (std::size_t n = 0; n < encBytes; ++n) { + os << m_str[idx + n]; + } + idx += encBytes - 1; + break; + } + } + } + + std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ) { + xmlEncode.encodeTo( os ); + return os; + } + + XmlWriter::ScopedElement::ScopedElement( XmlWriter* writer ) + : m_writer( writer ) + {} + + XmlWriter::ScopedElement::ScopedElement( ScopedElement&& other ) noexcept + : m_writer( other.m_writer ){ + other.m_writer = nullptr; + } + XmlWriter::ScopedElement& XmlWriter::ScopedElement::operator=( ScopedElement&& other ) noexcept { + if ( m_writer ) { + m_writer->endElement(); + } + m_writer = other.m_writer; + other.m_writer = nullptr; + return *this; + } + + XmlWriter::ScopedElement::~ScopedElement() { + if( m_writer ) + m_writer->endElement(); + } + + XmlWriter::ScopedElement& XmlWriter::ScopedElement::writeText( std::string const& text, bool indent ) { + m_writer->writeText( text, indent ); + return *this; + } + + XmlWriter::XmlWriter( std::ostream& os ) : m_os( os ) + { + writeDeclaration(); + } + + XmlWriter::~XmlWriter() { + while( !m_tags.empty() ) + endElement(); + } + + XmlWriter& XmlWriter::startElement( std::string const& name ) { + ensureTagClosed(); + newlineIfNecessary(); + m_os << m_indent << '<' << name; + m_tags.push_back( name ); + m_indent += " "; + m_tagIsOpen = true; + return *this; + } + + XmlWriter::ScopedElement XmlWriter::scopedElement( std::string const& name ) { + ScopedElement scoped( this ); + startElement( name ); + return scoped; + } + + XmlWriter& XmlWriter::endElement() { + newlineIfNecessary(); + m_indent = m_indent.substr( 0, m_indent.size()-2 ); + if( m_tagIsOpen ) { + m_os << "/>"; + m_tagIsOpen = false; + } + else { + m_os << m_indent << ""; + } + m_os << std::endl; + m_tags.pop_back(); + return *this; + } + + XmlWriter& XmlWriter::writeAttribute( std::string const& name, std::string const& attribute ) { + if( !name.empty() && !attribute.empty() ) + m_os << ' ' << name << "=\"" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '"'; + return *this; + } + + XmlWriter& XmlWriter::writeAttribute( std::string const& name, bool attribute ) { + m_os << ' ' << name << "=\"" << ( attribute ? "true" : "false" ) << '"'; + return *this; + } + + XmlWriter& XmlWriter::writeText( std::string const& text, bool indent ) { + if( !text.empty() ){ + bool tagWasOpen = m_tagIsOpen; + ensureTagClosed(); + if( tagWasOpen && indent ) + m_os << m_indent; + m_os << XmlEncode( text ); + m_needsNewline = true; + } + return *this; + } + + XmlWriter& XmlWriter::writeComment( std::string const& text ) { + ensureTagClosed(); + m_os << m_indent << ""; + m_needsNewline = true; + return *this; + } + + void XmlWriter::writeStylesheetRef( std::string const& url ) { + m_os << "\n"; + } + + XmlWriter& XmlWriter::writeBlankLine() { + ensureTagClosed(); + m_os << '\n'; + return *this; + } + + void XmlWriter::ensureTagClosed() { + if( m_tagIsOpen ) { + m_os << ">" << std::endl; + m_tagIsOpen = false; + } + } + + void XmlWriter::writeDeclaration() { + m_os << "\n"; + } + + void XmlWriter::newlineIfNecessary() { + if( m_needsNewline ) { + m_os << std::endl; + m_needsNewline = false; + } + } +} +// end catch_xmlwriter.cpp +// start catch_reporter_bases.cpp + +#include +#include +#include +#include +#include + +namespace Catch { + void prepareExpandedExpression(AssertionResult& result) { + result.getExpandedExpression(); + } + + // Because formatting using c++ streams is stateful, drop down to C is required + // Alternatively we could use stringstream, but its performance is... not good. + std::string getFormattedDuration( double duration ) { + // Max exponent + 1 is required to represent the whole part + // + 1 for decimal point + // + 3 for the 3 decimal places + // + 1 for null terminator + const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1; + char buffer[maxDoubleSize]; + + // Save previous errno, to prevent sprintf from overwriting it + ErrnoGuard guard; +#ifdef _MSC_VER + sprintf_s(buffer, "%.3f", duration); +#else + sprintf(buffer, "%.3f", duration); +#endif + return std::string(buffer); + } + + TestEventListenerBase::TestEventListenerBase(ReporterConfig const & _config) + :StreamingReporterBase(_config) {} + + void TestEventListenerBase::assertionStarting(AssertionInfo const &) {} + + bool TestEventListenerBase::assertionEnded(AssertionStats const &) { + return false; + } + +} // end namespace Catch +// end catch_reporter_bases.cpp +// start catch_reporter_compact.cpp + +namespace { + +#ifdef CATCH_PLATFORM_MAC + const char* failedString() { return "FAILED"; } + const char* passedString() { return "PASSED"; } +#else + const char* failedString() { return "failed"; } + const char* passedString() { return "passed"; } +#endif + + // Colour::LightGrey + Catch::Colour::Code dimColour() { return Catch::Colour::FileName; } + + std::string bothOrAll( std::size_t count ) { + return count == 1 ? std::string() : + count == 2 ? "both " : "all " ; + } + +} // anon namespace + +namespace Catch { +namespace { +// Colour, message variants: +// - white: No tests ran. +// - red: Failed [both/all] N test cases, failed [both/all] M assertions. +// - white: Passed [both/all] N test cases (no assertions). +// - red: Failed N tests cases, failed M assertions. +// - green: Passed [both/all] N tests cases with M assertions. +void printTotals(std::ostream& out, const Totals& totals) { + if (totals.testCases.total() == 0) { + out << "No tests ran."; + } else if (totals.testCases.failed == totals.testCases.total()) { + Colour colour(Colour::ResultError); + const std::string qualify_assertions_failed = + totals.assertions.failed == totals.assertions.total() ? + bothOrAll(totals.assertions.failed) : std::string(); + out << + "Failed " << bothOrAll(totals.testCases.failed) + << pluralise(totals.testCases.failed, "test case") << ", " + "failed " << qualify_assertions_failed << + pluralise(totals.assertions.failed, "assertion") << '.'; + } else if (totals.assertions.total() == 0) { + out << + "Passed " << bothOrAll(totals.testCases.total()) + << pluralise(totals.testCases.total(), "test case") + << " (no assertions)."; + } else if (totals.assertions.failed) { + Colour colour(Colour::ResultError); + out << + "Failed " << pluralise(totals.testCases.failed, "test case") << ", " + "failed " << pluralise(totals.assertions.failed, "assertion") << '.'; + } else { + Colour colour(Colour::ResultSuccess); + out << + "Passed " << bothOrAll(totals.testCases.passed) + << pluralise(totals.testCases.passed, "test case") << + " with " << pluralise(totals.assertions.passed, "assertion") << '.'; + } +} + +// Implementation of CompactReporter formatting +class AssertionPrinter { +public: + AssertionPrinter& operator= (AssertionPrinter const&) = delete; + AssertionPrinter(AssertionPrinter const&) = delete; + AssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages) + : stream(_stream) + , result(_stats.assertionResult) + , messages(_stats.infoMessages) + , itMessage(_stats.infoMessages.begin()) + , printInfoMessages(_printInfoMessages) {} + + void print() { + printSourceInfo(); + + itMessage = messages.begin(); + + switch (result.getResultType()) { + case ResultWas::Ok: + printResultType(Colour::ResultSuccess, passedString()); + printOriginalExpression(); + printReconstructedExpression(); + if (!result.hasExpression()) + printRemainingMessages(Colour::None); + else + printRemainingMessages(); + break; + case ResultWas::ExpressionFailed: + if (result.isOk()) + printResultType(Colour::ResultSuccess, failedString() + std::string(" - but was ok")); + else + printResultType(Colour::Error, failedString()); + printOriginalExpression(); + printReconstructedExpression(); + printRemainingMessages(); + break; + case ResultWas::ThrewException: + printResultType(Colour::Error, failedString()); + printIssue("unexpected exception with message:"); + printMessage(); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::FatalErrorCondition: + printResultType(Colour::Error, failedString()); + printIssue("fatal error condition with message:"); + printMessage(); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::DidntThrowException: + printResultType(Colour::Error, failedString()); + printIssue("expected exception, got none"); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::Info: + printResultType(Colour::None, "info"); + printMessage(); + printRemainingMessages(); + break; + case ResultWas::Warning: + printResultType(Colour::None, "warning"); + printMessage(); + printRemainingMessages(); + break; + case ResultWas::ExplicitFailure: + printResultType(Colour::Error, failedString()); + printIssue("explicitly"); + printRemainingMessages(Colour::None); + break; + // These cases are here to prevent compiler warnings + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + printResultType(Colour::Error, "** internal error **"); + break; + } + } + +private: + void printSourceInfo() const { + Colour colourGuard(Colour::FileName); + stream << result.getSourceInfo() << ':'; + } + + void printResultType(Colour::Code colour, std::string const& passOrFail) const { + if (!passOrFail.empty()) { + { + Colour colourGuard(colour); + stream << ' ' << passOrFail; + } + stream << ':'; + } + } + + void printIssue(std::string const& issue) const { + stream << ' ' << issue; + } + + void printExpressionWas() { + if (result.hasExpression()) { + stream << ';'; + { + Colour colour(dimColour()); + stream << " expression was:"; + } + printOriginalExpression(); + } + } + + void printOriginalExpression() const { + if (result.hasExpression()) { + stream << ' ' << result.getExpression(); + } + } + + void printReconstructedExpression() const { + if (result.hasExpandedExpression()) { + { + Colour colour(dimColour()); + stream << " for: "; + } + stream << result.getExpandedExpression(); + } + } + + void printMessage() { + if (itMessage != messages.end()) { + stream << " '" << itMessage->message << '\''; + ++itMessage; + } + } + + void printRemainingMessages(Colour::Code colour = dimColour()) { + if (itMessage == messages.end()) + return; + + // using messages.end() directly yields (or auto) compilation error: + std::vector::const_iterator itEnd = messages.end(); + const std::size_t N = static_cast(std::distance(itMessage, itEnd)); + + { + Colour colourGuard(colour); + stream << " with " << pluralise(N, "message") << ':'; + } + + for (; itMessage != itEnd; ) { + // If this assertion is a warning ignore any INFO messages + if (printInfoMessages || itMessage->type != ResultWas::Info) { + stream << " '" << itMessage->message << '\''; + if (++itMessage != itEnd) { + Colour colourGuard(dimColour()); + stream << " and"; + } + } + } + } + +private: + std::ostream& stream; + AssertionResult const& result; + std::vector messages; + std::vector::const_iterator itMessage; + bool printInfoMessages; +}; + +} // anon namespace + + std::string CompactReporter::getDescription() { + return "Reports test results on a single line, suitable for IDEs"; + } + + ReporterPreferences CompactReporter::getPreferences() const { + ReporterPreferences prefs; + prefs.shouldRedirectStdOut = false; + return prefs; + } + + void CompactReporter::noMatchingTestCases( std::string const& spec ) { + stream << "No test cases matched '" << spec << '\'' << std::endl; + } + + void CompactReporter::assertionStarting( AssertionInfo const& ) {} + + bool CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) { + AssertionResult const& result = _assertionStats.assertionResult; + + bool printInfoMessages = true; + + // Drop out if result was successful and we're not printing those + if( !m_config->includeSuccessfulResults() && result.isOk() ) { + if( result.getResultType() != ResultWas::Warning ) + return false; + printInfoMessages = false; + } + + AssertionPrinter printer( stream, _assertionStats, printInfoMessages ); + printer.print(); + + stream << std::endl; + return true; + } + + void CompactReporter::sectionEnded(SectionStats const& _sectionStats) { + if (m_config->showDurations() == ShowDurations::Always) { + stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl; + } + } + + void CompactReporter::testRunEnded( TestRunStats const& _testRunStats ) { + printTotals( stream, _testRunStats.totals ); + stream << '\n' << std::endl; + StreamingReporterBase::testRunEnded( _testRunStats ); + } + + CompactReporter::~CompactReporter() {} + + CATCH_REGISTER_REPORTER( "compact", CompactReporter ) + +} // end namespace Catch +// end catch_reporter_compact.cpp +// start catch_reporter_console.cpp + +#include +#include + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch + // Note that 4062 (not all labels are handled + // and default is missing) is enabled +#endif + +namespace Catch { + +namespace { + +// Formatter impl for ConsoleReporter +class ConsoleAssertionPrinter { +public: + ConsoleAssertionPrinter& operator= (ConsoleAssertionPrinter const&) = delete; + ConsoleAssertionPrinter(ConsoleAssertionPrinter const&) = delete; + ConsoleAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages) + : stream(_stream), + stats(_stats), + result(_stats.assertionResult), + colour(Colour::None), + message(result.getMessage()), + messages(_stats.infoMessages), + printInfoMessages(_printInfoMessages) { + switch (result.getResultType()) { + case ResultWas::Ok: + colour = Colour::Success; + passOrFail = "PASSED"; + //if( result.hasMessage() ) + if (_stats.infoMessages.size() == 1) + messageLabel = "with message"; + if (_stats.infoMessages.size() > 1) + messageLabel = "with messages"; + break; + case ResultWas::ExpressionFailed: + if (result.isOk()) { + colour = Colour::Success; + passOrFail = "FAILED - but was ok"; + } else { + colour = Colour::Error; + passOrFail = "FAILED"; + } + if (_stats.infoMessages.size() == 1) + messageLabel = "with message"; + if (_stats.infoMessages.size() > 1) + messageLabel = "with messages"; + break; + case ResultWas::ThrewException: + colour = Colour::Error; + passOrFail = "FAILED"; + messageLabel = "due to unexpected exception with "; + if (_stats.infoMessages.size() == 1) + messageLabel += "message"; + if (_stats.infoMessages.size() > 1) + messageLabel += "messages"; + break; + case ResultWas::FatalErrorCondition: + colour = Colour::Error; + passOrFail = "FAILED"; + messageLabel = "due to a fatal error condition"; + break; + case ResultWas::DidntThrowException: + colour = Colour::Error; + passOrFail = "FAILED"; + messageLabel = "because no exception was thrown where one was expected"; + break; + case ResultWas::Info: + messageLabel = "info"; + break; + case ResultWas::Warning: + messageLabel = "warning"; + break; + case ResultWas::ExplicitFailure: + passOrFail = "FAILED"; + colour = Colour::Error; + if (_stats.infoMessages.size() == 1) + messageLabel = "explicitly with message"; + if (_stats.infoMessages.size() > 1) + messageLabel = "explicitly with messages"; + break; + // These cases are here to prevent compiler warnings + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + passOrFail = "** internal error **"; + colour = Colour::Error; + break; + } + } + + void print() const { + printSourceInfo(); + if (stats.totals.assertions.total() > 0) { + if (result.isOk()) + stream << '\n'; + printResultType(); + printOriginalExpression(); + printReconstructedExpression(); + } else { + stream << '\n'; + } + printMessage(); + } + +private: + void printResultType() const { + if (!passOrFail.empty()) { + Colour colourGuard(colour); + stream << passOrFail << ":\n"; + } + } + void printOriginalExpression() const { + if (result.hasExpression()) { + Colour colourGuard(Colour::OriginalExpression); + stream << " "; + stream << result.getExpressionInMacro(); + stream << '\n'; + } + } + void printReconstructedExpression() const { + if (result.hasExpandedExpression()) { + stream << "with expansion:\n"; + Colour colourGuard(Colour::ReconstructedExpression); + stream << Column(result.getExpandedExpression()).indent(2) << '\n'; + } + } + void printMessage() const { + if (!messageLabel.empty()) + stream << messageLabel << ':' << '\n'; + for (auto const& msg : messages) { + // If this assertion is a warning ignore any INFO messages + if (printInfoMessages || msg.type != ResultWas::Info) + stream << Column(msg.message).indent(2) << '\n'; + } + } + void printSourceInfo() const { + Colour colourGuard(Colour::FileName); + stream << result.getSourceInfo() << ": "; + } + + std::ostream& stream; + AssertionStats const& stats; + AssertionResult const& result; + Colour::Code colour; + std::string passOrFail; + std::string messageLabel; + std::string message; + std::vector messages; + bool printInfoMessages; +}; + +std::size_t makeRatio(std::size_t number, std::size_t total) { + std::size_t ratio = total > 0 ? CATCH_CONFIG_CONSOLE_WIDTH * number / total : 0; + return (ratio == 0 && number > 0) ? 1 : ratio; +} + +std::size_t& findMax(std::size_t& i, std::size_t& j, std::size_t& k) { + if (i > j && i > k) + return i; + else if (j > k) + return j; + else + return k; +} + +struct ColumnInfo { + enum Justification { Left, Right }; + std::string name; + int width; + Justification justification; +}; +struct ColumnBreak {}; +struct RowBreak {}; + +class Duration { + enum class Unit { + Auto, + Nanoseconds, + Microseconds, + Milliseconds, + Seconds, + Minutes + }; + static const uint64_t s_nanosecondsInAMicrosecond = 1000; + static const uint64_t s_nanosecondsInAMillisecond = 1000 * s_nanosecondsInAMicrosecond; + static const uint64_t s_nanosecondsInASecond = 1000 * s_nanosecondsInAMillisecond; + static const uint64_t s_nanosecondsInAMinute = 60 * s_nanosecondsInASecond; + + uint64_t m_inNanoseconds; + Unit m_units; + +public: + explicit Duration(uint64_t inNanoseconds, Unit units = Unit::Auto) + : m_inNanoseconds(inNanoseconds), + m_units(units) { + if (m_units == Unit::Auto) { + if (m_inNanoseconds < s_nanosecondsInAMicrosecond) + m_units = Unit::Nanoseconds; + else if (m_inNanoseconds < s_nanosecondsInAMillisecond) + m_units = Unit::Microseconds; + else if (m_inNanoseconds < s_nanosecondsInASecond) + m_units = Unit::Milliseconds; + else if (m_inNanoseconds < s_nanosecondsInAMinute) + m_units = Unit::Seconds; + else + m_units = Unit::Minutes; + } + + } + + auto value() const -> double { + switch (m_units) { + case Unit::Microseconds: + return m_inNanoseconds / static_cast(s_nanosecondsInAMicrosecond); + case Unit::Milliseconds: + return m_inNanoseconds / static_cast(s_nanosecondsInAMillisecond); + case Unit::Seconds: + return m_inNanoseconds / static_cast(s_nanosecondsInASecond); + case Unit::Minutes: + return m_inNanoseconds / static_cast(s_nanosecondsInAMinute); + default: + return static_cast(m_inNanoseconds); + } + } + auto unitsAsString() const -> std::string { + switch (m_units) { + case Unit::Nanoseconds: + return "ns"; + case Unit::Microseconds: + return "µs"; + case Unit::Milliseconds: + return "ms"; + case Unit::Seconds: + return "s"; + case Unit::Minutes: + return "m"; + default: + return "** internal error **"; + } + + } + friend auto operator << (std::ostream& os, Duration const& duration) -> std::ostream& { + return os << duration.value() << " " << duration.unitsAsString(); + } +}; +} // end anon namespace + +class TablePrinter { + std::ostream& m_os; + std::vector m_columnInfos; + std::ostringstream m_oss; + int m_currentColumn = -1; + bool m_isOpen = false; + +public: + TablePrinter( std::ostream& os, std::vector columnInfos ) + : m_os( os ), + m_columnInfos( std::move( columnInfos ) ) {} + + auto columnInfos() const -> std::vector const& { + return m_columnInfos; + } + + void open() { + if (!m_isOpen) { + m_isOpen = true; + *this << RowBreak(); + for (auto const& info : m_columnInfos) + *this << info.name << ColumnBreak(); + *this << RowBreak(); + m_os << Catch::getLineOfChars<'-'>() << "\n"; + } + } + void close() { + if (m_isOpen) { + *this << RowBreak(); + m_os << std::endl; + m_isOpen = false; + } + } + + template + friend TablePrinter& operator << (TablePrinter& tp, T const& value) { + tp.m_oss << value; + return tp; + } + + friend TablePrinter& operator << (TablePrinter& tp, ColumnBreak) { + auto colStr = tp.m_oss.str(); + // This takes account of utf8 encodings + auto strSize = Catch::StringRef(colStr).numberOfCharacters(); + tp.m_oss.str(""); + tp.open(); + if (tp.m_currentColumn == static_cast(tp.m_columnInfos.size() - 1)) { + tp.m_currentColumn = -1; + tp.m_os << "\n"; + } + tp.m_currentColumn++; + + auto colInfo = tp.m_columnInfos[tp.m_currentColumn]; + auto padding = (strSize + 2 < static_cast(colInfo.width)) + ? std::string(colInfo.width - (strSize + 2), ' ') + : std::string(); + if (colInfo.justification == ColumnInfo::Left) + tp.m_os << colStr << padding << " "; + else + tp.m_os << padding << colStr << " "; + return tp; + } + + friend TablePrinter& operator << (TablePrinter& tp, RowBreak) { + if (tp.m_currentColumn > 0) { + tp.m_os << "\n"; + tp.m_currentColumn = -1; + } + return tp; + } +}; + +ConsoleReporter::ConsoleReporter(ReporterConfig const& config) + : StreamingReporterBase(config), + m_tablePrinter(new TablePrinter(config.stream(), + { + { "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH - 32, ColumnInfo::Left }, + { "iters", 8, ColumnInfo::Right }, + { "elapsed ns", 14, ColumnInfo::Right }, + { "average", 14, ColumnInfo::Right } + })) {} +ConsoleReporter::~ConsoleReporter() = default; + +std::string ConsoleReporter::getDescription() { + return "Reports test results as plain lines of text"; +} + +void ConsoleReporter::noMatchingTestCases(std::string const& spec) { + stream << "No test cases matched '" << spec << '\'' << std::endl; +} + +void ConsoleReporter::assertionStarting(AssertionInfo const&) {} + +bool ConsoleReporter::assertionEnded(AssertionStats const& _assertionStats) { + AssertionResult const& result = _assertionStats.assertionResult; + + bool includeResults = m_config->includeSuccessfulResults() || !result.isOk(); + + // Drop out if result was successful but we're not printing them. + if (!includeResults && result.getResultType() != ResultWas::Warning) + return false; + + lazyPrint(); + + ConsoleAssertionPrinter printer(stream, _assertionStats, includeResults); + printer.print(); + stream << std::endl; + return true; +} + +void ConsoleReporter::sectionStarting(SectionInfo const& _sectionInfo) { + m_headerPrinted = false; + StreamingReporterBase::sectionStarting(_sectionInfo); +} +void ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) { + m_tablePrinter->close(); + if (_sectionStats.missingAssertions) { + lazyPrint(); + Colour colour(Colour::ResultError); + if (m_sectionStack.size() > 1) + stream << "\nNo assertions in section"; + else + stream << "\nNo assertions in test case"; + stream << " '" << _sectionStats.sectionInfo.name << "'\n" << std::endl; + } + if (m_config->showDurations() == ShowDurations::Always) { + stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl; + } + if (m_headerPrinted) { + m_headerPrinted = false; + } + StreamingReporterBase::sectionEnded(_sectionStats); +} + +void ConsoleReporter::benchmarkStarting(BenchmarkInfo const& info) { + lazyPrintWithoutClosingBenchmarkTable(); + + auto nameCol = Column( info.name ).width( static_cast( m_tablePrinter->columnInfos()[0].width - 2 ) ); + + bool firstLine = true; + for (auto line : nameCol) { + if (!firstLine) + (*m_tablePrinter) << ColumnBreak() << ColumnBreak() << ColumnBreak(); + else + firstLine = false; + + (*m_tablePrinter) << line << ColumnBreak(); + } +} +void ConsoleReporter::benchmarkEnded(BenchmarkStats const& stats) { + Duration average(stats.elapsedTimeInNanoseconds / stats.iterations); + (*m_tablePrinter) + << stats.iterations << ColumnBreak() + << stats.elapsedTimeInNanoseconds << ColumnBreak() + << average << ColumnBreak(); +} + +void ConsoleReporter::testCaseEnded(TestCaseStats const& _testCaseStats) { + m_tablePrinter->close(); + StreamingReporterBase::testCaseEnded(_testCaseStats); + m_headerPrinted = false; +} +void ConsoleReporter::testGroupEnded(TestGroupStats const& _testGroupStats) { + if (currentGroupInfo.used) { + printSummaryDivider(); + stream << "Summary for group '" << _testGroupStats.groupInfo.name << "':\n"; + printTotals(_testGroupStats.totals); + stream << '\n' << std::endl; + } + StreamingReporterBase::testGroupEnded(_testGroupStats); +} +void ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) { + printTotalsDivider(_testRunStats.totals); + printTotals(_testRunStats.totals); + stream << std::endl; + StreamingReporterBase::testRunEnded(_testRunStats); +} + +void ConsoleReporter::lazyPrint() { + + m_tablePrinter->close(); + lazyPrintWithoutClosingBenchmarkTable(); +} + +void ConsoleReporter::lazyPrintWithoutClosingBenchmarkTable() { + + if (!currentTestRunInfo.used) + lazyPrintRunInfo(); + if (!currentGroupInfo.used) + lazyPrintGroupInfo(); + + if (!m_headerPrinted) { + printTestCaseAndSectionHeader(); + m_headerPrinted = true; + } +} +void ConsoleReporter::lazyPrintRunInfo() { + stream << '\n' << getLineOfChars<'~'>() << '\n'; + Colour colour(Colour::SecondaryText); + stream << currentTestRunInfo->name + << " is a Catch v" << libraryVersion() << " host application.\n" + << "Run with -? for options\n\n"; + + if (m_config->rngSeed() != 0) + stream << "Randomness seeded to: " << m_config->rngSeed() << "\n\n"; + + currentTestRunInfo.used = true; +} +void ConsoleReporter::lazyPrintGroupInfo() { + if (!currentGroupInfo->name.empty() && currentGroupInfo->groupsCounts > 1) { + printClosedHeader("Group: " + currentGroupInfo->name); + currentGroupInfo.used = true; + } +} +void ConsoleReporter::printTestCaseAndSectionHeader() { + assert(!m_sectionStack.empty()); + printOpenHeader(currentTestCaseInfo->name); + + if (m_sectionStack.size() > 1) { + Colour colourGuard(Colour::Headers); + + auto + it = m_sectionStack.begin() + 1, // Skip first section (test case) + itEnd = m_sectionStack.end(); + for (; it != itEnd; ++it) + printHeaderString(it->name, 2); + } + + SourceLineInfo lineInfo = m_sectionStack.back().lineInfo; + + if (!lineInfo.empty()) { + stream << getLineOfChars<'-'>() << '\n'; + Colour colourGuard(Colour::FileName); + stream << lineInfo << '\n'; + } + stream << getLineOfChars<'.'>() << '\n' << std::endl; +} + +void ConsoleReporter::printClosedHeader(std::string const& _name) { + printOpenHeader(_name); + stream << getLineOfChars<'.'>() << '\n'; +} +void ConsoleReporter::printOpenHeader(std::string const& _name) { + stream << getLineOfChars<'-'>() << '\n'; + { + Colour colourGuard(Colour::Headers); + printHeaderString(_name); + } +} + +// if string has a : in first line will set indent to follow it on +// subsequent lines +void ConsoleReporter::printHeaderString(std::string const& _string, std::size_t indent) { + std::size_t i = _string.find(": "); + if (i != std::string::npos) + i += 2; + else + i = 0; + stream << Column(_string).indent(indent + i).initialIndent(indent) << '\n'; +} + +struct SummaryColumn { + + SummaryColumn( std::string _label, Colour::Code _colour ) + : label( std::move( _label ) ), + colour( _colour ) {} + SummaryColumn addRow( std::size_t count ) { + ReusableStringStream rss; + rss << count; + std::string row = rss.str(); + for (auto& oldRow : rows) { + while (oldRow.size() < row.size()) + oldRow = ' ' + oldRow; + while (oldRow.size() > row.size()) + row = ' ' + row; + } + rows.push_back(row); + return *this; + } + + std::string label; + Colour::Code colour; + std::vector rows; + +}; + +void ConsoleReporter::printTotals( Totals const& totals ) { + if (totals.testCases.total() == 0) { + stream << Colour(Colour::Warning) << "No tests ran\n"; + } else if (totals.assertions.total() > 0 && totals.testCases.allPassed()) { + stream << Colour(Colour::ResultSuccess) << "All tests passed"; + stream << " (" + << pluralise(totals.assertions.passed, "assertion") << " in " + << pluralise(totals.testCases.passed, "test case") << ')' + << '\n'; + } else { + + std::vector columns; + columns.push_back(SummaryColumn("", Colour::None) + .addRow(totals.testCases.total()) + .addRow(totals.assertions.total())); + columns.push_back(SummaryColumn("passed", Colour::Success) + .addRow(totals.testCases.passed) + .addRow(totals.assertions.passed)); + columns.push_back(SummaryColumn("failed", Colour::ResultError) + .addRow(totals.testCases.failed) + .addRow(totals.assertions.failed)); + columns.push_back(SummaryColumn("failed as expected", Colour::ResultExpectedFailure) + .addRow(totals.testCases.failedButOk) + .addRow(totals.assertions.failedButOk)); + + printSummaryRow("test cases", columns, 0); + printSummaryRow("assertions", columns, 1); + } +} +void ConsoleReporter::printSummaryRow(std::string const& label, std::vector const& cols, std::size_t row) { + for (auto col : cols) { + std::string value = col.rows[row]; + if (col.label.empty()) { + stream << label << ": "; + if (value != "0") + stream << value; + else + stream << Colour(Colour::Warning) << "- none -"; + } else if (value != "0") { + stream << Colour(Colour::LightGrey) << " | "; + stream << Colour(col.colour) + << value << ' ' << col.label; + } + } + stream << '\n'; +} + +void ConsoleReporter::printTotalsDivider(Totals const& totals) { + if (totals.testCases.total() > 0) { + std::size_t failedRatio = makeRatio(totals.testCases.failed, totals.testCases.total()); + std::size_t failedButOkRatio = makeRatio(totals.testCases.failedButOk, totals.testCases.total()); + std::size_t passedRatio = makeRatio(totals.testCases.passed, totals.testCases.total()); + while (failedRatio + failedButOkRatio + passedRatio < CATCH_CONFIG_CONSOLE_WIDTH - 1) + findMax(failedRatio, failedButOkRatio, passedRatio)++; + while (failedRatio + failedButOkRatio + passedRatio > CATCH_CONFIG_CONSOLE_WIDTH - 1) + findMax(failedRatio, failedButOkRatio, passedRatio)--; + + stream << Colour(Colour::Error) << std::string(failedRatio, '='); + stream << Colour(Colour::ResultExpectedFailure) << std::string(failedButOkRatio, '='); + if (totals.testCases.allPassed()) + stream << Colour(Colour::ResultSuccess) << std::string(passedRatio, '='); + else + stream << Colour(Colour::Success) << std::string(passedRatio, '='); + } else { + stream << Colour(Colour::Warning) << std::string(CATCH_CONFIG_CONSOLE_WIDTH - 1, '='); + } + stream << '\n'; +} +void ConsoleReporter::printSummaryDivider() { + stream << getLineOfChars<'-'>() << '\n'; +} + +CATCH_REGISTER_REPORTER("console", ConsoleReporter) + +} // end namespace Catch + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif +// end catch_reporter_console.cpp +// start catch_reporter_junit.cpp + +#include +#include +#include +#include + +namespace Catch { + + namespace { + std::string getCurrentTimestamp() { + // Beware, this is not reentrant because of backward compatibility issues + // Also, UTC only, again because of backward compatibility (%z is C++11) + time_t rawtime; + std::time(&rawtime); + auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); + +#ifdef _MSC_VER + std::tm timeInfo = {}; + gmtime_s(&timeInfo, &rawtime); +#else + std::tm* timeInfo; + timeInfo = std::gmtime(&rawtime); +#endif + + char timeStamp[timeStampSize]; + const char * const fmt = "%Y-%m-%dT%H:%M:%SZ"; + +#ifdef _MSC_VER + std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); +#else + std::strftime(timeStamp, timeStampSize, fmt, timeInfo); +#endif + return std::string(timeStamp); + } + + std::string fileNameTag(const std::vector &tags) { + auto it = std::find_if(begin(tags), + end(tags), + [] (std::string const& tag) {return tag.front() == '#'; }); + if (it != tags.end()) + return it->substr(1); + return std::string(); + } + } // anonymous namespace + + JunitReporter::JunitReporter( ReporterConfig const& _config ) + : CumulativeReporterBase( _config ), + xml( _config.stream() ) + { + m_reporterPrefs.shouldRedirectStdOut = true; + } + + JunitReporter::~JunitReporter() {} + + std::string JunitReporter::getDescription() { + return "Reports test results in an XML format that looks like Ant's junitreport target"; + } + + void JunitReporter::noMatchingTestCases( std::string const& /*spec*/ ) {} + + void JunitReporter::testRunStarting( TestRunInfo const& runInfo ) { + CumulativeReporterBase::testRunStarting( runInfo ); + xml.startElement( "testsuites" ); + } + + void JunitReporter::testGroupStarting( GroupInfo const& groupInfo ) { + suiteTimer.start(); + stdOutForSuite.clear(); + stdErrForSuite.clear(); + unexpectedExceptions = 0; + CumulativeReporterBase::testGroupStarting( groupInfo ); + } + + void JunitReporter::testCaseStarting( TestCaseInfo const& testCaseInfo ) { + m_okToFail = testCaseInfo.okToFail(); + } + + bool JunitReporter::assertionEnded( AssertionStats const& assertionStats ) { + if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail ) + unexpectedExceptions++; + return CumulativeReporterBase::assertionEnded( assertionStats ); + } + + void JunitReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { + stdOutForSuite += testCaseStats.stdOut; + stdErrForSuite += testCaseStats.stdErr; + CumulativeReporterBase::testCaseEnded( testCaseStats ); + } + + void JunitReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { + double suiteTime = suiteTimer.getElapsedSeconds(); + CumulativeReporterBase::testGroupEnded( testGroupStats ); + writeGroup( *m_testGroups.back(), suiteTime ); + } + + void JunitReporter::testRunEndedCumulative() { + xml.endElement(); + } + + void JunitReporter::writeGroup( TestGroupNode const& groupNode, double suiteTime ) { + XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" ); + TestGroupStats const& stats = groupNode.value; + xml.writeAttribute( "name", stats.groupInfo.name ); + xml.writeAttribute( "errors", unexpectedExceptions ); + xml.writeAttribute( "failures", stats.totals.assertions.failed-unexpectedExceptions ); + xml.writeAttribute( "tests", stats.totals.assertions.total() ); + xml.writeAttribute( "hostname", "tbd" ); // !TBD + if( m_config->showDurations() == ShowDurations::Never ) + xml.writeAttribute( "time", "" ); + else + xml.writeAttribute( "time", suiteTime ); + xml.writeAttribute( "timestamp", getCurrentTimestamp() ); + + // Write test cases + for( auto const& child : groupNode.children ) + writeTestCase( *child ); + + xml.scopedElement( "system-out" ).writeText( trim( stdOutForSuite ), false ); + xml.scopedElement( "system-err" ).writeText( trim( stdErrForSuite ), false ); + } + + void JunitReporter::writeTestCase( TestCaseNode const& testCaseNode ) { + TestCaseStats const& stats = testCaseNode.value; + + // All test cases have exactly one section - which represents the + // test case itself. That section may have 0-n nested sections + assert( testCaseNode.children.size() == 1 ); + SectionNode const& rootSection = *testCaseNode.children.front(); + + std::string className = stats.testInfo.className; + + if( className.empty() ) { + className = fileNameTag(stats.testInfo.tags); + if ( className.empty() ) + className = "global"; + } + + if ( !m_config->name().empty() ) + className = m_config->name() + "." + className; + + writeSection( className, "", rootSection ); + } + + void JunitReporter::writeSection( std::string const& className, + std::string const& rootName, + SectionNode const& sectionNode ) { + std::string name = trim( sectionNode.stats.sectionInfo.name ); + if( !rootName.empty() ) + name = rootName + '/' + name; + + if( !sectionNode.assertions.empty() || + !sectionNode.stdOut.empty() || + !sectionNode.stdErr.empty() ) { + XmlWriter::ScopedElement e = xml.scopedElement( "testcase" ); + if( className.empty() ) { + xml.writeAttribute( "classname", name ); + xml.writeAttribute( "name", "root" ); + } + else { + xml.writeAttribute( "classname", className ); + xml.writeAttribute( "name", name ); + } + xml.writeAttribute( "time", ::Catch::Detail::stringify( sectionNode.stats.durationInSeconds ) ); + + writeAssertions( sectionNode ); + + if( !sectionNode.stdOut.empty() ) + xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), false ); + if( !sectionNode.stdErr.empty() ) + xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), false ); + } + for( auto const& childNode : sectionNode.childSections ) + if( className.empty() ) + writeSection( name, "", *childNode ); + else + writeSection( className, name, *childNode ); + } + + void JunitReporter::writeAssertions( SectionNode const& sectionNode ) { + for( auto const& assertion : sectionNode.assertions ) + writeAssertion( assertion ); + } + + void JunitReporter::writeAssertion( AssertionStats const& stats ) { + AssertionResult const& result = stats.assertionResult; + if( !result.isOk() ) { + std::string elementName; + switch( result.getResultType() ) { + case ResultWas::ThrewException: + case ResultWas::FatalErrorCondition: + elementName = "error"; + break; + case ResultWas::ExplicitFailure: + elementName = "failure"; + break; + case ResultWas::ExpressionFailed: + elementName = "failure"; + break; + case ResultWas::DidntThrowException: + elementName = "failure"; + break; + + // We should never see these here: + case ResultWas::Info: + case ResultWas::Warning: + case ResultWas::Ok: + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + elementName = "internalError"; + break; + } + + XmlWriter::ScopedElement e = xml.scopedElement( elementName ); + + xml.writeAttribute( "message", result.getExpandedExpression() ); + xml.writeAttribute( "type", result.getTestMacroName() ); + + ReusableStringStream rss; + if( !result.getMessage().empty() ) + rss << result.getMessage() << '\n'; + for( auto const& msg : stats.infoMessages ) + if( msg.type == ResultWas::Info ) + rss << msg.message << '\n'; + + rss << "at " << result.getSourceInfo(); + xml.writeText( rss.str(), false ); + } + } + + CATCH_REGISTER_REPORTER( "junit", JunitReporter ) + +} // end namespace Catch +// end catch_reporter_junit.cpp +// start catch_reporter_multi.cpp + +namespace Catch { + + void MultipleReporters::add( IStreamingReporterPtr&& reporter ) { + m_reporters.push_back( std::move( reporter ) ); + } + + ReporterPreferences MultipleReporters::getPreferences() const { + return m_reporters[0]->getPreferences(); + } + + std::set MultipleReporters::getSupportedVerbosities() { + return std::set{ }; + } + + void MultipleReporters::noMatchingTestCases( std::string const& spec ) { + for( auto const& reporter : m_reporters ) + reporter->noMatchingTestCases( spec ); + } + + void MultipleReporters::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) { + for( auto const& reporter : m_reporters ) + reporter->benchmarkStarting( benchmarkInfo ); + } + void MultipleReporters::benchmarkEnded( BenchmarkStats const& benchmarkStats ) { + for( auto const& reporter : m_reporters ) + reporter->benchmarkEnded( benchmarkStats ); + } + + void MultipleReporters::testRunStarting( TestRunInfo const& testRunInfo ) { + for( auto const& reporter : m_reporters ) + reporter->testRunStarting( testRunInfo ); + } + + void MultipleReporters::testGroupStarting( GroupInfo const& groupInfo ) { + for( auto const& reporter : m_reporters ) + reporter->testGroupStarting( groupInfo ); + } + + void MultipleReporters::testCaseStarting( TestCaseInfo const& testInfo ) { + for( auto const& reporter : m_reporters ) + reporter->testCaseStarting( testInfo ); + } + + void MultipleReporters::sectionStarting( SectionInfo const& sectionInfo ) { + for( auto const& reporter : m_reporters ) + reporter->sectionStarting( sectionInfo ); + } + + void MultipleReporters::assertionStarting( AssertionInfo const& assertionInfo ) { + for( auto const& reporter : m_reporters ) + reporter->assertionStarting( assertionInfo ); + } + + // The return value indicates if the messages buffer should be cleared: + bool MultipleReporters::assertionEnded( AssertionStats const& assertionStats ) { + bool clearBuffer = false; + for( auto const& reporter : m_reporters ) + clearBuffer |= reporter->assertionEnded( assertionStats ); + return clearBuffer; + } + + void MultipleReporters::sectionEnded( SectionStats const& sectionStats ) { + for( auto const& reporter : m_reporters ) + reporter->sectionEnded( sectionStats ); + } + + void MultipleReporters::testCaseEnded( TestCaseStats const& testCaseStats ) { + for( auto const& reporter : m_reporters ) + reporter->testCaseEnded( testCaseStats ); + } + + void MultipleReporters::testGroupEnded( TestGroupStats const& testGroupStats ) { + for( auto const& reporter : m_reporters ) + reporter->testGroupEnded( testGroupStats ); + } + + void MultipleReporters::testRunEnded( TestRunStats const& testRunStats ) { + for( auto const& reporter : m_reporters ) + reporter->testRunEnded( testRunStats ); + } + + void MultipleReporters::skipTest( TestCaseInfo const& testInfo ) { + for( auto const& reporter : m_reporters ) + reporter->skipTest( testInfo ); + } + + bool MultipleReporters::isMulti() const { + return true; + } + +} // end namespace Catch +// end catch_reporter_multi.cpp +// start catch_reporter_xml.cpp + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch + // Note that 4062 (not all labels are handled + // and default is missing) is enabled +#endif + +namespace Catch { + XmlReporter::XmlReporter( ReporterConfig const& _config ) + : StreamingReporterBase( _config ), + m_xml(_config.stream()) + { + m_reporterPrefs.shouldRedirectStdOut = true; + } + + XmlReporter::~XmlReporter() = default; + + std::string XmlReporter::getDescription() { + return "Reports test results as an XML document"; + } + + std::string XmlReporter::getStylesheetRef() const { + return std::string(); + } + + void XmlReporter::writeSourceInfo( SourceLineInfo const& sourceInfo ) { + m_xml + .writeAttribute( "filename", sourceInfo.file ) + .writeAttribute( "line", sourceInfo.line ); + } + + void XmlReporter::noMatchingTestCases( std::string const& s ) { + StreamingReporterBase::noMatchingTestCases( s ); + } + + void XmlReporter::testRunStarting( TestRunInfo const& testInfo ) { + StreamingReporterBase::testRunStarting( testInfo ); + std::string stylesheetRef = getStylesheetRef(); + if( !stylesheetRef.empty() ) + m_xml.writeStylesheetRef( stylesheetRef ); + m_xml.startElement( "Catch" ); + if( !m_config->name().empty() ) + m_xml.writeAttribute( "name", m_config->name() ); + } + + void XmlReporter::testGroupStarting( GroupInfo const& groupInfo ) { + StreamingReporterBase::testGroupStarting( groupInfo ); + m_xml.startElement( "Group" ) + .writeAttribute( "name", groupInfo.name ); + } + + void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) { + StreamingReporterBase::testCaseStarting(testInfo); + m_xml.startElement( "TestCase" ) + .writeAttribute( "name", trim( testInfo.name ) ) + .writeAttribute( "description", testInfo.description ) + .writeAttribute( "tags", testInfo.tagsAsString() ); + + writeSourceInfo( testInfo.lineInfo ); + + if ( m_config->showDurations() == ShowDurations::Always ) + m_testCaseTimer.start(); + m_xml.ensureTagClosed(); + } + + void XmlReporter::sectionStarting( SectionInfo const& sectionInfo ) { + StreamingReporterBase::sectionStarting( sectionInfo ); + if( m_sectionDepth++ > 0 ) { + m_xml.startElement( "Section" ) + .writeAttribute( "name", trim( sectionInfo.name ) ) + .writeAttribute( "description", sectionInfo.description ); + writeSourceInfo( sectionInfo.lineInfo ); + m_xml.ensureTagClosed(); + } + } + + void XmlReporter::assertionStarting( AssertionInfo const& ) { } + + bool XmlReporter::assertionEnded( AssertionStats const& assertionStats ) { + + AssertionResult const& result = assertionStats.assertionResult; + + bool includeResults = m_config->includeSuccessfulResults() || !result.isOk(); + + if( includeResults || result.getResultType() == ResultWas::Warning ) { + // Print any info messages in tags. + for( auto const& msg : assertionStats.infoMessages ) { + if( msg.type == ResultWas::Info && includeResults ) { + m_xml.scopedElement( "Info" ) + .writeText( msg.message ); + } else if ( msg.type == ResultWas::Warning ) { + m_xml.scopedElement( "Warning" ) + .writeText( msg.message ); + } + } + } + + // Drop out if result was successful but we're not printing them. + if( !includeResults && result.getResultType() != ResultWas::Warning ) + return true; + + // Print the expression if there is one. + if( result.hasExpression() ) { + m_xml.startElement( "Expression" ) + .writeAttribute( "success", result.succeeded() ) + .writeAttribute( "type", result.getTestMacroName() ); + + writeSourceInfo( result.getSourceInfo() ); + + m_xml.scopedElement( "Original" ) + .writeText( result.getExpression() ); + m_xml.scopedElement( "Expanded" ) + .writeText( result.getExpandedExpression() ); + } + + // And... Print a result applicable to each result type. + switch( result.getResultType() ) { + case ResultWas::ThrewException: + m_xml.startElement( "Exception" ); + writeSourceInfo( result.getSourceInfo() ); + m_xml.writeText( result.getMessage() ); + m_xml.endElement(); + break; + case ResultWas::FatalErrorCondition: + m_xml.startElement( "FatalErrorCondition" ); + writeSourceInfo( result.getSourceInfo() ); + m_xml.writeText( result.getMessage() ); + m_xml.endElement(); + break; + case ResultWas::Info: + m_xml.scopedElement( "Info" ) + .writeText( result.getMessage() ); + break; + case ResultWas::Warning: + // Warning will already have been written + break; + case ResultWas::ExplicitFailure: + m_xml.startElement( "Failure" ); + writeSourceInfo( result.getSourceInfo() ); + m_xml.writeText( result.getMessage() ); + m_xml.endElement(); + break; + default: + break; + } + + if( result.hasExpression() ) + m_xml.endElement(); + + return true; + } + + void XmlReporter::sectionEnded( SectionStats const& sectionStats ) { + StreamingReporterBase::sectionEnded( sectionStats ); + if( --m_sectionDepth > 0 ) { + XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" ); + e.writeAttribute( "successes", sectionStats.assertions.passed ); + e.writeAttribute( "failures", sectionStats.assertions.failed ); + e.writeAttribute( "expectedFailures", sectionStats.assertions.failedButOk ); + + if ( m_config->showDurations() == ShowDurations::Always ) + e.writeAttribute( "durationInSeconds", sectionStats.durationInSeconds ); + + m_xml.endElement(); + } + } + + void XmlReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { + StreamingReporterBase::testCaseEnded( testCaseStats ); + XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" ); + e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() ); + + if ( m_config->showDurations() == ShowDurations::Always ) + e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() ); + + if( !testCaseStats.stdOut.empty() ) + m_xml.scopedElement( "StdOut" ).writeText( trim( testCaseStats.stdOut ), false ); + if( !testCaseStats.stdErr.empty() ) + m_xml.scopedElement( "StdErr" ).writeText( trim( testCaseStats.stdErr ), false ); + + m_xml.endElement(); + } + + void XmlReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { + StreamingReporterBase::testGroupEnded( testGroupStats ); + // TODO: Check testGroupStats.aborting and act accordingly. + m_xml.scopedElement( "OverallResults" ) + .writeAttribute( "successes", testGroupStats.totals.assertions.passed ) + .writeAttribute( "failures", testGroupStats.totals.assertions.failed ) + .writeAttribute( "expectedFailures", testGroupStats.totals.assertions.failedButOk ); + m_xml.endElement(); + } + + void XmlReporter::testRunEnded( TestRunStats const& testRunStats ) { + StreamingReporterBase::testRunEnded( testRunStats ); + m_xml.scopedElement( "OverallResults" ) + .writeAttribute( "successes", testRunStats.totals.assertions.passed ) + .writeAttribute( "failures", testRunStats.totals.assertions.failed ) + .writeAttribute( "expectedFailures", testRunStats.totals.assertions.failedButOk ); + m_xml.endElement(); + } + + CATCH_REGISTER_REPORTER( "xml", XmlReporter ) + +} // end namespace Catch + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif +// end catch_reporter_xml.cpp + +namespace Catch { + LeakDetector leakDetector; +} + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +// end catch_impl.hpp +#endif + +#ifdef CATCH_CONFIG_MAIN +// start catch_default_main.hpp + +#ifndef __OBJC__ + +#if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN) +// Standard C/C++ Win32 Unicode wmain entry point +extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) { +#else +// Standard C/C++ main entry point +int main (int argc, char * argv[]) { +#endif + + return Catch::Session().run( argc, argv ); +} + +#else // __OBJC__ + +// Objective-C entry point +int main (int argc, char * const argv[]) { +#if !CATCH_ARC_ENABLED + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; +#endif + + Catch::registerTestMethods(); + int result = Catch::Session().run( argc, (char**)argv ); + +#if !CATCH_ARC_ENABLED + [pool drain]; +#endif + + return result; +} + +#endif // __OBJC__ + +// end catch_default_main.hpp +#endif + +#if !defined(CATCH_CONFIG_IMPL_ONLY) + +#ifdef CLARA_CONFIG_MAIN_NOT_DEFINED +# undef CLARA_CONFIG_MAIN +#endif + +#if !defined(CATCH_CONFIG_DISABLE) +////// +// If this config identifier is defined then all CATCH macros are prefixed with CATCH_ +#ifdef CATCH_CONFIG_PREFIX_ALL + +#define CATCH_REQUIRE( ... ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__ ) +#define CATCH_REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ ) + +#define CATCH_REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_REQUIRE_THROWS", Catch::ResultDisposition::Normal, "", __VA_ARGS__ ) +#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr ) +#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr ) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr ) +#endif// CATCH_CONFIG_DISABLE_MATCHERS +#define CATCH_REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ ) + +#define CATCH_CHECK( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CATCH_CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ ) +#define CATCH_CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CATCH_CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CATCH_CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CATCH_CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CATCH_CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ ) + +#define CATCH_CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, "", __VA_ARGS__ ) +#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr ) +#define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) +#endif // CATCH_CONFIG_DISABLE_MATCHERS +#define CATCH_CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) + +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CATCH_CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg ) + +#define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg ) +#endif // CATCH_CONFIG_DISABLE_MATCHERS + +#define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( "CATCH_INFO", msg ) +#define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( "CATCH_WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg ) +#define CATCH_CAPTURE( msg ) INTERNAL_CATCH_INFO( "CATCH_CAPTURE", #msg " := " << ::Catch::Detail::stringify(msg) ) + +#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) +#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) +#define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ ) +#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) +#define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) +#define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) + +#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE() + +// "BDD-style" convenience wrappers +#define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ ) +#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ ) +#define CATCH_GIVEN( desc ) CATCH_SECTION( std::string( "Given: ") + desc ) +#define CATCH_WHEN( desc ) CATCH_SECTION( std::string( " When: ") + desc ) +#define CATCH_AND_WHEN( desc ) CATCH_SECTION( std::string( " And: ") + desc ) +#define CATCH_THEN( desc ) CATCH_SECTION( std::string( " Then: ") + desc ) +#define CATCH_AND_THEN( desc ) CATCH_SECTION( std::string( " And: ") + desc ) + +// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required +#else + +#define REQUIRE( ... ) INTERNAL_CATCH_TEST( "REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__ ) +#define REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( "REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ ) + +#define REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "REQUIRE_THROWS", Catch::ResultDisposition::Normal, __VA_ARGS__ ) +#define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr ) +#define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr ) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr ) +#endif // CATCH_CONFIG_DISABLE_MATCHERS +#define REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ ) + +#define CHECK( ... ) INTERNAL_CATCH_TEST( "CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( "CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ ) +#define CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( "CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ ) + +#define CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr ) +#define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) +#endif // CATCH_CONFIG_DISABLE_MATCHERS +#define CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) + +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg ) + +#define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg ) +#endif // CATCH_CONFIG_DISABLE_MATCHERS + +#define INFO( msg ) INTERNAL_CATCH_INFO( "INFO", msg ) +#define WARN( msg ) INTERNAL_CATCH_MSG( "WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg ) +#define CAPTURE( msg ) INTERNAL_CATCH_INFO( "CAPTURE", #msg " := " << ::Catch::Detail::stringify(msg) ) + +#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) +#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) +#define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ ) +#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) +#define FAIL( ... ) INTERNAL_CATCH_MSG( "FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) +#define FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE() + +#endif + +#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) + +// "BDD-style" convenience wrappers +#define SCENARIO( ... ) TEST_CASE( "Scenario: " __VA_ARGS__ ) +#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ ) + +#define GIVEN( desc ) SECTION( std::string(" Given: ") + desc ) +#define WHEN( desc ) SECTION( std::string(" When: ") + desc ) +#define AND_WHEN( desc ) SECTION( std::string("And when: ") + desc ) +#define THEN( desc ) SECTION( std::string(" Then: ") + desc ) +#define AND_THEN( desc ) SECTION( std::string(" And: ") + desc ) + +using Catch::Detail::Approx; + +#else +////// +// If this config identifier is defined then all CATCH macros are prefixed with CATCH_ +#ifdef CATCH_CONFIG_PREFIX_ALL + +#define CATCH_REQUIRE( ... ) (void)(0) +#define CATCH_REQUIRE_FALSE( ... ) (void)(0) + +#define CATCH_REQUIRE_THROWS( ... ) (void)(0) +#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0) +#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) (void)(0) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) +#endif// CATCH_CONFIG_DISABLE_MATCHERS +#define CATCH_REQUIRE_NOTHROW( ... ) (void)(0) + +#define CATCH_CHECK( ... ) (void)(0) +#define CATCH_CHECK_FALSE( ... ) (void)(0) +#define CATCH_CHECKED_IF( ... ) if (__VA_ARGS__) +#define CATCH_CHECKED_ELSE( ... ) if (!(__VA_ARGS__)) +#define CATCH_CHECK_NOFAIL( ... ) (void)(0) + +#define CATCH_CHECK_THROWS( ... ) (void)(0) +#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) (void)(0) +#define CATCH_CHECK_THROWS_WITH( expr, matcher ) (void)(0) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) +#endif // CATCH_CONFIG_DISABLE_MATCHERS +#define CATCH_CHECK_NOTHROW( ... ) (void)(0) + +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CATCH_CHECK_THAT( arg, matcher ) (void)(0) + +#define CATCH_REQUIRE_THAT( arg, matcher ) (void)(0) +#endif // CATCH_CONFIG_DISABLE_MATCHERS + +#define CATCH_INFO( msg ) (void)(0) +#define CATCH_WARN( msg ) (void)(0) +#define CATCH_CAPTURE( msg ) (void)(0) + +#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) +#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) +#define CATCH_METHOD_AS_TEST_CASE( method, ... ) +#define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0) +#define CATCH_SECTION( ... ) +#define CATCH_FAIL( ... ) (void)(0) +#define CATCH_FAIL_CHECK( ... ) (void)(0) +#define CATCH_SUCCEED( ... ) (void)(0) + +#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) + +// "BDD-style" convenience wrappers +#define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) +#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className ) +#define CATCH_GIVEN( desc ) +#define CATCH_WHEN( desc ) +#define CATCH_AND_WHEN( desc ) +#define CATCH_THEN( desc ) +#define CATCH_AND_THEN( desc ) + +// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required +#else + +#define REQUIRE( ... ) (void)(0) +#define REQUIRE_FALSE( ... ) (void)(0) + +#define REQUIRE_THROWS( ... ) (void)(0) +#define REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0) +#define REQUIRE_THROWS_WITH( expr, matcher ) (void)(0) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) +#endif // CATCH_CONFIG_DISABLE_MATCHERS +#define REQUIRE_NOTHROW( ... ) (void)(0) + +#define CHECK( ... ) (void)(0) +#define CHECK_FALSE( ... ) (void)(0) +#define CHECKED_IF( ... ) if (__VA_ARGS__) +#define CHECKED_ELSE( ... ) if (!(__VA_ARGS__)) +#define CHECK_NOFAIL( ... ) (void)(0) + +#define CHECK_THROWS( ... ) (void)(0) +#define CHECK_THROWS_AS( expr, exceptionType ) (void)(0) +#define CHECK_THROWS_WITH( expr, matcher ) (void)(0) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) +#endif // CATCH_CONFIG_DISABLE_MATCHERS +#define CHECK_NOTHROW( ... ) (void)(0) + +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CHECK_THAT( arg, matcher ) (void)(0) + +#define REQUIRE_THAT( arg, matcher ) (void)(0) +#endif // CATCH_CONFIG_DISABLE_MATCHERS + +#define INFO( msg ) (void)(0) +#define WARN( msg ) (void)(0) +#define CAPTURE( msg ) (void)(0) + +#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) +#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) +#define METHOD_AS_TEST_CASE( method, ... ) +#define REGISTER_TEST_CASE( Function, ... ) (void)(0) +#define SECTION( ... ) +#define FAIL( ... ) (void)(0) +#define FAIL_CHECK( ... ) (void)(0) +#define SUCCEED( ... ) (void)(0) +#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) + +#endif + +#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature ) + +// "BDD-style" convenience wrappers +#define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) ) +#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className ) + +#define GIVEN( desc ) +#define WHEN( desc ) +#define AND_WHEN( desc ) +#define THEN( desc ) +#define AND_THEN( desc ) + +using Catch::Detail::Approx; + +#endif + +#endif // ! CATCH_CONFIG_IMPL_ONLY + +// start catch_reenable_warnings.h + + +#ifdef __clang__ +# ifdef __ICC // icpc defines the __clang__ macro +# pragma warning(pop) +# else +# pragma clang diagnostic pop +# endif +#elif defined __GNUC__ +# pragma GCC diagnostic pop +#endif + +// end catch_reenable_warnings.h +// end catch.hpp +#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED + diff --git a/xs/src/libslic3r/Config.cpp b/xs/src/libslic3r/ConfigBase.cpp similarity index 100% rename from xs/src/libslic3r/Config.cpp rename to xs/src/libslic3r/ConfigBase.cpp diff --git a/xs/src/libslic3r/Config.hpp b/xs/src/libslic3r/ConfigBase.hpp similarity index 100% rename from xs/src/libslic3r/Config.hpp rename to xs/src/libslic3r/ConfigBase.hpp From d145ee3465210be035f46ad43cc49bde1f799239 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 28 Apr 2018 18:12:26 -0500 Subject: [PATCH 039/112] Finish renaming Config->ConfigBase in libSlic3r to make room for a Slic3r::Config that has an interface closer to the Perl version. --- src/CMakeLists.txt | 2 +- src/slic3r.cpp | 2 +- xs/src/libslic3r/ConfigBase.cpp | 2 +- xs/src/libslic3r/ConfigBase.hpp | 6 +++--- xs/src/libslic3r/Flow.hpp | 2 +- xs/src/libslic3r/PrintConfig.hpp | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 15382d8b8..9f1e0072f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -44,7 +44,7 @@ add_library(libslic3r STATIC ${LIBDIR}/libslic3r/BoundingBox.cpp ${LIBDIR}/libslic3r/BridgeDetector.cpp ${LIBDIR}/libslic3r/ClipperUtils.cpp - ${LIBDIR}/libslic3r/Config.cpp + ${LIBDIR}/libslic3r/ConfigBase.cpp ${LIBDIR}/libslic3r/ExPolygon.cpp ${LIBDIR}/libslic3r/ExPolygonCollection.cpp ${LIBDIR}/libslic3r/Extruder.cpp diff --git a/src/slic3r.cpp b/src/slic3r.cpp index 82a04a1f1..2e8aaf387 100644 --- a/src/slic3r.cpp +++ b/src/slic3r.cpp @@ -1,4 +1,4 @@ -#include "Config.hpp" +#include "ConfigBase.hpp" #include "Geometry.hpp" #include "IO.hpp" #include "Model.hpp" diff --git a/xs/src/libslic3r/ConfigBase.cpp b/xs/src/libslic3r/ConfigBase.cpp index ad11df720..161c96212 100644 --- a/xs/src/libslic3r/ConfigBase.cpp +++ b/xs/src/libslic3r/ConfigBase.cpp @@ -1,4 +1,4 @@ -#include "Config.hpp" +#include "ConfigBase.hpp" #include #include #include diff --git a/xs/src/libslic3r/ConfigBase.hpp b/xs/src/libslic3r/ConfigBase.hpp index d1ea39002..1db0f9a96 100644 --- a/xs/src/libslic3r/ConfigBase.hpp +++ b/xs/src/libslic3r/ConfigBase.hpp @@ -1,5 +1,5 @@ -#ifndef slic3r_Config_hpp_ -#define slic3r_Config_hpp_ +#ifndef slic3r_ConfigBase_hpp_ +#define slic3r_ConfigBase_hpp_ #include #include @@ -751,4 +751,4 @@ class UnknownOptionException : public std::exception {}; } -#endif +#endif diff --git a/xs/src/libslic3r/Flow.hpp b/xs/src/libslic3r/Flow.hpp index fb4d8e237..cc8f90723 100644 --- a/xs/src/libslic3r/Flow.hpp +++ b/xs/src/libslic3r/Flow.hpp @@ -2,7 +2,7 @@ #define slic3r_Flow_hpp_ #include "libslic3r.h" -#include "Config.hpp" +#include "ConfigBase.hpp" #include "ExtrusionEntity.hpp" namespace Slic3r { diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index 0aa65ba28..6db11d275 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -19,7 +19,7 @@ #define slic3r_PrintConfig_hpp_ #include "libslic3r.h" -#include "Config.hpp" +#include "ConfigBase.hpp" #define OPT_PTR(KEY) if (opt_key == #KEY) return &this->KEY From ad46bc81060fe368688db61e123a8ecd17dbd011 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 28 Apr 2018 18:13:51 -0500 Subject: [PATCH 040/112] Start a simple Slic3r::Log to collect all of the debugging prints to a single area. Upgrade backend to boost::log as needed. --- xs/src/libslic3r/Log.hpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 xs/src/libslic3r/Log.hpp diff --git a/xs/src/libslic3r/Log.hpp b/xs/src/libslic3r/Log.hpp new file mode 100644 index 000000000..554b560a2 --- /dev/null +++ b/xs/src/libslic3r/Log.hpp @@ -0,0 +1,24 @@ +#ifndef slic3r_LOG_HPP +#define slic3r_LOG_HPP + +#include + +namespace Slic3r { + +class Log { +public: + static void fatal_error(std::string topic, std::wstring message) { + std::cerr << topic << ": "; + std::wcerr << message << std::endl; + } + + static void info(std::string topic, std::wstring message) { + std::clog << topic << ": "; + std::wclog << message << std::endl; + } + +}; + +} + +#endif // slic3r_LOG_HPP From 399db5902c618d40159ddb5f122620ad5105ee1b Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 28 Apr 2018 18:15:16 -0500 Subject: [PATCH 041/112] More misc functions (used to live as static functions in Slic3r::GUI perl file). Passing -DVAR_ABS and -DVAR_ABS_PATH=/path/to/slic3r/var on compile redirects where Slic3r expects to find its var directory. --- src/GUI/misc_ui.cpp | 32 ++++++++++++++++++++++++++++---- src/GUI/misc_ui.hpp | 31 +++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/src/GUI/misc_ui.cpp b/src/GUI/misc_ui.cpp index ef00fa2d3..8183ec020 100644 --- a/src/GUI/misc_ui.cpp +++ b/src/GUI/misc_ui.cpp @@ -1,5 +1,8 @@ #include "misc_ui.hpp" #include +#include + +#include namespace Slic3r { namespace GUI { @@ -14,11 +17,18 @@ void check_version(bool manual) { #endif const wxString var(const wxString& in) { + // TODO replace center string with path to VAR in actual distribution later + if (VAR_ABS) { + return VAR_ABS_PATH + "/" + in; + } else { + return bin() + VAR_REL + "/" + in; + } +} + +const wxString bin() { wxFileName f(wxStandardPaths::Get().GetExecutablePath()); wxString appPath(f.GetPath()); - - // replace center string with path to VAR in actual distribution later - return appPath + "/../var/" + in; + return appPath; } /// Returns the path to Slic3r's default user data directory. @@ -28,7 +38,6 @@ const wxString home(const wxString& in) { return wxGetHomeDir() + "/." + in + "/"; } - wxString decode_path(const wxString& in) { // TODO Stub return in; @@ -38,6 +47,21 @@ wxString encode_path(const wxString& in) { // TODO Stub return in; } + +void show_error(wxWindow* parent, const wxString& message) { + wxMessageDialog(parent, message, _("Error"), wxOK | wxICON_ERROR).ShowModal(); +} + +void show_info(wxWindow* parent, const wxString& message, const wxString& title = _("Notice")) { + wxMessageDialog(parent, message, title, wxOK | wxICON_INFORMATION).ShowModal(); +} + +void fatal_error(wxWindow* parent, const wxString& message) { + show_error(parent, message); + throw std::runtime_error(message.ToStdString()); +} + + /* sub append_submenu { my ($self, $menu, $string, $description, $submenu, $id, $icon) = @_; diff --git a/src/GUI/misc_ui.hpp b/src/GUI/misc_ui.hpp index 5276a3f8c..d8586fec7 100644 --- a/src/GUI/misc_ui.hpp +++ b/src/GUI/misc_ui.hpp @@ -29,16 +29,47 @@ constexpr bool isDev = true; constexpr bool isDev = false; #endif + +/// Mostly useful for Linux distro maintainers, this will change where Slic3r assumes +/// its ./var directory lives (where its art assets are). +/// Define VAR_ABS and VAR_ABS_PATH +#ifndef VAR_ABS + #define VAR_ABS false +#else + #define VAR_ABS true +#endif +#ifndef VAR_ABS_PATH + #define VAR_ABS_PATH "/usr/share/Slic3r/var" +#endif + +#ifndef VAR_REL // Redefine on compile + #define VAR_REL L"/../var" +#endif + /// Performs a check via the Internet for a new version of Slic3r. /// If this version of Slic3r was compiled with -DSLIC3R_DEV, check the development /// space instead of release. void check_version(bool manual = false); +/// Provides a path to Slic3r's var dir. const wxString var(const wxString& in); +/// Provide a path to where Slic3r exec'd from. +const wxString bin(); + /// Always returns path to home directory. const wxString home(const wxString& in = "Slic3r"); +/// Shows an error messagebox +void show_error(wxWindow* parent, const wxString& message); + +/// Shows an info messagebox. +void show_info(wxWindow* parent, const wxString& message, const wxString& title); + +/// Show an error messagebox and then throw an exception. +void fatal_error(wxWindow* parent, const wxString& message); + + template void append_menu_item(wxMenu* menu, const wxString& name,const wxString& help, T lambda, int id = wxID_ANY, const wxString& icon = "", const wxString& accel = "") { wxMenuItem* tmp = menu->Append(wxID_ANY, name, help); From d24001b92dae241a081838f61f602d8cd99f6a16 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 28 Apr 2018 18:17:10 -0500 Subject: [PATCH 042/112] Check for datadir in OnInit(). --- src/GUI/GUI.cpp | 55 ++++++++++++++++++++++++++++++++++++------------- src/GUI/GUI.hpp | 2 ++ 2 files changed, 43 insertions(+), 14 deletions(-) diff --git a/src/GUI/GUI.cpp b/src/GUI/GUI.cpp index 67d5485c1..690f07284 100644 --- a/src/GUI/GUI.cpp +++ b/src/GUI/GUI.cpp @@ -3,6 +3,8 @@ #include #endif #include +#include +#include #include "MainFrame.hpp" @@ -10,40 +12,65 @@ #include "misc_ui.hpp" #include "Preset.hpp" +// Logging mechanism +#include "Log.hpp" + namespace Slic3r { namespace GUI { -enum -{ - ID_Hello = 1 -}; +/// Primary initialization and point of entry into the GUI application. +/// Calls MainFrame and handles preset loading, etc. bool App::OnInit() { - - this->SetAppName("Slic3r"); // TODO: Call a logging function with channel GUI, severity info this->notifier = std::unique_ptr(); - wxString datadir {decode_path(wxStandardPaths::Get().GetUserDataDir())}; + datadir = decode_path(wxStandardPaths::Get().GetUserDataDir()); wxString enc_datadir = encode_path(datadir); - std::cerr << datadir << "\n"; + + const wxString& slic3r_ini {datadir + "/slic3r.ini"}; + const wxString& print_ini {datadir + "/print"}; + const wxString& printer_ini {datadir + "/printer"}; + const wxString& material_ini {datadir + "/filament"}; + + // if we don't have a datadir or a slic3r.ini, prompt for wizard. + bool run_wizard = (wxDirExists(datadir) && wxFileExists(slic3r_ini)); + + /* Check to make sure if datadir exists */ + for (auto& dir : std::vector { enc_datadir, print_ini, printer_ini, material_ini }) { + if (wxDirExists(dir)) continue; + if (!wxMkdir(dir)) { + Slic3r::Log::fatal_error(LogChannel, (_("Slic3r was unable to create its data directory at ")+ dir).ToStdWstring()); + } + } // TODO: Call a logging function with channel GUI, severity info for datadir path + Slic3r::Log::info(LogChannel, (_("Data dir: ") + datadir).ToStdWstring()); + + if (wxFileExists(slic3r_ini)) { + /* + my $ini = eval { Slic3r::Config->read_ini("$datadir/slic3r.ini") }; + if ($ini) { + $last_version = $ini->{_}{version}; + $ini->{_}{$_} = $Settings->{_}{$_} + for grep !exists $ini->{_}{$_}, keys %{$Settings->{_}}; + $Settings = $ini; + } + delete $Settings->{_}{mode}; # handle legacy + */ + } - /* Check to make sure if datadir exists - * - */ - // Load settings this->gui_config->save_settings(); + + // Load presets this->load_presets(); wxImage::AddHandler(new wxPNGHandler()); MainFrame *frame = new MainFrame( "Slic3r", wxDefaultPosition, wxDefaultSize, this->gui_config); this->SetTopWindow(frame); - frame->Show( true ); // Load init bundle // @@ -56,7 +83,7 @@ bool App::OnInit() && (!$Settings->{_}{last_version_check} || (time - $Settings->{_}{last_version_check}) >= 86400); */ - // run callback functions during idle + // run callback functions during idle on the main frame /* EVT_IDLE($frame, sub { while (my $cb = shift @cb) { diff --git a/src/GUI/GUI.hpp b/src/GUI/GUI.hpp index 219970806..82c4b2082 100644 --- a/src/GUI/GUI.hpp +++ b/src/GUI/GUI.hpp @@ -36,6 +36,8 @@ private: void load_presets(); + wxString datadir {""}; + const std::string LogChannel {"GUI"}; //< Which log these messages should go to. }; }} // namespace Slic3r::GUI From c0d8e68606b9fbda4c576fd4e3dbb0e4c900d12d Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 28 Apr 2018 18:18:10 -0500 Subject: [PATCH 043/112] working on higher-level cpp Slic3r::Config that has a similar interface to the old Perl one. --- src/GUI/Settings.hpp | 7 ++++++- xs/src/libslic3r/Config.hpp | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 xs/src/libslic3r/Config.hpp diff --git a/src/GUI/Settings.hpp b/src/GUI/Settings.hpp index 9c135cec3..bc391ae87 100644 --- a/src/GUI/Settings.hpp +++ b/src/GUI/Settings.hpp @@ -25,7 +25,7 @@ enum class ReloadBehavior { }; /// Stub class to hold onto GUI-specific settings options. -/// TODO: Incorporate a copy of Slic3r::Config +/// TODO: Incorporate the system from libslic3r class Settings { public: bool show_host {false}; @@ -50,9 +50,14 @@ class Settings { const wxString version { wxString(SLIC3R_VERSION) }; void save_settings(); + void load_settings(); /// Storage for window positions std::map > window_pos { std::map >() }; + + private: + const std::string LogChannel {"GUI_Settings"}; //< Which log these messages should go to. + }; }} //namespace Slic3r::GUI diff --git a/xs/src/libslic3r/Config.hpp b/xs/src/libslic3r/Config.hpp new file mode 100644 index 000000000..265cc2201 --- /dev/null +++ b/xs/src/libslic3r/Config.hpp @@ -0,0 +1,21 @@ +#ifndef CONFIG_HPP +#define CONFIG_HPP + +#include "PrintConfig.hpp" + +namespace Slic3r { + +class Config : DynamicPrintConfig { +public: + static Config *new_from_defaults(); + static Config *new_from_cli(const &argc, const char* argv[]); + + void write_ini(const std::string& file) { save(file); } + void read_ini(const std::string& file) { load(file); } + + +}; + +} // namespace Slic3r + +#endif // CONFIG_HPP From 47354beacc7e6b8bab07a3564ece53f800e939c3 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 28 Apr 2018 18:53:14 -0500 Subject: [PATCH 044/112] Added stdexcept include, convert VAR_ABS_PATH and VAR_REL to wxStrings. --- src/GUI/misc_ui.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GUI/misc_ui.cpp b/src/GUI/misc_ui.cpp index 8183ec020..c585117b9 100644 --- a/src/GUI/misc_ui.cpp +++ b/src/GUI/misc_ui.cpp @@ -3,6 +3,7 @@ #include #include +#include namespace Slic3r { namespace GUI { @@ -19,9 +20,9 @@ void check_version(bool manual) { const wxString var(const wxString& in) { // TODO replace center string with path to VAR in actual distribution later if (VAR_ABS) { - return VAR_ABS_PATH + "/" + in; + return wxString(VAR_ABS_PATH) + "/" + in; } else { - return bin() + VAR_REL + "/" + in; + return bin() + wxString(VAR_REL) + "/" + in; } } From ac24ab827e9d7b3bbffcd9a578872af3a6d64309 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 28 Apr 2018 20:53:49 -0500 Subject: [PATCH 045/112] Add AboutDialog to GUI and menu. --- src/CMakeLists.txt | 3 +- src/GUI/AboutDialog.cpp | 98 +++++++++++++++++++++++++++++++++++++++++ src/GUI/AboutDialog.hpp | 41 +++++++++++++++++ src/GUI/MainFrame.cpp | 5 +++ 4 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 src/GUI/AboutDialog.cpp create mode 100644 src/GUI/AboutDialog.hpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9f1e0072f..187811c48 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -147,7 +147,7 @@ include_directories(${Boost_INCLUDE_DIRS}) set(wxWidgets_USE_STATIC OFF) set(wxWidgets_USE_UNICODE ON) -find_package(wxWidgets COMPONENTS base aui core) +find_package(wxWidgets COMPONENTS base aui core html) IF(CMAKE_HOST_UNIX) #set(Boost_LIBRARIES bsystem bthread bfilesystem) @@ -165,6 +165,7 @@ IF(wxWidgets_FOUND) ${GUI_LIBDIR}/MainFrame.cpp ${GUI_LIBDIR}/GUI.cpp ${GUI_LIBDIR}/Settings.cpp + ${GUI_LIBDIR}/AboutDialog.cpp ${GUI_LIBDIR}/misc_ui.cpp ) #only build GUI lib if building with wx diff --git a/src/GUI/AboutDialog.cpp b/src/GUI/AboutDialog.cpp new file mode 100644 index 000000000..91a7b224a --- /dev/null +++ b/src/GUI/AboutDialog.cpp @@ -0,0 +1,98 @@ +#include "AboutDialog.hpp" + +namespace Slic3r { namespace GUI { + +static void link_clicked(wxHtmlLinkEvent& e) +{ + wxLaunchDefaultBrowser(e.GetLinkInfo().GetHref()); + e.Skip(0); +} + +AboutDialog::AboutDialog(wxWindow* parent) : wxDialog(parent, -1, _("About Slic3r"), wxDefaultPosition, wxSize(600, 460), wxCAPTION) +{ + auto hsizer { new wxBoxSizer(wxHORIZONTAL) } ; + + auto vsizer { new wxBoxSizer(wxVERTICAL) } ; + + // logo + auto logo { new AboutDialogLogo(this) }; + hsizer->Add(logo, 0, wxEXPAND | wxLEFT | wxRIGHT, 30); + + // title + auto title { new wxStaticText(this, -1, "Slic3r", wxDefaultPosition, wxDefaultSize) }; + auto title_font { wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) }; + + title_font.SetWeight(wxFONTWEIGHT_BOLD); + title_font.SetFamily(wxFONTFAMILY_ROMAN); + title_font.SetPointSize(24); + title->SetFont(title_font); + + vsizer->Add(title, 0, wxALIGN_LEFT | wxTOP, 30); + + // version + + auto version {new wxStaticText(this, -1, wxString("Version ") + wxString(SLIC3R_VERSION), wxDefaultPosition, wxDefaultSize) }; + auto version_font { wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) }; + version_font.SetPointSize((the_os == OS::Windows ? 9 : 11)); + version->SetFont(version_font); + vsizer->Add(version, 0, wxALIGN_LEFT | wxBOTTOM, 10); + + // text + + wxString text {""}; + text << "" + << "" + << "Copyright © 2011-2017 Alessandro Ranellucci.
" + << "Slic3r is licensed under the " + << "GNU Affero General Public License, version 3." + << "


" + << "Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark Hindess, " + << "Petr Ledvina, Joseph Lenox, Y. Sapir, Mike Sheldrake, Kliment Yanev and numerous others. " + << "Manual by Gary Hodgson. Inspired by the RepRap community.
" + << "Slic3r logo designed by Corey Daniels, Silk Icon Set designed by Mark James. " + << "

" + << "Built on " << build_date << " at git version " << git_version << "." + << "" + << ""; + auto html {new wxHtmlWindow(this, -1, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_NEVER)}; + html->SetBorders(2); + html->SetPage(text); + + html->Bind(wxEVT_HTML_LINK_CLICKED, [=](wxHtmlLinkEvent& e){ link_clicked(e); }); + + vsizer->Add(html, 1, wxEXPAND | wxALIGN_LEFT | wxRIGHT | wxBOTTOM, 20); + // buttons + auto buttons = this->CreateStdDialogButtonSizer(wxOK); + this->SetEscapeId(wxID_CLOSE); + + vsizer->Add(buttons, 0, wxEXPAND | wxRIGHT | wxBOTTOM, 3); + + hsizer->Add(vsizer, 1, wxEXPAND, 0); + this->SetSizer(hsizer); + + }; + +AboutDialogLogo::AboutDialogLogo(wxWindow* parent) : + wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize) +{ + this->logo = wxBitmap(var("Slic3r_192px.png"), wxBITMAP_TYPE_PNG); + this->SetMinSize(wxSize(this->logo.GetWidth(), this->logo.GetHeight())); + + this->Bind(wxEVT_PAINT, [=](wxPaintEvent& e) { this->repaint(e);}); +} + +void AboutDialogLogo::repaint(wxPaintEvent& event) +{ + auto dc { new wxPaintDC(this) }; + + dc->SetBackgroundMode(wxPENSTYLE_TRANSPARENT); + + const auto size {this->GetSize()}; + const auto logo_w {this->logo.GetWidth()}; + const auto logo_h {this->logo.GetHeight()}; + + dc->DrawBitmap(this->logo, (size.GetWidth() - logo_w) / 2, (size.GetHeight() - logo_h) / 2, 1); + event.Skip(); +} + +}} // namespace Slic3r::GUI diff --git a/src/GUI/AboutDialog.hpp b/src/GUI/AboutDialog.hpp new file mode 100644 index 000000000..40637a091 --- /dev/null +++ b/src/GUI/AboutDialog.hpp @@ -0,0 +1,41 @@ +#ifndef ABOUTDIALOG_HPP +#define ABOUTDIALOG_HPP +#include +#include +#include +#include +#include +#include +#include + +#include "libslic3r.h" +#include "misc_ui.hpp" + +#ifndef SLIC3R_BUILD_COMMIT +#define SLIC3R_BUILD_COMMIT "(Unknown revision)" +#endif + +namespace Slic3r { namespace GUI { + +const wxString build_date {__DATE__}; +const wxString git_version {SLIC3R_BUILD_COMMIT}; + +class AboutDialogLogo : public wxPanel { +private: + wxBitmap logo; +public: + AboutDialogLogo(wxWindow* parent); + void repaint(wxPaintEvent& event); +}; + +class AboutDialog : public wxDialog { +public: + /// Build and show the About popup. + AboutDialog(wxWindow* parent); +}; + + + +}} // namespace Slic3r::GUI + +#endif // ABOUTDIALOG_HPP diff --git a/src/GUI/MainFrame.cpp b/src/GUI/MainFrame.cpp index f006423b1..6c0221687 100644 --- a/src/GUI/MainFrame.cpp +++ b/src/GUI/MainFrame.cpp @@ -3,6 +3,8 @@ #include #include +#include "AboutDialog.hpp" + namespace Slic3r { namespace GUI { wxBEGIN_EVENT_TABLE(MainFrame, wxFrame) @@ -151,6 +153,9 @@ void MainFrame::init_menubar() }); append_menu_item(menuHelp, _("&About Slic3r"), _("Show about dialog"), [=](wxCommandEvent& e) { + auto about = new AboutDialog(nullptr); + about->ShowModal(); + about->Destroy(); }, wxID_ABOUT); } From 8fb78ca5d7c229e2f210ee75d62dd5b08eaa0182 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 28 Apr 2018 21:40:37 -0500 Subject: [PATCH 046/112] Spit out the result of git rev-parse --short HEAD in AboutDialog. --- src/CMakeLists.txt | 15 +++++++++++++++ src/GUI/AboutDialog.hpp | 7 ++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 187811c48..db8ccfb80 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,8 +1,12 @@ cmake_minimum_required (VERSION 3.9) project (slic3r) + # only on newer GCCs: -ftemplate-backtrace-limit=0 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -DM_PI=3.14159265358979323846 -D_GLIBCXX_USE_C99 -DHAS_BOOL -DNOGDI -DBOOST_ASIO_DISABLE_KQUEUE") + +execute_process(COMMAND git rev-parse --short HEAD OUTPUT_VARIABLE GIT_VERSION) + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -DSLIC3R_DEBUG") if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.7.0) @@ -158,6 +162,17 @@ target_link_libraries (slic3r libslic3r admesh BSpline clipper expat polypartiti IF(wxWidgets_FOUND) MESSAGE("wx found!") INCLUDE("${wxWidgets_USE_FILE}") + + if (NOT GIT_VERSION STREQUAL "") + if (MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DSLIC3R_BUILD_COMMIT=${GIT_VERSION} ") + else(MSVC) + execute_process(COMMAND git rev-parse --short HEAD OUTPUT_VARIABLE GIT_VERSION) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSLIC3R_BUILD_COMMIT=${GIT_VERSION}") + string(REGEX REPLACE "\n$" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + endif(MSVC) + endif(NOT GIT_VERSION STREQUAL "") + include_directories(${GUI_LIBDIR}) include_directories(${wxWidgets_INCLUDE}) diff --git a/src/GUI/AboutDialog.hpp b/src/GUI/AboutDialog.hpp index 40637a091..fea496b4a 100644 --- a/src/GUI/AboutDialog.hpp +++ b/src/GUI/AboutDialog.hpp @@ -11,14 +11,19 @@ #include "libslic3r.h" #include "misc_ui.hpp" + #ifndef SLIC3R_BUILD_COMMIT #define SLIC3R_BUILD_COMMIT "(Unknown revision)" #endif +#define VER1_(x) #x +#define VER_(x) VER1_(x) +#define BUILD_COMMIT VER_(SLIC3R_BUILD_COMMIT) + namespace Slic3r { namespace GUI { const wxString build_date {__DATE__}; -const wxString git_version {SLIC3R_BUILD_COMMIT}; +const wxString git_version {BUILD_COMMIT}; class AboutDialogLogo : public wxPanel { private: From 87b3f9582e38ab0de2d5bb1bbc210e98edb66f5e Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 28 Apr 2018 23:13:12 -0500 Subject: [PATCH 047/112] Ensure unknown revision still works. --- src/CMakeLists.txt | 2 +- src/GUI/AboutDialog.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index db8ccfb80..50e6870dc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,7 +5,7 @@ project (slic3r) # only on newer GCCs: -ftemplate-backtrace-limit=0 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -DM_PI=3.14159265358979323846 -D_GLIBCXX_USE_C99 -DHAS_BOOL -DNOGDI -DBOOST_ASIO_DISABLE_KQUEUE") -execute_process(COMMAND git rev-parse --short HEAD OUTPUT_VARIABLE GIT_VERSION) +execute_process(COMMAND git rev-parse --short HEAD OUTPUT_VARIABLE GIT_VERSION ERROR_QUIET) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -DSLIC3R_DEBUG") diff --git a/src/GUI/AboutDialog.hpp b/src/GUI/AboutDialog.hpp index fea496b4a..f506cdfdd 100644 --- a/src/GUI/AboutDialog.hpp +++ b/src/GUI/AboutDialog.hpp @@ -13,7 +13,7 @@ #ifndef SLIC3R_BUILD_COMMIT -#define SLIC3R_BUILD_COMMIT "(Unknown revision)" +#define SLIC3R_BUILD_COMMIT (Unknown revision) #endif #define VER1_(x) #x From c2d10aeeedde22cb14d9e83360188ef74775ad41 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 28 Apr 2018 23:37:27 -0500 Subject: [PATCH 048/112] Moved plater stubs to its own cpp --- src/CMakeLists.txt | 7 ++++--- src/GUI/Plater.cpp | 13 +++++++++++++ src/GUI/Plater.hpp | 9 ++++++--- 3 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 src/GUI/Plater.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 50e6870dc..1c4759fa1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -177,10 +177,11 @@ IF(wxWidgets_FOUND) include_directories(${wxWidgets_INCLUDE}) add_library(slic3r_gui STATIC - ${GUI_LIBDIR}/MainFrame.cpp - ${GUI_LIBDIR}/GUI.cpp - ${GUI_LIBDIR}/Settings.cpp ${GUI_LIBDIR}/AboutDialog.cpp + ${GUI_LIBDIR}/GUI.cpp + ${GUI_LIBDIR}/MainFrame.cpp + ${GUI_LIBDIR}/Plater.cpp + ${GUI_LIBDIR}/Settings.cpp ${GUI_LIBDIR}/misc_ui.cpp ) #only build GUI lib if building with wx diff --git a/src/GUI/Plater.cpp b/src/GUI/Plater.cpp new file mode 100644 index 000000000..57b4d1120 --- /dev/null +++ b/src/GUI/Plater.cpp @@ -0,0 +1,13 @@ +#include "Plater.hpp" + +namespace Slic3r { namespace GUI { + +Plater::Plater(wxWindow* parent, const wxString& title) : + wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, title) { } +void Plater::add() { + +} + + +}} // Namespace Slic3r::GUI + diff --git a/src/GUI/Plater.hpp b/src/GUI/Plater.hpp index bf7aa917a..7b0031519 100644 --- a/src/GUI/Plater.hpp +++ b/src/GUI/Plater.hpp @@ -1,14 +1,17 @@ #ifndef PLATER_HPP #define PLATER_HPP +#include +#ifndef WX_PRECOMP + #include +#endif namespace Slic3r { namespace GUI { class Plater : public wxPanel { public: - Plater(wxWindow* parent, const wxString& title) : - wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, title) - { } + Plater(wxWindow* parent, const wxString& title); + void add(); }; From ce77ade904f1e87a3fbe0dfe3fbee6f377ddf5d7 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 28 Apr 2018 23:38:27 -0500 Subject: [PATCH 049/112] Added handling to deal with if the lambda function passed in is a nullptr type. --- src/GUI/misc_ui.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/GUI/misc_ui.hpp b/src/GUI/misc_ui.hpp index d8586fec7..d40ab729c 100644 --- a/src/GUI/misc_ui.hpp +++ b/src/GUI/misc_ui.hpp @@ -9,6 +9,8 @@ #include #include +#include "Log.hpp" + /// Common static (that is, free-standing) functions, not part of an object hierarchy. namespace Slic3r { namespace GUI { @@ -82,7 +84,8 @@ void append_menu_item(wxMenu* menu, const wxString& name,const wxString& help, T if (!icon.IsEmpty()) tmp->SetBitmap(wxBitmap(var(icon))); - menu->Bind(wxEVT_MENU, lambda, tmp->GetId(), tmp->GetId()); + if (typeid(lambda) != typeid(nullptr)) + menu->Bind(wxEVT_MENU, lambda, tmp->GetId(), tmp->GetId()); } /* From 72703ca0e83c583b97bd6a40ffeedfee26f371b3 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 28 Apr 2018 23:39:00 -0500 Subject: [PATCH 050/112] Added menu mechanism to load 3d models. --- src/GUI/MainFrame.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GUI/MainFrame.cpp b/src/GUI/MainFrame.cpp index 6c0221687..83eb2a65a 100644 --- a/src/GUI/MainFrame.cpp +++ b/src/GUI/MainFrame.cpp @@ -118,6 +118,7 @@ void MainFrame::init_menubar() wxMenu* menuFile = new wxMenu(); { + append_menu_item(menuFile, _(L"Open STL/OBJ/AMF/3MF…"), _("Open a model"), [=](wxCommandEvent& e) { if (this->plater != nullptr) this->plater->add();}, wxID_ANY, "brick_add.png", "Ctrl+O"); } wxMenu* menuPlater = new wxMenu(); From 44944a9b7db7aadb5a7e9fed0428835eb1f257f5 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 29 Apr 2018 10:07:41 -0500 Subject: [PATCH 051/112] Move ZipArchive to its own library. --- src/CMakeLists.txt | 6 +++++- xs/src/{libslic3r => }/Zip/ZipArchive.cpp | 0 xs/src/{libslic3r => }/Zip/ZipArchive.hpp | 0 3 files changed, 5 insertions(+), 1 deletion(-) rename xs/src/{libslic3r => }/Zip/ZipArchive.cpp (100%) rename xs/src/{libslic3r => }/Zip/ZipArchive.hpp (100%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1c4759fa1..c5bea65c1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -44,6 +44,11 @@ include_directories(${LIBDIR}/poly2tri/) include_directories(${LIBDIR}/poly2tri/sweep) include_directories(${LIBDIR}/poly2tri/common) +add_library(ZipArchive STATIC + ${LIBDIR}/Zip/ZipArchive.cpp +) + + add_library(libslic3r STATIC ${LIBDIR}/libslic3r/BoundingBox.cpp ${LIBDIR}/libslic3r/BridgeDetector.cpp @@ -97,7 +102,6 @@ add_library(libslic3r STATIC ${LIBDIR}/libslic3r/SurfaceCollection.cpp ${LIBDIR}/libslic3r/SVG.cpp ${LIBDIR}/libslic3r/TriangleMesh.cpp - ${LIBDIR}/libslic3r/Zip/ZipArchive.cpp ) add_library(BSpline STATIC diff --git a/xs/src/libslic3r/Zip/ZipArchive.cpp b/xs/src/Zip/ZipArchive.cpp similarity index 100% rename from xs/src/libslic3r/Zip/ZipArchive.cpp rename to xs/src/Zip/ZipArchive.cpp diff --git a/xs/src/libslic3r/Zip/ZipArchive.hpp b/xs/src/Zip/ZipArchive.hpp similarity index 100% rename from xs/src/libslic3r/Zip/ZipArchive.hpp rename to xs/src/Zip/ZipArchive.hpp From bd6fe7114a1c71a5bea09807cecae10669b236c0 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 29 Apr 2018 10:08:10 -0500 Subject: [PATCH 052/112] Be more selective in what is compiled with C++11. --- src/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c5bea65c1..a28bb833f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,7 +3,7 @@ project (slic3r) # only on newer GCCs: -ftemplate-backtrace-limit=0 -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -DM_PI=3.14159265358979323846 -D_GLIBCXX_USE_C99 -DHAS_BOOL -DNOGDI -DBOOST_ASIO_DISABLE_KQUEUE") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -DM_PI=3.14159265358979323846 -D_GLIBCXX_USE_C99 -DHAS_BOOL -DNOGDI -DBOOST_ASIO_DISABLE_KQUEUE") execute_process(COMMAND git rev-parse --short HEAD OUTPUT_VARIABLE GIT_VERSION ERROR_QUIET) @@ -103,6 +103,7 @@ add_library(libslic3r STATIC ${LIBDIR}/libslic3r/SVG.cpp ${LIBDIR}/libslic3r/TriangleMesh.cpp ) +target_compile_features(libslic3r PUBLIC cxx_std_11) add_library(BSpline STATIC ${LIBDIR}/BSpline/BSpline.cpp @@ -188,6 +189,7 @@ IF(wxWidgets_FOUND) ${GUI_LIBDIR}/Settings.cpp ${GUI_LIBDIR}/misc_ui.cpp ) + target_compile_features(slic3r_gui PUBLIC cxx_std_11) #only build GUI lib if building with wx target_link_libraries (slic3r slic3r_gui ${wxWidgets_LIBRARIES}) ELSE(wxWidgets_FOUND) From 3fda71e5ddc114f94fa0d7cc63fea723f6bd071d Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 29 Apr 2018 10:08:38 -0500 Subject: [PATCH 053/112] Move slic3r_gui link higher in the chain (as it relies on libslic3r). --- src/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a28bb833f..e1190ee54 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -162,7 +162,6 @@ IF(CMAKE_HOST_UNIX) #set(Boost_LIBRARIES bsystem bthread bfilesystem) ENDIF(CMAKE_HOST_UNIX) -target_link_libraries (slic3r libslic3r admesh BSpline clipper expat polypartition poly2tri ${Boost_LIBRARIES}) IF(wxWidgets_FOUND) MESSAGE("wx found!") @@ -198,6 +197,8 @@ ELSE(wxWidgets_FOUND) #skip gui when no wx included ENDIF(wxWidgets_FOUND) +target_link_libraries (slic3r libslic3r admesh BSpline clipper expat polypartition poly2tri ZipArchive ${Boost_LIBRARIES}) + # Windows needs a compiled component for Boost.nowide IF (WIN32) add_library(boost-nowide STATIC From 31ed51de00505dddec98a2c3762f341cfd135818 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 29 Apr 2018 10:13:00 -0500 Subject: [PATCH 054/112] added descriptive comment to GUI --- src/GUI/GUI.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GUI/GUI.cpp b/src/GUI/GUI.cpp index 690f07284..9370e4afe 100644 --- a/src/GUI/GUI.cpp +++ b/src/GUI/GUI.cpp @@ -48,6 +48,7 @@ bool App::OnInit() // TODO: Call a logging function with channel GUI, severity info for datadir path Slic3r::Log::info(LogChannel, (_("Data dir: ") + datadir).ToStdWstring()); + // Load gui settings from slic3r.ini if (wxFileExists(slic3r_ini)) { /* my $ini = eval { Slic3r::Config->read_ini("$datadir/slic3r.ini") }; From 48b13aa1c78928d775c8773753fa46a6fbcbaf3b Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 29 Apr 2018 10:13:39 -0500 Subject: [PATCH 055/112] Stubbed Plater constructor. --- src/GUI/Plater.cpp | 91 +++++++++++++++++++++++++++++++++++++++++++++- src/GUI/Plater.hpp | 34 +++++++++++++++++ 2 files changed, 124 insertions(+), 1 deletion(-) diff --git a/src/GUI/Plater.cpp b/src/GUI/Plater.cpp index 57b4d1120..ad887cf41 100644 --- a/src/GUI/Plater.cpp +++ b/src/GUI/Plater.cpp @@ -3,7 +3,96 @@ namespace Slic3r { namespace GUI { Plater::Plater(wxWindow* parent, const wxString& title) : - wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, title) { } + wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, title), + print(Slic3r::Print()) +{ + + auto on_select_object { [=](uint32_t& obj_idx) { + // this->select_object(obj_idx); + } }; + /* + # Initialize handlers for canvases + my $on_select_object = sub { + my ($obj_idx) = @_; + $self->select_object($obj_idx); + }; + my $on_double_click = sub { + $self->object_settings_dialog if $self->selected_object; + }; + my $on_right_click = sub { + my ($canvas, $click_pos) = @_; + + my ($obj_idx, $object) = $self->selected_object; + return if !defined $obj_idx; + + my $menu = $self->object_menu; + $canvas->PopupMenu($menu, $click_pos); + $menu->Destroy; + }; + my $on_instances_moved = sub { + $self->on_model_change; + }; + # Initialize 3D plater + if ($Slic3r::GUI::have_OpenGL) { + $self->{canvas3D} = Slic3r::GUI::Plater::3D->new($self->{preview_notebook}, $self->{objects}, $self->{model}, $self->{config}); + $self->{preview_notebook}->AddPage($self->{canvas3D}, '3D'); + $self->{canvas3D}->set_on_select_object($on_select_object); + $self->{canvas3D}->set_on_double_click($on_double_click); + $self->{canvas3D}->set_on_right_click(sub { $on_right_click->($self->{canvas3D}, @_); }); + $self->{canvas3D}->set_on_instances_moved($on_instances_moved); + $self->{canvas3D}->on_viewport_changed(sub { + $self->{preview3D}->canvas->set_viewport_from_scene($self->{canvas3D}); + }); + } + # Initialize 2D preview canvas + $self->{canvas} = Slic3r::GUI::Plater::2D->new($self->{preview_notebook}, wxDefaultSize, $self->{objects}, $self->{model}, $self->{config}); + $self->{preview_notebook}->AddPage($self->{canvas}, '2D'); + $self->{canvas}->on_select_object($on_select_object); + $self->{canvas}->on_double_click($on_double_click); + $self->{canvas}->on_right_click(sub { $on_right_click->($self->{canvas}, @_); }); + $self->{canvas}->on_instances_moved($on_instances_moved); + + # Initialize 3D toolpaths preview + $self->{preview3D_page_idx} = -1; + if ($Slic3r::GUI::have_OpenGL) { + $self->{preview3D} = Slic3r::GUI::Plater::3DPreview->new($self->{preview_notebook}, $self->{print}); + $self->{preview3D}->canvas->on_viewport_changed(sub { + $self->{canvas3D}->set_viewport_from_scene($self->{preview3D}->canvas); + }); + $self->{preview_notebook}->AddPage($self->{preview3D}, 'Preview'); + $self->{preview3D_page_idx} = $self->{preview_notebook}->GetPageCount-1; + } + + # Initialize toolpaths preview + $self->{toolpaths2D_page_idx} = -1; + if ($Slic3r::GUI::have_OpenGL) { + $self->{toolpaths2D} = Slic3r::GUI::Plater::2DToolpaths->new($self->{preview_notebook}, $self->{print}); + $self->{preview_notebook}->AddPage($self->{toolpaths2D}, 'Layers'); + $self->{toolpaths2D_page_idx} = $self->{preview_notebook}->GetPageCount-1; + } + + EVT_NOTEBOOK_PAGE_CHANGED($self, $self->{preview_notebook}, sub { + wxTheApp->CallAfter(sub { + my $sel = $self->{preview_notebook}->GetSelection; + if ($sel == $self->{preview3D_page_idx} || $sel == $self->{toolpaths2D_page_idx}) { + if (!$Slic3r::GUI::Settings->{_}{background_processing} && !$self->{processed}) { + $self->statusbar->SetCancelCallback(sub { + $self->stop_background_process; + $self->statusbar->SetStatusText("Slicing cancelled"); + $self->{preview_notebook}->SetSelection(0); + + }); + $self->start_background_process; + } else { + $self->{preview3D}->load_print + if $sel == $self->{preview3D_page_idx}; + } + } + }); + }); + */ + +} void Plater::add() { } diff --git a/src/GUI/Plater.hpp b/src/GUI/Plater.hpp index 7b0031519..a22d7acf6 100644 --- a/src/GUI/Plater.hpp +++ b/src/GUI/Plater.hpp @@ -5,14 +5,48 @@ #include #endif +#include + +#include + +#include "libslic3r.h" +#include "Model.hpp" +#include "Print.hpp" + namespace Slic3r { namespace GUI { +using UndoOperation = int; + +class Plater2DObject; + class Plater : public wxPanel { public: Plater(wxWindow* parent, const wxString& title); void add(); +private: + Print print; + Model model; + + bool processed {false}; + + std::vector objects; + + std::stack undo {}; + std::stack redo {}; + + wxNotebook* preview_notebook {new wxNotebook(this, -1, wxDefaultPosition, wxSize(335,335), wxNB_BOTTOM)}; + +}; + + +// 2D Preview of an object +class Plater2DObject { +public: + std::string name {""}; + std::string identifier {""}; + bool selected {false}; }; } } // Namespace Slic3r::GUI From d02516d8fed66b357e57d5f10120ed2669cfc771 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 29 Apr 2018 12:14:03 -0500 Subject: [PATCH 056/112] Added factory function for new_from_defaults. Stubbed out new_from_cli. --- src/CMakeLists.txt | 1 + xs/src/libslic3r/Config.cpp | 31 +++++++++++++++++++++++++++++++ xs/src/libslic3r/Config.hpp | 10 ++++++---- 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 xs/src/libslic3r/Config.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e1190ee54..12ac4a3b3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -54,6 +54,7 @@ add_library(libslic3r STATIC ${LIBDIR}/libslic3r/BridgeDetector.cpp ${LIBDIR}/libslic3r/ClipperUtils.cpp ${LIBDIR}/libslic3r/ConfigBase.cpp + ${LIBDIR}/libslic3r/Config.cpp ${LIBDIR}/libslic3r/ExPolygon.cpp ${LIBDIR}/libslic3r/ExPolygonCollection.cpp ${LIBDIR}/libslic3r/Extruder.cpp diff --git a/xs/src/libslic3r/Config.cpp b/xs/src/libslic3r/Config.cpp new file mode 100644 index 000000000..d9f99cbbc --- /dev/null +++ b/xs/src/libslic3r/Config.cpp @@ -0,0 +1,31 @@ +#include "Config.hpp" +#include "Log.hpp" + +namespace Slic3r { + +std::shared_ptr +Config::new_from_defaults() +{ + return std::make_shared(); +} +std::shared_ptr +Config::new_from_defaults(std::initializer_list init) +{ + auto my_config(std::make_shared()); + for (auto& opt_key : init) { + if (print_config_def.has(opt_key)) { + const std::string value { print_config_def.get(opt_key)->default_value->serialize() }; + my_config->set_deserialize(opt_key, value); + } + } + + return my_config; +} + +std::shared_ptr +new_from_cli(const int& argc, const char* argv[]) +{ + return std::make_shared(); +} + +} // namespace Slic3r diff --git a/xs/src/libslic3r/Config.hpp b/xs/src/libslic3r/Config.hpp index 265cc2201..118309033 100644 --- a/xs/src/libslic3r/Config.hpp +++ b/xs/src/libslic3r/Config.hpp @@ -1,19 +1,21 @@ #ifndef CONFIG_HPP #define CONFIG_HPP +#include +#include + #include "PrintConfig.hpp" namespace Slic3r { class Config : DynamicPrintConfig { public: - static Config *new_from_defaults(); - static Config *new_from_cli(const &argc, const char* argv[]); + static std::shared_ptr new_from_defaults(); + static std::shared_ptr new_from_defaults(std::initializer_list init); + static std::shared_ptr new_from_cli(const int& argc, const char* argv[]); void write_ini(const std::string& file) { save(file); } void read_ini(const std::string& file) { load(file); } - - }; } // namespace Slic3r From d07aaa87fdd9579c49292081f7175733c566371b Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 29 Apr 2018 12:16:31 -0500 Subject: [PATCH 057/112] Further implementation of Plater and Plater2D. --- src/CMakeLists.txt | 1 + src/GUI/Plater.cpp | 19 +++++++++++++++---- src/GUI/Plater.hpp | 24 ++++++++++++++---------- src/GUI/Plater/Plate2D.cpp | 0 src/GUI/Plater/Plate2D.hpp | 25 +++++++++++++++++++++++++ src/GUI/Plater/Plater2DObject.hpp | 13 +++++++++++++ 6 files changed, 68 insertions(+), 14 deletions(-) create mode 100644 src/GUI/Plater/Plate2D.cpp create mode 100644 src/GUI/Plater/Plate2D.hpp create mode 100644 src/GUI/Plater/Plater2DObject.hpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 12ac4a3b3..361074ea3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -186,6 +186,7 @@ IF(wxWidgets_FOUND) ${GUI_LIBDIR}/GUI.cpp ${GUI_LIBDIR}/MainFrame.cpp ${GUI_LIBDIR}/Plater.cpp + ${GUI_LIBDIR}/Plater/Plate2D.cpp ${GUI_LIBDIR}/Settings.cpp ${GUI_LIBDIR}/misc_ui.cpp ) diff --git a/src/GUI/Plater.cpp b/src/GUI/Plater.cpp index ad887cf41..75d6fee1d 100644 --- a/src/GUI/Plater.cpp +++ b/src/GUI/Plater.cpp @@ -1,12 +1,20 @@ #include "Plater.hpp" +#include "Log.hpp" namespace Slic3r { namespace GUI { +const auto PROGRESS_BAR_EVENT = wxNewEventType(); + Plater::Plater(wxWindow* parent, const wxString& title) : - wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, title), - print(Slic3r::Print()) + wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, title) { + // Set callback for status event for worker threads + /* + this->print->set_status_cb([=](std::string percent percent, std::wstring message) { + wxPostEvent(this, new wxPlThreadEvent(-1, PROGRESS_BAR_EVENT, + }); + */ auto on_select_object { [=](uint32_t& obj_idx) { // this->select_object(obj_idx); } }; @@ -44,6 +52,10 @@ Plater::Plater(wxWindow* parent, const wxString& title) : $self->{preview3D}->canvas->set_viewport_from_scene($self->{canvas3D}); }); } + */ + canvas2D = new Plate2D(preview_notebook, wxDefaultSize, objects, model, config); + + /* # Initialize 2D preview canvas $self->{canvas} = Slic3r::GUI::Plater::2D->new($self->{preview_notebook}, wxDefaultSize, $self->{objects}, $self->{model}, $self->{config}); $self->{preview_notebook}->AddPage($self->{canvas}, '2D'); @@ -51,7 +63,6 @@ Plater::Plater(wxWindow* parent, const wxString& title) : $self->{canvas}->on_double_click($on_double_click); $self->{canvas}->on_right_click(sub { $on_right_click->($self->{canvas}, @_); }); $self->{canvas}->on_instances_moved($on_instances_moved); - # Initialize 3D toolpaths preview $self->{preview3D_page_idx} = -1; if ($Slic3r::GUI::have_OpenGL) { @@ -94,7 +105,7 @@ Plater::Plater(wxWindow* parent, const wxString& title) : } void Plater::add() { - + Log::info("GUI", L"Called Add function"); } diff --git a/src/GUI/Plater.hpp b/src/GUI/Plater.hpp index a22d7acf6..f0c4569f3 100644 --- a/src/GUI/Plater.hpp +++ b/src/GUI/Plater.hpp @@ -12,6 +12,10 @@ #include "libslic3r.h" #include "Model.hpp" #include "Print.hpp" +#include "Config.hpp" + +#include "Plater/Plater2DObject.hpp" +#include "Plater/Plate2D.hpp" namespace Slic3r { namespace GUI { @@ -26,28 +30,28 @@ public: void add(); private: - Print print; - Model model; + std::shared_ptr print {std::make_shared(Slic3r::Print())}; + std::shared_ptr model {std::make_shared(Slic3r::Model())}; + + std::shared_ptr config { Slic3r::Config::new_from_defaults( + {"bed_shape", "complete_objects", "extruder_clearance_radius", "skirts", "skirt_distance", + "brim_width", "serial_port", "serial_speed", "host_type", "print_host", "octoprint_apikey", + "shortcuts", "filament_colour"})}; bool processed {false}; - std::vector objects; + std::vector objects {}; std::stack undo {}; std::stack redo {}; wxNotebook* preview_notebook {new wxNotebook(this, -1, wxDefaultPosition, wxSize(335,335), wxNB_BOTTOM)}; + Plate2D* canvas2D {}; + }; -// 2D Preview of an object -class Plater2DObject { -public: - std::string name {""}; - std::string identifier {""}; - bool selected {false}; -}; } } // Namespace Slic3r::GUI diff --git a/src/GUI/Plater/Plate2D.cpp b/src/GUI/Plater/Plate2D.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/src/GUI/Plater/Plate2D.hpp b/src/GUI/Plater/Plate2D.hpp new file mode 100644 index 000000000..306d5cba1 --- /dev/null +++ b/src/GUI/Plater/Plate2D.hpp @@ -0,0 +1,25 @@ +#ifndef PLATE2D_HPP +#define PLATE2D_HPP +#include +#ifndef WX_PRECOMP + #include +#endif +#include +#include "Plater.hpp" +#include "Plater/Plater2DObject.hpp" + + +namespace Slic3r { namespace GUI { + +class Plate2D : public wxPanel { +public: + Plate2D(wxWindow* parent, const wxSize& size, std::vector& _objects, std::shared_ptr _model, std::shared_ptr _config) : + wxPanel(parent, wxID_ANY, wxDefaultPosition, size, wxTAB_TRAVERSAL), objects(_objects), model(_model), config(_config) { } +private: + std::vector& objects; + std::shared_ptr model; + std::shared_ptr config; +}; + +} } // Namespace Slic3r::GUI +#endif // PLATE2D_HPP diff --git a/src/GUI/Plater/Plater2DObject.hpp b/src/GUI/Plater/Plater2DObject.hpp new file mode 100644 index 000000000..3a1772cfb --- /dev/null +++ b/src/GUI/Plater/Plater2DObject.hpp @@ -0,0 +1,13 @@ +#ifndef PLATER2DOBJECT_HPP +#define PLATER2DOBJECT_HPP + +namespace Slic3r { namespace GUI { +// 2D Preview of an object +class Plater2DObject { +public: + std::string name {""}; + std::string identifier {""}; + bool selected {false}; +}; +} } // Namespace Slic3r::GUI +#endif From 1d1d9ba6a8acdd1b506b5853141ad4dead39c51e Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 29 Apr 2018 12:46:58 -0500 Subject: [PATCH 058/112] Trying to use gcc 7 for slic3r --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 738368ffc..6947794f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,8 +33,8 @@ addons: sources: - ubuntu-toolchain-r-test packages: - - g++-4.9 - - gcc-4.9 + - g++-7.3.0 + - gcc-7.3.0 - libgtk2.0-0 - libgtk2.0-dev - freeglut3 From 1cbc72f1263715cce9994d94fafd564616850eb9 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 29 Apr 2018 12:48:07 -0500 Subject: [PATCH 059/112] Trying to use gcc 7 for slic3r --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6947794f3..6c4649418 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,8 +33,8 @@ addons: sources: - ubuntu-toolchain-r-test packages: - - g++-7.3.0 - - gcc-7.3.0 + - g++-7.3 + - gcc-7.3 - libgtk2.0-0 - libgtk2.0-dev - freeglut3 From d01c5f93e0ae0d3b558e074ba82fdbc0fccb27d6 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 29 Apr 2018 12:49:42 -0500 Subject: [PATCH 060/112] Trying to use gcc 7 for slic3r --- .travis.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6c4649418..8196536c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -language: perl +language: c++ before_install: - sh package/linux/travis-decrypt-key install: @@ -6,14 +6,11 @@ install: - export SLIC3R_STATIC=1 - export CXX=g++-4.9 - export CC=gcc-4.9 -- source $HOME/perl5/perlbrew/etc/bashrc script: - bash package/linux/travis-setup.sh -- perlbrew switch slic3r-perl - cmake -DBOOST_ROOT=$BOOST_DIR src/ - make after_success: -- eval $(perl -Mlocal::lib=$TRAVIS_BUILD_DIR/local-lib) - LD_LIBRARY_PATH=$WXDIR/lib package/linux/make_archive.sh linux-x64 - package/linux/appimage.sh x86_64 - package/deploy/sftp.sh linux ~/slic3r-upload.rsa *.bz2 Slic3r*.AppImage @@ -33,8 +30,8 @@ addons: sources: - ubuntu-toolchain-r-test packages: - - g++-7.3 - - gcc-7.3 + - g++-6.3 + - gcc-6.3 - libgtk2.0-0 - libgtk2.0-dev - freeglut3 From d33ad951757cf9e485c71a6d2f413ce897063527 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 29 Apr 2018 12:50:44 -0500 Subject: [PATCH 061/112] Trying to use gcc 7 for slic3r --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8196536c3..c861f7e9e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,8 +30,8 @@ addons: sources: - ubuntu-toolchain-r-test packages: - - g++-6.3 - - gcc-6.3 + - g++-7 + - gcc-7 - libgtk2.0-0 - libgtk2.0-dev - freeglut3 From 108fc93fce48f9ae93f4cf4574f94f7e9aed1b33 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 29 Apr 2018 12:56:17 -0500 Subject: [PATCH 062/112] Tweaks; removing perl deps from travis. --- .travis.yml | 4 ++-- package/linux/travis-setup.sh | 12 ------------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index c861f7e9e..34940401f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,8 @@ before_install: install: - export BOOST_DIR=$HOME/boost_1_63_0 - export SLIC3R_STATIC=1 -- export CXX=g++-4.9 -- export CC=gcc-4.9 +- export CXX=g++-7 +- export CC=gcc-7 script: - bash package/linux/travis-setup.sh - cmake -DBOOST_ROOT=$BOOST_DIR src/ diff --git a/package/linux/travis-setup.sh b/package/linux/travis-setup.sh index 3c9f55ecf..3a0493606 100755 --- a/package/linux/travis-setup.sh +++ b/package/linux/travis-setup.sh @@ -4,27 +4,15 @@ WXVERSION=302 CACHE=$HOME/cache mkdir -p $CACHE -if [ ! -e $CACHE/slic3r-perlbrew-5.24.tar.bz2 ]; then - echo "Downloading http://www.siusgs.com/slic3r/buildserver/slic3r-perl.524.travis.tar.bz2 => $CACHE/slic3r-perlbrew-5.24.tar.bz2" - curl -L "http://www.siusgs.com/slic3r/buildserver/slic3r-perl.524.travis.tar.bz2" -o $CACHE/slic3r-perlbrew-5.24.tar.bz2; -fi - if [ ! -e $CACHE/boost-compiled.tar.bz2 ]; then echo "Downloading http://www.siusgs.com/slic3r/buildserver/boost_1_63_0.built.gcc-4.9.4-buildserver.tar.bz2 => $CACHE/boost-compiled.tar.bz2" curl -L "http://www.siusgs.com/slic3r/buildserver/boost_1_63_0.built.gcc-4.9.4-buildserver.tar.bz2" -o $CACHE/boost-compiled.tar.bz2 fi -if [ ! -e $CACHE/local-lib-wx${WXVERSION}.tar.bz2 ]; then - echo "Downloading http://www.siusgs.com/slic3r/buildserver/slic3r-dependencies.travis-wx${WXVERSION}.tar.bz2 => $CACHE/local-lib-wx${WXVERSION}.tar.bz2" - curl -L "http://www.siusgs.com/slic3r/buildserver/slic3r-dependencies.travis-wx${WXVERSION}.tar.bz2" -o $CACHE/local-lib-wx${WXVERSION}.tar.bz2 -fi - if [ ! -e $CACHE/wx${WXVERSION}.tar.bz2 ]; then echo "Downloading http://www.siusgs.com/slic3r/buildserver/wx${WXVERSION}-libs.tar.bz2 => $CACHE/wx${WXVERSION}.tar.bz2" curl -L "http://www.siusgs.com/slic3r/buildserver/wx${WXVERSION}-libs.tar.bz2" -o $CACHE/wx${WXVERSION}.tar.bz2 fi -tar -C$TRAVIS_BUILD_DIR -xjf $CACHE/local-lib-wx${WXVERSION}.tar.bz2 -tar -C$HOME/perl5/perlbrew/perls -xjf $CACHE/slic3r-perlbrew-5.24.tar.bz2 tar -C$HOME -xjf $CACHE/boost-compiled.tar.bz2 tar -C$HOME -xjf $CACHE/wx${WXVERSION}.tar.bz2 From 197b4f265f821c4d045de18a53092576b80d07e1 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 29 Apr 2018 14:38:56 -0500 Subject: [PATCH 063/112] Stubbed out Solarized, added ColorScheme for default (needed for plater) --- src/GUI/ColorScheme.hpp | 11 ++++++ src/GUI/ColorScheme/ColorSchemeBase.hpp | 47 +++++++++++++++++++++++++ src/GUI/ColorScheme/Default.hpp | 47 +++++++++++++++++++++++++ src/GUI/ColorScheme/Solarized.hpp | 44 +++++++++++++++++++++++ src/GUI/Settings.hpp | 7 ++-- 5 files changed, 151 insertions(+), 5 deletions(-) create mode 100644 src/GUI/ColorScheme.hpp create mode 100644 src/GUI/ColorScheme/ColorSchemeBase.hpp create mode 100644 src/GUI/ColorScheme/Default.hpp create mode 100644 src/GUI/ColorScheme/Solarized.hpp diff --git a/src/GUI/ColorScheme.hpp b/src/GUI/ColorScheme.hpp new file mode 100644 index 000000000..b0410a501 --- /dev/null +++ b/src/GUI/ColorScheme.hpp @@ -0,0 +1,11 @@ +#ifndef COLORSCHEME_HPP +#define COLORSCHEME_HPP + +/// Wrapper file to make the color schemes available to using applications +/// without the circular include headaches. + +#include "ColorScheme/ColorSchemeBase.hpp" +#include "ColorScheme/Default.hpp" +#include "ColorScheme/Solarized.hpp" + +#endif diff --git a/src/GUI/ColorScheme/ColorSchemeBase.hpp b/src/GUI/ColorScheme/ColorSchemeBase.hpp new file mode 100644 index 000000000..decac8d5d --- /dev/null +++ b/src/GUI/ColorScheme/ColorSchemeBase.hpp @@ -0,0 +1,47 @@ +#ifndef COLOR_SLIC3R_HPP +#define COLOR_SLIC3R_HPP + +namespace Slic3r { namespace GUI { + +class ColorScheme { +public: + virtual const std::string name() const = 0; + virtual const bool SOLID_BACKGROUNDCOLOR() const = 0; + virtual const wxColour SELECTED_COLOR() const = 0; + virtual const wxColour HOVER_COLOR() const = 0; + virtual const wxColour TOP_COLOR() const = 0; + virtual const wxColour BOTTOM_COLOR() const = 0; + virtual const wxColour BACKGROUND_COLOR() const = 0; + virtual const wxColour GRID_COLOR() const = 0; + virtual const wxColour GROUND_COLOR() const = 0; + virtual const wxColour COLOR_CUTPLANE() const = 0; + virtual const wxColour COLOR_PARTS() const = 0; + virtual const wxColour COLOR_INFILL() const = 0; + virtual const wxColour COLOR_SUPPORT() const = 0; + virtual const wxColour COLOR_UNKNOWN() const = 0; + virtual const wxColour BED_COLOR() const = 0; + virtual const wxColour BED_GRID() const = 0; + virtual const wxColour BED_SELECTED() const = 0; + virtual const wxColour BED_OBJECTS() const = 0; + virtual const wxColour BED_INSTANCE() const = 0; + virtual const wxColour BED_DRAGGED() const = 0; + virtual const wxColour BED_CENTER() const = 0; + virtual const wxColour BED_SKIRT() const = 0; + virtual const wxColour BED_CLEARANCE() const = 0; + virtual const wxColour BACKGROUND255() const = 0; + virtual const wxColour TOOL_DARK() const = 0; + virtual const wxColour TOOL_SUPPORT() const = 0; + virtual const wxColour TOOL_INFILL() const = 0; + virtual const wxColour TOOL_STEPPERIM() const = 0; + virtual const wxColour TOOL_SHADE() const = 0; + virtual const wxColour TOOL_COLOR() const = 0; + virtual const wxColour SPLINE_L_PEN() const = 0; + virtual const wxColour SPLINE_O_PEN() const = 0; + virtual const wxColour SPLINE_I_PEN() const = 0; + virtual const wxColour SPLINE_R_PEN() const = 0; + virtual const wxColour BED_DARK() const = 0; +}; + +}} // namespace Slic3r::GUI + +#endif diff --git a/src/GUI/ColorScheme/Default.hpp b/src/GUI/ColorScheme/Default.hpp new file mode 100644 index 000000000..47fd951e6 --- /dev/null +++ b/src/GUI/ColorScheme/Default.hpp @@ -0,0 +1,47 @@ +#ifndef COLOR_DEFAULT_HPP +#define COLOR_DEFAULT_HPP + +namespace Slic3r { namespace GUI { + +class DefaultColor : public ColorScheme { +public: + const std::string name() const { return "Default"; } + const bool SOLID_BACKGROUNDCOLOR() const { return false; }; + const wxColour SELECTED_COLOR() const { return wxColour(0, 1, 0); }; + const wxColour HOVER_COLOR() const { return wxColour(0.4, 0.9, 0); }; // + +#include "ColorScheme/ColorSchemeBase.hpp" + +namespace Slic3r { namespace GUI { + +/// S O L A R I Z E +/// http://ethanschoonover.com/solarized +/// +/// Implements a colorscheme lookup of wxColors +class Solarized : public ColorScheme { +public: + const wxColour SELECTED_COLOR() { return COLOR_MAGENTA; } + const wxColour HOVER_COLOR() { return COLOR_VIOLET; } + const wxColour SUPPORT_COLOR() { return COLOR_VIOLET; } + + const wxColour BACKGROUND_COLOR() { return COLOR_BASE3; } + + +private: + const wxColour COLOR_BASE0 {wxColour(0.51373,0.58039,0.58824)}; + const wxColour COLOR_BASE00 {wxColour(0.39608,0.48235,0.51373)}; + const wxColour COLOR_BASE01 {wxColour(0.34510,0.43137,0.45882)}; + const wxColour COLOR_BASE02 {wxColour(0.02745,0.21176,0.25882)}; + const wxColour COLOR_BASE03 {wxColour(0.00000,0.16863,0.21176)}; + const wxColour COLOR_BASE1 {wxColour(0.57647,0.63137,0.63137)}; + const wxColour COLOR_BASE2 {wxColour(0.93333,0.90980,0.83529)}; + const wxColour COLOR_BASE3 {wxColour(0.99216,0.96471,0.89020)}; + const wxColour COLOR_BLUE {wxColour(0.14902,0.54510,0.82353)}; + const wxColour COLOR_CYAN {wxColour(0.16471,0.63137,0.59608)}; + const wxColour COLOR_GREEN {wxColour(0.52157,0.60000,0.00000)}; + const wxColour COLOR_MAGENTA {wxColour(0.82745,0.21176,0.50980)}; + const wxColour COLOR_ORANGE {wxColour(0.79608,0.29412,0.08627)}; + const wxColour COLOR_RED {wxColour(0.86275,0.19608,0.18431)}; + const wxColour COLOR_VIOLET {wxColour(0.42353,0.44314,0.76863)}; + const wxColour COLOR_YELLOW {wxColour(0.70980,0.53725,0.00000)}; + +}; +}} // namespace Slic3r::GUI + + +#endif // SOLARIZED_HPP diff --git a/src/GUI/Settings.hpp b/src/GUI/Settings.hpp index bc391ae87..c74383084 100644 --- a/src/GUI/Settings.hpp +++ b/src/GUI/Settings.hpp @@ -9,6 +9,7 @@ #include #include "libslic3r.h" +#include "ColorScheme.hpp" namespace Slic3r { namespace GUI { @@ -16,10 +17,6 @@ enum class PathColor { role }; -enum class ColorScheme { - solarized, slic3r -}; - enum class ReloadBehavior { all, copy, discard }; @@ -40,7 +37,7 @@ class Settings { bool hide_reload_dialog {false}; ReloadBehavior reload {ReloadBehavior::all}; - ColorScheme color {ColorScheme::slic3r}; + std::unique_ptr color {new Slic3r::GUI::DefaultColor}; PathColor color_toolpaths_by {PathColor::role}; float nudge {1.0}; //< 2D plater nudge amount in mm From 7126d13850bd55f4b4d457466cb7434640d669ad Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 29 Apr 2018 14:40:15 -0500 Subject: [PATCH 064/112] Push Settings down so it's available to the plater (for color choices, etc). --- src/GUI/MainFrame.cpp | 6 +++--- src/GUI/MainFrame.hpp | 2 +- src/GUI/Plater.cpp | 8 +++++--- src/GUI/Plater.hpp | 5 ++++- src/GUI/Plater/Plate2D.cpp | 12 ++++++++++++ src/GUI/Plater/Plate2D.hpp | 8 ++++++-- 6 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/GUI/MainFrame.cpp b/src/GUI/MainFrame.cpp index 83eb2a65a..8c1d3c0e4 100644 --- a/src/GUI/MainFrame.cpp +++ b/src/GUI/MainFrame.cpp @@ -12,9 +12,9 @@ wxEND_EVENT_TABLE() MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size) : MainFrame(title, pos, size, nullptr) {} -MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size, std::shared_ptr config) +MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size, std::shared_ptr _gui_config) : wxFrame(NULL, wxID_ANY, title, pos, size), loaded(false), - tabpanel(nullptr), controller(nullptr), plater(nullptr), gui_config(config), preset_editor_tabs(std::map()) + tabpanel(nullptr), controller(nullptr), plater(nullptr), gui_config(_gui_config), preset_editor_tabs(std::map()) { // Set icon to either the .ico if windows or png for everything else. if (the_os == OS::Windows) @@ -105,7 +105,7 @@ void MainFrame::init_tabpanel() wxTheApp->CallAfter([=] { this->tabpanel->SetSelection(0); }); }), panel->GetId()); - this->plater = new Slic3r::GUI::Plater(panel, _("Plater")); + this->plater = new Slic3r::GUI::Plater(panel, _("Plater"), gui_config); this->controller = new Slic3r::GUI::Controller(panel, _("Controller")); panel->AddPage(this->plater, this->plater->GetName()); diff --git a/src/GUI/MainFrame.hpp b/src/GUI/MainFrame.hpp index 085cc3922..b067c6f9b 100644 --- a/src/GUI/MainFrame.hpp +++ b/src/GUI/MainFrame.hpp @@ -28,7 +28,7 @@ class MainFrame: public wxFrame { public: MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size); - MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size, std::shared_ptr gui_config); + MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size, std::shared_ptr _gui_config); private: wxDECLARE_EVENT_TABLE(); diff --git a/src/GUI/Plater.cpp b/src/GUI/Plater.cpp index 75d6fee1d..2fb6d323d 100644 --- a/src/GUI/Plater.cpp +++ b/src/GUI/Plater.cpp @@ -1,3 +1,5 @@ +#include + #include "Plater.hpp" #include "Log.hpp" @@ -5,8 +7,8 @@ namespace Slic3r { namespace GUI { const auto PROGRESS_BAR_EVENT = wxNewEventType(); -Plater::Plater(wxWindow* parent, const wxString& title) : - wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, title) +Plater::Plater(wxWindow* parent, const wxString& title, std::shared_ptr _settings) : + wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, title), settings(_settings) { // Set callback for status event for worker threads @@ -53,7 +55,7 @@ Plater::Plater(wxWindow* parent, const wxString& title) : }); } */ - canvas2D = new Plate2D(preview_notebook, wxDefaultSize, objects, model, config); + canvas2D = new Plate2D(preview_notebook, wxDefaultSize, objects, model, config, settings); /* # Initialize 2D preview canvas diff --git a/src/GUI/Plater.hpp b/src/GUI/Plater.hpp index f0c4569f3..e37448fdd 100644 --- a/src/GUI/Plater.hpp +++ b/src/GUI/Plater.hpp @@ -16,22 +16,25 @@ #include "Plater/Plater2DObject.hpp" #include "Plater/Plate2D.hpp" +#include "Settings.hpp" namespace Slic3r { namespace GUI { using UndoOperation = int; class Plater2DObject; +class Plate2D; class Plater : public wxPanel { public: - Plater(wxWindow* parent, const wxString& title); + Plater(wxWindow* parent, const wxString& title, std::shared_ptr _settings); void add(); private: std::shared_ptr print {std::make_shared(Slic3r::Print())}; std::shared_ptr model {std::make_shared(Slic3r::Model())}; + std::shared_ptr settings {}; std::shared_ptr config { Slic3r::Config::new_from_defaults( {"bed_shape", "complete_objects", "extruder_clearance_radius", "skirts", "skirt_distance", diff --git a/src/GUI/Plater/Plate2D.cpp b/src/GUI/Plater/Plate2D.cpp index e69de29bb..c5015b5d2 100644 --- a/src/GUI/Plater/Plate2D.cpp +++ b/src/GUI/Plater/Plate2D.cpp @@ -0,0 +1,12 @@ +#include "Plater/Plate2D.hpp" + +#include + +namespace Slic3r { namespace GUI { + +Plate2D::Plate2D(wxWindow* parent, const wxSize& size, std::vector& _objects, std::shared_ptr _model, std::shared_ptr _config, std::shared_ptr _settings) : + wxPanel(parent, wxID_ANY, wxDefaultPosition, size, wxTAB_TRAVERSAL), objects(_objects), model(_model), config(_config), settings(_settings) +{ +} + +} } // Namespace Slic3r::GUI diff --git a/src/GUI/Plater/Plate2D.hpp b/src/GUI/Plater/Plate2D.hpp index 306d5cba1..3c82f1a10 100644 --- a/src/GUI/Plater/Plate2D.hpp +++ b/src/GUI/Plater/Plate2D.hpp @@ -6,6 +6,8 @@ #endif #include #include "Plater.hpp" +#include "ColorScheme.hpp" +#include "Settings.hpp" #include "Plater/Plater2DObject.hpp" @@ -13,12 +15,14 @@ namespace Slic3r { namespace GUI { class Plate2D : public wxPanel { public: - Plate2D(wxWindow* parent, const wxSize& size, std::vector& _objects, std::shared_ptr _model, std::shared_ptr _config) : - wxPanel(parent, wxID_ANY, wxDefaultPosition, size, wxTAB_TRAVERSAL), objects(_objects), model(_model), config(_config) { } + Plate2D(wxWindow* parent, const wxSize& size, std::vector& _objects, std::shared_ptr _model, std::shared_ptr _config, std::shared_ptr _settings); private: std::vector& objects; std::shared_ptr model; std::shared_ptr config; + std::shared_ptr settings; + + wxBrush objects_brush {}; }; } } // Namespace Slic3r::GUI From 1548066318e52c86c832d168a3e3398f8d2a7766 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 29 Apr 2018 18:02:48 -0500 Subject: [PATCH 065/112] Staged the 2D plater on its tab. --- src/GUI/Plater.cpp | 1 + src/GUI/Plater/Plate2D.cpp | 58 ++++++++++++++++++++++++++++++++++++++ src/GUI/Plater/Plate2D.hpp | 31 ++++++++++++++++++++ 3 files changed, 90 insertions(+) diff --git a/src/GUI/Plater.cpp b/src/GUI/Plater.cpp index 2fb6d323d..fa8b596c1 100644 --- a/src/GUI/Plater.cpp +++ b/src/GUI/Plater.cpp @@ -56,6 +56,7 @@ Plater::Plater(wxWindow* parent, const wxString& title, std::shared_ptrAddPage(canvas2D, _("2D")); /* # Initialize 2D preview canvas diff --git a/src/GUI/Plater/Plate2D.cpp b/src/GUI/Plater/Plate2D.cpp index c5015b5d2..13ebb43f6 100644 --- a/src/GUI/Plater/Plate2D.cpp +++ b/src/GUI/Plater/Plate2D.cpp @@ -1,4 +1,5 @@ #include "Plater/Plate2D.hpp" +#include "Log.hpp" #include @@ -7,6 +8,63 @@ namespace Slic3r { namespace GUI { Plate2D::Plate2D(wxWindow* parent, const wxSize& size, std::vector& _objects, std::shared_ptr _model, std::shared_ptr _config, std::shared_ptr _settings) : wxPanel(parent, wxID_ANY, wxDefaultPosition, size, wxTAB_TRAVERSAL), objects(_objects), model(_model), config(_config), settings(_settings) { + + this->Bind(wxEVT_PAINT, [=](wxPaintEvent &e) { this->repaint(e); }); + this->Bind(wxEVT_MOTION, [=](wxMouseEvent &e) { this->mouse_drag(e); }); + if (user_drawn_background) { + this->Bind(wxEVT_ERASE_BACKGROUND, [=](wxEraseEvent& e){ }); + } + + // Bind the varying mouse events + + // Set the brushes + set_colors(); +} + +void Plate2D::repaint(wxPaintEvent& e) { +} + +void Plate2D::mouse_drag(wxMouseEvent& e) { + if (e.Dragging()) { + Slic3r::Log::info(LogChannel, L"Mouse dragging"); + } else { + Slic3r::Log::info(LogChannel, L"Mouse moving"); + } +} + +void Plate2D::set_colors() { + + this->SetBackgroundColour(settings->color->BACKGROUND255()); + + this->objects_brush.SetColour(settings->color->BED_OBJECTS()); + this->objects_brush.SetStyle(wxBRUSHSTYLE_SOLID); + this->instance_brush.SetColour(settings->color->BED_INSTANCE()); + this->instance_brush.SetStyle(wxBRUSHSTYLE_SOLID); + this->selected_brush.SetColour(settings->color->BED_SELECTED()); + this->selected_brush.SetStyle(wxBRUSHSTYLE_SOLID); + this->dragged_brush.SetColour(settings->color->BED_DRAGGED()); + this->dragged_brush.SetStyle(wxBRUSHSTYLE_SOLID); + this->bed_brush.SetColour(settings->color->BED_COLOR()); + this->bed_brush.SetStyle(wxBRUSHSTYLE_SOLID); + this->transparent_brush.SetColour(wxColour(0,0,0)); + this->transparent_brush.SetStyle(wxBRUSHSTYLE_TRANSPARENT); + + this->grid_pen.SetColour(settings->color->BED_GRID()); + this->grid_pen.SetWidth(1); + this->grid_pen.SetStyle(wxPENSTYLE_SOLID); + this->print_center_pen.SetColour(settings->color->BED_CENTER()); + this->print_center_pen.SetWidth(1); + this->print_center_pen.SetStyle(wxPENSTYLE_SOLID); + this->clearance_pen.SetColour(settings->color->BED_CLEARANCE()); + this->clearance_pen.SetWidth(1); + this->clearance_pen.SetStyle(wxPENSTYLE_SOLID); + this->skirt_pen.SetColour(settings->color->BED_SKIRT()); + this->skirt_pen.SetWidth(1); + this->skirt_pen.SetStyle(wxPENSTYLE_SOLID); + this->dark_pen.SetColour(settings->color->BED_DARK()); + this->dark_pen.SetWidth(1); + this->dark_pen.SetStyle(wxPENSTYLE_SOLID); + } } } // Namespace Slic3r::GUI diff --git a/src/GUI/Plater/Plate2D.hpp b/src/GUI/Plater/Plate2D.hpp index 3c82f1a10..07ae3451a 100644 --- a/src/GUI/Plater/Plate2D.hpp +++ b/src/GUI/Plater/Plate2D.hpp @@ -4,11 +4,16 @@ #ifndef WX_PRECOMP #include #endif + #include #include "Plater.hpp" #include "ColorScheme.hpp" #include "Settings.hpp" #include "Plater/Plater2DObject.hpp" +#include "misc_ui.hpp" + + +#include "Log.hpp" namespace Slic3r { namespace GUI { @@ -22,7 +27,33 @@ private: std::shared_ptr config; std::shared_ptr settings; + // Different brushes to draw with wxBrush objects_brush {}; + wxBrush instance_brush {}; + wxBrush selected_brush {}; + wxBrush bed_brush {}; + wxBrush dragged_brush {}; + wxBrush transparent_brush {}; + + wxPen grid_pen {}; + wxPen print_center_pen {}; + wxPen clearance_pen {}; + wxPen skirt_pen {}; + wxPen dark_pen {}; + + bool user_drawn_background {(the_os == OS::Mac ? false : true)}; + Plater2DObject selected_instance; + + /// Handle mouse-move events + void mouse_drag(wxMouseEvent& e); + + /// Handle repaint events + void repaint(wxPaintEvent& e); + + /// Set/Update all of the colors used by the various brushes in the panel. + void set_colors(); + + const std::string LogChannel {"GUI_2D"}; }; } } // Namespace Slic3r::GUI From 0a963ea0df61bd97ac2c3b95392e261acd572055 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 29 Apr 2018 18:03:13 -0500 Subject: [PATCH 066/112] Set LogChannel for Slic3r::GUI::Plater --- src/GUI/Plater.cpp | 2 +- src/GUI/Plater.hpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GUI/Plater.cpp b/src/GUI/Plater.cpp index fa8b596c1..678edfca5 100644 --- a/src/GUI/Plater.cpp +++ b/src/GUI/Plater.cpp @@ -108,7 +108,7 @@ Plater::Plater(wxWindow* parent, const wxString& title, std::shared_ptr Date: Sun, 29 Apr 2018 22:49:49 -0500 Subject: [PATCH 067/112] added warn() to log --- xs/src/libslic3r/Log.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xs/src/libslic3r/Log.hpp b/xs/src/libslic3r/Log.hpp index 554b560a2..419448a88 100644 --- a/xs/src/libslic3r/Log.hpp +++ b/xs/src/libslic3r/Log.hpp @@ -17,6 +17,11 @@ public: std::wclog << message << std::endl; } + static void warn(std::string topic, std::wstring message) { + std::cerr << topic << ": "; + std::wcerr << message << std::endl; + } + }; } From 4eec78e1bf906055d0a42cce75982c52160d418b Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 29 Apr 2018 22:50:06 -0500 Subject: [PATCH 068/112] further fleshing out of 2d plater --- src/GUI/Plater/Plate2D.cpp | 92 ++++++++++++++++++++++++++++++++++++++ src/GUI/Plater/Plate2D.hpp | 38 +++++++++++++++- 2 files changed, 128 insertions(+), 2 deletions(-) diff --git a/src/GUI/Plater/Plate2D.cpp b/src/GUI/Plater/Plate2D.cpp index 13ebb43f6..e9a906c22 100644 --- a/src/GUI/Plater/Plate2D.cpp +++ b/src/GUI/Plater/Plate2D.cpp @@ -1,7 +1,12 @@ #include "Plater/Plate2D.hpp" + +// libslic3r includes +#include "Geometry.hpp" #include "Log.hpp" +// wx includes #include +#include namespace Slic3r { namespace GUI { @@ -15,6 +20,8 @@ Plate2D::Plate2D(wxWindow* parent, const wxSize& size, std::vectorBind(wxEVT_ERASE_BACKGROUND, [=](wxEraseEvent& e){ }); } + this->Bind(wxEVT_SIZE, [=](wxSizeEvent &e) { this->update_bed_size(); this->Refresh(); }); + // Bind the varying mouse events // Set the brushes @@ -22,6 +29,36 @@ Plate2D::Plate2D(wxWindow* parent, const wxSize& size, std::vectorSetFocus(); + + auto dc {new wxAutoBufferedPaintDC(this)}; + const auto& size = this->GetSize(); + + + if (this->user_drawn_background) { + // On all systems the AutoBufferedPaintDC() achieves double buffering. + // On MacOS the background is erased, on Windows the background is not erased + // and on Linux/GTK the background is erased to gray color. + // Fill DC with the background on Windows & Linux/GTK. + const auto& brush_background {wxBrush(this->settings->color->BACKGROUND255(), wxBRUSHSTYLE_SOLID)}; + const auto& pen_background {wxPen(this->settings->color->BACKGROUND255(), 1, wxPENSTYLE_SOLID)}; + dc->SetPen(pen_background); + dc->SetBrush(brush_background); + const auto& rect {this->GetUpdateRegion().GetBox()}; + dc->DrawRectangle(rect.GetLeft(), rect.GetTop(), rect.GetWidth(), rect.GetHeight()); + } + + // Draw bed + { + dc->SetPen(this->print_center_pen); + dc->SetBrush(this->bed_brush); + + dc->DrawPolygon(scaled_points_to_pixel(this->bed_polygon, true), 0, 0); + } + + } void Plate2D::mouse_drag(wxMouseEvent& e) { @@ -67,4 +104,59 @@ void Plate2D::set_colors() { } +void Plate2D::nudge_key(wxKeyEvent& e) { + const auto key = e.GetKeyCode(); + + switch( key ) { + case WXK_LEFT: + this->nudge(MoveDirection::Left); + case WXK_RIGHT: + this->nudge(MoveDirection::Right); + case WXK_DOWN: + this->nudge(MoveDirection::Down); + case WXK_UP: + this->nudge(MoveDirection::Up); + default: + break; // do nothing + } + +} + +void Plate2D::nudge(MoveDirection dir) { + if (this->selected_instance < this->objects.size()) { + auto i = 0U; + for (auto& obj : this->objects) { + if (obj.selected()) { + if (obj.selected_instance != -1) { + } + } + i++; + } + } + if (selected_instance >= this->objects.size()) { + Slic3r::Log::warn(LogChannel, L"Nudge failed because there is no selected instance."); + return; // Abort + } +} + +void Plate2D::update_bed_size() { + const auto& canvas_size {this->GetSize()}; + const auto& canvas_w {canvas_size.GetWidth()}; + const auto& canvas_h {canvas_size.GetHeight()}; + if (canvas_w == 0) return; // Abort early if we haven't drawn canvas yet. + + this->bed_polygon = Slic3r::Polygon(); + const auto& polygon = bed_polygon; + + const auto& bb = bed_polygon.bounding_box(); + const auto& size = bb.size(); + + this->scaling_factor = std::min(static_cast(canvas_w) / unscale(size.x), + static_cast(canvas_h) / unscale(size.y)); + + assert(this->scaling_factor != 0); + + +} + } } // Namespace Slic3r::GUI diff --git a/src/GUI/Plater/Plate2D.hpp b/src/GUI/Plater/Plate2D.hpp index 07ae3451a..553400a44 100644 --- a/src/GUI/Plater/Plate2D.hpp +++ b/src/GUI/Plater/Plate2D.hpp @@ -6,6 +6,7 @@ #endif #include +#include #include "Plater.hpp" #include "ColorScheme.hpp" #include "Settings.hpp" @@ -18,9 +19,16 @@ namespace Slic3r { namespace GUI { +enum class MoveDirection { + Up, Down, Left, Right +}; + class Plate2D : public wxPanel { public: Plate2D(wxWindow* parent, const wxSize& size, std::vector& _objects, std::shared_ptr _model, std::shared_ptr _config, std::shared_ptr _settings); + + +// std::function<> on_select_object {}; private: std::vector& objects; std::shared_ptr model; @@ -42,7 +50,7 @@ private: wxPen dark_pen {}; bool user_drawn_background {(the_os == OS::Mac ? false : true)}; - Plater2DObject selected_instance; + size_t selected_instance; /// Handle mouse-move events void mouse_drag(wxMouseEvent& e); @@ -50,10 +58,36 @@ private: /// Handle repaint events void repaint(wxPaintEvent& e); + void nudge_key(wxKeyEvent& e); + + void nudge(MoveDirection dir); + /// Set/Update all of the colors used by the various brushes in the panel. void set_colors(); - + + /// Convert a scale point array to a pixel polygon suitable for DrawPolygon + std::vector scaled_points_to_pixel(std::vector points, bool unscale); + + // For a specific point, unscaled it + wxPoint unscaled_point_to_pixel(const wxPoint& in) { + const auto& canvas_height {this->GetSize().GetHeight()}; + const auto& zero = this->bed_origin; + return wxPoint(in.x * this->scaling_factor + zero.x, + in.x * this->scaling_factor + (zero.y - canvas_height)); + } + + /// Read print bed size from config. + void update_bed_size(); + const std::string LogChannel {"GUI_2D"}; + + wxPoint bed_origin {}; + Slic3r::Polygon bed_polygon {}; + + /// How much to scale the points to fit in the draw bounding box area. + /// Expressed as pixel / mm + double scaling_factor {1.0}; + }; } } // Namespace Slic3r::GUI From cc4477eb3f61a87921e23ede41c85b848d50951e Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Mon, 30 Apr 2018 22:15:32 -0500 Subject: [PATCH 069/112] Used correct inheritance for Config. --- xs/src/libslic3r/Config.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xs/src/libslic3r/Config.hpp b/xs/src/libslic3r/Config.hpp index 118309033..a4c7fa470 100644 --- a/xs/src/libslic3r/Config.hpp +++ b/xs/src/libslic3r/Config.hpp @@ -8,7 +8,7 @@ namespace Slic3r { -class Config : DynamicPrintConfig { +class Config : public DynamicPrintConfig { public: static std::shared_ptr new_from_defaults(); static std::shared_ptr new_from_defaults(std::initializer_list init); From 77ae0df2ad2d2f4a1b798a9ca909d381b2c5ba87 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Mon, 30 Apr 2018 22:15:56 -0500 Subject: [PATCH 070/112] scale Pointf array into Points array. --- xs/src/libslic3r/Point.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xs/src/libslic3r/Point.hpp b/xs/src/libslic3r/Point.hpp index 048e6c227..57a9ef7e8 100644 --- a/xs/src/libslic3r/Point.hpp +++ b/xs/src/libslic3r/Point.hpp @@ -152,6 +152,15 @@ to_points(const std::vector &items) return pp; } +inline Points +scale(const std::vector&in ) { + Points out; + for (const auto& p : in) {out.push_back(Point(scale_(p.x), scale_(p.y))); } + return out; +} + + + } // start Boost From 456212918f72954b681f6eca8ba4e8aff890975f Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Mon, 30 Apr 2018 22:16:50 -0500 Subject: [PATCH 071/112] Fixed unscale point->pixel rescale function. --- src/GUI/Plater/Plate2D.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GUI/Plater/Plate2D.hpp b/src/GUI/Plater/Plate2D.hpp index 553400a44..5bd57e75f 100644 --- a/src/GUI/Plater/Plate2D.hpp +++ b/src/GUI/Plater/Plate2D.hpp @@ -73,7 +73,7 @@ private: const auto& canvas_height {this->GetSize().GetHeight()}; const auto& zero = this->bed_origin; return wxPoint(in.x * this->scaling_factor + zero.x, - in.x * this->scaling_factor + (zero.y - canvas_height)); + in.y * this->scaling_factor + (zero.y - canvas_height)); } /// Read print bed size from config. From aef1bf7f37c83343e941333d9c7e130e90a110ce Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Mon, 30 Apr 2018 22:17:42 -0500 Subject: [PATCH 072/112] Ported scaled_points_to_pixel, made Polygon and Polylines versions. --- src/GUI/Plater/Plate2D.cpp | 10 ++++++++++ src/GUI/Plater/Plate2D.hpp | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/GUI/Plater/Plate2D.cpp b/src/GUI/Plater/Plate2D.cpp index e9a906c22..3791b10b8 100644 --- a/src/GUI/Plater/Plate2D.cpp +++ b/src/GUI/Plater/Plate2D.cpp @@ -157,6 +157,16 @@ void Plate2D::update_bed_size() { assert(this->scaling_factor != 0); +std::vector Plate2D::scaled_points_to_pixel(const Slic3r::Polygon& poly, bool unscale) { + return this->scaled_points_to_pixel(Polyline(poly), unscale); } +std::vector Plate2D::scaled_points_to_pixel(const Slic3r::Polyline& poly, bool unscale) { + std::vector result; + for (const auto& pt : poly.points) { + const auto tmp {wxPoint(pt.x, pt.y)}; + result.push_back( (unscale ? unscaled_point_to_pixel(tmp) : tmp) ); + } + return result; +} } } // Namespace Slic3r::GUI diff --git a/src/GUI/Plater/Plate2D.hpp b/src/GUI/Plater/Plate2D.hpp index 5bd57e75f..6c7ab3dc8 100644 --- a/src/GUI/Plater/Plate2D.hpp +++ b/src/GUI/Plater/Plate2D.hpp @@ -66,7 +66,8 @@ private: void set_colors(); /// Convert a scale point array to a pixel polygon suitable for DrawPolygon - std::vector scaled_points_to_pixel(std::vector points, bool unscale); + std::vector scaled_points_to_pixel(const Slic3r::Polygon& poly, bool unscale); + std::vector scaled_points_to_pixel(const Slic3r::Polyline& poly, bool unscale); // For a specific point, unscaled it wxPoint unscaled_point_to_pixel(const wxPoint& in) { From 953977be4b3de9b56b48cead553bc56e917378c9 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Mon, 30 Apr 2018 22:18:17 -0500 Subject: [PATCH 073/112] Easter egg: Change Canvas text based on the current date (Sep 13). --- src/GUI/Plater/Plate2D.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/GUI/Plater/Plate2D.hpp b/src/GUI/Plater/Plate2D.hpp index 6c7ab3dc8..8c5313791 100644 --- a/src/GUI/Plater/Plate2D.hpp +++ b/src/GUI/Plater/Plate2D.hpp @@ -4,6 +4,7 @@ #ifndef WX_PRECOMP #include #endif +#include #include #include @@ -19,6 +20,12 @@ namespace Slic3r { namespace GUI { + +// Setup for an Easter Egg with the canvas text. +const wxDateTime today_date {wxDateTime().GetDateOnly()}; +const wxDateTime special_date {13, wxDateTime::Month::Sep, 2006, 0, 0, 0, 0}; +const bool today_is_special = {today_date.GetDay() == special_date.GetDay() && today_date.GetMonth() == special_date.GetMonth()}; + enum class MoveDirection { Up, Down, Left, Right }; @@ -84,6 +91,10 @@ private: wxPoint bed_origin {}; Slic3r::Polygon bed_polygon {}; + /// Set up the 2D canvas blank canvas text. + /// Easter egg: Sept. 13, 2006. The first part ever printed by a RepRap to make another RepRap. + const wxString CANVAS_TEXT { today_is_special ? _(L"What do you want to print today?™") : _("Drag your objects here") }; + /// How much to scale the points to fit in the draw bounding box area. /// Expressed as pixel / mm From fb3250997b47b094b3a944ab728824ca958e7b04 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Mon, 30 Apr 2018 22:18:53 -0500 Subject: [PATCH 074/112] Set BackgroundStyle because wxWidgets wants us to. --- src/GUI/Plater/Plate2D.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GUI/Plater/Plate2D.cpp b/src/GUI/Plater/Plate2D.cpp index 3791b10b8..b30f3b9e7 100644 --- a/src/GUI/Plater/Plate2D.cpp +++ b/src/GUI/Plater/Plate2D.cpp @@ -26,6 +26,7 @@ Plate2D::Plate2D(wxWindow* parent, const wxSize& size, std::vectorSetBackgroundStyle(wxBG_STYLE_PAINT); } void Plate2D::repaint(wxPaintEvent& e) { From 2116dfa1788e6e984aefae7c1bfe92cfcf570543 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Mon, 30 Apr 2018 22:20:00 -0500 Subject: [PATCH 075/112] more work on repaint() event handler. Now draws grid based on bed polygon in config. --- src/GUI/Plater/Plate2D.cpp | 36 +++++++++++++++++++++++++++++++++--- src/GUI/Plater/Plate2D.hpp | 3 +++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/GUI/Plater/Plate2D.cpp b/src/GUI/Plater/Plate2D.cpp index b30f3b9e7..72d14e414 100644 --- a/src/GUI/Plater/Plate2D.cpp +++ b/src/GUI/Plater/Plate2D.cpp @@ -35,7 +35,7 @@ void Plate2D::repaint(wxPaintEvent& e) { this->SetFocus(); auto dc {new wxAutoBufferedPaintDC(this)}; - const auto& size = this->GetSize(); + const auto& size {wxSize(this->GetSize().GetWidth(), this->GetSize().GetHeight())}; if (this->user_drawn_background) { @@ -55,8 +55,38 @@ void Plate2D::repaint(wxPaintEvent& e) { { dc->SetPen(this->print_center_pen); dc->SetBrush(this->bed_brush); - - dc->DrawPolygon(scaled_points_to_pixel(this->bed_polygon, true), 0, 0); + auto tmp {scaled_points_to_pixel(this->bed_polygon, true)}; + dc->DrawPolygon(this->bed_polygon.points.size(), tmp.data(), 0, 0); + } + + // draw print center + { + if (this->objects.size() > 0 && settings->autocenter) { + const auto center = this->unscaled_point_to_pixel(this->print_center); + dc->SetPen(print_center_pen); + dc->DrawLine(center.x, 0, center.x, size.y); + dc->DrawLine(0, center.y, size.x, center.y); + dc->SetTextForeground(wxColor(0,0,0)); + dc->SetFont(wxFont(10, wxFONTFAMILY_ROMAN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); + + dc->DrawLabel("X = ", wxRect(0,0, center.x*2, this->GetSize().GetHeight()), wxALIGN_CENTER_HORIZONTAL | wxALIGN_BOTTOM); + dc->DrawRotatedText("Y = ", 0, center.y + 15, 90); + } + } + + // draw text if plate is empty + if (this->objects.size() == 0) { + dc->SetTextForeground(settings->color->BED_OBJECTS()); + dc->SetFont(wxFont(14, wxFONTFAMILY_ROMAN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); + dc->DrawLabel(CANVAS_TEXT, wxRect(0,0, this->GetSize().GetWidth(), this->GetSize().GetHeight()), wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL); + } else { + // draw grid + dc->SetPen(grid_pen); + // Assumption: grid of lines is arranged + // as adjacent pairs of wxPoints + for (auto i = 0U; i < grid.size(); i+=2) { + dc->DrawLine(grid[i], grid[i+1]); + } } diff --git a/src/GUI/Plater/Plate2D.hpp b/src/GUI/Plater/Plate2D.hpp index 8c5313791..39457bc71 100644 --- a/src/GUI/Plater/Plate2D.hpp +++ b/src/GUI/Plater/Plate2D.hpp @@ -90,7 +90,10 @@ private: const std::string LogChannel {"GUI_2D"}; wxPoint bed_origin {}; + wxPoint print_center {}; Slic3r::Polygon bed_polygon {}; + std::vector grid {}; + /// Set up the 2D canvas blank canvas text. /// Easter egg: Sept. 13, 2006. The first part ever printed by a RepRap to make another RepRap. const wxString CANVAS_TEXT { today_is_special ? _(L"What do you want to print today?™") : _("Drag your objects here") }; From 352183131a797bbcaa871a69d72b2272b4fa38a5 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Mon, 30 Apr 2018 22:33:54 -0500 Subject: [PATCH 076/112] Finished update_bed_size, shuffled LogChannel position in the class. updated a few comments. --- src/GUI/Plater/Plate2D.cpp | 53 +++++++++++++++++++++++++++++++++----- src/GUI/Plater/Plate2D.hpp | 8 +++--- 2 files changed, 50 insertions(+), 11 deletions(-) diff --git a/src/GUI/Plater/Plate2D.cpp b/src/GUI/Plater/Plate2D.cpp index 72d14e414..2f747f2a2 100644 --- a/src/GUI/Plater/Plate2D.cpp +++ b/src/GUI/Plater/Plate2D.cpp @@ -2,7 +2,9 @@ // libslic3r includes #include "Geometry.hpp" +#include "Point.hpp" #include "Log.hpp" +#include "ClipperUtils.hpp" // wx includes #include @@ -27,6 +29,7 @@ Plate2D::Plate2D(wxWindow* parent, const wxSize& size, std::vectorSetBackgroundStyle(wxBG_STYLE_PAINT); + } void Plate2D::repaint(wxPaintEvent& e) { @@ -69,8 +72,11 @@ void Plate2D::repaint(wxPaintEvent& e) { dc->SetTextForeground(wxColor(0,0,0)); dc->SetFont(wxFont(10, wxFONTFAMILY_ROMAN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); - dc->DrawLabel("X = ", wxRect(0,0, center.x*2, this->GetSize().GetHeight()), wxALIGN_CENTER_HORIZONTAL | wxALIGN_BOTTOM); - dc->DrawRotatedText("Y = ", 0, center.y + 15, 90); + wxString val {}; + val.Printf("X = %.0f", this->print_center.x); + dc->DrawLabel(val , wxRect(0,0, center.x*2, this->GetSize().GetHeight()), wxALIGN_CENTER_HORIZONTAL | wxALIGN_BOTTOM); + val.Printf("Y = %.0f", this->print_center.y); + dc->DrawRotatedText(val, 0, center.y + 15, 90); } } @@ -157,7 +163,7 @@ void Plate2D::nudge(MoveDirection dir) { if (this->selected_instance < this->objects.size()) { auto i = 0U; for (auto& obj : this->objects) { - if (obj.selected()) { + if (obj.selected) { if (obj.selected_instance != -1) { } } @@ -176,17 +182,47 @@ void Plate2D::update_bed_size() { const auto& canvas_h {canvas_size.GetHeight()}; if (canvas_w == 0) return; // Abort early if we haven't drawn canvas yet. - this->bed_polygon = Slic3r::Polygon(); + this->bed_polygon = Slic3r::Polygon(scale(dynamic_cast(config->optptr("bed_shape"))->values)); + const auto& polygon = bed_polygon; const auto& bb = bed_polygon.bounding_box(); const auto& size = bb.size(); - this->scaling_factor = std::min(static_cast(canvas_w) / unscale(size.x), - static_cast(canvas_h) / unscale(size.y)); + this->scaling_factor = std::min(canvas_w / unscale(size.x), canvas_h / unscale(size.y)); - assert(this->scaling_factor != 0); + this->bed_origin = wxPoint( + canvas_w / 2 - (unscale(bb.max.x + bb.min.x)/2 * this->scaling_factor), + canvas_h - (canvas_h / 2 - (unscale(bb.max.y + bb.min.y)/2 * this->scaling_factor)) + ); + const auto& center = bb.center(); + this->print_center = wxPoint(unscale(center.x), unscale(center.y)); + + // Cache bed contours and grid + { + const auto& step { scale_(10) }; + auto grid {Polylines()}; + + for (coord_t x = (bb.min.x - (bb.min.x % step) + step); x < bb.max.x; x += step) { + grid.push_back(Polyline()); + grid.back().append(Point(x, bb.min.y)); + grid.back().append(Point(x, bb.max.y)); + }; + + for (coord_t y = (bb.min.y - (bb.min.y % step) + step); y < bb.max.y; y += step) { + grid.push_back(Polyline()); + grid.back().append(Point(bb.min.x, y)); + grid.back().append(Point(bb.max.x, y)); + }; + + grid = intersection_pl(grid, polygon); + for (auto& i : grid) { + const auto& tmpline { this->scaled_points_to_pixel(i, 1) }; + this->grid.insert(this->grid.end(), tmpline.begin(), tmpline.end()); + } + } +} std::vector Plate2D::scaled_points_to_pixel(const Slic3r::Polygon& poly, bool unscale) { return this->scaled_points_to_pixel(Polyline(poly), unscale); @@ -200,4 +236,7 @@ std::vector Plate2D::scaled_points_to_pixel(const Slic3r::Polyline& pol } return result; } + + + } } // Namespace Slic3r::GUI diff --git a/src/GUI/Plater/Plate2D.hpp b/src/GUI/Plater/Plate2D.hpp index 39457bc71..9b33c80eb 100644 --- a/src/GUI/Plater/Plate2D.hpp +++ b/src/GUI/Plater/Plate2D.hpp @@ -84,11 +84,10 @@ private: in.y * this->scaling_factor + (zero.y - canvas_height)); } - /// Read print bed size from config. + /// Read print bed size from config and calculate the scaled rendition of the bed given the draw canvas. void update_bed_size(); - const std::string LogChannel {"GUI_2D"}; - + /// private class variables to stash bits for drawing the print bed area. wxPoint bed_origin {}; wxPoint print_center {}; Slic3r::Polygon bed_polygon {}; @@ -97,11 +96,12 @@ private: /// Set up the 2D canvas blank canvas text. /// Easter egg: Sept. 13, 2006. The first part ever printed by a RepRap to make another RepRap. const wxString CANVAS_TEXT { today_is_special ? _(L"What do you want to print today?™") : _("Drag your objects here") }; - /// How much to scale the points to fit in the draw bounding box area. /// Expressed as pixel / mm double scaling_factor {1.0}; + + const std::string LogChannel {"GUI_2D"}; }; From 7afbb6978ad6446422e9feb542db7ae7964767fd Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Mon, 30 Apr 2018 22:34:30 -0500 Subject: [PATCH 077/112] added Selected_instance field to Plater2DObject, also added reference to object index to Plater. --- src/GUI/Plater.hpp | 1 + src/GUI/Plater/Plater2DObject.hpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/GUI/Plater.hpp b/src/GUI/Plater.hpp index 2d42295a5..c74f9d87f 100644 --- a/src/GUI/Plater.hpp +++ b/src/GUI/Plater.hpp @@ -21,6 +21,7 @@ namespace Slic3r { namespace GUI { using UndoOperation = int; +using obj_index = unsigned int; class Plater2DObject; class Plate2D; diff --git a/src/GUI/Plater/Plater2DObject.hpp b/src/GUI/Plater/Plater2DObject.hpp index 3a1772cfb..1bd5b97ba 100644 --- a/src/GUI/Plater/Plater2DObject.hpp +++ b/src/GUI/Plater/Plater2DObject.hpp @@ -8,6 +8,7 @@ public: std::string name {""}; std::string identifier {""}; bool selected {false}; + int selected_instance {-1}; }; } } // Namespace Slic3r::GUI #endif From 14097656e9c742ea963974b9ca4ce4c4d7974392 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Mon, 30 Apr 2018 23:38:12 -0500 Subject: [PATCH 078/112] Added point_to_model_units() and clarified a couple comments. --- src/GUI/Plater/Plate2D.hpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/GUI/Plater/Plate2D.hpp b/src/GUI/Plater/Plate2D.hpp index 9b33c80eb..01eb01abe 100644 --- a/src/GUI/Plater/Plate2D.hpp +++ b/src/GUI/Plater/Plate2D.hpp @@ -14,7 +14,6 @@ #include "Plater/Plater2DObject.hpp" #include "misc_ui.hpp" - #include "Log.hpp" @@ -42,7 +41,7 @@ private: std::shared_ptr config; std::shared_ptr settings; - // Different brushes to draw with + // Different brushes to draw with, initialized from settings->Color during the constructor wxBrush objects_brush {}; wxBrush instance_brush {}; wxBrush selected_brush {}; @@ -76,7 +75,7 @@ private: std::vector scaled_points_to_pixel(const Slic3r::Polygon& poly, bool unscale); std::vector scaled_points_to_pixel(const Slic3r::Polyline& poly, bool unscale); - // For a specific point, unscaled it + /// For a specific point, unscale it relative to the origin wxPoint unscaled_point_to_pixel(const wxPoint& in) { const auto& canvas_height {this->GetSize().GetHeight()}; const auto& zero = this->bed_origin; @@ -103,6 +102,20 @@ private: const std::string LogChannel {"GUI_2D"}; + Slic3r::Point point_to_model_units(coordf_t x, coordf_t y) { + const auto& zero {this->bed_origin}; + return Slic3r::Point( + scale_(x - zero.x) / this->scaling_factor, + scale_(y - zero.y) / this->scaling_factor + ); + } + Slic3r::Point point_to_model_units(const wxPoint& pt) { + return this->point_to_model_units(pt.x, pt.y); + } + Slic3r::Point point_to_model_units(const Pointf& pt) { + return this->point_to_model_units(pt.x, pt.y); + } + }; } } // Namespace Slic3r::GUI From 5f405b60e91a22b02cee356aa1e123aa4bb84ef9 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 1 May 2018 21:50:30 -0500 Subject: [PATCH 079/112] Plater2DObject->PlaterObject --- src/CMakeLists.txt | 1 + src/GUI/Plater.hpp | 6 ++-- src/GUI/Plater/Plate2D.cpp | 2 +- src/GUI/Plater/Plate2D.hpp | 6 ++-- src/GUI/Plater/Plater2DObject.hpp | 14 --------- src/GUI/Plater/PlaterObject.cpp | 50 +++++++++++++++++++++++++++++++ src/GUI/Plater/PlaterObject.hpp | 34 +++++++++++++++++++++ 7 files changed, 92 insertions(+), 21 deletions(-) delete mode 100644 src/GUI/Plater/Plater2DObject.hpp create mode 100644 src/GUI/Plater/PlaterObject.cpp create mode 100644 src/GUI/Plater/PlaterObject.hpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 361074ea3..6f81384a1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -187,6 +187,7 @@ IF(wxWidgets_FOUND) ${GUI_LIBDIR}/MainFrame.cpp ${GUI_LIBDIR}/Plater.cpp ${GUI_LIBDIR}/Plater/Plate2D.cpp + ${GUI_LIBDIR}/Plater/PlaterObject.cpp ${GUI_LIBDIR}/Settings.cpp ${GUI_LIBDIR}/misc_ui.cpp ) diff --git a/src/GUI/Plater.hpp b/src/GUI/Plater.hpp index c74f9d87f..58a25d0a1 100644 --- a/src/GUI/Plater.hpp +++ b/src/GUI/Plater.hpp @@ -14,7 +14,7 @@ #include "Print.hpp" #include "Config.hpp" -#include "Plater/Plater2DObject.hpp" +#include "Plater/PlaterObject.hpp" #include "Plater/Plate2D.hpp" #include "Settings.hpp" @@ -23,7 +23,7 @@ namespace Slic3r { namespace GUI { using UndoOperation = int; using obj_index = unsigned int; -class Plater2DObject; +class PlaterObject; class Plate2D; class Plater : public wxPanel @@ -44,7 +44,7 @@ private: bool processed {false}; - std::vector objects {}; + std::vector objects {}; std::stack undo {}; std::stack redo {}; diff --git a/src/GUI/Plater/Plate2D.cpp b/src/GUI/Plater/Plate2D.cpp index 2f747f2a2..11f863f93 100644 --- a/src/GUI/Plater/Plate2D.cpp +++ b/src/GUI/Plater/Plate2D.cpp @@ -12,7 +12,7 @@ namespace Slic3r { namespace GUI { -Plate2D::Plate2D(wxWindow* parent, const wxSize& size, std::vector& _objects, std::shared_ptr _model, std::shared_ptr _config, std::shared_ptr _settings) : +Plate2D::Plate2D(wxWindow* parent, const wxSize& size, std::vector& _objects, std::shared_ptr _model, std::shared_ptr _config, std::shared_ptr _settings) : wxPanel(parent, wxID_ANY, wxDefaultPosition, size, wxTAB_TRAVERSAL), objects(_objects), model(_model), config(_config), settings(_settings) { diff --git a/src/GUI/Plater/Plate2D.hpp b/src/GUI/Plater/Plate2D.hpp index 01eb01abe..8bab87b7a 100644 --- a/src/GUI/Plater/Plate2D.hpp +++ b/src/GUI/Plater/Plate2D.hpp @@ -11,7 +11,7 @@ #include "Plater.hpp" #include "ColorScheme.hpp" #include "Settings.hpp" -#include "Plater/Plater2DObject.hpp" +#include "Plater/PlaterObject.hpp" #include "misc_ui.hpp" #include "Log.hpp" @@ -31,12 +31,12 @@ enum class MoveDirection { class Plate2D : public wxPanel { public: - Plate2D(wxWindow* parent, const wxSize& size, std::vector& _objects, std::shared_ptr _model, std::shared_ptr _config, std::shared_ptr _settings); + Plate2D(wxWindow* parent, const wxSize& size, std::vector& _objects, std::shared_ptr _model, std::shared_ptr _config, std::shared_ptr _settings); // std::function<> on_select_object {}; private: - std::vector& objects; + std::vector& objects; std::shared_ptr model; std::shared_ptr config; std::shared_ptr settings; diff --git a/src/GUI/Plater/Plater2DObject.hpp b/src/GUI/Plater/Plater2DObject.hpp deleted file mode 100644 index 1bd5b97ba..000000000 --- a/src/GUI/Plater/Plater2DObject.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef PLATER2DOBJECT_HPP -#define PLATER2DOBJECT_HPP - -namespace Slic3r { namespace GUI { -// 2D Preview of an object -class Plater2DObject { -public: - std::string name {""}; - std::string identifier {""}; - bool selected {false}; - int selected_instance {-1}; -}; -} } // Namespace Slic3r::GUI -#endif diff --git a/src/GUI/Plater/PlaterObject.cpp b/src/GUI/Plater/PlaterObject.cpp new file mode 100644 index 000000000..39b6bca3b --- /dev/null +++ b/src/GUI/Plater/PlaterObject.cpp @@ -0,0 +1,50 @@ +#include "Plater/PlaterObject.hpp" + +#include "Geometry.hpp" +#include "ExPolygon.hpp" + +namespace Slic3r { namespace GUI { + +Slic3r::ExPolygonCollection& PlaterObject::make_thumbnail(const Slic3r::Model& model, int obj_index) { + + // make method idempotent + this->thumbnail.clear(); + + auto mesh {model.objects[obj_index]->raw_mesh()}; + auto model_instance {model.objects[obj_idx]->instances[0]}; + + // Apply any x/y rotations and scaling vector if this came from a 3MF object. + mesh.rotate_x(model_instance.x_rotation); + mesh.rotate_y(model_instance.y_rotation); + mesh.scale_xyz(model_instance.scaling_vector); + + if (mesh.facets_count <= 5000) { + auto area_threshold {Slic3r::Geometry::scale(1)}; + ExPolygons tmp {}; + std::copy_if(tmp.end(), mesh.horizontal_projection().begin(), mesh.horizontal_projection().end(), [=](const ExPolygon& p) { return p.area() >= area_threshold; } ); // return all polys bigger than the area + this->thumbnail.append(tmp); + this->thumbnail.simplify(0.5); + } else { + auto convex_hull {Slic3r::ExPolygon(mesh.convex_hull)}; + this->thumbnail.append(convex_hull); + } + + return this->thumbnail; +} +Slic3r::ExPolygonCollection& PlaterObject::transform_thumbnail(Slic3r::Model model, int obj_idx) { + if (this->thumbnail.expolygons.size() == 0) return this->thumbnail; + + const auto& model_object {model.objects[obj_idx] }; + const auto& model_instance {model_object.instances[0]}; + + // the order of these transformations MUST be the same everywhere, including + // in Slic3r::Print->add_model_object() + auto t {this->thumbnail}; + t.rotate(model_instance.rotation(), Slic3r::Point(0,0)); + t.scale(model_instance.scaling_factor()); + + this->transformed_thumbnail = t; + +} + +} } // Namespace Slic3r::GUI diff --git a/src/GUI/Plater/PlaterObject.hpp b/src/GUI/Plater/PlaterObject.hpp new file mode 100644 index 000000000..32709a30c --- /dev/null +++ b/src/GUI/Plater/PlaterObject.hpp @@ -0,0 +1,34 @@ +#ifndef PLATEROBJECT_HPP +#define PLATEROBJECT_HPP +#include +#ifndef WX_PRECOMP + #include +#endif + +#include "ExPolygonCollection.hpp" + +namespace Slic3r { namespace GUI { + +class PlaterObject { +public: + wxString name {L""}; + wxString identifier {L""}; + wxString input_file {L""}; + int input_file_obj_idx {-1}; + + + Slic3r::ExPolygonCollection thumbnail; + Slic3r::ExPolygonCollection transformed_thumbnail; + + // read only + std::vector instance_thumbnails; + + bool selected {false}; + int selected_instance {-1}; + + Slic3r::ExPolygonCollection& make_thumbnail(Slic3r::Model model, int obj_index); + Slic3r::ExPolygonCollection& transform_thumbnail(Slic3r::Model model, int obj_index); +}; + +}} // Namespace Slic3r::GUI +#endif From 1074b04326424732d430abf29aa293203a558de2 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 1 May 2018 22:31:38 -0500 Subject: [PATCH 080/112] Overloaded append() to add single ExPolygons (avoids having to create a vector for no purpose) --- xs/src/libslic3r/ExPolygonCollection.cpp | 5 +++++ xs/src/libslic3r/ExPolygonCollection.hpp | 1 + 2 files changed, 6 insertions(+) diff --git a/xs/src/libslic3r/ExPolygonCollection.cpp b/xs/src/libslic3r/ExPolygonCollection.cpp index 90498a42d..9de1cb786 100644 --- a/xs/src/libslic3r/ExPolygonCollection.cpp +++ b/xs/src/libslic3r/ExPolygonCollection.cpp @@ -135,5 +135,10 @@ ExPolygonCollection::append(const ExPolygons &expp) { this->expolygons.insert(this->expolygons.end(), expp.begin(), expp.end()); } +void +ExPolygonCollection::append(const ExPolygon &expp) +{ + this->expolygons.push_back(expp); +} } diff --git a/xs/src/libslic3r/ExPolygonCollection.hpp b/xs/src/libslic3r/ExPolygonCollection.hpp index 89728c822..57f512336 100644 --- a/xs/src/libslic3r/ExPolygonCollection.hpp +++ b/xs/src/libslic3r/ExPolygonCollection.hpp @@ -33,6 +33,7 @@ class ExPolygonCollection Polygons contours() const; Polygons holes() const; void append(const ExPolygons &expolygons); + void append(const ExPolygon &expolygons); }; inline ExPolygonCollection& From 76b86c807bde33d724048636f9988786753774ce Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 1 May 2018 22:32:09 -0500 Subject: [PATCH 081/112] Implemented make_thumbnail and transform_thumbnail; neither is tested yet. --- src/GUI/Plater/PlaterObject.cpp | 29 +++++++++++++++-------------- src/GUI/Plater/PlaterObject.hpp | 5 +++-- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/GUI/Plater/PlaterObject.cpp b/src/GUI/Plater/PlaterObject.cpp index 39b6bca3b..b27ba821b 100644 --- a/src/GUI/Plater/PlaterObject.cpp +++ b/src/GUI/Plater/PlaterObject.cpp @@ -2,49 +2,50 @@ #include "Geometry.hpp" #include "ExPolygon.hpp" +#include "libslic3r.h" namespace Slic3r { namespace GUI { -Slic3r::ExPolygonCollection& PlaterObject::make_thumbnail(const Slic3r::Model& model, int obj_index) { +Slic3r::ExPolygonCollection& PlaterObject::make_thumbnail(const Slic3r::Model& model, int obj_idx) { // make method idempotent - this->thumbnail.clear(); + this->thumbnail.expolygons.clear(); - auto mesh {model.objects[obj_index]->raw_mesh()}; + auto mesh {model.objects[obj_idx]->raw_mesh()}; auto model_instance {model.objects[obj_idx]->instances[0]}; // Apply any x/y rotations and scaling vector if this came from a 3MF object. - mesh.rotate_x(model_instance.x_rotation); - mesh.rotate_y(model_instance.y_rotation); - mesh.scale_xyz(model_instance.scaling_vector); + mesh.rotate_x(model_instance->x_rotation); + mesh.rotate_y(model_instance->y_rotation); + mesh.scale(model_instance->scaling_vector); - if (mesh.facets_count <= 5000) { - auto area_threshold {Slic3r::Geometry::scale(1)}; + if (mesh.facets_count() <= 5000) { + auto area_threshold {scale_(1.0)}; ExPolygons tmp {}; std::copy_if(tmp.end(), mesh.horizontal_projection().begin(), mesh.horizontal_projection().end(), [=](const ExPolygon& p) { return p.area() >= area_threshold; } ); // return all polys bigger than the area this->thumbnail.append(tmp); this->thumbnail.simplify(0.5); } else { - auto convex_hull {Slic3r::ExPolygon(mesh.convex_hull)}; + auto convex_hull {Slic3r::ExPolygon(mesh.convex_hull())}; this->thumbnail.append(convex_hull); } return this->thumbnail; } -Slic3r::ExPolygonCollection& PlaterObject::transform_thumbnail(Slic3r::Model model, int obj_idx) { +Slic3r::ExPolygonCollection& PlaterObject::transform_thumbnail(const Slic3r::Model& model, int obj_idx) { if (this->thumbnail.expolygons.size() == 0) return this->thumbnail; const auto& model_object {model.objects[obj_idx] }; - const auto& model_instance {model_object.instances[0]}; + const auto& model_instance {model_object->instances[0]}; // the order of these transformations MUST be the same everywhere, including // in Slic3r::Print->add_model_object() auto t {this->thumbnail}; - t.rotate(model_instance.rotation(), Slic3r::Point(0,0)); - t.scale(model_instance.scaling_factor()); + t.rotate(model_instance->rotation, Slic3r::Point(0,0)); + t.scale(model_instance->scaling_factor); this->transformed_thumbnail = t; - + return this->transformed_thumbnail; } } } // Namespace Slic3r::GUI diff --git a/src/GUI/Plater/PlaterObject.hpp b/src/GUI/Plater/PlaterObject.hpp index 32709a30c..72b71d88e 100644 --- a/src/GUI/Plater/PlaterObject.hpp +++ b/src/GUI/Plater/PlaterObject.hpp @@ -6,6 +6,7 @@ #endif #include "ExPolygonCollection.hpp" +#include "Model.hpp" namespace Slic3r { namespace GUI { @@ -26,8 +27,8 @@ public: bool selected {false}; int selected_instance {-1}; - Slic3r::ExPolygonCollection& make_thumbnail(Slic3r::Model model, int obj_index); - Slic3r::ExPolygonCollection& transform_thumbnail(Slic3r::Model model, int obj_index); + Slic3r::ExPolygonCollection& make_thumbnail(const Slic3r::Model& model, int obj_idx); + Slic3r::ExPolygonCollection& transform_thumbnail(const Slic3r::Model& model, int obj_idx); }; }} // Namespace Slic3r::GUI From a9983249622077a68380dd70f3a2f6e1e8992c67 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 1 May 2018 22:32:42 -0500 Subject: [PATCH 082/112] Stubbed out mouse events for left up/down/dclick. --- src/GUI/Plater/Plate2D.cpp | 21 ++++++++++++++++++++- src/GUI/Plater/Plate2D.hpp | 5 ++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/GUI/Plater/Plate2D.cpp b/src/GUI/Plater/Plate2D.cpp index 11f863f93..fb0b172a9 100644 --- a/src/GUI/Plater/Plate2D.cpp +++ b/src/GUI/Plater/Plate2D.cpp @@ -18,6 +18,10 @@ Plate2D::Plate2D(wxWindow* parent, const wxSize& size, std::vector this->Bind(wxEVT_PAINT, [=](wxPaintEvent &e) { this->repaint(e); }); this->Bind(wxEVT_MOTION, [=](wxMouseEvent &e) { this->mouse_drag(e); }); + this->Bind(wxEVT_LEFT_DOWN, [=](wxMouseEvent &e) { this->mouse_down(e); }); + this->Bind(wxEVT_LEFT_UP, [=](wxMouseEvent &e) { this->mouse_up(e); }); + this->Bind(wxEVT_LEFT_DCLICK, [=](wxMouseEvent &e) { this->mouse_dclick(e); }); + if (user_drawn_background) { this->Bind(wxEVT_ERASE_BACKGROUND, [=](wxEraseEvent& e){ }); } @@ -99,13 +103,28 @@ void Plate2D::repaint(wxPaintEvent& e) { } void Plate2D::mouse_drag(wxMouseEvent& e) { + const auto pos {e.GetPosition()}; + const auto& point {this->point_to_model_units(e.GetPosition())}; if (e.Dragging()) { Slic3r::Log::info(LogChannel, L"Mouse dragging"); } else { - Slic3r::Log::info(LogChannel, L"Mouse moving"); + auto cursor = wxSTANDARD_CURSOR; + /* + if (find_first_of(this->objects.begin(), this->objects.end(); [=](const PlaterObject& o) { return o.contour->contains_point(point);} ) == this->object.end()) { + cursor = wxCursor(wxCURSOR_HAND); + } + */ + this->SetCursor(*cursor); } } +void Plate2D::mouse_down(wxMouseEvent& e) { +} +void Plate2D::mouse_up(wxMouseEvent& e) { +} +void Plate2D::mouse_dclick(wxMouseEvent& e) { +} + void Plate2D::set_colors() { this->SetBackgroundColour(settings->color->BACKGROUND255()); diff --git a/src/GUI/Plater/Plate2D.hpp b/src/GUI/Plater/Plate2D.hpp index 8bab87b7a..61c097422 100644 --- a/src/GUI/Plater/Plate2D.hpp +++ b/src/GUI/Plater/Plate2D.hpp @@ -36,7 +36,7 @@ public: // std::function<> on_select_object {}; private: - std::vector& objects; + std::vector& objects; //< reference to parent vector std::shared_ptr model; std::shared_ptr config; std::shared_ptr settings; @@ -60,6 +60,9 @@ private: /// Handle mouse-move events void mouse_drag(wxMouseEvent& e); + void mouse_down(wxMouseEvent& e); + void mouse_up(wxMouseEvent& e); + void mouse_dclick(wxMouseEvent& e); /// Handle repaint events void repaint(wxPaintEvent& e); From 3b17844fbaa91f47ad20c71e3072c3793855009d Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 1 May 2018 22:50:10 -0500 Subject: [PATCH 083/112] partially implemented open_model as a free function in misc_ui. Initial dir and the file patterns are not implemented yet. --- src/GUI/misc_ui.cpp | 19 +++++++++++++++++++ src/GUI/misc_ui.hpp | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/src/GUI/misc_ui.cpp b/src/GUI/misc_ui.cpp index c585117b9..ee1aaeb9d 100644 --- a/src/GUI/misc_ui.cpp +++ b/src/GUI/misc_ui.cpp @@ -1,10 +1,12 @@ #include "misc_ui.hpp" #include #include +#include #include #include + namespace Slic3r { namespace GUI { @@ -110,5 +112,22 @@ sub show_error { } */ +std::vector open_model(wxWindow* parent, const Settings& settings, wxWindow* top) { + auto dialog {new wxFileDialog((parent != nullptr ? parent : top), _("Choose one or more files") + wxString(" (STL/OBJ/AMF/3MF):"), ".", "", + "", wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST)}; + if (dialog->ShowModal() != wxID_OK) { + dialog->Destroy(); + return std::vector(); + } + std::vector tmp; + wxArrayString tmpout; + dialog->GetPaths(tmpout); + for (const auto& i : tmpout) { + tmp.push_back(i); + } + dialog->Destroy(); + return tmp; +} + }} // namespace Slic3r::GUI diff --git a/src/GUI/misc_ui.hpp b/src/GUI/misc_ui.hpp index d40ab729c..d56c52219 100644 --- a/src/GUI/misc_ui.hpp +++ b/src/GUI/misc_ui.hpp @@ -9,6 +9,8 @@ #include #include +#include "Settings.hpp" + #include "Log.hpp" /// Common static (that is, free-standing) functions, not part of an object hierarchy. @@ -98,6 +100,8 @@ sub CallAfter { wxString decode_path(const wxString& in); wxString encode_path(const wxString& in); +std::vector open_model(wxWindow* parent, const Settings& settings, wxWindow* top); + }} // namespace Slic3r::GUI #endif // MISC_UI_HPP From ff1fa38b3154362ad5707c46fe099992a3888b42 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 1 May 2018 22:51:07 -0500 Subject: [PATCH 084/112] Stubbed out load_file, some work on add to call load_file(). Added some comments for canvas2D. --- src/GUI/Plater.cpp | 19 +++++++++++++++++++ src/GUI/Plater.hpp | 9 +++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/GUI/Plater.cpp b/src/GUI/Plater.cpp index 678edfca5..c6eaf0421 100644 --- a/src/GUI/Plater.cpp +++ b/src/GUI/Plater.cpp @@ -109,8 +109,27 @@ Plater::Plater(wxWindow* parent, const wxString& title, std::shared_ptrobject_identifier; + const auto& input_files{open_model(this, *(this->settings), wxTheApp->GetTopWindow())}; + for (const auto& f : input_files) { + Log::info(LogChannel, (wxString(L"Calling Load File for ") + f).ToStdWstring()); + this->load_file(f); + } + + // abort if no objects actually added. + if (start_object_id == this->object_identifier) return; + + // save the added objects + + // get newly added objects count + } +std::vector Plater::load_file(const wxString& file) { + return std::vector(); + +} }} // Namespace Slic3r::GUI diff --git a/src/GUI/Plater.hpp b/src/GUI/Plater.hpp index 58a25d0a1..316c0b034 100644 --- a/src/GUI/Plater.hpp +++ b/src/GUI/Plater.hpp @@ -44,14 +44,19 @@ private: bool processed {false}; - std::vector objects {}; + std::vector objects {}; //< Main object vector. + + size_t object_identifier {0U}; //< Counter for adding objects to Slic3r std::stack undo {}; std::stack redo {}; wxNotebook* preview_notebook {new wxNotebook(this, -1, wxDefaultPosition, wxSize(335,335), wxNB_BOTTOM)}; - Plate2D* canvas2D {}; + Plate2D* canvas2D {}; //< 2D plater canvas + + /// Handles the actual load of the file from the dialog handoff. + std::vector load_file(const wxString& file); const std::string LogChannel {"GUI_Plater"}; //< Which log these messages should go to. From 4d9d2c88dc15104946f89f506561127115e45208 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Wed, 2 May 2018 16:16:19 -0500 Subject: [PATCH 085/112] added file filters to add dialog --- src/GUI/misc_ui.cpp | 2 +- src/GUI/misc_ui.hpp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/GUI/misc_ui.cpp b/src/GUI/misc_ui.cpp index ee1aaeb9d..f04adc8b7 100644 --- a/src/GUI/misc_ui.cpp +++ b/src/GUI/misc_ui.cpp @@ -114,7 +114,7 @@ sub show_error { std::vector open_model(wxWindow* parent, const Settings& settings, wxWindow* top) { auto dialog {new wxFileDialog((parent != nullptr ? parent : top), _("Choose one or more files") + wxString(" (STL/OBJ/AMF/3MF):"), ".", "", - "", wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST)}; + MODEL_WILDCARD, wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST)}; if (dialog->ShowModal() != wxID_OK) { dialog->Destroy(); return std::vector(); diff --git a/src/GUI/misc_ui.hpp b/src/GUI/misc_ui.hpp index d56c52219..e733fe565 100644 --- a/src/GUI/misc_ui.hpp +++ b/src/GUI/misc_ui.hpp @@ -8,6 +8,8 @@ #include #include +#include +#include #include "Settings.hpp" @@ -33,6 +35,23 @@ constexpr bool isDev = true; constexpr bool isDev = false; #endif +// hopefully the compiler is smart enough to figure this out +const std::map FILE_WILDCARDS { + std::make_pair("known", "Known files (*.stl, *.obj, *.amf, *.xml, *.3mf)|*.3mf;*.3MF;*.stl;*.STL;*.obj;*.OBJ;*.amf;*.AMF;*.xml;*.XML"), + std::make_pair("stl", "STL files (*.stl)|*.stl;*.STL"), + std::make_pair("obj", "OBJ files (*.obj)|*.obj;*.OBJ"), + std::make_pair("amf", "AMF files (*.amf)|*.amf;*.AMF;*.xml;*.XML"), + std::make_pair("tmf", "3MF files (*.3mf)|*.3mf;*.3MF"), + std::make_pair("ini", "INI files *.ini|*.ini;*.INI"), + std::make_pair("gcode", "G-code files (*.gcode, *.gco, *.g, *.ngc)|*.gcode;*.GCODE;*.gco;*.GCO;*.g;*.G;*.ngc;*.NGC"), + std::make_pair("svg", "SVG files *.svg|*.svg;*.SVG") + }; + +const std::string MODEL_WILDCARD { FILE_WILDCARDS.at("known") + std::string("|") + FILE_WILDCARDS.at("stl")+ std::string("|") + FILE_WILDCARDS.at("obj") + std::string("|") + FILE_WILDCARDS.at("amf")+ std::string("|") + FILE_WILDCARDS.at("tmf")}; +const std::string STL_MODEL_WILDCARD { FILE_WILDCARDS.at("stl") }; +const std::string AMF_MODEL_WILDCARD { FILE_WILDCARDS.at("amf") }; +const std::string TMF_MODEL_WILDCARD { FILE_WILDCARDS.at("tmf") }; + /// Mostly useful for Linux distro maintainers, this will change where Slic3r assumes /// its ./var directory lives (where its art assets are). From 434fc0aa2ec01e04d252c84c35201053b3d2043a Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Wed, 2 May 2018 22:49:54 -0500 Subject: [PATCH 086/112] Define new event to post status text messages to a status bar; meant for child items to post information to the status bar that propagate up --- src/CMakeLists.txt | 1 + src/GUI/ProgressStatusBar.cpp | 10 ++++++++++ src/GUI/ProgressStatusBar.hpp | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 src/GUI/ProgressStatusBar.cpp create mode 100644 src/GUI/ProgressStatusBar.hpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6f81384a1..cf8958389 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -186,6 +186,7 @@ IF(wxWidgets_FOUND) ${GUI_LIBDIR}/GUI.cpp ${GUI_LIBDIR}/MainFrame.cpp ${GUI_LIBDIR}/Plater.cpp + ${GUI_LIBDIR}/ProgressStatusBar.cpp ${GUI_LIBDIR}/Plater/Plate2D.cpp ${GUI_LIBDIR}/Plater/PlaterObject.cpp ${GUI_LIBDIR}/Settings.cpp diff --git a/src/GUI/ProgressStatusBar.cpp b/src/GUI/ProgressStatusBar.cpp new file mode 100644 index 000000000..8684c2e35 --- /dev/null +++ b/src/GUI/ProgressStatusBar.cpp @@ -0,0 +1,10 @@ +#include "ProgressStatusBar.hpp" + +namespace Slic3r { namespace GUI { + +void ProgressStatusBar::SendStatusText(wxEvtHandler* dest, wxWindowID origin, const wxString& msg) { + wxQueueEvent(dest, new StatusTextEvent(EVT_STATUS_TEXT_POST, origin, msg)); + +} + +}} // Namespace Slic3r::GUI diff --git a/src/GUI/ProgressStatusBar.hpp b/src/GUI/ProgressStatusBar.hpp new file mode 100644 index 000000000..1b690f589 --- /dev/null +++ b/src/GUI/ProgressStatusBar.hpp @@ -0,0 +1,35 @@ +#ifndef PROGRESSSTATUSBAR_HPP +#define PROGRESSSTATUSBAR_HPP +#include +#include + +namespace Slic3r { namespace GUI { + +class StatusTextEvent : public wxEvent { +public: + StatusTextEvent(wxEventType eventType, int winid, const wxString& msg) + : wxEvent(winid, eventType), + message(msg) { } + + bool ShouldPropagate() const { return true; } // propagate this event + + /// One accessor + const wxString& GetMessage() const {return message;} + /// implement the base class pure virtual + virtual wxEvent *Clone() const { return new StatusTextEvent(*this); } + +private: + const wxString message; +}; + +wxDEFINE_EVENT(EVT_STATUS_TEXT_POST, StatusTextEvent); + +class ProgressStatusBar : public wxStatusBar { +public: + //< Post an event to owning box and let it percolate up to a window that sets the appropriate status text. + static void SendStatusText(wxEvtHandler* dest, wxWindowID origin, const wxString& msg); + ProgressStatusBar(wxWindow* parent, int id) : wxStatusBar(parent, id) { } +}; + +}} // Namespace Slic3r::GUI +#endif // PROGRESSSTATUSBAR_HPP From 131e6d8d8d7b873791bd07d99d2d684ab302c7d9 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Wed, 2 May 2018 22:50:22 -0500 Subject: [PATCH 087/112] Initial load status bar, apparently layout broke for plater. --- src/GUI/MainFrame.cpp | 9 ++++----- src/GUI/MainFrame.hpp | 3 +++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/GUI/MainFrame.cpp b/src/GUI/MainFrame.cpp index 8c1d3c0e4..029471f49 100644 --- a/src/GUI/MainFrame.cpp +++ b/src/GUI/MainFrame.cpp @@ -28,11 +28,10 @@ MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& si wxToolTip::SetAutoPop(TOOLTIP_TIMER); - // STUB: Initialize status bar with text. - /* # initialize status bar - $self->{statusbar} = Slic3r::GUI::ProgressStatusBar->new($self, -1); - $self->{statusbar}->SetStatusText("Version $Slic3r::VERSION - Remember to check for updates at http://slic3r.org/"); - $self->SetStatusBar($self->{statusbar}); */ + // initialize status bar + this->statusbar = new ProgressStatusBar(this, -1); + this->statusbar->SetStatusText("Version $Slic3r::VERSION - Remember to check for updates at http://slic3r.org/"); + this->SetStatusBar(this->statusbar); this->loaded = 1; diff --git a/src/GUI/MainFrame.hpp b/src/GUI/MainFrame.hpp index b067c6f9b..b073d0c48 100644 --- a/src/GUI/MainFrame.hpp +++ b/src/GUI/MainFrame.hpp @@ -17,6 +17,7 @@ #include "PresetEditor.hpp" #include "Settings.hpp" #include "GUI.hpp" +#include "ProgressStatusBar.hpp" namespace Slic3r { namespace GUI { @@ -47,6 +48,8 @@ private: std::shared_ptr gui_config; std::map preset_editor_tabs; + ProgressStatusBar* statusbar {new ProgressStatusBar(this, -1)}; + }; }} // Namespace Slic3r::GUI From 33d2232f0987081f1fc7052bad8071742dca677a Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Wed, 2 May 2018 22:51:08 -0500 Subject: [PATCH 088/112] stubbed in load_model_objects, load_file should be implemented now. --- src/GUI/Plater.cpp | 80 ++++++++++++++++++++++++++++++++++++++++++-- src/GUI/Plater.hpp | 8 ++++- src/GUI/Settings.hpp | 2 ++ 3 files changed, 87 insertions(+), 3 deletions(-) diff --git a/src/GUI/Plater.cpp b/src/GUI/Plater.cpp index c6eaf0421..51f684df9 100644 --- a/src/GUI/Plater.cpp +++ b/src/GUI/Plater.cpp @@ -1,6 +1,9 @@ #include +#include + #include "Plater.hpp" +#include "ProgressStatusBar.hpp" #include "Log.hpp" namespace Slic3r { namespace GUI { @@ -126,9 +129,82 @@ void Plater::add() { } -std::vector Plater::load_file(const wxString& file) { - return std::vector(); +std::vector Plater::load_file(const wxString& file, const int obj_idx_to_load) { + auto input_file {wxFileName(file)}; + settings->skein_directory = input_file.GetPath(); + settings->save_settings(); + + Slic3r::Model model; + bool valid_load {true}; + + auto obj_idx {std::vector()}; + auto progress_dialog {new wxProgressDialog(_(L"Loading…"), _(L"Processing input file…"), 100, this, 0)}; + progress_dialog->Pulse(); + //TODO: Add a std::wstring so we can handle non-roman characters as file names. + try { + auto model {Slic3r::Model::read_from_file(file.ToStdString())}; + } catch (std::runtime_error& e) { + show_error(this, e.what()); + valid_load = false; + } + + if (valid_load) { + if (model.looks_like_multipart_object()) { + auto dialog {new wxMessageDialog(this, + _("This file contains several objects positioned at multiple heights. Instead of considering them as multiple objects, should I consider\n them this file as a single object having multiple parts?\n"), _("Multi-part object detected"), wxICON_WARNING | wxYES | wxNO)}; + if (dialog->ShowModal() == wxID_YES) { + model.convert_multipart_object(); + } + } + + for (auto i = 0U; i < model.objects.size(); i++) { + auto object {model.objects[i]}; + object->input_file = file.ToStdString(); + for (auto j = 0U; j < object->volumes.size(); j++) { + auto volume {object->volumes.at(j)}; + volume->input_file = file.ToStdString(); + volume->input_file_obj_idx = i; + volume->input_file_vol_idx = j; + } + } + auto i {0U}; + if (obj_idx_to_load > 0) { + const size_t idx_load = obj_idx_to_load; + if (idx_load >= model.objects.size()) return std::vector(); + obj_idx = this->load_model_objects(model.objects.at(idx_load)); + i = idx_load; + } else { + obj_idx = this->load_model_objects(model.objects); + } + + for (const auto &j : obj_idx) { + this->objects[j].input_file = file; + this->objects[j].input_file_obj_idx = i++; + } + ProgressStatusBar::SendStatusText(this, this->GetId(), _("Loaded ") + input_file.GetName()); + + if (this->scaled_down) { + ProgressStatusBar::SendStatusText(this, this->GetId(), _("Your object appears to be too large, so it was automatically scaled down to fit your print bed.")); + } + if (this->outside_bounds) { + ProgressStatusBar::SendStatusText(this, this->GetId(), _("Some of your object(s) appear to be outside the print bed. Use the arrange button to correct this.")); + } + } + + progress_dialog->Destroy(); + this->redo = std::stack(); + return obj_idx; +} + + + +std::vector Plater::load_model_objects(ModelObject* model_object) { + ModelObjectPtrs tmp {model_object}; // wrap in a std::vector + return load_model_objects(tmp); +} +std::vector Plater::load_model_objects(ModelObjectPtrs model_objects) { + return std::vector(); } }} // Namespace Slic3r::GUI diff --git a/src/GUI/Plater.hpp b/src/GUI/Plater.hpp index 316c0b034..9bc5165db 100644 --- a/src/GUI/Plater.hpp +++ b/src/GUI/Plater.hpp @@ -56,10 +56,16 @@ private: Plate2D* canvas2D {}; //< 2D plater canvas /// Handles the actual load of the file from the dialog handoff. - std::vector load_file(const wxString& file); + std::vector load_file(const wxString& file, const int obj_idx_to_load = -1); const std::string LogChannel {"GUI_Plater"}; //< Which log these messages should go to. + std::vector load_model_objects(ModelObject* model_object); + std::vector load_model_objects(ModelObjectPtrs model_objects); + + bool scaled_down {false}; + bool outside_bounds {false}; + }; diff --git a/src/GUI/Settings.hpp b/src/GUI/Settings.hpp index c74383084..854a88683 100644 --- a/src/GUI/Settings.hpp +++ b/src/GUI/Settings.hpp @@ -46,6 +46,8 @@ class Settings { const wxString version { wxString(SLIC3R_VERSION) }; + wxString skein_directory {}; //< Recently-opened skien directory. + void save_settings(); void load_settings(); From 2bab9f27e12cc27faff7b6728e5dbcfb4325ae7d Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Thu, 3 May 2018 07:55:41 -0500 Subject: [PATCH 089/112] Moved statusbar up to public (allow children to manipulate the statusbar) --- src/GUI/MainFrame.hpp | 4 ++-- src/GUI/Plater.cpp | 11 ++++++++--- src/GUI/Plater.hpp | 4 ++++ src/GUI/ProgressStatusBar.cpp | 5 ----- src/GUI/ProgressStatusBar.hpp | 22 +--------------------- 5 files changed, 15 insertions(+), 31 deletions(-) diff --git a/src/GUI/MainFrame.hpp b/src/GUI/MainFrame.hpp index b073d0c48..1838114bb 100644 --- a/src/GUI/MainFrame.hpp +++ b/src/GUI/MainFrame.hpp @@ -21,7 +21,7 @@ namespace Slic3r { namespace GUI { - +class Plater; constexpr unsigned int TOOLTIP_TIMER = 32767; @@ -30,6 +30,7 @@ class MainFrame: public wxFrame public: MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size); MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size, std::shared_ptr _gui_config); + ProgressStatusBar* statusbar {new ProgressStatusBar(this, -1)}; private: wxDECLARE_EVENT_TABLE(); @@ -48,7 +49,6 @@ private: std::shared_ptr gui_config; std::map preset_editor_tabs; - ProgressStatusBar* statusbar {new ProgressStatusBar(this, -1)}; }; diff --git a/src/GUI/Plater.cpp b/src/GUI/Plater.cpp index 51f684df9..623299215 100644 --- a/src/GUI/Plater.cpp +++ b/src/GUI/Plater.cpp @@ -1,10 +1,12 @@ #include #include +#include #include "Plater.hpp" #include "ProgressStatusBar.hpp" #include "Log.hpp" +#include "MainFrame.hpp" namespace Slic3r { namespace GUI { @@ -182,13 +184,13 @@ std::vector Plater::load_file(const wxString& file, const int obj_idx_to_lo this->objects[j].input_file = file; this->objects[j].input_file_obj_idx = i++; } - ProgressStatusBar::SendStatusText(this, this->GetId(), _("Loaded ") + input_file.GetName()); + GetFrame()->statusbar->SetStatusText(_("Loaded ") + input_file.GetName()); if (this->scaled_down) { - ProgressStatusBar::SendStatusText(this, this->GetId(), _("Your object appears to be too large, so it was automatically scaled down to fit your print bed.")); + GetFrame()->statusbar->SetStatusText(_("Your object appears to be too large, so it was automatically scaled down to fit your print bed.")); } if (this->outside_bounds) { - ProgressStatusBar::SendStatusText(this, this->GetId(), _("Some of your object(s) appear to be outside the print bed. Use the arrange button to correct this.")); + GetFrame()->statusbar->SetStatusText(_("Some of your object(s) appear to be outside the print bed. Use the arrange button to correct this.")); } } @@ -207,5 +209,8 @@ std::vector Plater::load_model_objects(ModelObjectPtrs model_objects) { return std::vector(); } +MainFrame* Plater::GetFrame() { return dynamic_cast(wxGetTopLevelParent(this)); } + + }} // Namespace Slic3r::GUI diff --git a/src/GUI/Plater.hpp b/src/GUI/Plater.hpp index 9bc5165db..5068e788e 100644 --- a/src/GUI/Plater.hpp +++ b/src/GUI/Plater.hpp @@ -18,6 +18,8 @@ #include "Plater/Plate2D.hpp" #include "Settings.hpp" +#include "MainFrame.hpp" + namespace Slic3r { namespace GUI { using UndoOperation = int; @@ -25,6 +27,7 @@ using obj_index = unsigned int; class PlaterObject; class Plate2D; +class MainFrame; class Plater : public wxPanel { @@ -65,6 +68,7 @@ private: bool scaled_down {false}; bool outside_bounds {false}; + MainFrame* GetFrame(); }; diff --git a/src/GUI/ProgressStatusBar.cpp b/src/GUI/ProgressStatusBar.cpp index 8684c2e35..24822748b 100644 --- a/src/GUI/ProgressStatusBar.cpp +++ b/src/GUI/ProgressStatusBar.cpp @@ -2,9 +2,4 @@ namespace Slic3r { namespace GUI { -void ProgressStatusBar::SendStatusText(wxEvtHandler* dest, wxWindowID origin, const wxString& msg) { - wxQueueEvent(dest, new StatusTextEvent(EVT_STATUS_TEXT_POST, origin, msg)); - -} - }} // Namespace Slic3r::GUI diff --git a/src/GUI/ProgressStatusBar.hpp b/src/GUI/ProgressStatusBar.hpp index 1b690f589..f2984691b 100644 --- a/src/GUI/ProgressStatusBar.hpp +++ b/src/GUI/ProgressStatusBar.hpp @@ -5,29 +5,9 @@ namespace Slic3r { namespace GUI { -class StatusTextEvent : public wxEvent { -public: - StatusTextEvent(wxEventType eventType, int winid, const wxString& msg) - : wxEvent(winid, eventType), - message(msg) { } - - bool ShouldPropagate() const { return true; } // propagate this event - - /// One accessor - const wxString& GetMessage() const {return message;} - /// implement the base class pure virtual - virtual wxEvent *Clone() const { return new StatusTextEvent(*this); } - -private: - const wxString message; -}; - -wxDEFINE_EVENT(EVT_STATUS_TEXT_POST, StatusTextEvent); - class ProgressStatusBar : public wxStatusBar { public: - //< Post an event to owning box and let it percolate up to a window that sets the appropriate status text. - static void SendStatusText(wxEvtHandler* dest, wxWindowID origin, const wxString& msg); + /// Constructor stub from parent ProgressStatusBar(wxWindow* parent, int id) : wxStatusBar(parent, id) { } }; From e263ca2b3862d5a55e8bdad120fb41d37f1244be Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Fri, 4 May 2018 22:35:20 -0500 Subject: [PATCH 090/112] Stubbed out save_window_pos --- src/GUI/Settings.cpp | 3 +++ src/GUI/Settings.hpp | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/GUI/Settings.cpp b/src/GUI/Settings.cpp index 8affa6886..8354c54d4 100644 --- a/src/GUI/Settings.cpp +++ b/src/GUI/Settings.cpp @@ -10,6 +10,9 @@ sub save_settings { } */ + } +void Settings::save_window_pos(wxWindow* ref, wxString name) { +} }} // namespace Slic3r::GUI diff --git a/src/GUI/Settings.hpp b/src/GUI/Settings.hpp index 854a88683..0b35f62e7 100644 --- a/src/GUI/Settings.hpp +++ b/src/GUI/Settings.hpp @@ -54,6 +54,8 @@ class Settings { /// Storage for window positions std::map > window_pos { std::map >() }; + void save_window_pos(wxWindow* ref, wxString name); + private: const std::string LogChannel {"GUI_Settings"}; //< Which log these messages should go to. From c68cadbefa3e2eefd89c6b71e8313c34d7110c79 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Fri, 4 May 2018 22:35:47 -0500 Subject: [PATCH 091/112] Properly pull slic3r version string from libslic3r --- src/GUI/MainFrame.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/GUI/MainFrame.cpp b/src/GUI/MainFrame.cpp index 029471f49..fe7fba502 100644 --- a/src/GUI/MainFrame.cpp +++ b/src/GUI/MainFrame.cpp @@ -4,6 +4,7 @@ #include #include "AboutDialog.hpp" +#include "libslic3r.h" namespace Slic3r { namespace GUI { @@ -29,8 +30,11 @@ MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& si wxToolTip::SetAutoPop(TOOLTIP_TIMER); // initialize status bar + // we call SetStatusBar() here because MainFrame is the direct owner. this->statusbar = new ProgressStatusBar(this, -1); - this->statusbar->SetStatusText("Version $Slic3r::VERSION - Remember to check for updates at http://slic3r.org/"); + wxString welcome_text {_("Version SLIC3R_VERSION_REPLACE - Remember to check for updates at http://slic3r.org/")}; + welcome_text.Replace("SLIC3R_VERSION_REPLACE", wxString(SLIC3R_VERSION)); + this->statusbar->SetStatusText(welcome_text); this->SetStatusBar(this->statusbar); this->loaded = 1; From 85bfd86bb3f8cdefa8f6e6a5bf91b2310dfa4329 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Fri, 4 May 2018 22:39:28 -0500 Subject: [PATCH 092/112] Handle wxEVT_WINDOW_CLOSE --- src/GUI/MainFrame.cpp | 30 +++++++++++++++++++----------- src/GUI/Plater.hpp | 2 ++ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/GUI/MainFrame.cpp b/src/GUI/MainFrame.cpp index fe7fba502..0c95505c9 100644 --- a/src/GUI/MainFrame.cpp +++ b/src/GUI/MainFrame.cpp @@ -51,17 +51,14 @@ MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& si this->Show(); this->Layout(); } -/* - # declare events - EVT_CLOSE($self, sub { - my (undef, $event) = @_; - - if ($event->CanVeto) { - if (!$self->{plater}->prompt_unsaved_changes) { - $event->Veto; + // Set up event handlers. + this->Bind(wxEVT_CLOSE_WINDOW, [=](wxCloseEvent& e) { + if (e.CanVeto()) { + if (!this->plater->prompt_unsaved_changes()) { + e.Veto(); return; } - + /* if ($self->{controller} && $self->{controller}->printing) { my $confirm = Wx::MessageDialog->new($self, "You are currently printing. Do you want to stop printing and continue anyway?", 'Unfinished Print', wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT); @@ -70,10 +67,21 @@ MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& si return; } } + + */ + // save window size + gui_config->save_window_pos(this, "main_frame"); + + // Propagate event + e.Skip(); } + }); +/* + # declare events + EVT_CLOSE($self, sub { + my (undef, $event) = @_; + - # save window size - wxTheApp->save_window_pos($self, "main_frame"); # propagate event $event->Skip; diff --git a/src/GUI/Plater.hpp b/src/GUI/Plater.hpp index 5068e788e..ecbec1048 100644 --- a/src/GUI/Plater.hpp +++ b/src/GUI/Plater.hpp @@ -35,6 +35,8 @@ public: Plater(wxWindow* parent, const wxString& title, std::shared_ptr _settings); void add(); + /// Ask if there are any unsaved changes. + bool prompt_unsaved_changes() { return true; } private: std::shared_ptr print {std::make_shared(Slic3r::Print())}; std::shared_ptr model {std::make_shared(Slic3r::Model())}; From c012ea6a00d3c036ada8f1385802a3d64af2b854 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Fri, 4 May 2018 22:46:50 -0500 Subject: [PATCH 093/112] Implemented ProgressStatusBar --- src/GUI/ProgressStatusBar.cpp | 59 ++++++++++++++++++++++++++++++++++- src/GUI/ProgressStatusBar.hpp | 45 +++++++++++++++++++++++++- src/GUI/misc_ui.hpp | 5 +++ 3 files changed, 107 insertions(+), 2 deletions(-) diff --git a/src/GUI/ProgressStatusBar.cpp b/src/GUI/ProgressStatusBar.cpp index 24822748b..ceb909af8 100644 --- a/src/GUI/ProgressStatusBar.cpp +++ b/src/GUI/ProgressStatusBar.cpp @@ -1,5 +1,62 @@ #include "ProgressStatusBar.hpp" - +#include "misc_ui.hpp" namespace Slic3r { namespace GUI { +ProgressStatusBar::ProgressStatusBar(wxWindow* parent, int id) : wxStatusBar(parent, id) { + this->prog->Hide(); + this->cancelbutton->Hide(); + + this->SetFieldsCount(3); + const int tmpWidths[] {-1, 150, 155}; // need to make the array ahead of time in C++ + this->SetStatusWidths(3, tmpWidths); + + // Assign events. + this->Bind(wxEVT_TIMER, [=](wxTimerEvent& e){this->OnTimer(e);}); + this->Bind(wxEVT_SIZE, [=](wxSizeEvent& e){this->OnSize(e);}); + this->Bind(wxEVT_BUTTON, [=](wxCommandEvent& e) { this->cancel_cb(); this->cancelbutton->Hide();}); +} + +ProgressStatusBar::~ProgressStatusBar() { + if (this->timer != nullptr) { + if (this->timer->IsRunning()) + this->timer->Stop(); + } +} + +/// wxPerl version of this used a impromptu hashmap and a loop +/// which more impractical here. +/// Opportunity to refactor here. +void ProgressStatusBar::OnSize(wxSizeEvent &e) { + + // position 0 is reserved for status text + // position 1 is cancel button + // position 2 is prog + + { + wxRect rect; + this->GetFieldRect(1, rect); + const auto& offset = ( wxGTK ? 1 : 0); // cosmetic 1px offset on wxgtk + const auto& pos {wxPoint(rect.x + offset, rect.y + offset)}; + this->cancelbutton->Move(pos); + this->cancelbutton->SetSize(rect.GetWidth() - offset, rect.GetHeight()); + } + + { + wxRect rect; + this->GetFieldRect(2, rect); + const auto& offset = ( wxGTK ? 1 : 0); // cosmetic 1px offset on wxgtk + const auto& pos {wxPoint(rect.x + offset, rect.y + offset)}; + this->prog->Move(pos); + this->prog->SetSize(rect.GetWidth() - offset, rect.GetHeight()); + } + e.Skip(); +} + +void ProgressStatusBar::OnTimer(wxTimerEvent& e) { + if (this->prog->IsShown()) + this->timer->Stop(); + if (this->busy) + this->prog->Pulse(); +} + }} // Namespace Slic3r::GUI diff --git a/src/GUI/ProgressStatusBar.hpp b/src/GUI/ProgressStatusBar.hpp index f2984691b..44e6dd60c 100644 --- a/src/GUI/ProgressStatusBar.hpp +++ b/src/GUI/ProgressStatusBar.hpp @@ -2,13 +2,56 @@ #define PROGRESSSTATUSBAR_HPP #include #include +#include +#include +#include namespace Slic3r { namespace GUI { class ProgressStatusBar : public wxStatusBar { public: /// Constructor stub from parent - ProgressStatusBar(wxWindow* parent, int id) : wxStatusBar(parent, id) { } + ProgressStatusBar(wxWindow* parent, int id); + + /// Stop any running timers before destruction. + ~ProgressStatusBar(); + + /// + wxTimer* timer {new wxTimer(this)}; + + /// Progress bar + wxGauge* prog {new wxGauge(this, wxGA_HORIZONTAL, 100, wxDefaultPosition, wxDefaultSize)}; + + /// General cancel button. Using applications can assign functions to it. + wxButton* cancelbutton {new wxButton(this, -1, _("Cancel"), wxDefaultPosition, wxDefaultSize)}; + + /// Set callback function for cancel button press. + void SetCancelCallback(std::function cb) { + this->cancel_cb = cb; + cb == nullptr ? this->cancelbutton->Hide() : this->cancelbutton->Show(); + } + + /// Accessor function for the current value of the progress bar + size_t GetProgress() {return this->prog->GetValue();} + + /// Accessor function for busy state + bool IsBusy() {return this->busy;} + + /// Show the progress bar. + void ShowProgress(bool show = true) { this->prog->Show(show); this->prog->Pulse(); } + + void SetRange(int range) { if (range != this->prog->GetRange() ) this->prog->SetRange(range);} + +private: + void OnSize(wxSizeEvent& e); + void OnTimer(wxTimerEvent& e); + void Run(int rate = 100) { if (this->timer->IsRunning()) this->timer->Start(rate);}; + + // Cancel callback function + std::function cancel_cb {[](){;}}; + + bool busy {false}; + }; }} // Namespace Slic3r::GUI diff --git a/src/GUI/misc_ui.hpp b/src/GUI/misc_ui.hpp index e733fe565..90ad19070 100644 --- a/src/GUI/misc_ui.hpp +++ b/src/GUI/misc_ui.hpp @@ -27,6 +27,11 @@ constexpr OS the_os = OS::Windows; constexpr OS the_os = OS::Mac; #elif __linux__ constexpr OS the_os = OS::Linux; + #ifdef __WXGTK__ + constexpr bool wxGTK {true}; + #else + constexpr bool wxGTK {false}; + #endif #endif #ifdef SLIC3R_DEV From e2fdb00bb0f8379bdf5a3554f696925897b653f4 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Fri, 4 May 2018 22:47:06 -0500 Subject: [PATCH 094/112] removed commented Perl code from MainFrame --- src/GUI/MainFrame.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/GUI/MainFrame.cpp b/src/GUI/MainFrame.cpp index 0c95505c9..82e2b0f09 100644 --- a/src/GUI/MainFrame.cpp +++ b/src/GUI/MainFrame.cpp @@ -76,17 +76,6 @@ MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& si e.Skip(); } }); -/* - # declare events - EVT_CLOSE($self, sub { - my (undef, $event) = @_; - - - - # propagate event - $event->Skip; - }); -*/ } /// Private initialization function for the main frame tab panel. From 9235a52dceca4f285f207700ee24f69ea0c49125 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Fri, 4 May 2018 22:47:49 -0500 Subject: [PATCH 095/112] stubbed out Plater::select_object() and uncommented its use in a lambda being assigned to on_select_object. --- src/GUI/Plater.cpp | 4 ++-- src/GUI/Plater.hpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/GUI/Plater.cpp b/src/GUI/Plater.cpp index 623299215..3ac360799 100644 --- a/src/GUI/Plater.cpp +++ b/src/GUI/Plater.cpp @@ -22,8 +22,8 @@ Plater::Plater(wxWindow* parent, const wxString& title, std::shared_ptrselect_object(obj_idx); + auto on_select_object { [=](size_t& obj_idx) { + this->select_object(obj_idx); } }; /* # Initialize handlers for canvases diff --git a/src/GUI/Plater.hpp b/src/GUI/Plater.hpp index ecbec1048..726040892 100644 --- a/src/GUI/Plater.hpp +++ b/src/GUI/Plater.hpp @@ -72,6 +72,8 @@ private: bool outside_bounds {false}; MainFrame* GetFrame(); + void select_object(size_t& obj_idx) { }; + }; From ea94cb750682bad0bf457f188fc2378c9b208756 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Fri, 4 May 2018 23:20:03 -0500 Subject: [PATCH 096/112] Fleshed out a StartBusy() function and moved Run to be public. Also added functional as a header. --- src/GUI/ProgressStatusBar.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/GUI/ProgressStatusBar.hpp b/src/GUI/ProgressStatusBar.hpp index 44e6dd60c..dfb792e8b 100644 --- a/src/GUI/ProgressStatusBar.hpp +++ b/src/GUI/ProgressStatusBar.hpp @@ -5,6 +5,7 @@ #include #include #include +#include namespace Slic3r { namespace GUI { @@ -42,10 +43,14 @@ public: void SetRange(int range) { if (range != this->prog->GetRange() ) this->prog->SetRange(range);} + /// Start the timer. + void Run(int rate = 100) { if (this->timer->IsRunning()) this->timer->Start(rate);}; + + void StartBusy(int rate = 100) { this->busy = true; this->ShowProgress(true); if (!this->timer->IsRunning()) this->timer->Start(rate); } + private: void OnSize(wxSizeEvent& e); void OnTimer(wxTimerEvent& e); - void Run(int rate = 100) { if (this->timer->IsRunning()) this->timer->Start(rate);}; // Cancel callback function std::function cancel_cb {[](){;}}; From 25d9c110a6b025736bd2856e69e084f297340b32 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Fri, 4 May 2018 23:39:38 -0500 Subject: [PATCH 097/112] ripped out most of the perl-dependent stuff from Slic3r's archive build script on Linux (do less useless stuff on Travis). --- package/linux/appimage.sh | 4 +--- package/linux/libpaths.txt | 5 ----- package/linux/make_archive.sh | 42 +++-------------------------------- 3 files changed, 4 insertions(+), 47 deletions(-) diff --git a/package/linux/appimage.sh b/package/linux/appimage.sh index 3a68b5e17..05e61f909 100755 --- a/package/linux/appimage.sh +++ b/package/linux/appimage.sh @@ -32,7 +32,7 @@ cd $WD/${APP}.AppDir mkdir -p $WD/${APP}.AppDir/usr/bin # Copy primary Slic3r script here and perl-local, as well as var -for i in {var,slic3r.pl,perl-local}; do +for i in {var,Slic3r}; do cp -R $srcfolder/$i $WD/${APP}.AppDir/usr/bin/ done @@ -48,8 +48,6 @@ for i in $(cat $WD/libpaths.appimage.txt | grep -v "^#" | awk -F# '{print $1}'); done -cp -R $srcfolder/local-lib ${WD}/${APP}.AppDir/usr/lib/local-lib - cat > $WD/${APP}.AppDir/AppRun << 'EOF' #!/usr/bin/env bash # some magic to find out the real location of this script dealing with symlinks diff --git a/package/linux/libpaths.txt b/package/linux/libpaths.txt index ef876a13a..3c64c9758 100644 --- a/package/linux/libpaths.txt +++ b/package/linux/libpaths.txt @@ -1,8 +1,3 @@ -/home/travis/builds/alexrj/Slic3r/local-lib/lib/perl5/x86_64-linux-thread-multi/Alien/wxWidgets/gtk_3_0_2_uni/lib/libwx_baseu-3.0.so.0 -/home/travis/builds/alexrj/Slic3r/local-lib/lib/perl5/x86_64-linux-thread-multi/Alien/wxWidgets/gtk_3_0_2_uni/lib/libwx_gtk2u_adv-3.0.so.0 -/home/travis/builds/alexrj/Slic3r/local-lib/lib/perl5/x86_64-linux-thread-multi/Alien/wxWidgets/gtk_3_0_2_uni/lib/libwx_gtk2u_core-3.0.so.0 -/home/travis/builds/alexrj/Slic3r/local-lib/lib/perl5/x86_64-linux-thread-multi/Alien/wxWidgets/gtk_3_0_2_uni/lib/libwx_gtk2u_gl-3.0.so.0 -/home/travis/builds/alexrj/Slic3r/local-lib/lib/perl5/x86_64-linux-thread-multi/Alien/wxWidgets/gtk_3_0_2_uni/lib/libwx_gtk2u_html-3.0.so.0 /lib/x86_64-linux-gnu/liblzma.so.5 /lib/x86_64-linux-gnu/libpng12.so.0 /usr/lib/x86_64-linux-gnu/libjpeg.so.8 diff --git a/package/linux/make_archive.sh b/package/linux/make_archive.sh index ad87b2a06..3eaf8b601 100755 --- a/package/linux/make_archive.sh +++ b/package/linux/make_archive.sh @@ -10,7 +10,6 @@ if [ "$#" -ne 1 ]; then echo "Usage: $(basename $0) arch_name" exit 1; fi -libdirs=$(find ./local-lib -iname *.so -exec dirname {} \; | sort -u | paste -sd ";" -) WD=./$(dirname $0) source $(dirname $0)/../common/util.sh # Determine if this is a tagged (release) commit. @@ -22,7 +21,6 @@ set_build_id set_branch set_app_name set_pr_id -install_par # If we're on a branch, add the branch name to the app name. if [ "$current_branch" == "master" ]; then @@ -35,8 +33,7 @@ else dmgfile=slic3r-${SLIC3R_BUILD_ID}-${1}-${current_branch}.tar.bz2 fi -rm -rf $WD/_tmp -mkdir -p $WD/_tmp +mkdir -p $WD # Set the application folder infomation. appfolder="$WD/${appname}" @@ -46,8 +43,6 @@ resourcefolder=$appfolder echo "Appfolder: $appfolder, archivefolder: $archivefolder" # Our slic3r dir and location of perl -PERL_BIN=$(which perl) -PP_BIN=$(which pp) SLIC3R_DIR="./" if [[ -d "${appfolder}" ]]; then @@ -67,14 +62,12 @@ echo "Copying resources..." cp -rf $SLIC3R_DIR/var $resourcefolder/ echo "Copying Slic3r..." -cp $SLIC3R_DIR/slic3r.pl $archivefolder/slic3r.pl -cp -fRP $SLIC3R_DIR/local-lib $archivefolder/local-lib -cp -fRP $SLIC3R_DIR/lib/* $archivefolder/local-lib/lib/perl5/ +cp $SLIC3R_DIR/slic3r $archivefolder/Slic3r mkdir $archivefolder/bin echo "Installing libraries to $archivefolder/bin ..." if [ -z ${WXDIR+x} ]; then - for bundle in $(find $archivefolder/local-lib/lib/perl5 -name '*.so' | grep "Wx") $(find $archivefolder/local-lib/lib/perl5 -name '*.so' -type f | grep "wxWidgets"); do + for bundle in $archivefolder/Slic3r; do echo "$(LD_LIBRARY_PATH=$libdirs ldd $bundle | grep .so | grep local-lib | awk '{print $3}')" for dylib in $(LD_LIBRARY_PATH=$libdirs ldd $bundle | grep .so | grep local-lib | awk '{print $3}'); do install -v $dylib $archivefolder/bin @@ -91,37 +84,8 @@ echo "Copying startup script..." cp -f $WD/startup_script.sh $archivefolder/$appname chmod +x $archivefolder/$appname -echo "Copying perl from $PERL_BIN" -# Edit package/common/coreperl to add/remove core Perl modules added to this package, one per line. -cp -f $PERL_BIN $archivefolder/perl-local -${PP_BIN} wxextension .0 \ - -M $(grep -v "^#" ${WD}/../common/coreperl | xargs | awk 'BEGIN { OFS=" -M "}; {$1=$1; print $0}') \ - -B -p -e "print 123" -o $WD/_tmp/test.par -unzip -qq -o $WD/_tmp/test.par -d $WD/_tmp/ -cp -rf $WD/_tmp/lib/* $archivefolder/local-lib/lib/perl5/ -cp -rf $WD/_tmp/shlib $archivefolder/ -rm -rf $WD/_tmp for i in $(cat $WD/libpaths.txt | grep -v "^#" | awk -F# '{print $1}'); do install -v $i $archivefolder/bin done -echo "Cleaning local-lib" -rm -rf $archivefolder/local-lib/bin -rm -rf $archivefolder/local-lib/man -rm -f $archivefolder/local-lib/lib/perl5/Algorithm/*.pl -rm -rf $archivefolder/local-lib/lib/perl5/unicore -rm -rf $archivefolder/local-lib/lib/perl5/App -rm -rf $archivefolder/local-lib/lib/perl5/Devel/CheckLib.pm -rm -rf $archivefolder/local-lib/lib/perl5/ExtUtils -rm -rf $archivefolder/local-lib/lib/perl5/Module/Build* -rm -rf $(pwd)$archivefolder/local-lib/lib/perl5/TAP -rm -rf $(pwd)/$archivefolder/local-lib/lib/perl5/Test* -find $(pwd)/$archivefolder/local-lib -type d -path '*/Wx/*' \( -name WebView \ - -or -name DocView -or -name STC -or -name IPC \ - -or -name Calendar -or -name DataView \ - -or -name DateTime -or -name Media -or -name PerlTest \ - -or -name Ribbon \) -exec rm -rf "{}" \; -rm -rf $archivefolder/local-lib/lib/perl5/*/Alien/wxWidgets/*/include -find $archivefolder/local-lib -depth -type d -empty -exec rmdir "{}" \; - tar -C$(pwd)/$(dirname $appfolder) -cjf $(pwd)/$dmgfile "$appname" From 46edadb0cd271e514bbaa585a7ecdc070b5789a4 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Fri, 4 May 2018 23:52:25 -0500 Subject: [PATCH 098/112] Look for static wxwidgets and static boost if SLIC3R_STATIC is defined. --- src/CMakeLists.txt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cf8958389..86753350d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -24,8 +24,14 @@ ELSE(CMAKE_HOST_APPLE) # set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -L.") ENDIF(CMAKE_HOST_APPLE) -set(Boost_USE_STATIC_LIBS OFF) -set(Boost_USE_STATIC_RUNTIME OFF) +if(DEFINED ENV{SLIC3R_STATIC}) + set(Boost_USE_STATIC_LIBS ON) + set(Boost_USE_STATIC_RUNTIME ON) +else(DEFINED ENV{SLIC3R_STATIC}) + set(Boost_USE_STATIC_LIBS OFF) + set(Boost_USE_STATIC_RUNTIME OFF) +endif(DEFINED ENV{SLIC3R_STATIC}) + find_package(Threads REQUIRED) find_package(Boost COMPONENTS system thread filesystem) @@ -154,7 +160,12 @@ add_library(bthread SHARED IMPORTED) set_target_properties(bthread PROPERTIES IMPORTED_LOCATION ${bthread_l}) include_directories(${Boost_INCLUDE_DIRS}) -set(wxWidgets_USE_STATIC OFF) +if(DEFINED ENV{SLIC3R_STATIC}) + set(wxWidgets_USE_STATIC ON) +ELSE(DEFINED ENV{SLIC3R_STATIC}) + set(wxWidgets_USE_STATIC OFF) +ENDIF(DEFINED ENV{SLIC3R_STATIC}) + set(wxWidgets_USE_UNICODE ON) find_package(wxWidgets COMPONENTS base aui core html) From a73366b00ed16be652cce9b4780eeac5d3046e55 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 5 May 2018 00:16:44 -0500 Subject: [PATCH 099/112] fix the startup script to point at the binary. --- package/linux/startup_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/linux/startup_script.sh b/package/linux/startup_script.sh index 30f0e2c69..dbe4d7981 100644 --- a/package/linux/startup_script.sh +++ b/package/linux/startup_script.sh @@ -3,4 +3,4 @@ BIN=$(readlink "$0") DIR=$(dirname "$BIN") export LD_LIBRARY_PATH="$DIR/bin" -exec "$DIR/perl-local" -I"$DIR/local-lib/lib/perl5" "$DIR/slic3r.pl" $@ +exec "$DIR/Slic3r" From 897b595db856883a6ce77c6c893ddb7b92f69d7c Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 5 May 2018 00:17:32 -0500 Subject: [PATCH 100/112] Set compile configuration variables if they are in the environment for the path to slic3r var dir --- .travis.yml | 1 + src/CMakeLists.txt | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 34940401f..c5d7c00a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ install: - export SLIC3R_STATIC=1 - export CXX=g++-7 - export CC=gcc-7 +- export SLIC3R_VAR_REL=./var script: - bash package/linux/travis-setup.sh - cmake -DBOOST_ROOT=$BOOST_DIR src/ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 86753350d..0a8b9f9b0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,7 +3,20 @@ project (slic3r) # only on newer GCCs: -ftemplate-backtrace-limit=0 -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -DM_PI=3.14159265358979323846 -D_GLIBCXX_USE_C99 -DHAS_BOOL -DNOGDI -DBOOST_ASIO_DISABLE_KQUEUE") +set(CMAKE_CXX_FLAGS "-g ${CMAKE_CXX_FLAGS} -Wall -DM_PI=3.14159265358979323846 -D_GLIBCXX_USE_C99 -DHAS_BOOL -DNOGDI -DBOOST_ASIO_DISABLE_KQUEUE") + +if(DEFINED ENV{SLIC3R_VAR_REL}) + set(CMAKE_CXX_FLAGS "-DVAR_REL=$ENV{SLIC3R_VAR_REL}") +endif(DEFINED ENV{SLIC3R_VAR_REL}) + +if(DEFINED ENV{SLIC3R_VAR_ABS}) + set(CMAKE_CXX_FLAGS "-DVAR_ABS") +endif(DEFINED ENV{SLIC3R_VAR_ABS}) + +if(DEFINED ENV{SLIC3R_VAR_ABS_PATH}) + set(CMAKE_CXX_FLAGS "-DVAR_ABS_PATH=$ENV{SLIC3R_VAR_ABS_PATH}") +endif(DEFINED ENV{SLIC3R_VAR_ABS_PATH}) + execute_process(COMMAND git rev-parse --short HEAD OUTPUT_VARIABLE GIT_VERSION ERROR_QUIET) From 9c154a6b2d8e65f4c48fb3e9e5cf7598528831c7 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 5 May 2018 00:30:46 -0500 Subject: [PATCH 101/112] not using var rel because its expansion needs to be fixed in misc_ui.hpp --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c5d7c00a1..34940401f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ install: - export SLIC3R_STATIC=1 - export CXX=g++-7 - export CC=gcc-7 -- export SLIC3R_VAR_REL=./var script: - bash package/linux/travis-setup.sh - cmake -DBOOST_ROOT=$BOOST_DIR src/ From 0af528845c66136ab39262e58fab554229bfed86 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 5 May 2018 12:48:24 -0500 Subject: [PATCH 102/112] Finished implementing ProgressStatusBar class --- src/GUI/ProgressStatusBar.cpp | 12 ++++++++++++ src/GUI/ProgressStatusBar.hpp | 16 ++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/GUI/ProgressStatusBar.cpp b/src/GUI/ProgressStatusBar.cpp index ceb909af8..b3f47f1ed 100644 --- a/src/GUI/ProgressStatusBar.cpp +++ b/src/GUI/ProgressStatusBar.cpp @@ -52,6 +52,18 @@ void ProgressStatusBar::OnSize(wxSizeEvent &e) { e.Skip(); } +void ProgressStatusBar::SetProgress(size_t val) { + if (!this->prog->IsShown()) { + this->ShowProgress(true); + } + if (val == this->prog->GetRange()) { + this->prog->SetValue(0); + this->ShowProgress(false); + } else { + this->prog->SetValue(val); + } +} + void ProgressStatusBar::OnTimer(wxTimerEvent& e) { if (this->prog->IsShown()) this->timer->Stop(); diff --git a/src/GUI/ProgressStatusBar.hpp b/src/GUI/ProgressStatusBar.hpp index dfb792e8b..e295dbd6a 100644 --- a/src/GUI/ProgressStatusBar.hpp +++ b/src/GUI/ProgressStatusBar.hpp @@ -32,21 +32,25 @@ public: cb == nullptr ? this->cancelbutton->Hide() : this->cancelbutton->Show(); } - /// Accessor function for the current value of the progress bar - size_t GetProgress() {return this->prog->GetValue();} - - /// Accessor function for busy state - bool IsBusy() {return this->busy;} - /// Show the progress bar. void ShowProgress(bool show = true) { this->prog->Show(show); this->prog->Pulse(); } + /// Accessor function for the current value of the progress bar + inline size_t GetProgress() {return this->prog->GetValue();} + + /// Accessor set function for the current value of the progress bar + void SetProgress(size_t val); + void SetRange(int range) { if (range != this->prog->GetRange() ) this->prog->SetRange(range);} /// Start the timer. void Run(int rate = 100) { if (this->timer->IsRunning()) this->timer->Start(rate);}; void StartBusy(int rate = 100) { this->busy = true; this->ShowProgress(true); if (!this->timer->IsRunning()) this->timer->Start(rate); } + void StopBusy() { this->timer->Stop(); this->ShowProgress(false); this->prog->SetValue(0); this->busy = false;} + + /// Accessor function for busy state + bool IsBusy() {return this->busy;} private: void OnSize(wxSizeEvent& e); From e32be5a2244271f5a7df00e230e4bde98e76dfb5 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 5 May 2018 12:48:36 -0500 Subject: [PATCH 103/112] sorted GUI files --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0a8b9f9b0..6db5c038e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -210,9 +210,9 @@ IF(wxWidgets_FOUND) ${GUI_LIBDIR}/GUI.cpp ${GUI_LIBDIR}/MainFrame.cpp ${GUI_LIBDIR}/Plater.cpp - ${GUI_LIBDIR}/ProgressStatusBar.cpp ${GUI_LIBDIR}/Plater/Plate2D.cpp ${GUI_LIBDIR}/Plater/PlaterObject.cpp + ${GUI_LIBDIR}/ProgressStatusBar.cpp ${GUI_LIBDIR}/Settings.cpp ${GUI_LIBDIR}/misc_ui.cpp ) From 91edf908f286bb0a6b0749edb82a35cc71ba30c0 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 5 May 2018 12:56:24 -0500 Subject: [PATCH 104/112] Stubbed restore_window_pos --- src/GUI/MainFrame.cpp | 1 + src/GUI/Settings.cpp | 3 +++ src/GUI/Settings.hpp | 1 + 3 files changed, 5 insertions(+) diff --git a/src/GUI/MainFrame.cpp b/src/GUI/MainFrame.cpp index 82e2b0f09..d39d0b363 100644 --- a/src/GUI/MainFrame.cpp +++ b/src/GUI/MainFrame.cpp @@ -48,6 +48,7 @@ MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& si this->SetMinSize(wxSize(760, 490)); this->SetSize(this->GetMinSize()); wxTheApp->SetTopWindow(this); + gui_config->restore_window_pos(this, "main_frame"); this->Show(); this->Layout(); } diff --git a/src/GUI/Settings.cpp b/src/GUI/Settings.cpp index 8354c54d4..23d5808d5 100644 --- a/src/GUI/Settings.cpp +++ b/src/GUI/Settings.cpp @@ -15,4 +15,7 @@ sub save_settings { void Settings::save_window_pos(wxWindow* ref, wxString name) { } + +void Settings::restore_window_pos(wxWindow* ref, wxString name) { +} }} // namespace Slic3r::GUI diff --git a/src/GUI/Settings.hpp b/src/GUI/Settings.hpp index 0b35f62e7..aaa9bd72b 100644 --- a/src/GUI/Settings.hpp +++ b/src/GUI/Settings.hpp @@ -55,6 +55,7 @@ class Settings { std::map > window_pos { std::map >() }; void save_window_pos(wxWindow* ref, wxString name); + void restore_window_pos(wxWindow* ref, wxString name); private: const std::string LogChannel {"GUI_Settings"}; //< Which log these messages should go to. From 2b91524619ad2406e43c347dccb03e55dddbe5d9 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 5 May 2018 12:57:31 -0500 Subject: [PATCH 105/112] Remember to actually set the sizer. --- src/GUI/MainFrame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GUI/MainFrame.cpp b/src/GUI/MainFrame.cpp index d39d0b363..1452d0cc3 100644 --- a/src/GUI/MainFrame.cpp +++ b/src/GUI/MainFrame.cpp @@ -30,7 +30,6 @@ MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& si wxToolTip::SetAutoPop(TOOLTIP_TIMER); // initialize status bar - // we call SetStatusBar() here because MainFrame is the direct owner. this->statusbar = new ProgressStatusBar(this, -1); wxString welcome_text {_("Version SLIC3R_VERSION_REPLACE - Remember to check for updates at http://slic3r.org/")}; welcome_text.Replace("SLIC3R_VERSION_REPLACE", wxString(SLIC3R_VERSION)); @@ -44,6 +43,7 @@ MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& si wxSizer* sizer = new wxBoxSizer(wxVERTICAL); sizer->Add(this->tabpanel, 1, wxEXPAND); sizer->SetSizeHints(this); + this->SetSizer(sizer); this->Fit(); this->SetMinSize(wxSize(760, 490)); this->SetSize(this->GetMinSize()); From 4860d63b01aa2dea64fba63ef15d353a1e82c7bf Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 5 May 2018 16:10:43 -0500 Subject: [PATCH 106/112] Add static method to create scaled Polygons from Pointf arrays. --- xs/src/libslic3r/Polygon.cpp | 11 +++++++++++ xs/src/libslic3r/Polygon.hpp | 2 ++ 2 files changed, 13 insertions(+) diff --git a/xs/src/libslic3r/Polygon.cpp b/xs/src/libslic3r/Polygon.cpp index b14b7d0fa..d809294f1 100644 --- a/xs/src/libslic3r/Polygon.cpp +++ b/xs/src/libslic3r/Polygon.cpp @@ -293,4 +293,15 @@ Polygon::convex_points(double angle) const return convex; } +Polygon Polygon::new_scale(const Pointfs& p) { + Points scaled_p; + for (auto i : p) { + // scale each individual point and append to a new array + scaled_p.push_back(scale_(i.x), scale_(i.y)); + } + return Slic3r::Polygon(scaled_p); +}; + + + } diff --git a/xs/src/libslic3r/Polygon.hpp b/xs/src/libslic3r/Polygon.hpp index b1576ad27..1534de40c 100644 --- a/xs/src/libslic3r/Polygon.hpp +++ b/xs/src/libslic3r/Polygon.hpp @@ -48,6 +48,8 @@ class Polygon : public MultiPoint { std::string wkt() const; Points concave_points(double angle = PI) const; Points convex_points(double angle = PI) const; + + static Polygon new_scale(const Pointfs& p); }; inline Polygons From dc08bcafaeba8b6abc816bab7c6468b7c601732a Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 5 May 2018 16:13:34 -0500 Subject: [PATCH 107/112] Added template function to make getting references to ConfigOptions easier to write. --- xs/src/libslic3r/Config.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xs/src/libslic3r/Config.hpp b/xs/src/libslic3r/Config.hpp index a4c7fa470..e2049cd32 100644 --- a/xs/src/libslic3r/Config.hpp +++ b/xs/src/libslic3r/Config.hpp @@ -16,6 +16,13 @@ public: void write_ini(const std::string& file) { save(file); } void read_ini(const std::string& file) { load(file); } + + /// Template function to retrieve and cast in hopefully a slightly nicer + /// format than longwinded dynamic_cast<> + template + T& get(const t_config_option_key& opt_key, bool create=false) { + return *(dynamic_cast(this->optptr(opt_key, create))); + } }; } // namespace Slic3r From 2c2ad2c992625b38f15eee2a9614fdd4f27e8381 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 5 May 2018 16:13:58 -0500 Subject: [PATCH 108/112] Changed identifier type to size_t (needs to be numerical to do math on it) --- src/GUI/Plater/PlaterObject.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GUI/Plater/PlaterObject.hpp b/src/GUI/Plater/PlaterObject.hpp index 72b71d88e..7fb6602cb 100644 --- a/src/GUI/Plater/PlaterObject.hpp +++ b/src/GUI/Plater/PlaterObject.hpp @@ -13,7 +13,7 @@ namespace Slic3r { namespace GUI { class PlaterObject { public: wxString name {L""}; - wxString identifier {L""}; + size_t identifier {0U}; wxString input_file {L""}; int input_file_obj_idx {-1}; From b0d552ce4e735a7e977f946b2764600d5912b7af Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 5 May 2018 17:35:28 -0500 Subject: [PATCH 109/112] Add macro to take advantage of wxString << --- src/GUI/misc_ui.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GUI/misc_ui.hpp b/src/GUI/misc_ui.hpp index 90ad19070..eebefd015 100644 --- a/src/GUI/misc_ui.hpp +++ b/src/GUI/misc_ui.hpp @@ -15,6 +15,11 @@ #include "Log.hpp" + +/// Macro to build std::wstring that slic3r::log expects using << syntax of wxString +/// Avoids wx pollution of libslic3r +#define LOG_WSTRING(...) ((wxString("") << __VA_ARGS__).ToStdWstring()) + /// Common static (that is, free-standing) functions, not part of an object hierarchy. namespace Slic3r { namespace GUI { From a620e2ee133bba53aeb130dd6f386ee213d57e47 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 5 May 2018 17:35:53 -0500 Subject: [PATCH 110/112] Fixed arguments for Polygon::new_scale --- xs/src/libslic3r/Polygon.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xs/src/libslic3r/Polygon.cpp b/xs/src/libslic3r/Polygon.cpp index d809294f1..a3bebb034 100644 --- a/xs/src/libslic3r/Polygon.cpp +++ b/xs/src/libslic3r/Polygon.cpp @@ -297,7 +297,7 @@ Polygon Polygon::new_scale(const Pointfs& p) { Points scaled_p; for (auto i : p) { // scale each individual point and append to a new array - scaled_p.push_back(scale_(i.x), scale_(i.y)); + scaled_p.push_back(Slic3r::Point(scale_(i.x), scale_(i.y))); } return Slic3r::Polygon(scaled_p); }; From 574f77ec165273f66d8c4be7fcedf0131bfe2b04 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 5 May 2018 17:36:20 -0500 Subject: [PATCH 111/112] Added generic error message to Log; print error type to console. --- xs/src/libslic3r/Log.hpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xs/src/libslic3r/Log.hpp b/xs/src/libslic3r/Log.hpp index 419448a88..5eddac995 100644 --- a/xs/src/libslic3r/Log.hpp +++ b/xs/src/libslic3r/Log.hpp @@ -8,17 +8,21 @@ namespace Slic3r { class Log { public: static void fatal_error(std::string topic, std::wstring message) { - std::cerr << topic << ": "; + std::cerr << topic << " FERR" << ": "; + std::wcerr << message << std::endl; + } + static void error(std::string topic, std::wstring message) { + std::cerr << topic << " ERR" << ": "; std::wcerr << message << std::endl; } static void info(std::string topic, std::wstring message) { - std::clog << topic << ": "; + std::clog << topic << " INFO" << ": "; std::wclog << message << std::endl; } static void warn(std::string topic, std::wstring message) { - std::cerr << topic << ": "; + std::cerr << topic << " WARN" << ": "; std::wcerr << message << std::endl; } From 904e7d749ee66910c1ab03cfd8c66fd38640e110 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 5 May 2018 17:37:13 -0500 Subject: [PATCH 112/112] Implemented load_model_objects, fleshed out add() more. Implemented bed_centerf(). --- src/GUI/Plater.cpp | 90 ++++++++++++++++++++++++++++++++++++++++++++-- src/GUI/Plater.hpp | 5 +++ 2 files changed, 92 insertions(+), 3 deletions(-) diff --git a/src/GUI/Plater.cpp b/src/GUI/Plater.cpp index 3ac360799..16a74a828 100644 --- a/src/GUI/Plater.cpp +++ b/src/GUI/Plater.cpp @@ -126,8 +126,21 @@ void Plater::add() { if (start_object_id == this->object_identifier) return; // save the added objects - + auto new_model {this->model}; + // get newly added objects count + auto new_objects_count = this->object_identifier - start_object_id; + + Slic3r::Log::info(LogChannel, (wxString("Obj id:") << object_identifier).ToStdWstring()); + for (auto i = start_object_id; i < new_objects_count + start_object_id; i++) { + const auto& obj_idx {this->get_object_index(i)}; + new_model->add_object(*(this->model->objects.at(obj_idx))); + } + Slic3r::Log::info(LogChannel, (wxString("Obj id:") << object_identifier).ToStdWstring()); + + // Prepare for undo + //this->add_undo_operation("ADD", nullptr, new_model, start_object_id); + } @@ -145,11 +158,13 @@ std::vector Plater::load_file(const wxString& file, const int obj_idx_to_lo progress_dialog->Pulse(); //TODO: Add a std::wstring so we can handle non-roman characters as file names. try { - auto model {Slic3r::Model::read_from_file(file.ToStdString())}; + model = Slic3r::Model::read_from_file(file.ToStdString()); } catch (std::runtime_error& e) { show_error(this, e.what()); + Slic3r::Log::error(LogChannel, LOG_WSTRING(file << " failed to load: " << e.what())); valid_load = false; } + Slic3r::Log::info(LogChannel, LOG_WSTRING("load_valid is " << valid_load)); if (valid_load) { if (model.looks_like_multipart_object()) { @@ -172,12 +187,15 @@ std::vector Plater::load_file(const wxString& file, const int obj_idx_to_lo } auto i {0U}; if (obj_idx_to_load > 0) { + Slic3r::Log::info(LogChannel, L"Loading model objects, obj_idx_to_load > 0"); const size_t idx_load = obj_idx_to_load; if (idx_load >= model.objects.size()) return std::vector(); obj_idx = this->load_model_objects(model.objects.at(idx_load)); i = idx_load; } else { + Slic3r::Log::info(LogChannel, L"Loading model objects, obj_idx_to_load = 0"); obj_idx = this->load_model_objects(model.objects); + Slic3r::Log::info(LogChannel, LOG_WSTRING("obj_idx size: " << obj_idx.size())); } for (const auto &j : obj_idx) { @@ -206,11 +224,77 @@ std::vector Plater::load_model_objects(ModelObject* model_object) { return load_model_objects(tmp); } std::vector Plater::load_model_objects(ModelObjectPtrs model_objects) { - return std::vector(); + auto bed_center {this->bed_centerf()}; + + auto bed_shape {Slic3r::Polygon::new_scale(this->config->get("bed_shape").values)}; + auto bed_size {bed_shape.bounding_box().size()}; + + bool need_arrange {false}; + + auto obj_idx {std::vector()}; + Slic3r::Log::info(LogChannel, LOG_WSTRING("Objects: " << model_objects.size())); + + for (auto& obj : model_objects) { + auto o {this->model->add_object(*obj)}; + o->repair(); + + auto tmpobj {PlaterObject()}; + const auto objfile {wxFileName::FileName( obj->input_file )}; + tmpobj.name = wxString(std::string() == obj->name ? obj->name : objfile.GetName()); + tmpobj.identifier = (this->object_identifier)++; + + this->objects.push_back(tmpobj); + obj_idx.push_back(this->objects.size()); + Slic3r::Log::info(LogChannel, LOG_WSTRING("Object array new size: " << this->objects.size())); + Slic3r::Log::info(LogChannel, LOG_WSTRING("Instances: " << obj->instances.size())); + + if (obj->instances.size() == 0) { + if (settings->autocenter) { + need_arrange = true; + o->center_around_origin(); + + o->add_instance(); + o->instances.back()->offset = this->bed_centerf(); + } else { + need_arrange = false; + if (settings->autoalignz) { + o->align_to_ground(); + } + o->add_instance(); + } + } else { + if (settings->autoalignz) { + o->align_to_ground(); + } + } + { + // If the object is too large (more than 5x the bed) scale it down. + auto size {o->bounding_box().size()}; + double ratio {0.0f}; + if (ratio > 5) { + for (auto& instance : o->instances) { + instance->scaling_factor = (1.0f/ratio); + this->scaled_down = true; + } + } + } + + { + // Provide a warning if downscaling by 5x still puts it over the bed size. + + } + } + return obj_idx; } MainFrame* Plater::GetFrame() { return dynamic_cast(wxGetTopLevelParent(this)); } +int Plater::get_object_index(size_t object_id) { + for (size_t i = 0U; i < this->objects.size(); i++) { + if (this->objects.at(i).identifier == object_id) return static_cast(i); + } + return -1; +} }} // Namespace Slic3r::GUI diff --git a/src/GUI/Plater.hpp b/src/GUI/Plater.hpp index 726040892..7f84f0ca1 100644 --- a/src/GUI/Plater.hpp +++ b/src/GUI/Plater.hpp @@ -73,7 +73,12 @@ private: MainFrame* GetFrame(); void select_object(size_t& obj_idx) { }; + int get_object_index(size_t object_id); + Slic3r::Pointf bed_centerf() { + auto bed_shape { Slic3r::Polygon::new_scale(this->config->get("bed_shape").values) }; + return Slic3r::Pointf(); + } };