summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Spike <aaron@ekips.org>2006-04-25 03:05:00 +0000
committeracspike <acspike@users.sourceforge.net>2006-04-25 03:05:00 +0000
commit427d9bd94dfb7df192e5668c6a2d51306e11b468 (patch)
tree791fd4b0fd395bfc47bb724c7d3e2b790aba6a31 /src
parentslant the unlocked lock; SVG optimizations for smaller size (diff)
downloadinkscape-427d9bd94dfb7df192e5668c6a2d51306e11b468.tar.gz
inkscape-427d9bd94dfb7df192e5668c6a2d51306e11b468.zip
Move fit canvas button into PageSizer
(bzr r585)
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/document-properties.cpp26
-rw-r--r--src/ui/widget/page-sizer.cpp29
-rw-r--r--src/ui/widget/page-sizer.h1
3 files changed, 29 insertions, 27 deletions
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 25f8e8af0..c837c7193 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -23,7 +23,6 @@
#include <gtkmm.h>
#include "ui/widget/color-picker.h"
#include "ui/widget/scalar-unit.h"
-#include "ui/widget/button.h"
#include "xml/node-event-vector.h"
#include "helper/units.h"
@@ -34,7 +33,6 @@
#include "desktop-handles.h"
#include "desktop.h"
#include "sp-namedview.h"
-#include "helper/action.h"
#include "document-properties.h"
@@ -58,8 +56,6 @@ static void on_doc_replaced (SPDesktop* dt, SPDocument* doc);
static void on_activate_desktop (Inkscape::Application *, SPDesktop* dt, void*);
static void on_deactivate_desktop (Inkscape::Application *, SPDesktop* dt, void*);
-static void fire_fit_canvas_to_selection_or_drawing();
-
static Inkscape::XML::NodeEventVector const _repr_events = {
NULL, /* child_added */
NULL, /* child_removed */
@@ -196,14 +192,6 @@ DocumentProperties::build_page()
_rcb_shad.init (_("_Show border shadow"), _("If set, page border shows a shadow on its right and lower side"), "inkscape:showpageshadow", _wr, false);
_rum_deflt.init (_("Default _units:"), "inkscape:document-units", _wr);
- Inkscape::UI::Widget::Button* fit_canv = manage(new Inkscape::UI::Widget::Button(_("Fit canvas to selection"),
- _("Resize the canvas to fit the current selection, or the entire drawing if there is no selection")));
- fit_canv->signal_clicked().connect(sigc::ptr_fun(fire_fit_canvas_to_selection_or_drawing));
-
- // prevent fit_canv from expanding
- Gtk::Alignment *fit_canv_cont = manage(new Gtk::Alignment(1.0,0.5,0.0,0.0));
- fit_canv_cont->add(*fit_canv);
-
Gtk::Label* label_gen = manage (new Gtk::Label);
label_gen->set_markup (_("<b>General</b>"));
Gtk::Label* label_bor = manage (new Gtk::Label);
@@ -220,7 +208,6 @@ DocumentProperties::build_page()
0, 0,
label_for, 0,
0, &_page_sizer,
- 0, fit_canv_cont,
0, 0,
label_bor, 0,
0, _rcb_canb._button,
@@ -505,19 +492,6 @@ on_doc_replaced (SPDesktop* dt, SPDocument* doc)
_instance->update();
}
-static void
-fire_fit_canvas_to_selection_or_drawing() {
- SPDesktop *dt = SP_ACTIVE_DESKTOP;
- if (!dt) return;
- Verb *verb = Verb::get( SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING );
- if (verb) {
- SPAction *action = verb->get_action(dt);
- if (action) {
- sp_action_perform(action, NULL);
- }
- }
-}
-
} // namespace Dialog
} // namespace UI
diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp
index 31390b676..1f3749bda 100644
--- a/src/ui/widget/page-sizer.cpp
+++ b/src/ui/widget/page-sizer.cpp
@@ -18,17 +18,22 @@
#endif
#include <cmath>
+#include <gtkmm.h>
#include <gtkmm/optionmenu.h>
#include <gtkmm/frame.h>
#include <gtkmm/table.h>
+#include "ui/widget/button.h"
#include "ui/widget/scalar-unit.h"
#include "helper/units.h"
#include "inkscape.h"
+#include "verbs.h"
#include "desktop-handles.h"
#include "document.h"
+#include "desktop.h"
#include "page-sizer.h"
+#include "helper/action.h"
using std::pair;
@@ -233,10 +238,17 @@ PageSizer::init (Registry& reg)
/* Custom paper frame */
Gtk::Frame *frame = manage (new Gtk::Frame(_("Custom size")));
pack_start (*frame, false, false, 0);
- Gtk::Table *table = manage (new Gtk::Table (4, 2, false));
+ Gtk::Table *table = manage (new Gtk::Table (5, 2, false));
table->set_border_width (4);
table->set_row_spacings (4);
table->set_col_spacings (4);
+
+ Inkscape::UI::Widget::Button* fit_canv = manage(new Inkscape::UI::Widget::Button(_("Fit page to selection"),
+ _("Resize the page to fit the current selection, or the entire drawing if there is no selection")));
+ // prevent fit_canv from expanding
+ Gtk::Alignment *fit_canv_cont = manage(new Gtk::Alignment(1.0,0.5,0.0,0.0));
+ fit_canv_cont->add(*fit_canv);
+
frame->add (*table);
_wr = &reg;
@@ -249,11 +261,13 @@ PageSizer::init (Registry& reg)
table->attach (*_rum._sel, 1,2,0,1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0);
table->attach (*_rusw.getSU(), 0,2,1,2, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0);
table->attach (*_rush.getSU(), 0,2,2,3, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0);
+ table->attach (*fit_canv_cont, 0,2,3,4, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0);
_landscape_connection = _rb_land->signal_toggled().connect (sigc::mem_fun (*this, &PageSizer::on_landscape));
_portrait_connection = _rb_port->signal_toggled().connect (sigc::mem_fun (*this, &PageSizer::on_portrait));
_changedw_connection = _rusw.getSU()->signal_value_changed().connect (sigc::mem_fun (*this, &PageSizer::on_value_changed));
_changedh_connection = _rush.getSU()->signal_value_changed().connect (sigc::mem_fun (*this, &PageSizer::on_value_changed));
+ fit_canv->signal_clicked().connect(sigc::mem_fun(*this, &PageSizer::fire_fit_canvas_to_selection_or_drawing));
show_all_children();
}
@@ -320,6 +334,19 @@ PageSizer::find_paper_size (double w, double h) const
}
void
+PageSizer::fire_fit_canvas_to_selection_or_drawing() {
+ SPDesktop *dt = SP_ACTIVE_DESKTOP;
+ if (!dt) return;
+ Verb *verb = Verb::get( SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING );
+ if (verb) {
+ SPAction *action = verb->get_action(dt);
+ if (action) {
+ sp_action_perform(action, NULL);
+ }
+ }
+}
+
+void
PageSizer::on_portrait()
{
double w = _rusw.getSU()->getValue ("px");
diff --git a/src/ui/widget/page-sizer.h b/src/ui/widget/page-sizer.h
index e17628c76..d0fdeb8cc 100644
--- a/src/ui/widget/page-sizer.h
+++ b/src/ui/widget/page-sizer.h
@@ -38,6 +38,7 @@ public:
protected:
void setDoc (double w, double h);
int find_paper_size (double w, double h) const;
+ void fire_fit_canvas_to_selection_or_drawing();
void on_portrait();
void on_landscape();
void on_value_changed();