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