1 /**
2 * \brief Rendering options widget
3 *
4 * Author:
5 * Kees Cook <kees@outflux.net>
6 *
7 * Copyright (C) 2007 Kees Cook
8 * Copyright (C) 2004 Bryce Harrington
9 *
10 * Released under GNU GPL. Read the file 'COPYING' for more information
11 */
13 #ifdef HAVE_CONFIG_H
14 # include <config.h>
15 #endif
17 #include <glibmm/i18n.h>
19 #include "unit-constants.h"
20 #include "rendering-options.h"
22 namespace Inkscape {
23 namespace UI {
24 namespace Widget {
26 void
27 RenderingOptions::_toggled()
28 {
29 _frame_bitmap.set_sensitive(as_bitmap());
30 }
32 /**
33 * Construct a Rendering Options widget
34 *
35 */
37 RenderingOptions::RenderingOptions () :
38 Gtk::VBox (),
39 _frame_backends ( Glib::ustring(_("Backend")) ),
40 _radio_vector ( Glib::ustring(_("Vector")) ),
41 _radio_bitmap ( Glib::ustring(_("Bitmap")) ),
42 _frame_bitmap ( Glib::ustring(_("Bitmap options")) ),
43 _dpi( _("DPI"),
44 Glib::ustring(_("Preferred resolution of rendering, "
45 "in dots per inch.")),
46 1,
47 Glib::ustring(""), Glib::ustring(""),
48 false)
49 {
50 // set up tooltips
51 _tt.set_tip (_radio_vector, Glib::ustring(
52 _("Render using Cairo vector operations. "
53 "The resulting image is usually smaller in file "
54 "size and can be arbitrarily scaled, but some "
55 "filter effects will not be correctly rendered.")));
56 _tt.set_tip (_radio_bitmap, Glib::ustring(
57 _("Render everything as bitmap. The resulting image "
58 "is usually larger in file size and cannot be "
59 "arbitrarily scaled without quality loss, but all "
60 "objects will be rendered exactly as displayed.")));
62 set_border_width(2);
64 // default to vector operations
65 _radio_vector.set_active (true);
66 Gtk::RadioButtonGroup group = _radio_vector.get_group ();
67 _radio_bitmap.set_group (group);
68 _radio_bitmap.signal_toggled().connect(sigc::mem_fun(*this, &RenderingOptions::_toggled));
70 // configure default DPI
71 _dpi.setRange(PT_PER_IN,2400.0);
72 _dpi.setValue(PT_PER_IN);
73 _dpi.setIncrements(1.0,10.0);
74 _dpi.setDigits(0);
75 _dpi.update();
77 // fill frames
78 Gtk::VBox *box_vector = Gtk::manage( new Gtk::VBox () );
79 box_vector->set_border_width (2);
80 box_vector->add (_radio_vector);
81 box_vector->add (_radio_bitmap);
82 _frame_backends.add (*box_vector);
84 Gtk::HBox *box_bitmap = Gtk::manage( new Gtk::HBox () );
85 box_bitmap->set_border_width (2);
86 box_bitmap->add (_dpi);
87 _frame_bitmap.add (*box_bitmap);
89 // fill up container
90 add (_frame_backends);
91 add (_frame_bitmap);
93 // initialize states
94 _toggled();
96 show_all_children ();
97 }
99 bool
100 RenderingOptions::as_bitmap ()
101 {
102 return _radio_bitmap.get_active();
103 }
105 double
106 RenderingOptions::bitmap_dpi ()
107 {
108 return _dpi.getValue();
109 }
111 } // namespace Widget
112 } // namespace UI
113 } // namespace Inkscape
115 /*
116 Local Variables:
117 mode:c++
118 c-file-style:"stroustrup"
119 c-file-offsets:((innamespace . 0)(inline-open . 0))
120 indent-tabs-mode:nil
121 fill-column:99
122 End:
123 */
124 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :