summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2011-05-19 04:43:01 +0000
committerJon A. Cruz <jon@joncruz.org>2011-05-19 04:43:01 +0000
commita622000f4859173bb7ac484b86cefe9fa4f169e4 (patch)
tree67346f20e163a5ff4fec535627547454369ccaa1 /src
parentAdding inkscape:label parameter to guidelines so that our guidelanes can disp... (diff)
downloadinkscape-a622000f4859173bb7ac484b86cefe9fa4f169e4.tar.gz
inkscape-a622000f4859173bb7ac484b86cefe9fa4f169e4.zip
Revert version bump so win devlibs can catch up.
(bzr r10210)
Diffstat (limited to 'src')
-rw-r--r--src/display/sp-canvas.cpp7
-rw-r--r--src/ege-adjustment-action.cpp10
-rw-r--r--src/ege-select-one-action.cpp3
-rw-r--r--src/ink-comboboxentry-action.cpp27
-rw-r--r--src/ink-comboboxentry-action.h2
-rw-r--r--src/inkscape.cpp4
-rw-r--r--src/io/sys.cpp4
-rw-r--r--src/ui/dialog/glyphs.cpp20
-rw-r--r--src/ui/dialog/glyphs.h2
-rw-r--r--src/widgets/sp-color-slider.cpp18
-rw-r--r--src/widgets/sp-color-wheel-selector.cpp4
11 files changed, 93 insertions, 8 deletions
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index 0d450362a..2d1e57092 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -47,9 +47,12 @@
using Inkscape::Debug::GdkEventLatencyTracker;
+// GTK_CHECK_VERSION returns false on failure
+#define HAS_GDK_EVENT_REQUEST_MOTIONS GTK_CHECK_VERSION(2, 12, 0)
+
// gtk_check_version returns non-NULL on failure
static bool const HAS_BROKEN_MOTION_HINTS =
- true || gtk_check_version(2, 12, 0) != NULL;
+ true || gtk_check_version(2, 12, 0) != NULL || !HAS_GDK_EVENT_REQUEST_MOTIONS;
// Define this to visualize the regions to be redrawn
//#define DEBUG_REDRAW 1;
@@ -1596,7 +1599,9 @@ sp_canvas_scroll (GtkWidget *widget, GdkEventScroll *event)
static inline void request_motions(GdkWindow *w, GdkEventMotion *event) {
gdk_window_get_pointer(w, NULL, NULL, NULL);
+#if HAS_GDK_EVENT_REQUEST_MOTIONS
gdk_event_request_motions(event);
+#endif
}
/**
diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp
index b8ee66f08..9c01b4c7c 100644
--- a/src/ege-adjustment-action.cpp
+++ b/src/ege-adjustment-action.cpp
@@ -47,8 +47,10 @@
#include <gtk/gtktoolitem.h>
#include <gtk/gtk.h>
#include <gtk/gtkhscale.h>
+#if GTK_CHECK_VERSION(2,12,0)
#include <gtk/gtkscalebutton.h>
#include <gtk/gtkstock.h>
+#endif /* GTK_CHECK_VERSION(2,12,0) */
#include <gtk/gtkhbox.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkmisc.h>
@@ -94,6 +96,7 @@ enum {
APPEARANCE_MINIMAL, /* no label, just choices in a drop-down menu */
};
+#if GTK_CHECK_VERSION(2,12,0)
/* TODO need to have appropriate icons setup for these: */
static const gchar *floogles[] = {
GTK_STOCK_REMOVE,
@@ -102,6 +105,7 @@ static const gchar *floogles[] = {
GTK_STOCK_ABOUT,
GTK_STOCK_GO_UP,
0};
+#endif /* GTK_CHECK_VERSION(2,12,0) */
typedef struct _EgeAdjustmentDescr EgeAdjustmentDescr;
@@ -842,10 +846,12 @@ static GtkWidget* create_tool_item( GtkAction* action )
gtk_scale_set_digits( GTK_SCALE(spinbutton), 0 );
g_signal_connect( G_OBJECT(spinbutton), "format-value", G_CALLBACK(slider_format_falue), leakyForNow );
+#if GTK_CHECK_VERSION(2,12,0)
} else if ( act->private_data->appearanceMode == APPEARANCE_MINIMAL ) {
spinbutton = gtk_scale_button_new( GTK_ICON_SIZE_MENU, 0, 100, 2, 0 );
gtk_scale_button_set_adjustment( GTK_SCALE_BUTTON(spinbutton), act->private_data->adj );
gtk_scale_button_set_icons( GTK_SCALE_BUTTON(spinbutton), floogles );
+#endif /* GTK_CHECK_VERSION(2,12,0) */
} else {
if ( gFactoryCb ) {
spinbutton = gFactoryCb( act->private_data->adj, act->private_data->climbRate, act->private_data->digits );
@@ -907,8 +913,10 @@ static GtkWidget* create_tool_item( GtkAction* action )
g_signal_connect_swapped( G_OBJECT(spinbutton), "event", G_CALLBACK(event_cb), action );
if ( act->private_data->appearanceMode == APPEARANCE_FULL ) {
/* */
+#if GTK_CHECK_VERSION(2,12,0)
} else if ( act->private_data->appearanceMode == APPEARANCE_MINIMAL ) {
/* */
+#endif /* GTK_CHECK_VERSION(2,12,0) */
} else {
gtk_entry_set_width_chars( GTK_ENTRY(spinbutton), act->private_data->digits + 3 );
}
@@ -954,8 +962,10 @@ gboolean focus_in_cb( GtkWidget *widget, GdkEventKey *event, gpointer data )
EgeAdjustmentAction* action = EGE_ADJUSTMENT_ACTION( data );
if ( GTK_IS_SPIN_BUTTON(widget) ) {
action->private_data->lastVal = gtk_spin_button_get_value( GTK_SPIN_BUTTON(widget) );
+#if GTK_CHECK_VERSION(2,12,0)
} else if ( GTK_IS_SCALE_BUTTON(widget) ) {
action->private_data->lastVal = gtk_scale_button_get_value( GTK_SCALE_BUTTON(widget) );
+#endif /* GTK_CHECK_VERSION(2,12,0) */
} else if (GTK_IS_RANGE(widget) ) {
action->private_data->lastVal = gtk_range_get_value( GTK_RANGE(widget) );
}
diff --git a/src/ege-select-one-action.cpp b/src/ege-select-one-action.cpp
index 1c3ec1ff5..83a083425 100644
--- a/src/ege-select-one-action.cpp
+++ b/src/ege-select-one-action.cpp
@@ -935,6 +935,7 @@ void resync_sensitive( EgeSelectOneAction* act )
GSList* group = (GSList*)data;
// List is backwards in group as compared to GtkTreeModel, we better do matching.
while ( group ) {
+#if GTK_CHECK_VERSION(2,16,0)
GtkRadioAction* ract = GTK_RADIO_ACTION(group->data);
const gchar* label = gtk_action_get_label( GTK_ACTION( ract ) );
@@ -963,6 +964,8 @@ void resync_sensitive( EgeSelectOneAction* act )
}
gtk_action_set_sensitive( GTK_ACTION(ract), sens );
+#endif
+
group = g_slist_next(group);
}
}
diff --git a/src/ink-comboboxentry-action.cpp b/src/ink-comboboxentry-action.cpp
index eaaf62113..74034e537 100644
--- a/src/ink-comboboxentry-action.cpp
+++ b/src/ink-comboboxentry-action.cpp
@@ -266,7 +266,9 @@ static void ink_comboboxentry_action_init (Ink_ComboBoxEntry_Action *action)
action->active = -1;
action->text = NULL;
action->entry_completion = NULL;
+#if !GTK_CHECK_VERSION(2,16,0)
action->indicator = NULL;
+#endif
action->popup = false;
action->warning = NULL;
action->altx_name = NULL;
@@ -346,7 +348,15 @@ GtkWidget* create_tool_item( GtkAction* action )
{
GtkWidget *align = gtk_alignment_new(0, 0.5, 0, 0);
+#if GTK_CHECK_VERSION(2,16,0)
gtk_container_add( GTK_CONTAINER(align), comboBoxEntry );
+#else // GTK_CHECK_VERSION(2,16,0)
+ GtkWidget *hbox = gtk_hbox_new( FALSE, 0 );
+ ink_comboboxentry_action->indicator = gtk_image_new_from_stock(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_box_pack_start( GTK_BOX(hbox), comboBoxEntry, TRUE, TRUE, 0 );
+ gtk_box_pack_start( GTK_BOX(hbox), ink_comboboxentry_action->indicator, FALSE, FALSE, 0 );
+ gtk_container_add( GTK_CONTAINER(align), hbox );
+#endif // GTK_CHECK_VERSION(2,16,0)
gtk_container_add( GTK_CONTAINER(item), align );
}
@@ -405,7 +415,10 @@ GtkWidget* create_tool_item( GtkAction* action )
}
+#if GTK_CHECK_VERSION(2,16,0)
gtk_action_connect_proxy( GTK_ACTION( action ), item );
+#endif
+
gtk_widget_show_all( item );
} else {
@@ -467,6 +480,7 @@ gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* ink
// Show or hide warning
if( ink_comboboxentry_action->active == -1 && ink_comboboxentry_action->warning != NULL ) {
+#if GTK_CHECK_VERSION(2,16,0)
{
GtkStockItem item;
gboolean isStock = gtk_stock_lookup( GTK_STOCK_DIALOG_WARNING, &item );
@@ -484,13 +498,22 @@ gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* ink
gtk_entry_set_icon_tooltip_text( ink_comboboxentry_action->entry,
GTK_ENTRY_ICON_SECONDARY,
ink_comboboxentry_action->warning );
+#else // GTK_CHECK_VERSION(2,16,0)
+ gtk_image_set_from_stock( GTK_IMAGE(ink_comboboxentry_action->indicator), GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_widget_set_tooltip_text( ink_comboboxentry_action->indicator, ink_comboboxentry_action->warning );
+#endif // GTK_CHECK_VERSION(2,16,0)
} else {
+#if GTK_CHECK_VERSION(2,16,0)
gtk_entry_set_icon_from_icon_name( GTK_ENTRY(ink_comboboxentry_action->entry),
GTK_ENTRY_ICON_SECONDARY,
NULL );
gtk_entry_set_icon_from_stock( GTK_ENTRY(ink_comboboxentry_action->entry),
GTK_ENTRY_ICON_SECONDARY,
NULL );
+#else // GTK_CHECK_VERSION(2,16,0)
+ gtk_image_set_from_stock( GTK_IMAGE(ink_comboboxentry_action->indicator), NULL, GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_widget_set_tooltip_text( ink_comboboxentry_action->indicator, NULL );
+#endif // GTK_CHECK_VERSION(2,16,0)
}
}
@@ -562,9 +585,13 @@ void ink_comboboxentry_action_set_warning( Ink_ComboBoxEntry_Action* action,
// Widget may not have been created....
if( action->entry ) {
+#if GTK_CHECK_VERSION(2,16,0)
gtk_entry_set_icon_tooltip_text( GTK_ENTRY(action->entry),
GTK_ENTRY_ICON_SECONDARY,
action->warning );
+#else // GTK_CHECK_VERSION(2,16,0)
+ gtk_image_set_from_stock( GTK_IMAGE(action->indicator), action->warning ? GTK_STOCK_DIALOG_WARNING : 0, GTK_ICON_SIZE_SMALL_TOOLBAR );
+#endif // GTK_CHECK_VERSION(2,16,0)
}
}
diff --git a/src/ink-comboboxentry-action.h b/src/ink-comboboxentry-action.h
index 1a83cb053..e080e6cdf 100644
--- a/src/ink-comboboxentry-action.h
+++ b/src/ink-comboboxentry-action.h
@@ -49,7 +49,9 @@ struct _Ink_ComboBoxEntry_Action {
GtkComboBoxEntry *combobox;
GtkEntry *entry;
GtkEntryCompletion *entry_completion;
+#if !GTK_CHECK_VERSION(2,16,0)
GtkWidget *indicator;
+#endif
gpointer cell_data_func; // drop-down menu format
diff --git a/src/inkscape.cpp b/src/inkscape.cpp
index 1b0893c0b..91e3b0c5f 100644
--- a/src/inkscape.cpp
+++ b/src/inkscape.cpp
@@ -442,7 +442,11 @@ void inkscape_autosave_init()
// Turn on autosave
guint32 timeout = prefs->getInt("/options/autosave/interval", 10) * 60;
// g_debug("options.autosave.interval = %d", prefs->getInt("/options/autosave/interval", 10));
+#if GLIB_CHECK_VERSION(2,14,0)
autosave_timeout_id = g_timeout_add_seconds(timeout, inkscape_autosave, NULL);
+#else
+ autosave_timeout_id = g_timeout_add(timeout * 1000, inkscape_autosave, NULL);
+#endif
}
}
diff --git a/src/io/sys.cpp b/src/io/sys.cpp
index e6c512be2..a68d02707 100644
--- a/src/io/sys.cpp
+++ b/src/io/sys.cpp
@@ -19,7 +19,9 @@
#include <glib/gstdio.h>
#include <glib/gutils.h>
#include <glibmm/fileutils.h>
-#include <glib/gstdio.h>
+#if GLIB_CHECK_VERSION(2,6,0)
+ #include <glib/gstdio.h>
+#endif
#include <glibmm/ustring.h>
#include <gtk/gtkmessagedialog.h>
diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp
index 8eef5d89b..f3d7ed971 100644
--- a/src/ui/dialog/glyphs.cpp
+++ b/src/ui/dialog/glyphs.cpp
@@ -48,6 +48,7 @@ GlyphsPanel &GlyphsPanel::getInstance()
}
+#if GLIB_CHECK_VERSION(2,14,0)
static std::map<GUnicodeScript, Glib::ustring> & getScriptToName()
{
static bool init = false;
@@ -122,6 +123,8 @@ static std::map<GUnicodeScript, Glib::ustring> & getScriptToName()
mappings[G_UNICODE_SCRIPT_PHOENICIAN] = _("Phoenician");
mappings[G_UNICODE_SCRIPT_PHAGS_PA] = _("Phags-pa");
mappings[G_UNICODE_SCRIPT_NKO] = _("N'Ko");
+
+#if GLIB_CHECK_VERSION(2,14,0)
mappings[G_UNICODE_SCRIPT_KAYAH_LI] = _("Kayah Li");
mappings[G_UNICODE_SCRIPT_LEPCHA] = _("Lepcha");
mappings[G_UNICODE_SCRIPT_REJANG] = _("Rejang");
@@ -133,9 +136,11 @@ static std::map<GUnicodeScript, Glib::ustring> & getScriptToName()
mappings[G_UNICODE_SCRIPT_CARIAN] = _("Carian");
mappings[G_UNICODE_SCRIPT_LYCIAN] = _("Lycian");
mappings[G_UNICODE_SCRIPT_LYDIAN] = _("Lydian");
+#endif // GLIB_CHECK_VERSION(2,14,0)
}
return mappings;
}
+#endif // GLIB_CHECK_VERSION(2,14,0)
typedef std::pair<gunichar, gunichar> Range;
typedef std::pair<Range, Glib::ustring> NamedRange;
@@ -332,7 +337,9 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) :
entry(0),
label(0),
insertBtn(0),
+#if GLIB_CHECK_VERSION(2,14,0)
scriptCombo(0),
+#endif // GLIB_CHECK_VERSION(2,14,0)
fsel(0),
targetDesktop(0),
deskTrack(),
@@ -359,6 +366,7 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) :
// -------------------------------
+#if GLIB_CHECK_VERSION(2,14,0)
{
Gtk::Label *label = new Gtk::Label(_("Script: "));
table->attach( *Gtk::manage(label),
@@ -383,6 +391,7 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) :
}
row++;
+#endif // GLIB_CHECK_VERSION(2,14,0)
// -------------------------------
@@ -455,7 +464,10 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) :
insertBtn = new Gtk::Button(_("Append"));
conn = insertBtn->signal_clicked().connect(sigc::mem_fun(*this, &GlyphsPanel::insertText));
instanceConns.push_back(conn);
+#if GTK_CHECK_VERSION(2,18,0)
+ //gtkmm 2.18
insertBtn->set_can_default();
+#endif
insertBtn->set_sensitive(false);
box->pack_end(*Gtk::manage(insertBtn), Gtk::PACK_SHRINK);
@@ -595,11 +607,13 @@ void GlyphsPanel::glyphSelectionChanged()
Glib::ustring scriptName;
+#if GLIB_CHECK_VERSION(2,14,0)
GUnicodeScript script = g_unichar_get_script(ch);
std::map<GUnicodeScript, Glib::ustring> mappings = getScriptToName();
if (mappings.find(script) != mappings.end()) {
scriptName = mappings[script];
}
+#endif
gchar * tmp = g_strdup_printf("U+%04X %s", ch, scriptName.c_str());
label->set_text(tmp);
}
@@ -666,6 +680,7 @@ void GlyphsPanel::rebuild()
if (font) {
//double sp_font_selector_get_size (SPFontSelector *fsel);
+#if GLIB_CHECK_VERSION(2,14,0)
GUnicodeScript script = G_UNICODE_SCRIPT_INVALID_CODE;
Glib::ustring scriptName = scriptCombo->get_active_text();
std::map<GUnicodeScript, Glib::ustring> items = getScriptToName();
@@ -675,6 +690,7 @@ void GlyphsPanel::rebuild()
break;
}
}
+#endif // GLIB_CHECK_VERSION(2,14,0)
// Disconnect the model while we update it. Simple work-around for 5x+ performance boost.
Glib::RefPtr<Gtk::ListStore> tmp = Gtk::ListStore::create(*getColumns());
@@ -691,9 +707,13 @@ void GlyphsPanel::rebuild()
for (gunichar ch = lower; ch <= upper; ch++) {
int glyphId = font->MapUnicodeChar(ch);
if (glyphId > 0) {
+#if GLIB_CHECK_VERSION(2,14,0)
if ((script == G_UNICODE_SCRIPT_INVALID_CODE) || (script == g_unichar_get_script(ch))) {
present.push_back(ch);
}
+#else
+ present.push_back(ch);
+#endif
}
}
diff --git a/src/ui/dialog/glyphs.h b/src/ui/dialog/glyphs.h
index 1440a693f..d6c731dda 100644
--- a/src/ui/dialog/glyphs.h
+++ b/src/ui/dialog/glyphs.h
@@ -77,7 +77,9 @@ private:
Gtk::Entry *entry;
Gtk::Label *label;
Gtk::Button *insertBtn;
+#if GLIB_CHECK_VERSION(2,14,0)
Gtk::ComboBoxText *scriptCombo;
+#endif //GLIB_CHECK_VERSION(2,14,0)
Gtk::ComboBoxText *rangeCombo;
SPFontSelector *fsel;
SPDesktop *targetDesktop;
diff --git a/src/widgets/sp-color-slider.cpp b/src/widgets/sp-color-slider.cpp
index 0690caaab..0e30b1ce6 100644
--- a/src/widgets/sp-color-slider.cpp
+++ b/src/widgets/sp-color-slider.cpp
@@ -1,3 +1,5 @@
+#define __SP_COLOR_SLIDER_C__
+
/*
* A slider with colored background
*
@@ -327,17 +329,21 @@ sp_color_slider_new (GtkAdjustment *adjustment)
return GTK_WIDGET (slider);
}
-void sp_color_slider_set_adjustment(SPColorSlider *slider, GtkAdjustment *adjustment)
+void
+sp_color_slider_set_adjustment (SPColorSlider *slider, GtkAdjustment *adjustment)
{
- g_return_if_fail (slider != NULL);
- g_return_if_fail (SP_IS_COLOR_SLIDER (slider));
+ g_return_if_fail (slider != NULL);
+ g_return_if_fail (SP_IS_COLOR_SLIDER (slider));
- if (!adjustment) {
- adjustment = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, 1.0, 0.01, 0.0, 0.0);
- } else {
+ if (!adjustment) {
+ adjustment = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, 1.0, 0.01, 0.0, 0.0);
+ }
+#if GTK_CHECK_VERSION (2,14,0)
+ else {
gtk_adjustment_set_page_increment(adjustment, 0.0);
gtk_adjustment_set_page_size(adjustment, 0.0);
}
+#endif
if (slider->adjustment != adjustment) {
if (slider->adjustment) {
diff --git a/src/widgets/sp-color-wheel-selector.cpp b/src/widgets/sp-color-wheel-selector.cpp
index 784dd23ad..2e36a024e 100644
--- a/src/widgets/sp-color-wheel-selector.cpp
+++ b/src/widgets/sp-color-wheel-selector.cpp
@@ -135,12 +135,14 @@ static void resizeHSVWheel( GtkHSV *hsv, GtkAllocation *allocation )
gtk_hsv_set_metrics( hsv, diam, ring );
}
+#if GTK_CHECK_VERSION(2,18,0)
static void handleWheelStyleSet(GtkHSV *hsv, GtkStyle* /*previous*/, gpointer /*userData*/)
{
GtkAllocation allocation = {0, 0, 0, 0};
gtk_widget_get_allocation( GTK_WIDGET(hsv), &allocation );
resizeHSVWheel( hsv, &allocation );
}
+#endif // GTK_CHECK_VERSION(2,18,0)
static void handleWheelAllocation(GtkHSV *hsv, GtkAllocation *allocation, gpointer /*userData*/)
{
@@ -218,8 +220,10 @@ void ColorWheelSelector::init()
// GTK does not automatically scale the color wheel, so we have to add that in:
gtk_signal_connect( GTK_OBJECT(_wheel), "size-allocate",
GTK_SIGNAL_FUNC(handleWheelAllocation), _csel );
+#if GTK_CHECK_VERSION(2,18,0)
gtk_signal_connect( GTK_OBJECT(_wheel), "style-set",
GTK_SIGNAL_FUNC(handleWheelStyleSet), _csel );
+#endif // GTK_CHECK_VERSION(2,18,0)
}
static void