Code

Implement cross-architecture print dialog using cairo and PNG backends.
[inkscape.git] / src / ui / widget / rendering-options.cpp
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 /**
27  *    Construct a Rendering Options widget
28  *
29  */
30   
31 RenderingOptions::RenderingOptions () :
32       Gtk::VBox (),
33       //Labelled(label, tooltip, new Gtk::VBox(), suffix, icon, mnemonic),
34       _radio_cairo ( new Gtk::RadioButton () ),
35       //_radio_bitmap( new Gtk::RadioButton (_radio_cairo->get_group ()), 
36       _radio_bitmap( new Gtk::RadioButton () ),
37       _widget_cairo( Glib::ustring(_("_Cairo")),
38                      Glib::ustring(_("Render using Cairo vector operations.  The resulting image is usually smaller in file "
39                         "size and can be arbitrarily scaled, but some "
40                         "filter effects will not be correctly rendered.")),
41                      _radio_cairo,
42                      Glib::ustring(""), Glib::ustring(""),
43                      true),
44       _widget_bitmap(Glib::ustring(_("_Bitmap")),
45                      Glib::ustring(_("Render everything as bitmap.  The resulting image "
46                         "is usually larger in file size and cannot be "
47                         "arbitrarily scaled without quality loss, but all "
48                         "objects will be rendered exactly as displayed.")),
49                      _radio_bitmap,
50                      Glib::ustring(""), Glib::ustring(""),
51                      true),
52       _dpi( _("DPI"), Glib::ustring(_("Preferred resolution of rendering, in dots per inch.")),
53                      1,
54                      Glib::ustring(""), Glib::ustring(""),
55                      false)
56 {
57     set_border_width(2);
59     // default to cairo operations
60     _radio_cairo->set_active (true);
61     Gtk::RadioButtonGroup group = _radio_cairo->get_group ();
62     _radio_bitmap->set_group (group);
64     // configure default DPI
65     _dpi.setRange(PT_PER_IN,2400.0);
66     _dpi.setValue(PT_PER_IN);
68     // fill up container
69     add (_widget_cairo);
70     add (_widget_bitmap);
71     add (_dpi);
73     show_all_children ();
74 }
76 bool
77 RenderingOptions::as_bitmap ()
78 {
79     return _radio_bitmap->get_active();
80 }
82 double
83 RenderingOptions::bitmap_dpi ()
84 {
85     return _dpi.getValue();
86 }
88 } // namespace Widget
89 } // namespace UI
90 } // namespace Inkscape
92 /* 
93   Local Variables:
94   mode:c++
95   c-file-style:"stroustrup"
96   c-file-offsets:((innamespace . 0)(inline-open . 0))
97   indent-tabs-mode:nil
98   fill-column:99
99   End:
100 */
101 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :