diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2011-10-27 04:55:51 +0000 |
|---|---|---|
| committer | Jon A. Cruz <jon@joncruz.org> | 2011-10-27 04:55:51 +0000 |
| commit | 2633767789e4264b13ef91a684accf734fb4e94f (patch) | |
| tree | 0f6bc8d758b8e4bcf01d2dd393166907906c156e /src/ui | |
| parent | Cleanup pass on documentation that was dumping garbage into doxygen output. (diff) | |
| download | inkscape-2633767789e4264b13ef91a684accf734fb4e94f.tar.gz inkscape-2633767789e4264b13ef91a684accf734fb4e94f.zip | |
Fixing more broken and split doc comments.
(bzr r10697)
Diffstat (limited to 'src/ui')
53 files changed, 673 insertions, 635 deletions
diff --git a/src/ui/dialog/desktop-tracker.cpp b/src/ui/dialog/desktop-tracker.cpp index 4eeac74b9..42447a141 100644 --- a/src/ui/dialog/desktop-tracker.cpp +++ b/src/ui/dialog/desktop-tracker.cpp @@ -1,7 +1,3 @@ -/** - * Glyph selector dialog. - */ - /* Authors: * Jon A. Cruz * diff --git a/src/ui/dialog/desktop-tracker.h b/src/ui/dialog/desktop-tracker.h index d73071194..da276fae4 100644 --- a/src/ui/dialog/desktop-tracker.h +++ b/src/ui/dialog/desktop-tracker.h @@ -1,7 +1,3 @@ -/** - * Glyph selector dialog. - */ - /* Authors: * Jon A. Cruz * diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index 78bb8c66a..49bdc0a30 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -1,6 +1,4 @@ -/** - * Find dialog. - * +/* * Authors: * Bryce W. Harrington <bryce@bryceharrington.org> * Johan Engelen <goejendaagh@zonnet.nl> diff --git a/src/ui/view/view-widget.cpp b/src/ui/view/view-widget.cpp index d43877569..7876928f7 100644 --- a/src/ui/view/view-widget.cpp +++ b/src/ui/view/view-widget.cpp @@ -1,6 +1,4 @@ -/** \file - * SPViewWidget implementation. - * +/* * Authors: * Lauris Kaplinski <lauris@kaplinski.com> * Ralf Stephan <ralf@ark.in-berlin.de> @@ -16,7 +14,7 @@ //using namespace Inkscape::UI::View; -/* SPViewWidget */ +// SPViewWidget static void sp_view_widget_class_init(SPViewWidgetClass *vwc); static void sp_view_widget_init(SPViewWidget *widget); @@ -24,9 +22,6 @@ static void sp_view_widget_destroy(GtkObject *object); static GtkEventBoxClass *widget_parent_class; -/** - * Registers the SPViewWidget class with Glib and returns its type number. - */ GType sp_view_widget_get_type(void) { static GType type = 0; @@ -89,10 +84,6 @@ static void sp_view_widget_destroy(GtkObject *object) Inkscape::GC::request_early_collection(); } -/** - * Connects widget to view's 'resized' signal and calls virtual set_view() - * function. - */ void sp_view_widget_set_view(SPViewWidget *vw, Inkscape::UI::View::View *view) { g_return_if_fail(vw != NULL); @@ -109,9 +100,6 @@ void sp_view_widget_set_view(SPViewWidget *vw, Inkscape::UI::View::View *view) } } -/** - * Calls the virtual shutdown() function of the SPViewWidget. - */ bool sp_view_widget_shutdown(SPViewWidget *vw) { g_return_val_if_fail(vw != NULL, TRUE); diff --git a/src/ui/view/view-widget.h b/src/ui/view/view-widget.h index 5143054d2..668f9d19a 100644 --- a/src/ui/view/view-widget.h +++ b/src/ui/view/view-widget.h @@ -33,15 +33,27 @@ class SPNamedView; #define SP_VIEW_WIDGET_VIEW(w) (SP_VIEW_WIDGET (w)->view) #define SP_VIEW_WIDGET_DOCUMENT(w) (SP_VIEW_WIDGET (w)->view ? ((SPViewWidget *) (w))->view->doc : NULL) -GType sp_view_widget_get_type (void); +/** + * Registers the SPViewWidget class with Glib and returns its type number. + */ +GType sp_view_widget_get_type(void); -void sp_view_widget_set_view (SPViewWidget *vw, Inkscape::UI::View::View *view); +/** + * Connects widget to view's 'resized' signal and calls virtual set_view() + * function. + */ +void sp_view_widget_set_view(SPViewWidget *vw, Inkscape::UI::View::View *view); -/// Allows presenting 'save changes' dialog, FALSE - continue, TRUE - cancel -bool sp_view_widget_shutdown (SPViewWidget *vw); +/** + * Allows presenting 'save changes' dialog, FALSE - continue, TRUE - cancel. + * Calls the virtual shutdown() function of the SPViewWidget. + */ +bool sp_view_widget_shutdown(SPViewWidget *vw); -/// Create a new SPViewWidget (which happens to be a SPDesktopWidget). -SPViewWidget *sp_desktop_widget_new (SPNamedView *namedview); +/** + * Create a new SPViewWidget (which happens to be a SPDesktopWidget). + */ +SPViewWidget *sp_desktop_widget_new(SPNamedView *namedview); /** * SPViewWidget is a GUI widget that contain a single View. It is also diff --git a/src/ui/view/view.cpp b/src/ui/view/view.cpp index dc6307ab0..e13976cc4 100644 --- a/src/ui/view/view.cpp +++ b/src/ui/view/view.cpp @@ -1,6 +1,4 @@ -/** \file - * View implementation - * +/* * Authors: * Lauris Kaplinski <lauris@kaplinski.com> * Ralf Stephan <ralf@ark.in-berlin.de> @@ -78,9 +76,6 @@ View::View() _message_changed_connection = _message_stack->connectChanged (sigc::bind (sigc::ptr_fun (&_onStatusMessage), this)); } -/** - * Deletes and nulls all View message stacks and disconnects it from signals. - */ View::~View() { _close(); @@ -127,15 +122,6 @@ void View::requestRedraw() _redraw_requested_signal.emit(); } -/** - * Disconnects the view from the document signals, connects the view - * to a new one, and emits the _document_set_signal on the view. - * - * This is code comon to all subclasses and called from their - * setDocument() methods after they are done. - * - * \param doc The new document to connect the view to. - */ void View::setDocument(SPDocument *doc) { g_return_if_fail(doc != NULL); diff --git a/src/ui/view/view.h b/src/ui/view/view.h index 8b30aead2..6ed9f476c 100644 --- a/src/ui/view/view.h +++ b/src/ui/view/view.h @@ -72,6 +72,10 @@ class View : public GC::Managed<>, public: View(); + + /** + * Deletes and nulls all View message stacks and disconnects it from signals. + */ virtual ~View(); void close() { _close(); } @@ -110,6 +114,16 @@ protected: Inkscape::MessageContext *_tips_message_context; virtual void _close(); + + /** + * Disconnects the view from the document signals, connects the view + * to a new one, and emits the _document_set_signal on the view. + * + * This is code comon to all subclasses and called from their + * setDocument() methods after they are done. + * + * @param doc The new document to connect the view to. + */ virtual void setDocument(SPDocument *doc); sigc::signal<void,double,double> _position_set_signal; diff --git a/src/ui/widget/button.cpp b/src/ui/widget/button.cpp index fe4aa90ce..ae1dbbe98 100644 --- a/src/ui/widget/button.cpp +++ b/src/ui/widget/button.cpp @@ -1,6 +1,4 @@ -/** - * Button and CheckButton widgets. - * +/* * Author: * buliabyak@gmail.com * diff --git a/src/ui/widget/color-picker.cpp b/src/ui/widget/color-picker.cpp index bd7a666d2..f32e25885 100644 --- a/src/ui/widget/color-picker.cpp +++ b/src/ui/widget/color-picker.cpp @@ -1,7 +1,4 @@ -/** - * @file - * Color picker button & window. - * +/* * Authors: * Lauris Kaplinski <lauris@kaplinski.com> * bulia byak <buliabyak@users.sf.net> diff --git a/src/ui/widget/color-preview.cpp b/src/ui/widget/color-preview.cpp index a4212c7ba..22ca1ebe0 100644 --- a/src/ui/widget/color-preview.cpp +++ b/src/ui/widget/color-preview.cpp @@ -1,6 +1,4 @@ -/** \file - * Implemenmtation of a simple color preview widget - * +/* * Author: * Lauris Kaplinski <lauris@kaplinski.com> * Ralf Stephan <ralf@ark.in-berlin.de> diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index 9c6758bc0..14b219110 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -1,6 +1,4 @@ -/** - * A custom Inkscape wrapper around gdl_dock_item. - * +/* * Author: * Gustav Broberg <broberg@kth.se> * diff --git a/src/ui/widget/entity-entry.cpp b/src/ui/widget/entity-entry.cpp index e62eb009c..aaf67a7a2 100644 --- a/src/ui/widget/entity-entry.cpp +++ b/src/ui/widget/entity-entry.cpp @@ -1,5 +1,4 @@ -/** \file - * +/* * Authors: * bulia byak <buliabyak@users.sf.net> * Bryce W. Harrington <bryce@bryceharrington.org> diff --git a/src/ui/widget/entry.cpp b/src/ui/widget/entry.cpp index ce7552fd6..7ac8532fb 100644 --- a/src/ui/widget/entry.cpp +++ b/src/ui/widget/entry.cpp @@ -1,8 +1,4 @@ -/** - * @file - * - * Helperclass for Gtk::Entry widgets. - * +/* * Authors: * Johan Engelen <goejendaagh@zonnet.nl> * diff --git a/src/ui/widget/handlebox.cpp b/src/ui/widget/handlebox.cpp index f5b716975..0ac84ef3a 100644 --- a/src/ui/widget/handlebox.cpp +++ b/src/ui/widget/handlebox.cpp @@ -1,10 +1,4 @@ -/** - * HandleBox Widget - Adds a detachment handle to another widget. - * - * This work really doesn't amount to much more than a convenience constructor - * for Gtk::HandleBox. Maybe this could be contributed back to Gtkmm, as - * Gtkmm provides several convenience constructors for other widgets as well. - * +/* * Author: * Derek P. Moore <derekm@hackunix.org> * diff --git a/src/ui/widget/icon-widget.cpp b/src/ui/widget/icon-widget.cpp index c3780b616..1bc4ad308 100644 --- a/src/ui/widget/icon-widget.cpp +++ b/src/ui/widget/icon-widget.cpp @@ -1,6 +1,4 @@ -/** - * Icon Widget. - * +/* * Author: * Bryce Harrington <bryce@bryceharrington.org> * @@ -21,14 +19,6 @@ namespace Inkscape { namespace UI { namespace Widget { -/** - * General purpose icon widget, supporting SVG, etc. icon loading - * - * \param ... - * - * An icon widget is a ... - */ - IconWidget::IconWidget() { _pb = NULL; diff --git a/src/ui/widget/labelled.cpp b/src/ui/widget/labelled.cpp index a62d1a470..0a13d6347 100644 --- a/src/ui/widget/labelled.cpp +++ b/src/ui/widget/labelled.cpp @@ -1,7 +1,4 @@ -/** - * Labelled Widget - Adds a label with optional icon or suffix to - * another widget. - * +/* * Authors: * Carl Hetherington <inkscape@carlh.net> * Derek P. Moore <derekm@hackunix.org> @@ -24,18 +21,6 @@ namespace Inkscape { namespace UI { namespace Widget { -/** - * Construct a Labelled Widget. - * - * \param label Label. - * \param widget Widget to label; should be allocated with new, as it will - * be passed to Gtk::manage(). - * \param suffix Suffix, placed after the widget (defaults to ""). - * \param icon Icon filename, placed before the label (defaults to ""). - * \param mnemonic Mnemonic toggle; if true, an underscore (_) in the text - * indicates the next character should be used for the - * mnemonic accelerator key (defaults to true). - */ Labelled::Labelled(Glib::ustring const &label, Glib::ustring const &tooltip, Gtk::Widget *widget, Glib::ustring const &suffix, @@ -60,9 +45,6 @@ Labelled::Labelled(Glib::ustring const &label, Glib::ustring const &tooltip, } -/** - * Allow the setting of the width of the labelled widget - */ void Labelled::setWidgetSizeRequest(int width, int height) { if (_widget) diff --git a/src/ui/widget/labelled.h b/src/ui/widget/labelled.h index 9614dc28a..8c2ec8939 100644 --- a/src/ui/widget/labelled.h +++ b/src/ui/widget/labelled.h @@ -26,6 +26,19 @@ namespace Widget { class Labelled : public Gtk::HBox { public: + + /** + * Construct a Labelled Widget. + * + * @param label Label. + * @param widget Widget to label; should be allocated with new, as it will + * be passed to Gtk::manage(). + * @param suffix Suffix, placed after the widget (defaults to ""). + * @param icon Icon filename, placed before the label (defaults to ""). + * @param mnemonic Mnemonic toggle; if true, an underscore (_) in the text + * indicates the next character should be used for the + * mnemonic accelerator key (defaults to true). + */ Labelled(Glib::ustring const &label, Glib::ustring const &tooltip, Gtk::Widget *widget, Glib::ustring const &suffix = "", diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp index c9550bb27..9cb904c9f 100644 --- a/src/ui/widget/licensor.cpp +++ b/src/ui/widget/licensor.cpp @@ -1,5 +1,4 @@ -/** \file - * +/* * Authors: * bulia byak <buliabyak@users.sf.net> * Bryce W. Harrington <bryce@bryceharrington.org> diff --git a/src/ui/widget/notebook-page.cpp b/src/ui/widget/notebook-page.cpp index eea8aefba..92bcb6937 100644 --- a/src/ui/widget/notebook-page.cpp +++ b/src/ui/widget/notebook-page.cpp @@ -1,4 +1,4 @@ -/** +/* * Notebook page widget. * * Author: @@ -19,12 +19,6 @@ namespace Inkscape { namespace UI { namespace Widget { -/** - * Construct a NotebookPage - * - * \param label Label. - */ - NotebookPage::NotebookPage(int n_rows, int n_columns, bool expand, bool fill, guint padding) :_table(n_rows, n_columns) { diff --git a/src/ui/widget/notebook-page.h b/src/ui/widget/notebook-page.h index bd53870d6..a541f3ba0 100644 --- a/src/ui/widget/notebook-page.h +++ b/src/ui/widget/notebook-page.h @@ -24,7 +24,12 @@ namespace Widget { class NotebookPage : public Gtk::VBox { public: + NotebookPage(); + + /** + * Construct a NotebookPage. + */ NotebookPage(int n_rows, int n_columns, bool expand=false, bool fill=false, guint padding=0); Gtk::Table& table() { return _table; } diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 67f3789c7..a6b0fb76d 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -1,7 +1,9 @@ -/** \file +/** + * @file * * Paper-size widget and helper functions - * + */ +/* * Authors: * bulia byak <buliabyak@users.sf.net> * Lauris Kaplinski <lauris@kaplinski.com> diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index aaa8e2a70..8c8603640 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -1,6 +1,4 @@ -/** - * Panel widget. - * +/* * Authors: * Bryce Harrington <bryce@bryceharrington.org> * Jon A. Cruz <jon@joncruz.org> @@ -54,10 +52,6 @@ void Panel::prep() { eek_preview_set_size_mappings( G_N_ELEMENTS(sizes), sizes ); } -/** - * Construct a Panel - */ - Panel::Panel(Glib::ustring const &label, gchar const *prefs_path, int verb_num, Glib::ustring const &apply_label, bool menu_desired) : diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index 3134111c0..d51d942dd 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -41,11 +41,15 @@ class Panel : public Gtk::VBox { public: static void prep(); - virtual ~Panel(); + /** + * Construct a Panel. + */ Panel(Glib::ustring const &label = "", gchar const *prefs_path = 0, int verb_num = 0, Glib::ustring const &apply_label = "", bool menu_desired = false); + virtual ~Panel(); + gchar const *getPrefsPath() const; void setLabel(Glib::ustring const &label); Glib::ustring const &getLabel() const; diff --git a/src/ui/widget/point.cpp b/src/ui/widget/point.cpp index 7a4b4459a..385b60122 100644 --- a/src/ui/widget/point.cpp +++ b/src/ui/widget/point.cpp @@ -1,7 +1,4 @@ -/** - * Point Widget - A labelled text box, with spin buttons and optional - * icon or suffix, for entering arbitrary coordinate values. - * +/* * Authors: * Johan Engelen <j.b.c.engelen@utwente.nl> * Carl Hetherington <inkscape@carlh.net> @@ -28,16 +25,6 @@ namespace Inkscape { namespace UI { namespace Widget { -/** - * Construct a Point Widget. - * - * \param label Label. - * \param suffix Suffix, placed after the widget (defaults to ""). - * \param icon Icon filename, placed before the label (defaults to ""). - * \param mnemonic Mnemonic toggle; if true, an underscore (_) in the label - * indicates the next character should be used for the - * mnemonic accelerator key (defaults to false). - */ Point::Point(Glib::ustring const &label, Glib::ustring const &tooltip, Glib::ustring const &suffix, Glib::ustring const &icon, @@ -51,17 +38,6 @@ Point::Point(Glib::ustring const &label, Glib::ustring const &tooltip, static_cast<Gtk::VBox*>(_widget)->show_all_children(); } -/** - * Construct a Point Widget. - * - * \param label Label. - * \param digits Number of decimal digits to display. - * \param suffix Suffix, placed after the widget (defaults to ""). - * \param icon Icon filename, placed before the label (defaults to ""). - * \param mnemonic Mnemonic toggle; if true, an underscore (_) in the label - * indicates the next character should be used for the - * mnemonic accelerator key (defaults to false). - */ Point::Point(Glib::ustring const &label, Glib::ustring const &tooltip, unsigned digits, Glib::ustring const &suffix, @@ -76,18 +52,6 @@ Point::Point(Glib::ustring const &label, Glib::ustring const &tooltip, static_cast<Gtk::VBox*>(_widget)->show_all_children(); } -/** - * Construct a Point Widget. - * - * \param label Label. - * \param adjust Adjustment to use for the SpinButton. - * \param digits Number of decimal digits to display (defaults to 0). - * \param suffix Suffix, placed after the widget (defaults to ""). - * \param icon Icon filename, placed before the label (defaults to ""). - * \param mnemonic Mnemonic toggle; if true, an underscore (_) in the label - * indicates the next character should be used for the - * mnemonic accelerator key (defaults to true). - */ Point::Point(Glib::ustring const &label, Glib::ustring const &tooltip, Gtk::Adjustment &adjust, unsigned digits, @@ -103,131 +67,105 @@ Point::Point(Glib::ustring const &label, Glib::ustring const &tooltip, static_cast<Gtk::VBox*>(_widget)->show_all_children(); } -/** Fetches the precision of the spin buton */ -unsigned -Point::getDigits() const +unsigned Point::getDigits() const { return xwidget.getDigits(); } -/** Gets the current step ingrement used by the spin button */ -double -Point::getStep() const +double Point::getStep() const { return xwidget.getStep(); } -/** Gets the current page increment used by the spin button */ -double -Point::getPage() const +double Point::getPage() const { return xwidget.getPage(); } -/** Gets the minimum range value allowed for the spin button */ -double -Point::getRangeMin() const +double Point::getRangeMin() const { return xwidget.getRangeMin(); } -/** Gets the maximum range value allowed for the spin button */ -double -Point::getRangeMax() const +double Point::getRangeMax() const { return xwidget.getRangeMax(); } -/** Get the value in the spin_button . */ -double -Point::getXValue() const +double Point::getXValue() const { return xwidget.getValue(); } -double -Point::getYValue() const + +double Point::getYValue() const { return ywidget.getValue(); } -Geom::Point -Point::getValue() const + +Geom::Point Point::getValue() const { return Geom::Point( getXValue() , getYValue() ); } -/** Get the value spin_button represented as an integer. */ -int -Point::getXValueAsInt() const +int Point::getXValueAsInt() const { return xwidget.getValueAsInt(); } -int -Point::getYValueAsInt() const + +int Point::getYValueAsInt() const { return ywidget.getValueAsInt(); } -/** Sets the precision to be displayed by the spin button */ -void -Point::setDigits(unsigned digits) +void Point::setDigits(unsigned digits) { xwidget.setDigits(digits); ywidget.setDigits(digits); } -/** Sets the step and page increments for the spin button */ -void -Point::setIncrements(double step, double page) +void Point::setIncrements(double step, double page) { xwidget.setIncrements(step, page); ywidget.setIncrements(step, page); } -/** Sets the minimum and maximum range allowed for the spin button */ -void -Point::setRange(double min, double max) +void Point::setRange(double min, double max) { xwidget.setRange(min, max); ywidget.setRange(min, max); } -/** Sets the value of the spin button */ -void -Point::setValue(Geom::Point const & p) +void Point::setValue(Geom::Point const & p) { xwidget.setValue(p[0]); ywidget.setValue(p[1]); } -/** Manually forces an update of the spin button */ -void -Point::update() { +void Point::update() +{ xwidget.update(); ywidget.update(); } -/** Check 'setProgrammatically' of both scalar widgets. False if value is changed by user by clicking the widget. */ -bool -Point::setProgrammatically() { +bool Point::setProgrammatically() +{ return (xwidget.setProgrammatically || ywidget.setProgrammatically); } -void -Point::clearProgrammatically() { +void Point::clearProgrammatically() +{ xwidget.setProgrammatically = false; ywidget.setProgrammatically = false; } -/** Signal raised when the spin button's value changes */ -Glib::SignalProxy0<void> -Point::signal_x_value_changed() +Glib::SignalProxy0<void> Point::signal_x_value_changed() { return xwidget.signal_value_changed(); } -Glib::SignalProxy0<void> -Point::signal_y_value_changed() + +Glib::SignalProxy0<void> Point::signal_y_value_changed() { return ywidget.signal_value_changed(); } diff --git a/src/ui/widget/point.h b/src/ui/widget/point.h index 651c8c8fb..ced43c47a 100644 --- a/src/ui/widget/point.h +++ b/src/ui/widget/point.h @@ -30,17 +30,54 @@ namespace Widget { class Point : public Labelled { public: + + + /** + * Construct a Point Widget. + * + * @param label Label. + * @param suffix Suffix, placed after the widget (defaults to ""). + * @param icon Icon filename, placed before the label (defaults to ""). + * @param mnemonic Mnemonic toggle; if true, an underscore (_) in the label + * indicates the next character should be used for the + * mnemonic accelerator key (defaults to false). + */ Point( Glib::ustring const &label, Glib::ustring const &tooltip, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", bool mnemonic = true); + + /** + * Construct a Point Widget. + * + * @param label Label. + * @param digits Number of decimal digits to display. + * @param suffix Suffix, placed after the widget (defaults to ""). + * @param icon Icon filename, placed before the label (defaults to ""). + * @param mnemonic Mnemonic toggle; if true, an underscore (_) in the label + * indicates the next character should be used for the + * mnemonic accelerator key (defaults to false). + */ Point( Glib::ustring const &label, Glib::ustring const &tooltip, unsigned digits, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", bool mnemonic = true); + + /** + * Construct a Point Widget. + * + * @param label Label. + * @param adjust Adjustment to use for the SpinButton. + * @param digits Number of decimal digits to display (defaults to 0). + * @param suffix Suffix, placed after the widget (defaults to ""). + * @param icon Icon filename, placed before the label (defaults to ""). + * @param mnemonic Mnemonic toggle; if true, an underscore (_) in the label + * indicates the next character should be used for the + * mnemonic accelerator key (defaults to true). + */ Point( Glib::ustring const &label, Glib::ustring const &tooltip, Gtk::Adjustment &adjust, @@ -49,35 +86,93 @@ public: Glib::ustring const &icon = "", bool mnemonic = true); + /** + * Fetches the precision of the spin buton. + */ unsigned getDigits() const; + + /** + * Gets the current step ingrement used by the spin button. + */ double getStep() const; + + /** + * Gets the current page increment used by the spin button. + */ double getPage() const; + + /** + * Gets the minimum range value allowed for the spin button. + */ double getRangeMin() const; + + /** + * Gets the maximum range value allowed for the spin button. + */ double getRangeMax() const; + bool getSnapToTicks() const; + + /** + * Get the value in the spin_button. + */ double getXValue() const; + double getYValue() const; + Geom::Point getValue() const; + + /** + * Get the value spin_button represented as an integer. + */ int getXValueAsInt() const; + int getYValueAsInt() const; + /** + * Sets the precision to be displayed by the spin button. + */ void setDigits(unsigned digits); + + /** + * Sets the step and page increments for the spin button. + */ void setIncrements(double step, double page); + + /** + * Sets the minimum and maximum range allowed for the spin button. + */ void setRange(double min, double max); + + /** + * Sets the value of the spin button. + */ void setValue(Geom::Point const & p); + /** + * Manually forces an update of the spin button. + */ void update(); + /** + * Signal raised when the spin button's value changes. + */ Glib::SignalProxy0<void> signal_x_value_changed(); + Glib::SignalProxy0<void> signal_y_value_changed(); - bool setProgrammatically(); // true if the value was set by setValue, not changed by the user; - // if a callback checks it, it must reset it back to false + /** + * Check 'setProgrammatically' of both scalar widgets. False if value is changed by user by clicking the widget. + * true if the value was set by setValue, not changed by the user; + * if a callback checks it, it must reset it back to false. + */ + bool setProgrammatically(); + void clearProgrammatically(); protected: - Scalar xwidget, ywidget; - + Scalar xwidget; + Scalar ywidget; }; } // namespace Widget diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index b88123ab1..001d2277d 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -1,4 +1,4 @@ -/** +/* * Inkscape Preferences dialog. * * Authors: @@ -583,10 +583,6 @@ void PrefCombo::init(Glib::ustring const &prefs_path, this->set_active(row); } -/** - initialize a combo box - second form uses strings as key values -*/ void PrefCombo::init(Glib::ustring const &prefs_path, Glib::ustring labels[], Glib::ustring values[], int num_items, Glib::ustring default_value) { diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index 83290a045..ea5c377a3 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -164,6 +164,11 @@ class PrefCombo : public Gtk::ComboBoxText public: void init(Glib::ustring const &prefs_path, Glib::ustring labels[], int values[], int num_items, int default_value); + + /** + * Initialize a combo box. + * second form uses strings as key values. + */ void init(Glib::ustring const &prefs_path, Glib::ustring labels[], Glib::ustring values[], int num_items, Glib::ustring default_value); protected: diff --git a/src/ui/widget/random.cpp b/src/ui/widget/random.cpp index e2fb30812..03cea7d5a 100644 --- a/src/ui/widget/random.cpp +++ b/src/ui/widget/random.cpp @@ -1,10 +1,4 @@ -/** - * Scalar Widget - A labelled text box, with spin buttons and optional - * icon or suffix, for entering arbitrary number values. It adds an extra - * number called "startseed", that is not UI edittable, but should be put in SVG. - * This does NOT generate a random number, but provides merely the saving of - * the startseed value. - * +/* * Authors: * Carl Hetherington <inkscape@carlh.net> * Derek P. Moore <derekm@hackunix.org> @@ -31,16 +25,6 @@ namespace Inkscape { namespace UI { namespace Widget { -/** - * Construct a Random scalar Widget. - * - * \param label Label. - * \param suffix Suffix, placed after the widget (defaults to ""). - * \param icon Icon filename, placed before the label (defaults to ""). - * \param mnemonic Mnemonic toggle; if true, an underscore (_) in the label - * indicates the next character should be used for the - * mnemonic accelerator key (defaults to false). - */ Random::Random(Glib::ustring const &label, Glib::ustring const &tooltip, Glib::ustring const &suffix, Glib::ustring const &icon, @@ -51,17 +35,6 @@ Random::Random(Glib::ustring const &label, Glib::ustring const &tooltip, addReseedButton(); } -/** - * Construct a Random Scalar Widget. - * - * \param label Label. - * \param digits Number of decimal digits to display. - * \param suffix Suffix, placed after the widget (defaults to ""). - * \param icon Icon filename, placed before the label (defaults to ""). - * \param mnemonic Mnemonic toggle; if true, an underscore (_) in the label - * indicates the next character should be used for the - * mnemonic accelerator key (defaults to false). - */ Random::Random(Glib::ustring const &label, Glib::ustring const &tooltip, unsigned digits, Glib::ustring const &suffix, @@ -73,18 +46,6 @@ Random::Random(Glib::ustring const &label, Glib::ustring const &tooltip, addReseedButton(); } -/** - * Construct a Random Scalar Widget. - * - * \param label Label. - * \param adjust Adjustment to use for the SpinButton. - * \param digits Number of decimal digits to display (defaults to 0). - * \param suffix Suffix, placed after the widget (defaults to ""). - * \param icon Icon filename, placed before the label (defaults to ""). - * \param mnemonic Mnemonic toggle; if true, an underscore (_) in the label - * indicates the next character should be used for the - * mnemonic accelerator key (defaults to true). - */ Random::Random(Glib::ustring const &label, Glib::ustring const &tooltip, Gtk::Adjustment &adjust, unsigned digits, @@ -97,23 +58,17 @@ Random::Random(Glib::ustring const &label, Glib::ustring const &tooltip, addReseedButton(); } -/** Gets the startseed */ -long -Random::getStartSeed() const +long Random::getStartSeed() const { return startseed; } -/** Sets the startseed number */ -void -Random::setStartSeed(long newseed) +void Random::setStartSeed(long newseed) { startseed = newseed; } -/** Add reseed button to the widget */ -void -Random::addReseedButton() +void Random::addReseedButton() { Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( "randomize", Inkscape::ICON_SIZE_BUTTON) ); Gtk::Button * pButton = Gtk::manage(new Gtk::Button()); diff --git a/src/ui/widget/random.h b/src/ui/widget/random.h index 33f416e3f..cb8c223dc 100644 --- a/src/ui/widget/random.h +++ b/src/ui/widget/random.h @@ -17,23 +17,62 @@ namespace UI { namespace Widget { /** - * A labelled text box, with spin buttons and optional icon or suffix, for - * entering arbitrary number values and generating a random number from it. + * A labelled text box, with spin buttons and optional + * icon or suffix, for entering arbitrary number values. It adds an extra + * number called "startseed", that is not UI edittable, but should be put in SVG. + * This does NOT generate a random number, but provides merely the saving of + * the startseed value. */ class Random : public Scalar { public: + + /** + * Construct a Random scalar Widget. + * + * @param label Label. + * @param suffix Suffix, placed after the widget (defaults to ""). + * @param icon Icon filename, placed before the label (defaults to ""). + * @param mnemonic Mnemonic toggle; if true, an underscore (_) in the label + * indicates the next character should be used for the + * mnemonic accelerator key (defaults to false). + */ Random(Glib::ustring const &label, Glib::ustring const &tooltip, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", bool mnemonic = true); + + /** + * Construct a Random Scalar Widget. + * + * @param label Label. + * @param digits Number of decimal digits to display. + * @param suffix Suffix, placed after the widget (defaults to ""). + * @param icon Icon filename, placed before the label (defaults to ""). + * @param mnemonic Mnemonic toggle; if true, an underscore (_) in the label + * indicates the next character should be used for the + * mnemonic accelerator key (defaults to false). + */ Random(Glib::ustring const &label, Glib::ustring const &tooltip, unsigned digits, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", bool mnemonic = true); + + /** + * Construct a Random Scalar Widget. + * + * @param label Label. + * @param adjust Adjustment to use for the SpinButton. + * @param digits Number of decimal digits to display (defaults to 0). + * @param suffix Suffix, placed after the widget (defaults to ""). + * @param icon Icon filename, placed before the label (defaults to ""). + * @param mnemonic Mnemonic toggle; if true, an underscore (_) in the label + * indicates the next character should be used for the + * mnemonic accelerator key (defaults to true). + */ Random(Glib::ustring const &label, Glib::ustring const &tooltip, Gtk::Adjustment &adjust, @@ -42,7 +81,14 @@ public: Glib::ustring const &icon = "", bool mnemonic = true); + /** + * Gets the startseed. + */ long getStartSeed() const; + + /** + * Sets the startseed number. + */ void setStartSeed(long newseed); sigc::signal <void> signal_reseeded; @@ -51,7 +97,12 @@ protected: long startseed; private: + + /** + * Add reseed button to the widget. + */ void addReseedButton(); + void onReseedButtonClick(); }; diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 3f060f740..f923a7c9c 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -1,6 +1,4 @@ -/** \file - * - * +/* * Authors: * Johan Engelen <j.b.c.engelen@utwente.nl> * bulia byak <buliabyak@users.sf.net> @@ -632,13 +630,7 @@ RegisteredVector::setValue(Geom::Point const & p, Geom::Point const & origin) _origin = origin; } -/** - * Changes the widgets text to polar coordinates. The SVG output will still be a normal carthesian vector. - * Careful: when calling getValue(), the return value's X-coord will be the angle, Y-value will be the distance/length. - * After changing the coords type (polar/non-polar), the value has to be reset (setValue). - */ -void -RegisteredVector::setPolarCoords(bool polar_coords) +void RegisteredVector::setPolarCoords(bool polar_coords) { _polar_coords = polar_coords; if (polar_coords) { diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h index a948e1535..df2377464 100644 --- a/src/ui/widget/registered-widget.h +++ b/src/ui/widget/registered-widget.h @@ -345,6 +345,12 @@ public: // redefine setValue, because transform must be applied void setValue(Geom::Point const & p); void setValue(Geom::Point const & p, Geom::Point const & origin); + + /** + * Changes the widgets text to polar coordinates. The SVG output will still be a normal carthesian vector. + * Careful: when calling getValue(), the return value's X-coord will be the angle, Y-value will be the distance/length. + * After changing the coords type (polar/non-polar), the value has to be reset (setValue). + */ void setPolarCoords(bool polar_coords = true); protected: diff --git a/src/ui/widget/registry.cpp b/src/ui/widget/registry.cpp index aa92e6ecb..725e52791 100644 --- a/src/ui/widget/registry.cpp +++ b/src/ui/widget/registry.cpp @@ -1,6 +1,4 @@ -/** \file - * - * +/* * Authors: * Ralf Stephan <ralf@ark.in-berlin.de> * diff --git a/src/ui/widget/rendering-options.cpp b/src/ui/widget/rendering-options.cpp index 1ceaa784e..bbc0a0039 100644 --- a/src/ui/widget/rendering-options.cpp +++ b/src/ui/widget/rendering-options.cpp @@ -1,6 +1,4 @@ -/** - * Rendering options widget. - * +/* * Author: * Kees Cook <kees@outflux.net> * @@ -23,17 +21,11 @@ namespace Inkscape { namespace UI { namespace Widget { -void -RenderingOptions::_toggled() +void RenderingOptions::_toggled() { _frame_bitmap.set_sensitive(as_bitmap()); } -/** - * Construct a Rendering Options widget - * - */ - RenderingOptions::RenderingOptions () : Gtk::VBox (), _frame_backends ( Glib::ustring(_("Backend")) ), diff --git a/src/ui/widget/rendering-options.h b/src/ui/widget/rendering-options.h index 3e2e046d3..241683fe6 100644 --- a/src/ui/widget/rendering-options.h +++ b/src/ui/widget/rendering-options.h @@ -24,6 +24,10 @@ namespace Widget { class RenderingOptions : public Gtk::VBox { public: + + /** + * Construct a Rendering Options widget. + */ RenderingOptions(); bool as_bitmap(); // should we render as a bitmap? diff --git a/src/ui/widget/rotateable.cpp b/src/ui/widget/rotateable.cpp index 6a65d6ab3..c31e6f529 100644 --- a/src/ui/widget/rotateable.cpp +++ b/src/ui/widget/rotateable.cpp @@ -1,6 +1,4 @@ -/** - * widget adjustable by dragging it to rotate away from a zero-change axis. - * +/* * Authors: * buliabyak@gmail.com * diff --git a/src/ui/widget/scalar-unit.cpp b/src/ui/widget/scalar-unit.cpp index 47e9b23b2..99ff70846 100644 --- a/src/ui/widget/scalar-unit.cpp +++ b/src/ui/widget/scalar-unit.cpp @@ -1,17 +1,4 @@ -/** - * Scalar Unit Widget - A labelled text box, with spin buttons and - * optional icon or suffix, for entering the values of various unit - * types. - * - * A ScalarUnit is a control for entering, viewing, or manipulating - * numbers with units. This differs from ordinary numbers like 2 or - * 3.14 because the number portion of a scalar *only* has meaning - * when considered with its unit type. For instance, 12 m and 12 in - * have very different actual values, but 1 m and 100 cm have the same - * value. The ScalarUnit allows us to abstract the presentation of - * the scalar to the user from the internal representations used by - * the program. - * +/* * Authors: * Bryce Harrington <bryce@bryceharrington.org> * Derek P. Moore <derekm@hackunix.org> @@ -33,19 +20,6 @@ namespace Inkscape { namespace UI { namespace Widget { -/** - * Construct a ScalarUnit - * - * \param label Label. - * \param unit_type Unit type (defaults to UNIT_TYPE_LINEAR). - * \param suffix Suffix, placed after the widget (defaults to ""). - * \param icon Icon filename, placed before the label (defaults to ""). - * \param unit_menu UnitMenu drop down; if not specified, one will be created - * and displayed after the widget (defaults to NULL). - * \param mnemonic Mnemonic toggle; if true, an underscore (_) in the label - * indicates the next character should be used for the - * mnemonic accelerator key (defaults to true). - */ ScalarUnit::ScalarUnit(Glib::ustring const &label, Glib::ustring const &tooltip, UnitType unit_type, Glib::ustring const &suffix, @@ -72,18 +46,6 @@ ScalarUnit::ScalarUnit(Glib::ustring const &label, Glib::ustring const &tooltip, lastUnits = _unit_menu->getUnitAbbr(); } -/** - * Construct a ScalarUnit - * - * \param label Label. - * \param tooltip Tooltip text. - * \param take_unitmenu Use the unitmenu from this parameter. - * \param suffix Suffix, placed after the widget (defaults to ""). - * \param icon Icon filename, placed before the label (defaults to ""). - * \param mnemonic Mnemonic toggle; if true, an underscore (_) in the label - * indicates the next character should be used for the - * mnemonic accelerator key (defaults to true). - */ ScalarUnit::ScalarUnit(Glib::ustring const &label, Glib::ustring const &tooltip, ScalarUnit &take_unitmenu, Glib::ustring const &suffix, @@ -104,12 +66,7 @@ ScalarUnit::ScalarUnit(Glib::ustring const &label, Glib::ustring const &tooltip, } -/** - * Initializes the scalar based on the settings in _unit_menu. - * Requires that _unit_menu has already been initialized. - */ -void -ScalarUnit::initScalar(double min_value, double max_value) +void ScalarUnit::initScalar(double min_value, double max_value) { g_assert(_unit_menu != NULL); Scalar::setDigits(_unit_menu->getDefaultDigits()); @@ -118,9 +75,8 @@ ScalarUnit::initScalar(double min_value, double max_value) Scalar::setRange(min_value, max_value); } -/** Sets the unit for the ScalarUnit widget */ -bool -ScalarUnit::setUnit(Glib::ustring const &unit) { +bool ScalarUnit::setUnit(Glib::ustring const &unit) +{ g_assert(_unit_menu != NULL); // First set the unit if (!_unit_menu->setUnit(unit)) { @@ -130,47 +86,41 @@ ScalarUnit::setUnit(Glib::ustring const &unit) { return true; } -/** Adds the unit type to the ScalarUnit widget */ -void -ScalarUnit::setUnitType(UnitType unit_type) { +void ScalarUnit::setUnitType(UnitType unit_type) +{ g_assert(_unit_menu != NULL); _unit_menu->setUnitType(unit_type); lastUnits = _unit_menu->getUnitAbbr(); } -/** Resets the unit type for the ScalarUnit widget */ -void -ScalarUnit::resetUnitType(UnitType unit_type) { +void ScalarUnit::resetUnitType(UnitType unit_type) +{ g_assert(_unit_menu != NULL); _unit_menu->resetUnitType(unit_type); lastUnits = _unit_menu->getUnitAbbr(); } -/** Gets the object for the currently selected unit */ -Unit -ScalarUnit::getUnit() const { +Unit ScalarUnit::getUnit() const +{ g_assert(_unit_menu != NULL); return _unit_menu->getUnit(); } -/** Gets the UnitType ID for the unit */ -UnitType -ScalarUnit::getUnitType() const { +UnitType ScalarUnit::getUnitType() const +{ g_assert(_unit_menu); return _unit_menu->getUnitType(); } -/** Sets the number and unit system */ -void -ScalarUnit::setValue(double number, Glib::ustring const &units) { +void ScalarUnit::setValue(double number, Glib::ustring const &units) +{ g_assert(_unit_menu != NULL); _unit_menu->setUnit(units); Scalar::setValue(number); } -/** Convert and sets the number only and keeps the current unit. */ -void -ScalarUnit::setValueKeepUnit(double number, Glib::ustring const &units) { +void ScalarUnit::setValueKeepUnit(double number, Glib::ustring const &units) +{ g_assert(_unit_menu != NULL); if (units == "") { // set the value in the default units @@ -181,15 +131,13 @@ ScalarUnit::setValueKeepUnit(double number, Glib::ustring const &units) { } } -/** Sets the number only */ -void -ScalarUnit::setValue(double number) { +void ScalarUnit::setValue(double number) +{ Scalar::setValue(number); } -/** Returns the value in the given unit system */ -double -ScalarUnit::getValue(Glib::ustring const &unit_name) const { +double ScalarUnit::getValue(Glib::ustring const &unit_name) const +{ g_assert(_unit_menu != NULL); if (unit_name == "") { // Return the value in the default units @@ -200,36 +148,29 @@ ScalarUnit::getValue(Glib::ustring const &unit_name) const { } } -/** Grab focus, and select the text that is in the entry field. - */ -void -ScalarUnit::grabFocusAndSelectEntry() { +void ScalarUnit::grabFocusAndSelectEntry() +{ _widget->grab_focus(); static_cast<SpinButton*>(_widget)->select_region(0, 20); } -void -ScalarUnit::setHundredPercent(double number) +void ScalarUnit::setHundredPercent(double number) { _hundred_percent = number; } -void -ScalarUnit::setAbsoluteIsIncrement(bool value) +void ScalarUnit::setAbsoluteIsIncrement(bool value) { _absolute_is_increment = value; } -void -ScalarUnit::setPercentageIsIncrement(bool value) +void ScalarUnit::setPercentageIsIncrement(bool value) { _percentage_is_increment = value; } -/** Convert value from % to absolute, using _hundred_percent and *_is_increment flags */ -double -ScalarUnit::PercentageToAbsolute(double value) +double ScalarUnit::PercentageToAbsolute(double value) { // convert from percent to absolute double convertedVal = 0; @@ -243,9 +184,7 @@ ScalarUnit::PercentageToAbsolute(double value) return convertedVal; } -/** Convert value from absolute to %, using _hundred_percent and *_is_increment flags */ -double -ScalarUnit::AbsoluteToPercentage(double value) +double ScalarUnit::AbsoluteToPercentage(double value) { double convertedVal = 0; // convert from absolute to percent @@ -266,27 +205,21 @@ ScalarUnit::AbsoluteToPercentage(double value) return convertedVal; } -/** Assuming the current unit is absolute, get the corresponding % value */ -double -ScalarUnit::getAsPercentage() +double ScalarUnit::getAsPercentage() { double convertedVal = AbsoluteToPercentage(Scalar::getValue()); return convertedVal; } -/** Assuming the current unit is absolute, set the value corresponding to a given % */ -void -ScalarUnit::setFromPercentage(double value) +void ScalarUnit::setFromPercentage(double value) { double absolute = PercentageToAbsolute(value); Scalar::setValue(absolute); } -/** Signal handler for updating the value and suffix label when unit is changed */ -void -ScalarUnit::on_unit_changed() +void ScalarUnit::on_unit_changed() { g_assert(_unit_menu != NULL); diff --git a/src/ui/widget/scalar-unit.h b/src/ui/widget/scalar-unit.h index 05a7b95f8..4f22f438c 100644 --- a/src/ui/widget/scalar-unit.h +++ b/src/ui/widget/scalar-unit.h @@ -22,47 +22,142 @@ namespace Widget { /** * A labelled text box, with spin buttons and optional icon or suffix, for * entering the values of various unit types. + * + * A ScalarUnit is a control for entering, viewing, or manipulating + * numbers with units. This differs from ordinary numbers like 2 or + * 3.14 because the number portion of a scalar *only* has meaning + * when considered with its unit type. For instance, 12 m and 12 in + * have very different actual values, but 1 m and 100 cm have the same + * value. The ScalarUnit allows us to abstract the presentation of + * the scalar to the user from the internal representations used by + * the program. */ class ScalarUnit : public Scalar { public: + /** + * Construct a ScalarUnit. + * + * @param label Label. + * @param unit_type Unit type (defaults to UNIT_TYPE_LINEAR). + * @param suffix Suffix, placed after the widget (defaults to ""). + * @param icon Icon filename, placed before the label (defaults to ""). + * @param unit_menu UnitMenu drop down; if not specified, one will be created + * and displayed after the widget (defaults to NULL). + * @param mnemonic Mnemonic toggle; if true, an underscore (_) in the label + * indicates the next character should be used for the + * mnemonic accelerator key (defaults to true). + */ ScalarUnit(Glib::ustring const &label, Glib::ustring const &tooltip, UnitType unit_type = UNIT_TYPE_LINEAR, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", UnitMenu *unit_menu = NULL, bool mnemonic = true); + + /** + * Construct a ScalarUnit. + * + * @param label Label. + * @param tooltip Tooltip text. + * @param take_unitmenu Use the unitmenu from this parameter. + * @param suffix Suffix, placed after the widget (defaults to ""). + * @param icon Icon filename, placed before the label (defaults to ""). + * @param mnemonic Mnemonic toggle; if true, an underscore (_) in the label + * indicates the next character should be used for the + * mnemonic accelerator key (defaults to true). + */ ScalarUnit(Glib::ustring const &label, Glib::ustring const &tooltip, ScalarUnit &take_unitmenu, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", bool mnemonic = true); + /** + * Initializes the scalar based on the settings in _unit_menu. + * Requires that _unit_menu has already been initialized. + */ void initScalar(double min_value, double max_value); + /** + * Gets the object for the currently selected unit. + */ Unit getUnit() const; + + /** + * Gets the UnitType ID for the unit. + */ UnitType getUnitType() const; + + /** + * Returns the value in the given unit system. + */ double getValue(Glib::ustring const &units) const; + /** + * Sets the unit for the ScalarUnit widget. + */ bool setUnit(Glib::ustring const &units); + + /** + * Adds the unit type to the ScalarUnit widget. + */ void setUnitType(UnitType unit_type); + + /** + * Resets the unit type for the ScalarUnit widget. + */ void resetUnitType(UnitType unit_type); + + /** + * Sets the number and unit system. + */ void setValue(double number, Glib::ustring const &units); + + /** + * Convert and sets the number only and keeps the current unit. + */ void setValueKeepUnit(double number, Glib::ustring const &units); + + /** + * Sets the number only. + */ void setValue(double number); + /** + * Grab focus, and select the text that is in the entry field. + */ void grabFocusAndSelectEntry(); void setHundredPercent(double number); + void setAbsoluteIsIncrement(bool value); + void setPercentageIsIncrement(bool value); + /** + * Convert value from % to absolute, using _hundred_percent and *_is_increment flags. + */ double PercentageToAbsolute(double value); + + /** + * Convert value from absolute to %, using _hundred_percent and *_is_increment flags. + */ double AbsoluteToPercentage(double value); + /** + * Assuming the current unit is absolute, get the corresponding % value. + */ double getAsPercentage(); + + /** + * Assuming the current unit is absolute, set the value corresponding to a given %. + */ void setFromPercentage(double value); + /** + * Signal handler for updating the value and suffix label when unit is changed. + */ void on_unit_changed(); protected: diff --git a/src/ui/widget/scalar.cpp b/src/ui/widget/scalar.cpp index 4237d9db9..220498561 100644 --- a/src/ui/widget/scalar.cpp +++ b/src/ui/widget/scalar.cpp @@ -1,7 +1,4 @@ -/** - * Scalar Widget - A labelled text box, with spin buttons and optional - * icon or suffix, for entering arbitrary number values. - * +/* * Authors: * Carl Hetherington <inkscape@carlh.net> * Derek P. Moore <derekm@hackunix.org> @@ -24,16 +21,6 @@ namespace Inkscape { namespace UI { namespace Widget { -/** - * Construct a Scalar Widget. - * - * \param label Label. - * \param suffix Suffix, placed after the widget (defaults to ""). - * \param icon Icon filename, placed before the label (defaults to ""). - * \param mnemonic Mnemonic toggle; if true, an underscore (_) in the label - * indicates the next character should be used for the - * mnemonic accelerator key (defaults to false). - */ Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, Glib::ustring const &suffix, Glib::ustring const &icon, @@ -43,17 +30,6 @@ Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, { } -/** - * Construct a Scalar Widget. - * - * \param label Label. - * \param digits Number of decimal digits to display. - * \param suffix Suffix, placed after the widget (defaults to ""). - * \param icon Icon filename, placed before the label (defaults to ""). - * \param mnemonic Mnemonic toggle; if true, an underscore (_) in the label - * indicates the next character should be used for the - * mnemonic accelerator key (defaults to false). - */ Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, unsigned digits, Glib::ustring const &suffix, @@ -64,18 +40,6 @@ Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, { } -/** - * Construct a Scalar Widget. - * - * \param label Label. - * \param adjust Adjustment to use for the SpinButton. - * \param digits Number of decimal digits to display (defaults to 0). - * \param suffix Suffix, placed after the widget (defaults to ""). - * \param icon Icon filename, placed before the label (defaults to ""). - * \param mnemonic Mnemonic toggle; if true, an underscore (_) in the label - * indicates the next character should be used for the - * mnemonic accelerator key (defaults to true). - */ Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, Gtk::Adjustment &adjust, unsigned digits, @@ -87,17 +51,13 @@ Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, { } -/** Fetches the precision of the spin buton */ -unsigned -Scalar::getDigits() const +unsigned Scalar::getDigits() const { g_assert(_widget != NULL); return static_cast<SpinButton*>(_widget)->get_digits(); } -/** Gets the current step ingrement used by the spin button */ -double -Scalar::getStep() const +double Scalar::getStep() const { g_assert(_widget != NULL); double step, page; @@ -105,9 +65,7 @@ Scalar::getStep() const return step; } -/** Gets the current page increment used by the spin button */ -double -Scalar::getPage() const +double Scalar::getPage() const { g_assert(_widget != NULL); double step, page; @@ -115,9 +73,7 @@ Scalar::getPage() const return page; } -/** Gets the minimum range value allowed for the spin button */ -double -Scalar::getRangeMin() const +double Scalar::getRangeMin() const { g_assert(_widget != NULL); double min, max; @@ -125,9 +81,7 @@ Scalar::getRangeMin() const return min; } -/** Gets the maximum range value allowed for the spin button */ -double -Scalar::getRangeMax() const +double Scalar::getRangeMax() const { g_assert(_widget != NULL); double min, max; @@ -135,70 +89,53 @@ Scalar::getRangeMax() const return max; } -/** Get the value in the spin_button . */ -double -Scalar::getValue() const +double Scalar::getValue() const { g_assert(_widget != NULL); return static_cast<SpinButton*>(_widget)->get_value(); } -/** Get the value spin_button represented as an integer. */ -int -Scalar::getValueAsInt() const +int Scalar::getValueAsInt() const { g_assert(_widget != NULL); return static_cast<SpinButton*>(_widget)->get_value_as_int(); } -/** Sets the precision to be displayed by the spin button */ -void -Scalar::setDigits(unsigned digits) +void Scalar::setDigits(unsigned digits) { g_assert(_widget != NULL); static_cast<SpinButton*>(_widget)->set_digits(digits); } -/** Sets the step and page increments for the spin button - * @todo Remove the second parameter - deprecated - */ -void -Scalar::setIncrements(double step, double /*page*/) +void Scalar::setIncrements(double step, double /*page*/) { g_assert(_widget != NULL); static_cast<SpinButton*>(_widget)->set_increments(step, 0); } -/** Sets the minimum and maximum range allowed for the spin button */ -void -Scalar::setRange(double min, double max) +void Scalar::setRange(double min, double max) { g_assert(_widget != NULL); static_cast<SpinButton*>(_widget)->set_range(min, max); } -/** Sets the value of the spin button */ -void -Scalar::setValue(double value) +void Scalar::setValue(double value) { g_assert(_widget != NULL); setProgrammatically = true; // callback is supposed to reset back, if it cares static_cast<SpinButton*>(_widget)->set_value(value); } -/** Manually forces an update of the spin button */ -void -Scalar::update() { +void Scalar::update() +{ g_assert(_widget != NULL); static_cast<SpinButton*>(_widget)->update(); } -/** Signal raised when the spin button's value changes */ -Glib::SignalProxy0<void> -Scalar::signal_value_changed() +Glib::SignalProxy0<void> Scalar::signal_value_changed() { return static_cast<SpinButton*>(_widget)->signal_value_changed(); } diff --git a/src/ui/widget/scalar.h b/src/ui/widget/scalar.h index 66bd07ddb..c73bcc62a 100644 --- a/src/ui/widget/scalar.h +++ b/src/ui/widget/scalar.h @@ -25,17 +25,52 @@ namespace Widget { class Scalar : public Labelled { public: + /** + * Construct a Scalar Widget. + * + * @param label Label. + * @param suffix Suffix, placed after the widget (defaults to ""). + * @param icon Icon filename, placed before the label (defaults to ""). + * @param mnemonic Mnemonic toggle; if true, an underscore (_) in the label + * indicates the next character should be used for the + * mnemonic accelerator key (defaults to false). + */ Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", bool mnemonic = true); + + /** + * Construct a Scalar Widget. + * + * @param label Label. + * @param digits Number of decimal digits to display. + * @param suffix Suffix, placed after the widget (defaults to ""). + * @param icon Icon filename, placed before the label (defaults to ""). + * @param mnemonic Mnemonic toggle; if true, an underscore (_) in the label + * indicates the next character should be used for the + * mnemonic accelerator key (defaults to false). + */ Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, unsigned digits, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", bool mnemonic = true); + + /** + * Construct a Scalar Widget. + * + * @param label Label. + * @param adjust Adjustment to use for the SpinButton. + * @param digits Number of decimal digits to display (defaults to 0). + * @param suffix Suffix, placed after the widget (defaults to ""). + * @param icon Icon filename, placed before the label (defaults to ""). + * @param mnemonic Mnemonic toggle; if true, an underscore (_) in the label + * indicates the next character should be used for the + * mnemonic accelerator key (defaults to true). + */ Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, Gtk::Adjustment &adjust, @@ -44,26 +79,79 @@ public: Glib::ustring const &icon = "", bool mnemonic = true); + /** + * Fetches the precision of the spin buton. + */ unsigned getDigits() const; + + /** + * Gets the current step ingrement used by the spin button. + */ double getStep() const; + + /** + * Gets the current page increment used by the spin button. + */ double getPage() const; + + /** + * Gets the minimum range value allowed for the spin button. + */ double getRangeMin() const; + + /** + * Gets the maximum range value allowed for the spin button. + */ double getRangeMax() const; + bool getSnapToTicks() const; + + /** + * Get the value in the spin_button. + */ double getValue() const; + + /** + * Get the value spin_button represented as an integer. + */ int getValueAsInt() const; + /** + * Sets the precision to be displayed by the spin button. + */ void setDigits(unsigned digits); + + /** + * Sets the step and page increments for the spin button. + * @todo Remove the second parameter - deprecated + */ void setIncrements(double step, double page); + + /** + * Sets the minimum and maximum range allowed for the spin button. + */ void setRange(double min, double max); + + /** + * Sets the value of the spin button. + */ void setValue(double value); + /** + * Manually forces an update of the spin button. + */ void update(); + /** + * Signal raised when the spin button's value changes. + */ Glib::SignalProxy0<void> signal_value_changed(); - bool setProgrammatically; // true if the value was set by setValue, not changed by the user; - // if a callback checks it, it must reset it back to false + /** + * true if the value was set by setValue, not changed by the user; + * if a callback checks it, it must reset it back to false. + */ + bool setProgrammatically; }; } // namespace Widget diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index 51c3af4dd..b6722f4cf 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -1,6 +1,4 @@ -/** - * Selected style indicator (fill, stroke, opacity). - * +/* * Author: * buliabyak@gmail.com * Abhishek Sharma diff --git a/src/ui/widget/spin-slider.cpp b/src/ui/widget/spin-slider.cpp index 4a3b0dd77..da2db991e 100644 --- a/src/ui/widget/spin-slider.cpp +++ b/src/ui/widget/spin-slider.cpp @@ -1,6 +1,4 @@ -/** - * Groups an HScale and a SpinButton together using the same Adjustment. - * +/* * Author: * Nicholas Bishop <nicholasbishop@gmail.com> * Felipe C. da S. Sanches <juca@members.fsf.org> diff --git a/src/ui/widget/spinbutton.cpp b/src/ui/widget/spinbutton.cpp index 78b00bebc..60b7856f6 100644 --- a/src/ui/widget/spinbutton.cpp +++ b/src/ui/widget/spinbutton.cpp @@ -1,6 +1,3 @@ -/** - * SpinButton widget, that allows entry of both '.' and ',' for the decimal, even when in numeric mode. - */ /* * Author: * Johan B. C. Engelen @@ -32,15 +29,7 @@ SpinButton::connect_signals() { signal_key_press_event().connect(sigc::mem_fun(*this, &SpinButton::on_my_key_press_event)); }; -/** - * This callback function should try to convert the entered text to a number and write it to newvalue. - * It calls a method to evaluate the (potential) mathematical expression. - * - * @retval false No conversion done, continue with default handler. - * @retval true Conversion successful, don't call default handler. - */ -int -SpinButton::on_input(double* newvalue) +int SpinButton::on_input(double* newvalue) { try { Inkscape::Util::GimpEevlQuantity result; @@ -66,23 +55,13 @@ SpinButton::on_input(double* newvalue) return true; } -/** When focus is obtained, save the value to enable undo later. - * @retval false continue with default handler. - * @retval true don't call default handler. -*/ -bool -SpinButton::on_my_focus_in_event(GdkEventFocus* /*event*/) +bool SpinButton::on_my_focus_in_event(GdkEventFocus* /*event*/) { on_focus_in_value = get_value(); return false; // do not consume the event } -/** Handle specific keypress events, like Ctrl+Z - * @retval false continue with default handler. - * @retval true don't call default handler. -*/ -bool -SpinButton::on_my_key_press_event(GdkEventKey* event) +bool SpinButton::on_my_key_press_event(GdkEventKey* event) { switch (get_group0_keyval (event)) { case GDK_Escape: @@ -103,11 +82,7 @@ SpinButton::on_my_key_press_event(GdkEventKey* event) return false; // do not consume the event } -/** - * Undo the editing, by resetting the value upon when the spinbutton got focus. - */ -void -SpinButton::undo() +void SpinButton::undo() { set_value(on_focus_in_value); } diff --git a/src/ui/widget/spinbutton.h b/src/ui/widget/spinbutton.h index df913553d..b7764d979 100644 --- a/src/ui/widget/spinbutton.h +++ b/src/ui/widget/spinbutton.h @@ -1,6 +1,3 @@ -/** - * \brief SpinButton widget, that allows entry of both '.' and ',' for the decimal, even when in numeric mode. - */ /* * Author: * Johan B. C. Engelen @@ -22,7 +19,8 @@ namespace Widget { class UnitMenu; /** - * SpinButton widget, that allows entry of simple math expressions (also units, when linked with UnitMenu). + * SpinButton widget, that allows entry of simple math expressions (also units, when linked with UnitMenu), + * and allows entry of both '.' and ',' for the decimal, even when in numeric mode. * * Calling "set_numeric()" effectively disables the expression parsing. If no unit menu is linked, all unitlike characters are ignored. */ @@ -50,10 +48,35 @@ protected: UnitMenu *_unit_menu; /// Linked unit menu for unit conversion in entered expressions. void connect_signals(); - int on_input(double* newvalue); - bool on_my_focus_in_event(GdkEventFocus* event); - bool on_my_key_press_event(GdkEventKey* event); - void undo(); + + /** + * This callback function should try to convert the entered text to a number and write it to newvalue. + * It calls a method to evaluate the (potential) mathematical expression. + * + * @retval false No conversion done, continue with default handler. + * @retval true Conversion successful, don't call default handler. + */ + int on_input(double* newvalue); + + /** + * When focus is obtained, save the value to enable undo later. + * @retval false continue with default handler. + * @retval true don't call default handler. + */ + bool on_my_focus_in_event(GdkEventFocus* event); + + /** + * Handle specific keypress events, like Ctrl+Z. + * + * @retval false continue with default handler. + * @retval true don't call default handler. + */ + bool on_my_key_press_event(GdkEventKey* event); + + /** + * Undo the editing, by resetting the value upon when the spinbutton got focus. + */ + void undo(); double on_focus_in_value; diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp index 4a1b83175..d9bf7e2aa 100644 --- a/src/ui/widget/style-subject.cpp +++ b/src/ui/widget/style-subject.cpp @@ -1,6 +1,4 @@ -/** - * Abstraction for different style widget operands. - * +/* * Copyright (C) 2007 MenTaLguY <mental@rydia.net> * Abhishek Sharma * diff --git a/src/ui/widget/svg-canvas.cpp b/src/ui/widget/svg-canvas.cpp index f0eb24a10..d3d9f70f2 100644 --- a/src/ui/widget/svg-canvas.cpp +++ b/src/ui/widget/svg-canvas.cpp @@ -1,6 +1,4 @@ -/** \file - * Gtkmm facade/wrapper around SPCanvas. - * +/* * Authors: * Ralf Stephan <ralf@ark.in-berlin.de> * diff --git a/src/ui/widget/text.cpp b/src/ui/widget/text.cpp index a5540e428..b79bea067 100644 --- a/src/ui/widget/text.cpp +++ b/src/ui/widget/text.cpp @@ -1,7 +1,4 @@ -/** - * Text Widget - A labelled text box, with spin buttons and optional - * icon or suffix, for entering arbitrary number values. - * +/* * Authors: * Carl Hetherington <inkscape@carlh.net> * Maximilian Albert <maximilian.albert@gmail.com> @@ -22,16 +19,6 @@ namespace Inkscape { namespace UI { namespace Widget { -/** - * Construct a Text Widget. - * - * \param label Label. - * \param suffix Suffix, placed after the widget (defaults to ""). - * \param icon Icon filename, placed before the label (defaults to ""). - * \param mnemonic Mnemonic toggle; if true, an underscore (_) in the label - * indicates the next character should be used for the - * mnemonic accelerator key (defaults to false). - */ Text::Text(Glib::ustring const &label, Glib::ustring const &tooltip, Glib::ustring const &suffix, Glib::ustring const &icon, @@ -41,26 +28,20 @@ Text::Text(Glib::ustring const &label, Glib::ustring const &tooltip, { } -/** Get the text in the entry */ -const char * -Text::getText() const +const char *Text::getText() const { g_assert(_widget != NULL); return static_cast<Gtk::Entry*>(_widget)->get_text().c_str(); } -/** Sets the text of the text entry */ -void -Text::setText(const char* text) +void Text::setText(const char* text) { g_assert(_widget != NULL); setProgrammatically = true; // callback is supposed to reset back, if it cares static_cast<Gtk::Entry*>(_widget)->set_text(text); // FIXME: set correctly } -/** Signal raised when the spin button's value changes */ -Glib::SignalProxy0<void> -Text::signal_activate() +Glib::SignalProxy0<void> Text::signal_activate() { return static_cast<Gtk::Entry*>(_widget)->signal_activate(); } diff --git a/src/ui/widget/text.h b/src/ui/widget/text.h index bccaefa2e..0f6efd01f 100644 --- a/src/ui/widget/text.h +++ b/src/ui/widget/text.h @@ -26,18 +26,38 @@ namespace Widget { class Text : public Labelled { public: + + /** + * Construct a Text Widget. + * + * @param label Label. + * @param suffix Suffix, placed after the widget (defaults to ""). + * @param icon Icon filename, placed before the label (defaults to ""). + * @param mnemonic Mnemonic toggle; if true, an underscore (_) in the label + * indicates the next character should be used for the + * mnemonic accelerator key (defaults to false). + */ Text(Glib::ustring const &label, Glib::ustring const &tooltip, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", bool mnemonic = true); + /** + * Get the text in the entry. + */ const char* getText() const; + /** + * Sets the text of the text entry. + */ void setText(const char* text); void update(); + /** + * Signal raised when the spin button's value changes. + */ Glib::SignalProxy0<void> signal_activate(); bool setProgrammatically; // true if the value was set by setValue, not changed by the user; diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index 51e0a262f..40f58f0ae 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -1,7 +1,4 @@ -/** \file - * - Implementation of tolerance slider widget. - * +/* * Authors: * Ralf Stephan <ralf@ark.in-berlin.de> * Abhishek Sharma diff --git a/src/ui/widget/tolerance-slider.h b/src/ui/widget/tolerance-slider.h index 22c04d361..0a9663bc3 100644 --- a/src/ui/widget/tolerance-slider.h +++ b/src/ui/widget/tolerance-slider.h @@ -1,8 +1,3 @@ -/** \file - * \brief - * - * This widget is part of the Document properties dialog. - */ /* * Authors: * Ralf Stephan <ralf@ark.in-berlin.de> @@ -27,6 +22,10 @@ namespace Widget { class Registry; +/** + * Implementation of tolerance slider widget. + * This widget is part of the Document properties dialog. + */ class ToleranceSlider { public: ToleranceSlider(); diff --git a/src/ui/widget/toolbox.cpp b/src/ui/widget/toolbox.cpp index 41a13f4e9..99891fc44 100644 --- a/src/ui/widget/toolbox.cpp +++ b/src/ui/widget/toolbox.cpp @@ -1,6 +1,4 @@ -/** - * Toolbox Widget - A detachable toolbar for buttons and other widgets. - * +/* * Author: * Derek P. Moore <derekm@hackunix.org> * diff --git a/src/ui/widget/unit-menu.cpp b/src/ui/widget/unit-menu.cpp index bb0b65576..085783481 100644 --- a/src/ui/widget/unit-menu.cpp +++ b/src/ui/widget/unit-menu.cpp @@ -1,6 +1,4 @@ -/** - * Unit Menu Widget - A drop down menu for choosing unit types. - * +/* * Author: * Bryce Harrington <bryce@bryceharrington.org> * @@ -21,10 +19,6 @@ namespace Inkscape { namespace UI { namespace Widget { -/** - * Construct a UnitMenu - * - */ UnitMenu::UnitMenu() : _type(UNIT_TYPE_NONE) { set_active(0); @@ -33,14 +27,9 @@ UnitMenu::UnitMenu() : _type(UNIT_TYPE_NONE) UnitMenu::~UnitMenu() { } -/** Adds the unit type to the widget. This extracts the corresponding - units from the unit map matching the given type, and appends them - to the dropdown widget. It causes the primary unit for the given - unit_type to be selected. */ -bool -UnitMenu::setUnitType(UnitType unit_type) +bool UnitMenu::setUnitType(UnitType unit_type) { - /* Expand the unit widget with unit entries from the unit table */ + // Expand the unit widget with unit entries from the unit table UnitTable::UnitMap m = _unit_table.units(unit_type); UnitTable::UnitMap::iterator iter = m.begin(); while(iter != m.end()) { @@ -54,31 +43,21 @@ UnitMenu::setUnitType(UnitType unit_type) return true; } -/** Removes all unit entries, then adds the unit type to the widget. - This extracts the corresponding - units from the unit map matching the given type, and appends them - to the dropdown widget. It causes the primary unit for the given - unit_type to be selected. */ -bool -UnitMenu::resetUnitType(UnitType unit_type) +bool UnitMenu::resetUnitType(UnitType unit_type) { clear_text(); return setUnitType(unit_type); } -/** Adds a unit, possibly user-defined, to the menu. */ -void -UnitMenu::addUnit(Unit const& u) +void UnitMenu::addUnit(Unit const& u) { _unit_table.addUnit(u, false); append_text(u.abbr); } -/** Returns the Unit object corresponding to the current selection - in the dropdown widget */ -Unit -UnitMenu::getUnit() const { +Unit UnitMenu::getUnit() const +{ if (get_active_text() == "") { g_assert(_type != UNIT_TYPE_NONE); return _unit_table.getUnit(_unit_table.primary(_type)); @@ -86,11 +65,8 @@ UnitMenu::getUnit() const { return _unit_table.getUnit(get_active_text()); } -/** Sets the dropdown widget to the given unit abbreviation. - Returns true if the unit was selectable, false if not - (i.e., if the unit was not present in the widget) */ -bool -UnitMenu::setUnit(Glib::ustring const & unit) { +bool UnitMenu::setUnit(Glib::ustring const & unit) +{ // TODO: Determine if 'unit' is available in the dropdown. // If not, return false @@ -98,63 +74,41 @@ UnitMenu::setUnit(Glib::ustring const & unit) { return true; } -/** Returns the abbreviated unit name of the selected unit */ -Glib::ustring -UnitMenu::getUnitAbbr() const { +Glib::ustring UnitMenu::getUnitAbbr() const +{ if (get_active_text() == "") { return ""; } return getUnit().abbr; } -/** Returns the UnitType of the selected unit */ -UnitType -UnitMenu::getUnitType() const { +UnitType UnitMenu::getUnitType() const +{ return getUnit().type; } -/** Returns the unit factor for the selected unit */ -double -UnitMenu::getUnitFactor() const +double UnitMenu::getUnitFactor() const { return getUnit().factor; } -/** Returns the recommended number of digits for displaying - * numbers of this unit type. - */ -int -UnitMenu::getDefaultDigits() const +int UnitMenu::getDefaultDigits() const { return getUnit().defaultDigits(); } -/** Returns the recommended step size in spin buttons - * displaying units of this type - */ -double -UnitMenu::getDefaultStep() const +double UnitMenu::getDefaultStep() const { int factor_digits = -1*int(log10(getUnit().factor)); return pow(10.0, factor_digits); } -/** Returns the recommended page size (when hitting pgup/pgdn) - * in spin buttons displaying units of this type - */ -double -UnitMenu::getDefaultPage() const +double UnitMenu::getDefaultPage() const { return 10 * getDefaultStep(); } -/** - * Returns the conversion factor required to convert values - * of the currently selected unit into units of type - * new_unit_abbr. - */ -double -UnitMenu::getConversion(Glib::ustring const &new_unit_abbr, Glib::ustring const &old_unit_abbr) const +double UnitMenu::getConversion(Glib::ustring const &new_unit_abbr, Glib::ustring const &old_unit_abbr) const { double old_factor = getUnit().factor; if (old_unit_abbr != "no_unit") @@ -171,18 +125,13 @@ UnitMenu::getConversion(Glib::ustring const &new_unit_abbr, Glib::ustring const return old_factor / new_unit.factor; } -/** Returns true if the selected unit is not dimensionless - * (false for %, true for px, pt, cm, etc) - */ -bool -UnitMenu::isAbsolute() const { +bool UnitMenu::isAbsolute() const +{ return getUnitType() != UNIT_TYPE_DIMENSIONLESS; } -/** Returns true if the selected unit is radial (deg or rad) - */ -bool -UnitMenu::isRadial() const { +bool UnitMenu::isRadial() const +{ return getUnitType() == UNIT_TYPE_RADIAL; } diff --git a/src/ui/widget/unit-menu.h b/src/ui/widget/unit-menu.h index cb11bbb30..61e93bd65 100644 --- a/src/ui/widget/unit-menu.h +++ b/src/ui/widget/unit-menu.h @@ -25,27 +25,98 @@ namespace Widget { class UnitMenu : public ComboText { public: + + /** + * Construct a UnitMenu + */ UnitMenu(); + virtual ~UnitMenu(); + /** + * Adds the unit type to the widget. This extracts the corresponding + * units from the unit map matching the given type, and appends them + * to the dropdown widget. It causes the primary unit for the given + * unit_type to be selected. + */ bool setUnitType(UnitType unit_type); + + /** + * Removes all unit entries, then adds the unit type to the widget. + * This extracts the corresponding + * units from the unit map matching the given type, and appends them + * to the dropdown widget. It causes the primary unit for the given + * unit_type to be selected. + */ bool resetUnitType(UnitType unit_type); + + /** + * Adds a unit, possibly user-defined, to the menu. + */ void addUnit(Unit const& u); + /** + * Sets the dropdown widget to the given unit abbreviation. + * Returns true if the unit was selectable, false if not + * (i.e., if the unit was not present in the widget). + */ bool setUnit(Glib::ustring const &unit); + /** + * Returns the Unit object corresponding to the current selection + * in the dropdown widget. + */ Unit getUnit() const; + + /** + * Returns the abbreviated unit name of the selected unit. + */ Glib::ustring getUnitAbbr() const; + + /** + * Returns the UnitType of the selected unit. + */ UnitType getUnitType() const; + + /** + * Returns the unit factor for the selected unit. + */ double getUnitFactor() const; + /** + * Returns the recommended number of digits for displaying + * numbers of this unit type. + */ int getDefaultDigits() const; + + /** + * Returns the recommended step size in spin buttons + * displaying units of this type. + */ double getDefaultStep() const; + + /** + * Returns the recommended page size (when hitting pgup/pgdn) + * in spin buttons displaying units of this type. + */ double getDefaultPage() const; + /** + * Returns the conversion factor required to convert values + * of the currently selected unit into units of type + * new_unit_abbr. + */ double getConversion(Glib::ustring const &new_unit_abbr, Glib::ustring const &old_unit_abbr = "no_unit") const; + /** + * Returns true if the selected unit is not dimensionless + * (false for %, true for px, pt, cm, etc). + */ bool isAbsolute() const; + + /** + * Returns true if the selected unit is radial (deg or rad). + */ bool isRadial() const; UnitTable &getUnitTable() {return _unit_table;} diff --git a/src/ui/widget/zoom-status.cpp b/src/ui/widget/zoom-status.cpp index c6d6f19a3..fa8191671 100644 --- a/src/ui/widget/zoom-status.cpp +++ b/src/ui/widget/zoom-status.cpp @@ -1,7 +1,4 @@ -/** \file - * Gtkmm facade/wrapper around zoom_status code that formerly lived - * in desktop-widget.cpp - * +/* * Authors: * Ralf Stephan <ralf@ark.in-berlin.de> * Lauris Kaplinski <lauris@kaplinski.com> |
