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

This commit is contained in:
Enrico Turri 2019-03-27 12:51:59 +01:00
commit 30c4e4fed6
7 changed files with 25 additions and 12 deletions

View File

@ -4,6 +4,7 @@
#include <boost/log/trivial.hpp>
#include <boost/format.hpp>
#include <boost/filesystem.hpp>
#include <boost/nowide/convert.hpp>
#ifdef WIN32
@ -11,6 +12,7 @@
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <Windows.h>
#include <shellapi.h>
// https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/
// This routine appends the given argument to a command line such that CommandLineToArgvW will return the argument string unchanged.

View File

@ -1,5 +1,7 @@
#include "Version.hpp"
#include <cctype>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/nowide/fstream.hpp>

View File

@ -32,7 +32,7 @@
#include "GUI.hpp"
#ifdef HAS_GLSAFE
void glAssertRecentCallImpl()
void glAssertRecentCallImpl(const char *file_name, unsigned int line, const char *function_name)
{
GLenum err = glGetError();
if (err == GL_NO_ERROR)
@ -48,7 +48,7 @@ void glAssertRecentCallImpl()
case GL_OUT_OF_MEMORY: sErr = "Out Of Memory"; break;
default: sErr = "Unknown"; break;
}
BOOST_LOG_TRIVIAL(error) << "OpenGL error " << (int)err << ": " << sErr;
BOOST_LOG_TRIVIAL(error) << "OpenGL error in " << file_name << ":" << line << ", function " << function_name << "() : " << (int)err << " - " << sErr;
assert(false);
}
#endif

View File

@ -16,9 +16,9 @@
#endif
#ifdef HAS_GLSAFE
extern void glAssertRecentCallImpl();
inline void glAssertRecentCall() { glAssertRecentCallImpl(); }
#define glsafe(cmd) do { cmd; glAssertRecentCallImpl(); } while (false)
extern void glAssertRecentCallImpl(const char *file_name, unsigned int line, const char *function_name);
inline void glAssertRecentCall() { glAssertRecentCallImpl(__FILE__, __LINE__, __FUNCTION__); }
#define glsafe(cmd) do { cmd; glAssertRecentCallImpl(__FILE__, __LINE__, __FUNCTION__); } while (false)
#else
inline void glAssertRecentCall() { }
#define glsafe(cmd) cmd

View File

@ -108,7 +108,7 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector<std::stri
if (!boost::algorithm::iends_with(filename, ".svg"))
continue;
NSVGimage* image = nsvgParseFromFile(filename.c_str(), "px", 96.0f);
NSVGimage* image = nsvgParseFromFile(encode_path(filename.c_str()).c_str(), "px", 96.0f);
if (image == nullptr)
continue;
@ -361,7 +361,7 @@ bool GLTexture::load_from_png(const std::string& filename, bool use_mipmaps)
bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, unsigned int max_size_px)
{
NSVGimage* image = nsvgParseFromFile(filename.c_str(), "px", 96.0f);
NSVGimage* image = nsvgParseFromFile(encode_path(filename.c_str()).c_str(), "px", 96.0f);
if (image == nullptr)
{
// printf("Could not open SVG image.\n");

View File

@ -103,7 +103,7 @@ public:
}
void unbind() { event_storage.reset(nullptr); }
explicit operator bool() const noexcept { return !!event_storage; }
explicit operator bool() const { return !!event_storage; }
};

View File

@ -1,4 +1,5 @@
// #include "libslic3r/GCodeSender.hpp"
#include "slic3r/Utils/Serial.hpp"
#include "Tab.hpp"
#include "PresetBundle.hpp"
#include "PresetHints.hpp"
@ -6,7 +7,6 @@
#include "slic3r/Utils/Http.hpp"
#include "slic3r/Utils/PrintHost.hpp"
#include "slic3r/Utils/Serial.hpp"
#include "BonjourDialog.hpp"
#include "WipeTowerDialog.hpp"
#include "ButtonsDescription.hpp"
@ -542,7 +542,10 @@ void Tab::update_changed_tree_ui()
auto cur_item = m_treectrl->GetFirstVisibleItem();
if (!cur_item || !m_treectrl->IsVisible(cur_item))
return;
auto selection = m_treectrl->GetItemText(m_treectrl->GetSelection());
auto selected_item = m_treectrl->GetSelection();
auto selection = selected_item ? m_treectrl->GetItemText(selected_item) : "";
while (cur_item) {
auto title = m_treectrl->GetItemText(cur_item);
for (auto page : m_pages)
@ -2497,7 +2500,10 @@ void Tab::rebuild_page_tree()
if (!have_selection) {
// this is triggered on first load, so we don't disable the sel change event
m_treectrl->SelectItem(m_treectrl->GetFirstVisibleItem());//! (treectrl->GetFirstChild(rootItem));
auto item = m_treectrl->GetFirstVisibleItem();
if (item) {
m_treectrl->SelectItem(item);
}
}
// Thaw();
}
@ -2524,7 +2530,10 @@ void Tab::update_page_tree_visibility()
if (!have_selection) {
// this is triggered on first load, so we don't disable the sel change event
m_treectrl->SelectItem(m_treectrl->GetFirstVisibleItem());//! (treectrl->GetFirstChild(rootItem));
auto item = m_treectrl->GetFirstVisibleItem();
if (item) {
m_treectrl->SelectItem(item);
}
}
}