summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Valavanis <valavanisalex@gmail.com>2013-03-09 18:52:43 +0000
committerAlex Valavanis <valavanisalex@gmail.com>2013-03-09 18:52:43 +0000
commit093bd929fe463a6199d09b69706e55d3ddb57682 (patch)
tree7c18684af2def2c0ee78e55502f415a87f2d7097 /src
parentMigrate calligraphic-profile-rename.* to Gtk::Grid (diff)
downloadinkscape-093bd929fe463a6199d09b69706e55d3ddb57682.tar.gz
inkscape-093bd929fe463a6199d09b69706e55d3ddb57682.zip
Migrate Object Properties dialog to Gtk::Grid
(bzr r12188)
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/export.h1
-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
5 files changed, 147 insertions, 50 deletions
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/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;