diff options
| author | Ted Gould <ted@gould.cx> | 2008-11-21 05:24:08 +0000 |
|---|---|---|
| committer | Ted Gould <ted@canonical.com> | 2008-11-21 05:24:08 +0000 |
| commit | 44a3a78fb6a3863c0c7f3c1193837337e68a67e4 (patch) | |
| tree | 1722ee5ec6f88c881cd4124923354b3c1311501b /src/widgets | |
| parent | Merge from trunk (diff) | |
| download | inkscape-44a3a78fb6a3863c0c7f3c1193837337e68a67e4.tar.gz inkscape-44a3a78fb6a3863c0c7f3c1193837337e68a67e4.zip | |
Merge from fe-moved
(bzr r6891)
Diffstat (limited to 'src/widgets')
| -rw-r--r-- | src/widgets/Makefile_insert | 32 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/widgets/calligraphic-profile-rename.cpp | 149 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/widgets/calligraphic-profile-rename.h | 90 | ||||
| -rw-r--r-- | src/widgets/desktop-widget.cpp | 2 | ||||
| -rw-r--r-- | src/widgets/font-selector.cpp | 2 | ||||
| -rw-r--r-- | src/widgets/icon.cpp | 4 | ||||
| -rw-r--r-- | src/widgets/select-toolbar.cpp | 8 | ||||
| -rw-r--r-- | src/widgets/toolbox.cpp | 140 |
8 files changed, 222 insertions, 205 deletions
diff --git a/src/widgets/Makefile_insert b/src/widgets/Makefile_insert index 33f589247..fdebe8d20 100644 --- a/src/widgets/Makefile_insert +++ b/src/widgets/Makefile_insert @@ -11,18 +11,18 @@ widgets/clean: rm -f widgets/libspwidgets.a $(widgets_libspwidgets_a_OBJECTS) widgets_libspwidgets_a_SOURCES = \ - widgets/button.cpp \ - widgets/button.h \ + widgets/button.cpp \ + widgets/button.h \ widgets/calligraphic-profile-rename.cpp \ widgets/calligraphic-profile-rename.h \ widgets/dash-selector.cpp \ - widgets/dash-selector.h \ + widgets/dash-selector.h \ widgets/dash-selector.cpp \ - widgets/dash-selector.h \ + widgets/dash-selector.h \ widgets/desktop-widget.cpp \ widgets/desktop-widget.h \ widgets/font-selector.cpp \ - widgets/font-selector.h \ + widgets/font-selector.h \ widgets/gradient-toolbar.cpp \ widgets/gradient-toolbar.h \ widgets/gradient-image.cpp \ @@ -31,14 +31,14 @@ widgets_libspwidgets_a_SOURCES = \ widgets/gradient-selector.h \ widgets/gradient-vector.cpp \ widgets/gradient-vector.h \ - widgets/icon.cpp \ - widgets/icon.h \ - widgets/layer-selector.h \ - widgets/layer-selector.cpp \ + widgets/icon.cpp \ + widgets/icon.h \ + widgets/layer-selector.h \ + widgets/layer-selector.cpp \ widgets/paint-selector.cpp \ widgets/paint-selector.h \ - widgets/ruler.cpp \ - widgets/ruler.h \ + widgets/ruler.cpp \ + widgets/ruler.h \ widgets/select-toolbar.cpp \ widgets/select-toolbar.h \ widgets/shrink-wrap-button.cpp \ @@ -61,8 +61,8 @@ widgets_libspwidgets_a_SOURCES = \ widgets/sp-color-wheel-selector.h \ widgets/sp-color-wheel.cpp \ widgets/sp-color-wheel.h \ - widgets/sp-widget.cpp \ - widgets/sp-widget.h\ + widgets/sp-widget.cpp \ + widgets/sp-widget.h \ widgets/sp-xmlview-attr-list.cpp \ widgets/sp-xmlview-attr-list.h \ widgets/sp-xmlview-content.cpp \ @@ -72,9 +72,9 @@ widgets_libspwidgets_a_SOURCES = \ widgets/spinbutton-events.cpp \ widgets/spinbutton-events.h \ widgets/spw-utilities.cpp \ - widgets/spw-utilities.h \ - widgets/toolbox.cpp \ - widgets/toolbox.h \ + widgets/spw-utilities.h \ + widgets/toolbox.cpp \ + widgets/toolbox.h \ widgets/widget-sizes.h widgets/button.$(OBJEXT): helper/sp-marshal.h diff --git a/src/widgets/calligraphic-profile-rename.cpp b/src/widgets/calligraphic-profile-rename.cpp index 45ad08aa9..888b327f4 100755..100644 --- a/src/widgets/calligraphic-profile-rename.cpp +++ b/src/widgets/calligraphic-profile-rename.cpp @@ -1,12 +1,14 @@ -/** +/** @file + * @brief Dialog for naming calligraphic profiles * - * \brief Dialog for naming calligraphic profiles - * - * Author: + * @note This file is in the wrong directory because of link order issues - + * it is required by widgets/toolbox.cpp, and libspwidgets.a comes after + * libinkdialogs.a in the current link order. + */ +/* Author: * Aubanel MONNIER * - * Copyright (C) 2007 Aubanel MONNIER - * + * Copyright (C) 2007 Authors * Released under GNU GPL. Read the file 'COPYING' for more information */ @@ -20,80 +22,87 @@ #include "desktop.h" #include "calligraphic-profile-rename.h" - namespace Inkscape { namespace UI { -namespace Dialogs { -CalligraphicProfileDialog::CalligraphicProfileDialog(): _applied(false){ - Gtk::VBox *mainVBox = get_vbox(); - _layout_table.set_spacings(4); - _layout_table.resize (1, 2); - - _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, - 0, 1, 0, 1, Gtk::FILL, Gtk::FILL); - _layout_table.attach(_profile_name_entry, - 1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL); - mainVBox->pack_start(_layout_table, false, false, 4); - // Buttons - _close_button.set_use_stock(true); - _close_button.set_label(Gtk::Stock::CANCEL.id); - _close_button.set_flags(Gtk::CAN_DEFAULT); - - _apply_button.set_use_underline(true); - _apply_button.set_label(_("Save")); - _apply_button.set_flags(Gtk::CAN_DEFAULT); - - _close_button.signal_clicked() - .connect(sigc::mem_fun(*this, &CalligraphicProfileDialog::_close)); - _apply_button.signal_clicked() - .connect(sigc::mem_fun(*this, &CalligraphicProfileDialog::_apply)); - - signal_delete_event().connect( - sigc::bind_return( - sigc::hide(sigc::mem_fun(*this, &CalligraphicProfileDialog::_close)), - true - ) - ); - - add_action_widget(_close_button, Gtk::RESPONSE_CLOSE); - add_action_widget(_apply_button, Gtk::RESPONSE_APPLY); - - _apply_button.grab_default(); - - show_all_children(); +namespace Dialog { + +CalligraphicProfileRename::CalligraphicProfileRename() : + _applied(false) +{ + Gtk::VBox *mainVBox = get_vbox(); + _layout_table.set_spacings(4); + _layout_table.resize (1, 2); + + _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, + 0, 1, 0, 1, Gtk::FILL, Gtk::FILL); + _layout_table.attach(_profile_name_entry, + 1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL); + mainVBox->pack_start(_layout_table, false, false, 4); + // Buttons + _close_button.set_use_stock(true); + _close_button.set_label(Gtk::Stock::CANCEL.id); + _close_button.set_flags(Gtk::CAN_DEFAULT); + + _apply_button.set_use_underline(true); + _apply_button.set_label(_("Save")); + _apply_button.set_flags(Gtk::CAN_DEFAULT); + + _close_button.signal_clicked() + .connect(sigc::mem_fun(*this, &CalligraphicProfileRename::_close)); + _apply_button.signal_clicked() + .connect(sigc::mem_fun(*this, &CalligraphicProfileRename::_apply)); + + signal_delete_event().connect( sigc::bind_return( + sigc::hide(sigc::mem_fun(*this, &CalligraphicProfileRename::_close)), true ) ); + + add_action_widget(_close_button, Gtk::RESPONSE_CLOSE); + add_action_widget(_apply_button, Gtk::RESPONSE_APPLY); + + _apply_button.grab_default(); + + show_all_children(); } -void -CalligraphicProfileDialog::_apply() +void CalligraphicProfileRename::_apply() { - _profile_name = _profile_name_entry.get_text(); - _applied = true; - _close(); + _profile_name = _profile_name_entry.get_text(); + _applied = true; + _close(); } -void -CalligraphicProfileDialog::_close() +void CalligraphicProfileRename::_close() { - this->Gtk::Dialog::hide(); - + this->Gtk::Dialog::hide(); } -void CalligraphicProfileDialog::show(SPDesktop *desktop){ - CalligraphicProfileDialog &dial = instance(); - dial._applied=false; - dial.set_modal(true); - desktop->setWindowTransient (dial.gobj()); - dial.property_destroy_with_parent() = true; - // dial.Gtk::Dialog::show(); - //dial.present(); - dial.run(); +void CalligraphicProfileRename::show(SPDesktop *desktop) +{ + CalligraphicProfileRename &dial = instance(); + dial._applied=false; + dial.set_modal(true); + desktop->setWindowTransient (dial.gobj()); + dial.property_destroy_with_parent() = true; + // dial.Gtk::Dialog::show(); + //dial.present(); + dial.run(); } - -}}} +} // namespace Dialog +} // namespace UI +} // namespace Inkscape + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/widgets/calligraphic-profile-rename.h b/src/widgets/calligraphic-profile-rename.h index f0e455c6c..53ce907ed 100755..100644 --- a/src/widgets/calligraphic-profile-rename.h +++ b/src/widgets/calligraphic-profile-rename.h @@ -1,12 +1,10 @@ -/** - * - * \brief Dialog for naming calligraphic profiles - * - * Author: +/** @file + * @brief Dialog for naming calligraphic profiles + */ +/* Author: * Aubanel MONNIER * - * Copyright (C) 2007 Aubanel MONNIER - * + * Copyright (C) 2007 Authors * Released under GNU GPL. Read the file 'COPYING' for more information */ @@ -20,38 +18,58 @@ struct SPDesktop; namespace Inkscape { - namespace UI { - namespace Dialogs { +namespace UI { +namespace Dialog { - class CalligraphicProfileDialog: public Gtk::Dialog { - public: - CalligraphicProfileDialog(); - virtual ~CalligraphicProfileDialog(){} ; - static void show(SPDesktop *desktop); - static bool applied(){return instance()._applied;} - static Glib::ustring getProfileName() { return instance()._profile_name;} - - Glib::ustring getName() const { return "CalligraphicProfileDialog"; } +class CalligraphicProfileRename : public Gtk::Dialog { +public: + CalligraphicProfileRename(); + virtual ~CalligraphicProfileRename() {} + Glib::ustring getName() const { + return "CalligraphicProfileRename"; + } + + static void show(SPDesktop *desktop); + static bool applied() { + return instance()._applied; + } + static Glib::ustring getProfileName() { + return instance()._profile_name; + } - - protected: - void _close(); - void _apply(); +protected: + void _close(); + void _apply(); - Gtk::Label _profile_name_label; - Gtk::Entry _profile_name_entry; - Gtk::Table _layout_table; - Gtk::Button _close_button; - Gtk::Button _apply_button; - Glib::ustring _profile_name; - bool _applied; - private: - static CalligraphicProfileDialog &instance(){static CalligraphicProfileDialog instance; return instance;} - CalligraphicProfileDialog(CalligraphicProfileDialog const &); // no copy - CalligraphicProfileDialog &operator=(CalligraphicProfileDialog const &); // no assign - }; + Gtk::Label _profile_name_label; + Gtk::Entry _profile_name_entry; + Gtk::Table _layout_table; + Gtk::Button _close_button; + Gtk::Button _apply_button; + Glib::ustring _profile_name; + bool _applied; +private: + static CalligraphicProfileRename &instance() { + static CalligraphicProfileRename instance_; + return instance_; } - } -} + CalligraphicProfileRename(CalligraphicProfileRename const &); // no copy + CalligraphicProfileRename &operator=(CalligraphicProfileRename const &); // no assign +}; + +} // namespace Dialog +} // namespace UI +} // namespace Inkscape #endif // INKSCAPE_DIALOG_CALLIGRAPHIC_PROFILE_H + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 3c78eb0bb..1fdf1fceb 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1700,7 +1700,7 @@ sp_desktop_widget_update_scrollbars (SPDesktopWidget *dtw, double scale) Geom::Point(2 * sp_document_width(doc), 2 * sp_document_height(doc)) ); SPObject* root = doc->root; SPItem* item = SP_ITEM(root); - boost::optional<Geom::Rect> deskarea = Geom::unify(darea, sp_item_bbox_desktop(item)); + Geom::OptRect deskarea = Geom::unify(darea, sp_item_bbox_desktop(item)); /* Canvas region we always show unconditionally */ Geom::Rect carea( Geom::Point(deskarea->min()[Geom::X] * scale - 64, deskarea->max()[Geom::Y] * -scale - 64), diff --git a/src/widgets/font-selector.cpp b/src/widgets/font-selector.cpp index 49a35b5cb..502c34790 100644 --- a/src/widgets/font-selector.cpp +++ b/src/widgets/font-selector.cpp @@ -671,7 +671,7 @@ static gint sp_font_preview_expose(GtkWidget *widget, GdkEventExpose *event) hpos[len] = base_pt[0]; len++; if ( curF ) { - boost::optional<Geom::Rect> nbbox = curF->BBox(str_text->glyph_text[i].gl); + Geom::OptRect nbbox = curF->BBox(str_text->glyph_text[i].gl); if (nbbox) { bbox.x0 = MIN(bbox.x0, base_pt[Geom::X] + theSize * (nbbox->min())[0]); bbox.y0 = MIN(bbox.y0, base_pt[Geom::Y] - theSize * (nbbox->max())[1]); diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index 4c0439da7..5aad614b4 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -662,7 +662,7 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, if (object && SP_IS_ITEM(object)) { /* Find bbox in document */ Geom::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object))); - boost::optional<Geom::Rect> dbox = SP_ITEM(object)->getBounds(i2doc); + Geom::OptRect dbox = SP_ITEM(object)->getBounds(i2doc); if ( SP_OBJECT_PARENT(object) == NULL ) { @@ -671,7 +671,7 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, } /* This is in document coordinates, i.e. pixels */ - if ( dbox && !dbox->isEmpty() ) { + if ( dbox ) { NRGC gc(NULL); /* Update to renderable state */ double sf = 1.0; diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index af1883916..e6929fcff 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -68,8 +68,8 @@ sp_selection_layout_widget_update(SPWidget *spw, Inkscape::Selection *sel) int prefs_bbox = prefs->getInt("/tools/bounding_box", 0); SPItem::BBoxType bbox_type = (prefs_bbox ==0)? SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX; - boost::optional<Geom::Rect> const bbox(sel->bounds(bbox_type)); - if ( bbox && !bbox->isEmpty() ) { + Geom::OptRect const bbox(sel->bounds(bbox_type)); + if ( bbox ) { UnitTracker *tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(G_OBJECT(spw), "tracker")); SPUnit const &unit = *tracker->getActiveUnit(); @@ -159,9 +159,9 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) int prefs_bbox = prefs->getInt("/tools/bounding_box"); SPItem::BBoxType bbox_type = (prefs_bbox ==0)? SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX; - boost::optional<Geom::Rect> bbox = selection->bounds(bbox_type); + Geom::OptRect bbox = selection->bounds(bbox_type); - if ( !bbox || bbox->isEmpty() ) { + if ( !bbox ) { g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(FALSE)); return; } diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index b945765db..ca6a72ca2 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -32,85 +32,74 @@ #include <gtk/gtk.h> #include <iostream> #include <sstream> - -#include "widgets/button.h" -#include "widgets/widget-sizes.h" -#include "widgets/spw-utilities.h" -#include "widgets/spinbutton-events.h" -#include "dialogs/text-edit.h" -#include "dialogs/dialog-events.h" - -#include "ui/widget/style-swatch.h" - -#include "verbs.h" -#include "sp-namedview.h" -#include "desktop.h" -#include "desktop-handles.h" -#include "xml/repr.h" -#include "xml/node-event-vector.h" -#include "xml/attribute-record.h" #include <glibmm/i18n.h> -#include "helper/unit-menu.h" -#include "helper/units.h" -#include "live_effects/effect.h" - -#include "inkscape.h" -#include "conn-avoid-ref.h" - -#include "select-toolbar.h" +#include "../box3d-context.h" +#include "../box3d.h" +#include "calligraphic-profile-rename.h" +#include "../conn-avoid-ref.h" +#include "../connection-pool.h" +#include "../connector-context.h" +#include "../desktop.h" +#include "../desktop-handles.h" +#include "../desktop-style.h" +#include "../dialogs/dialog-events.h" +#include "../dialogs/text-edit.h" +#include "../document-private.h" +#include "../ege-adjustment-action.h" +#include "../ege-output-action.h" +#include "../ege-select-one-action.h" +#include "../flood-context.h" #include "gradient-toolbar.h" - -#include "connector-context.h" -#include "node-context.h" -#include "pen-context.h" -#include "lpe-tool-context.h" -#include "live_effects/lpe-line_segment.h" -#include "shape-editor.h" -#include "tweak-context.h" -#include "sp-rect.h" -#include "box3d.h" -#include "box3d-context.h" -#include "sp-star.h" -#include "sp-spiral.h" -#include "sp-ellipse.h" -#include "sp-text.h" -#include "sp-flowtext.h" -#include "sp-clippath.h" -#include "sp-mask.h" -#include "style.h" -#include "tools-switch.h" -#include "selection.h" -#include "selection-chemistry.h" -#include "document-private.h" -#include "desktop-style.h" -#include "../libnrtype/font-lister.h" +#include "../graphlayout/graphlayout.h" +#include "../helper/unit-menu.h" +#include "../helper/units.h" +#include "../helper/unit-tracker.h" +#include "icon.h" +#include "../ink-action.h" +#include "../inkscape.h" +#include "../inkscape-stock.h" +#include "../interface.h" #include "../libnrtype/font-instance.h" -#include "../connection-pool.h" +#include "../libnrtype/font-lister.h" +#include "../live_effects/effect.h" +#include "../live_effects/lpe-angle_bisector.h" +#include "../live_effects/lpe-line_segment.h" +#include "../lpe-tool-context.h" +#include "../mod360.h" +#include "../node-context.h" +#include "../pen-context.h" #include "../preferences.h" -#include "../inkscape-stock.h" -#include "icon.h" -#include "graphlayout/graphlayout.h" -#include "interface.h" -#include "shortcuts.h" - -#include "mod360.h" +#include "../selection-chemistry.h" +#include "../selection.h" +#include "select-toolbar.h" +#include "../shape-editor.h" +#include "../shortcuts.h" +#include "../sp-clippath.h" +#include "../sp-ellipse.h" +#include "../sp-flowtext.h" +#include "../sp-mask.h" +#include "../sp-namedview.h" +#include "../sp-rect.h" +#include "../sp-spiral.h" +#include "../sp-star.h" +#include "../sp-text.h" +#include "../style.h" +#include "../svg/css-ostringstream.h" +#include "../tools-switch.h" +#include "../tweak-context.h" +#include "../ui/widget/style-swatch.h" +#include "../verbs.h" +#include "../widgets/button.h" +#include "../widgets/spinbutton-events.h" +#include "../widgets/spw-utilities.h" +#include "../widgets/widget-sizes.h" +#include "../xml/attribute-record.h" +#include "../xml/node-event-vector.h" +#include "../xml/repr.h" #include "toolbox.h" -#include "flood-context.h" - -#include "ink-action.h" -#include "ege-adjustment-action.h" -#include "ege-output-action.h" -#include "ege-select-one-action.h" -#include "helper/unit-tracker.h" -#include "live_effects/lpe-angle_bisector.h" - -#include "svg/css-ostringstream.h" - -#include "widgets/calligraphic-profile-rename.h" - using Inkscape::UnitTracker; typedef void (*SetupFunction)(GtkWidget *toolbox, SPDesktop *desktop); @@ -4106,6 +4095,7 @@ static void sp_dcc_build_presets_list(GObject *tbl) static void sp_dcc_save_profile (GtkWidget */*widget*/, GObject *tbl) { + using Inkscape::UI::Dialog::CalligraphicProfileRename; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); SPDesktop *desktop = (SPDesktop *) g_object_get_data(tbl, "desktop" ); if (! desktop) return; @@ -4113,13 +4103,13 @@ static void sp_dcc_save_profile (GtkWidget */*widget*/, GObject *tbl) if (g_object_get_data(tbl, "presets_blocked")) return; - Inkscape::UI::Dialogs::CalligraphicProfileDialog::show(desktop); - if ( ! Inkscape::UI::Dialogs::CalligraphicProfileDialog::applied()) { + CalligraphicProfileRename::show(desktop); + if ( !CalligraphicProfileRename::applied()) { // dialog cancelled update_presets_list (tbl); return; } - Glib::ustring profile_name = Inkscape::UI::Dialogs::CalligraphicProfileDialog::getProfileName(); + Glib::ustring profile_name = CalligraphicProfileRename::getProfileName(); if (profile_name.empty()) { // empty name entered @@ -5007,7 +4997,7 @@ lpetool_toggle_set_bbox (GtkToggleAction *act, gpointer data) { SPDesktop *desktop = static_cast<SPDesktop *>(data); Inkscape::Selection *selection = desktop->selection; - boost::optional<Geom::Rect> bbox = selection->bounds(); + Geom::OptRect bbox = selection->bounds(); if (bbox) { Geom::Point A(bbox->min()); |
