Code

This is the first c++ification commit from me. It handles sp-line, sp-polyline, sp...
[inkscape.git] / src / ui / dialog / inkscape-preferences.h
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 namespace Inkscape {
86 namespace UI {
87 namespace Dialog {
89 class InkscapePreferences : public UI::Widget::Panel {
90 public:
91     virtual ~InkscapePreferences();
93     static InkscapePreferences &getInstance() { return *new InkscapePreferences(); }
95 protected:
96     Gtk::Frame _page_frame;
97     Gtk::Label _page_title;
98     Gtk::TreeView _page_list;
99     Glib::RefPtr<Gtk::TreeStore> _page_list_model;
101     //Pagelist model columns:
102     class PageListModelColumns : public Gtk::TreeModel::ColumnRecord
103     {
104     public:
105         PageListModelColumns()
106         { Gtk::TreeModelColumnRecord::add(_col_name); Gtk::TreeModelColumnRecord::add(_col_page); Gtk::TreeModelColumnRecord::add(_col_id); }
107         Gtk::TreeModelColumn<Glib::ustring> _col_name;
108         Gtk::TreeModelColumn<int> _col_id;
109         Gtk::TreeModelColumn<UI::Widget::DialogPage*> _col_page;
110     };
111     PageListModelColumns _page_list_columns;
113     Gtk::TreeModel::Path _path_tools;
114     Gtk::TreeModel::Path _path_shapes;
116     UI::Widget::DialogPage _page_mouse;
117     UI::Widget::DialogPage _page_scrolling;
118     UI::Widget::DialogPage _page_snapping;
119     UI::Widget::DialogPage _page_steps;
120     UI::Widget::DialogPage _page_tools;
121     UI::Widget::DialogPage _page_windows;
122     UI::Widget::DialogPage _page_clones;
123     UI::Widget::DialogPage _page_mask;
124     UI::Widget::DialogPage _page_transforms;
125     UI::Widget::DialogPage _page_filters;
126     UI::Widget::DialogPage _page_select;
127     UI::Widget::DialogPage _page_importexport;
128     UI::Widget::DialogPage _page_cms;
129     UI::Widget::DialogPage _page_grids;
130     UI::Widget::DialogPage _page_svgoutput;
131     UI::Widget::DialogPage _page_misc;
132     UI::Widget::DialogPage _page_ui;
133     UI::Widget::DialogPage _page_save;
134     UI::Widget::DialogPage _page_bitmaps;
135     UI::Widget::DialogPage _page_spellcheck;
137     UI::Widget::DialogPage _page_selector;
138     UI::Widget::DialogPage _page_node;
139     UI::Widget::DialogPage _page_tweak;
140     UI::Widget::DialogPage _page_spray;
141     UI::Widget::DialogPage _page_zoom;
142     UI::Widget::DialogPage _page_shapes;
143     UI::Widget::DialogPage _page_pencil;
144     UI::Widget::DialogPage _page_pen;
145     UI::Widget::DialogPage _page_calligraphy;
146     UI::Widget::DialogPage _page_text;
147     UI::Widget::DialogPage _page_gradient;
148     UI::Widget::DialogPage _page_connector;
149     UI::Widget::DialogPage _page_dropper;
150     UI::Widget::DialogPage _page_lpetool;
152     UI::Widget::DialogPage _page_rectangle;
153     UI::Widget::DialogPage _page_3dbox;
154     UI::Widget::DialogPage _page_ellipse;
155     UI::Widget::DialogPage _page_star;
156     UI::Widget::DialogPage _page_spiral;
157     UI::Widget::DialogPage _page_paintbucket;
158     UI::Widget::DialogPage _page_eraser;
160     UI::Widget::PrefSpinButton _mouse_sens;
161     UI::Widget::PrefSpinButton _mouse_thres;
162     UI::Widget::PrefCheckButton _mouse_use_ext_input;
163     UI::Widget::PrefCheckButton _mouse_switch_on_ext_input;
165     UI::Widget::PrefSpinButton _scroll_wheel;
166     UI::Widget::PrefSpinButton _scroll_arrow_px;
167     UI::Widget::PrefSpinButton _scroll_arrow_acc;
168     UI::Widget::PrefSpinButton _scroll_auto_speed;
169     UI::Widget::PrefSpinButton _scroll_auto_thres;
170     UI::Widget::PrefCheckButton _scroll_space;
171     UI::Widget::PrefCheckButton _wheel_zoom;
173     Gtk::HScale     *_slider_snapping_delay;
174     UI::Widget::PrefCheckButton _snap_indicator;
175     UI::Widget::PrefCheckButton _snap_closest_only;
176     UI::Widget::PrefCheckButton _snap_mouse_pointer;
178     UI::Widget::PrefCombo       _steps_rot_snap;
179     UI::Widget::PrefCheckButton _steps_compass;
180     UI::Widget::PrefSpinButton _steps_arrow;
181     UI::Widget::PrefSpinButton _steps_scale;
182     UI::Widget::PrefSpinButton _steps_inset;
183     UI::Widget::PrefSpinButton _steps_zoom;
185     UI::Widget::PrefRadioButton _t_sel_trans_obj;
186     UI::Widget::PrefRadioButton _t_sel_trans_outl;
187     UI::Widget::PrefRadioButton _t_sel_cue_none;
188     UI::Widget::PrefRadioButton _t_sel_cue_mark;
189     UI::Widget::PrefRadioButton _t_sel_cue_box;
190     UI::Widget::PrefRadioButton _t_bbox_visual;
191     UI::Widget::PrefRadioButton _t_bbox_geometric;
193     UI::Widget::PrefCheckButton _t_cvg_keep_objects;
194     UI::Widget::PrefCheckButton _t_cvg_convert_whole_groups;
195     UI::Widget::PrefCheckButton _t_node_show_outline;
196     UI::Widget::PrefCheckButton _t_node_live_outline;
197     UI::Widget::PrefCheckButton _t_node_live_objects;
198     UI::Widget::PrefCheckButton _t_node_pathflash_enabled;
199     UI::Widget::PrefCheckButton _t_node_pathflash_selected;
200     UI::Widget::PrefSpinButton  _t_node_pathflash_timeout;
201     UI::Widget::PrefCheckButton _t_node_show_path_direction;
202     UI::Widget::PrefCheckButton _t_node_single_node_transform_handles;
203     UI::Widget::PrefCheckButton _t_node_delete_preserves_shape;
204     UI::Widget::PrefColorPicker _t_node_pathoutline_color;
206     UI::Widget::PrefRadioButton _win_dockable;
207     UI::Widget::PrefRadioButton _win_floating;
208     UI::Widget::PrefRadioButton _win_ontop_none;
209     UI::Widget::PrefRadioButton _win_ontop_normal;
210     UI::Widget::PrefRadioButton _win_ontop_agressive;
211     UI::Widget::PrefRadioButton _win_save_geom_off;
212     UI::Widget::PrefRadioButton _win_save_geom;
213     UI::Widget::PrefRadioButton _win_save_geom_prefs;
214     UI::Widget::PrefCheckButton _win_hide_task;
215     UI::Widget::PrefCheckButton _win_zoom_resize;
216     UI::Widget::PrefCheckButton _win_show_close;
217     UI::Widget::PrefSpinButton _win_trans_focus; /**< The dialog transparency setting for when the dialog is focused. */
218     UI::Widget::PrefSpinButton _win_trans_blur;  /**< The dialog transparency setting for when the dialog is out of focus. */
219     UI::Widget::PrefSpinButton _win_trans_time;  /**< How much time to go from one transparency setting to another */
221     UI::Widget::PrefCheckButton _pencil_average_all_sketches;
223     UI::Widget::PrefCheckButton _calligrapy_use_abs_size;
224     UI::Widget::PrefCheckButton _calligrapy_keep_selected;
226     UI::Widget::PrefCheckButton _connector_ignore_text;
228     UI::Widget::PrefRadioButton _clone_option_parallel;
229     UI::Widget::PrefRadioButton _clone_option_stay;
230     UI::Widget::PrefRadioButton _clone_option_transform;
231     UI::Widget::PrefRadioButton _clone_option_unlink;
232     UI::Widget::PrefRadioButton _clone_option_delete;
233     UI::Widget::PrefCheckButton _clone_relink_on_duplicate;
235     UI::Widget::PrefCheckButton _mask_mask_on_top;
236     UI::Widget::PrefCheckButton _mask_mask_remove;
237     UI::Widget::PrefRadioButton _mask_grouping_none;
238     UI::Widget::PrefRadioButton _mask_grouping_separate;
239     UI::Widget::PrefRadioButton _mask_grouping_all;
240     UI::Widget::PrefCheckButton _mask_ungrouping;
242     UI::Widget::PrefRadioButton _blur_quality_best;
243     UI::Widget::PrefRadioButton _blur_quality_better;
244     UI::Widget::PrefRadioButton _blur_quality_normal;
245     UI::Widget::PrefRadioButton _blur_quality_worse;
246     UI::Widget::PrefRadioButton _blur_quality_worst;
247     UI::Widget::PrefRadioButton _filter_quality_best;
248     UI::Widget::PrefRadioButton _filter_quality_better;
249     UI::Widget::PrefRadioButton _filter_quality_normal;
250     UI::Widget::PrefRadioButton _filter_quality_worse;
251     UI::Widget::PrefRadioButton _filter_quality_worst;
252     UI::Widget::PrefCheckButton _show_filters_info_box;
253     UI::Widget::PrefSpinButton  _filter_multi_threaded;
255     UI::Widget::PrefCheckButton _trans_scale_stroke;
256     UI::Widget::PrefCheckButton _trans_scale_corner;
257     UI::Widget::PrefCheckButton _trans_gradient;
258     UI::Widget::PrefCheckButton _trans_pattern;
259     UI::Widget::PrefRadioButton _trans_optimized;
260     UI::Widget::PrefRadioButton _trans_preserved;
262     UI::Widget::PrefRadioButton _sel_all;
263     UI::Widget::PrefRadioButton _sel_current;
264     UI::Widget::PrefRadioButton _sel_recursive;
265     UI::Widget::PrefCheckButton _sel_hidden;
266     UI::Widget::PrefCheckButton _sel_locked;
267     UI::Widget::PrefCheckButton _sel_layer_deselects;
269     UI::Widget::PrefSpinButton  _importexport_export;
270     UI::Widget::PrefSpinButton  _misc_simpl;
271     UI::Widget::PrefSlider      _snap_delay;
272     UI::Widget::PrefSlider      _snap_weight;
273     UI::Widget::PrefSpinButton  _misc_latency_skew;
274     UI::Widget::PrefCheckButton _misc_comment;
275     UI::Widget::PrefCheckButton _misc_forkvectors;
276     UI::Widget::PrefCheckButton _misc_scripts;
277     UI::Widget::PrefCheckButton _misc_namedicon_delay;
278     Gtk::TextView   _misc_info;
279     Gtk::ScrolledWindow _misc_info_scroll;
282     // UI page
283     UI::Widget::PrefCombo       _ui_languages;
284     UI::Widget::PrefCombo       _misc_small_toolbar;
285     UI::Widget::PrefCombo       _misc_small_secondary;
286     UI::Widget::PrefCombo       _misc_small_tools;
287     UI::Widget::PrefCheckButton _ui_colorsliders_top;
288     UI::Widget::PrefSpinButton  _misc_recent;
289     UI::Widget::PrefCheckButton _ui_partialdynamic;
290     UI::Widget::ZoomCorrRulerSlider _ui_zoom_correction;
292     //Spellcheck
293     UI::Widget::PrefCombo       _spell_language;
294     UI::Widget::PrefCombo       _spell_language2;
295     UI::Widget::PrefCombo       _spell_language3;
296     UI::Widget::PrefCheckButton _spell_ignorenumbers;
297     UI::Widget::PrefCheckButton _spell_ignoreallcaps;
299     UI::Widget::PrefCombo       _misc_overs_bitmap;
300     UI::Widget::PrefCombo       _misc_bitmap_editor;
301     UI::Widget::PrefCheckButton _misc_bitmap_autoreload;
302     UI::Widget::PrefSpinButton  _bitmap_copy_res;
304     UI::Widget::PrefCheckButton _save_use_current_dir;
305     UI::Widget::PrefCheckButton _save_autosave_enable;
306     UI::Widget::PrefSpinButton  _save_autosave_interval;
307     UI::Widget::PrefEntry       _save_autosave_path;
308     UI::Widget::PrefSpinButton  _save_autosave_max;
310     Gtk::ComboBoxText   _cms_display_profile;
311     UI::Widget::PrefCheckButton     _cms_from_display;
312     UI::Widget::PrefCombo           _cms_intent;
314     UI::Widget::PrefCheckButton     _cms_softproof;
315     UI::Widget::PrefCheckButton     _cms_gamutwarn;
316     Gtk::ColorButton    _cms_gamutcolor;
317     Gtk::ComboBoxText   _cms_proof_profile;
318     UI::Widget::PrefCombo           _cms_proof_intent;
319     UI::Widget::PrefCheckButton     _cms_proof_blackpoint;
320     UI::Widget::PrefCheckButton     _cms_proof_preserveblack;
322     Gtk::Notebook       _grids_notebook;
323     UI::Widget::PrefCheckButton     _grids_no_emphasize_on_zoom;
324     UI::Widget::DialogPage          _grids_xy;
325     UI::Widget::DialogPage          _grids_axonom;
326     // CanvasXYGrid properties:
327         UI::Widget::PrefUnit            _grids_xy_units;
328         UI::Widget::PrefSpinButton      _grids_xy_origin_x;
329         UI::Widget::PrefSpinButton      _grids_xy_origin_y;
330         UI::Widget::PrefSpinButton      _grids_xy_spacing_x;
331         UI::Widget::PrefSpinButton      _grids_xy_spacing_y;
332         UI::Widget::PrefColorPicker     _grids_xy_color;
333         UI::Widget::PrefColorPicker     _grids_xy_empcolor;
334         UI::Widget::PrefSpinButton      _grids_xy_empspacing;
335         UI::Widget::PrefCheckButton     _grids_xy_dotted;
336     // CanvasAxonomGrid properties:
337         UI::Widget::PrefUnit            _grids_axonom_units;
338         UI::Widget::PrefSpinButton      _grids_axonom_origin_x;
339         UI::Widget::PrefSpinButton      _grids_axonom_origin_y;
340         UI::Widget::PrefSpinButton      _grids_axonom_spacing_y;
341         UI::Widget::PrefSpinButton      _grids_axonom_angle_x;
342         UI::Widget::PrefSpinButton      _grids_axonom_angle_z;
343         UI::Widget::PrefColorPicker     _grids_axonom_color;
344         UI::Widget::PrefColorPicker     _grids_axonom_empcolor;
345         UI::Widget::PrefSpinButton      _grids_axonom_empspacing;
347     // SVG Output page:
348     UI::Widget::PrefCheckButton   _svgoutput_usenamedcolors;
349     UI::Widget::PrefSpinButton    _svgoutput_numericprecision;
350     UI::Widget::PrefSpinButton    _svgoutput_minimumexponent;
351     UI::Widget::PrefCheckButton   _svgoutput_inlineattrs;
352     UI::Widget::PrefSpinButton    _svgoutput_indent;
353     UI::Widget::PrefCheckButton   _svgoutput_allowrelativecoordinates;
354     UI::Widget::PrefCheckButton   _svgoutput_forcerepeatcommands;
356     UI::Widget::PrefEntryButtonHBox _importexport_ocal_url;
357     UI::Widget::PrefEntry       _importexport_ocal_username;
358     UI::Widget::PrefEntry       _importexport_ocal_password;
360     int _max_dialog_width;
361     int _max_dialog_height;
362     int _sb_width;
363     UI::Widget::DialogPage* _current_page;
365     Gtk::TreeModel::iterator AddPage(UI::Widget::DialogPage& p, Glib::ustring title, int id);
366     Gtk::TreeModel::iterator AddPage(UI::Widget::DialogPage& p, Glib::ustring title, Gtk::TreeModel::iterator parent, int id);
367     bool SetMaxDialogSize(const Gtk::TreeModel::iterator& iter);
368     bool PresentPage(const Gtk::TreeModel::iterator& iter);
370     static void AddSelcueCheckbox(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, bool def_value);
371     static void AddGradientCheckbox(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, bool def_value);
372     static void AddConvertGuidesCheckbox(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, bool def_value);
373     static void AddDotSizeSpinbutton(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, double def_value);
374     static void AddNewObjectsStyle(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, const gchar* banner = NULL);
376     void on_pagelist_selection_changed();
377     void on_reset_open_recent_clicked();
378     void initPageMouse();
379     void initPageScrolling();
380     void initPageSnapping();
381     void initPageSteps();
382     void initPageTools();
383     void initPageWindows();
384     void initPageClones();
385     void initPageMasks();
386     void initPageTransforms();
387     void initPageFilters();
388     void initPageSelecting();
389     void initPageImportExport();
390     void initPageCMS();
391     void initPageGrids();
392     void initPageSVGOutput();
393     void initPageUI();
394     void initPageSpellcheck();
395     void initPageSave();
396     void initPageBitmaps();
397     void initPageMisc();
398     void initPageI18n();
400     void _presentPages();
402 private:
403     InkscapePreferences();
404     InkscapePreferences(InkscapePreferences const &d);
405     InkscapePreferences operator=(InkscapePreferences const &d);
406 };
408 } // namespace Dialog
409 } // namespace UI
410 } // namespace Inkscape
412 #endif //INKSCAPE_UI_DIALOG_INKSCAPE_PREFERENCES_H
414 /*
415   Local Variables:
416   mode:c++
417   c-file-style:"stroustrup"
418   c-file-offsets:((innamespace . 0)(inline-open . 0))
419   indent-tabs-mode:nil
420   fill-column:99
421   End:
422 */
423 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :