Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortamasmeszaros <meszaros.q@gmail.com>2021-01-06 18:01:39 +0300
committertamasmeszaros <meszaros.q@gmail.com>2021-01-07 15:24:26 +0300
commita5882a1a1c3f561233a22cc7663514b97e5fb3ba (patch)
tree76912b4340a435922cb7d66230fedb68d249fe56
parent8e7958da124d128e8d4b8ebdec3ec6bf2c00af47 (diff)
success with text ellipsize for combobox
-rw-r--r--src/slic3r/CMakeLists.txt9
-rw-r--r--src/slic3r/GUI/PresetComboBoxes.cpp20
2 files changed, 29 insertions, 0 deletions
diff --git a/src/slic3r/CMakeLists.txt b/src/slic3r/CMakeLists.txt
index 699135d27..2101832f5 100644
--- a/src/slic3r/CMakeLists.txt
+++ b/src/slic3r/CMakeLists.txt
@@ -255,3 +255,12 @@ endif ()
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/)
diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp
index 6031edf78..c7598f9db 100644
--- a/src/slic3r/GUI/PresetComboBoxes.cpp
+++ b/src/slic3r/GUI/PresetComboBoxes.cpp
@@ -32,6 +32,10 @@
#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>
+
using Slic3r::GUI::format_wxstr;
namespace Slic3r {
@@ -130,6 +134,8 @@ PresetComboBox::PresetComboBox(wxWindow* parent, Preset::Type preset_type, const
}
evt.Skip();
});
+
+// g_object_set( G_OBJECT( this ), "ellipsize", PANGO_ELLIPSIZE_END, nullptr);
}
PresetComboBox::~PresetComboBox()
@@ -179,6 +185,20 @@ 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;
+
+ GtkCellRendererText* cell = (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 );
}
void PresetComboBox::update(std::string select_preset_name)