Merge remote-tracking branch 'remotes/origin/master' into vb_osx_eject
This commit is contained in:
commit
4988b93b8d
3 changed files with 82 additions and 0 deletions
|
@ -255,3 +255,12 @@ endif ()
|
|||
if (SLIC3R_PCH AND NOT SLIC3R_SYNTAXONLY)
|
||||
add_precompiled_header(libslic3r_gui pchheader.hpp FORCEINCLUDE)
|
||||
endif ()
|
||||
|
||||
# We need to implement some hacks for wxWidgets and touch the underlying GTK
|
||||
# layer and sub-libraries. This forces us to use the include locations of these
|
||||
# libraries. No need to link to them, wxWidgets does that already.
|
||||
# See PresetComboBox.cpp for the includes and subsequent workarounds.
|
||||
if (UNIX AND NOT APPLE)
|
||||
find_package(GTK${SLIC3R_GTK} REQUIRED)
|
||||
target_include_directories(libslic3r_gui PRIVATE ${GTK${SLIC3R_GTK}_INCLUDE_DIRS})
|
||||
endif ()
|
||||
|
|
|
@ -32,6 +32,14 @@
|
|||
#include "PhysicalPrinterDialog.hpp"
|
||||
#include "SavePresetDialog.hpp"
|
||||
|
||||
// A workaround for a set of issues related to text fitting into gtk widgets:
|
||||
// See e.g.: https://github.com/prusa3d/PrusaSlicer/issues/4584
|
||||
#if defined(__WXGTK20__) || defined(__WXGTK3__)
|
||||
#include <glib-2.0/glib-object.h>
|
||||
#include <pango-1.0/pango/pango-layout.h>
|
||||
#include <gtk/gtk.h>
|
||||
#endif
|
||||
|
||||
using Slic3r::GUI::format_wxstr;
|
||||
|
||||
namespace Slic3r {
|
||||
|
@ -179,6 +187,25 @@ void PresetComboBox::update_selection()
|
|||
|
||||
SetSelection(m_last_selected);
|
||||
SetToolTip(GetString(m_last_selected));
|
||||
|
||||
// A workaround for a set of issues related to text fitting into gtk widgets:
|
||||
// See e.g.: https://github.com/prusa3d/PrusaSlicer/issues/4584
|
||||
#if defined(__WXGTK20__) || defined(__WXGTK3__)
|
||||
GList* cells = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(m_widget));
|
||||
|
||||
// 'cells' contains the GtkCellRendererPixBuf for the icon,
|
||||
// 'cells->next' contains GtkCellRendererText for the text we need to ellipsize
|
||||
if (!cells || !cells->next) return;
|
||||
|
||||
auto cell = static_cast<GtkCellRendererText *>(cells->next->data);
|
||||
|
||||
if (!cell) return;
|
||||
|
||||
g_object_set(G_OBJECT(cell), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
|
||||
|
||||
// Only the list of cells must be freed, the renderer isn't ours to free
|
||||
g_list_free(cells);
|
||||
#endif
|
||||
}
|
||||
|
||||
void PresetComboBox::update(std::string select_preset_name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue