diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2017-06-29 15:40:49 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marc@jeanmougin.fr> | 2017-06-29 15:40:49 +0000 |
| commit | f36f7edc837b86a229f17fa03e94d6e0706e00c1 (patch) | |
| tree | c1a685af6629ecdd936c5d6fb5022b6a3a483d81 /src | |
| parent | Merge branch 'master' of gitlab.com:inkscape/inkscape (diff) | |
| parent | Merge branch 'master' of gitlab.com:inkscape/inkscape (diff) | |
| download | inkscape-f36f7edc837b86a229f17fa03e94d6e0706e00c1.tar.gz inkscape-f36f7edc837b86a229f17fa03e94d6e0706e00c1.zip | |
Merge branch 'master' of gitlab.com:inkscape/inkscape
Diffstat (limited to 'src')
| -rw-r--r-- | src/io/resource.cpp | 6 | ||||
| -rw-r--r-- | src/io/resource.h | 3 | ||||
| -rw-r--r-- | src/ui/dialog/dock-behavior.cpp | 4 | ||||
| -rw-r--r-- | src/ui/dialog/grid-arrange-tab.cpp | 4 | ||||
| -rw-r--r-- | src/ui/dialog/grid-arrange-tab.h | 20 | ||||
| -rw-r--r-- | src/ui/dialog/knot-properties.cpp | 18 | ||||
| -rw-r--r-- | src/ui/dialog/knot-properties.h | 4 | ||||
| -rw-r--r-- | src/ui/dialog/layers.cpp | 35 | ||||
| -rw-r--r-- | src/ui/dialog/objects.cpp | 38 | ||||
| -rw-r--r-- | src/ui/dialog/styledialog.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/styledialog.h | 6 | ||||
| -rw-r--r-- | src/ui/dialog/tags.cpp | 4 | ||||
| -rw-r--r-- | src/ui/interface.cpp | 29 | ||||
| -rw-r--r-- | src/ui/previewholder.cpp | 1 | ||||
| -rw-r--r-- | src/ui/widget/dock-item.cpp | 12 | ||||
| -rw-r--r-- | src/ui/widget/dock-item.h | 14 | ||||
| -rw-r--r-- | src/ui/widget/dock.cpp | 5 | ||||
| -rw-r--r-- | src/ui/widget/dock.h | 2 |
18 files changed, 92 insertions, 115 deletions
diff --git a/src/io/resource.cpp b/src/io/resource.cpp index ffe612e43..73dc7117e 100644 --- a/src/io/resource.cpp +++ b/src/io/resource.cpp @@ -20,7 +20,6 @@ #include "config.h" #endif -#include <glib.h> // g_assert() #include "path-prefix.h" #include "io/sys.h" #include "io/resource.h" @@ -49,6 +48,7 @@ gchar *_get_path(Domain domain, Type type, char const *filename) case ICONS: temp = INKSCAPE_PIXMAPDIR; break; case KEYS: temp = INKSCAPE_KEYSDIR; break; case MARKERS: temp = INKSCAPE_MARKERSDIR; break; + case NONE: g_assert_not_reached(); break; case PALETTES: temp = INKSCAPE_PALETTESDIR; break; case PATTERNS: temp = INKSCAPE_PATTERNSDIR; break; case SCREENS: temp = INKSCAPE_SCREENSDIR; break; @@ -71,6 +71,9 @@ gchar *_get_path(Domain domain, Type type, char const *filename) } path = g_strdup(temp); } break; + case CACHE: { + path = g_build_filename(g_get_user_cache_dir(), "inkscape", NULL); + } break; case USER: { char const *name=NULL; switch (type) { @@ -80,6 +83,7 @@ gchar *_get_path(Domain domain, Type type, char const *filename) case ICONS: name = "icons"; break; case KEYS: name = "keys"; break; case MARKERS: name = "markers"; break; + case NONE: name = ""; break; case PALETTES: name = "palettes"; break; case PATTERNS: name = "patterns"; break; case SYMBOLS: name = "symbols"; break; diff --git a/src/io/resource.h b/src/io/resource.h index 8b60775b5..0ea5ab4f0 100644 --- a/src/io/resource.h +++ b/src/io/resource.h @@ -17,6 +17,7 @@ #ifndef SEEN_INKSCAPE_IO_RESOURCE_H #define SEEN_INKSCAPE_IO_RESOURCE_H +#include <glibmm/ustring.h> #include "util/share.h" namespace Inkscape { @@ -35,6 +36,7 @@ enum Type { ICONS, KEYS, MARKERS, + NONE, PALETTES, PATTERNS, SCREENS, @@ -49,6 +51,7 @@ enum Type { enum Domain { SYSTEM, CREATE, + CACHE, USER }; diff --git a/src/ui/dialog/dock-behavior.cpp b/src/ui/dialog/dock-behavior.cpp index 299584a31..0c8bb3194 100644 --- a/src/ui/dialog/dock-behavior.cpp +++ b/src/ui/dialog/dock-behavior.cpp @@ -39,9 +39,9 @@ DockBehavior::DockBehavior(Dialog &dialog) : static_cast<Widget::DockItem::State>( Inkscape::Preferences::get()->getInt(_dialog._prefs_path + "/state", UI::Widget::DockItem::DOCKED_STATE)), - static_cast<Widget::DockItem::Placement>( + static_cast<GdlDockPlacement>( Inkscape::Preferences::get()->getInt(_dialog._prefs_path + "/placement", - UI::Widget::DockItem::TOP))) + GDL_DOCK_TOP))) { // Connect signals diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index 5d7422279..bb8fc564a 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -610,6 +610,7 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) NoOfRowsLabel.set_text_with_mnemonic(_("_Rows:")); NoOfRowsLabel.set_mnemonic_widget(NoOfRowsSpinner); + NoOfRowsBox.set_orientation(Gtk::ORIENTATION_VERTICAL); NoOfRowsBox.pack_start(NoOfRowsLabel, false, false, MARGIN); NoOfRowsSpinner.set_digits(0); @@ -640,6 +641,7 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) /*#### Label for X ####*/ padXByYLabel.set_label(" "); + XByYLabelVBox.set_orientation(Gtk::ORIENTATION_VERTICAL); XByYLabelVBox.pack_start(padXByYLabel, false, false, MARGIN); XByYLabel.set_markup(" × "); XByYLabelVBox.pack_start(XByYLabel, false, false, MARGIN); @@ -650,6 +652,7 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) NoOfColsLabel.set_text_with_mnemonic(_("_Columns:")); NoOfColsLabel.set_mnemonic_widget(NoOfColsSpinner); + NoOfColsBox.set_orientation(Gtk::ORIENTATION_VERTICAL); NoOfColsBox.pack_start(NoOfColsLabel, false, false, MARGIN); NoOfColsSpinner.set_digits(0); @@ -676,6 +679,7 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) SpinsHBox.pack_start(NoOfColsBox, false, false, MARGIN); + TileBox.set_orientation(Gtk::ORIENTATION_VERTICAL); TileBox.pack_start(SpinsHBox, false, false, MARGIN); VertAlign = prefs->getInt("/dialogs/gridtiler/VertAlign", 1); diff --git a/src/ui/dialog/grid-arrange-tab.h b/src/ui/dialog/grid-arrange-tab.h index 891849f1a..93bc38218 100644 --- a/src/ui/dialog/grid-arrange-tab.h +++ b/src/ui/dialog/grid-arrange-tab.h @@ -73,7 +73,7 @@ private: bool userHidden; bool updating; - Gtk::VBox TileBox; + Gtk::Box TileBox; Gtk::Button *TileOkButton; Gtk::Button *TileCancelButton; @@ -81,22 +81,22 @@ private: Gtk::Label SelectionContentsLabel; - Gtk::HBox AlignHBox; - Gtk::HBox SpinsHBox; + Gtk::Box AlignHBox; + Gtk::Box SpinsHBox; // Number per Row - Gtk::VBox NoOfColsBox; + Gtk::Box NoOfColsBox; Gtk::Label NoOfColsLabel; Inkscape::UI::Widget::SpinButton NoOfColsSpinner; bool AutoRowSize; Gtk::CheckButton RowHeightButton; - Gtk::VBox XByYLabelVBox; + Gtk::Box XByYLabelVBox; Gtk::Label padXByYLabel; Gtk::Label XByYLabel; // Number per Column - Gtk::VBox NoOfRowsBox; + Gtk::Box NoOfRowsBox; Gtk::Label NoOfRowsLabel; Inkscape::UI::Widget::SpinButton NoOfRowsSpinner; bool AutoColSize; @@ -121,15 +121,11 @@ private: bool ManualSpacing; // Row height - Gtk::VBox RowHeightVBox; - Gtk::HBox RowHeightBox; - Gtk::Label RowHeightLabel; + Gtk::Box RowHeightBox; Inkscape::UI::Widget::SpinButton RowHeightSpinner; // Column width - Gtk::VBox ColumnWidthVBox; - Gtk::HBox ColumnWidthBox; - Gtk::Label ColumnWidthLabel; + Gtk::Box ColumnWidthBox; Inkscape::UI::Widget::SpinButton ColumnWidthSpinner; }; diff --git a/src/ui/dialog/knot-properties.cpp b/src/ui/dialog/knot-properties.cpp index 954fe2a66..9008d943a 100644 --- a/src/ui/dialog/knot-properties.cpp +++ b/src/ui/dialog/knot-properties.cpp @@ -45,14 +45,15 @@ KnotPropertiesDialog::KnotPropertiesDialog() { Gtk::Box *mainVBox = get_vbox(); - _layout_table.set_spacings(4); - _layout_table.resize (2, 2); + _layout_table.set_row_spacing(4); + _layout_table.set_column_spacing(4); _unit_name = ""; // Layer name widgets _knot_x_entry.set_activates_default(true); _knot_x_entry.set_digits(4); _knot_x_entry.set_increments(1,1); _knot_x_entry.set_range(-G_MAXDOUBLE, G_MAXDOUBLE); + _knot_x_entry.set_hexpand(); _knot_x_label.set_label(_("Position X:")); _knot_x_label.set_alignment(1.0, 0.5); @@ -60,16 +61,15 @@ KnotPropertiesDialog::KnotPropertiesDialog() _knot_y_entry.set_digits(4); _knot_y_entry.set_increments(1,1); _knot_y_entry.set_range(-G_MAXDOUBLE, G_MAXDOUBLE); - _knot_y_label.set_label(_("Position Y:")); + _knot_y_entry.set_hexpand(); + _knot_y_label.set_label(_("Position Y:")); _knot_y_label.set_alignment(1.0, 0.5); - _layout_table.attach(_knot_x_label, - 0, 1, 0, 1, Gtk::FILL, Gtk::FILL); - _layout_table.attach(_knot_x_entry, - 1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL); + _layout_table.attach(_knot_x_label, 0, 0, 1, 1); + _layout_table.attach(_knot_x_entry, 1, 0, 1, 1); - _layout_table.attach(_knot_y_label, 0, 1, 1, 2, Gtk::FILL, Gtk::FILL); - _layout_table.attach(_knot_y_entry, 1, 2, 1, 2, Gtk::FILL | Gtk::EXPAND, Gtk::FILL); + _layout_table.attach(_knot_y_label, 0, 1, 1, 1); + _layout_table.attach(_knot_y_entry, 1, 1, 1, 1); mainVBox->pack_start(_layout_table, true, true, 4); diff --git a/src/ui/dialog/knot-properties.h b/src/ui/dialog/knot-properties.h index f6157168f..1297eae1f 100644 --- a/src/ui/dialog/knot-properties.h +++ b/src/ui/dialog/knot-properties.h @@ -13,9 +13,9 @@ #define INKSCAPE_DIALOG_KNOT_PROPERTIES_H #include <gtkmm/dialog.h> +#include <gtkmm/grid.h> #include <gtkmm/label.h> #include <gtkmm/spinbutton.h> -#include <gtkmm/table.h> #include <2geom/point.h> #include "knot.h" #include "ui/tools/measure-tool.h" @@ -45,7 +45,7 @@ protected: Gtk::SpinButton _knot_x_entry; Gtk::Label _knot_y_label; Gtk::SpinButton _knot_y_entry; - Gtk::Table _layout_table; + Gtk::Grid _layout_table; bool _position_visible; Gtk::Button _close_button; diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index be3b4af06..7a650b034 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -15,7 +15,6 @@ #include "layers.h" #include <gtkmm/icontheme.h> -#include <gtkmm/imagemenuitem.h> #include <gtkmm/separatormenuitem.h> #include <glibmm/main.h> @@ -113,11 +112,12 @@ void LayersPanel::_styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned i Gtk::MenuItem& LayersPanel::_addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id ) { - GtkWidget* iconWidget = 0; + Gtk::Image *iconWidget = nullptr; const char* label = 0; if ( iconName ) { - iconWidget = gtk_image_new_from_icon_name( iconName, GTK_ICON_SIZE_MENU ); + iconWidget = Gtk::manage(new Gtk::Image()); + iconWidget->set_from_icon_name( iconName, Gtk::ICON_SIZE_MENU ); } if ( desktop ) { @@ -125,7 +125,8 @@ Gtk::MenuItem& LayersPanel::_addPopupItem( SPDesktop *desktop, unsigned int code if ( verb ) { SPAction *action = verb->get_action(Inkscape::ActionContext(desktop)); if ( !iconWidget && action && action->image ) { - iconWidget = gtk_image_new_from_icon_name( action->image, GTK_ICON_SIZE_MENU ); + iconWidget = Gtk::manage(new Gtk::Image()); + iconWidget->set_from_icon_name( action->image, Gtk::ICON_SIZE_MENU ); } if ( action ) { @@ -138,21 +139,23 @@ Gtk::MenuItem& LayersPanel::_addPopupItem( SPDesktop *desktop, unsigned int code label = fallback; } - Gtk::Widget* wrapped = 0; - if ( iconWidget ) { - wrapped = Gtk::manage(Glib::wrap(iconWidget)); - wrapped->show(); - } - - - Gtk::MenuItem* item = 0; + auto box = Gtk::manage(new Gtk::Box()); + Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem()); - if (wrapped) { - item = Gtk::manage(new Gtk::ImageMenuItem(*wrapped, label, true)); - } else { - item = Gtk::manage(new Gtk::MenuItem(label, true)); + if (iconWidget) { + box->pack_start(*iconWidget, false, true, 0); + } + else { + Gtk::Label *fake_icon = Gtk::manage(new Gtk::Label("")); + box->pack_start(*fake_icon, false, true, 0); } + Gtk::Label *menu_label = Gtk::manage(new Gtk::Label(label, true)); + menu_label->set_xalign(0.0); + box->pack_start(*menu_label, true, true, 0); + item->add(*box); + item->show_all(); + item->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &LayersPanel::_takeAction), id)); _popupMenu.append(*item); diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index e76da241a..4b673b8b7 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -241,23 +241,25 @@ void ObjectsPanel::_styleButton(Gtk::Button& btn, char const* iconName, char con */ Gtk::MenuItem& ObjectsPanel::_addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id ) { - GtkWidget* iconWidget = 0; + Gtk::Image *iconWidget = nullptr; const char* label = 0; if ( iconName ) { - iconWidget = gtk_image_new_from_icon_name( iconName, GTK_ICON_SIZE_MENU ); + iconWidget = Gtk::manage(new Gtk::Image()); + iconWidget->set_from_icon_name( iconName, Gtk::ICON_SIZE_MENU ); } if ( desktop ) { Verb *verb = Verb::get( code ); if ( verb ) { - SPAction *action = verb->get_action(desktop); + SPAction *action = verb->get_action(Inkscape::ActionContext(desktop)); if ( !iconWidget && action && action->image ) { - iconWidget = gtk_image_new_from_icon_name( action->image, GTK_ICON_SIZE_MENU ); + iconWidget = Gtk::manage(new Gtk::Image()); + iconWidget->set_from_icon_name( action->image, Gtk::ICON_SIZE_MENU ); } if ( action ) { - // label = action->name; + label = action->name; } } } @@ -266,21 +268,23 @@ Gtk::MenuItem& ObjectsPanel::_addPopupItem( SPDesktop *desktop, unsigned int cod label = fallback; } - Gtk::Widget* wrapped = 0; - if ( iconWidget ) { - wrapped = Gtk::manage(Glib::wrap(iconWidget)); - wrapped->show(); - } - - - Gtk::MenuItem* item = 0; + auto box = Gtk::manage(new Gtk::Box()); + Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem()); - if (wrapped) { - item = Gtk::manage(new Gtk::ImageMenuItem(*wrapped, label, true)); - } else { - item = Gtk::manage(new Gtk::MenuItem(label, true)); + if (iconWidget) { + box->pack_start(*iconWidget, false, true, 0); + } + else { + Gtk::Label *fake_icon = Gtk::manage(new Gtk::Label("")); + box->pack_start(*fake_icon, false, true, 0); } + Gtk::Label *menu_label = Gtk::manage(new Gtk::Label(label, true)); + menu_label->set_xalign(0.0); + box->pack_start(*menu_label, true, true, 0); + item->add(*box); + item->show_all(); + item->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &ObjectsPanel::_takeAction), id)); _popupMenu.append(*item); diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 73dd6937a..3642c0168 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -264,7 +264,9 @@ StyleDialog::StyleDialog() : _treeView.set_expander_column(*(_treeView.get_column(1))); // Pack widgets + _paned.set_orientation(Gtk::ORIENTATION_VERTICAL); _paned.pack1(_mainBox, Gtk::SHRINK); + _mainBox.set_orientation(Gtk::ORIENTATION_VERTICAL); _mainBox.pack_start(_scrolledWindow, Gtk::PACK_EXPAND_WIDGET); _scrolledWindow.add(_treeView); _scrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index dbbc1e480..03932e3cc 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -108,9 +108,9 @@ private: Glib::RefPtr<TreeStore> _store; // Widgets - Gtk::VPaned _paned; - Gtk::VBox _mainBox; - Gtk::HBox _buttonBox; + Gtk::Paned _paned; + Gtk::Box _mainBox; + Gtk::Box _buttonBox; Gtk::ScrolledWindow _scrolledWindow; Gtk::Button* del; Gtk::Button* create; diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index b990ccfef..176719995 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -155,7 +155,7 @@ Gtk::MenuItem& TagsPanel::_addPopupItem( SPDesktop *desktop, unsigned int code, } if ( action ) { - label = action->name; + // label = action->name; } } } @@ -166,7 +166,7 @@ Gtk::MenuItem& TagsPanel::_addPopupItem( SPDesktop *desktop, unsigned int code, Gtk::Widget* wrapped = 0; if ( iconWidget ) { - wrapped = manage(Glib::wrap(iconWidget)); + wrapped = Gtk::manage(Glib::wrap(iconWidget)); wrapped->show(); } diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 4246ae34e..a0ee5c72b 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -136,8 +136,6 @@ static void sp_ui_menu_item_set_name(GtkWidget *data, Glib::ustring const &name); static void sp_recent_open(GtkRecentChooser *, gpointer); -static void injectRenamedIcons(); - static const int MIN_ONSCREEN_DISTANCE = 50; void @@ -1441,33 +1439,6 @@ sp_ui_menu_item_set_name(GtkWidget *data, Glib::ustring const &name) } } } - -void injectRenamedIcons() -{ - Glib::RefPtr<Gtk::IconTheme> iconTheme = Gtk::IconTheme::get_default(); - - std::vector< std::pair<Glib::ustring, Glib::ustring> > renamed; - renamed.push_back(std::make_pair("gtk-file", "document-x-generic")); - renamed.push_back(std::make_pair("gtk-directory", "folder")); - - for ( std::vector< std::pair<Glib::ustring, Glib::ustring> >::iterator it = renamed.begin(); it < renamed.end(); ++it ) { - bool hasIcon = iconTheme->has_icon(it->first); - bool hasSecondIcon = iconTheme->has_icon(it->second); - - if ( !hasIcon && hasSecondIcon ) { - Glib::ArrayHandle<int> sizes = iconTheme->get_icon_sizes(it->second); - for ( Glib::ArrayHandle<int>::iterator it2 = sizes.begin(); it2 < sizes.end(); ++it2 ) { - Glib::RefPtr<Gdk::Pixbuf> pb = iconTheme->load_icon( it->second, *it2 ); - if ( pb ) { - // install a private copy of the pixbuf to avoid pinning a theme - Glib::RefPtr<Gdk::Pixbuf> pbCopy = pb->copy(); - Gtk::IconTheme::add_builtin_icon( it->first, *it2, pbCopy ); - } - } - } - } -} - /* Local Variables: mode:c++ diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index 6fec65124..e294bd408 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -149,7 +149,6 @@ void PreviewHolder::addPreview( Previewable* preview ) auto target = kids[childCount - (j + 1)]; int col2 = j % width; int row2 = j / width; - Glib::RefPtr<Gtk::Widget> handle(target); _insides->remove( *target ); target->set_hexpand(); diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index d268be785..60ea03fb7 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -21,7 +21,7 @@ namespace UI { namespace Widget { DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& long_name, - const Glib::ustring& icon_name, State state, Placement placement) : + const Glib::ustring& icon_name, State state, GdlDockPlacement placement) : _dock(dock), _prev_state(state), _prev_position(0), @@ -70,7 +70,7 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l signal_delete_event().connect(sigc::mem_fun(*this, &Inkscape::UI::Widget::DockItem::_onDeleteEvent)); signal_realize().connect(sigc::mem_fun(*this, &Inkscape::UI::Widget::DockItem::_onRealize)); - _dock.addItem(*this, ( _prev_state == FLOATING_STATE || _prev_state == ICONIFIED_FLOATING_STATE ) ? FLOATING : placement); + _dock.addItem(*this, ( _prev_state == FLOATING_STATE || _prev_state == ICONIFIED_FLOATING_STATE ) ? GDL_DOCK_FLOATING : placement); if (_prev_state == ICONIFIED_FLOATING_STATE || _prev_state == ICONIFIED_DOCKED_STATE) { iconify(); @@ -214,16 +214,16 @@ DockItem::getPrevState() const return _prev_state; } -DockItem::Placement +GdlDockPlacement DockItem::getPlacement() const { - GdlDockPlacement placement = (GdlDockPlacement)TOP; + GdlDockPlacement placement = GDL_DOCK_TOP; GdlDockObject *parent = gdl_dock_object_get_parent_object (GDL_DOCK_OBJECT(_gdl_dock_item)); if (parent) { gdl_dock_object_child_placement(parent, GDL_DOCK_OBJECT(_gdl_dock_item), &placement); } - return (Placement)placement; + return placement; } void @@ -258,7 +258,7 @@ DockItem::present() show(); } // tabbed - else if (getPlacement() == CENTER) { + else if (getPlacement() == GDL_DOCK_CENTER) { int i = gtk_notebook_page_num(GTK_NOTEBOOK(gtk_widget_get_parent(_gdl_dock_item)), GTK_WIDGET (_gdl_dock_item)); if (i >= 0) diff --git a/src/ui/widget/dock-item.h b/src/ui/widget/dock-item.h index 2df45b207..b5f6c13af 100644 --- a/src/ui/widget/dock-item.h +++ b/src/ui/widget/dock-item.h @@ -45,18 +45,8 @@ public: ICONIFIED_DOCKED_STATE, // item iconified in its assigned dock from dock ICONIFIED_FLOATING_STATE}; // item iconified in its assigned dock from float - enum Placement { - NONE = GDL_DOCK_NONE, - TOP = GDL_DOCK_TOP, - BOTTOM = GDL_DOCK_BOTTOM, - RIGHT = GDL_DOCK_RIGHT, - LEFT = GDL_DOCK_LEFT, - CENTER = GDL_DOCK_CENTER, - FLOATING = GDL_DOCK_FLOATING - }; - DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& long_name, - const Glib::ustring& icon_name, State state, Placement placement); + const Glib::ustring& icon_name, State state, GdlDockPlacement placement); ~DockItem(); @@ -80,7 +70,7 @@ public: bool isIconified() const; State getState() const; State getPrevState() const; - Placement getPlacement() const; + GdlDockPlacement getPlacement() const; Gtk::Window *getWindow(); //< gives the parent window, if the dock item has one (i.e. it's floating) diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp index b2dec401f..7dfad9582 100644 --- a/src/ui/widget/dock.cpp +++ b/src/ui/widget/dock.cpp @@ -124,12 +124,13 @@ Dock::~Dock() g_free(_gdl_dock_bar); } -void Dock::addItem(DockItem& item, DockItem::Placement placement) +void Dock::addItem(DockItem& item, GdlDockPlacement placement) { _dock_items.push_back(&item); + gdl_dock_add_item(GDL_DOCK(_gdl_dock), GDL_DOCK_ITEM(item.gobj()), - (GdlDockPlacement)placement); + placement); // FIXME: This is a hack to prevent the dock from expanding the main window, this can't be done // initially as the paned doesn't exist. diff --git a/src/ui/widget/dock.h b/src/ui/widget/dock.h index 74b072d22..6258a06e3 100644 --- a/src/ui/widget/dock.h +++ b/src/ui/widget/dock.h @@ -37,7 +37,7 @@ public: Dock(Gtk::Orientation orientation=Gtk::ORIENTATION_VERTICAL); ~Dock(); - void addItem(DockItem& item, DockItem::Placement placement); + void addItem(DockItem& item, GdlDockPlacement placement); Gtk::Widget& getWidget(); //< return the top widget Gtk::Paned *getParentPaned(); |
