mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-28 19:21:20 -06:00
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
|
|
@ -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