1 /**
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/table.h>
21 #include <gtkmm/colorbutton.h>
22 #include <gtkmm/comboboxtext.h>
23 #include <gtkmm/spinbutton.h>
24 #include <gtkmm/treestore.h>
25 #include <gtkmm/treeview.h>
26 #include <gtkmm/radiobutton.h>
27 #include <gtkmm/frame.h>
28 #include <gtkmm/notebook.h>
29 #include "ui/widget/preferences-widget.h"
30 #include <sigc++/sigc++.h>
31 #include <glibmm/i18n.h>
33 #include "ui/widget/panel.h"
35 // UPDATE THIS IF YOU'RE ADDING PREFS PAGES.
36 // Otherwise the commands that open the dialog with the new page will fail.
38 enum {
39 PREFS_PAGE_TOOLS,
40 PREFS_PAGE_TOOLS_SELECTOR,
41 PREFS_PAGE_TOOLS_NODE,
42 PREFS_PAGE_TOOLS_TWEAK,
43 PREFS_PAGE_TOOLS_ZOOM,
44 PREFS_PAGE_TOOLS_SHAPES,
45 PREFS_PAGE_TOOLS_SHAPES_RECT,
46 PREFS_PAGE_TOOLS_SHAPES_3DBOX,
47 PREFS_PAGE_TOOLS_SHAPES_ELLIPSE,
48 PREFS_PAGE_TOOLS_SHAPES_STAR,
49 PREFS_PAGE_TOOLS_SHAPES_SPIRAL,
50 PREFS_PAGE_TOOLS_PENCIL,
51 PREFS_PAGE_TOOLS_PEN,
52 PREFS_PAGE_TOOLS_CALLIGRAPHY,
53 PREFS_PAGE_TOOLS_PAINTBUCKET,
54 PREFS_PAGE_TOOLS_ERASER,
55 PREFS_PAGE_TOOLS_LPETOOL,
56 PREFS_PAGE_TOOLS_TEXT,
57 PREFS_PAGE_TOOLS_GRADIENT,
58 PREFS_PAGE_TOOLS_CONNECTOR,
59 PREFS_PAGE_TOOLS_DROPPER,
60 PREFS_PAGE_SELECTING,
61 PREFS_PAGE_TRANSFORMS,
62 PREFS_PAGE_CLONES,
63 PREFS_PAGE_MASKS,
64 PREFS_PAGE_FILTERS,
65 PREFS_PAGE_BITMAPS,
66 PREFS_PAGE_CMS,
67 PREFS_PAGE_GRIDS,
68 PREFS_PAGE_SVGOUTPUT,
69 PREFS_PAGE_AUTOSAVE,
70 PREFS_PAGE_IMPORTEXPORT,
71 PREFS_PAGE_UI,
72 PREFS_PAGE_MOUSE,
73 PREFS_PAGE_SCROLLING,
74 PREFS_PAGE_STEPS,
75 PREFS_PAGE_WINDOWS,
76 PREFS_PAGE_MISC
77 };
79 using namespace Inkscape::UI::Widget;
81 namespace Inkscape {
82 namespace UI {
83 namespace Dialog {
85 class InkscapePreferences : public UI::Widget::Panel {
86 public:
87 virtual ~InkscapePreferences();
89 static InkscapePreferences &getInstance() { return *new InkscapePreferences(); }
91 protected:
92 Gtk::Frame _page_frame;
93 Gtk::Label _page_title;
94 Gtk::TreeView _page_list;
95 Glib::RefPtr<Gtk::TreeStore> _page_list_model;
97 //Pagelist model columns:
98 class PageListModelColumns : public Gtk::TreeModel::ColumnRecord
99 {
100 public:
101 PageListModelColumns()
102 { Gtk::TreeModelColumnRecord::add(_col_name); Gtk::TreeModelColumnRecord::add(_col_page); Gtk::TreeModelColumnRecord::add(_col_id); }
103 Gtk::TreeModelColumn<Glib::ustring> _col_name;
104 Gtk::TreeModelColumn<int> _col_id;
105 Gtk::TreeModelColumn<DialogPage*> _col_page;
106 };
107 PageListModelColumns _page_list_columns;
109 Gtk::TreeModel::Path _path_tools;
110 Gtk::TreeModel::Path _path_shapes;
112 DialogPage _page_mouse, _page_scrolling, _page_steps, _page_tools, _page_windows,
113 _page_clones, _page_mask, _page_transforms, _page_filters, _page_select,
114 _page_importexport, _page_cms, _page_grids, _page_svgoutput, _page_misc,
115 _page_ui, _page_autosave, _page_bitmaps;
116 DialogPage _page_selector, _page_node, _page_tweak, _page_zoom, _page_shapes, _page_pencil, _page_pen,
117 _page_calligraphy, _page_text, _page_gradient, _page_connector, _page_dropper, _page_lpetool;
118 DialogPage _page_rectangle, _page_3dbox, _page_ellipse, _page_star, _page_spiral, _page_paintbucket, _page_eraser;
120 PrefSpinButton _mouse_sens, _mouse_thres;
121 PrefCheckButton _mouse_use_ext_input;
122 PrefCheckButton _mouse_switch_on_ext_input;
124 PrefSpinButton _scroll_wheel, _scroll_arrow_px, _scroll_arrow_acc, _scroll_auto_speed, _scroll_auto_thres;
125 PrefCheckButton _scroll_space;
126 PrefCheckButton _wheel_zoom;
128 PrefCombo _steps_rot_snap;
129 PrefCheckButton _steps_compass;
130 PrefSpinButton _steps_arrow, _steps_scale, _steps_inset, _steps_zoom;
132 PrefRadioButton _t_sel_trans_obj, _t_sel_trans_outl, _t_sel_cue_none, _t_sel_cue_mark,
133 _t_sel_cue_box, _t_bbox_visual, _t_bbox_geometric;
134 PrefCheckButton _t_cvg_keep_objects, _t_cvg_convert_whole_groups;
135 PrefCheckButton _t_node_pathflash_enabled;
136 PrefSpinButton _t_node_pathflash_timeout;
137 PrefColorPicker _t_node_pathoutline_color;
139 PrefRadioButton _win_dockable, _win_floating;
140 PrefRadioButton _win_ontop_none, _win_ontop_normal, _win_ontop_agressive;
141 PrefRadioButton _win_save_geom_off, _win_save_geom, _win_save_geom_prefs;
142 PrefCheckButton _win_hide_task, _win_zoom_resize , _win_show_close;
144 PrefCheckButton _calligrapy_use_abs_size;
145 PrefCheckButton _calligrapy_keep_selected;
147 PrefCheckButton _connector_ignore_text;
149 PrefRadioButton _clone_option_parallel, _clone_option_stay, _clone_option_transform,
150 _clone_option_unlink, _clone_option_delete;
151 PrefCheckButton _clone_relink_on_duplicate;
153 PrefCheckButton _mask_mask_on_top;
154 PrefCheckButton _mask_mask_remove;
156 PrefRadioButton _blur_quality_best, _blur_quality_better, _blur_quality_normal, _blur_quality_worse, _blur_quality_worst;
157 PrefCheckButton _show_filters_info_box;
159 PrefCheckButton _trans_scale_stroke, _trans_scale_corner, _trans_gradient,_trans_pattern;
160 PrefRadioButton _trans_optimized, _trans_preserved;
162 PrefRadioButton _sel_all;
163 PrefRadioButton _sel_current;
164 PrefRadioButton _sel_recursive;
165 PrefCheckButton _sel_hidden, _sel_locked;
166 PrefCheckButton _sel_layer_deselects;
168 PrefSpinButton _importexport_export, _misc_recent, _misc_simpl;
169 ZoomCorrRulerSlider _ui_zoom_correction;
170 PrefSpinButton _misc_latency_skew;
171 PrefCheckButton _misc_comment, _misc_forkvectors, _misc_scripts, _misc_namedicon_delay;
172 PrefCombo _misc_small_toolbar;
173 PrefCombo _misc_small_secondary;
174 PrefCombo _misc_small_tools;
175 PrefCombo _misc_overs_bitmap;
176 PrefCombo _misc_bitmap_editor;
177 PrefCheckButton _misc_bitmap_autoreload;
178 PrefSpinButton _bitmap_copy_res;
180 PrefCheckButton _autosave_autosave_enable;
181 PrefSpinButton _autosave_autosave_interval;
182 PrefEntry _autosave_autosave_path;
183 PrefSpinButton _autosave_autosave_max;
185 Gtk::ComboBoxText _cms_display_profile;
186 PrefCheckButton _cms_from_display;
187 PrefCombo _cms_intent;
189 PrefCheckButton _cms_softproof;
190 PrefCheckButton _cms_gamutwarn;
191 Gtk::ColorButton _cms_gamutcolor;
192 Gtk::ComboBoxText _cms_proof_profile;
193 PrefCombo _cms_proof_intent;
194 PrefCheckButton _cms_proof_blackpoint;
195 PrefCheckButton _cms_proof_preserveblack;
197 Gtk::Notebook _grids_notebook;
198 PrefCheckButton _grids_no_emphasize_on_zoom;
199 DialogPage _grids_xy, _grids_axonom;
200 // CanvasXYGrid properties:
201 PrefUnit _grids_xy_units;
202 PrefSpinButton _grids_xy_origin_x;
203 PrefSpinButton _grids_xy_origin_y;
204 PrefSpinButton _grids_xy_spacing_x;
205 PrefSpinButton _grids_xy_spacing_y;
206 PrefColorPicker _grids_xy_color;
207 PrefColorPicker _grids_xy_empcolor;
208 PrefSpinButton _grids_xy_empspacing;
209 PrefCheckButton _grids_xy_dotted;
210 // CanvasAxonomGrid properties:
211 PrefUnit _grids_axonom_units;
212 PrefSpinButton _grids_axonom_origin_x;
213 PrefSpinButton _grids_axonom_origin_y;
214 PrefSpinButton _grids_axonom_spacing_y;
215 PrefSpinButton _grids_axonom_angle_x;
216 PrefSpinButton _grids_axonom_angle_z;
217 PrefColorPicker _grids_axonom_color;
218 PrefColorPicker _grids_axonom_empcolor;
219 PrefSpinButton _grids_axonom_empspacing;
221 // SVG Output page:
222 PrefCheckButton _svgoutput_usenamedcolors;
223 PrefSpinButton _svgoutput_numericprecision;
224 PrefSpinButton _svgoutput_minimumexponent;
225 PrefCheckButton _svgoutput_inlineattrs;
226 PrefSpinButton _svgoutput_indent;
227 PrefCheckButton _svgoutput_allowrelativecoordinates;
228 PrefCheckButton _svgoutput_forcerepeatcommands;
230 PrefEntryButtonHBox _importexport_ocal_url;
231 PrefEntry _importexport_ocal_username;
232 PrefEntry _importexport_ocal_password;
234 int _max_dialog_width;
235 int _max_dialog_height;
236 int _sb_width;
237 DialogPage* _current_page;
239 Gtk::TreeModel::iterator AddPage(DialogPage& p, Glib::ustring title, int id);
240 Gtk::TreeModel::iterator AddPage(DialogPage& p, Glib::ustring title, Gtk::TreeModel::iterator parent, int id);
241 bool SetMaxDialogSize(const Gtk::TreeModel::iterator& iter);
242 bool PresentPage(const Gtk::TreeModel::iterator& iter);
244 static void AddSelcueCheckbox(DialogPage& p, const std::string& prefs_path, bool def_value);
245 static void AddGradientCheckbox(DialogPage& p, const std::string& prefs_path, bool def_value);
246 static void AddConvertGuidesCheckbox(DialogPage& p, const std::string& prefs_path, bool def_value);
247 static void AddDotSizeSpinbutton(DialogPage& p, const std::string& prefs_path, double def_value);
248 static void AddNewObjectsStyle(DialogPage& p, const std::string& prefs_path, const gchar* banner = NULL);
250 void on_pagelist_selection_changed();
251 void initPageMouse();
252 void initPageScrolling();
253 void initPageSteps();
254 void initPageTools();
255 void initPageWindows();
256 void initPageClones();
257 void initPageMasks();
258 void initPageTransforms();
259 void initPageFilters();
260 void initPageSelecting();
261 void initPageImportExport();
262 void initPageCMS();
263 void initPageGrids();
264 void initPageSVGOutput();
265 void initPageUI();
266 void initPageAutosave();
267 void initPageBitmaps();
268 void initPageMisc();
270 void _presentPages();
272 private:
273 InkscapePreferences();
274 InkscapePreferences(InkscapePreferences const &d);
275 InkscapePreferences operator=(InkscapePreferences const &d);
276 };
278 } // namespace Dialog
279 } // namespace UI
280 } // namespace Inkscape
282 #endif //INKSCAPE_UI_DIALOG_INKSCAPE_PREFERENCES_H
284 /*
285 Local Variables:
286 mode:c++
287 c-file-style:"stroustrup"
288 c-file-offsets:((innamespace . 0)(inline-open . 0))
289 indent-tabs-mode:nil
290 fill-column:99
291 End:
292 */
293 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :