From bf215bba858eae740271e5437027bc10a1384f12 Mon Sep 17 00:00:00 2001 From: supermerill Date: Tue, 23 Jun 2020 13:01:17 +0200 Subject: [PATCH] compilation fixes also some freepyscad update --- .github/workflows/ccpp_mac.yml | 9 +++ .github/workflows/ccpp_ubuntu.yml | 6 ++ deps/deps-linux.cmake | 2 + sandboxes/opencsg/CMakeLists.txt | 2 +- src/CMakeLists.txt | 6 +- src/libslic3r/Config.hpp | 2 +- src/libslic3r/GCode/CoolingBuffer.cpp | 1 + src/libslic3r/PerimeterGenerator.cpp | 3 +- src/slic3r/GUI/FreeCADDialog.cpp | 79 ++++++++++++++------------- src/slic3r/GUI/FreeCADDialog.hpp | 4 +- 10 files changed, 69 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ccpp_mac.yml b/.github/workflows/ccpp_mac.yml index 5bd6bae0da1..af4fa31b651 100644 --- a/.github/workflows/ccpp_mac.yml +++ b/.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_* diff --git a/.github/workflows/ccpp_ubuntu.yml b/.github/workflows/ccpp_ubuntu.yml index 22303525a62..8a7831b03a8 100644 --- a/.github/workflows/ccpp_ubuntu.yml +++ b/.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_* diff --git a/deps/deps-linux.cmake b/deps/deps-linux.cmake index e99c4e23fe8..14fc931eaff 100644 --- a/deps/deps-linux.cmake +++ b/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 diff --git a/sandboxes/opencsg/CMakeLists.txt b/sandboxes/opencsg/CMakeLists.txt index bea05306fac..ec1f4cae91b 100644 --- a/sandboxes/opencsg/CMakeLists.txt +++ b/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) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0814b86ae09..aa4de9672f6 100644 --- a/src/CMakeLists.txt +++ b/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) diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index 1cc0378cf1c..05fe265c08d 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -867,7 +867,7 @@ class ConfigOptionPercentsTempl : public ConfigOptionFloatsTempl 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 { diff --git a/src/libslic3r/GCode/CoolingBuffer.cpp b/src/libslic3r/GCode/CoolingBuffer.cpp index d4e73d8bd0d..c1a47446fe7 100644 --- a/src/libslic3r/GCode/CoolingBuffer.cpp +++ b/src/libslic3r/GCode/CoolingBuffer.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #if 0 #define DEBUG diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index b35f020f0b1..e5ca99af542 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/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); diff --git a/src/slic3r/GUI/FreeCADDialog.cpp b/src/slic3r/GUI/FreeCADDialog.cpp index 5cab954283b..e993bc1f2ed 100644 --- a/src/slic3r/GUI/FreeCADDialog.cpp +++ b/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 +#include +#include +#include + #include #include #include #include #include "wxExtensions.hpp" -#include - -//C++11 -#include -#include -#include -#include #include #include #include #include #include +#include +#include +#include #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 listener) + void get_string_from_web_async(const std::string &url, FreeCADDialog* free, std::function 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 { diff --git a/src/slic3r/GUI/FreeCADDialog.hpp b/src/slic3r/GUI/FreeCADDialog.hpp index 016f9c1fdb4..f93fac5df56 100644 --- a/src/slic3r/GUI/FreeCADDialog.hpp +++ b/src/slic3r/GUI/FreeCADDialog.hpp @@ -3,6 +3,7 @@ #include #include +#include #include "GUI_App.hpp" #include "GUI_Utils.hpp" @@ -14,6 +15,7 @@ #include #include #include +#include namespace Slic3r { namespace GUI { @@ -34,7 +36,7 @@ class PyCommand { PyCommandType type; wxString tooltip; std::vector 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) {}