diff --git a/lib/Slic3r/GUI.pm b/lib/Slic3r/GUI.pm index 077b5625b..5ac8afe4d 100644 --- a/lib/Slic3r/GUI.pm +++ b/lib/Slic3r/GUI.pm @@ -40,6 +40,7 @@ use Wx 0.9901 qw(:bitmap :dialog :icon :id :misc :systemsettings :toplevelwindow :filedialog :font); use Wx::Event qw(EVT_IDLE EVT_COMMAND); use base 'Wx::App'; +#use base 'Wx::AppConsole'; use constant FILE_WILDCARDS => { known => 'Known files (*.stl, *.obj, *.amf, *.xml)|*.stl;*.STL;*.obj;*.OBJ;*.amf;*.AMF;*.xml;*.XML', diff --git a/lib/Slic3r/GUI/MainFrame.pm b/lib/Slic3r/GUI/MainFrame.pm index a3e34c73c..6ea6049ba 100644 --- a/lib/Slic3r/GUI/MainFrame.pm +++ b/lib/Slic3r/GUI/MainFrame.pm @@ -284,8 +284,13 @@ sub _init_menubar { $self->_append_menu_item($helpMenu, "&About Slic3r", 'Show about dialog', sub { wxTheApp->about; }); + if (Slic3r::GUI::debugged()) { + $self->_append_menu_item($helpMenu, "&Debug", 'Break to debugger', sub { + Slic3r::GUI::break_to_debugger(); + }); + } } - + # menubar # assign menubar to frame after appending items, otherwise special items # will not be handled correctly diff --git a/slic3r.sublime-project b/slic3r.sublime-project index 9f2586dc8..9deb0e273 100644 --- a/slic3r.sublime-project +++ b/slic3r.sublime-project @@ -28,7 +28,7 @@ "name": "xs & run", "working_dir": "$project_path/xs", "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", - "shell_cmd": "perl Build install & perl ..\\slic3r.pl --gui \"..\\..\\Slic3r-tests\\star3-big2.stl\"" + "shell_cmd": "perl Build install & cd .. & perl slic3r.pl --gui \"..\\Slic3r-tests\\star3-big2.stl\"" } ], "folders": @@ -36,5 +36,26 @@ { "path": "." } - ] + ], + + "settings": + { + "sublimegdb_workingdir": "${folder:${project_path:run}}", + // NOTE: You MUST provide --interpreter=mi for the plugin to work +// "sublimegdb_commandline": "D:\\Qt\\Tools\\mingw492_32\\bin\\gdb.exe --interpreter=mi -ex 'target localhost:2345'", +// "sublimegdb_commandline": "D:\\Qt\\Tools\\mingw492_32\\bin\\gdb.exe --interpreter=mi perl --args perl slic3r.pl", +// "sublimegdb_commandline": "D:\\Qt\\Tools\\mingw492_32\\bin\\gdb.exe --interpreter=mi perl --args slic3r.pl ", +// "sublimegdb_commandline": "D:\\Qt\\Tools\\mingw492_32\\bin\\gdb.exe --interpreter=mi -e C:\\Strawberry\\perl\\bin\\perl.exe -s C:\\Strawberry\\perl\\site\\lib\\auto\\Slic3r\\XS\\XS.xs.dll --args perl slic3r.pl -j 1 --gui D:\\src\\Slic3r-tests\\star3-big.stl", + "sublimegdb_commandline": "D:\\Qt\\Tools\\mingw492_32\\bin\\gdb.exe --interpreter=mi perl.exe --args perl slic3r.pl -j 1 --gui", // D:\\src\\Slic3r-tests\\star3-big.stl", +// "sublimegdb_commandline": "D:\\Qt\\Tools\\mingw492_32\\bin\\gdb.exe --interpreter=mi -x slic3r.gdb", +// "arguments": "slic3r -j 1 --gui ../Slic3r-tests/star3-big.stl", +// "arguments": "../slic3r.pl -j 1 --gui", +// "sublimegdb_exec_cmd": "-exec-continue", + + // Add "pending breakpoints" for symbols that are dynamically loaded from + // external shared libraries + "debug_ext" : true, + "run_after_init": false, + "close_views": false + } } diff --git a/xs/MANIFEST b/xs/MANIFEST index b838290c7..2fbd9f0ce 100644 --- a/xs/MANIFEST +++ b/xs/MANIFEST @@ -42,6 +42,8 @@ src/libslic3r/Fill/FillPlanePath.cpp src/libslic3r/Fill/FillPlanePath.hpp src/libslic3r/Fill/FillRectilinear.cpp src/libslic3r/Fill/FillRectilinear.hpp +src/libslic3r/Fill/FillRectilinear2.cpp +src/libslic3r/Fill/FillRectilinear2.hpp src/libslic3r/Flow.cpp src/libslic3r/Flow.hpp src/libslic3r/GCode.cpp diff --git a/xs/src/libslic3r/Fill/FillBase.cpp b/xs/src/libslic3r/Fill/FillBase.cpp index 07d6f38b9..c17f57185 100644 --- a/xs/src/libslic3r/Fill/FillBase.cpp +++ b/xs/src/libslic3r/Fill/FillBase.cpp @@ -6,6 +6,7 @@ #include "Fill3DHoneycomb.hpp" #include "FillPlanePath.hpp" #include "FillRectilinear.hpp" +#include "FillRectilinear2.hpp" namespace Slic3r { @@ -18,7 +19,8 @@ Fill* Fill::new_from_type(const std::string &type) if (type == "3dhoneycomb") return new Fill3DHoneycomb(); if (type == "rectilinear") - return new FillRectilinear(); +// return new FillRectilinear(); + return new FillRectilinear2(); if (type == "line") return new FillLine(); if (type == "grid") diff --git a/xs/src/libslic3r/Fill/FillBase.hpp b/xs/src/libslic3r/Fill/FillBase.hpp index 354d16535..8fa2bee42 100644 --- a/xs/src/libslic3r/Fill/FillBase.hpp +++ b/xs/src/libslic3r/Fill/FillBase.hpp @@ -12,6 +12,8 @@ class Surface; struct FillParams { + FillParams() { memset(this, 0, sizeof(FillParams)); } + coordf_t width; // Fraction in <0, 1> float density; diff --git a/xs/src/libslic3r/Fill/FillRectilinear.cpp b/xs/src/libslic3r/Fill/FillRectilinear.cpp index 99b8b346f..e2f996e2a 100644 --- a/xs/src/libslic3r/Fill/FillRectilinear.cpp +++ b/xs/src/libslic3r/Fill/FillRectilinear.cpp @@ -34,7 +34,7 @@ Polylines FillRectilinear::fill_surface(const Surface *surface, const FillParams bounding_box.min.x - (bounding_box.min.x % this->_line_spacing), bounding_box.min.y - (bounding_box.min.y % this->_line_spacing))); } - + // generate the basic pattern coord_t x_max = bounding_box.max.x + SCALED_EPSILON; Lines lines; diff --git a/xs/src/libslic3r/TriangleMesh.cpp b/xs/src/libslic3r/TriangleMesh.cpp index a5b89ba70..91e7982aa 100644 --- a/xs/src/libslic3r/TriangleMesh.cpp +++ b/xs/src/libslic3r/TriangleMesh.cpp @@ -13,7 +13,7 @@ #include #ifdef SLIC3R_DEBUG -#define SLIC3R_TRIANGLEMESH_DEBUG +// #define SLIC3R_TRIANGLEMESH_DEBUG #include "SVG.hpp" #endif diff --git a/xs/src/slic3r/GUI/GUI.cpp b/xs/src/slic3r/GUI/GUI.cpp index fd5135f0a..eab1f6583 100644 --- a/xs/src/slic3r/GUI/GUI.cpp +++ b/xs/src/slic3r/GUI/GUI.cpp @@ -36,4 +36,19 @@ enable_screensaver() #endif } +bool +debugged() +{ + return IsDebuggerPresent(); +} + +void +break_to_debugger() +{ + #ifdef _WIN32 + if (IsDebuggerPresent()) + DebugBreak(); + #endif /* _WIN32 */ +} + } } diff --git a/xs/src/slic3r/GUI/GUI.hpp b/xs/src/slic3r/GUI/GUI.hpp index 3ce72fd61..85656c0a3 100644 --- a/xs/src/slic3r/GUI/GUI.hpp +++ b/xs/src/slic3r/GUI/GUI.hpp @@ -5,6 +5,8 @@ namespace Slic3r { namespace GUI { void disable_screensaver(); void enable_screensaver(); +bool debugged(); +void break_to_debugger(); } } diff --git a/xs/xsp/GUI.xsp b/xs/xsp/GUI.xsp index a422040e1..875c49e26 100644 --- a/xs/xsp/GUI.xsp +++ b/xs/xsp/GUI.xsp @@ -13,3 +13,9 @@ void disable_screensaver() void enable_screensaver() %code{% Slic3r::GUI::enable_screensaver(); %}; + +bool debugged() + %code{% RETVAL=Slic3r::GUI::debugged(); %}; + +void break_to_debugger() + %code{% Slic3r::GUI::break_to_debugger(); %};