Browse Source

compilation fixes
also some freepyscad update

supermerill 4 years ago
parent
commit
bf215bba85

+ 9 - 0
.github/workflows/ccpp_mac.yml

@@ -26,6 +26,15 @@ jobs:
     - name: make deps
       working-directory: ./deps/build
       run: make
+    - name: ls libs
+      working-directory: ./deps/build
+      run: ls ./destdir/usr/local/lib
+    - name: rename wxscintilla
+      working-directory: ./deps/build/destdir/usr/local/lib
+      run: cp libwxscintilla-3.1.a libwx_osx_cocoau_scintilla-3.1.a
+    - name: ls libs
+      working-directory: ./deps/build
+      run: ls ./destdir/usr/local/lib
     - name: clean deps
       working-directory: ./deps/build
       run: rm -rf dep_*

+ 6 - 0
.github/workflows/ccpp_ubuntu.yml

@@ -30,6 +30,12 @@ jobs:
     - name: make deps
       working-directory: ./deps/build
       run: make
+    - name: rename wxscintilla
+      working-directory: ./deps/build/destdir/usr/local/lib
+      run: cp libwxscintilla-3.1.a libwx_gtk2u_scintilla-3.1.a
+    - name: ls libs
+      working-directory: ./deps/build
+      run: ls ./destdir/usr/local/lib
     - name: clean deps
       working-directory: ./deps/build
       run: rm -rf dep_*

+ 2 - 0
deps/deps-linux.cmake

@@ -108,6 +108,8 @@ ExternalProject_Add(dep_wxwidgets
         --with-opengl
         --enable-unicode
         --enable-graphics_ctx
+        --enable-stc
+		--enable-aui
         --with-regex=builtin
         --with-libpng=builtin
         --with-libxpm=builtin

+ 1 - 1
sandboxes/opencsg/CMakeLists.txt

@@ -10,7 +10,7 @@ add_executable(opencsg_example WIN32
     ${CMAKE_CURRENT_SOURCE_DIR}/../../src/slic3r/GUI/I18N.hpp
     ${CMAKE_CURRENT_SOURCE_DIR}/../../src/slic3r/GUI/I18N.cpp)
 
-find_package(wxWidgets 3.1 REQUIRED COMPONENTS core base gl html stc scintilla aui)
+find_package(wxWidgets 3.1 REQUIRED COMPONENTS core base gl html)
 find_package(OpenGL REQUIRED)
 find_package(GLEW REQUIRED)
 find_package(OpenCSG REQUIRED)

+ 3 - 3
src/CMakeLists.txt

@@ -40,9 +40,9 @@ if (SLIC3R_GUI)
     if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
         set (wxWidgets_CONFIG_OPTIONS "--toolkit=gtk${SLIC3R_GTK}")
         if (SLIC3R_WX_STABLE)
-            find_package(wxWidgets 3.0 REQUIRED COMPONENTS base core adv html gl stc scintilla aui)
+            find_package(wxWidgets 3.0 REQUIRED COMPONENTS base core adv html gl stc)
         else ()
-            find_package(wxWidgets 3.1 QUIET COMPONENTS base core adv html gl stc scintilla aui)
+            find_package(wxWidgets 3.1 QUIET COMPONENTS base core adv html gl stc)
 
             if (NOT wxWidgets_FOUND)
                 message(FATAL_ERROR "\nCould not find wxWidgets 3.1.\n"
@@ -50,7 +50,7 @@ if (SLIC3R_GUI)
             endif ()
         endif ()
     else ()
-        find_package(wxWidgets 3.1 REQUIRED COMPONENTS html adv gl core base stc scintilla aui)
+        find_package(wxWidgets 3.1 REQUIRED COMPONENTS html adv gl core base stc scintilla)
     endif ()
 
     if(UNIX)

+ 1 - 1
src/libslic3r/Config.hpp

@@ -867,7 +867,7 @@ public:
     ConfigOption*           clone() const override { return new ConfigOptionPercentsTempl(*this); }
     ConfigOptionPercentsTempl&   operator=(const ConfigOption *opt) { this->set(opt); return *this; }
     bool                    operator==(const ConfigOptionPercentsTempl &rhs) const { return this->values == rhs.values; }
-    double                  get_abs_value(size_t i, double ratio_over) const { return is_nil(i) ? 0 : ratio_over * get_at(i) / 100; }
+    double                  get_abs_value(size_t i, double ratio_over) const { return this->is_nil(i) ? 0 : ratio_over * this->get_at(i) / 100; }
 
     std::string serialize() const override
     {

+ 1 - 0
src/libslic3r/GCode/CoolingBuffer.cpp

@@ -5,6 +5,7 @@
 #include <boost/log/trivial.hpp>
 #include <iostream>
 #include <float.h>
+#include <unordered_set>
 
 #if 0
     #define DEBUG

+ 2 - 1
src/libslic3r/PerimeterGenerator.cpp

@@ -718,7 +718,8 @@ void PerimeterGenerator::process()
                 }
             } else {
                 if (this->object_config->thin_walls_merge) {
-                    entities = this->_traverse_loops(contours.front(), ThickPolylines{});
+                    ThickPolylines no_thin_walls;
+                    entities = this->_traverse_loops(contours.front(), no_thin_walls);
                     _merge_thin_walls(entities, thin_walls);
                 } else {
                     entities = this->_traverse_loops(contours.front(), thin_walls);

+ 41 - 38
src/slic3r/GUI/FreeCADDialog.cpp

@@ -1,4 +1,5 @@
 #include "FreeCADDialog.hpp"
+
 #include "I18N.hpp"
 #include "libslic3r/Utils.hpp"
 #include "GUI.hpp"
@@ -6,24 +7,26 @@
 #include "slic3r/Utils/Http.hpp"
 #include "AppConfig.hpp"
 #include "Tab.hpp"
+
+#include <iostream>
+#include <ctime>
+#include <stdio.h>
+#include <stdlib.h>
+
 #include <wx/scrolwin.h>
 #include <wx/display.h>
 #include <wx/file.h>
 #include <wx/gbsizer.h>
 #include "wxExtensions.hpp"
-#include <iostream>
-
-//C++11
 
-#include <ctime>
-#include <stdio.h>
-#include <stdlib.h>
-#include <regex>
 #include <boost/locale.hpp>
 #include <boost/iostreams/device/file_descriptor.hpp>
 #include <boost/iostreams/stream.hpp>
 #include <boost/iostreams/tee.hpp>
 #include <boost/iostreams/filtering_stream.hpp>
+#include <boost/log/trivial.hpp>
+#include <boost/property_tree/ptree.hpp>
+#include <boost/property_tree/json_parser.hpp>
 
 #if ENABLE_SCROLLABLE
 static wxSize get_screen_size(wxWindow* window)
@@ -74,7 +77,7 @@ namespace GUI {
     }
 
     // Downloads a file (http get operation). Cancels if the Updater is being destroyed.
-    void get_string_from_web_async(const std::string &url, FreeCADDialog* free, std::function<void(FreeCADDialog*, std::string)> listener)
+    void get_string_from_web_async(const std::string &url, FreeCADDialog* free, std::function<void(FreeCADDialog*, std::string&)> listener)
     {
 
         Slic3r::Http::get(url)
@@ -96,20 +99,19 @@ namespace GUI {
 std::string create_help_text() {
     std::stringstream ss;
 
-    ss << " == common 3D primitives ==\n";
+    ss << " == 3D obj ==\n";
     ss << "cube(x,y,z)\n";
     ss << "cylinder(r|d,h)\n";
-    ss << "poly_int(a,nb)\n";
-    ss << "poly_ext(r,nb)\n";
-    ss << "cone(r1|d2,r2|d2,h)\n";
-    ss << "iso_thread(d,p,h,internal,offset)\n";
-    ss << "solid_slices(array_points, centers)\n";
-    ss << "importStl(filepath)\n"; 
-    ss << " == common 3D operation ==\n";
+    ss << "ngon(a|r,n,h)\n";
+    ss << "cone(r1,r2,h)\n";
+    ss << "iso_thread(d,p,h\n  ,internal,offset)\n";
+    ss << "solid_slices(...)\n";
+    ss << "importStl(file)\n"; 
+    ss << " == 3D op ==\n";
     ss << "cut()(...3D)\n";
     ss << "union()(...3D)\n";
     ss << "intersection()(...3D)\n";
-    ss << " == common object modifier ==\n";
+    ss << " == Object modifier ==\n";
     ss << ".x/y/z() | .center()\n";
     ss << ".move(x,y,z)\n";
     ss << ".rotate(x,y,z)\n";
@@ -162,8 +164,7 @@ FreeCADDialog::FreeCADDialog(GUI_App* app, MainFrame* mainframe)
     commands.emplace_back(PyCommand{"offset", PyCommandType::pctOPERATION, { "length","fillet" }, "offset(length,fillet)(...obj)"});
     commands.emplace_back(PyCommand{"chamfer", PyCommandType::pctOPERATION, { "l" }, "chamfer(l)(...obj)"});
     commands.emplace_back(PyCommand{"fillet", PyCommandType::pctOPERATION, { "l" }, "fillet(l)(...obj)"});
-    commands.emplace_back(PyCommand{"poly_ext", PyCommandType::pctOBJECT, {"r", "nb", "h", "d="}, "poly_ext(r,nb,h)\npoly_ext(d=,nb=,h=)"});
-    commands.emplace_back(PyCommand{"poly_int", PyCommandType::pctOBJECT, { "a", "nb", "h", "d=" }, "poly_int(a,nb,h)\npoly_int(d=,nb=,h=)"});
+    commands.emplace_back(PyCommand{"ngon", PyCommandType::pctOBJECT, {"r", "nb", "h", "a=", "d="}, "ngon(r,n,h)\ngon(d=,n=,h=)\ngon(a=,n=,h=)" });
     commands.emplace_back(PyCommand{"triangle", PyCommandType::pctOBJECT, { "x","y","z" }, "triangle(x,y,z)"});
     commands.emplace_back(PyCommand{ "iso_thread", PyCommandType::pctOBJECT, {"d","p","h","internal","offset","fn="},
         "iso_thread(d,p,h,internal, offset,[fn=])\nm3 screw: iso_thread(3,0.5,10,False,0)\nm3 nut: cut()(...,iso_thread(3,0.5,3,True,0.15))" });
@@ -179,6 +180,8 @@ FreeCADDialog::FreeCADDialog(GUI_App* app, MainFrame* mainframe)
     commands.emplace_back(PyCommand{"bezier", PyCommandType::pctOBJECT});
     commands.emplace_back(PyCommand{"square", PyCommandType::pctOBJECT});
     commands.emplace_back(PyCommand{"importSvg", PyCommandType::pctOBJECT, "importSvg(filename,ids)"});
+    commands.emplace_back(PyCommand{"poly_ext", PyCommandType::pctOBJECT, {"r", "nb", "h", "d="}, "poly_ext(r,nb,h)\npoly_ext(d=,nb=,h=)" });
+    commands.emplace_back(PyCommand{"poly_int", PyCommandType::pctOBJECT, { "a", "nb", "h", "d=" }, "poly_int(a,nb,h)\npoly_int(d=,nb=,h=)" });
     commands.emplace_back(PyCommand{"xy", PyCommandType::pctMODIFIER | PyCommandType::pctNO_PARAMETER});
     commands.emplace_back(PyCommand{"z", PyCommandType::pctMODIFIER | PyCommandType::pctNO_PARAMETER});
     commands.emplace_back(PyCommand{"center", PyCommandType::pctMODIFIER | PyCommandType::pctNO_PARAMETER});
@@ -201,7 +204,7 @@ FreeCADDialog::FreeCADDialog(GUI_App* app, MainFrame* mainframe)
 
     // fonts
     const wxFont& font = wxGetApp().normal_font();
-    const wxFont& bold_font = wxGetApp().bold_font();
+    //const wxFont& bold_font = wxGetApp().bold_font();
     SetFont(font);
 
     wxIcon *freecad_icon = new wxIcon();
@@ -288,7 +291,7 @@ FreeCADDialog::FreeCADDialog(GUI_App* app, MainFrame* mainframe)
 }
 
 void FreeCADDialog::close_me(wxCommandEvent& event_args) {
-    bool ok = this->write_text_in_file(m_text->GetText(), boost::filesystem::path(Slic3r::data_dir()) / "temp" / "current_pyscad.py");
+    this->write_text_in_file(m_text->GetText(), boost::filesystem::path(Slic3r::data_dir()) / "temp" / "current_pyscad.py");
     this->gui_app->change_calibration_dialog(this, nullptr);
     this->Destroy();
 }
@@ -488,7 +491,7 @@ void FreeCADDialog::on_char_add(wxStyledTextEvent& event) {
     // Find the word start
     int current_pos = stc->GetCurrentPos();
     int word_start_pos = stc->WordStartPosition(current_pos, true);
-    int len_entered = current_pos - word_start_pos;
+    //int len_entered = current_pos - word_start_pos;
     const wxString str = stc->GetTextRange(word_start_pos, current_pos + 1);
     //if(current_pos>1)
     //    std::cout << "char typed: " << (char)stc->GetCharAt(current_pos)<<" with length "<< len_entered 
@@ -552,7 +555,7 @@ void FreeCADDialog::on_key_type(wxKeyEvent& event)
         int nb_words = 0;
         wxString possible;
         for (const PyCommand &cmd : commands) {
-            if (str.IsEmpty() || cmd.name.StartsWith(str) && ((cmd.type & PyCommandType::pctDO_NOT_SHOW) == 0)) {
+            if ( (str.IsEmpty() || cmd.name.StartsWith(str)) && ((cmd.type & PyCommandType::pctDO_NOT_SHOW) == 0) ){
                 nb_words++; possible += possible.empty() ? cmd.name : (" " + cmd.name);
             }
         }
@@ -637,24 +640,24 @@ void FreeCADDialog::createSTC()
             (wxObject*)NULL,
             this);
 
-    m_text->StyleSetForeground(wxSTC_P_DEFAULT, wxColour(0, 0, 0));
-    m_text->StyleSetForeground(wxSTC_P_COMMENTLINE, wxColour(128, 255, 128)); // comment, grennsish
-    m_text->StyleSetForeground(wxSTC_P_COMMENTBLOCK, wxColour(128, 255, 128)); // comment, grennsish
-    m_text->StyleSetForeground(wxSTC_P_NUMBER, wxColour(255, 128, 0)); // number red-orange
-    m_text->StyleSetForeground(wxSTC_P_STRING, wxColour(128, 256, 0)); // string, light green
-    m_text->StyleSetBackground(wxSTC_P_STRINGEOL, wxColour(255, 0, 0)); // End of line where string is not closed
-    m_text->StyleSetForeground(wxSTC_P_CHARACTER, wxColour(128, 256, 0));
-    m_text->StyleSetForeground(wxSTC_P_WORD, wxColour(0, 0, 128));
+    m_text->StyleSetForeground(wxSTC_P_DEFAULT, wxColour(0u, 0u, 0u));
+    m_text->StyleSetForeground(wxSTC_P_COMMENTLINE, wxColour(128u, 255u, 128u)); // comment, grennsish
+    m_text->StyleSetForeground(wxSTC_P_COMMENTBLOCK, wxColour(128u, 255u, 128u)); // comment, grennsish
+    m_text->StyleSetForeground(wxSTC_P_NUMBER, wxColour(255u, 128u, 0u)); // number red-orange
+    m_text->StyleSetForeground(wxSTC_P_STRING, wxColour(128u, 256u, 0u)); // string, light green
+    m_text->StyleSetBackground(wxSTC_P_STRINGEOL, wxColour(255u, 0u, 0u)); // End of line where string is not closed
+    m_text->StyleSetForeground(wxSTC_P_CHARACTER, wxColour(128u, 256u, 0u));
+    m_text->StyleSetForeground(wxSTC_P_WORD, wxColour(0u, 0u, 128u));
     m_text->StyleSetBold(wxSTC_P_WORD, true),
-        m_text->StyleSetForeground(wxSTC_P_WORD2, wxColour(0, 0, 128));
-    m_text->StyleSetForeground(wxSTC_P_TRIPLE, wxColour(128, 0, 0)); // triple quote
-    m_text->StyleSetForeground(wxSTC_P_TRIPLEDOUBLE, wxColour(128, 0, 0)); //triple double quote
-    m_text->StyleSetForeground(wxSTC_P_DEFNAME, wxColour(0, 128, 128)); // Function or method name definition
+    m_text->StyleSetForeground(wxSTC_P_WORD2, wxColour(0u, 0u, 128u));
+    m_text->StyleSetForeground(wxSTC_P_TRIPLE, wxColour(128u, 0u, 0u)); // triple quote
+    m_text->StyleSetForeground(wxSTC_P_TRIPLEDOUBLE, wxColour(128u, 0u, 0u)); //triple double quote
+    m_text->StyleSetForeground(wxSTC_P_DEFNAME, wxColour(0u, 128u, 128u)); // Function or method name definition
     m_text->StyleSetBold(wxSTC_P_DEFNAME, true),
-    m_text->StyleSetForeground(wxSTC_P_OPERATOR, wxColour(255, 0, 0));
+    m_text->StyleSetForeground(wxSTC_P_OPERATOR, wxColour(255u, 0u, 0u));
     m_text->StyleSetBold(wxSTC_P_OPERATOR, true),
     
-    m_text->StyleSetForeground(wxSTC_P_IDENTIFIER, wxColour(255, 64, 255)); // function call and almost all defined words in the language, violet
+    m_text->StyleSetForeground(wxSTC_P_IDENTIFIER, wxColour(255u, 64u, 255u)); // function call and almost all defined words in the language, violet
 
     //add text if the saved file exist
     boost::filesystem::path temp_file(Slic3r::data_dir());
@@ -809,7 +812,7 @@ void FreeCADDialog::create_geometry(wxCommandEvent& event_args) {
     temp_file = temp_file / "exec_temp.py";
     wxString text = m_text->GetText();
     if (text.find("scene().redraw(") == std::string::npos) {
-        int redraw_pos = text.find("redraw()");
+        size_t redraw_pos = text.find("redraw()");
         if (redraw_pos == std::string::npos) {
             text = "scene().redraw(\n" + text + "\n)";
         } else {

+ 3 - 1
src/slic3r/GUI/FreeCADDialog.hpp

@@ -3,6 +3,7 @@
 
 #include <map>
 #include <vector>
+#include <regex>
 
 #include "GUI_App.hpp"
 #include "GUI_Utils.hpp"
@@ -14,6 +15,7 @@
 #include <wx/textctrl.h>
 #include <wx/gbsizer.h>
 #include <boost/process.hpp>
+#include <boost/asio.hpp>
 
 namespace Slic3r { 
 namespace GUI {
@@ -34,7 +36,7 @@ public:
     PyCommandType type;
     wxString tooltip;
     std::vector<std::string> args;
-    PyCommand(wxString lbl, PyCommandType modifier) : name(lbl), type(modifier) { auto lol = { "Z","z" }; }
+    PyCommand(wxString lbl, PyCommandType modifier) : name(lbl), type(modifier) { }
     PyCommand(wxString lbl, uint16_t modifier) : name(lbl), type(PyCommandType(modifier)) {}
     PyCommand(wxString lbl, PyCommandType modifier, std::string tooltip) : name(lbl), type(modifier), tooltip(tooltip) {}
     PyCommand(wxString lbl, uint16_t modifier, std::string tooltip) : name(lbl), type(PyCommandType(modifier)), tooltip(tooltip) {}