summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2016-05-06 21:00:48 +0000
committerjabiertxof <info@marker.es>2016-05-06 21:00:48 +0000
commit21b8afc070567499476e1e902faf454057c7adab (patch)
treec57167f1ad89b745fc05eb20db216da4c94316ea /src
parentFinishing eraser tool. TODO undo work (diff)
parentPrevent scrollbar overlay from covering swatches in GTK3 build. (diff)
downloadinkscape-21b8afc070567499476e1e902faf454057c7adab.tar.gz
inkscape-21b8afc070567499476e1e902faf454057c7adab.zip
update to trunk
(bzr r14865.1.3)
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt11
-rw-r--r--src/extension/loader.cpp2
-rw-r--r--src/extension/loader.h6
-rw-r--r--src/extension/system.cpp13
-rw-r--r--src/ui/cache/svg_preview_cache.cpp2
-rw-r--r--src/ui/dialog/glyphs.h2
-rw-r--r--src/ui/previewholder.cpp6
-rw-r--r--src/ui/previewholder.h1
-rw-r--r--src/ui/widget/panel.cpp4
-rw-r--r--src/ui/widget/panel.h4
-rw-r--r--src/widgets/button.cpp16
-rw-r--r--src/widgets/icon.cpp46
12 files changed, 76 insertions, 37 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e44eb757d..df25728f4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -558,6 +558,8 @@ if (NOT "${WITH_EXT_GDL}")
endif()
+
+
# Link the inkscape_base library against all external dependencies
target_link_libraries(inkscape_base ${INKSCAPE_TARGET_LIBS})
@@ -565,3 +567,12 @@ target_link_libraries(inkscape_base ${INKSCAPE_TARGET_LIBS})
target_link_libraries(inkscape inkscape_base )
target_link_libraries(inkview inkscape_base)
+#Define the installation
+install(
+ TARGETS inkscape_base inkscape inkview
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib/inkscape
+ ARCHIVE DESTINATION lib/inkscape
+ )
+
+
diff --git a/src/extension/loader.cpp b/src/extension/loader.cpp
index 110df3ae3..863a176ca 100644
--- a/src/extension/loader.cpp
+++ b/src/extension/loader.cpp
@@ -74,7 +74,7 @@ Implementation::Implementation *Loader::load_implementation(Inkscape::XML::Docum
_getInkscapeVersion GetInkscapeVersion = NULL;
// build the path where to look for the plugin
- gchar *path = g_build_filename(_baseDirectory, name, (char *) NULL);
+ gchar *path = g_build_filename(_baseDirectory.c_str(), name, (char *) NULL);
module = g_module_open(path, G_MODULE_BIND_LOCAL);
g_free(path);
diff --git a/src/extension/loader.h b/src/extension/loader.h
index 5d48bf861..0d3a69061 100644
--- a/src/extension/loader.h
+++ b/src/extension/loader.h
@@ -31,7 +31,7 @@ public:
*
* @param dir is the path where the plugin should be loaded from.
*/
- void set_base_directory(const gchar *dir) {
+ void set_base_directory(std::string dir) {
_baseDirectory = dir;
}
@@ -51,7 +51,7 @@ public:
Implementation::Implementation *load_implementation(Inkscape::XML::Document *doc);
private:
- const gchar *_baseDirectory; /**< The base directory to load a plugin from */
+ std::string _baseDirectory; /**< The base directory to load a plugin from */
};
@@ -70,4 +70,4 @@ private:
fill-column:99
End:
*/
-// vim:filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99: \ No newline at end of file
+// vim:filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99:
diff --git a/src/extension/system.cpp b/src/extension/system.cpp
index 6b8e80d3c..3c623455a 100644
--- a/src/extension/system.cpp
+++ b/src/extension/system.cpp
@@ -47,7 +47,7 @@ namespace Extension {
static void open_internal(Inkscape::Extension::Extension *in_plug, gpointer in_data);
static void save_internal(Inkscape::Extension::Extension *in_plug, gpointer in_data);
-static Extension *build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation *in_imp);
+static Extension *build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation *in_imp, std::string* baseDir);
/**
* \return A new document created from the filename passed in
@@ -422,7 +422,7 @@ get_print(gchar const *key)
* case could apply to modules that are built in (like the SVG load/save functions).
*/
static Extension *
-build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation *in_imp)
+build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation *in_imp, std::string* baseDir)
{
enum {
MODULE_EXTENSION,
@@ -490,7 +490,9 @@ build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation
}
case MODULE_PLUGIN: {
Inkscape::Extension::Loader loader = Inkscape::Extension::Loader();
- loader.set_base_directory ( Inkscape::Application::profile_path("extensions"));
+ if( baseDir != NULL){
+ loader.set_base_directory ( *baseDir );
+ }
imp = loader.load_implementation(doc);
break;
}
@@ -546,7 +548,8 @@ Extension *
build_from_file(gchar const *filename)
{
Inkscape::XML::Document *doc = sp_repr_read_file(filename, INKSCAPE_EXTENSION_URI);
- Extension *ext = build_from_reprdoc(doc, NULL);
+ std::string dir = Glib::path_get_dirname(filename);
+ Extension *ext = build_from_reprdoc(doc, NULL, &dir);
if (ext != NULL)
Inkscape::GC::release(doc);
else
@@ -568,7 +571,7 @@ build_from_mem(gchar const *buffer, Implementation::Implementation *in_imp)
{
Inkscape::XML::Document *doc = sp_repr_read_mem(buffer, strlen(buffer), INKSCAPE_EXTENSION_URI);
g_return_val_if_fail(doc != NULL, NULL);
- Extension *ext = build_from_reprdoc(doc, in_imp);
+ Extension *ext = build_from_reprdoc(doc, in_imp, NULL);
Inkscape::GC::release(doc);
return ext;
}
diff --git a/src/ui/cache/svg_preview_cache.cpp b/src/ui/cache/svg_preview_cache.cpp
index f1d6304cb..eeb99e045 100644
--- a/src/ui/cache/svg_preview_cache.cpp
+++ b/src/ui/cache/svg_preview_cache.cpp
@@ -1,5 +1,5 @@
/** \file
- * SPIcon: Generic icon widget
+ * SVGPreview: Preview cache
*/
/*
* Authors:
diff --git a/src/ui/dialog/glyphs.h b/src/ui/dialog/glyphs.h
index 3d0571244..00c3ffa07 100644
--- a/src/ui/dialog/glyphs.h
+++ b/src/ui/dialog/glyphs.h
@@ -27,8 +27,6 @@ class font_instance;
namespace Inkscape {
namespace UI {
-class PreviewHolder;
-
namespace Dialog {
class GlyphColumns;
diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp
index 21f3f38d7..beb83f35c 100644
--- a/src/ui/previewholder.cpp
+++ b/src/ui/previewholder.cpp
@@ -340,6 +340,12 @@ void PreviewHolder::calcGridSize( const Gtk::Widget* thing, int itemCount, int&
width = itemCount;
height = 1;
+#if GTK_CHECK_VERSION(3,16,0)
+ // Disable overlay scrolling as the scrollbar covers up swatches.
+ // For some reason this also makes the height 55px.
+ ((Gtk::ScrolledWindow *)_scroller)->set_overlay_scrolling(false);
+#endif
+
if ( _anchor == SP_ANCHOR_SOUTH || _anchor == SP_ANCHOR_NORTH ) {
Gtk::Requisition req;
#if GTK_CHECK_VERSION(3,0,0)
diff --git a/src/ui/previewholder.h b/src/ui/previewholder.h
index f6d1985cc..28c0fd865 100644
--- a/src/ui/previewholder.h
+++ b/src/ui/previewholder.h
@@ -3,6 +3,7 @@
#define SEEN_PREVIEW_HOLDER_H
/*
* A simple interface for previewing representations.
+ * Used by Swatches
*
* Authors:
* Jon A. Cruz
diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp
index 8a1e98a63..5d4a25a68 100644
--- a/src/ui/widget/panel.cpp
+++ b/src/ui/widget/panel.cpp
@@ -73,6 +73,9 @@ Panel::Panel(Glib::ustring const &label, gchar const *prefs_path,
_action_area(0),
_fillable(0)
{
+#if WITH_GTKMM_3_0
+ set_orientation( Gtk::ORIENTATION_VERTICAL );
+#endif
_init();
}
@@ -92,7 +95,6 @@ void Panel::_popper(GdkEventButton* event)
void Panel::_init()
{
- Glib::ustring tmp("<");
_anchor = SP_ANCHOR_CENTER;
guint panel_size = 0, panel_mode = 0, panel_ratio = 100, panel_border = 0;
diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h
index a90060e17..7b2836fe8 100644
--- a/src/ui/widget/panel.h
+++ b/src/ui/widget/panel.h
@@ -64,7 +64,11 @@ namespace Widget {
* @see UI::Dialog::DesktopTracker to handle desktop change, selection change and selected object modifications.
* @see UI::Dialog::DialogManager manages the dialogs within inkscape.
*/
+#if WITH_GTKMM_3_0
+class Panel : public Gtk::Box {
+#else
class Panel : public Gtk::VBox {
+#endif
public:
static void prep();
diff --git a/src/widgets/button.cpp b/src/widgets/button.cpp
index 54f073c01..6ea8c1360 100644
--- a/src/widgets/button.cpp
+++ b/src/widgets/button.cpp
@@ -106,11 +106,13 @@ static void sp_button_get_preferred_width(GtkWidget *widget, gint *minimal_width
GtkStyleContext *context = gtk_widget_get_style_context (widget);
GtkBorder padding;
+ GtkBorder border;
- gtk_style_context_get_border(context, static_cast<GtkStateFlags>(0), &padding);
+ gtk_style_context_get_padding(context, GTK_STATE_FLAG_NORMAL, &padding);
+ gtk_style_context_get_border( context, GTK_STATE_FLAG_NORMAL, &border );
- *minimal_width += 2 + 2 * MAX(2, padding.left + padding.right);
- *natural_width += 2 + 2 * MAX(2, padding.left + padding.right);
+ *minimal_width += MAX(2, padding.left + padding.right + border.left + border.right);
+ *natural_width += MAX(2, padding.left + padding.right + border.left + border.right);
}
static void sp_button_get_preferred_height(GtkWidget *widget, gint *minimal_height, gint *natural_height)
@@ -126,11 +128,13 @@ static void sp_button_get_preferred_height(GtkWidget *widget, gint *minimal_heig
GtkStyleContext *context = gtk_widget_get_style_context (widget);
GtkBorder padding;
+ GtkBorder border;
- gtk_style_context_get_border(context, static_cast<GtkStateFlags>(0), &padding);
+ gtk_style_context_get_padding(context, GTK_STATE_FLAG_NORMAL, &padding);
+ gtk_style_context_get_border( context, GTK_STATE_FLAG_NORMAL, &border );
- *minimal_height += 2 + 2 * MAX(2, padding.top + padding.bottom);
- *natural_height += 2 + 2 * MAX(2, padding.top + padding.bottom);
+ *minimal_height += MAX(2, padding.top + padding.bottom + border.top + border.bottom);
+ *natural_height += MAX(2, padding.top + padding.bottom + border.top + border.bottom);
}
#else
static void sp_button_size_request(GtkWidget *widget, GtkRequisition *requisition)
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index 010b3a6fb..f2031fe51 100644
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
@@ -232,6 +232,7 @@ void IconImpl::sizeAllocate(GtkWidget *widget, GtkAllocation *allocation)
}
}
+// GTK3 Only, Doesn't actually seem to be used.
gboolean IconImpl::draw(GtkWidget *widget, cairo_t* cr)
{
SPIcon *icon = SP_ICON(widget);
@@ -247,32 +248,34 @@ gboolean IconImpl::draw(GtkWidget *widget, cairo_t* cr)
if (gtk_widget_get_state_flags (GTK_WIDGET(icon)) != GTK_STATE_FLAG_NORMAL && image) {
#else
if (gtk_widget_get_state (GTK_WIDGET(icon)) != GTK_STATE_NORMAL && image) {
+ std::cerr << "IconImpl::draw: Ooops! It is called in GTK2" << std::endl;
#endif
- GtkIconSource *source = gtk_icon_source_new();
- gtk_icon_source_set_pixbuf(source, icon->pb);
- gtk_icon_source_set_size(source, GTK_ICON_SIZE_SMALL_TOOLBAR); // note: this is boilerplate and not used
- gtk_icon_source_set_size_wildcarded(source, FALSE);
+ std::cerr << "IconImpl::draw: No image, creating fallback" << std::endl;
#if GTK_CHECK_VERSION(3,0,0)
- image = gtk_render_icon_pixbuf(gtk_widget_get_style_context(widget),
- source,
- (GtkIconSize)-1);
+ // image = gtk_render_icon_pixbuf(gtk_widget_get_style_context(widget),
+ // source,
+ // (GtkIconSize)-1);
// gtk_render_icon_pixbuf deprecated, replaced by:
- // GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
- // image = gtk_icon_theme_load_icon (icon_theme,
- // name,
- // 32,
- // 0,
- // NULL);
+ GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
+ image = gtk_icon_theme_load_icon (icon_theme,
+ "gtk-image",
+ 32,
+ (GtkIconLookupFlags)0,
+ NULL);
#else
+ GtkIconSource *source = gtk_icon_source_new();
+ gtk_icon_source_set_pixbuf(source, icon->pb);
+ gtk_icon_source_set_size(source, GTK_ICON_SIZE_SMALL_TOOLBAR); // note: this is boilerplate and not used
+ gtk_icon_source_set_size_wildcarded(source, FALSE);
image = gtk_style_render_icon(gtk_widget_get_style(widget), source,
gtk_widget_get_direction(widget),
(GtkStateType) gtk_widget_get_state(widget),
(GtkIconSize)-1, widget, "gtk-image");
+ gtk_icon_source_free(source);
#endif
- gtk_icon_source_free(source);
unref_image = true;
}
@@ -801,6 +804,10 @@ GtkWidget *IconImpl::newFull( Inkscape::IconSize lsize, gchar const *name )
GtkWidget *widget = NULL;
gint trySize = CLAMP( static_cast<gint>(lsize), 0, static_cast<gint>(G_N_ELEMENTS(iconSizeLookup) - 1) );
+ if (trySize != lsize ) {
+ std::cerr << "GtkWidget *IconImple::newFull(): lsize != trySize: lsize: " << lsize
+ << " try Size: " << trySize << " " << (name?name:"NULL") << std::endl;
+ }
if ( !sizeMapDone ) {
injectCustomSize();
}
@@ -828,6 +835,7 @@ GtkWidget *IconImpl::newFull( Inkscape::IconSize lsize, gchar const *name )
if ( Inkscape::Preferences::get()->getBool("/options/iconrender/named_nodelay") ) {
int psize = getPhysSize(lsize);
+ // std::cout << " name: " << name << " size: " << psize << std::endl;
prerenderIcon(name, mappedSize, psize);
} else {
addPreRender( mappedSize, name );
@@ -1000,8 +1008,6 @@ int IconImpl::getPhysSize(int size)
"inkscape-decoration"
};
- GtkWidget *icon = GTK_WIDGET(g_object_new(SP_TYPE_ICON, NULL));
-
for (unsigned i = 0; i < G_N_ELEMENTS(gtkSizes); ++i) {
guint const val_ix = (gtkSizes[i] <= GTK_ICON_SIZE_DIALOG) ? (guint)gtkSizes[i] : (guint)Inkscape::ICON_SIZE_DECORATION;
@@ -1026,7 +1032,12 @@ int IconImpl::getPhysSize(int size)
// gtk_icon_size_lookup(), because themes are free to render the pixbuf however
// they like, including changing the usual size."
gchar const *id = INKSCAPE_ICON("document-open");
- GdkPixbuf *pb = gtk_widget_render_icon( icon, id, gtkSizes[i], NULL);
+ GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
+ GdkPixbuf *pb = gtk_icon_theme_load_icon (icon_theme,
+ id,
+ vals[val_ix],
+ (GtkIconLookupFlags)0,
+ NULL);
if (pb) {
width = gdk_pixbuf_get_width(pb);
height = gdk_pixbuf_get_height(pb);
@@ -1042,7 +1053,6 @@ int IconImpl::getPhysSize(int size)
g_object_unref(G_OBJECT(pb));
}
}
- //g_object_unref(icon);
init = true;
}