mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 16:51:21 -06:00
parent
a5882a1a1c
commit
2505c0a82d
3 changed files with 74 additions and 21 deletions
|
|
@ -256,11 +256,11 @@ if (SLIC3R_PCH AND NOT SLIC3R_SYNTAXONLY)
|
|||
add_precompiled_header(libslic3r_gui pchheader.hpp FORCEINCLUDE)
|
||||
endif ()
|
||||
|
||||
target_include_directories(libslic3r_gui PUBLIC /usr/include/glib-2.0)
|
||||
target_include_directories(libslic3r_gui PUBLIC /usr/lib/glib-2.0/include)
|
||||
target_include_directories(libslic3r_gui PUBLIC /usr/include/pango-1.0)
|
||||
target_include_directories(libslic3r_gui PUBLIC /usr/include/harfbuzz)
|
||||
target_include_directories(libslic3r_gui PUBLIC /usr/include/gtk-3.0/)
|
||||
target_include_directories(libslic3r_gui PUBLIC /usr/include/cairo/)
|
||||
target_include_directories(libslic3r_gui PUBLIC /usr/include/gdk-pixbuf-2.0/)
|
||||
target_include_directories(libslic3r_gui PUBLIC /usr/include/atk-1.0/)
|
||||
# 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,9 +32,13 @@
|
|||
#include "PhysicalPrinterDialog.hpp"
|
||||
#include "SavePresetDialog.hpp"
|
||||
|
||||
#include <glib-2.0/glib-object.h>
|
||||
#include <pango-1.0/pango/pango-layout.h>
|
||||
#include <gtk/gtk.h>
|
||||
// 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;
|
||||
|
||||
|
|
@ -134,8 +138,6 @@ PresetComboBox::PresetComboBox(wxWindow* parent, Preset::Type preset_type, const
|
|||
}
|
||||
evt.Skip();
|
||||
});
|
||||
|
||||
// g_object_set( G_OBJECT( this ), "ellipsize", PANGO_ELLIPSIZE_END, nullptr);
|
||||
}
|
||||
|
||||
PresetComboBox::~PresetComboBox()
|
||||
|
|
@ -186,19 +188,24 @@ void PresetComboBox::update_selection()
|
|||
SetSelection(m_last_selected);
|
||||
SetToolTip(GetString(m_last_selected));
|
||||
|
||||
GList* cells = gtk_cell_layout_get_cells( GTK_CELL_LAYOUT( m_widget ) );
|
||||
if( !cells )
|
||||
return;
|
||||
// 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));
|
||||
|
||||
GtkCellRendererText* cell = (GtkCellRendererText *) cells->next->data;
|
||||
// 'cells' contains the GtkCellRendererPixBuf for the icon,
|
||||
// 'cells->next' contains GtkCellRendererText for the text we need to ellipsize
|
||||
if (!cells || !cells->next) return;
|
||||
|
||||
if( !cell )
|
||||
return;
|
||||
auto cell = static_cast<GtkCellRendererText *>(cells->next->data);
|
||||
|
||||
g_object_set( G_OBJECT( cell ), "ellipsize", PANGO_ELLIPSIZE_END, NULL );
|
||||
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 );
|
||||
g_list_free(cells);
|
||||
#endif
|
||||
}
|
||||
|
||||
void PresetComboBox::update(std::string select_preset_name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue