summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-01-15 23:43:23 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-01-15 23:43:23 +0000
commitb32949eaefba1f07e3898efe060b21a6377b6741 (patch)
tree21e97f39886b62bcc5fa2a284a61640cfdfb62a6 /src/ui
parentSlightly more 'object-oriented' way to invoke item-specific conversion-to-gui... (diff)
downloadinkscape-b32949eaefba1f07e3898efe060b21a6377b6741.tar.gz
inkscape-b32949eaefba1f07e3898efe060b21a6377b6741.zip
RegisteredCheckbutton is now subclassed from RegisteredWidget<CheckButton>
(bzr r4500)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/document-properties.cpp162
-rw-r--r--src/ui/dialog/document-properties.h16
-rw-r--r--src/ui/widget/registered-widget.cpp70
-rw-r--r--src/ui/widget/registered-widget.h46
4 files changed, 134 insertions, 160 deletions
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index c8f9bde7c..1a1ba3689 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -9,7 +9,7 @@
* Jon Phillips <jon@rejon.org>
* Ralf Stephan <ralf@ark.in-berlin.de> (Gtkmm)
*
- * Copyright (C) 2006-2007 Johan Engelen <johan@shouraizou.nl>
+ * Copyright (C) 2006-2008 Johan Engelen <johan@shouraizou.nl>
* Copyright (C) 2000 - 2005 Authors
*
* Released under GNU GPL. Read the file 'COPYING' for more information
@@ -185,14 +185,24 @@ DocumentProperties::build_page()
{
_page_page.show();
- _rcp_bg.init (_("Back_ground:"), _("Background color"), _("Color and transparency of the page background (also used for bitmap export)"),
+ _rcp_bg.init(
+ _("Back_ground:"),
+ _("Background color"),
+ _("Color and transparency of the page background (also used for bitmap export)"),
"pagecolor", "inkscape:pageopacity", _wr);
- _rcb_canb.init (_("Show page _border"), _("If set, rectangular page border is shown"), "showborder", _wr, false);
- _rcb_bord.init (_("Border on _top of drawing"), _("If set, border is always on top of the drawing"), "borderlayer", _wr, false);
+ _rcb_canb = Gtk::manage( new RegisteredCheckButton(
+ _("Show page _border"),
+ _("If set, rectangular page border is shown"), "showborder", _wr, false) );
+ _rcb_bord = Gtk::manage( new RegisteredCheckButton(
+ _("Border on _top of drawing"),
+ _("If set, border is always on top of the drawing"), "borderlayer", _wr, false) );
_rcp_bord.init (_("Border _color:"), _("Page border color"),
_("Color of the page border"),
"bordercolor", "borderopacity", _wr);
- _rcb_shad.init (_("_Show border shadow"), _("If set, page border shows a shadow on its right and lower side"), "inkscape:showpageshadow", _wr, false);
+ _rcb_shad = Gtk::manage( new RegisteredCheckButton(
+ _("_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);
Gtk::Label* label_gen = manage (new Gtk::Label);
@@ -213,9 +223,9 @@ DocumentProperties::build_page()
0, &_page_sizer,
0, 0,
label_bor, 0,
- 0, _rcb_canb._button,
- 0, _rcb_bord._button,
- 0, _rcb_shad._button,
+ 0, _rcb_canb,
+ 0, _rcb_bord,
+ 0, _rcb_shad,
_rcp_bord._label, _rcp_bord._cp,
};
@@ -227,27 +237,29 @@ DocumentProperties::build_guides()
{
_page_guides.show();
- _rcb_sgui.init (_("Show _guides"), _("Show or hide guides"), "showguides", _wr);
+ _rcb_sgui = Gtk::manage( new RegisteredCheckButton(
+ _("Show _guides"), _("Show or hide guides"), "showguides", _wr) );
_rcp_gui.init (_("Guide co_lor:"), _("Guideline color"),
_("Color of guidelines"), "guidecolor", "guideopacity", _wr);
_rcp_hgui.init (_("_Highlight color:"), _("Highlighted guideline color"),
_("Color of a guideline when it is under mouse"),
"guidehicolor", "guidehiopacity", _wr);
-
- _rcbsng.init (_("_Snap guides while dragging"),
+
+ _rcbsng = Gtk::manage( new RegisteredCheckButton(
+ _("_Snap guides while dragging"),
_("While dragging a guide, snap to object nodes or bounding box corners ('Snap to nodes' or 'snap to bounding box corners' must be enabled in the 'Snap' tab; only a small part of the guide near the cursor will snap)"),
- "inkscape:snap-guide", _wr);
-
+ "inkscape:snap-guide", _wr) );
+
Gtk::Label *label_gui = manage (new Gtk::Label);
label_gui->set_markup (_("<b>Guides</b>"));
Gtk::Widget *const widget_array[] =
{
label_gui, 0,
- 0, _rcb_sgui._button,
+ 0, _rcb_sgui,
_rcp_gui._label, _rcp_gui._cp,
_rcp_hgui._label, _rcp_hgui._cp,
- 0, _rcbsng._button,
+ 0, _rcbsng,
};
attach_all(_page_guides.table(), widget_array, G_N_ELEMENTS(widget_array));
@@ -257,30 +269,30 @@ void
DocumentProperties::build_snap()
{
_page_snap.show();
- //General options
- _rcbsg.init (_("_Enable snapping"),
+ //General options
+ _rcbsg = Gtk::manage( new RegisteredCheckButton( _("_Enable snapping"),
_("Toggle snapping on or off"),
- "inkscape:snap-global", _wr);
- _rcbsnbb.init (_("_Bounding box corners"),
+ "inkscape:snap-global", _wr) );
+ _rcbsnbb = Gtk::manage( new RegisteredCheckButton( _("_Bounding box corners"),
_("Only available in the selector tool: snap bounding box corners to guides, to grids, and to other bounding boxes (but not to nodes or paths)"),
- "inkscape:snap-bbox", _wr);
- _rcbsnn.init (_("_Nodes"),
+ "inkscape:snap-bbox", _wr) );
+ _rcbsnn = Gtk::manage( new RegisteredCheckButton( _("_Nodes"),
_("Snap nodes (e.g. path nodes, special points in shapes, gradient handles, text base points, transformation origins, etc.) to guides, to grids, to paths and to other nodes"),
- "inkscape:snap-nodes", _wr);
+ "inkscape:snap-nodes", _wr) );
//Options for snapping to objects
- _rcbsnop.init (_("Snap to path_s"),
+ _rcbsnop = Gtk::manage( new RegisteredCheckButton( _("Snap to path_s"),
_("Snap nodes to object paths"),
- "inkscape:object-paths", _wr);
- _rcbsnon.init (_("Snap to n_odes"),
+ "inkscape:object-paths", _wr) );
+ _rcbsnon = Gtk::manage( new RegisteredCheckButton( _("Snap to n_odes"),
_("Snap nodes and guides to object nodes"),
- "inkscape:object-nodes", _wr);
- _rcbsnbbn.init (_("Snap to bounding box co_rners"),
+ "inkscape:object-nodes", _wr) );
+ _rcbsnbbn = Gtk::manage( new RegisteredCheckButton( _("Snap to bounding box co_rners"),
_("Snap bounding box corners to other bounding box corners"),
- "inkscape:bbox-nodes", _wr);
- _rcbsnbbp.init (_("Snap to bounding bo_x edges"),
+ "inkscape:bbox-nodes", _wr) );
+ _rcbsnbbp = Gtk::manage( new RegisteredCheckButton( _("Snap to bounding bo_x edges"),
_("Snap bounding box corners and guides to bounding box edges"),
- "inkscape:bbox-paths", _wr);
+ "inkscape:bbox-paths", _wr) );
_rsu_sno.init (_("Snap _distance"), _("Snap only when _closer than:"),
_("Snapping distance, in screen pixels, for snapping to objects"),
@@ -302,20 +314,20 @@ DocumentProperties::build_snap()
//Other options to locate here: e.g. visual snapping indicators on/off
std::list<Gtk::ToggleButton*> slaves;
- slaves.push_back(_rcbsnop._button);
- slaves.push_back(_rcbsnon._button);
- _rcbsnn.setSlaveButton(slaves);
+ slaves.push_back(_rcbsnop);
+ slaves.push_back(_rcbsnon);
+ _rcbsnn->setSlaveButton(slaves);
slaves.clear();
- slaves.push_back(_rcbsnbbp._button);
- slaves.push_back(_rcbsnbbn._button);
- _rcbsnbb.setSlaveButton(slaves);
+ slaves.push_back(_rcbsnbbp);
+ slaves.push_back(_rcbsnbbn);
+ _rcbsnbb->setSlaveButton(slaves);
slaves.clear();
- slaves.push_back(_rcbsnn._button);
- slaves.push_back(_rcbsnbb._button);
+ slaves.push_back(_rcbsnn);
+ slaves.push_back(_rcbsnbb);
- _rcbsg.setSlaveButton(slaves);
+ _rcbsg->setSlaveButton(slaves);
Gtk::Label *label_g = manage (new Gtk::Label);
label_g->set_markup (_("<b>Snapping</b>"));
@@ -331,17 +343,17 @@ DocumentProperties::build_snap()
Gtk::Widget *const array[] =
{
label_g, 0,
- 0, _rcbsg._button,
+ 0, _rcbsg,
0, 0,
label_w, 0,
- 0, _rcbsnn._button,
- 0, _rcbsnbb._button,
+ 0, _rcbsnn,
+ 0, _rcbsnbb,
0, 0,
label_o, 0,
- 0, _rcbsnop._button,
- 0, _rcbsnon._button,
- 0, _rcbsnbbp._button,
- 0, _rcbsnbbn._button,
+ 0, _rcbsnop,
+ 0, _rcbsnon,
+ 0, _rcbsnbbp,
+ 0, _rcbsnbbn,
0, _rsu_sno._vbox,
0, 0,
label_gr, 0,
@@ -358,19 +370,19 @@ void
DocumentProperties::build_snap_dtls()
{
_page_snap_dtls.show();
-
- _rcbsigg.init (_("_Grid with guides"),
+
+ _rcbsigg = Gtk::manage( new RegisteredCheckButton( _("_Grid with guides"),
_("Snap to grid-guide intersections"),
- "inkscape:snap-intersection-grid-guide", _wr);
-
- _rcbsils.init (_("_Line segments"),
+ "inkscape:snap-intersection-grid-guide", _wr) );
+
+ _rcbsils = Gtk::manage( new RegisteredCheckButton( _("_Line segments"),
_("Snap to intersections of line segments ('snap to paths' must be enabled, see the previous tab)"),
- "inkscape:snap-intersection-line-segments", _wr);
+ "inkscape:snap-intersection-line-segments", _wr) );
//Applies to both nodes and guides, but not to bboxes, that's why its located here
- _rcbic.init (_("Rotation _center"),
+ _rcbic = Gtk::manage( new RegisteredCheckButton( _("Rotation _center"),
_("Consider the rotation center of an object when snapping"),
- "inkscape:snap-center", _wr);
+ "inkscape:snap-center", _wr) );
//Other options to locate here: e.g. visual snapping indicators on/off
@@ -382,11 +394,11 @@ DocumentProperties::build_snap_dtls()
Gtk::Widget *const array[] =
{
label_i, 0,
- 0, _rcbsigg._button,
- 0, _rcbsils._button,
+ 0, _rcbsigg,
+ 0, _rcbsils,
0, 0,
label_m, 0,
- 0, _rcbic._button,
+ 0, _rcbic,
};
attach_all(_page_snap_dtls.table(), array, G_N_ELEMENTS(array));
@@ -402,8 +414,8 @@ DocumentProperties::update_gridspage()
SPNamedView *nv = sp_desktop_namedview(dt);
//remove all tabs
- while (_grids_notebook.get_current_page() != -1) {
- _grids_notebook.remove_page(-1);
+ while (_grids_notebook.get_n_pages() != 0) {
+ _grids_notebook.remove_page(-1); // this also deletes the page.
}
//add tabs
@@ -423,7 +435,7 @@ DocumentProperties::update_gridspage()
default:
break;
}
- _grids_notebook.append_page(grid->getWidget(), _createPageTabLabel(name, icon));
+ _grids_notebook.append_page(*grid->newWidget(), _createPageTabLabel(name, icon));
grids_present = true;
}
_grids_notebook.show_all();
@@ -488,10 +500,10 @@ DocumentProperties::update()
//-----------------------------------------------------------page page
_rcp_bg.setRgba32 (nv->pagecolor);
- _rcb_canb.setActive (nv->showborder);
- _rcb_bord.setActive (nv->borderlayer == SP_BORDER_LAYER_TOP);
+ _rcb_canb->setActive (nv->showborder);
+ _rcb_bord->setActive (nv->borderlayer == SP_BORDER_LAYER_TOP);
_rcp_bord.setRgba32 (nv->bordercolor);
- _rcb_shad.setActive (nv->showpageshadow);
+ _rcb_shad->setActive (nv->showpageshadow);
if (nv->doc_units)
_rum_deflt.setUnit (nv->doc_units);
@@ -501,29 +513,29 @@ DocumentProperties::update()
_page_sizer.setDim (doc_w_px, doc_h_px);
//-----------------------------------------------------------guide
- _rcb_sgui.setActive (nv->showguides);
+ _rcb_sgui->setActive (nv->showguides);
_rcp_gui.setRgba32 (nv->guidecolor);
_rcp_hgui.setRgba32 (nv->guidehicolor);
//-----------------------------------------------------------snap
- _rcbsnbb.setActive (nv->snap_manager.getSnapModeBBox());
- _rcbsnn.setActive (nv->snap_manager.getSnapModeNode());
- _rcbsng.setActive (nv->snap_manager.getSnapModeGuide());
- _rcbic.setActive (nv->snap_manager.getIncludeItemCenter());
- _rcbsigg.setActive (nv->snap_manager.getSnapIntersectionGG());
- _rcbsils.setActive (nv->snap_manager.getSnapIntersectionLS());
- _rcbsnop.setActive(nv->snap_manager.object.getSnapToItemPath());
- _rcbsnon.setActive(nv->snap_manager.object.getSnapToItemNode());
- _rcbsnbbp.setActive(nv->snap_manager.object.getSnapToBBoxPath());
- _rcbsnbbn.setActive(nv->snap_manager.object.getSnapToBBoxNode());
+ _rcbsnbb->setActive (nv->snap_manager.getSnapModeBBox());
+ _rcbsnn->setActive (nv->snap_manager.getSnapModeNode());
+ _rcbsng->setActive (nv->snap_manager.getSnapModeGuide());
+ _rcbic->setActive (nv->snap_manager.getIncludeItemCenter());
+ _rcbsigg->setActive (nv->snap_manager.getSnapIntersectionGG());
+ _rcbsils->setActive (nv->snap_manager.getSnapIntersectionLS());
+ _rcbsnop->setActive(nv->snap_manager.object.getSnapToItemPath());
+ _rcbsnon->setActive(nv->snap_manager.object.getSnapToItemNode());
+ _rcbsnbbp->setActive(nv->snap_manager.object.getSnapToBBoxPath());
+ _rcbsnbbn->setActive(nv->snap_manager.object.getSnapToBBoxNode());
_rsu_sno.setValue (nv->objecttolerance);
_rsu_sn.setValue (nv->gridtolerance);
_rsu_gusn.setValue (nv->guidetolerance);
- _rcbsg.setActive (nv->snap_manager.getSnapEnabledGlobally());
+ _rcbsg->setActive (nv->snap_manager.getSnapEnabledGlobally());
//-----------------------------------------------------------grids page
diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h
index cee1533c5..b23fbef9b 100644
--- a/src/ui/dialog/document-properties.h
+++ b/src/ui/dialog/document-properties.h
@@ -5,7 +5,7 @@
* Ralf Stephan <ralf@ark.in-berlin.de>
* Bryce W. Harrington <bryce@bryceharrington.org>
*
- * Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
+ * Copyright (C) 2006-2008 Johan Engelen <johan@shouraizou.nl>
* Copyright (C) 2004, 2005 Authors
*
* Released under GNU GPL. Read the file 'COPYING' for more information.
@@ -65,26 +65,26 @@ protected:
Gtk::VBox _grids_vbox;
//---------------------------------------------------------------
- RegisteredCheckButton _rcb_canb, _rcb_bord, _rcb_shad;
+ RegisteredCheckButton *_rcb_canb, *_rcb_bord, *_rcb_shad;
RegisteredColorPicker _rcp_bg, _rcp_bord;
RegisteredUnitMenu _rum_deflt;
PageSizer _page_sizer;
//---------------------------------------------------------------
- RegisteredCheckButton _rcbgrid;
+ RegisteredCheckButton *_rcbgrid;
RegisteredUnitMenu _rums;
//---------------------------------------------------------------
- RegisteredCheckButton _rcb_sgui, _rcbsng;
+ RegisteredCheckButton *_rcb_sgui, *_rcbsng;
RegisteredUnitMenu _rum_gusn;
RegisteredColorPicker _rcp_gui, _rcp_hgui;
//---------------------------------------------------------------
- RegisteredCheckButton _rcbsg, _rcbsnbb, _rcbsnn, _rcbsnop;
- RegisteredCheckButton _rcbsnon, _rcbsnbbp, _rcbsnbbn;
+ RegisteredCheckButton *_rcbsg, *_rcbsnbb, *_rcbsnn, *_rcbsnop;
+ RegisteredCheckButton *_rcbsnon, *_rcbsnbbp, *_rcbsnbbn;
RegisteredUnitMenu _rumso;
ToleranceSlider _rsu_sno, _rsu_sn, _rsu_gusn;
RegisteredRadioButtonPair _rrb_pix;
//---------------------------------------------------------------
- RegisteredCheckButton _rcbic;
- RegisteredCheckButton _rcbsigg, _rcbsils;
+ RegisteredCheckButton *_rcbic;
+ RegisteredCheckButton *_rcbsigg, *_rcbsils;
//---------------------------------------------------------------
Gtk::Notebook _grids_notebook;
Gtk::HBox _grids_hbox_crea;
diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp
index a54c89292..e582a117f 100644
--- a/src/ui/widget/registered-widget.cpp
+++ b/src/ui/widget/registered-widget.cpp
@@ -107,37 +107,31 @@ RegisteredWdg::write_to_xml(const char * svgstr)
//====================================================
-RegisteredCheckButton::RegisteredCheckButton()
-: _button(0),
- setProgrammatically(false)
-{
-}
-
RegisteredCheckButton::~RegisteredCheckButton()
{
_toggled_connection.disconnect();
- if (_button) delete _button;
}
-void
-RegisteredCheckButton::init (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, SPDocument *doc_in)
+RegisteredCheckButton::RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, SPDocument *doc_in)
+ : RegisteredWidget<Gtk::CheckButton>()
{
init_parent(key, wr, repr_in, doc_in);
- _button = new Gtk::CheckButton;
- _tt.set_tip (*_button, tip);
+ setProgrammatically = false;
+
+ _tt.set_tip (*this, tip);
Gtk::Label *l = new Gtk::Label (label);
l->set_use_underline (true);
- _button->add (*manage (l));
- _button->set_alignment (right? 1.0 : 0.0, 0.5);
- _toggled_connection = _button->signal_toggled().connect (sigc::mem_fun (*this, &RegisteredCheckButton::on_toggled));
+ add (*manage (l));
+ set_alignment (right? 1.0 : 0.0, 0.5);
+ _toggled_connection = signal_toggled().connect (sigc::mem_fun (*this, &RegisteredCheckButton::on_toggled));
}
void
RegisteredCheckButton::setActive (bool b)
{
setProgrammatically = true;
- _button->set_active (b);
+ set_active (b);
//The slave button is greyed out if the master button is unchecked
for (std::list<Gtk::ToggleButton*>::const_iterator i = _slavebuttons.begin(); i != _slavebuttons.end(); i++) {
(*i)->set_sensitive(b);
@@ -157,10 +151,10 @@ RegisteredCheckButton::on_toggled()
return;
_wr->setUpdating (true);
- write_to_xml(_button->get_active() ? "true" : "false");
+ write_to_xml(get_active() ? "true" : "false");
//The slave button is greyed out if the master button is unchecked
for (std::list<Gtk::ToggleButton*>::const_iterator i = _slavebuttons.begin(); i != _slavebuttons.end(); i++) {
- (*i)->set_sensitive(_button->get_active());
+ (*i)->set_sensitive(get_active());
}
_wr->setUpdating (false);
@@ -546,53 +540,31 @@ RegisteredRadioButtonPair::on_value_changed()
* Registered POINT
*/
-RegisteredPoint::RegisteredPoint()
-{
- _widget = NULL;
-}
-
RegisteredPoint::~RegisteredPoint()
{
- if (_widget)
- delete _widget;
-
_value_x_changed_connection.disconnect();
_value_y_changed_connection.disconnect();
}
-void
-RegisteredPoint::init ( const Glib::ustring& label, const Glib::ustring& tip,
+RegisteredPoint::RegisteredPoint ( const Glib::ustring& label, const Glib::ustring& tip,
const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in,
SPDocument* doc_in )
+ : RegisteredWidget<Point> (label, tip)
{
init_parent(key, wr, repr_in, doc_in);
- _widget = new Point (label, tip);
- _widget->setRange (-1e6, 1e6);
- _widget->setDigits (2);
- _widget->setIncrements(0.1, 1.0);
- _value_x_changed_connection = _widget->signal_x_value_changed().connect (sigc::mem_fun (*this, &RegisteredPoint::on_value_changed));
- _value_y_changed_connection = _widget->signal_y_value_changed().connect (sigc::mem_fun (*this, &RegisteredPoint::on_value_changed));
-}
-
-Point*
-RegisteredPoint::getPoint()
-{
- return _widget;
-}
-
-void
-RegisteredPoint::setValue (double xval, double yval)
-{
- if (_widget)
- _widget->setValue(xval, yval);
+ setRange (-1e6, 1e6);
+ setDigits (2);
+ setIncrements(0.1, 1.0);
+ _value_x_changed_connection = signal_x_value_changed().connect (sigc::mem_fun (*this, &RegisteredPoint::on_value_changed));
+ _value_y_changed_connection = signal_y_value_changed().connect (sigc::mem_fun (*this, &RegisteredPoint::on_value_changed));
}
void
RegisteredPoint::on_value_changed()
{
- if (_widget->setProgrammatically()) {
- _widget->clearProgrammatically();
+ if (setProgrammatically()) {
+ clearProgrammatically();
return;
}
@@ -602,7 +574,7 @@ RegisteredPoint::on_value_changed()
_wr->setUpdating (true);
Inkscape::SVGOStringStream os;
- os << _widget->getXValue() << "," << _widget->getYValue();
+ os << getXValue() << "," << getYValue();
write_to_xml(os.str().c_str());
diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h
index 1a5501427..7c643715f 100644
--- a/src/ui/widget/registered-widget.h
+++ b/src/ui/widget/registered-widget.h
@@ -3,8 +3,9 @@
*
* Authors:
* Ralf Stephan <ralf@ark.in-berlin.de>
+ * Johan Engelen <j.b.c.engelen@utwente.nl>
*
- * Copyright (C) 2005 Authors
+ * Copyright (C) 2005-2008 Authors
*
* Released under GNU GPL. Read the file 'COPYING' for more information.
*/
@@ -15,10 +16,12 @@
#include <gtkmm/box.h>
#include <gtkmm/adjustment.h>
#include <gtkmm/tooltips.h>
+#include <gtkmm/togglebutton.h>
#include "xml/node.h"
#include "registry.h"
+#include "ui/widget/point.h"
#include "ui/widget/random.h"
class SPUnit;
@@ -28,7 +31,6 @@ namespace Gtk {
class HScale;
class RadioButton;
class SpinButton;
- class ToggleButton;
}
namespace Inkscape {
@@ -40,7 +42,6 @@ class Registry;
class Scalar;
class ScalarUnit;
class UnitMenu;
-class Point;
template <class W>
class RegisteredWidget : public W {
@@ -137,24 +138,23 @@ protected:
//#######################################################
-class RegisteredCheckButton : public RegisteredWdg {
+class RegisteredCheckButton : public RegisteredWidget<Gtk::CheckButton> {
public:
- RegisteredCheckButton();
- ~RegisteredCheckButton();
- void init (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL);
+ virtual ~RegisteredCheckButton();
+ RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL);
+
void setActive (bool);
- Gtk::ToggleButton *_button;
std::list<Gtk::ToggleButton*> _slavebuttons;
// a slave button is only sensitive when the master button is active
// i.e. a slave button is greyed-out when the master button is not checked
void setSlaveButton(std::list<Gtk::ToggleButton*> btns) {
- _slavebuttons = btns;
+ _slavebuttons = btns;
}
- bool setProgrammatically; // true if the value was set by setValue, not changed by the user;
+ bool setProgrammatically; // true if the value was set by setActive, not changed by the user;
// if a callback checks it, it must reset it back to false
@@ -336,27 +336,17 @@ protected:
void on_value_changed();
};
-class RegisteredPoint : public RegisteredWdg {
+class RegisteredPoint : public RegisteredWidget<Point> {
public:
- RegisteredPoint();
- ~RegisteredPoint();
- void init (const Glib::ustring& label,
- const Glib::ustring& tip,
- const Glib::ustring& key,
- Registry& wr,
- Inkscape::XML::Node* repr_in,
- SPDocument *doc_in);
- inline void init ( const Glib::ustring& label,
- const Glib::ustring& tip,
- const Glib::ustring& key,
- Registry& wr)
- { init(label, tip, key, wr, NULL, NULL); };
-
- Point* getPoint();
- void setValue (double xval, double yval);
+ virtual ~RegisteredPoint();
+ RegisteredPoint ( const Glib::ustring& label,
+ const Glib::ustring& tip,
+ const Glib::ustring& key,
+ Registry& wr,
+ Inkscape::XML::Node* repr_in = NULL,
+ SPDocument *doc_in = NULL );
protected:
- Point *_widget;
sigc::connection _value_x_changed_connection;
sigc::connection _value_y_changed_connection;
void on_value_changed();