0ba8c965d4ebfa26bed947cbc3d431c2d393944f
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>
33 #include <gtkmm/textview.h>
34 #include <gtkmm/scrolledwindow.h>
36 #include "ui/widget/panel.h"
38 // UPDATE THIS IF YOU'RE ADDING PREFS PAGES.
39 // Otherwise the commands that open the dialog with the new page will fail.
41 enum {
42 PREFS_PAGE_TOOLS,
43 PREFS_PAGE_TOOLS_SELECTOR,
44 PREFS_PAGE_TOOLS_NODE,
45 PREFS_PAGE_TOOLS_TWEAK,
46 PREFS_PAGE_TOOLS_SPRAY,
47 PREFS_PAGE_TOOLS_ZOOM,
48 PREFS_PAGE_TOOLS_SHAPES,
49 PREFS_PAGE_TOOLS_SHAPES_RECT,
50 PREFS_PAGE_TOOLS_SHAPES_3DBOX,
51 PREFS_PAGE_TOOLS_SHAPES_ELLIPSE,
52 PREFS_PAGE_TOOLS_SHAPES_STAR,
53 PREFS_PAGE_TOOLS_SHAPES_SPIRAL,
54 PREFS_PAGE_TOOLS_PENCIL,
55 PREFS_PAGE_TOOLS_PEN,
56 PREFS_PAGE_TOOLS_CALLIGRAPHY,
57 PREFS_PAGE_TOOLS_PAINTBUCKET,
58 PREFS_PAGE_TOOLS_ERASER,
59 PREFS_PAGE_TOOLS_LPETOOL,
60 PREFS_PAGE_TOOLS_TEXT,
61 PREFS_PAGE_TOOLS_GRADIENT,
62 PREFS_PAGE_TOOLS_CONNECTOR,
63 PREFS_PAGE_TOOLS_DROPPER,
64 PREFS_PAGE_SELECTING,
65 PREFS_PAGE_TRANSFORMS,
66 PREFS_PAGE_CLONES,
67 PREFS_PAGE_MASKS,
68 PREFS_PAGE_FILTERS,
69 PREFS_PAGE_BITMAPS,
70 PREFS_PAGE_CMS,
71 PREFS_PAGE_GRIDS,
72 PREFS_PAGE_SVGOUTPUT,
73 PREFS_PAGE_SAVE,
74 PREFS_PAGE_IMPORTEXPORT,
75 PREFS_PAGE_MOUSE,
76 PREFS_PAGE_SCROLLING,
77 PREFS_PAGE_SNAPPING,
78 PREFS_PAGE_STEPS,
79 PREFS_PAGE_UI,
80 PREFS_PAGE_WINDOWS,
81 PREFS_PAGE_SPELLCHECK,
82 PREFS_PAGE_MISC
83 };
85 using namespace Inkscape::UI::Widget;
87 namespace Inkscape {
88 namespace UI {
89 namespace Dialog {
91 class InkscapePreferences : public UI::Widget::Panel {
92 public:
93 virtual ~InkscapePreferences();
95 static InkscapePreferences &getInstance() { return *new InkscapePreferences(); }
97 protected:
98 Gtk::Frame _page_frame;
99 Gtk::Label _page_title;
100 Gtk::TreeView _page_list;
101 Glib::RefPtr<Gtk::TreeStore> _page_list_model;
103 //Pagelist model columns:
104 class PageListModelColumns : public Gtk::TreeModel::ColumnRecord
105 {
106 public:
107 PageListModelColumns()
108 { Gtk::TreeModelColumnRecord::add(_col_name); Gtk::TreeModelColumnRecord::add(_col_page); Gtk::TreeModelColumnRecord::add(_col_id); }
109 Gtk::TreeModelColumn<Glib::ustring> _col_name;
110 Gtk::TreeModelColumn<int> _col_id;
111 Gtk::TreeModelColumn<DialogPage*> _col_page;
112 };
113 PageListModelColumns _page_list_columns;
115 Gtk::TreeModel::Path _path_tools;
116 Gtk::TreeModel::Path _path_shapes;
118 DialogPage _page_mouse, _page_scrolling, _page_snapping, _page_steps, _page_tools, _page_windows,
119 _page_clones, _page_mask, _page_transforms, _page_filters, _page_select,
120 _page_importexport, _page_cms, _page_grids, _page_svgoutput, _page_misc,
121 _page_ui, _page_save, _page_bitmaps, _page_spellcheck;
122 DialogPage _page_selector, _page_node, _page_tweak, _page_spray, _page_zoom, _page_shapes, _page_pencil, _page_pen,
123 _page_calligraphy, _page_text, _page_gradient, _page_connector, _page_dropper, _page_lpetool;
124 DialogPage _page_rectangle, _page_3dbox, _page_ellipse, _page_star, _page_spiral, _page_paintbucket, _page_eraser;
126 PrefSpinButton _mouse_sens, _mouse_thres;
127 PrefCheckButton _mouse_use_ext_input;
128 PrefCheckButton _mouse_switch_on_ext_input;
130 PrefSpinButton _scroll_wheel, _scroll_arrow_px, _scroll_arrow_acc, _scroll_auto_speed, _scroll_auto_thres;
131 PrefCheckButton _scroll_space;
132 PrefCheckButton _wheel_zoom;
134 Gtk::HScale *_slider_snapping_delay;
135 PrefCheckButton _snap_indicator, _snap_closest_only, _snap_mouse_pointer;
137 PrefCombo _steps_rot_snap;
138 PrefCheckButton _steps_compass;
139 PrefSpinButton _steps_arrow, _steps_scale, _steps_inset, _steps_zoom;
141 PrefRadioButton _t_sel_trans_obj, _t_sel_trans_outl, _t_sel_cue_none, _t_sel_cue_mark,
142 _t_sel_cue_box, _t_bbox_visual, _t_bbox_geometric;
143 PrefCheckButton _t_cvg_keep_objects, _t_cvg_convert_whole_groups;
144 PrefCheckButton _t_node_show_outline;
145 PrefCheckButton _t_node_live_outline;
146 PrefCheckButton _t_node_live_objects;
147 PrefCheckButton _t_node_pathflash_enabled;
148 PrefCheckButton _t_node_pathflash_selected;
149 PrefSpinButton _t_node_pathflash_timeout;
150 PrefCheckButton _t_node_show_path_direction;
151 PrefCheckButton _t_node_single_node_transform_handles;
152 PrefCheckButton _t_node_delete_preserves_shape;
153 PrefColorPicker _t_node_pathoutline_color;
155 PrefRadioButton _win_dockable, _win_floating;
156 PrefRadioButton _win_ontop_none, _win_ontop_normal, _win_ontop_agressive;
157 PrefRadioButton _win_save_geom_off, _win_save_geom, _win_save_geom_prefs;
158 PrefCheckButton _win_hide_task, _win_zoom_resize , _win_show_close;
159 PrefSpinButton _win_trans_focus; /**< The dialog transparency setting for when the dialog is focused. */
160 PrefSpinButton _win_trans_blur; /**< The dialog transparency setting for when the dialog is out of focus. */
161 PrefSpinButton _win_trans_time; /**< How much time to go from one transparency setting to another */
163 PrefCheckButton _pencil_average_all_sketches;
165 PrefCheckButton _calligrapy_use_abs_size;
166 PrefCheckButton _calligrapy_keep_selected;
168 PrefCheckButton _connector_ignore_text;
170 PrefRadioButton _clone_option_parallel, _clone_option_stay, _clone_option_transform,
171 _clone_option_unlink, _clone_option_delete;
172 PrefCheckButton _clone_relink_on_duplicate;
174 PrefCheckButton _mask_mask_on_top;
175 PrefCheckButton _mask_mask_remove;
176 PrefRadioButton _mask_grouping_none, _mask_grouping_separate, _mask_grouping_all;
177 PrefCheckButton _mask_ungrouping;
179 PrefRadioButton _blur_quality_best, _blur_quality_better, _blur_quality_normal, _blur_quality_worse, _blur_quality_worst;
180 PrefRadioButton _filter_quality_best, _filter_quality_better, _filter_quality_normal, _filter_quality_worse, _filter_quality_worst;
181 PrefCheckButton _show_filters_info_box;
182 PrefSpinButton _filter_multi_threaded;
184 PrefCheckButton _trans_scale_stroke, _trans_scale_corner, _trans_gradient,_trans_pattern;
185 PrefRadioButton _trans_optimized, _trans_preserved;
187 PrefRadioButton _sel_all;
188 PrefRadioButton _sel_current;
189 PrefRadioButton _sel_recursive;
190 PrefCheckButton _sel_hidden, _sel_locked;
191 PrefCheckButton _sel_layer_deselects;
193 PrefSpinButton _importexport_export, _misc_simpl;
194 PrefSlider _snap_delay, _snap_weight;
195 PrefSpinButton _misc_latency_skew;
196 PrefCheckButton _misc_comment, _misc_forkvectors, _misc_scripts, _misc_namedicon_delay;
197 Gtk::TextView _misc_info;
198 Gtk::ScrolledWindow _misc_info_scroll;
201 // UI page
202 PrefCombo _ui_languages;
203 PrefCombo _misc_small_toolbar;
204 PrefCombo _misc_small_secondary;
205 PrefCombo _misc_small_tools;
206 PrefCheckButton _ui_colorsliders_top;
207 PrefSpinButton _misc_recent;
208 PrefCheckButton _ui_partialdynamic;
209 ZoomCorrRulerSlider _ui_zoom_correction;
211 //Spellcheck
212 PrefCombo _spell_language;
213 PrefCombo _spell_language2;
214 PrefCombo _spell_language3;
215 PrefCheckButton _spell_ignorenumbers;
216 PrefCheckButton _spell_ignoreallcaps;
218 PrefCombo _misc_overs_bitmap;
219 PrefCombo _misc_bitmap_editor;
220 PrefCheckButton _misc_bitmap_autoreload;
221 PrefSpinButton _bitmap_copy_res;
223 PrefCheckButton _save_use_current_dir;
224 PrefCheckButton _save_autosave_enable;
225 PrefSpinButton _save_autosave_interval;
226 PrefEntry _save_autosave_path;
227 PrefSpinButton _save_autosave_max;
229 Gtk::ComboBoxText _cms_display_profile;
230 PrefCheckButton _cms_from_display;
231 PrefCombo _cms_intent;
233 PrefCheckButton _cms_softproof;
234 PrefCheckButton _cms_gamutwarn;
235 Gtk::ColorButton _cms_gamutcolor;
236 Gtk::ComboBoxText _cms_proof_profile;
237 PrefCombo _cms_proof_intent;
238 PrefCheckButton _cms_proof_blackpoint;
239 PrefCheckButton _cms_proof_preserveblack;
241 Gtk::Notebook _grids_notebook;
242 PrefCheckButton _grids_no_emphasize_on_zoom;
243 DialogPage _grids_xy, _grids_axonom;
244 // CanvasXYGrid properties:
245 PrefUnit _grids_xy_units;
246 PrefSpinButton _grids_xy_origin_x;
247 PrefSpinButton _grids_xy_origin_y;
248 PrefSpinButton _grids_xy_spacing_x;
249 PrefSpinButton _grids_xy_spacing_y;
250 PrefColorPicker _grids_xy_color;
251 PrefColorPicker _grids_xy_empcolor;
252 PrefSpinButton _grids_xy_empspacing;
253 PrefCheckButton _grids_xy_dotted;
254 // CanvasAxonomGrid properties:
255 PrefUnit _grids_axonom_units;
256 PrefSpinButton _grids_axonom_origin_x;
257 PrefSpinButton _grids_axonom_origin_y;
258 PrefSpinButton _grids_axonom_spacing_y;
259 PrefSpinButton _grids_axonom_angle_x;
260 PrefSpinButton _grids_axonom_angle_z;
261 PrefColorPicker _grids_axonom_color;
262 PrefColorPicker _grids_axonom_empcolor;
263 PrefSpinButton _grids_axonom_empspacing;
265 // SVG Output page:
266 PrefCheckButton _svgoutput_usenamedcolors;
267 PrefSpinButton _svgoutput_numericprecision;
268 PrefSpinButton _svgoutput_minimumexponent;
269 PrefCheckButton _svgoutput_inlineattrs;
270 PrefSpinButton _svgoutput_indent;
271 PrefCheckButton _svgoutput_allowrelativecoordinates;
272 PrefCheckButton _svgoutput_forcerepeatcommands;
274 PrefEntryButtonHBox _importexport_ocal_url;
275 PrefEntry _importexport_ocal_username;
276 PrefEntry _importexport_ocal_password;
278 int _max_dialog_width;
279 int _max_dialog_height;
280 int _sb_width;
281 DialogPage* _current_page;
283 Gtk::TreeModel::iterator AddPage(DialogPage& p, Glib::ustring title, int id);
284 Gtk::TreeModel::iterator AddPage(DialogPage& p, Glib::ustring title, Gtk::TreeModel::iterator parent, int id);
285 bool SetMaxDialogSize(const Gtk::TreeModel::iterator& iter);
286 bool PresentPage(const Gtk::TreeModel::iterator& iter);
288 static void AddSelcueCheckbox(DialogPage& p, Glib::ustring const &prefs_path, bool def_value);
289 static void AddGradientCheckbox(DialogPage& p, Glib::ustring const &prefs_path, bool def_value);
290 static void AddConvertGuidesCheckbox(DialogPage& p, Glib::ustring const &prefs_path, bool def_value);
291 static void AddDotSizeSpinbutton(DialogPage& p, Glib::ustring const &prefs_path, double def_value);
292 static void AddNewObjectsStyle(DialogPage& p, Glib::ustring const &prefs_path, const gchar* banner = NULL);
294 void on_pagelist_selection_changed();
295 void on_reset_open_recent_clicked();
296 void initPageMouse();
297 void initPageScrolling();
298 void initPageSnapping();
299 void initPageSteps();
300 void initPageTools();
301 void initPageWindows();
302 void initPageClones();
303 void initPageMasks();
304 void initPageTransforms();
305 void initPageFilters();
306 void initPageSelecting();
307 void initPageImportExport();
308 void initPageCMS();
309 void initPageGrids();
310 void initPageSVGOutput();
311 void initPageUI();
312 void initPageSpellcheck();
313 void initPageSave();
314 void initPageBitmaps();
315 void initPageMisc();
316 void initPageI18n();
318 void _presentPages();
320 private:
321 InkscapePreferences();
322 InkscapePreferences(InkscapePreferences const &d);
323 InkscapePreferences operator=(InkscapePreferences const &d);
324 };
326 } // namespace Dialog
327 } // namespace UI
328 } // namespace Inkscape
330 #endif //INKSCAPE_UI_DIALOG_INKSCAPE_PREFERENCES_H
332 /*
333 Local Variables:
334 mode:c++
335 c-file-style:"stroustrup"
336 c-file-offsets:((innamespace . 0)(inline-open . 0))
337 indent-tabs-mode:nil
338 fill-column:99
339 End:
340 */
341 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :