1 /** @file
2 * @brief Inkscape Preferences dialog
3 */
4 /* Authors:
5 * Carl Hetherington
6 * Marco Scholten
7 * Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
8 * Bruno Dilly <bruno.dilly@gmail.com>
9 *
10 * Copyright (C) 2004-2007 Authors
11 *
12 * Released under GNU GPL. Read the file 'COPYING' for more information.
13 */
15 #ifndef INKSCAPE_UI_DIALOG_INKSCAPE_PREFERENCES_H
16 #define INKSCAPE_UI_DIALOG_INKSCAPE_PREFERENCES_H
18 #include <iostream>
19 #include <vector>
20 #include <gtkmm/base.h>
21 #include <gtkmm/table.h>
22 #include <gtkmm/colorbutton.h>
23 #include <gtkmm/comboboxtext.h>
24 #include <gtkmm/spinbutton.h>
25 #include <gtkmm/treestore.h>
26 #include <gtkmm/treeview.h>
27 #include <gtkmm/radiobutton.h>
28 #include <gtkmm/frame.h>
29 #include <gtkmm/notebook.h>
30 #include "ui/widget/preferences-widget.h"
31 #include <sigc++/sigc++.h>
32 #include <glibmm/i18n.h>
34 #include "ui/widget/panel.h"
36 // UPDATE THIS IF YOU'RE ADDING PREFS PAGES.
37 // Otherwise the commands that open the dialog with the new page will fail.
39 enum {
40 PREFS_PAGE_TOOLS,
41 PREFS_PAGE_TOOLS_SELECTOR,
42 PREFS_PAGE_TOOLS_NODE,
43 PREFS_PAGE_TOOLS_TWEAK,
44 PREFS_PAGE_TOOLS_ZOOM,
45 PREFS_PAGE_TOOLS_SHAPES,
46 PREFS_PAGE_TOOLS_SHAPES_RECT,
47 PREFS_PAGE_TOOLS_SHAPES_3DBOX,
48 PREFS_PAGE_TOOLS_SHAPES_ELLIPSE,
49 PREFS_PAGE_TOOLS_SHAPES_STAR,
50 PREFS_PAGE_TOOLS_SHAPES_SPIRAL,
51 PREFS_PAGE_TOOLS_PENCIL,
52 PREFS_PAGE_TOOLS_PEN,
53 PREFS_PAGE_TOOLS_CALLIGRAPHY,
54 PREFS_PAGE_TOOLS_PAINTBUCKET,
55 PREFS_PAGE_TOOLS_ERASER,
56 PREFS_PAGE_TOOLS_LPETOOL,
57 PREFS_PAGE_TOOLS_TEXT,
58 PREFS_PAGE_TOOLS_GRADIENT,
59 PREFS_PAGE_TOOLS_CONNECTOR,
60 PREFS_PAGE_TOOLS_DROPPER,
61 PREFS_PAGE_SELECTING,
62 PREFS_PAGE_TRANSFORMS,
63 PREFS_PAGE_CLONES,
64 PREFS_PAGE_MASKS,
65 PREFS_PAGE_FILTERS,
66 PREFS_PAGE_BITMAPS,
67 PREFS_PAGE_CMS,
68 PREFS_PAGE_GRIDS,
69 PREFS_PAGE_SVGOUTPUT,
70 PREFS_PAGE_AUTOSAVE,
71 PREFS_PAGE_IMPORTEXPORT,
72 PREFS_PAGE_UI,
73 PREFS_PAGE_MOUSE,
74 PREFS_PAGE_SCROLLING,
75 PREFS_PAGE_SNAPPING,
76 PREFS_PAGE_STEPS,
77 PREFS_PAGE_WINDOWS,
78 PREFS_PAGE_MISC
79 };
81 using namespace Inkscape::UI::Widget;
83 namespace Inkscape {
84 namespace UI {
85 namespace Dialog {
87 class InkscapePreferences : public UI::Widget::Panel {
88 public:
89 virtual ~InkscapePreferences();
91 static InkscapePreferences &getInstance() { return *new InkscapePreferences(); }
93 protected:
94 Gtk::Frame _page_frame;
95 Gtk::Label _page_title;
96 Gtk::TreeView _page_list;
97 Glib::RefPtr<Gtk::TreeStore> _page_list_model;
99 //Pagelist model columns:
100 class PageListModelColumns : public Gtk::TreeModel::ColumnRecord
101 {
102 public:
103 PageListModelColumns()
104 { Gtk::TreeModelColumnRecord::add(_col_name); Gtk::TreeModelColumnRecord::add(_col_page); Gtk::TreeModelColumnRecord::add(_col_id); }
105 Gtk::TreeModelColumn<Glib::ustring> _col_name;
106 Gtk::TreeModelColumn<int> _col_id;
107 Gtk::TreeModelColumn<DialogPage*> _col_page;
108 };
109 PageListModelColumns _page_list_columns;
111 Gtk::TreeModel::Path _path_tools;
112 Gtk::TreeModel::Path _path_shapes;
114 DialogPage _page_mouse, _page_scrolling, _page_snapping, _page_steps, _page_tools, _page_windows,
115 _page_clones, _page_mask, _page_transforms, _page_filters, _page_select,
116 _page_importexport, _page_cms, _page_grids, _page_svgoutput, _page_misc,
117 _page_ui, _page_autosave, _page_bitmaps;
118 DialogPage _page_selector, _page_node, _page_tweak, _page_zoom, _page_shapes, _page_pencil, _page_pen,
119 _page_calligraphy, _page_text, _page_gradient, _page_connector, _page_dropper, _page_lpetool;
120 DialogPage _page_rectangle, _page_3dbox, _page_ellipse, _page_star, _page_spiral, _page_paintbucket, _page_eraser;
122 PrefSpinButton _mouse_sens, _mouse_thres;
123 PrefCheckButton _mouse_use_ext_input;
124 PrefCheckButton _mouse_switch_on_ext_input;
126 PrefSpinButton _scroll_wheel, _scroll_arrow_px, _scroll_arrow_acc, _scroll_auto_speed, _scroll_auto_thres;
127 PrefCheckButton _scroll_space;
128 PrefCheckButton _wheel_zoom;
130 Gtk::HScale *_slider_snapping_delay;
131 PrefCheckButton _snap_indicator, _snap_closest_only;
133 PrefCombo _steps_rot_snap;
134 PrefCheckButton _steps_compass;
135 PrefSpinButton _steps_arrow, _steps_scale, _steps_inset, _steps_zoom;
137 PrefRadioButton _t_sel_trans_obj, _t_sel_trans_outl, _t_sel_cue_none, _t_sel_cue_mark,
138 _t_sel_cue_box, _t_bbox_visual, _t_bbox_geometric;
139 PrefCheckButton _t_cvg_keep_objects, _t_cvg_convert_whole_groups;
140 PrefCheckButton _t_node_pathflash_enabled;
141 PrefSpinButton _t_node_pathflash_timeout;
142 PrefColorPicker _t_node_pathoutline_color;
144 PrefRadioButton _win_dockable, _win_floating;
145 PrefRadioButton _win_ontop_none, _win_ontop_normal, _win_ontop_agressive;
146 PrefRadioButton _win_save_geom_off, _win_save_geom, _win_save_geom_prefs;
147 PrefCheckButton _win_hide_task, _win_zoom_resize , _win_show_close;
148 PrefSpinButton _win_trans_focus; /**< The dialog transparency setting for when the dialog is focused. */
149 PrefSpinButton _win_trans_blur; /**< The dialog transparency setting for when the dialog is out of focus. */
150 PrefSpinButton _win_trans_time; /**< How much time to go from one transparency setting to another */
152 PrefCheckButton _calligrapy_use_abs_size;
153 PrefCheckButton _calligrapy_keep_selected;
155 PrefCheckButton _connector_ignore_text;
157 PrefRadioButton _clone_option_parallel, _clone_option_stay, _clone_option_transform,
158 _clone_option_unlink, _clone_option_delete;
159 PrefCheckButton _clone_relink_on_duplicate;
161 PrefCheckButton _mask_mask_on_top;
162 PrefCheckButton _mask_mask_remove;
164 PrefRadioButton _blur_quality_best, _blur_quality_better, _blur_quality_normal, _blur_quality_worse, _blur_quality_worst;
165 PrefRadioButton _filter_quality_best, _filter_quality_better, _filter_quality_normal, _filter_quality_worse, _filter_quality_worst;
166 PrefCheckButton _show_filters_info_box;
168 PrefCheckButton _trans_scale_stroke, _trans_scale_corner, _trans_gradient,_trans_pattern;
169 PrefRadioButton _trans_optimized, _trans_preserved;
171 PrefRadioButton _sel_all;
172 PrefRadioButton _sel_current;
173 PrefRadioButton _sel_recursive;
174 PrefCheckButton _sel_hidden, _sel_locked;
175 PrefCheckButton _sel_layer_deselects;
177 PrefSpinButton _importexport_export, _misc_recent, _misc_simpl;
178 ZoomCorrRulerSlider _ui_zoom_correction;
179 PrefSlider _snap_delay, _snap_weight;
180 PrefSpinButton _misc_latency_skew;
181 PrefCheckButton _misc_comment, _misc_forkvectors, _misc_scripts, _misc_namedicon_delay;
182 PrefCombo _misc_small_toolbar;
183 PrefCombo _misc_small_secondary;
184 PrefCombo _misc_small_tools;
185 PrefCombo _misc_overs_bitmap;
186 PrefCombo _misc_bitmap_editor;
187 PrefCheckButton _misc_bitmap_autoreload;
188 PrefSpinButton _bitmap_copy_res;
190 PrefCheckButton _autosave_autosave_enable;
191 PrefSpinButton _autosave_autosave_interval;
192 PrefEntry _autosave_autosave_path;
193 PrefSpinButton _autosave_autosave_max;
195 Gtk::ComboBoxText _cms_display_profile;
196 PrefCheckButton _cms_from_display;
197 PrefCombo _cms_intent;
199 PrefCheckButton _cms_softproof;
200 PrefCheckButton _cms_gamutwarn;
201 Gtk::ColorButton _cms_gamutcolor;
202 Gtk::ComboBoxText _cms_proof_profile;
203 PrefCombo _cms_proof_intent;
204 PrefCheckButton _cms_proof_blackpoint;
205 PrefCheckButton _cms_proof_preserveblack;
207 Gtk::Notebook _grids_notebook;
208 PrefCheckButton _grids_no_emphasize_on_zoom;
209 DialogPage _grids_xy, _grids_axonom;
210 // CanvasXYGrid properties:
211 PrefUnit _grids_xy_units;
212 PrefSpinButton _grids_xy_origin_x;
213 PrefSpinButton _grids_xy_origin_y;
214 PrefSpinButton _grids_xy_spacing_x;
215 PrefSpinButton _grids_xy_spacing_y;
216 PrefColorPicker _grids_xy_color;
217 PrefColorPicker _grids_xy_empcolor;
218 PrefSpinButton _grids_xy_empspacing;
219 PrefCheckButton _grids_xy_dotted;
220 // CanvasAxonomGrid properties:
221 PrefUnit _grids_axonom_units;
222 PrefSpinButton _grids_axonom_origin_x;
223 PrefSpinButton _grids_axonom_origin_y;
224 PrefSpinButton _grids_axonom_spacing_y;
225 PrefSpinButton _grids_axonom_angle_x;
226 PrefSpinButton _grids_axonom_angle_z;
227 PrefColorPicker _grids_axonom_color;
228 PrefColorPicker _grids_axonom_empcolor;
229 PrefSpinButton _grids_axonom_empspacing;
231 // SVG Output page:
232 PrefCheckButton _svgoutput_usenamedcolors;
233 PrefSpinButton _svgoutput_numericprecision;
234 PrefSpinButton _svgoutput_minimumexponent;
235 PrefCheckButton _svgoutput_inlineattrs;
236 PrefSpinButton _svgoutput_indent;
237 PrefCheckButton _svgoutput_allowrelativecoordinates;
238 PrefCheckButton _svgoutput_forcerepeatcommands;
240 PrefEntryButtonHBox _importexport_ocal_url;
241 PrefEntry _importexport_ocal_username;
242 PrefEntry _importexport_ocal_password;
244 int _max_dialog_width;
245 int _max_dialog_height;
246 int _sb_width;
247 DialogPage* _current_page;
249 Gtk::TreeModel::iterator AddPage(DialogPage& p, Glib::ustring title, int id);
250 Gtk::TreeModel::iterator AddPage(DialogPage& p, Glib::ustring title, Gtk::TreeModel::iterator parent, int id);
251 bool SetMaxDialogSize(const Gtk::TreeModel::iterator& iter);
252 bool PresentPage(const Gtk::TreeModel::iterator& iter);
254 static void AddSelcueCheckbox(DialogPage& p, Glib::ustring const &prefs_path, bool def_value);
255 static void AddGradientCheckbox(DialogPage& p, Glib::ustring const &prefs_path, bool def_value);
256 static void AddConvertGuidesCheckbox(DialogPage& p, Glib::ustring const &prefs_path, bool def_value);
257 static void AddDotSizeSpinbutton(DialogPage& p, Glib::ustring const &prefs_path, double def_value);
258 static void AddNewObjectsStyle(DialogPage& p, Glib::ustring const &prefs_path, const gchar* banner = NULL);
260 void on_pagelist_selection_changed();
261 void initPageMouse();
262 void initPageScrolling();
263 void initPageSnapping();
264 void initPageSteps();
265 void initPageTools();
266 void initPageWindows();
267 void initPageClones();
268 void initPageMasks();
269 void initPageTransforms();
270 void initPageFilters();
271 void initPageSelecting();
272 void initPageImportExport();
273 void initPageCMS();
274 void initPageGrids();
275 void initPageSVGOutput();
276 void initPageUI();
277 void initPageAutosave();
278 void initPageBitmaps();
279 void initPageMisc();
281 void _presentPages();
283 private:
284 InkscapePreferences();
285 InkscapePreferences(InkscapePreferences const &d);
286 InkscapePreferences operator=(InkscapePreferences const &d);
287 };
289 } // namespace Dialog
290 } // namespace UI
291 } // namespace Inkscape
293 #endif //INKSCAPE_UI_DIALOG_INKSCAPE_PREFERENCES_H
295 /*
296 Local Variables:
297 mode:c++
298 c-file-style:"stroustrup"
299 c-file-offsets:((innamespace . 0)(inline-open . 0))
300 indent-tabs-mode:nil
301 fill-column:99
302 End:
303 */
304 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :