42
44
project => Padre::Constant::PROJECT,
45
51
#####################################################################
46
52
# Settings Specification
48
54
# This section identifies the set of all named configuration entries,
49
55
# and where the configuration system should resolve them to.
54
# for each setting, add an array ref:
55
# [ $setting_name, $setting_type, $setting_default ]
57
# -- user identity (simplistic initial version)
58
[ 'identity_name', Padre::Constant::ASCII, '' ], # Initially, this must be ascii only
59
[ 'identity_email', Padre::Constant::ASCII, '' ],
61
# -- for module::starter
62
[ 'license', Padre::Constant::ASCII, '' ],
63
[ 'builder', Padre::Constant::ASCII, '' ],
64
[ 'module_start_directory', Padre::Constant::ASCII, '' ],
67
# allow projects to forcefully override personal settings
68
[ 'editor_indent_auto', Padre::Constant::BOOLEAN, 1 ],
69
[ 'editor_indent_tab', Padre::Constant::BOOLEAN, 1 ],
70
[ 'editor_indent_tab_width', Padre::Constant::POSINT, 8 ],
71
[ 'editor_indent_width', Padre::Constant::POSINT, 8 ],
74
# startup mode, if no files given on the command line this can be
75
# new - a new empty buffer
76
# nothing - nothing to open
77
# last - the files that were open last time
78
[ 'main_startup', Padre::Constant::ASCII, 'new' ],
79
[ 'main_singleinstance', Padre::Constant::BOOLEAN, 0 ],
80
[ 'main_lockinterface', Padre::Constant::BOOLEAN, 1 ],
81
[ 'main_functions', Padre::Constant::BOOLEAN, 0 ],
82
[ 'main_functions_order', Padre::Constant::ASCII, 'alphabetical' ],
83
[ 'main_outline', Padre::Constant::BOOLEAN, 0 ],
84
[ 'main_directory', Padre::Constant::BOOLEAN, 0 ],
85
[ 'main_output', Padre::Constant::BOOLEAN, 0 ],
86
[ 'main_output_ansi', Padre::Constant::BOOLEAN, 1 ],
87
[ 'main_syntaxcheck', Padre::Constant::BOOLEAN, 0 ],
88
[ 'main_errorlist', Padre::Constant::BOOLEAN, 0 ],
89
[ 'main_statusbar', Padre::Constant::BOOLEAN, 1 ],
92
[ 'editor_font', Padre::Constant::ASCII, '' ],
93
[ 'editor_linenumbers', Padre::Constant::BOOLEAN, 1 ],
94
[ 'editor_eol', Padre::Constant::BOOLEAN, 0 ],
95
[ 'editor_whitespace', Padre::Constant::BOOLEAN, 0 ],
96
[ 'editor_indentationguides', Padre::Constant::BOOLEAN, 0 ],
97
[ 'editor_calltips', Padre::Constant::BOOLEAN, 0 ],
98
[ 'editor_autoindent', Padre::Constant::ASCII, 'deep' ],
99
[ 'editor_folding', Padre::Constant::BOOLEAN, 0 ],
100
[ 'editor_fold_pod', Padre::Constant::BOOLEAN, 0 ],
101
[ 'editor_currentline', Padre::Constant::BOOLEAN, 1 ],
102
[ 'editor_currentline_color', Padre::Constant::ASCII, 'FFFF04' ],
103
[ 'editor_beginner', Padre::Constant::BOOLEAN, 1 ],
104
[ 'editor_wordwrap', Padre::Constant::BOOLEAN, 0 ],
105
[ 'editor_file_size_limit', Padre::Constant::POSINT, 500_000 ],
106
[ 'find_case', Padre::Constant::BOOLEAN, 1 ],
107
[ 'find_regex', Padre::Constant::BOOLEAN, 0 ],
108
[ 'find_reverse', Padre::Constant::BOOLEAN, 0 ],
109
[ 'find_first', Padre::Constant::BOOLEAN, 0 ],
110
[ 'find_nohidden', Padre::Constant::BOOLEAN, 1 ],
111
[ 'find_quick', Padre::Constant::BOOLEAN, 0 ],
112
[ 'ppi_highlight', Padre::Constant::BOOLEAN, 0 ],
113
[ 'ppi_highlight_limit', Padre::Constant::POSINT, 2000 ],
115
# -- behaviour tuning
116
# When running a script from the application some of the files might have
117
# not been saved yet. There are several option what to do before running the
119
# none - don't save anything (the script will be run without current modifications)
120
# unsaved - as above but including modifications present in the buffer
121
# same - save the file in the current buffer
122
# all_files - all the files (but not buffers that have no filenames)
123
# all_buffers - all the buffers even if they don't have a name yet
124
[ 'run_save', Padre::Constant::ASCII, 'same' ],
126
# move of stacktrace to run menu: will be removed (run_stacktrace)
127
[ 'run_stacktrace', Padre::Constant::BOOLEAN, 0 ],
128
[ 'autocomplete_brackets', Padre::Constant::BOOLEAN, 0 ],
130
# by default use background threads unless profiling
131
# TODO - Make the default actually change
132
[ 'threads', Padre::Constant::BOOLEAN, 1 ],
133
[ 'locale', Padre::Constant::ASCII, '' ],
134
[ 'locale_perldiag', Padre::Constant::ASCII, '' ],
135
[ 'experimental', Padre::Constant::BOOLEAN, 0 ],
139
# for each setting, add an array ref:
140
# [ $setting_name, $setting_type, $setting_default ]
143
# since it's in local files, it has to be a host-specific setting
144
[ 'editor_style', Padre::Constant::ASCII, 'default' ],
147
[ 'main_maximized', Padre::Constant::BOOLEAN, 0 ],
148
[ 'main_top', Padre::Constant::INTEGER, 40 ],
149
[ 'main_left', Padre::Constant::INTEGER, 20 ],
150
[ 'main_width', Padre::Constant::POSINT, 600 ],
151
[ 'main_height', Padre::Constant::POSINT, 400 ],
153
[ 'logging', Padre::Constant::BOOLEAN, 0 ],
154
[ 'logging_trace', Padre::Constant::BOOLEAN, 0 ],
156
# -- default run parameters
157
[ 'run_interpreter_args_default', Padre::Constant::ASCII, '' ],
158
[ 'run_script_args_default', Padre::Constant::ASCII, '' ],
159
[ 'external_diff_tool', Padre::Constant::ASCII, '' ],
164
human => Padre::Constant::HUMAN,
165
host => Padre::Constant::HOST,
167
foreach my $type ( keys %settings ) {
168
my $settings = $settings{$type};
169
my $store = $store{$type};
170
foreach my $setting (@$settings) {
171
my ( $name, $type, $default ) = @$setting;
60
# create a new setting, with %params used to feed the new object.
64
# Validate the setting
65
my $object = Padre::Config::Setting->new(@_);
66
if ( $SETTING{ $object->{name} } ) {
67
Carp::croak("The $object->{name} setting is already defined");
70
# Generate the accessor
71
my $code = <<"END_PERL";
72
package Padre::Config;
76
if ( exists \$self->[$object->{store}]->{'$object->{name}'} ) {
77
return \$self->[$object->{store}]->{'$object->{name}'};
79
return \$DEFAULT{'$object->{name}'};
83
# Compile the accessor
84
eval $code; ## no critic
86
Carp::croak("Failed to compile setting $object->{name}");
90
$SETTING{ $object->{name} } = $object;
91
$DEFAULT{ $object->{name} } = $object->{default};
96
# User identity (simplistic initial version)
97
# Initially, this must be ascii only
99
name => 'identity_name',
100
type => Padre::Constant::ASCII,
101
store => Padre::Constant::HUMAN,
105
name => 'identity_email',
106
type => Padre::Constant::ASCII,
107
store => Padre::Constant::HUMAN,
111
name => 'identity_nickname',
112
type => Padre::Constant::ASCII,
113
store => Padre::Constant::HUMAN,
117
# Support for Module::Starter
120
type => Padre::Constant::ASCII,
121
store => Padre::Constant::HUMAN,
126
type => Padre::Constant::ASCII,
127
store => Padre::Constant::HUMAN,
131
name => 'module_start_directory',
132
type => Padre::Constant::ASCII,
133
store => Padre::Constant::HUMAN,
138
# Allow projects to forcefully override personal settings
140
name => 'editor_indent_auto',
141
type => Padre::Constant::BOOLEAN,
142
store => Padre::Constant::HUMAN,
147
name => 'editor_indent_tab',
148
type => Padre::Constant::BOOLEAN,
149
store => Padre::Constant::HUMAN,
154
name => 'editor_indent_tab_width',
155
type => Padre::Constant::POSINT,
156
store => Padre::Constant::HUMAN,
161
name => 'editor_indent_width',
162
type => Padre::Constant::POSINT,
163
store => Padre::Constant::HUMAN,
168
# Startup mode, if no files given on the command line this can be
169
# new - a new empty buffer
170
# nothing - nothing to open
171
# last - the files that were open last time
173
name => 'main_startup',
174
type => Padre::Constant::ASCII,
175
store => Padre::Constant::HUMAN,
178
'last' => _T('Previous open files'),
179
'new' => _T('A new empty file'),
180
'nothing' => _T('No open files'),
186
name => 'main_singleinstance',
187
type => Padre::Constant::BOOLEAN,
188
store => Padre::Constant::HUMAN,
194
$main->single_instance_start;
196
$main->single_instance_stop;
202
name => 'main_lockinterface',
203
type => Padre::Constant::BOOLEAN,
204
store => Padre::Constant::HUMAN,
210
# Update the lock status
211
$main->aui->lock_panels($value);
213
# The toolbar can't dynamically switch between
214
# tearable and non-tearable so rebuild it.
215
# TODO: Review this assumption
216
if ($Padre::Wx::Toolbar::DOCKABLE) {
217
$main->rebuild_toolbar;
224
name => 'main_functions',
225
type => Padre::Constant::BOOLEAN,
226
store => Padre::Constant::HUMAN,
230
name => 'main_functions_order',
231
type => Padre::Constant::ASCII,
232
store => Padre::Constant::HUMAN,
233
default => 'alphabetical',
235
'original' => _T('Code Order'),
236
'alphabetical' => _T('Alphabetical Order'),
237
'alphabetical_private_last' => _T('Alphabetical Order (Private Last)'),
241
name => 'main_outline',
242
type => Padre::Constant::BOOLEAN,
243
store => Padre::Constant::HUMAN,
247
name => 'main_directory',
248
type => Padre::Constant::BOOLEAN,
249
store => Padre::Constant::HUMAN,
253
name => 'main_directory_panel',
254
type => Padre::Constant::ASCII,
255
store => Padre::Constant::HUMAN,
258
'left' => _T('Project Tools (Left)'),
259
'right' => _T('Document Tools (Right)'),
265
# Is it visible and on the wrong side?
266
return 1 unless $main->has_directory;
267
my $directory = $main->directory;
268
return 1 unless $directory->IsShown;
269
return 1 unless $directory->side ne $value;
271
# Hide and reshow the tool with the new setting
272
$directory->panel->hide($directory);
273
$main->directory_panel->show($directory);
281
name => 'main_output',
282
type => Padre::Constant::BOOLEAN,
283
store => Padre::Constant::HUMAN,
287
name => 'main_output_ansi',
288
type => Padre::Constant::BOOLEAN,
289
store => Padre::Constant::HUMAN,
293
name => 'main_syntaxcheck',
294
type => Padre::Constant::BOOLEAN,
295
store => Padre::Constant::HUMAN,
299
name => 'main_errorlist',
300
type => Padre::Constant::BOOLEAN,
301
store => Padre::Constant::HUMAN,
305
name => 'main_statusbar',
306
type => Padre::Constant::BOOLEAN,
307
store => Padre::Constant::HUMAN,
311
name => 'main_toolbar',
312
type => Padre::Constant::BOOLEAN,
313
store => Padre::Constant::HUMAN,
317
# Directory Tree Settings
319
name => 'default_projects_directory',
320
type => Padre::Constant::ASCII,
321
store => Padre::Constant::HUMAN,
322
default => File::HomeDir->my_documents,
327
name => 'editor_font',
328
type => Padre::Constant::ASCII,
329
store => Padre::Constant::HUMAN,
333
name => 'editor_linenumbers',
334
type => Padre::Constant::BOOLEAN,
335
store => Padre::Constant::HUMAN,
339
name => 'editor_eol',
340
type => Padre::Constant::BOOLEAN,
341
store => Padre::Constant::HUMAN,
345
name => 'editor_whitespace',
346
type => Padre::Constant::BOOLEAN,
347
store => Padre::Constant::HUMAN,
351
name => 'editor_indentationguides',
352
type => Padre::Constant::BOOLEAN,
353
store => Padre::Constant::HUMAN,
357
name => 'editor_calltips',
358
type => Padre::Constant::BOOLEAN,
359
store => Padre::Constant::HUMAN,
363
name => 'editor_autoindent',
364
type => Padre::Constant::ASCII,
365
store => Padre::Constant::HUMAN,
368
'no' => 'No Autoindent',
369
'same' => 'Indent to Same Depth',
370
'deep' => 'Indent Deeply',
374
name => 'editor_folding',
375
type => Padre::Constant::BOOLEAN,
376
store => Padre::Constant::HUMAN,
380
name => 'editor_fold_pod',
381
type => Padre::Constant::BOOLEAN,
382
store => Padre::Constant::HUMAN,
386
name => 'editor_currentline',
387
type => Padre::Constant::BOOLEAN,
388
store => Padre::Constant::HUMAN,
392
name => 'editor_currentline_color',
393
type => Padre::Constant::ASCII,
394
store => Padre::Constant::HUMAN,
398
name => 'editor_beginner',
399
type => Padre::Constant::BOOLEAN,
400
store => Padre::Constant::HUMAN,
404
name => 'editor_wordwrap',
405
type => Padre::Constant::BOOLEAN,
406
store => Padre::Constant::HUMAN,
410
name => 'editor_file_size_limit',
411
type => Padre::Constant::POSINT,
412
store => Padre::Constant::HUMAN,
416
name => 'editor_right_margin_enable',
417
type => Padre::Constant::BOOLEAN,
418
store => Padre::Constant::HUMAN,
422
name => 'editor_right_margin_column',
423
type => Padre::Constant::POSINT,
424
store => Padre::Constant::HUMAN,
429
type => Padre::Constant::BOOLEAN,
430
store => Padre::Constant::HUMAN,
434
name => 'find_regex',
435
type => Padre::Constant::BOOLEAN,
436
store => Padre::Constant::HUMAN,
440
name => 'find_reverse',
441
type => Padre::Constant::BOOLEAN,
442
store => Padre::Constant::HUMAN,
446
name => 'find_first',
447
type => Padre::Constant::BOOLEAN,
448
store => Padre::Constant::HUMAN,
452
name => 'find_nohidden',
453
type => Padre::Constant::BOOLEAN,
454
store => Padre::Constant::HUMAN,
458
name => 'find_quick',
459
type => Padre::Constant::BOOLEAN,
460
store => Padre::Constant::HUMAN,
464
name => 'update_file_from_disk_interval',
465
type => Padre::Constant::ASCII,
466
store => Padre::Constant::HUMAN,
471
# When running a script from the application some of the files might have
472
# not been saved yet. There are several option what to do before running the
474
# none - don't save anything (the script will be run without current modifications)
475
# unsaved - as above but including modifications present in the buffer
476
# same - save the file in the current buffer
477
# all_files - all the files (but not buffers that have no filenames)
478
# all_buffers - all the buffers even if they don't have a name yet
481
type => Padre::Constant::ASCII,
482
store => Padre::Constant::HUMAN,
486
# Move of stacktrace to run menu: will be removed (run_stacktrace)
488
name => 'run_stacktrace',
489
type => Padre::Constant::BOOLEAN,
490
store => Padre::Constant::HUMAN,
494
name => 'autocomplete_brackets',
495
type => Padre::Constant::BOOLEAN,
496
store => Padre::Constant::HUMAN,
500
# By default use background threads unless profiling
501
# TODO - Make the default actually change
504
type => Padre::Constant::BOOLEAN,
505
store => Padre::Constant::HUMAN,
510
type => Padre::Constant::ASCII,
511
store => Padre::Constant::HUMAN,
515
name => 'locale_perldiag',
516
type => Padre::Constant::ASCII,
517
store => Padre::Constant::HUMAN,
522
# Since it's in local files, it has to be a host-specific setting.
524
name => 'editor_style',
525
type => Padre::Constant::ASCII,
526
store => Padre::Constant::HOST,
527
default => 'default',
532
name => 'main_maximized',
533
type => Padre::Constant::BOOLEAN,
534
store => Padre::Constant::HOST,
539
type => Padre::Constant::INTEGER,
540
store => Padre::Constant::HOST,
545
type => Padre::Constant::INTEGER,
546
store => Padre::Constant::HOST,
550
name => 'main_width',
551
type => Padre::Constant::POSINT,
552
store => Padre::Constant::HOST,
556
name => 'main_height',
557
type => Padre::Constant::POSINT,
558
store => Padre::Constant::HOST,
565
type => Padre::Constant::BOOLEAN,
566
store => Padre::Constant::HOST,
570
name => 'logging_trace',
571
type => Padre::Constant::BOOLEAN,
572
store => Padre::Constant::HOST,
578
name => 'run_interpreter_args_default',
579
type => Padre::Constant::ASCII,
580
store => Padre::Constant::HOST,
584
name => 'run_script_args_default',
585
type => Padre::Constant::ASCII,
586
store => Padre::Constant::HOST,
590
name => 'run_use_external_window',
591
type => Padre::Constant::BOOLEAN,
592
store => Padre::Constant::HOST,
596
name => 'external_diff_tool',
597
type => Padre::Constant::ASCII,
598
store => Padre::Constant::HOST,
181
606
#####################################################################
182
607
# Constructor and Accessors