diff --git a/cmake/modules/FindAlienWx.cmake b/cmake/modules/FindAlienWx.cmake index a96c29195..65221172b 100644 --- a/cmake/modules/FindAlienWx.cmake +++ b/cmake/modules/FindAlienWx.cmake @@ -49,6 +49,7 @@ my \$defines = ' ' . Alien::wxWidgets->defines; my \$cflags = Alien::wxWidgets->c_flags; my \$linkflags = Alien::wxWidgets->link_flags; my \$libraries = ' ' . Alien::wxWidgets->libraries(@components); +my \$gui_toolkit = Alien::wxWidgets->config->{toolkit}; #my @libraries = Alien::wxWidgets->link_libraries(@components); #my @implib = Alien::wxWidgets->import_libraries(@components); #my @shrlib = Alien::wxWidgets->shared_libraries(@components); @@ -82,6 +83,7 @@ cmake_set_var('LIBRARIES', \$libraries); cmake_set_var('DEFINITIONS', \$defines); #cmake_set_var('DEFINITIONS_DEBUG', ); cmake_set_var('CXX_FLAGS', \$cflags); +cmake_set_var('GUI_TOOLKIT', \$gui_toolkit); close \$fh; ") include(${AlienWx_TEMP_INCLUDE}) @@ -96,6 +98,7 @@ if (AlienWx_DEBUG) message(STATUS " AlienWx_DEFINITIONS = ${AlienWx_DEFINITIONS}") message(STATUS " AlienWx_DEFINITIONS_DEBUG = ${AlienWx_DEFINITIONS_DEBUG}") message(STATUS " AlienWx_CXX_FLAGS = ${AlienWx_CXX_FLAGS}") + message(STATUS " AlienWx_GUI_TOOLKIT = ${AlienWx_GUI_TOOLKIT}") endif() include(FindPackageHandleStandardArgs) diff --git a/xs/CMakeLists.txt b/xs/CMakeLists.txt index 66c1cdd6a..f4d0b17ea 100644 --- a/xs/CMakeLists.txt +++ b/xs/CMakeLists.txt @@ -8,6 +8,7 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/) if (CMAKE_SYSTEM_NAME STREQUAL "Linux") # Workaround for an old CMake, which does not understand CMAKE_CXX_STANDARD. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall" ) + find_package(PkgConfig REQUIRED) endif() if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX) @@ -579,6 +580,15 @@ if (SLIC3R_PRUSACONTROL) #add_compile_options(${AlienWx_CXX_FLAGS}) add_definitions(${AlienWx_DEFINITIONS}) set(wxWidgets_LIBRARIES ${AlienWx_LIBRARIES}) + # On Linux / gtk, we need to have a direct access to gtk+ for some workarounds. + if (AlienWx_GUI_TOOLKIT STREQUAL "gtk2") + pkg_check_modules(GTK2 gtk+-2.0) + include_directories(${GTK2_INCLUDE_DIRS}) + endif() + if (AlienWx_GUI_TOOLKIT STREQUAL "gtk3") + pkg_check_modules(GTK3 gtk+-3.0) + include_directories(${GTK3_INCLUDE_DIRS}) + endif() else () find_package(wxWidgets REQUIRED COMPONENTS base core adv html gl) include(${wxWidgets_USE_FILE}) diff --git a/xs/src/slic3r/GUI/OptionsGroup.cpp b/xs/src/slic3r/GUI/OptionsGroup.cpp index 57659d03d..629a9f3a0 100644 --- a/xs/src/slic3r/GUI/OptionsGroup.cpp +++ b/xs/src/slic3r/GUI/OptionsGroup.cpp @@ -150,8 +150,15 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** colored_Label/* // Build a label if we have it wxStaticText* label=nullptr; if (label_width != 0) { + long label_style = staticbox ? 0 : wxALIGN_RIGHT; +#ifdef __WXGTK__ + // workaround for correct text align of the StaticBox on Linux + // flags wxALIGN_RIGHT and wxALIGN_CENTRE don't work when Ellipsize flags are _not_ given. + // Text is properly aligned only when Ellipsize is checked. + label_style |= staticbox ? 0 : wxST_ELLIPSIZE_END; +#endif /* __WXGTK__ */ label = new wxStaticText(parent(), wxID_ANY, line.label + (line.label.IsEmpty() ? "" : ":"), - wxDefaultPosition, wxSize(label_width, -1), staticbox ? 0 : wxALIGN_RIGHT); + wxDefaultPosition, wxSize(label_width, -1), label_style); label->SetFont(label_font); label->Wrap(label_width); // avoid a Linux/GTK bug grid_sizer->Add(label, 0, (staticbox ? 0 : wxALIGN_RIGHT | wxRIGHT) | wxALIGN_CENTER_VERTICAL, 5);