From 0e3011704642c7048ef446bbbf82d3767ef5cab1 Mon Sep 17 00:00:00 2001 From: keescook Date: Sun, 30 Dec 2007 02:05:21 +0000 Subject: [PATCH] beautify rendering options tab --- src/ui/widget/rendering-options.cpp | 81 ++++++++++++++++++----------- src/ui/widget/rendering-options.h | 20 ++++--- 2 files changed, 66 insertions(+), 35 deletions(-) diff --git a/src/ui/widget/rendering-options.cpp b/src/ui/widget/rendering-options.cpp index 9ea7c07bd..1a1e60052 100644 --- a/src/ui/widget/rendering-options.cpp +++ b/src/ui/widget/rendering-options.cpp @@ -23,6 +23,12 @@ namespace Inkscape { namespace UI { namespace Widget { +void +RenderingOptions::_toggled() +{ + _frame_bitmap.set_sensitive(as_bitmap()); +} + /** * Construct a Rendering Options widget * @@ -30,45 +36,62 @@ namespace Widget { RenderingOptions::RenderingOptions () : Gtk::VBox (), - //Labelled(label, tooltip, new Gtk::VBox(), suffix, icon, mnemonic), - _radio_cairo ( new Gtk::RadioButton () ), - //_radio_bitmap( new Gtk::RadioButton (_radio_cairo->get_group ()), - _radio_bitmap( new Gtk::RadioButton () ), - _widget_cairo( Glib::ustring(_("_Vector")), - Glib::ustring(_("Render using Cairo vector operations. The resulting image is usually smaller in file " + _radio_vector ( Glib::ustring(_("Vector")) ), + _radio_bitmap ( Glib::ustring(_("Bitmap")) ), + _frame_backends ( Glib::ustring(_("Backend")) ), + _frame_bitmap ( Glib::ustring(_("Bitmap options")) ), + _dpi( _("DPI"), + Glib::ustring(_("Preferred resolution of rendering, " + "in dots per inch.")), + 1, + Glib::ustring(""), Glib::ustring(""), + false) +{ + // set up tooltips + _tt.set_tip (_radio_vector, Glib::ustring( + _("Render using Cairo vector operations. " + "The resulting image is usually smaller in file " "size and can be arbitrarily scaled, but some " - "filter effects will not be correctly rendered.")), - _radio_cairo, - Glib::ustring(""), Glib::ustring(""), - true), - _widget_bitmap(Glib::ustring(_("_Bitmap")), - Glib::ustring(_("Render everything as bitmap. The resulting image " + "filter effects will not be correctly rendered."))); + _tt.set_tip (_radio_bitmap, Glib::ustring( + _("Render everything as bitmap. The resulting image " "is usually larger in file size and cannot be " "arbitrarily scaled without quality loss, but all " - "objects will be rendered exactly as displayed.")), - _radio_bitmap, - Glib::ustring(""), Glib::ustring(""), - true), - _dpi( _("DPI"), Glib::ustring(_("Preferred resolution of rendering, in dots per inch.")), - 1, - Glib::ustring(""), Glib::ustring(""), - false) -{ + "objects will be rendered exactly as displayed."))); + set_border_width(2); - // default to cairo operations - _radio_cairo->set_active (true); - Gtk::RadioButtonGroup group = _radio_cairo->get_group (); - _radio_bitmap->set_group (group); + // default to vector operations + _radio_vector.set_active (true); + Gtk::RadioButtonGroup group = _radio_vector.get_group (); + _radio_bitmap.set_group (group); + _radio_bitmap.signal_toggled().connect(sigc::mem_fun(*this, &RenderingOptions::_toggled)); // configure default DPI _dpi.setRange(PT_PER_IN,2400.0); _dpi.setValue(PT_PER_IN); + _dpi.setIncrements(1.0,10.0); + _dpi.setDigits(0); + _dpi.update(); + + // fill frames + Gtk::VBox *box_vector = Gtk::manage( new Gtk::VBox () ); + box_vector->set_border_width (2); + box_vector->add (_radio_vector); + box_vector->add (_radio_bitmap); + _frame_backends.add (*box_vector); + + Gtk::HBox *box_bitmap = Gtk::manage( new Gtk::HBox () ); + box_bitmap->set_border_width (2); + box_bitmap->add (_dpi); + _frame_bitmap.add (*box_bitmap); // fill up container - add (_widget_cairo); - add (_widget_bitmap); - add (_dpi); + add (_frame_backends); + add (_frame_bitmap); + + // initialize states + _toggled(); show_all_children (); } @@ -76,7 +99,7 @@ RenderingOptions::RenderingOptions () : bool RenderingOptions::as_bitmap () { - return _radio_bitmap->get_active(); + return _radio_bitmap.get_active(); } double diff --git a/src/ui/widget/rendering-options.h b/src/ui/widget/rendering-options.h index 41134b814..964ffca57 100644 --- a/src/ui/widget/rendering-options.h +++ b/src/ui/widget/rendering-options.h @@ -13,7 +13,7 @@ #ifndef INKSCAPE_UI_WIDGET_RENDERING_OPTIONS_H #define INKSCAPE_UI_WIDGET_RENDERING_OPTIONS_H -#include "labelled.h" +#include #include "scalar.h" namespace Inkscape { @@ -30,11 +30,19 @@ public: protected: // Radio buttons to select desired rendering - Gtk::RadioButton *_radio_cairo; - Gtk::RadioButton *_radio_bitmap; - Labelled _widget_cairo; - Labelled _widget_bitmap; - Scalar _dpi; // DPI of bitmap to render + Gtk::Frame _frame_backends; + Gtk::RadioButton _radio_vector; + Gtk::RadioButton _radio_bitmap; + + // Bitmap options + Gtk::Frame _frame_bitmap; + Scalar _dpi; // DPI of bitmap to render + + // Tooltip manager + Gtk::Tooltips _tt; + + // callback for bitmap button + void _toggled(); }; } // namespace Widget -- 2.30.2