summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2013-03-10 20:36:05 +0000
committerJabiertxo Arraiza Zenotz <jtx@jtx.marker.es>2013-03-10 20:36:05 +0000
commit8db86f8405ff74e590566bfd552d1c23f00bdf5b (patch)
tree2913da86831eb11925cdc4d978982507dfe8e751 /src/ui
parentAdd pencil BSpline mode (diff)
parentMigrate Object Properties dialog to Gtk::Grid (diff)
downloadinkscape-8db86f8405ff74e590566bfd552d1c23f00bdf5b.tar.gz
inkscape-8db86f8405ff74e590566bfd552d1c23f00bdf5b.zip
Merge from trunk
(bzr r11950.1.50)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/aboutbox.cpp9
-rw-r--r--src/ui/dialog/calligraphic-profile-rename.cpp38
-rw-r--r--src/ui/dialog/calligraphic-profile-rename.h22
-rw-r--r--src/ui/dialog/debug.cpp4
-rw-r--r--src/ui/dialog/export.h1
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp19
-rw-r--r--src/ui/dialog/floating-behavior.cpp8
-rw-r--r--src/ui/dialog/guides.cpp17
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp14
-rw-r--r--src/ui/dialog/layer-properties.cpp4
-rw-r--r--src/ui/dialog/livepatheffect-add.cpp5
-rw-r--r--src/ui/dialog/object-attributes.cpp11
-rw-r--r--src/ui/dialog/object-attributes.h5
-rw-r--r--src/ui/dialog/object-properties.cpp157
-rw-r--r--src/ui/dialog/object-properties.h23
-rw-r--r--src/ui/dialog/svg-fonts-dialog.cpp21
-rw-r--r--src/ui/dialog/svg-fonts-dialog.h16
-rw-r--r--src/ui/dialog/swatches.cpp3
-rw-r--r--src/ui/previewholder.cpp270
-rw-r--r--src/ui/previewholder.h19
-rw-r--r--src/ui/widget/color-picker.cpp6
-rw-r--r--src/ui/widget/dock.cpp12
-rw-r--r--src/ui/widget/scalar.cpp2
-rw-r--r--src/ui/widget/selected-style.cpp27
-rw-r--r--src/ui/widget/selected-style.h16
-rw-r--r--src/ui/widget/spin-slider.cpp9
-rw-r--r--src/ui/widget/spin-slider.h8
-rw-r--r--src/ui/widget/tolerance-slider.cpp9
-rw-r--r--src/ui/widget/tolerance-slider.h13
29 files changed, 608 insertions, 160 deletions
diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp
index 0c0027c15..d4928d25d 100644
--- a/src/ui/dialog/aboutbox.cpp
+++ b/src/ui/dialog/aboutbox.cpp
@@ -97,7 +97,12 @@ AboutBox::AboutBox() : Gtk::Dialog(_("About Inkscape")) {
tabs->append_page(*manage(
make_scrolled_text(license_text)), _("_License"), true);
+#if WITH_GTKMM_3_0
+ get_content_area()->pack_end(*manage(tabs), true, true);
+#else
get_vbox()->pack_end(*manage(tabs), true, true);
+#endif
+
tabs->show_all();
add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
@@ -114,7 +119,11 @@ AboutBox::AboutBox() : Gtk::Dialog(_("About Inkscape")) {
label->set_selectable(true);
label->show();
+#if WITH_GTKMM_3_0
+ get_content_area()->pack_start(*manage(label), false, false);
+#else
get_vbox()->pack_start(*manage(label), false, false);
+#endif
Gtk::Requisition requisition;
#if GTK_CHECK_VERSION(3,0,0)
diff --git a/src/ui/dialog/calligraphic-profile-rename.cpp b/src/ui/dialog/calligraphic-profile-rename.cpp
index 77a4f4f03..9ae22db2d 100644
--- a/src/ui/dialog/calligraphic-profile-rename.cpp
+++ b/src/ui/dialog/calligraphic-profile-rename.cpp
@@ -13,14 +13,16 @@
* Released under GNU GPL. Read the file 'COPYING' for more information
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#include "calligraphic-profile-rename.h"
#include <glibmm/i18n.h>
#include <gtkmm/stock.h>
+#if WITH_GTKMM_3_0
+# include <gtkmm/grid.h>
+#else
+# include <gtkmm/table.h>
+#endif
+
#include "desktop.h"
namespace Inkscape {
@@ -28,24 +30,42 @@ namespace UI {
namespace Dialog {
CalligraphicProfileRename::CalligraphicProfileRename() :
+#if WITH_GTKMM_3_0
+ _layout_table(Gtk::manage(new Gtk::Grid())),
+#else
+ _layout_table(Gtk::manage(new Gtk::Table(1, 2))),
+#endif
_applied(false)
{
set_title(_("Edit profile"));
+#if WITH_GTKMM_3_0
+ Gtk::Box *mainVBox = get_content_area();
+ _layout_table->set_column_spacing(4);
+ _layout_table->set_row_spacing(4);
+#else
Gtk::Box *mainVBox = get_vbox();
- _layout_table.set_spacings(4);
- _layout_table.resize (1, 2);
+ _layout_table->set_spacings(4);
+#endif
_profile_name_entry.set_activates_default(true);
_profile_name_label.set_label(_("Profile name:"));
_profile_name_label.set_alignment(1.0, 0.5);
- _layout_table.attach(_profile_name_label,
+#if WITH_GTKMM_3_0
+ _layout_table->attach(_profile_name_label, 0, 0, 1, 1);
+
+ _profile_name_entry.set_hexpand();
+ _layout_table->attach(_profile_name_entry, 1, 0, 1, 1);
+#else
+ _layout_table->attach(_profile_name_label,
0, 1, 0, 1, Gtk::FILL, Gtk::FILL);
- _layout_table.attach(_profile_name_entry,
+ _layout_table->attach(_profile_name_entry,
1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL);
- mainVBox->pack_start(_layout_table, false, false, 4);
+#endif
+
+ mainVBox->pack_start(*_layout_table, false, false, 4);
// Buttons
_close_button.set_use_stock(true);
_close_button.set_label(Gtk::Stock::CANCEL.id);
diff --git a/src/ui/dialog/calligraphic-profile-rename.h b/src/ui/dialog/calligraphic-profile-rename.h
index 8fe82d7bb..4ef71900b 100644
--- a/src/ui/dialog/calligraphic-profile-rename.h
+++ b/src/ui/dialog/calligraphic-profile-rename.h
@@ -11,10 +11,22 @@
#ifndef INKSCAPE_DIALOG_CALLIGRAPHIC_PROFILE_H
#define INKSCAPE_DIALOG_CALLIGRAPHIC_PROFILE_H
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
#include <gtkmm/label.h>
-#include <gtkmm/table.h>
+
+namespace Gtk {
+#if WITH_GTKMM_3_0
+class Grid;
+#else
+class Table;
+#endif
+}
+
class SPDesktop;
namespace Inkscape {
@@ -47,7 +59,13 @@ protected:
Gtk::Label _profile_name_label;
Gtk::Entry _profile_name_entry;
- Gtk::Table _layout_table;
+
+#if WITH_GTKMM_3_0
+ Gtk::Grid* _layout_table;
+#else
+ Gtk::Table* _layout_table;
+#endif
+
Gtk::Button _close_button;
Gtk::Button _delete_button;
Gtk::Button _apply_button;
diff --git a/src/ui/dialog/debug.cpp b/src/ui/dialog/debug.cpp
index 429ed57bf..e61f8e389 100644
--- a/src/ui/dialog/debug.cpp
+++ b/src/ui/dialog/debug.cpp
@@ -69,7 +69,11 @@ DebugDialogImpl::DebugDialogImpl()
set_title(_("Messages"));
set_size_request(300, 400);
+#if WITH_GTKMM_3_0
+ Gtk::Box *mainVBox = get_content_area();
+#else
Gtk::Box *mainVBox = get_vbox();
+#endif
//## Add a menu for clear()
Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem(_("_File"), true));
diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h
index c8376cdcb..c5782fabc 100644
--- a/src/ui/dialog/export.h
+++ b/src/ui/dialog/export.h
@@ -24,7 +24,6 @@
#include "ui/widget/panel.h"
#include "ui/widget/button.h"
#include "ui/widget/entry.h"
-#include "widgets/sp-attribute-widget.h"
namespace Inkscape {
namespace UI {
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index fd368ed9f..989c40264 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -313,9 +313,15 @@ public:
set_tooltip_text(tip_text);
}
+#if WITH_GTKMM_3_0
+ Gdk::RGBA col;
+ col.set_rgba_u(65535, 65535, 65535);
+ set_rgba(col);
+#else
Gdk::Color col;
col.set_rgb(65535, 65535, 65535);
set_color(col);
+#endif
}
// Returns the color in 'rgb(r,g,b)' form.
@@ -323,8 +329,14 @@ public:
{
// no doubles here, so we can use the standard string stream.
std::ostringstream os;
+
+#if WITH_GTKMM_3_0
+ const Gdk::RGBA c = get_rgba();
+ const int r = c.get_red_u() / 257, g = c.get_green_u() / 257, b = c.get_blue_u() / 257;//TO-DO: verify this. This sounds a lot strange! shouldn't it be 256?
+#else
const Gdk::Color c = get_color();
const int r = c.get_red() / 257, g = c.get_green() / 257, b = c.get_blue() / 257;//TO-DO: verify this. This sounds a lot strange! shouldn't it be 256?
+#endif
os << "rgb(" << r << "," << g << "," << b << ")";
return os.str();
}
@@ -340,9 +352,16 @@ public:
i = (guint32) get_default()->as_uint();
}
const int r = SP_RGBA32_R_U(i), g = SP_RGBA32_G_U(i), b = SP_RGBA32_B_U(i);
+
+#if WITH_GTKMM_3_0
+ Gdk::RGBA col;
+ col.set_rgba_u(r * 256, g * 256, b * 256);
+ set_rgba(col);
+#else
Gdk::Color col;
col.set_rgb(r * 256, g * 256, b * 256);
set_color(col);
+#endif
}
};
diff --git a/src/ui/dialog/floating-behavior.cpp b/src/ui/dialog/floating-behavior.cpp
index eab5f9d8f..d70c5f187 100644
--- a/src/ui/dialog/floating-behavior.cpp
+++ b/src/ui/dialog/floating-behavior.cpp
@@ -135,7 +135,13 @@ FloatingBehavior::create(Dialog &dialog)
inline FloatingBehavior::operator Gtk::Widget &() { return *_d; }
inline GtkWidget *FloatingBehavior::gobj() { return GTK_WIDGET(_d->gobj()); }
-inline Gtk::Box* FloatingBehavior::get_vbox() { return _d->get_vbox(); }
+inline Gtk::Box* FloatingBehavior::get_vbox() {
+#if WITH_GTKMM_3_0
+ return _d->get_content_area();
+#else
+ return _d->get_vbox();
+#endif
+}
inline void FloatingBehavior::present() { _d->present(); }
inline void FloatingBehavior::hide() { _d->hide(); }
inline void FloatingBehavior::show() { _d->show(); }
diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp
index d8bbb5539..51bbc7d9a 100644
--- a/src/ui/dialog/guides.cpp
+++ b/src/ui/dialog/guides.cpp
@@ -70,9 +70,15 @@ void GuidelinePropertiesDialog::showDialog(SPGuide *guide, SPDesktop *desktop) {
void GuidelinePropertiesDialog::_colorChanged()
{
+#if WITH_GTKMM_3_0
+ const Gdk::RGBA c = _color.get_rgba();
+ unsigned r = c.get_red_u()/257, g = c.get_green_u()/257, b = c.get_blue_u()/257;
+#else
const Gdk::Color c = _color.get_color();
unsigned r = c.get_red()/257, g = c.get_green()/257, b = c.get_blue()/257;
+#endif
//TODO: why 257? verify this!
+
sp_guide_set_color(*_guide, r, g, b, true);
}
@@ -166,12 +172,12 @@ void GuidelinePropertiesDialog::_setup() {
add_button(Gtk::Stock::DELETE, -12);
add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
- Gtk::Box *mainVBox = get_vbox();
-
#if WITH_GTKMM_3_0
+ Gtk::Box *mainVBox = get_content_area();
_layout_table.set_row_spacing(4);
_layout_table.set_column_spacing(4);
#else
+ Gtk::Box *mainVBox = get_vbox();
_layout_table.set_spacings(4);
_layout_table.resize (3, 4);
#endif
@@ -328,9 +334,16 @@ void GuidelinePropertiesDialog::_setup() {
// init name entry
_label_entry.getEntry()->set_text(_guide->label ? _guide->label : "");
+
+#if WITH_GTKMM_3_0
+ Gdk::RGBA c;
+ c.set_rgba(((_guide->color>>24)&0xff) / 255.0, ((_guide->color>>16)&0xff) / 255.0, ((_guide->color>>8)&0xff) / 255.0);
+ _color.set_rgba(c);
+#else
Gdk::Color c;
c.set_rgb_p(((_guide->color>>24)&0xff) / 255.0, ((_guide->color>>16)&0xff) / 255.0, ((_guide->color>>8)&0xff) / 255.0);
_color.set_color(c);
+#endif
_modeChanged(); // sets values of spinboxes.
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index c63b78c70..fb814e066 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -799,10 +799,17 @@ static void proofComboChanged( Gtk::ComboBoxText* combo )
}
static void gamutColorChanged( Gtk::ColorButton* btn ) {
+#if WITH_GTKMM_3_0
+ Gdk::RGBA rgba = btn->get_rgba();
+ gushort r = rgba.get_red_u();
+ gushort g = rgba.get_green_u();
+ gushort b = rgba.get_blue_u();
+#else
Gdk::Color color = btn->get_color();
gushort r = color.get_red();
gushort g = color.get_green();
gushort b = color.get_blue();
+#endif
gchar* tmp = g_strdup_printf("#%02x%02x%02x", (r >> 8), (g >> 8), (b >> 8) );
@@ -967,8 +974,15 @@ void InkscapePreferences::initPageIO()
_("Highlights colors that are out of gamut for the target device"), false);
Glib::ustring colorStr = prefs->getString("/options/softproof/gamutcolor");
+
+#if WITH_GTKMM_3_0
+ Gdk::RGBA tmpColor( colorStr.empty() ? "#00ff00" : colorStr);
+ _cms_gamutcolor.set_rgba( tmpColor );
+#else
Gdk::Color tmpColor( colorStr.empty() ? "#00ff00" : colorStr);
_cms_gamutcolor.set_color( tmpColor );
+#endif
+
_page_cms.add_line( true, _("Out of gamut warning color:"), _cms_gamutcolor, "",
_("Selects the color used for out of gamut warning"), false);
diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp
index 6a1bc829e..3feed2afe 100644
--- a/src/ui/dialog/layer-properties.cpp
+++ b/src/ui/dialog/layer-properties.cpp
@@ -40,12 +40,12 @@ namespace Dialogs {
LayerPropertiesDialog::LayerPropertiesDialog()
: _strategy(NULL), _desktop(NULL), _layer(NULL), _position_visible(false)
{
- Gtk::Box *mainVBox = get_vbox();
-
#if WITH_GTKMM_3_0
+ Gtk::Box *mainVBox = get_content_area();
_layout_table.set_row_spacing(4);
_layout_table.set_column_spacing(4);
#else
+ Gtk::Box *mainVBox = get_vbox();
_layout_table.set_spacings(4);
_layout_table.resize (1, 2);
#endif
diff --git a/src/ui/dialog/livepatheffect-add.cpp b/src/ui/dialog/livepatheffect-add.cpp
index e899dbcfc..b5f51d81d 100644
--- a/src/ui/dialog/livepatheffect-add.cpp
+++ b/src/ui/dialog/livepatheffect-add.cpp
@@ -73,7 +73,12 @@ LivePathEffectAdd::LivePathEffectAdd() :
add_button.set_use_underline(true);
add_button.set_can_default();
+#if WITH_GTKMM_3_0
+ Gtk::Box *mainVBox = get_content_area();
+#else
Gtk::Box *mainVBox = get_vbox();
+#endif
+
mainVBox->pack_start(scrolled_window, true, true);
add_action_widget(close_button, Gtk::RESPONSE_CLOSE);
add_action_widget(add_button, Gtk::RESPONSE_APPLY);
diff --git a/src/ui/dialog/object-attributes.cpp b/src/ui/dialog/object-attributes.cpp
index 1ae9730d5..3d780fa83 100644
--- a/src/ui/dialog/object-attributes.cpp
+++ b/src/ui/dialog/object-attributes.cpp
@@ -30,6 +30,7 @@
#include "xml/repr.h"
#include "ui/dialog/dialog-manager.h"
#include "ui/dialog/object-attributes.h"
+#include "widgets/sp-attribute-widget.h"
#include "inkscape.h"
#include "selection.h"
@@ -81,14 +82,14 @@ ObjectAttributes::ObjectAttributes (void) :
UI::Widget::Panel ("", "/dialogs/objectattr/", SP_VERB_DIALOG_ATTR),
blocked (false),
CurrentItem(NULL),
- attrTable(),
+ attrTable(Gtk::manage(new SPAttributeTable())),
desktop(NULL),
deskTrack(),
selectChangedConn(),
subselChangedConn(),
selectModifiedConn()
{
- attrTable.show();
+ attrTable->show();
widget_setup();
desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &ObjectAttributes::setTargetDesktop) );
@@ -163,12 +164,12 @@ void ObjectAttributes::widget_setup (void)
attrs.push_back (desc[len].attribute);
len += 1;
}
- attrTable.set_object(obj, labels, attrs, (GtkWidget*)gobj());
+ attrTable->set_object(obj, labels, attrs, (GtkWidget*)gobj());
CurrentItem = item;
}
else
{
- attrTable.change_object(obj);
+ attrTable->change_object(obj);
}
set_sensitive (true);
@@ -201,7 +202,7 @@ void ObjectAttributes::selectionModifiedCB( guint flags )
if (flags & ( SP_OBJECT_MODIFIED_FLAG |
SP_OBJECT_PARENT_MODIFIED_FLAG |
SP_OBJECT_STYLE_MODIFIED_FLAG) ) {
- attrTable.reread_properties();
+ attrTable->reread_properties();
}
}
diff --git a/src/ui/dialog/object-attributes.h b/src/ui/dialog/object-attributes.h
index 81467dea6..b0d02a0af 100644
--- a/src/ui/dialog/object-attributes.h
+++ b/src/ui/dialog/object-attributes.h
@@ -28,7 +28,8 @@
#include "desktop.h"
#include "ui/dialog/desktop-tracker.h"
#include "ui/widget/panel.h"
-#include "widgets/sp-attribute-widget.h"
+
+class SPAttributeTable;
namespace Inkscape {
namespace UI {
@@ -72,7 +73,7 @@ private:
* in the SPAttrDesc arrays at the top of the cpp-file. This widgets also
* ensures object attribute modifications by the user are set.
*/
- SPAttributeTable attrTable;
+ SPAttributeTable *attrTable;
/**
* Stores the current desktop.
diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp
index 0800346f7..114204961 100644
--- a/src/ui/dialog/object-properties.cpp
+++ b/src/ui/dialog/object-properties.cpp
@@ -26,11 +26,8 @@
* Abhishek Sharma
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include "object-properties.h"
+#include "widgets/sp-attribute-widget.h"
#include "../../desktop-handles.h"
#include "../../document.h"
#include "../../document-undo.h"
@@ -50,19 +47,27 @@ ObjectProperties::ObjectProperties (void) :
UI::Widget::Panel ("", "/dialogs/object/", SP_VERB_DIALOG_ITEM),
blocked (false),
CurrentItem(NULL),
- TopTable (3, 4, false),
+#if WITH_GTKMM_3_0
+ TopTable(Gtk::manage(new Gtk::Grid())),
+#else
+ TopTable(Gtk::manage(new Gtk::Table(3, 4))),
+#endif
LabelID(_("_ID:"), 1),
LabelLabel(_("_Label:"), 1),
LabelTitle(_("_Title:"),1),
LabelDescription(_("_Description:"),1),
FrameDescription("", FALSE),
HBoxCheck(FALSE, 0),
- CheckTable(1, 2, TRUE),
+#if WITH_GTKMM_3_0
+ CheckTable(Gtk::manage(new Gtk::Grid())),
+#else
+ CheckTable(Gtk::manage(new Gtk::Table(1, 2, true))),
+#endif
CBHide(_("_Hide"), 1),
CBLock(_("L_ock"), 1),
BSet (_("_Set"), 1),
LabelInteractivity(_("_Interactivity"), 1),
- attrTable(),
+ attrTable(Gtk::manage(new SPAttributeTable())),
desktop(NULL),
deskTrack(),
selectChangedConn(),
@@ -91,6 +96,11 @@ ObjectProperties::ObjectProperties (void) :
desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &ObjectProperties::setTargetDesktop) );
deskTrack.connect(GTK_WIDGET(gobj()));
+
+#if WITH_GTKMM_3_0
+ CheckTable->set_row_homogeneous();
+ CheckTable->set_column_homogeneous(true);
+#endif
MakeWidget();
}
@@ -108,24 +118,44 @@ void ObjectProperties::MakeWidget(void)
Gtk::Box *contents = _getContents();
contents->set_spacing(0);
- TopTable.set_border_width(4);
- TopTable.set_row_spacings(4);
- TopTable.set_col_spacings(0);
- contents->pack_start (TopTable, false, false, 0);
+ TopTable->set_border_width(4);
+
+#if WITH_GTKMM_3_0
+ TopTable->set_row_spacing(4);
+ TopTable->set_column_spacing(0);
+#else
+ TopTable->set_row_spacings(4);
+ TopTable->set_col_spacings(0);
+#endif
+
+ contents->pack_start (*TopTable, false, false, 0);
/* Create the label for the object id */
LabelID.set_label (LabelID.get_label() + " ");
LabelID.set_alignment (1, 0.5);
- TopTable.attach (LabelID, 0, 1, 0, 1,
- Gtk::SHRINK | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
+
+#if WITH_GTKMM_3_0
+ LabelID.set_valign(Gtk::ALIGN_CENTER);
+ TopTable->attach(LabelID, 0, 0, 1, 1);
+#else
+ TopTable->attach(LabelID, 0, 1, 0, 1,
+ Gtk::SHRINK | Gtk::FILL,
+ Gtk::AttachOptions(), 0, 0 );
+#endif
/* Create the entry box for the object id */
EntryID.set_tooltip_text (_("The id= attribute (only letters, digits, and the characters .-_: allowed)"));
EntryID.set_max_length (64);
- TopTable.attach (EntryID, 1, 2, 0, 1,
- Gtk::EXPAND | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
+
+#if WITH_GTKMM_3_0
+ EntryID.set_valign(Gtk::ALIGN_CENTER);
+ TopTable->attach(EntryID, 1, 0, 1, 1);
+#else
+ TopTable->attach(EntryID, 1, 2, 0, 1,
+ Gtk::EXPAND | Gtk::FILL,
+ Gtk::AttachOptions(), 0, 0 );
+#endif
+
LabelID.set_mnemonic_widget (EntryID);
// pressing enter in the id field is the same as clicking Set:
@@ -136,16 +166,30 @@ void ObjectProperties::MakeWidget(void)
/* Create the label for the object label */
LabelLabel.set_label (LabelLabel.get_label() + " ");
LabelLabel.set_alignment (1, 0.5);
- TopTable.attach (LabelLabel, 0, 1, 1, 2,
- Gtk::SHRINK | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
+
+#if WITH_GTKMM_3_0
+ LabelLabel.set_valign(Gtk::ALIGN_CENTER);
+ TopTable->attach(LabelLabel, 0, 1, 1, 1);
+#else
+ TopTable->attach(LabelLabel, 0, 1, 1, 2,
+ Gtk::SHRINK | Gtk::FILL,
+ Gtk::AttachOptions(), 0, 0 );
+#endif
/* Create the entry box for the object label */
EntryLabel.set_tooltip_text (_("A freeform label for the object"));
EntryLabel.set_max_length (256);
- TopTable.attach (EntryLabel, 1, 2, 1, 2,
- Gtk::EXPAND | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
+
+#if WITH_GTKMM_3_0
+ EntryLabel.set_hexpand();
+ EntryLabel.set_valign(Gtk::ALIGN_CENTER);
+ TopTable->attach(EntryLabel, 1, 1, 1, 1);
+#else
+ TopTable->attach(EntryLabel, 1, 2, 1, 2,
+ Gtk::EXPAND | Gtk::FILL,
+ Gtk::AttachOptions(), 0, 0 );
+#endif
+
LabelLabel.set_mnemonic_widget (EntryLabel);
// pressing enter in the label field is the same as clicking Set:
@@ -154,16 +198,30 @@ void ObjectProperties::MakeWidget(void)
/* Create the label for the object title */
LabelTitle.set_label (LabelTitle.get_label() + " ");
LabelTitle.set_alignment (1, 0.5);
- TopTable.attach (LabelTitle, 0, 1, 2, 3,
- Gtk::SHRINK | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
+
+#if WITH_GTKMM_3_0
+ LabelTitle.set_valign(Gtk::ALIGN_CENTER);
+ TopTable->attach(LabelTitle, 0, 2, 1, 1);
+#else
+ TopTable->attach(LabelTitle, 0, 1, 2, 3,
+ Gtk::SHRINK | Gtk::FILL,
+ Gtk::AttachOptions(), 0, 0 );
+#endif
/* Create the entry box for the object title */
EntryTitle.set_sensitive (FALSE);
EntryTitle.set_max_length (256);
- TopTable.attach (EntryTitle, 1, 2, 2, 3,
- Gtk::EXPAND | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
+
+#if WITH_GTKMM_3_0
+ EntryTitle.set_hexpand();
+ EntryTitle.set_valign(Gtk::ALIGN_CENTER);
+ TopTable->attach(EntryTitle, 1, 2, 1, 1);
+#else
+ TopTable->attach(EntryTitle, 1, 2, 2, 3,
+ Gtk::EXPAND | Gtk::FILL,
+ Gtk::AttachOptions(), 0, 0 );
+#endif
+
LabelTitle.set_mnemonic_widget (EntryTitle);
// pressing enter in the label field is the same as clicking Set:
EntryTitle.signal_activate().connect(sigc::mem_fun(this, &ObjectProperties::label_changed));
@@ -186,29 +244,52 @@ void ObjectProperties::MakeWidget(void)
/* Check boxes */
contents->pack_start (HBoxCheck, FALSE, FALSE, 0);
- CheckTable.set_border_width(4);
- HBoxCheck.pack_start (CheckTable, TRUE, TRUE, 0);
+ CheckTable->set_border_width(4);
+ HBoxCheck.pack_start(*CheckTable, true, true, 0);
/* Hide */
CBHide.set_tooltip_text (_("Check to make the object invisible"));
- CheckTable.attach (CBHide, 0, 1, 0, 1,
+
+#if WITH_GTKMM_3_0
+ CBHide.set_hexpand();
+ CBHide.set_valign(Gtk::ALIGN_CENTER);
+ CheckTable->attach(CBHide, 0, 0, 1, 1);
+#else
+ CheckTable->attach(CBHide, 0, 1, 0, 1,
Gtk::EXPAND | Gtk::FILL,
Gtk::AttachOptions(), 0, 0 );
+#endif
+
CBHide.signal_toggled().connect(sigc::mem_fun(this, &ObjectProperties::hidden_toggled));
/* Lock */
// TRANSLATORS: "Lock" is a verb here
CBLock.set_tooltip_text (_("Check to make the object insensitive (not selectable by mouse)"));
- CheckTable.attach (CBLock, 1, 2, 0, 1,
+
+#if WITH_GTKMM_3_0
+ CBLock.set_hexpand();
+ CBLock.set_valign(Gtk::ALIGN_CENTER);
+ CheckTable->attach(CBLock, 1, 0, 1, 1);
+#else
+ CheckTable->attach(CBLock, 1, 2, 0, 1,
Gtk::EXPAND | Gtk::FILL,
Gtk::AttachOptions(), 0, 0 );
+#endif
+
CBLock.signal_toggled().connect(sigc::mem_fun(this, &ObjectProperties::sensitivity_toggled));
/* Button for setting the object's id, label, title and description. */
- CheckTable.attach (BSet, 2, 3, 0, 1,
+#if WITH_GTKMM_3_0
+ BSet.set_hexpand();
+ BSet.set_valign(Gtk::ALIGN_CENTER);
+ CheckTable->attach(BSet, 2, 0, 1, 1);
+#else
+ CheckTable->attach(BSet, 2, 3, 0, 1,
Gtk::EXPAND | Gtk::FILL,
Gtk::AttachOptions(), 0, 0 );
+#endif
+
BSet.signal_clicked().connect(sigc::mem_fun(this, &ObjectProperties::label_changed));
/* Create the frame for interactivity options */
@@ -237,7 +318,7 @@ void ObjectProperties::widget_setup(void)
CurrentItem = NULL;
//no selection anymore or multiple objects selected, means that we need
//to close the connections to the previously selected object
- attrTable.clear();
+ attrTable->clear();
return;
} else {
contents->set_sensitive (true);
@@ -301,13 +382,13 @@ void ObjectProperties::widget_setup(void)
if (CurrentItem == NULL)
{
- attrTable.set_object(obj, int_labels, int_attrs, (GtkWidget*)EInteractivity.gobj());
+ attrTable->set_object(obj, int_labels, int_attrs, (GtkWidget*)EInteractivity.gobj());
}
else
{
- attrTable.change_object(obj);
+ attrTable->change_object(obj);
}
- attrTable.show_all();
+ attrTable->show_all();
}
CurrentItem = item;
blocked = false;
diff --git a/src/ui/dialog/object-properties.h b/src/ui/dialog/object-properties.h
index a04c62bec..b49293ea1 100644
--- a/src/ui/dialog/object-properties.h
+++ b/src/ui/dialog/object-properties.h
@@ -29,6 +29,10 @@
#ifndef SEEN_DIALOGS_ITEM_PROPERTIES_H
#define SEEN_DIALOGS_ITEM_PROPERTIES_H
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "ui/widget/panel.h"
#include "ui/widget/frame.h"
#include <gtkmm/entry.h>
@@ -37,8 +41,8 @@
#include <gtkmm/textview.h>
#include "ui/dialog/desktop-tracker.h"
-#include "widgets/sp-attribute-widget.h"
+class SPAttributeTable;
class SPDesktop;
class SPItem;
@@ -70,7 +74,12 @@ private:
std::vector<Glib::ustring> int_attrs;
std::vector<Glib::ustring> int_labels;
- Gtk::Table TopTable; //the table with the object properties
+#if WITH_GTKMM_3_0
+ Gtk::Grid *TopTable; //the table with the object properties
+#else
+ Gtk::Table *TopTable; //the table with the object properties
+#endif
+
Gtk::Label LabelID; //the label for the object ID
Gtk::Entry EntryID; //the entry for the object ID
Gtk::Label LabelLabel; //the label for the object label
@@ -84,14 +93,20 @@ private:
Gtk::TextView TextViewDescription; //the text view object showing the object description
Gtk::HBox HBoxCheck; // the HBox for the check boxes
- Gtk::Table CheckTable; //the table for the check boxes
+
+#if WITH_GTKMM_3_0
+ Gtk::Grid *CheckTable; //the table for the check boxes
+#else
+ Gtk::Table *CheckTable; //the table for the check boxes
+#endif
+
Gtk::CheckButton CBHide; //the check button hide
Gtk::CheckButton CBLock; //the check button lock
Gtk::Button BSet; //the button set
Gtk::Label LabelInteractivity; //the label for interactivity
Gtk::Expander EInteractivity; //the label for interactivity
- SPAttributeTable attrTable; //the widget for showing the on... names at the bottom
+ SPAttributeTable *attrTable; //the widget for showing the on... names at the bottom
SPDesktop *desktop;
DesktopTracker deskTrack;
diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp
index be69635e8..0da39dd73 100644
--- a/src/ui/dialog/svg-fonts-dialog.cpp
+++ b/src/ui/dialog/svg-fonts-dialog.cpp
@@ -22,6 +22,7 @@
#include "document-undo.h"
#include <gtkmm/notebook.h>
#include <gtkmm/imagemenuitem.h>
+#include <gtkmm/scale.h>
#include <gtkmm/stock.h>
#include <glibmm/i18n.h>
#include <message-stack.h>
@@ -191,7 +192,7 @@ void SvgFontsDialog::on_kerning_value_changed(){
//slider values increase from right to left so that they match the kerning pair preview
//XML Tree being directly used here while it shouldn't be.
- this->kerning_pair->getRepr()->setAttribute("k", Glib::Ascii::dtostr(get_selected_spfont()->horiz_adv_x - kerning_slider.get_value()).c_str());
+ this->kerning_pair->getRepr()->setAttribute("k", Glib::Ascii::dtostr(get_selected_spfont()->horiz_adv_x - kerning_slider->get_value()).c_str());
DocumentUndo::maybeDone(document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, _("Adjust kerning value"));
//populate_kerning_pairs_box();
@@ -299,7 +300,7 @@ void SvgFontsDialog::on_kerning_pair_selection_changed(){
this->kerning_pair = kern;
//slider values increase from right to left so that they match the kerning pair preview
- kerning_slider.set_value(get_selected_spfont()->horiz_adv_x - kern->k);
+ kerning_slider->set_value(get_selected_spfont()->horiz_adv_x - kern->k);
}
void SvgFontsDialog::update_global_settings_tab(){
@@ -328,9 +329,9 @@ void SvgFontsDialog::on_font_selection_changed(){
double set_width = spfont->horiz_adv_x;
setwidth_spin.set_value(set_width);
- kerning_slider.set_range(0, set_width);
- kerning_slider.set_draw_value(false);
- kerning_slider.set_value(0);
+ kerning_slider->set_range(0, set_width);
+ kerning_slider->set_draw_value(false);
+ kerning_slider->set_value(0);
update_global_settings_tab();
populate_glyphs_box();
@@ -779,7 +780,7 @@ Gtk::VBox* SvgFontsDialog::kerning_tab(){
add_kernpair_button.set_label(_("Add pair"));
add_kernpair_button.signal_clicked().connect(sigc::mem_fun(*this, &SvgFontsDialog::add_kerning_pair));
_KerningPairsList.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_kerning_pair_selection_changed));
- kerning_slider.signal_value_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_kerning_value_changed));
+ kerning_slider->signal_value_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_kerning_value_changed));
kerning_vbox.pack_start(*kerning_selector, false,false);
@@ -797,7 +798,7 @@ Gtk::VBox* SvgFontsDialog::kerning_tab(){
Gtk::HBox* kerning_amount_hbox = Gtk::manage(new Gtk::HBox());
kerning_vbox.pack_start(*kerning_amount_hbox, false,false);
kerning_amount_hbox->add(*Gtk::manage(new Gtk::Label(_("Kerning value:"))));
- kerning_amount_hbox->add(kerning_slider);
+ kerning_amount_hbox->add(*kerning_slider);
kerning_preview.set_size(300 + 20, 150 + 20);
_font_da.set_size(150 + 20, 50 + 20);
@@ -884,6 +885,12 @@ void SvgFontsDialog::add_font(){
SvgFontsDialog::SvgFontsDialog()
: UI::Widget::Panel("", "/dialogs/svgfonts", SP_VERB_DIALOG_SVG_FONTS), _add(Gtk::Stock::NEW)
{
+#if WITH_GTKMM_3_0
+ kerning_slider = Gtk::manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL));
+#else
+ kerning_slider = Gtk::manage(new Gtk::HScale);
+#endif
+
_add.signal_clicked().connect(sigc::mem_fun(*this, &SvgFontsDialog::add_font));
Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox());
diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h
index 910f79d4c..9be984820 100644
--- a/src/ui/dialog/svg-fonts-dialog.h
+++ b/src/ui/dialog/svg-fonts-dialog.h
@@ -20,13 +20,20 @@
#include <gtkmm/drawingarea.h>
#include <gtkmm/entry.h>
#include <gtkmm/liststore.h>
-#include <gtkmm/scale.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/treeview.h>
#include "attributes.h"
#include "xml/helper-observer.h"
+namespace Gtk {
+#if WITH_GTKMM_3_0
+class Scale;
+#else
+class HScale;
+#endif
+}
+
class SPGlyph;
class SPGlyphKerning;
class SvgFont;
@@ -210,7 +217,12 @@ private:
GlyphComboBox first_glyph, second_glyph;
SPGlyphKerning* kerning_pair;
Inkscape::UI::Widget::SpinButton setwidth_spin;
- Gtk::HScale kerning_slider;
+
+#if WITH_GTKMM_3_0
+ Gtk::Scale* kerning_slider;
+#else
+ Gtk::HScale* kerning_slider;
+#endif
class EntryWidget : public Gtk::HBox
{
diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp
index 71fee342a..90cb1cdc9 100644
--- a/src/ui/dialog/swatches.cpp
+++ b/src/ui/dialog/swatches.cpp
@@ -1179,9 +1179,6 @@ void SwatchesPanel::_rebuild()
_holder->thawUpdates();
}
-
-
-
} //namespace Dialogs
} //namespace UI
} //namespace Inkscape
diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp
index 0b280ccb9..b5a1a29a8 100644
--- a/src/ui/previewholder.cpp
+++ b/src/ui/previewholder.cpp
@@ -19,6 +19,12 @@
#include <gtkmm/scrollbar.h>
#include <gtkmm/adjustment.h>
+#if WITH_GTKMM_3_0
+# include <gtkmm/grid.h>
+#else
+# include <gtkmm/table.h>
+#endif
+
#define COLUMNS_FOR_SMALL 16
#define COLUMNS_FOR_LARGE 8
//#define COLUMNS_FOR_SMALL 48
@@ -44,13 +50,31 @@ PreviewHolder::PreviewHolder() :
_border(BORDER_NONE)
{
_scroller = manage(new Gtk::ScrolledWindow());
+
+#if WITH_GTKMM_3_0
+ _insides = manage(new Gtk::Grid());
+ _insides->set_column_spacing(8);
+
+ // Add a container with the scroller and a spacer
+ Gtk::Grid* spaceHolder = manage(new Gtk::Grid());
+
+ _scroller->set_hexpand();
+ _scroller->set_vexpand();
+#else
_insides = manage(new Gtk::Table( 1, 2 ));
_insides->set_col_spacings( 8 );
-
+
// Add a container with the scroller and a spacer
Gtk::Table* spaceHolder = manage( new Gtk::Table(1, 2) );
+#endif
+
_scroller->add( *_insides );
+
+#if WITH_GTKMM_3_0
+ spaceHolder->attach( *_scroller, 0, 0, 1, 1);
+#else
spaceHolder->attach( *_scroller, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
+#endif
pack_start(*spaceHolder, Gtk::PACK_EXPAND_WIDGET);
}
@@ -93,6 +117,11 @@ void PreviewHolder::clear()
rebuildUI();
}
+/**
+ * Add a Previewable item to the PreviewHolder
+ *
+ * \param[in] preview The Previewable item to add
+ */
void PreviewHolder::addPreview( Previewable* preview )
{
items.push_back(preview);
@@ -100,41 +129,78 @@ void PreviewHolder::addPreview( Previewable* preview )
{
int i = items.size() - 1;
- if ( _view == VIEW_TYPE_LIST ) {
- Gtk::Widget* label = manage(preview->getPreview(PREVIEW_STYLE_BLURB, VIEW_TYPE_LIST, _baseSize, _ratio, _border));
- Gtk::Widget* thing = manage(preview->getPreview(PREVIEW_STYLE_PREVIEW, VIEW_TYPE_LIST, _baseSize, _ratio, _border));
+ switch(_view) {
+ case VIEW_TYPE_LIST:
+ {
+ Gtk::Widget* label = manage(preview->getPreview(PREVIEW_STYLE_BLURB, VIEW_TYPE_LIST, _baseSize, _ratio, _border));
+ Gtk::Widget* thing = manage(preview->getPreview(PREVIEW_STYLE_PREVIEW, VIEW_TYPE_LIST, _baseSize, _ratio, _border));
- _insides->attach( *thing, 0, 1, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
- _insides->attach( *label, 1, 2, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK );
- } else {
- Gtk::Widget* thing = manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, VIEW_TYPE_GRID, _baseSize, _ratio, _border));
-
- int width = 1;
- int height = 1;
- calcGridSize( thing, items.size(), width, height );
- int col = i % width;
- int row = i / width;
-
- if ( _insides && width > (int)_insides->property_n_columns() ) {
- std::vector<Gtk::Widget*>kids = _insides->get_children();
- int oldWidth = (int)_insides->property_n_columns();
- int childCount = (int)kids.size();
-// g_message(" %3d resize from %d to %d (r:%d, c:%d) with %d children", i, oldWidth, width, row, col, childCount );
- _insides->resize( height, width );
-
- for ( int j = oldWidth; j < childCount; j++ ) {
- Gtk::Widget* target = kids[childCount - (j + 1)];
- int col2 = j % width;
- int row2 = j / width;
- Glib::RefPtr<Gtk::Widget> handle(target);
- _insides->remove( *target );
- _insides->attach( *target, col2, col2+1, row2, row2+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
+#if WITH_GTKMM_3_0
+ thing->set_hexpand();
+ thing->set_vexpand();
+ _insides->attach(*thing, 0, i, 1, 1);
+
+ label->set_hexpand();
+ label->set_valign(Gtk::ALIGN_CENTER);
+ _insides->attach(*label, 1, i, 1, 1);
+#else
+ _insides->attach( *thing, 0, 1, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
+ _insides->attach( *label, 1, 2, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK );
+#endif
+ }
+
+ break;
+ case VIEW_TYPE_GRID:
+ {
+ Gtk::Widget* thing = manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, VIEW_TYPE_GRID, _baseSize, _ratio, _border));
+
+ int width = 1;
+ int height = 1;
+ calcGridSize( thing, items.size(), width, height );
+
+ // Column and row for the new widget
+ int col = i % width;
+ int row = i / width;
+
+#if !WITH_GTKMM_3_0
+ // If the existing grid isn't wide enough, we need to resize
+ // it and re-pack the existing widgets
+ if ( _insides && width > (int)_insides->property_n_columns() ) {
+ _insides->resize( height, width );
+#endif
+ std::vector<Gtk::Widget*>kids = _insides->get_children();
+ int childCount = (int)kids.size();
+ // g_message(" %3d resize from %d to %d (r:%d, c:%d) with %d children", i, oldWidth, width, row, col, childCount );
+
+ // Loop through the existing widgets and move them to new location
+ for ( int j = 1; j < childCount; j++ ) {
+ Gtk::Widget* target = kids[childCount - (j + 1)];
+ int col2 = j % width;
+ int row2 = j / width;
+ Glib::RefPtr<Gtk::Widget> handle(target);
+ _insides->remove( *target );
+
+#if WITH_GTKMM_3_0
+ target->set_hexpand();
+ target->set_vexpand();
+ _insides->attach( *target, col2, row2, 1, 1);
+#else
+ _insides->attach( *target, col2, col2+1, row2, row2+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
+#endif
+ }
+#if WITH_GTKMM_3_0
+ thing->set_hexpand();
+ thing->set_vexpand();
+ _insides->attach(*thing, col, row, 1, 1);
+#else
+ } else if ( col == 0 ) {
+ // we just started a new row
+ _insides->resize( row + 1, width );
+ }
+
+ _insides->attach( *thing, col, col+1, row, row+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
+#endif
}
- } else if ( col == 0 ) {
- // we just started a new row
- _insides->resize( row + 1, width );
- }
- _insides->attach( *thing, col, col+1, row, row+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
}
_scroller->show_all_children();
@@ -258,8 +324,17 @@ void PreviewHolder::on_size_allocate( Gtk::Allocation& allocation )
// g_message(" items:%d", (int)items.size());
//}
+/**
+ * Calculate the grid side of a preview holder
+ *
+ * \param[in] thing
+ * \param[in] itemCount The number of items to pack into the grid
+ * \param[out] width The width of the grid
+ * \param[out] height The height of the grid
+ */
void PreviewHolder::calcGridSize( const Gtk::Widget* thing, int itemCount, int& width, int& height )
{
+ // Initially set all items in a horizontal row
width = itemCount;
height = 1;
@@ -326,55 +401,104 @@ void PreviewHolder::rebuildUI()
_scroller->remove();
_insides = 0; // remove() call should have deleted the Gtk::Table.
- if ( _view == VIEW_TYPE_LIST ) {
- _insides = manage(new Gtk::Table( 1, 2 ));
- _insides->set_col_spacings( 8 );
- if (_border == BORDER_WIDE) {
- _insides->set_row_spacings( 1 );
- }
+ switch(_view) {
+ case VIEW_TYPE_LIST:
+ {
- for ( unsigned int i = 0; i < items.size(); i++ ) {
- Gtk::Widget* label = manage(items[i]->getPreview(PREVIEW_STYLE_BLURB, _view, _baseSize, _ratio, _border));
- //label->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
+#if WITH_GTKMM_3_0
+ _insides = manage(new Gtk::Grid());
+ _insides->set_column_spacing(8);
+#else
+ _insides = manage(new Gtk::Table( 1, 2 ));
+ _insides->set_col_spacings( 8 );
+#endif
- Gtk::Widget* thing = manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, _view, _baseSize, _ratio, _border));
+ if (_border == BORDER_WIDE) {
+#if WITH_GTKMM_3_0
+ _insides->set_row_spacing(1);
+#else
+ _insides->set_row_spacings( 1 );
+#endif
+ }
- _insides->attach( *thing, 0, 1, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
- _insides->attach( *label, 1, 2, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK );
- }
- _scroller->add( *_insides );
- } else {
- int col = 0;
- int row = 0;
- int width = 2;
- int height = 1;
+ for ( unsigned int i = 0; i < items.size(); i++ ) {
+ Gtk::Widget* label = manage(items[i]->getPreview(PREVIEW_STYLE_BLURB, _view, _baseSize, _ratio, _border));
+ //label->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
- for ( unsigned int i = 0; i < items.size(); i++ ) {
+ Gtk::Widget* thing = manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, _view, _baseSize, _ratio, _border));
- // If this is the last row, flag so the previews can draw a bottom
- ::BorderStyle border = ((row == height -1) && (_border == BORDER_SOLID)) ? BORDER_SOLID_LAST_ROW : _border;
- Gtk::Widget* thing = manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, _view, _baseSize, _ratio, border));
+#if WITH_GTKMM_3_0
+ thing->set_hexpand();
+ thing->set_vexpand();
+ _insides->attach(*thing, 0, i, 1, 1);
- if ( !_insides ) {
- calcGridSize( thing, items.size(), width, height );
- _insides = manage(new Gtk::Table( height, width ));
- if (_border == BORDER_WIDE) {
- _insides->set_col_spacings( 1 );
- _insides->set_row_spacings( 1 );
+ label->set_hexpand();
+ label->set_valign(Gtk::ALIGN_CENTER);
+ _insides->attach(*label, 1, i, 1, 1);
+#else
+ _insides->attach( *thing, 0, 1, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
+ _insides->attach( *label, 1, 2, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK );
+#endif
}
- }
- _insides->attach( *thing, col, col+1, row, row+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
- if ( ++col >= width ) {
- col = 0;
- row++;
+ _scroller->add( *_insides );
}
- }
- if ( !_insides ) {
- _insides = manage(new Gtk::Table( 1, 2 ));
- }
+ break;
- _scroller->add( *_insides );
+ case VIEW_TYPE_GRID:
+ {
+ int col = 0;
+ int row = 0;
+ int width = 2;
+ int height = 1;
+
+ for ( unsigned int i = 0; i < items.size(); i++ ) {
+
+ // If this is the last row, flag so the previews can draw a bottom
+ ::BorderStyle border = ((row == height -1) && (_border == BORDER_SOLID)) ? BORDER_SOLID_LAST_ROW : _border;
+ Gtk::Widget* thing = manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, _view, _baseSize, _ratio, border));
+
+ if ( !_insides ) {
+ calcGridSize( thing, items.size(), width, height );
+
+#if WITH_GTKMM_3_0
+ _insides = manage(new Gtk::Grid());
+ if (_border == BORDER_WIDE) {
+ _insides->set_column_spacing(1);
+ _insides->set_row_spacing(1);
+ }
+#else
+ _insides = manage(new Gtk::Table( height, width ));
+ if (_border == BORDER_WIDE) {
+ _insides->set_col_spacings( 1 );
+ _insides->set_row_spacings( 1 );
+ }
+#endif
+ }
+
+#if WITH_GTKMM_3_0
+ thing->set_hexpand();
+ thing->set_vexpand();
+ _insides->attach( *thing, col, row, 1, 1);
+#else
+ _insides->attach( *thing, col, col+1, row, row+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
+#endif
+
+ if ( ++col >= width ) {
+ col = 0;
+ row++;
+ }
+ }
+ if ( !_insides ) {
+#if WITH_GTKMM_3_0
+ _insides = manage(new Gtk::Grid());
+#else
+ _insides = manage(new Gtk::Table( 1, 2 ));
+#endif
+ }
+
+ _scroller->add( *_insides );
+ }
}
_scroller->show_all_children();
diff --git a/src/ui/previewholder.h b/src/ui/previewholder.h
index 4c591bfaf..f6d1985cc 100644
--- a/src/ui/previewholder.h
+++ b/src/ui/previewholder.h
@@ -12,10 +12,21 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <gtkmm/box.h>
#include <gtkmm/bin.h>
-#include <gtkmm/table.h>
+
+namespace Gtk {
+#if WITH_GTKMM_3_0
+class Grid;
+#else
+class Table;
+#endif
+}
+
#include "previewfillable.h"
#include "../widgets/eek-preview.h"
#include "enums.h"
@@ -56,7 +67,13 @@ private:
std::vector<Previewable*> items;
Gtk::Bin *_scroller;
+
+#if WITH_GTKMM_3_0
+ Gtk::Grid *_insides;
+#else
Gtk::Table *_insides;
+#endif
+
int _prefCols;
bool _updatesFrozen;
SPAnchorType _anchor;
diff --git a/src/ui/widget/color-picker.cpp b/src/ui/widget/color-picker.cpp
index 31fb3096c..5585f2db4 100644
--- a/src/ui/widget/color-picker.cpp
+++ b/src/ui/widget/color-picker.cpp
@@ -56,8 +56,14 @@ void ColorPicker::setupDialog(const Glib::ustring &title)
_colorSelectorDialog.set_title (title);
_colorSelectorDialog.set_border_width (4);
_colorSelector = SP_COLOR_SELECTOR(sp_color_selector_new(SP_TYPE_COLOR_NOTEBOOK));
+
+#if WITH_GTKMM_3_0
+ _colorSelectorDialog.get_content_area()->pack_start (
+ *Glib::wrap(&_colorSelector->vbox), true, true, 0);
+#else
_colorSelectorDialog.get_vbox()->pack_start (
*Glib::wrap(&_colorSelector->vbox), true, true, 0);
+#endif
g_signal_connect(G_OBJECT(_colorSelector), "dragged",
G_CALLBACK(sp_color_picker_color_mod), (void *)this);
diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp
index a38a93fb1..2bfc7e0df 100644
--- a/src/ui/widget/dock.cpp
+++ b/src/ui/widget/dock.cpp
@@ -54,6 +54,17 @@ Dock::Dock(Gtk::Orientation orientation)
{
gdl_dock_bar_set_orientation(_gdl_dock_bar, static_cast<GtkOrientation>(orientation));
+#if WITH_GTKMM_3_0
+ switch(orientation) {
+ case Gtk::ORIENTATION_VERTICAL:
+ _dock_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
+ break;
+ case Gtk::ORIENTATION_HORIZONTAL:
+ _dock_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL));
+ }
+
+ _paned = Gtk::manage(new Gtk::Paned(orientation));
+#else
switch (orientation) {
case Gtk::ORIENTATION_VERTICAL:
_dock_box = Gtk::manage(new Gtk::HBox());
@@ -63,6 +74,7 @@ Dock::Dock(Gtk::Orientation orientation)
_dock_box = Gtk::manage(new Gtk::VBox());
_paned = Gtk::manage(new Gtk::HPaned());
}
+#endif
_scrolled_window->add(*_dock_box);
_scrolled_window->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
diff --git a/src/ui/widget/scalar.cpp b/src/ui/widget/scalar.cpp
index 9bbcc80f9..fca8a7974 100644
--- a/src/ui/widget/scalar.cpp
+++ b/src/ui/widget/scalar.cpp
@@ -142,7 +142,7 @@ void Scalar::update()
void Scalar::addSlider()
{
#if WITH_GTKMM_3_0
- Gtk::HScale *scale = new Gtk::HScale(static_cast<SpinButton*>(_widget)->get_adjustment());
+ Gtk::Scale *scale = new Gtk::Scale(static_cast<SpinButton*>(_widget)->get_adjustment());
#else
Gtk::HScale *scale = new Gtk::HScale( * static_cast<SpinButton*>(_widget)->get_adjustment() );
#endif
diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp
index 41d7c8be2..18dbb984b 100644
--- a/src/ui/widget/selected-style.cpp
+++ b/src/ui/widget/selected-style.cpp
@@ -119,8 +119,11 @@ SelectedStyle::SelectedStyle(bool /*layout*/)
current_stroke_width(0),
_desktop (NULL),
-
+#if WITH_GTKMM_3_0
+ _table(),
+#else
_table(2, 6),
+#endif
_fill_label (_("Fill:")),
_stroke_label (_("Stroke:")),
_opacity_label (_("O:")),
@@ -158,8 +161,13 @@ SelectedStyle::SelectedStyle(bool /*layout*/)
_opacity_label.set_alignment(0.0, 0.5);
_opacity_label.set_padding(0, 0);
+#if WITH_GTKMM_3_0
+ _table.set_column_spacing(2);
+ _table.set_row_spacing(0);
+#else
_table.set_col_spacings (2);
_table.set_row_spacings (0);
+#endif
for (int i = SS_FILL; i <= SS_STROKE; i++) {
@@ -361,6 +369,16 @@ SelectedStyle::SelectedStyle(bool /*layout*/)
_opacity_sb.set_size_request (SELECTED_STYLE_SB_WIDTH, -1);
_opacity_sb.set_sensitive (false);
+#if WITH_GTKMM_3_0
+ _table.attach(_fill_label, 0, 0, 1, 1);
+ _table.attach(_stroke_label, 0, 1, 1, 1);
+
+ _table.attach(_fill_flag_place, 1, 0, 1, 1);
+ _table.attach(_stroke_flag_place, 1, 1, 1, 1);
+
+ _table.attach(_fill_place, 2, 0, 1, 1);
+ _table.attach(_stroke, 2, 1, 1, 1);
+#else
_table.attach(_fill_label, 0,1, 0,1, Gtk::FILL, Gtk::SHRINK);
_table.attach(_stroke_label, 0,1, 1,2, Gtk::FILL, Gtk::SHRINK);
@@ -369,10 +387,17 @@ SelectedStyle::SelectedStyle(bool /*layout*/)
_table.attach(_fill_place, 2,3, 0,1);
_table.attach(_stroke, 2,3, 1,2);
+#endif
_opacity_place.add(_opacity_label);
+
+#if WITH_GTKMM_3_0
+ _table.attach(_opacity_place, 4, 0, 1, 2);
+ _table.attach(_opacity_sb, 5, 0, 1, 2);
+#else
_table.attach(_opacity_place, 4,5, 0,2, Gtk::SHRINK, Gtk::SHRINK);
_table.attach(_opacity_sb, 5,6, 0,2, Gtk::SHRINK, Gtk::SHRINK);
+#endif
pack_start(_table, true, true, 2);
diff --git a/src/ui/widget/selected-style.h b/src/ui/widget/selected-style.h
index fac4f22e6..6d5222429 100644
--- a/src/ui/widget/selected-style.h
+++ b/src/ui/widget/selected-style.h
@@ -11,8 +11,18 @@
#ifndef INKSCAPE_UI_CURRENT_STYLE_H
#define INKSCAPE_UI_CURRENT_STYLE_H
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <gtkmm/box.h>
-#include <gtkmm/table.h>
+
+#if WITH_GTKMM_3_0
+# include <gtkmm/grid.h>
+#else
+# include <gtkmm/table.h>
+#endif
+
#include <gtkmm/label.h>
#include <gtkmm/eventbox.h>
#include <gtkmm/enums.h>
@@ -127,7 +137,11 @@ public:
protected:
SPDesktop *_desktop;
+#if WITH_GTKMM_3_0
+ Gtk::Grid _table;
+#else
Gtk::Table _table;
+#endif
Gtk::Label _fill_label;
Gtk::Label _stroke_label;
diff --git a/src/ui/widget/spin-slider.cpp b/src/ui/widget/spin-slider.cpp
index 323b1209c..facbf704c 100644
--- a/src/ui/widget/spin-slider.cpp
+++ b/src/ui/widget/spin-slider.cpp
@@ -116,11 +116,20 @@ Gtk::Adjustment& SpinSlider::get_adjustment()
return _adjustment;
}
+#if WITH_GTKMM_3_0
+const Gtk::Scale& SpinSlider::get_scale() const
+#else
const Gtk::HScale& SpinSlider::get_scale() const
+#endif
{
return _scale;
}
+
+#if WITH_GTKMM_3_0
+Gtk::Scale& SpinSlider::get_scale()
+#else
Gtk::HScale& SpinSlider::get_scale()
+#endif
{
return _scale;
}
diff --git a/src/ui/widget/spin-slider.h b/src/ui/widget/spin-slider.h
index f4a62107b..8a45299e5 100644
--- a/src/ui/widget/spin-slider.h
+++ b/src/ui/widget/spin-slider.h
@@ -41,13 +41,14 @@ public:
#if WITH_GTKMM_3_0
const Glib::RefPtr<Gtk::Adjustment> get_adjustment() const;
Glib::RefPtr<Gtk::Adjustment> get_adjustment();
+ const Gtk::Scale& get_scale() const;
+ Gtk::Scale& get_scale();
#else
const Gtk::Adjustment& get_adjustment() const;
Gtk::Adjustment& get_adjustment();
-#endif
-
const Gtk::HScale& get_scale() const;
Gtk::HScale& get_scale();
+#endif
const Inkscape::UI::Widget::SpinButton& get_spin_button() const;
Inkscape::UI::Widget::SpinButton& get_spin_button();
@@ -57,10 +58,11 @@ public:
private:
#if WITH_GTKMM_3_0
Glib::RefPtr<Gtk::Adjustment> _adjustment;
+ Gtk::Scale _scale;
#else
Gtk::Adjustment _adjustment;
-#endif
Gtk::HScale _scale;
+#endif
Inkscape::UI::Widget::SpinButton _spin;
};
diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp
index 16558f0ee..f92a08d0a 100644
--- a/src/ui/widget/tolerance-slider.cpp
+++ b/src/ui/widget/tolerance-slider.cpp
@@ -73,8 +73,15 @@ void ToleranceSlider::init (const Glib::ustring& label1, const Glib::ustring& la
theLabel1->set_use_underline();
theLabel1->set_alignment(0, 0.5);
// align the label with the checkbox text above by indenting 22 px.
- _hbox->pack_start(*theLabel1, Gtk::PACK_EXPAND_WIDGET, 22);
+ _hbox->pack_start(*theLabel1, Gtk::PACK_EXPAND_WIDGET, 22);
+
+#if WITH_GTKMM_3_0
+ _hscale = manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL));
+ _hscale->set_range(1.0, 51.0);
+#else
_hscale = manage (new Gtk::HScale (1.0, 51, 1.0));
+#endif
+
theLabel1->set_mnemonic_widget (*_hscale);
_hscale->set_draw_value (true);
_hscale->set_value_pos (Gtk::POS_RIGHT);
diff --git a/src/ui/widget/tolerance-slider.h b/src/ui/widget/tolerance-slider.h
index d0b78e3c1..2184cd52b 100644
--- a/src/ui/widget/tolerance-slider.h
+++ b/src/ui/widget/tolerance-slider.h
@@ -13,7 +13,12 @@
#include <gtkmm/radiobuttongroup.h>
namespace Gtk {
- class RadioButton;
+class RadioButton;
+#if WITH_GTKMM_3_0
+class Scale;
+#else
+class HScale;
+#endif
}
namespace Inkscape {
@@ -55,7 +60,13 @@ protected:
void on_toggled();
void update (double val);
Gtk::HBox *_hbox;
+
+#if WITH_GTKMM_3_0
+ Gtk::Scale *_hscale;
+#else
Gtk::HScale *_hscale;
+#endif
+
Gtk::RadioButtonGroup _radio_button_group;
Gtk::RadioButton *_button1;
Gtk::RadioButton *_button2;