| 1 | package Padre::Config; |
|---|
| 2 | |
|---|
| 3 | # Configuration subsystem for Padre |
|---|
| 4 | |
|---|
| 5 | # To help force the break from the first-generation HASH based configuration |
|---|
| 6 | # over to the second-generation method based configuration, initially we |
|---|
| 7 | # will use an ARRAY-based object, so that all existing code is forcefully |
|---|
| 8 | # broken. |
|---|
| 9 | |
|---|
| 10 | use 5.008; |
|---|
| 11 | use strict; |
|---|
| 12 | use warnings; |
|---|
| 13 | use Carp (); |
|---|
| 14 | use File::Spec (); |
|---|
| 15 | use Scalar::Util (); |
|---|
| 16 | use Params::Util (); |
|---|
| 17 | use Padre::Constant (); |
|---|
| 18 | use Padre::Util (); |
|---|
| 19 | use Padre::Current (); |
|---|
| 20 | use Padre::Config::Setting (); |
|---|
| 21 | use Padre::Config::Human (); |
|---|
| 22 | use Padre::Config::Host (); |
|---|
| 23 | use Padre::Locale::T; |
|---|
| 24 | use Padre::Logger; |
|---|
| 25 | |
|---|
| 26 | our $VERSION = '0.95'; |
|---|
| 27 | our $COMPATIBLE = '0.93'; |
|---|
| 28 | |
|---|
| 29 | our ( %SETTING, %DEFAULT, %STARTUP, $REVISION, $SINGLETON ); |
|---|
| 30 | |
|---|
| 31 | BEGIN { |
|---|
| 32 | # Master storage of the settings |
|---|
| 33 | %SETTING = (); |
|---|
| 34 | |
|---|
| 35 | # A cache for the defaults |
|---|
| 36 | %DEFAULT = (); |
|---|
| 37 | |
|---|
| 38 | # A cache for startup.yml settings |
|---|
| 39 | %STARTUP = (); |
|---|
| 40 | |
|---|
| 41 | # Storage for the default config object |
|---|
| 42 | $SINGLETON = undef; |
|---|
| 43 | |
|---|
| 44 | # Load Portable Perl support if needed |
|---|
| 45 | require Padre::Portable if Padre::Constant::PORTABLE; |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | # Accessor generation |
|---|
| 49 | use Class::XSAccessor::Array { |
|---|
| 50 | getters => { |
|---|
| 51 | host => Padre::Constant::HOST, |
|---|
| 52 | human => Padre::Constant::HUMAN, |
|---|
| 53 | project => Padre::Constant::PROJECT, |
|---|
| 54 | } |
|---|
| 55 | }; |
|---|
| 56 | |
|---|
| 57 | my $PANEL_OPTIONS = { |
|---|
| 58 | left => _T('Left Panel'), |
|---|
| 59 | right => _T('Right Panel'), |
|---|
| 60 | bottom => _T('Bottom Panel'), |
|---|
| 61 | }; |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | ##################################################################### |
|---|
| 68 | # Settings Specification |
|---|
| 69 | |
|---|
| 70 | # This section identifies the set of all named configuration entries, |
|---|
| 71 | # and where the configuration system should resolve them to. |
|---|
| 72 | |
|---|
| 73 | sub settings { |
|---|
| 74 | sort keys %SETTING; |
|---|
| 75 | } |
|---|
| 76 | |
|---|
| 77 | # |
|---|
| 78 | # setting( %params ); |
|---|
| 79 | # |
|---|
| 80 | # Create a new setting, with %params used to feed the new object. |
|---|
| 81 | # |
|---|
| 82 | sub setting { |
|---|
| 83 | |
|---|
| 84 | # Allow this sub to be called as a method or function |
|---|
| 85 | shift if ref( $_[0] ) eq __PACKAGE__; |
|---|
| 86 | |
|---|
| 87 | # Validate the setting |
|---|
| 88 | my $object = Padre::Config::Setting->new(@_); |
|---|
| 89 | my $name = $object->{name}; |
|---|
| 90 | if ( $SETTING{$name} ) { |
|---|
| 91 | Carp::croak("The $name setting is already defined"); |
|---|
| 92 | } |
|---|
| 93 | |
|---|
| 94 | # Generate the accessor |
|---|
| 95 | SCOPE: { |
|---|
| 96 | local $@; |
|---|
| 97 | eval $object->code; |
|---|
| 98 | Carp::croak("Failed to compile setting $object->{name}: $@") if $@; |
|---|
| 99 | } |
|---|
| 100 | |
|---|
| 101 | # Save the setting |
|---|
| 102 | $SETTING{$name} = $object; |
|---|
| 103 | $DEFAULT{$name} = $object->{default}; |
|---|
| 104 | $STARTUP{$name} = 1 if $object->{startup}; |
|---|
| 105 | |
|---|
| 106 | return 1; |
|---|
| 107 | } |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | |
|---|
| 111 | |
|---|
| 112 | |
|---|
| 113 | ##################################################################### |
|---|
| 114 | # Constructor and Input/Output |
|---|
| 115 | |
|---|
| 116 | sub new { |
|---|
| 117 | my $class = shift; |
|---|
| 118 | my $host = shift; |
|---|
| 119 | my $human = shift; |
|---|
| 120 | unless ( Params::Util::_INSTANCE( $host, 'Padre::Config::Host' ) ) { |
|---|
| 121 | Carp::croak("Did not provide a host config to Padre::Config->new"); |
|---|
| 122 | } |
|---|
| 123 | unless ( Params::Util::_INSTANCE( $human, 'Padre::Config::Human' ) ) { |
|---|
| 124 | Carp::croak("Did not provide a user config to Padre::Config->new"); |
|---|
| 125 | } |
|---|
| 126 | |
|---|
| 127 | # Create the basic object with the two required elements |
|---|
| 128 | my $self = bless [ $host, $human, undef ], $class; |
|---|
| 129 | |
|---|
| 130 | # Add the optional third element |
|---|
| 131 | if (@_) { |
|---|
| 132 | my $project = shift; |
|---|
| 133 | unless ( Params::Util::_INSTANCE( $project, 'Padre::Config::Project' ) ) { |
|---|
| 134 | Carp::croak("Did not provide a project config to Padre::Config->new"); |
|---|
| 135 | } |
|---|
| 136 | $self->[Padre::Constant::PROJECT] = $project; |
|---|
| 137 | } |
|---|
| 138 | |
|---|
| 139 | return $self; |
|---|
| 140 | } |
|---|
| 141 | |
|---|
| 142 | sub read { |
|---|
| 143 | my $class = shift; |
|---|
| 144 | |
|---|
| 145 | unless ($SINGLETON) { |
|---|
| 146 | TRACE("Loading configuration for $class") if DEBUG; |
|---|
| 147 | |
|---|
| 148 | # Load the host configuration |
|---|
| 149 | my $host = Padre::Config::Host->read; |
|---|
| 150 | |
|---|
| 151 | # Load the user configuration |
|---|
| 152 | my $human = Padre::Config::Human->read |
|---|
| 153 | || Padre::Config::Human->create; |
|---|
| 154 | |
|---|
| 155 | # Hand off to the constructor |
|---|
| 156 | $SINGLETON = $class->new( $host, $human ); |
|---|
| 157 | } |
|---|
| 158 | |
|---|
| 159 | return $SINGLETON; |
|---|
| 160 | } |
|---|
| 161 | |
|---|
| 162 | sub write { |
|---|
| 163 | TRACE( $_[0] ) if DEBUG; |
|---|
| 164 | my $self = shift; |
|---|
| 165 | |
|---|
| 166 | # Save the user configuration |
|---|
| 167 | delete $self->[Padre::Constant::HUMAN]->{version}; |
|---|
| 168 | delete $self->[Padre::Constant::HUMAN]->{Version}; |
|---|
| 169 | $self->[Padre::Constant::HUMAN]->write; |
|---|
| 170 | |
|---|
| 171 | # Save the host configuration |
|---|
| 172 | delete $self->[Padre::Constant::HOST]->{version}; |
|---|
| 173 | delete $self->[Padre::Constant::HOST]->{Version}; |
|---|
| 174 | $self->[Padre::Constant::HOST]->write; |
|---|
| 175 | |
|---|
| 176 | # Write the startup subset of the configuration. |
|---|
| 177 | # NOTE: Use a hyper-minimalist listified key/value file format |
|---|
| 178 | # so that we don't need to load YAML::Tiny before the thread fork. |
|---|
| 179 | # This should save around 400k of memory per background thread. |
|---|
| 180 | my %startup = ( |
|---|
| 181 | VERSION => $VERSION, |
|---|
| 182 | map { $_ => $self->$_() } sort keys %STARTUP |
|---|
| 183 | ); |
|---|
| 184 | open( my $FILE, '>', Padre::Constant::CONFIG_STARTUP ) or return 1; |
|---|
| 185 | print $FILE map { "$_\n$startup{$_}\n" } sort keys %startup or return 1; |
|---|
| 186 | close $FILE or return 1; |
|---|
| 187 | |
|---|
| 188 | return 1; |
|---|
| 189 | } |
|---|
| 190 | |
|---|
| 191 | sub clone { |
|---|
| 192 | my $self = shift; |
|---|
| 193 | my $class = Scalar::Util::blessed($self); |
|---|
| 194 | my $host = $self->host->clone; |
|---|
| 195 | my $human = $self->human->clone; |
|---|
| 196 | if ( $self->project ) { |
|---|
| 197 | my $project = $self->project->clone; |
|---|
| 198 | return $class->new( $host, $human, $project ); |
|---|
| 199 | } else { |
|---|
| 200 | return $class->new( $host, $human ); |
|---|
| 201 | } |
|---|
| 202 | } |
|---|
| 203 | |
|---|
| 204 | |
|---|
| 205 | |
|---|
| 206 | |
|---|
| 207 | |
|---|
| 208 | ###################################################################### |
|---|
| 209 | # Main Methods |
|---|
| 210 | |
|---|
| 211 | sub meta { |
|---|
| 212 | $SETTING{ $_[1] } or die("Missing or invalid setting name '$_[1]'"); |
|---|
| 213 | } |
|---|
| 214 | |
|---|
| 215 | sub default { |
|---|
| 216 | my $self = shift; |
|---|
| 217 | my $name = shift; |
|---|
| 218 | |
|---|
| 219 | # Does the setting exist? |
|---|
| 220 | unless ( $SETTING{$name} ) { |
|---|
| 221 | Carp::croak("The configuration setting '$name' does not exist"); |
|---|
| 222 | } |
|---|
| 223 | |
|---|
| 224 | return $DEFAULT{$name}; |
|---|
| 225 | } |
|---|
| 226 | |
|---|
| 227 | sub changed { |
|---|
| 228 | my $self = shift; |
|---|
| 229 | my $name = shift; |
|---|
| 230 | my $new = shift; |
|---|
| 231 | my $old = $self->$name(); |
|---|
| 232 | my $type = $self->meta($name)->type; |
|---|
| 233 | if ( $type == Padre::Constant::ASCII or $type == Padre::Constant::PATH ) { |
|---|
| 234 | return $new ne $old; |
|---|
| 235 | } else { |
|---|
| 236 | return $new != $old; |
|---|
| 237 | } |
|---|
| 238 | } |
|---|
| 239 | |
|---|
| 240 | sub set { |
|---|
| 241 | TRACE( $_[1] ) if DEBUG; |
|---|
| 242 | my $self = shift; |
|---|
| 243 | my $name = shift; |
|---|
| 244 | my $value = shift; |
|---|
| 245 | |
|---|
| 246 | # Does the setting exist? |
|---|
| 247 | my $setting = $SETTING{$name}; |
|---|
| 248 | unless ($setting) { |
|---|
| 249 | Carp::croak("The configuration setting '$name' does not exist"); |
|---|
| 250 | } |
|---|
| 251 | |
|---|
| 252 | # All types are Padre::Constant::ASCII-like |
|---|
| 253 | unless ( defined $value and not ref $value ) { |
|---|
| 254 | Carp::croak("Missing or non-scalar value for setting '$name'"); |
|---|
| 255 | } |
|---|
| 256 | |
|---|
| 257 | # We don't need to do additional checks on Padre::Constant::ASCII |
|---|
| 258 | my $type = $setting->type; |
|---|
| 259 | my $store = $setting->store; |
|---|
| 260 | unless ( defined $type ) { |
|---|
| 261 | Carp::croak("Setting '$name' has undefined type"); |
|---|
| 262 | } |
|---|
| 263 | if ( $type == Padre::Constant::BOOLEAN ) { |
|---|
| 264 | $value = 0 if $value eq ''; |
|---|
| 265 | if ( $value ne '1' and $value ne '0' ) { |
|---|
| 266 | Carp::croak("Setting '$name' to non-boolean '$value'"); |
|---|
| 267 | } |
|---|
| 268 | } |
|---|
| 269 | if ( $type == Padre::Constant::POSINT and not Params::Util::_POSINT($value) ) { |
|---|
| 270 | Carp::croak("Setting '$name' to non-posint '$value'"); |
|---|
| 271 | } |
|---|
| 272 | if ( $type == Padre::Constant::INTEGER and not _INTEGER($value) ) { |
|---|
| 273 | Carp::croak("Setting '$name' to non-integer '$value'"); |
|---|
| 274 | } |
|---|
| 275 | if ( $type == Padre::Constant::PATH ) { |
|---|
| 276 | if ( Padre::Constant::WIN32 and utf8::is_utf8($value) ) { |
|---|
| 277 | require Win32; |
|---|
| 278 | my $long = Win32::GetLongPathName($value); |
|---|
| 279 | |
|---|
| 280 | # GetLongPathName returns undef if it doesn't exist. |
|---|
| 281 | unless ( defined $long ) { |
|---|
| 282 | Carp::croak("Setting '$name' to non-existant path '$value'"); |
|---|
| 283 | } |
|---|
| 284 | $value = $long; |
|---|
| 285 | |
|---|
| 286 | # Wx::DirPickerCtrl upgrades data to utf8. |
|---|
| 287 | # Perl on Windows cannot handle utf8 in file names, |
|---|
| 288 | # so this hack converts path back. |
|---|
| 289 | } |
|---|
| 290 | unless ( -e $value ) { |
|---|
| 291 | Carp::croak("Setting '$name' to non-existant path '$value'"); |
|---|
| 292 | } |
|---|
| 293 | |
|---|
| 294 | # If we are in Portable mode convert the path to dist relative if |
|---|
| 295 | # the setting is going into the host backend. |
|---|
| 296 | if ( Padre::Constant::PORTABLE and $store == Padre::Constant::HOST ) { |
|---|
| 297 | |
|---|
| 298 | # NOTE: Even though this says "directory" it is safe for files too |
|---|
| 299 | $value = Padre::Portable::freeze_directory($value); |
|---|
| 300 | } |
|---|
| 301 | } |
|---|
| 302 | |
|---|
| 303 | # Now we can stash the variable |
|---|
| 304 | $self->[$store]->{$name} = $value; |
|---|
| 305 | |
|---|
| 306 | return 1; |
|---|
| 307 | } |
|---|
| 308 | |
|---|
| 309 | # Set a value in the configuration and apply the preference change |
|---|
| 310 | # to the application. |
|---|
| 311 | sub apply { |
|---|
| 312 | TRACE( $_[0] ) if DEBUG; |
|---|
| 313 | my $self = shift; |
|---|
| 314 | my $name = shift; |
|---|
| 315 | my $new = shift; |
|---|
| 316 | |
|---|
| 317 | # Does the setting exist? |
|---|
| 318 | my $setting = $SETTING{$name}; |
|---|
| 319 | unless ($setting) { |
|---|
| 320 | Carp::croak("The configuration setting '$name' does not exist"); |
|---|
| 321 | } |
|---|
| 322 | |
|---|
| 323 | my $old = $self->$name(); |
|---|
| 324 | if ( $old ne $new ) { |
|---|
| 325 | # Set the config value |
|---|
| 326 | $self->set( $name => $new ); |
|---|
| 327 | |
|---|
| 328 | # Does this setting have an apply hook |
|---|
| 329 | my $code = do { |
|---|
| 330 | require Padre::Config::Apply; |
|---|
| 331 | Padre::Config::Apply->can($name); |
|---|
| 332 | }; |
|---|
| 333 | if ( $code ) { |
|---|
| 334 | my $current = Padre::Current::_CURRENT(@_); |
|---|
| 335 | $code->( $current->main, $new, $old ); |
|---|
| 336 | } |
|---|
| 337 | } |
|---|
| 338 | |
|---|
| 339 | return 1; |
|---|
| 340 | } |
|---|
| 341 | |
|---|
| 342 | sub themes { |
|---|
| 343 | my $class = shift; |
|---|
| 344 | my $core_directory = Padre::Util::sharedir('themes'); |
|---|
| 345 | my $user_directory = File::Spec->catdir( |
|---|
| 346 | Padre::Constant::CONFIG_DIR, |
|---|
| 347 | 'themes', |
|---|
| 348 | ); |
|---|
| 349 | |
|---|
| 350 | # Scan themes directories |
|---|
| 351 | my %themes = (); |
|---|
| 352 | foreach my $directory ( $user_directory, $core_directory ) { |
|---|
| 353 | next unless -d $directory; |
|---|
| 354 | |
|---|
| 355 | # Search the directory |
|---|
| 356 | local *STYLEDIR; |
|---|
| 357 | unless ( opendir( STYLEDIR, $directory ) ) { |
|---|
| 358 | die "Failed to read '$directory'"; |
|---|
| 359 | } |
|---|
| 360 | foreach my $file ( readdir STYLEDIR ) { |
|---|
| 361 | next unless $file =~ s/\.txt\z//; |
|---|
| 362 | next unless Params::Util::_IDENTIFIER($file); |
|---|
| 363 | next if $themes{$file}; |
|---|
| 364 | $themes{$file} = File::Spec->catfile( |
|---|
| 365 | $directory, |
|---|
| 366 | "$file.txt" |
|---|
| 367 | ); |
|---|
| 368 | } |
|---|
| 369 | closedir STYLEDIR; |
|---|
| 370 | } |
|---|
| 371 | |
|---|
| 372 | return \%themes; |
|---|
| 373 | } |
|---|
| 374 | |
|---|
| 375 | |
|---|
| 376 | |
|---|
| 377 | |
|---|
| 378 | |
|---|
| 379 | ###################################################################### |
|---|
| 380 | # Support Functions |
|---|
| 381 | |
|---|
| 382 | # |
|---|
| 383 | # my $is_integer = _INTEGER( $scalar ); |
|---|
| 384 | # |
|---|
| 385 | # return true if $scalar is an integer. |
|---|
| 386 | # |
|---|
| 387 | sub _INTEGER { |
|---|
| 388 | return defined $_[0] && !ref $_[0] && $_[0] =~ m/^(?:0|-?[1-9]\d*)$/; |
|---|
| 389 | } |
|---|
| 390 | |
|---|
| 391 | |
|---|
| 392 | |
|---|
| 393 | |
|---|
| 394 | |
|---|
| 395 | ###################################################################### |
|---|
| 396 | # Basic Settings |
|---|
| 397 | |
|---|
| 398 | # User identity (simplistic initial version) |
|---|
| 399 | # Initially, this must be ascii only |
|---|
| 400 | setting( |
|---|
| 401 | name => 'identity_name', |
|---|
| 402 | type => Padre::Constant::ASCII, |
|---|
| 403 | store => Padre::Constant::HUMAN, |
|---|
| 404 | default => '', |
|---|
| 405 | ); |
|---|
| 406 | setting( |
|---|
| 407 | name => 'identity_email', |
|---|
| 408 | type => Padre::Constant::ASCII, |
|---|
| 409 | store => Padre::Constant::HUMAN, |
|---|
| 410 | default => '', |
|---|
| 411 | ); |
|---|
| 412 | setting( |
|---|
| 413 | name => 'identity_nickname', |
|---|
| 414 | type => Padre::Constant::ASCII, |
|---|
| 415 | store => Padre::Constant::HUMAN, |
|---|
| 416 | default => '', |
|---|
| 417 | ); |
|---|
| 418 | setting( |
|---|
| 419 | name => 'identity_location', |
|---|
| 420 | type => Padre::Constant::ASCII, |
|---|
| 421 | store => Padre::Constant::HOST, |
|---|
| 422 | default => '', |
|---|
| 423 | ); |
|---|
| 424 | |
|---|
| 425 | # Indent settings |
|---|
| 426 | # Allow projects to forcefully override personal settings |
|---|
| 427 | setting( |
|---|
| 428 | name => 'editor_indent_auto', |
|---|
| 429 | type => Padre::Constant::BOOLEAN, |
|---|
| 430 | store => Padre::Constant::HUMAN, |
|---|
| 431 | default => 1, |
|---|
| 432 | project => 1, |
|---|
| 433 | ); |
|---|
| 434 | setting( |
|---|
| 435 | name => 'editor_indent_tab', |
|---|
| 436 | type => Padre::Constant::BOOLEAN, |
|---|
| 437 | store => Padre::Constant::HUMAN, |
|---|
| 438 | default => 1, |
|---|
| 439 | project => 1, |
|---|
| 440 | ); |
|---|
| 441 | setting( |
|---|
| 442 | name => 'editor_indent_tab_width', |
|---|
| 443 | type => Padre::Constant::POSINT, |
|---|
| 444 | store => Padre::Constant::HUMAN, |
|---|
| 445 | default => 8, |
|---|
| 446 | project => 1, |
|---|
| 447 | ); |
|---|
| 448 | setting( |
|---|
| 449 | name => 'editor_indent_width', |
|---|
| 450 | type => Padre::Constant::POSINT, |
|---|
| 451 | store => Padre::Constant::HUMAN, |
|---|
| 452 | default => 8, |
|---|
| 453 | project => 1, |
|---|
| 454 | ); |
|---|
| 455 | |
|---|
| 456 | |
|---|
| 457 | |
|---|
| 458 | |
|---|
| 459 | |
|---|
| 460 | ##################################################################### |
|---|
| 461 | # Startup Behaviour Rules |
|---|
| 462 | |
|---|
| 463 | setting( |
|---|
| 464 | name => 'startup_splash', |
|---|
| 465 | type => Padre::Constant::BOOLEAN, |
|---|
| 466 | store => Padre::Constant::HUMAN, |
|---|
| 467 | default => 0, |
|---|
| 468 | startup => 1, |
|---|
| 469 | help => _T('Showing the splash image during start-up'), |
|---|
| 470 | ); |
|---|
| 471 | |
|---|
| 472 | # Startup mode, if no files given on the command line this can be |
|---|
| 473 | # new - a new empty buffer |
|---|
| 474 | # nothing - nothing to open |
|---|
| 475 | # last - the files that were open last time |
|---|
| 476 | setting( |
|---|
| 477 | name => 'startup_files', |
|---|
| 478 | type => Padre::Constant::ASCII, |
|---|
| 479 | store => Padre::Constant::HUMAN, |
|---|
| 480 | default => 'new', |
|---|
| 481 | options => { |
|---|
| 482 | 'last' => _T('Previous open files'), |
|---|
| 483 | 'new' => _T('A new empty file'), |
|---|
| 484 | 'nothing' => _T('No open files'), |
|---|
| 485 | 'session' => _T('Open session'), |
|---|
| 486 | }, |
|---|
| 487 | help => _T('"Open session" will ask which session (set of files) to open when you launch Padre.') |
|---|
| 488 | . _T( |
|---|
| 489 | '"Previous open files" will remember the open files when you close Padre and open the same files next time you launch Padre.' |
|---|
| 490 | ), |
|---|
| 491 | ); |
|---|
| 492 | |
|---|
| 493 | # How many times has the user run Padre? |
|---|
| 494 | # Default is 1 and the value is incremented at shutdown rather than |
|---|
| 495 | # startup so that we don't have to write files in the startup sequence. |
|---|
| 496 | setting( |
|---|
| 497 | name => 'nth_startup', |
|---|
| 498 | type => Padre::Constant::POSINT, |
|---|
| 499 | store => Padre::Constant::HUMAN, |
|---|
| 500 | default => 1, |
|---|
| 501 | ); |
|---|
| 502 | |
|---|
| 503 | # Save if feedback has been send or not |
|---|
| 504 | setting( |
|---|
| 505 | name => 'nth_feedback', |
|---|
| 506 | type => Padre::Constant::BOOLEAN, |
|---|
| 507 | store => Padre::Constant::HUMAN, |
|---|
| 508 | default => 0, |
|---|
| 509 | ); |
|---|
| 510 | |
|---|
| 511 | # Have we shown the birthday popup this year? (Prevents duplicate popups) |
|---|
| 512 | # Store it on the host, because we can't really sync it properly. |
|---|
| 513 | setting( |
|---|
| 514 | name => 'nth_birthday', |
|---|
| 515 | type => Padre::Constant::INTEGER, |
|---|
| 516 | store => Padre::Constant::HOST, |
|---|
| 517 | default => 0, |
|---|
| 518 | ); |
|---|
| 519 | |
|---|
| 520 | |
|---|
| 521 | |
|---|
| 522 | |
|---|
| 523 | ###################################################################### |
|---|
| 524 | # Main Window Tools and Layout |
|---|
| 525 | |
|---|
| 526 | # Window |
|---|
| 527 | setting( |
|---|
| 528 | name => 'main_title', |
|---|
| 529 | type => Padre::Constant::ASCII, |
|---|
| 530 | store => Padre::Constant::HUMAN, |
|---|
| 531 | default => ( Padre::Constant::PORTABLE ? 'Padre Portable' : 'Padre' ), |
|---|
| 532 | help => _T('Contents of the window title') . _T('Several placeholders like the filename can be used'), |
|---|
| 533 | ); |
|---|
| 534 | |
|---|
| 535 | setting( |
|---|
| 536 | name => 'main_singleinstance', |
|---|
| 537 | type => Padre::Constant::BOOLEAN, |
|---|
| 538 | store => Padre::Constant::HUMAN, |
|---|
| 539 | default => Padre::Constant::DEFAULT_SINGLEINSTANCE, |
|---|
| 540 | startup => 1, |
|---|
| 541 | ); |
|---|
| 542 | |
|---|
| 543 | setting( |
|---|
| 544 | name => 'main_singleinstance_port', |
|---|
| 545 | type => Padre::Constant::POSINT, |
|---|
| 546 | store => Padre::Constant::HOST, |
|---|
| 547 | default => Padre::Constant::DEFAULT_SINGLEINSTANCE_PORT, |
|---|
| 548 | startup => 1, |
|---|
| 549 | ); |
|---|
| 550 | |
|---|
| 551 | setting( |
|---|
| 552 | name => 'main_lockinterface', |
|---|
| 553 | type => Padre::Constant::BOOLEAN, |
|---|
| 554 | store => Padre::Constant::HUMAN, |
|---|
| 555 | default => 1, |
|---|
| 556 | ); |
|---|
| 557 | |
|---|
| 558 | setting( |
|---|
| 559 | name => 'main_functions', |
|---|
| 560 | type => Padre::Constant::BOOLEAN, |
|---|
| 561 | store => Padre::Constant::HUMAN, |
|---|
| 562 | default => 0, |
|---|
| 563 | ); |
|---|
| 564 | |
|---|
| 565 | setting( |
|---|
| 566 | name => 'main_functions_panel', |
|---|
| 567 | type => Padre::Constant::ASCII, |
|---|
| 568 | store => Padre::Constant::HUMAN, |
|---|
| 569 | default => 'right', |
|---|
| 570 | options => $PANEL_OPTIONS, |
|---|
| 571 | ); |
|---|
| 572 | |
|---|
| 573 | setting( |
|---|
| 574 | name => 'main_functions_order', |
|---|
| 575 | type => Padre::Constant::ASCII, |
|---|
| 576 | store => Padre::Constant::HUMAN, |
|---|
| 577 | default => 'alphabetical', |
|---|
| 578 | options => { |
|---|
| 579 | 'original' => _T('Code Order'), |
|---|
| 580 | 'alphabetical' => _T('Alphabetical Order'), |
|---|
| 581 | 'alphabetical_private_last' => _T('Alphabetical Order (Private Last)'), |
|---|
| 582 | }, |
|---|
| 583 | ); |
|---|
| 584 | |
|---|
| 585 | setting( |
|---|
| 586 | name => 'main_outline', |
|---|
| 587 | type => Padre::Constant::BOOLEAN, |
|---|
| 588 | store => Padre::Constant::HUMAN, |
|---|
| 589 | default => 0, |
|---|
| 590 | ); |
|---|
| 591 | |
|---|
| 592 | setting( |
|---|
| 593 | name => 'main_outline_panel', |
|---|
| 594 | type => Padre::Constant::ASCII, |
|---|
| 595 | store => Padre::Constant::HUMAN, |
|---|
| 596 | default => 'right', |
|---|
| 597 | options => $PANEL_OPTIONS, |
|---|
| 598 | ); |
|---|
| 599 | |
|---|
| 600 | setting( |
|---|
| 601 | name => 'main_tasks', |
|---|
| 602 | type => Padre::Constant::BOOLEAN, |
|---|
| 603 | store => Padre::Constant::HUMAN, |
|---|
| 604 | default => 0, |
|---|
| 605 | ); |
|---|
| 606 | |
|---|
| 607 | setting( |
|---|
| 608 | name => 'main_tasks_panel', |
|---|
| 609 | type => Padre::Constant::ASCII, |
|---|
| 610 | store => Padre::Constant::HUMAN, |
|---|
| 611 | default => 'bottom', |
|---|
| 612 | options => $PANEL_OPTIONS, |
|---|
| 613 | ); |
|---|
| 614 | |
|---|
| 615 | setting( |
|---|
| 616 | name => 'main_tasks_regexp', |
|---|
| 617 | type => Padre::Constant::ASCII, |
|---|
| 618 | store => Padre::Constant::HUMAN, |
|---|
| 619 | default => "#\\s*(?:TO[- ]?DO|XXX|FIX[- ]?ME)(?:[ \\t]*[:-]?)(?:[ \\t]*)(.*?)\\s*\$", |
|---|
| 620 | ); |
|---|
| 621 | |
|---|
| 622 | setting( |
|---|
| 623 | name => 'main_directory', |
|---|
| 624 | type => Padre::Constant::BOOLEAN, |
|---|
| 625 | store => Padre::Constant::HUMAN, |
|---|
| 626 | default => 0, |
|---|
| 627 | ); |
|---|
| 628 | |
|---|
| 629 | setting( |
|---|
| 630 | name => 'main_directory_order', |
|---|
| 631 | type => Padre::Constant::ASCII, |
|---|
| 632 | store => Padre::Constant::HUMAN, |
|---|
| 633 | default => 'first', |
|---|
| 634 | options => { |
|---|
| 635 | first => _T('Directories First'), |
|---|
| 636 | mixed => _T('Directories Mixed'), |
|---|
| 637 | }, |
|---|
| 638 | ); |
|---|
| 639 | |
|---|
| 640 | setting( |
|---|
| 641 | name => 'main_directory_panel', |
|---|
| 642 | type => Padre::Constant::ASCII, |
|---|
| 643 | store => Padre::Constant::HUMAN, |
|---|
| 644 | default => 'left', |
|---|
| 645 | options => $PANEL_OPTIONS, |
|---|
| 646 | ); |
|---|
| 647 | |
|---|
| 648 | setting( |
|---|
| 649 | name => 'main_directory_root', |
|---|
| 650 | type => Padre::Constant::ASCII, |
|---|
| 651 | store => Padre::Constant::HOST, |
|---|
| 652 | default => File::HomeDir->my_documents || '', |
|---|
| 653 | ); |
|---|
| 654 | |
|---|
| 655 | setting( |
|---|
| 656 | name => 'main_output', |
|---|
| 657 | type => Padre::Constant::BOOLEAN, |
|---|
| 658 | store => Padre::Constant::HUMAN, |
|---|
| 659 | default => 0, |
|---|
| 660 | ); |
|---|
| 661 | |
|---|
| 662 | setting( |
|---|
| 663 | name => 'main_output_panel', |
|---|
| 664 | type => Padre::Constant::ASCII, |
|---|
| 665 | store => Padre::Constant::HUMAN, |
|---|
| 666 | default => 'bottom', |
|---|
| 667 | options => $PANEL_OPTIONS, |
|---|
| 668 | ); |
|---|
| 669 | |
|---|
| 670 | setting( |
|---|
| 671 | name => 'main_output_ansi', |
|---|
| 672 | type => Padre::Constant::BOOLEAN, |
|---|
| 673 | store => Padre::Constant::HUMAN, |
|---|
| 674 | default => 1, |
|---|
| 675 | ); |
|---|
| 676 | |
|---|
| 677 | setting( |
|---|
| 678 | name => 'main_command', |
|---|
| 679 | type => Padre::Constant::BOOLEAN, |
|---|
| 680 | store => Padre::Constant::HUMAN, |
|---|
| 681 | default => 0, |
|---|
| 682 | ); |
|---|
| 683 | |
|---|
| 684 | setting( |
|---|
| 685 | name => 'main_command_panel', |
|---|
| 686 | type => Padre::Constant::ASCII, |
|---|
| 687 | store => Padre::Constant::HUMAN, |
|---|
| 688 | default => 'bottom', |
|---|
| 689 | options => $PANEL_OPTIONS, |
|---|
| 690 | ); |
|---|
| 691 | |
|---|
| 692 | setting( |
|---|
| 693 | name => 'main_syntax', |
|---|
| 694 | type => Padre::Constant::BOOLEAN, |
|---|
| 695 | store => Padre::Constant::HUMAN, |
|---|
| 696 | default => 0, |
|---|
| 697 | ); |
|---|
| 698 | |
|---|
| 699 | setting( |
|---|
| 700 | name => 'main_syntax_panel', |
|---|
| 701 | type => Padre::Constant::ASCII, |
|---|
| 702 | store => Padre::Constant::HUMAN, |
|---|
| 703 | default => 'bottom', |
|---|
| 704 | options => $PANEL_OPTIONS, |
|---|
| 705 | ); |
|---|
| 706 | |
|---|
| 707 | setting( |
|---|
| 708 | name => 'main_vcs', |
|---|
| 709 | type => Padre::Constant::BOOLEAN, |
|---|
| 710 | store => Padre::Constant::HUMAN, |
|---|
| 711 | default => 0, |
|---|
| 712 | ); |
|---|
| 713 | |
|---|
| 714 | setting( |
|---|
| 715 | name => 'main_vcs_panel', |
|---|
| 716 | type => Padre::Constant::ASCII, |
|---|
| 717 | store => Padre::Constant::HUMAN, |
|---|
| 718 | default => 'right', |
|---|
| 719 | options => $PANEL_OPTIONS, |
|---|
| 720 | ); |
|---|
| 721 | |
|---|
| 722 | setting( |
|---|
| 723 | name => 'main_cpan', |
|---|
| 724 | type => Padre::Constant::BOOLEAN, |
|---|
| 725 | store => Padre::Constant::HUMAN, |
|---|
| 726 | default => 0, |
|---|
| 727 | ); |
|---|
| 728 | |
|---|
| 729 | setting( |
|---|
| 730 | name => 'main_cpan_panel', |
|---|
| 731 | type => Padre::Constant::ASCII, |
|---|
| 732 | store => Padre::Constant::HUMAN, |
|---|
| 733 | default => 'right', |
|---|
| 734 | options => $PANEL_OPTIONS, |
|---|
| 735 | ); |
|---|
| 736 | |
|---|
| 737 | setting( |
|---|
| 738 | name => 'main_foundinfiles_panel', |
|---|
| 739 | type => Padre::Constant::ASCII, |
|---|
| 740 | store => Padre::Constant::HUMAN, |
|---|
| 741 | default => 'bottom', |
|---|
| 742 | options => $PANEL_OPTIONS, |
|---|
| 743 | ); |
|---|
| 744 | |
|---|
| 745 | setting( |
|---|
| 746 | name => 'main_replaceinfiles_panel', |
|---|
| 747 | type => Padre::Constant::ASCII, |
|---|
| 748 | store => Padre::Constant::HUMAN, |
|---|
| 749 | default => 'bottom', |
|---|
| 750 | options => $PANEL_OPTIONS, |
|---|
| 751 | ); |
|---|
| 752 | |
|---|
| 753 | setting( |
|---|
| 754 | name => 'main_breakpoints', |
|---|
| 755 | type => Padre::Constant::BOOLEAN, |
|---|
| 756 | store => Padre::Constant::HUMAN, |
|---|
| 757 | default => 0, |
|---|
| 758 | ); |
|---|
| 759 | |
|---|
| 760 | setting( |
|---|
| 761 | name => 'main_debugoutput', |
|---|
| 762 | type => Padre::Constant::BOOLEAN, |
|---|
| 763 | store => Padre::Constant::HUMAN, |
|---|
| 764 | default => 0, |
|---|
| 765 | ); |
|---|
| 766 | |
|---|
| 767 | setting( |
|---|
| 768 | name => 'main_debugger', |
|---|
| 769 | type => Padre::Constant::BOOLEAN, |
|---|
| 770 | store => Padre::Constant::HUMAN, |
|---|
| 771 | default => 0, |
|---|
| 772 | ); |
|---|
| 773 | |
|---|
| 774 | setting( |
|---|
| 775 | name => 'main_statusbar', |
|---|
| 776 | type => Padre::Constant::BOOLEAN, |
|---|
| 777 | store => Padre::Constant::HUMAN, |
|---|
| 778 | default => 1, |
|---|
| 779 | help => _T('Show or hide the status bar at the bottom of the window.'), |
|---|
| 780 | ); |
|---|
| 781 | |
|---|
| 782 | setting( |
|---|
| 783 | name => 'main_statusbar_template', |
|---|
| 784 | type => Padre::Constant::ASCII, |
|---|
| 785 | store => Padre::Constant::HUMAN, |
|---|
| 786 | default => '%m %f', |
|---|
| 787 | help => _T('Contents of the status bar') . _T('Several placeholders like the filename can be used'), |
|---|
| 788 | ); |
|---|
| 789 | |
|---|
| 790 | setting( |
|---|
| 791 | name => 'main_toolbar', |
|---|
| 792 | type => Padre::Constant::BOOLEAN, |
|---|
| 793 | store => Padre::Constant::HUMAN, |
|---|
| 794 | |
|---|
| 795 | # Toolbars are not typically used for Mac apps. |
|---|
| 796 | # Hide it by default so Padre looks "more Mac'ish" |
|---|
| 797 | # NOTE: Or at least, so we were told. Opinions apparently vary. |
|---|
| 798 | default => Padre::Constant::MAC ? 0 : 1, |
|---|
| 799 | ); |
|---|
| 800 | |
|---|
| 801 | setting( |
|---|
| 802 | name => 'main_toolbar_items', |
|---|
| 803 | type => Padre::Constant::ASCII, |
|---|
| 804 | store => Padre::Constant::HUMAN, |
|---|
| 805 | |
|---|
| 806 | # This lives here until a better place is found: |
|---|
| 807 | # This is a list of toolbar items, separated by ; |
|---|
| 808 | # The following items are supported: |
|---|
| 809 | # action |
|---|
| 810 | # Insert the action |
|---|
| 811 | # action(argument,argument) |
|---|
| 812 | # Insert an action which requires one or more arguments |
|---|
| 813 | # | |
|---|
| 814 | # Insert a seperator |
|---|
| 815 | default => 'file.new;' |
|---|
| 816 | . 'file.open;' |
|---|
| 817 | . 'file.save;' |
|---|
| 818 | . 'file.save_as;' |
|---|
| 819 | . 'file.save_all;' |
|---|
| 820 | . 'file.close;' . '|;' |
|---|
| 821 | . 'file.open_example;' . '|;' |
|---|
| 822 | . 'edit.undo;' |
|---|
| 823 | . 'edit.redo;' . '|;' |
|---|
| 824 | . 'edit.cut;' |
|---|
| 825 | . 'edit.copy;' |
|---|
| 826 | . 'edit.paste;' |
|---|
| 827 | . 'edit.select_all;' . '|;' |
|---|
| 828 | . 'search.find;' |
|---|
| 829 | . 'search.replace;' . '|;' |
|---|
| 830 | . 'edit.comment_toggle;' . '|;' |
|---|
| 831 | . 'search.open_resource;' |
|---|
| 832 | . 'search.quick_menu_access;' . '|;' |
|---|
| 833 | . 'run.run_document;' |
|---|
| 834 | . 'run.stop;' . '|;' |
|---|
| 835 | . 'debug.launch;' |
|---|
| 836 | . 'debug.set_breakpoint;' |
|---|
| 837 | . 'debug.quit;'. '|;' |
|---|
| 838 | ); |
|---|
| 839 | |
|---|
| 840 | # Directory Tree Settings |
|---|
| 841 | setting( |
|---|
| 842 | name => 'default_projects_directory', |
|---|
| 843 | type => Padre::Constant::PATH, |
|---|
| 844 | store => Padre::Constant::HOST, |
|---|
| 845 | default => File::HomeDir->my_documents || '', |
|---|
| 846 | ); |
|---|
| 847 | |
|---|
| 848 | # Editor Settings |
|---|
| 849 | |
|---|
| 850 | # The default editor font should be Consolas 10pt on Vista and Windows 7 |
|---|
| 851 | setting( |
|---|
| 852 | name => 'editor_font', |
|---|
| 853 | type => Padre::Constant::ASCII, |
|---|
| 854 | store => Padre::Constant::HUMAN, |
|---|
| 855 | default => Padre::Util::DISTRO =~ /^WIN(?:VISTA|7)$/ ? 'consolas 10' : '', |
|---|
| 856 | ); |
|---|
| 857 | setting( |
|---|
| 858 | name => 'editor_linenumbers', |
|---|
| 859 | type => Padre::Constant::BOOLEAN, |
|---|
| 860 | store => Padre::Constant::HUMAN, |
|---|
| 861 | default => 1, |
|---|
| 862 | ); |
|---|
| 863 | setting( |
|---|
| 864 | name => 'editor_eol', |
|---|
| 865 | type => Padre::Constant::BOOLEAN, |
|---|
| 866 | store => Padre::Constant::HUMAN, |
|---|
| 867 | default => 0, |
|---|
| 868 | ); |
|---|
| 869 | setting( |
|---|
| 870 | name => 'editor_whitespace', |
|---|
| 871 | type => Padre::Constant::BOOLEAN, |
|---|
| 872 | store => Padre::Constant::HUMAN, |
|---|
| 873 | default => 0, |
|---|
| 874 | ); |
|---|
| 875 | setting( |
|---|
| 876 | name => 'editor_indentationguides', |
|---|
| 877 | type => Padre::Constant::BOOLEAN, |
|---|
| 878 | store => Padre::Constant::HUMAN, |
|---|
| 879 | default => 0, |
|---|
| 880 | ); |
|---|
| 881 | setting( |
|---|
| 882 | name => 'editor_calltips', |
|---|
| 883 | type => Padre::Constant::BOOLEAN, |
|---|
| 884 | store => Padre::Constant::HUMAN, |
|---|
| 885 | default => 0, |
|---|
| 886 | ); |
|---|
| 887 | setting( |
|---|
| 888 | name => 'editor_autoindent', |
|---|
| 889 | type => Padre::Constant::ASCII, |
|---|
| 890 | store => Padre::Constant::HUMAN, |
|---|
| 891 | default => 'deep', |
|---|
| 892 | options => { |
|---|
| 893 | 'no' => _T('No Autoindent'), |
|---|
| 894 | 'same' => _T('Indent to Same Depth'), |
|---|
| 895 | 'deep' => _T('Indent Deeply'), |
|---|
| 896 | }, |
|---|
| 897 | ); |
|---|
| 898 | setting( |
|---|
| 899 | name => 'editor_folding', |
|---|
| 900 | type => Padre::Constant::BOOLEAN, |
|---|
| 901 | store => Padre::Constant::HUMAN, |
|---|
| 902 | default => 0, |
|---|
| 903 | ); |
|---|
| 904 | setting( |
|---|
| 905 | name => 'editor_fold_pod', |
|---|
| 906 | type => Padre::Constant::BOOLEAN, |
|---|
| 907 | store => Padre::Constant::HUMAN, |
|---|
| 908 | default => 0, |
|---|
| 909 | ); |
|---|
| 910 | |
|---|
| 911 | setting( |
|---|
| 912 | name => 'editor_brace_expression_highlighting', |
|---|
| 913 | type => Padre::Constant::BOOLEAN, |
|---|
| 914 | store => Padre::Constant::HUMAN, |
|---|
| 915 | default => 0, |
|---|
| 916 | ); |
|---|
| 917 | |
|---|
| 918 | setting( |
|---|
| 919 | name => 'save_autoclean', |
|---|
| 920 | type => Padre::Constant::BOOLEAN, |
|---|
| 921 | store => Padre::Constant::HUMAN, |
|---|
| 922 | default => 0, |
|---|
| 923 | ); |
|---|
| 924 | setting( |
|---|
| 925 | name => 'editor_currentline', |
|---|
| 926 | type => Padre::Constant::BOOLEAN, |
|---|
| 927 | store => Padre::Constant::HUMAN, |
|---|
| 928 | default => 1, |
|---|
| 929 | ); |
|---|
| 930 | setting( |
|---|
| 931 | name => 'editor_currentline_color', |
|---|
| 932 | type => Padre::Constant::ASCII, |
|---|
| 933 | store => Padre::Constant::HUMAN, |
|---|
| 934 | default => 'FFFF04', |
|---|
| 935 | ); |
|---|
| 936 | setting( |
|---|
| 937 | name => 'editor_wordwrap', |
|---|
| 938 | type => Padre::Constant::BOOLEAN, |
|---|
| 939 | store => Padre::Constant::HUMAN, |
|---|
| 940 | default => 0, |
|---|
| 941 | ); |
|---|
| 942 | setting( |
|---|
| 943 | name => 'editor_file_size_limit', |
|---|
| 944 | type => Padre::Constant::POSINT, |
|---|
| 945 | store => Padre::Constant::HUMAN, |
|---|
| 946 | default => 500_000, |
|---|
| 947 | ); |
|---|
| 948 | setting( |
|---|
| 949 | name => 'editor_right_margin_enable', |
|---|
| 950 | type => Padre::Constant::BOOLEAN, |
|---|
| 951 | store => Padre::Constant::HUMAN, |
|---|
| 952 | default => 0, |
|---|
| 953 | ); |
|---|
| 954 | setting( |
|---|
| 955 | name => 'editor_right_margin_column', |
|---|
| 956 | type => Padre::Constant::POSINT, |
|---|
| 957 | store => Padre::Constant::HUMAN, |
|---|
| 958 | default => 80, |
|---|
| 959 | ); |
|---|
| 960 | setting( |
|---|
| 961 | name => 'editor_smart_highlight_enable', |
|---|
| 962 | type => Padre::Constant::BOOLEAN, |
|---|
| 963 | store => Padre::Constant::HUMAN, |
|---|
| 964 | default => 1, |
|---|
| 965 | ); |
|---|
| 966 | setting( |
|---|
| 967 | name => 'editor_cursor_blink', |
|---|
| 968 | type => Padre::Constant::INTEGER, |
|---|
| 969 | store => Padre::Constant::HUMAN, |
|---|
| 970 | default => 500, # milliseconds |
|---|
| 971 | ); |
|---|
| 972 | setting( |
|---|
| 973 | name => 'editor_dwell', |
|---|
| 974 | type => Padre::Constant::INTEGER, |
|---|
| 975 | store => Padre::Constant::HUMAN, |
|---|
| 976 | default => 500, |
|---|
| 977 | ); |
|---|
| 978 | setting( |
|---|
| 979 | name => 'find_case', |
|---|
| 980 | type => Padre::Constant::BOOLEAN, |
|---|
| 981 | store => Padre::Constant::HUMAN, |
|---|
| 982 | default => 1, |
|---|
| 983 | ); |
|---|
| 984 | setting( |
|---|
| 985 | name => 'find_regex', |
|---|
| 986 | type => Padre::Constant::BOOLEAN, |
|---|
| 987 | store => Padre::Constant::HUMAN, |
|---|
| 988 | default => 0, |
|---|
| 989 | ); |
|---|
| 990 | setting( |
|---|
| 991 | name => 'find_reverse', |
|---|
| 992 | type => Padre::Constant::BOOLEAN, |
|---|
| 993 | store => Padre::Constant::HUMAN, |
|---|
| 994 | default => 0, |
|---|
| 995 | ); |
|---|
| 996 | setting( |
|---|
| 997 | name => 'find_first', |
|---|
| 998 | type => Padre::Constant::BOOLEAN, |
|---|
| 999 | store => Padre::Constant::HUMAN, |
|---|
| 1000 | default => 0, |
|---|
| 1001 | ); |
|---|
| 1002 | setting( |
|---|
| 1003 | name => 'find_nohidden', |
|---|
| 1004 | type => Padre::Constant::BOOLEAN, |
|---|
| 1005 | store => Padre::Constant::HUMAN, |
|---|
| 1006 | default => 1, |
|---|
| 1007 | ); |
|---|
| 1008 | setting( |
|---|
| 1009 | name => 'find_nomatch', |
|---|
| 1010 | type => Padre::Constant::BOOLEAN, |
|---|
| 1011 | store => Padre::Constant::HUMAN, |
|---|
| 1012 | default => 0, |
|---|
| 1013 | ); |
|---|
| 1014 | setting( |
|---|
| 1015 | name => 'default_line_ending', |
|---|
| 1016 | type => Padre::Constant::ASCII, |
|---|
| 1017 | store => Padre::Constant::HUMAN, |
|---|
| 1018 | default => Padre::Constant::NEWLINE, |
|---|
| 1019 | options => { |
|---|
| 1020 | 'UNIX' => 'UNIX', |
|---|
| 1021 | 'WIN' => 'WIN', |
|---|
| 1022 | 'MAC' => 'MAC', |
|---|
| 1023 | }, |
|---|
| 1024 | ); |
|---|
| 1025 | setting( |
|---|
| 1026 | name => 'update_file_from_disk_interval', |
|---|
| 1027 | type => Padre::Constant::ASCII, |
|---|
| 1028 | store => Padre::Constant::HUMAN, |
|---|
| 1029 | default => 2, |
|---|
| 1030 | ); |
|---|
| 1031 | |
|---|
| 1032 | # Autocomplete settings (global and Perl-specific) |
|---|
| 1033 | setting( |
|---|
| 1034 | name => 'autocomplete_multiclosebracket', |
|---|
| 1035 | type => Padre::Constant::BOOLEAN, |
|---|
| 1036 | store => Padre::Constant::HUMAN, |
|---|
| 1037 | default => 0, |
|---|
| 1038 | ); |
|---|
| 1039 | setting( |
|---|
| 1040 | name => 'autocomplete_always', |
|---|
| 1041 | type => Padre::Constant::BOOLEAN, |
|---|
| 1042 | store => Padre::Constant::HUMAN, |
|---|
| 1043 | default => 0, |
|---|
| 1044 | ); |
|---|
| 1045 | setting( |
|---|
| 1046 | name => 'autocomplete_method', |
|---|
| 1047 | type => Padre::Constant::BOOLEAN, |
|---|
| 1048 | store => Padre::Constant::HUMAN, |
|---|
| 1049 | default => 0, |
|---|
| 1050 | ); |
|---|
| 1051 | setting( |
|---|
| 1052 | name => 'autocomplete_subroutine', |
|---|
| 1053 | type => Padre::Constant::BOOLEAN, |
|---|
| 1054 | store => Padre::Constant::HUMAN, |
|---|
| 1055 | default => 0, |
|---|
| 1056 | ); |
|---|
| 1057 | setting( |
|---|
| 1058 | name => 'lang_perl5_autocomplete_max_suggestions', |
|---|
| 1059 | type => Padre::Constant::ASCII, |
|---|
| 1060 | store => Padre::Constant::HUMAN, |
|---|
| 1061 | default => 20, |
|---|
| 1062 | ); |
|---|
| 1063 | setting( |
|---|
| 1064 | name => 'lang_perl5_autocomplete_min_chars', |
|---|
| 1065 | type => Padre::Constant::ASCII, |
|---|
| 1066 | store => Padre::Constant::HUMAN, |
|---|
| 1067 | default => 1, |
|---|
| 1068 | ); |
|---|
| 1069 | setting( |
|---|
| 1070 | name => 'lang_perl5_autocomplete_min_suggestion_len', |
|---|
| 1071 | type => Padre::Constant::ASCII, |
|---|
| 1072 | store => Padre::Constant::HUMAN, |
|---|
| 1073 | default => 3, |
|---|
| 1074 | ); |
|---|
| 1075 | setting( |
|---|
| 1076 | name => 'lang_perl5_lexer_ppi_limit', |
|---|
| 1077 | type => Padre::Constant::POSINT, |
|---|
| 1078 | store => Padre::Constant::HUMAN, |
|---|
| 1079 | default => 4000, |
|---|
| 1080 | ); |
|---|
| 1081 | |
|---|
| 1082 | # Behaviour Tuning |
|---|
| 1083 | # When running a script from the application some of the files might have |
|---|
| 1084 | # not been saved yet. There are several option what to do before running the |
|---|
| 1085 | # script: |
|---|
| 1086 | # none - don't save anything (the script will be run without current modifications) |
|---|
| 1087 | # unsaved - as above but including modifications present in the buffer |
|---|
| 1088 | # same - save the file in the current buffer |
|---|
| 1089 | # all_files - all the files (but not buffers that have no filenames) |
|---|
| 1090 | # all_buffers - all the buffers even if they don't have a name yet |
|---|
| 1091 | setting( |
|---|
| 1092 | name => 'run_save', |
|---|
| 1093 | type => Padre::Constant::ASCII, |
|---|
| 1094 | store => Padre::Constant::HUMAN, |
|---|
| 1095 | default => 'same', |
|---|
| 1096 | ); |
|---|
| 1097 | setting( |
|---|
| 1098 | name => 'run_perl_cmd', |
|---|
| 1099 | type => Padre::Constant::ASCII, |
|---|
| 1100 | store => Padre::Constant::HOST, |
|---|
| 1101 | |
|---|
| 1102 | # We don't get a default from Padre::Perl, because the saved value |
|---|
| 1103 | # may be outdated sometimes in the future, reading it fresh on |
|---|
| 1104 | # every run makes us more future-compatible |
|---|
| 1105 | default => '', |
|---|
| 1106 | ); |
|---|
| 1107 | |
|---|
| 1108 | setting( |
|---|
| 1109 | name => 'lang_perl5_tags_file', |
|---|
| 1110 | type => Padre::Constant::ASCII, |
|---|
| 1111 | store => Padre::Constant::HOST, |
|---|
| 1112 | |
|---|
| 1113 | # Don't save a default to allow future updates |
|---|
| 1114 | default => '', |
|---|
| 1115 | ); |
|---|
| 1116 | |
|---|
| 1117 | setting( |
|---|
| 1118 | name => 'lang_perl5_lexer', |
|---|
| 1119 | type => Padre::Constant::ASCII, |
|---|
| 1120 | store => Padre::Constant::HOST, |
|---|
| 1121 | default => '', |
|---|
| 1122 | options => { |
|---|
| 1123 | '' => _T('Scintilla'), |
|---|
| 1124 | 'Padre::Document::Perl::Lexer' => _T('PPI Experimental'), |
|---|
| 1125 | 'Padre::Document::Perl::PPILexer' => _T('PPI Standard'), |
|---|
| 1126 | }, |
|---|
| 1127 | ); |
|---|
| 1128 | |
|---|
| 1129 | setting( |
|---|
| 1130 | name => 'xs_calltips_perlapi_version', |
|---|
| 1131 | type => Padre::Constant::ASCII, |
|---|
| 1132 | store => Padre::Constant::PROJECT, |
|---|
| 1133 | default => 'newest', |
|---|
| 1134 | project => 1, |
|---|
| 1135 | ); |
|---|
| 1136 | |
|---|
| 1137 | setting( |
|---|
| 1138 | name => 'info_on_statusbar', |
|---|
| 1139 | type => Padre::Constant::BOOLEAN, |
|---|
| 1140 | store => Padre::Constant::HUMAN, |
|---|
| 1141 | default => 0, |
|---|
| 1142 | help => _T('Show low-priority info messages on statusbar (not in a popup)'), |
|---|
| 1143 | ); |
|---|
| 1144 | |
|---|
| 1145 | # Move of stacktrace to run menu: will be removed (run_stacktrace) |
|---|
| 1146 | setting( |
|---|
| 1147 | name => 'run_stacktrace', |
|---|
| 1148 | type => Padre::Constant::BOOLEAN, |
|---|
| 1149 | store => Padre::Constant::HUMAN, |
|---|
| 1150 | default => 0, |
|---|
| 1151 | ); |
|---|
| 1152 | setting( |
|---|
| 1153 | name => 'autocomplete_brackets', |
|---|
| 1154 | type => Padre::Constant::BOOLEAN, |
|---|
| 1155 | store => Padre::Constant::HUMAN, |
|---|
| 1156 | default => 0, |
|---|
| 1157 | ); |
|---|
| 1158 | |
|---|
| 1159 | setting( |
|---|
| 1160 | name => 'mid_button_paste', |
|---|
| 1161 | type => Padre::Constant::BOOLEAN, |
|---|
| 1162 | store => Padre::Constant::HUMAN, |
|---|
| 1163 | default => 0, |
|---|
| 1164 | ); |
|---|
| 1165 | |
|---|
| 1166 | setting( |
|---|
| 1167 | name => 'sessionmanager_sortorder', |
|---|
| 1168 | type => Padre::Constant::ASCII, |
|---|
| 1169 | store => Padre::Constant::HUMAN, |
|---|
| 1170 | default => "0,0", |
|---|
| 1171 | ); |
|---|
| 1172 | |
|---|
| 1173 | # By default use background threads unless profiling |
|---|
| 1174 | # TO DO - Make the default actually change |
|---|
| 1175 | |
|---|
| 1176 | # (Ticket # 669) |
|---|
| 1177 | setting( |
|---|
| 1178 | name => 'threads', |
|---|
| 1179 | type => Padre::Constant::BOOLEAN, |
|---|
| 1180 | store => Padre::Constant::HUMAN, |
|---|
| 1181 | default => 1, |
|---|
| 1182 | startup => 1, |
|---|
| 1183 | ); |
|---|
| 1184 | setting( |
|---|
| 1185 | name => 'threads_maximum', |
|---|
| 1186 | type => Padre::Constant::INTEGER, |
|---|
| 1187 | store => Padre::Constant::HOST, |
|---|
| 1188 | default => 9, |
|---|
| 1189 | ); |
|---|
| 1190 | setting( |
|---|
| 1191 | name => 'threads_stacksize', |
|---|
| 1192 | type => Padre::Constant::INTEGER, |
|---|
| 1193 | store => Padre::Constant::HOST, |
|---|
| 1194 | default => Padre::Constant::WIN32 ? 4194304 : 0, |
|---|
| 1195 | startup => 1, |
|---|
| 1196 | ); |
|---|
| 1197 | setting( |
|---|
| 1198 | name => 'locale', |
|---|
| 1199 | type => Padre::Constant::ASCII, |
|---|
| 1200 | store => Padre::Constant::HUMAN, |
|---|
| 1201 | default => '', |
|---|
| 1202 | ); |
|---|
| 1203 | setting( |
|---|
| 1204 | name => 'locale_perldiag', |
|---|
| 1205 | type => Padre::Constant::ASCII, |
|---|
| 1206 | store => Padre::Constant::HUMAN, |
|---|
| 1207 | default => '', |
|---|
| 1208 | ); |
|---|
| 1209 | |
|---|
| 1210 | # Colour Data |
|---|
| 1211 | # Since it's in local files, it has to be a host-specific setting. |
|---|
| 1212 | setting( |
|---|
| 1213 | name => 'editor_style', |
|---|
| 1214 | type => Padre::Constant::ASCII, |
|---|
| 1215 | store => Padre::Constant::HOST, |
|---|
| 1216 | default => 'default', |
|---|
| 1217 | options => Padre::Config->themes, |
|---|
| 1218 | ); |
|---|
| 1219 | |
|---|
| 1220 | # Window Geometry |
|---|
| 1221 | setting( |
|---|
| 1222 | name => 'main_maximized', |
|---|
| 1223 | type => Padre::Constant::BOOLEAN, |
|---|
| 1224 | store => Padre::Constant::HOST, |
|---|
| 1225 | default => 0, |
|---|
| 1226 | ); |
|---|
| 1227 | setting( |
|---|
| 1228 | name => 'main_top', |
|---|
| 1229 | type => Padre::Constant::INTEGER, |
|---|
| 1230 | store => Padre::Constant::HOST, |
|---|
| 1231 | default => -1, |
|---|
| 1232 | ); |
|---|
| 1233 | setting( |
|---|
| 1234 | name => 'main_left', |
|---|
| 1235 | type => Padre::Constant::INTEGER, |
|---|
| 1236 | store => Padre::Constant::HOST, |
|---|
| 1237 | default => -1, |
|---|
| 1238 | ); |
|---|
| 1239 | setting( |
|---|
| 1240 | name => 'main_width', |
|---|
| 1241 | type => Padre::Constant::POSINT, |
|---|
| 1242 | store => Padre::Constant::HOST, |
|---|
| 1243 | default => -1, |
|---|
| 1244 | ); |
|---|
| 1245 | setting( |
|---|
| 1246 | name => 'main_height', |
|---|
| 1247 | type => Padre::Constant::POSINT, |
|---|
| 1248 | store => Padre::Constant::HOST, |
|---|
| 1249 | default => -1, |
|---|
| 1250 | ); |
|---|
| 1251 | |
|---|
| 1252 | # Run Parameters |
|---|
| 1253 | setting( |
|---|
| 1254 | name => 'run_interpreter_args_default', |
|---|
| 1255 | type => Padre::Constant::ASCII, |
|---|
| 1256 | store => Padre::Constant::HOST, |
|---|
| 1257 | default => '', |
|---|
| 1258 | ); |
|---|
| 1259 | setting( |
|---|
| 1260 | name => 'run_script_args_default', |
|---|
| 1261 | type => Padre::Constant::ASCII, |
|---|
| 1262 | store => Padre::Constant::HOST, |
|---|
| 1263 | default => '', |
|---|
| 1264 | ); |
|---|
| 1265 | setting( |
|---|
| 1266 | name => 'run_use_external_window', |
|---|
| 1267 | type => Padre::Constant::BOOLEAN, |
|---|
| 1268 | store => Padre::Constant::HOST, |
|---|
| 1269 | default => 1, |
|---|
| 1270 | ); |
|---|
| 1271 | |
|---|
| 1272 | # External tool integration |
|---|
| 1273 | |
|---|
| 1274 | setting( |
|---|
| 1275 | name => 'bin_shell', |
|---|
| 1276 | type => Padre::Constant::PATH, |
|---|
| 1277 | store => Padre::Constant::HOST, |
|---|
| 1278 | default => Padre::Constant::WIN32 ? 'cmd.exe' : '', |
|---|
| 1279 | ); |
|---|
| 1280 | |
|---|
| 1281 | # Enable/Disable entire functions that some people dislike. |
|---|
| 1282 | # Normally these should be enabled by default (or should be |
|---|
| 1283 | # planned to eventually be enabled by default). |
|---|
| 1284 | |
|---|
| 1285 | # Disable Bookmark functionality. |
|---|
| 1286 | # Reduces code size and menu entries. |
|---|
| 1287 | setting( |
|---|
| 1288 | name => 'feature_bookmark', |
|---|
| 1289 | type => Padre::Constant::BOOLEAN, |
|---|
| 1290 | store => Padre::Constant::HUMAN, |
|---|
| 1291 | default => 1, |
|---|
| 1292 | ); |
|---|
| 1293 | |
|---|
| 1294 | # Disable convenience font-size changes. |
|---|
| 1295 | # Reduces menu entries and prevents accidental font size changes |
|---|
| 1296 | # due to Ctrl-MouseWheel mistakes. |
|---|
| 1297 | setting( |
|---|
| 1298 | name => 'feature_fontsize', |
|---|
| 1299 | type => Padre::Constant::BOOLEAN, |
|---|
| 1300 | store => Padre::Constant::HUMAN, |
|---|
| 1301 | default => 1, |
|---|
| 1302 | ); |
|---|
| 1303 | |
|---|
| 1304 | # Disable code folding. |
|---|
| 1305 | # Reduces code bloat and menu entries. |
|---|
| 1306 | setting( |
|---|
| 1307 | name => 'feature_folding', |
|---|
| 1308 | type => Padre::Constant::BOOLEAN, |
|---|
| 1309 | store => Padre::Constant::HUMAN, |
|---|
| 1310 | default => 1, |
|---|
| 1311 | ); |
|---|
| 1312 | |
|---|
| 1313 | # Disable session support. |
|---|
| 1314 | # Reduces code bloat and database operations. |
|---|
| 1315 | setting( |
|---|
| 1316 | name => 'feature_session', |
|---|
| 1317 | type => Padre::Constant::BOOLEAN, |
|---|
| 1318 | store => Padre::Constant::HUMAN, |
|---|
| 1319 | default => 1, |
|---|
| 1320 | ); |
|---|
| 1321 | |
|---|
| 1322 | # Disable remembering cursor position. |
|---|
| 1323 | # Reduces code bloat and database operations. |
|---|
| 1324 | setting( |
|---|
| 1325 | name => 'feature_cursormemory', |
|---|
| 1326 | type => Padre::Constant::BOOLEAN, |
|---|
| 1327 | store => Padre::Constant::HUMAN, |
|---|
| 1328 | default => 1, |
|---|
| 1329 | ); |
|---|
| 1330 | |
|---|
| 1331 | # Disable GUI debugger. |
|---|
| 1332 | # Reduces code bloat and toolbar/menu entries for people that |
|---|
| 1333 | # prefer to use command line debugger (which is also less buggy) |
|---|
| 1334 | setting( |
|---|
| 1335 | name => 'feature_debugger', |
|---|
| 1336 | type => Padre::Constant::BOOLEAN, |
|---|
| 1337 | store => Padre::Constant::HUMAN, |
|---|
| 1338 | default => 1, |
|---|
| 1339 | ); |
|---|
| 1340 | |
|---|
| 1341 | # Enable experimental quick fix system. |
|---|
| 1342 | setting( |
|---|
| 1343 | name => 'feature_quick_fix', |
|---|
| 1344 | type => Padre::Constant::BOOLEAN, |
|---|
| 1345 | store => Padre::Constant::HUMAN, |
|---|
| 1346 | default => 0, |
|---|
| 1347 | ); |
|---|
| 1348 | |
|---|
| 1349 | # Enable experimental preference sync support. |
|---|
| 1350 | setting( |
|---|
| 1351 | name => 'feature_sync', |
|---|
| 1352 | type => Padre::Constant::BOOLEAN, |
|---|
| 1353 | store => Padre::Constant::HUMAN, |
|---|
| 1354 | default => 0, |
|---|
| 1355 | ); |
|---|
| 1356 | |
|---|
| 1357 | # Enable experimental expanded style support |
|---|
| 1358 | setting( |
|---|
| 1359 | name => 'feature_style_gui', |
|---|
| 1360 | type => Padre::Constant::BOOLEAN, |
|---|
| 1361 | store => Padre::Constant::HUMAN, |
|---|
| 1362 | default => 0, |
|---|
| 1363 | ); |
|---|
| 1364 | |
|---|
| 1365 | # Enable experimental Run with Devel::EndStats support. |
|---|
| 1366 | setting( |
|---|
| 1367 | name => 'feature_devel_endstats', |
|---|
| 1368 | type => Padre::Constant::BOOLEAN, |
|---|
| 1369 | store => Padre::Constant::HUMAN, |
|---|
| 1370 | default => 0, |
|---|
| 1371 | help => _T('Enable or disable the Run with Devel::EndStats if it is installed. ') |
|---|
| 1372 | . _T('This requires an installed Devel::EndStats and a Padre restart'), |
|---|
| 1373 | ); |
|---|
| 1374 | |
|---|
| 1375 | # Specify Devel::EndStats options for experimental Run with Devel::EndStats support |
|---|
| 1376 | setting( |
|---|
| 1377 | name => 'feature_devel_endstats_options', |
|---|
| 1378 | type => Padre::Constant::ASCII, |
|---|
| 1379 | store => Padre::Constant::HUMAN, |
|---|
| 1380 | default => 'verbose,1', |
|---|
| 1381 | help => _T(q{Specify Devel::EndStats options. 'feature_devel_endstats' must be enabled.}), |
|---|
| 1382 | ); |
|---|
| 1383 | |
|---|
| 1384 | # Enable experimental Run with Devel::TraceUse support. |
|---|
| 1385 | setting( |
|---|
| 1386 | name => 'feature_devel_traceuse', |
|---|
| 1387 | type => Padre::Constant::BOOLEAN, |
|---|
| 1388 | store => Padre::Constant::HUMAN, |
|---|
| 1389 | default => 0, |
|---|
| 1390 | help => _T('Enable or disable the Run with Devel::TraceUse if it is installed. ') |
|---|
| 1391 | . _T('This requires an installed Devel::TraceUse and a Padre restart'), |
|---|
| 1392 | ); |
|---|
| 1393 | |
|---|
| 1394 | # Specify Devel::TraceUse options for experimental Run with Devel::TraceUse support |
|---|
| 1395 | setting( |
|---|
| 1396 | name => 'feature_devel_traceuse_options', |
|---|
| 1397 | type => Padre::Constant::ASCII, |
|---|
| 1398 | store => Padre::Constant::HUMAN, |
|---|
| 1399 | default => '', |
|---|
| 1400 | help => _T(q{Specify Devel::TraceUse options. 'feature_devel_traceuse' must be enabled.}), |
|---|
| 1401 | ); |
|---|
| 1402 | |
|---|
| 1403 | # Toggle syntax checker annotations in editor |
|---|
| 1404 | setting( |
|---|
| 1405 | name => 'feature_syntax_check_annotations', |
|---|
| 1406 | type => Padre::Constant::BOOLEAN, |
|---|
| 1407 | store => Padre::Constant::HUMAN, |
|---|
| 1408 | default => 1, |
|---|
| 1409 | help => _T('Enable syntax checker annotations in the editor') |
|---|
| 1410 | ); |
|---|
| 1411 | |
|---|
| 1412 | # Toggle document differences feature |
|---|
| 1413 | setting( |
|---|
| 1414 | name => 'feature_document_diffs', |
|---|
| 1415 | type => Padre::Constant::BOOLEAN, |
|---|
| 1416 | store => Padre::Constant::HUMAN, |
|---|
| 1417 | default => 1, |
|---|
| 1418 | help => _T('Enable document differences feature') |
|---|
| 1419 | ); |
|---|
| 1420 | |
|---|
| 1421 | # Toggle version control system (VCS) support |
|---|
| 1422 | setting( |
|---|
| 1423 | name => 'feature_vcs_support', |
|---|
| 1424 | type => Padre::Constant::BOOLEAN, |
|---|
| 1425 | store => Padre::Constant::HUMAN, |
|---|
| 1426 | default => 1, |
|---|
| 1427 | help => _T('Enable version control system support') |
|---|
| 1428 | ); |
|---|
| 1429 | |
|---|
| 1430 | # Toggle MetaCPAN CPAN explorer panel |
|---|
| 1431 | setting( |
|---|
| 1432 | name => 'feature_cpan', |
|---|
| 1433 | type => Padre::Constant::BOOLEAN, |
|---|
| 1434 | store => Padre::Constant::HUMAN, |
|---|
| 1435 | default => 1, |
|---|
| 1436 | help => _T('Enable the CPAN Explorer, powered by MetaCPAN'), |
|---|
| 1437 | ); |
|---|
| 1438 | |
|---|
| 1439 | # Toggle Diff window feature |
|---|
| 1440 | setting( |
|---|
| 1441 | name => 'feature_diff_window', |
|---|
| 1442 | type => Padre::Constant::BOOLEAN, |
|---|
| 1443 | store => Padre::Constant::HUMAN, |
|---|
| 1444 | default => 0, |
|---|
| 1445 | help => _T('Toggle Diff window feature that compares two buffers graphically'), |
|---|
| 1446 | ); |
|---|
| 1447 | |
|---|
| 1448 | # Experimental command line interface |
|---|
| 1449 | setting( |
|---|
| 1450 | name => 'feature_command', |
|---|
| 1451 | type => Padre::Constant::BOOLEAN, |
|---|
| 1452 | store => Padre::Constant::HUMAN, |
|---|
| 1453 | default => 0, |
|---|
| 1454 | help => _T('Enable the experimental command line interface'), |
|---|
| 1455 | ); |
|---|
| 1456 | |
|---|
| 1457 | # Toggle Perl 6 auto detection |
|---|
| 1458 | setting( |
|---|
| 1459 | name => 'lang_perl6_auto_detection', |
|---|
| 1460 | type => Padre::Constant::BOOLEAN, |
|---|
| 1461 | store => Padre::Constant::HUMAN, |
|---|
| 1462 | default => 0, |
|---|
| 1463 | help => _T('Toggle Perl 6 auto detection in Perl 5 files') |
|---|
| 1464 | ); |
|---|
| 1465 | |
|---|
| 1466 | # Window menu list shorten common path |
|---|
| 1467 | setting( |
|---|
| 1468 | name => 'window_list_shorten_path', |
|---|
| 1469 | type => Padre::Constant::ASCII, |
|---|
| 1470 | store => Padre::Constant::HUMAN, |
|---|
| 1471 | default => 1, |
|---|
| 1472 | ); |
|---|
| 1473 | |
|---|
| 1474 | # Perl 5 Beginner Mode |
|---|
| 1475 | setting( |
|---|
| 1476 | name => 'lang_perl5_beginner', |
|---|
| 1477 | type => Padre::Constant::BOOLEAN, |
|---|
| 1478 | store => Padre::Constant::HUMAN, |
|---|
| 1479 | default => 1, |
|---|
| 1480 | ); |
|---|
| 1481 | |
|---|
| 1482 | setting( |
|---|
| 1483 | name => 'lang_perl5_beginner_split', |
|---|
| 1484 | type => Padre::Constant::BOOLEAN, |
|---|
| 1485 | store => Padre::Constant::HOST, |
|---|
| 1486 | default => 1, |
|---|
| 1487 | ); |
|---|
| 1488 | |
|---|
| 1489 | setting( |
|---|
| 1490 | name => 'lang_perl5_beginner_warning', |
|---|
| 1491 | type => Padre::Constant::BOOLEAN, |
|---|
| 1492 | store => Padre::Constant::HOST, |
|---|
| 1493 | default => 1, |
|---|
| 1494 | ); |
|---|
| 1495 | |
|---|
| 1496 | setting( |
|---|
| 1497 | name => 'lang_perl5_beginner_map', |
|---|
| 1498 | type => Padre::Constant::BOOLEAN, |
|---|
| 1499 | store => Padre::Constant::HOST, |
|---|
| 1500 | default => 1, |
|---|
| 1501 | ); |
|---|
| 1502 | |
|---|
| 1503 | setting( |
|---|
| 1504 | name => 'lang_perl5_beginner_debugger', |
|---|
| 1505 | type => Padre::Constant::BOOLEAN, |
|---|
| 1506 | store => Padre::Constant::HOST, |
|---|
| 1507 | default => 1, |
|---|
| 1508 | ); |
|---|
| 1509 | |
|---|
| 1510 | setting( |
|---|
| 1511 | name => 'lang_perl5_beginner_chomp', |
|---|
| 1512 | type => Padre::Constant::BOOLEAN, |
|---|
| 1513 | store => Padre::Constant::HOST, |
|---|
| 1514 | default => 1, |
|---|
| 1515 | ); |
|---|
| 1516 | |
|---|
| 1517 | setting( |
|---|
| 1518 | name => 'lang_perl5_beginner_map2', |
|---|
| 1519 | type => Padre::Constant::BOOLEAN, |
|---|
| 1520 | store => Padre::Constant::HOST, |
|---|
| 1521 | default => 1, |
|---|
| 1522 | ); |
|---|
| 1523 | |
|---|
| 1524 | setting( |
|---|
| 1525 | name => 'lang_perl5_beginner_perl6', |
|---|
| 1526 | type => Padre::Constant::BOOLEAN, |
|---|
| 1527 | store => Padre::Constant::HOST, |
|---|
| 1528 | default => 1, |
|---|
| 1529 | ); |
|---|
| 1530 | |
|---|
| 1531 | setting( |
|---|
| 1532 | name => 'lang_perl5_beginner_ifsetvar', |
|---|
| 1533 | type => Padre::Constant::BOOLEAN, |
|---|
| 1534 | store => Padre::Constant::HOST, |
|---|
| 1535 | default => 1, |
|---|
| 1536 | ); |
|---|
| 1537 | |
|---|
| 1538 | setting( |
|---|
| 1539 | name => 'lang_perl5_beginner_pipeopen', |
|---|
| 1540 | type => Padre::Constant::BOOLEAN, |
|---|
| 1541 | store => Padre::Constant::HOST, |
|---|
| 1542 | default => 1, |
|---|
| 1543 | ); |
|---|
| 1544 | |
|---|
| 1545 | setting( |
|---|
| 1546 | name => 'lang_perl5_beginner_pipe2open', |
|---|
| 1547 | type => Padre::Constant::BOOLEAN, |
|---|
| 1548 | store => Padre::Constant::HOST, |
|---|
| 1549 | default => 1, |
|---|
| 1550 | ); |
|---|
| 1551 | |
|---|
| 1552 | setting( |
|---|
| 1553 | name => 'lang_perl5_beginner_regexq', |
|---|
| 1554 | type => Padre::Constant::BOOLEAN, |
|---|
| 1555 | store => Padre::Constant::HOST, |
|---|
| 1556 | default => 1, |
|---|
| 1557 | ); |
|---|
| 1558 | |
|---|
| 1559 | setting( |
|---|
| 1560 | name => 'lang_perl5_beginner_elseif', |
|---|
| 1561 | type => Padre::Constant::BOOLEAN, |
|---|
| 1562 | store => Padre::Constant::HOST, |
|---|
| 1563 | default => 1, |
|---|
| 1564 | ); |
|---|
| 1565 | |
|---|
| 1566 | setting( |
|---|
| 1567 | name => 'lang_perl5_beginner_close', |
|---|
| 1568 | type => Padre::Constant::BOOLEAN, |
|---|
| 1569 | store => Padre::Constant::HOST, |
|---|
| 1570 | default => 1, |
|---|
| 1571 | ); |
|---|
| 1572 | |
|---|
| 1573 | # Padre::File options |
|---|
| 1574 | |
|---|
| 1575 | # ::HTTP |
|---|
| 1576 | setting( |
|---|
| 1577 | name => 'file_http_timeout', |
|---|
| 1578 | type => Padre::Constant::ASCII, |
|---|
| 1579 | store => Padre::Constant::HUMAN, |
|---|
| 1580 | default => 30, |
|---|
| 1581 | ); |
|---|
| 1582 | |
|---|
| 1583 | # ::FTP |
|---|
| 1584 | setting( |
|---|
| 1585 | name => 'file_ftp_timeout', |
|---|
| 1586 | type => Padre::Constant::ASCII, |
|---|
| 1587 | store => Padre::Constant::HUMAN, |
|---|
| 1588 | default => 30, |
|---|
| 1589 | ); |
|---|
| 1590 | |
|---|
| 1591 | setting( |
|---|
| 1592 | name => 'file_ftp_passive', |
|---|
| 1593 | type => Padre::Constant::BOOLEAN, |
|---|
| 1594 | store => Padre::Constant::HUMAN, |
|---|
| 1595 | default => 1, |
|---|
| 1596 | ); |
|---|
| 1597 | |
|---|
| 1598 | ################################################# |
|---|
| 1599 | # Version control system (VCS) |
|---|
| 1600 | ################################################# |
|---|
| 1601 | |
|---|
| 1602 | # Show normal objects? |
|---|
| 1603 | setting( |
|---|
| 1604 | name => 'vcs_normal_shown', |
|---|
| 1605 | type => Padre::Constant::BOOLEAN, |
|---|
| 1606 | store => Padre::Constant::HUMAN, |
|---|
| 1607 | default => 0, |
|---|
| 1608 | ); |
|---|
| 1609 | |
|---|
| 1610 | # Show unversioned objects? |
|---|
| 1611 | setting( |
|---|
| 1612 | name => 'vcs_unversioned_shown', |
|---|
| 1613 | type => Padre::Constant::BOOLEAN, |
|---|
| 1614 | store => Padre::Constant::HUMAN, |
|---|
| 1615 | default => 0, |
|---|
| 1616 | ); |
|---|
| 1617 | |
|---|
| 1618 | # Show ignored objects? |
|---|
| 1619 | setting( |
|---|
| 1620 | name => 'vcs_ignored_shown', |
|---|
| 1621 | type => Padre::Constant::BOOLEAN, |
|---|
| 1622 | store => Padre::Constant::HUMAN, |
|---|
| 1623 | default => 0, |
|---|
| 1624 | ); |
|---|
| 1625 | |
|---|
| 1626 | # Toggle experimental VCS command bar |
|---|
| 1627 | setting( |
|---|
| 1628 | name => 'vcs_enable_command_bar', |
|---|
| 1629 | type => Padre::Constant::BOOLEAN, |
|---|
| 1630 | store => Padre::Constant::HUMAN, |
|---|
| 1631 | default => 0, |
|---|
| 1632 | ); |
|---|
| 1633 | |
|---|
| 1634 | # Non-preference settings |
|---|
| 1635 | setting( |
|---|
| 1636 | name => 'session_autosave', |
|---|
| 1637 | type => Padre::Constant::BOOLEAN, |
|---|
| 1638 | store => Padre::Constant::HUMAN, |
|---|
| 1639 | default => 0, |
|---|
| 1640 | ); |
|---|
| 1641 | |
|---|
| 1642 | # The "config_" namespace is for the locations of configuration content |
|---|
| 1643 | # outside of the configuration API, and the paths to other non-Padre config |
|---|
| 1644 | # files for various external tools (usually so that projects can define the |
|---|
| 1645 | # the location of their project-specific policies). |
|---|
| 1646 | |
|---|
| 1647 | # The location of the server that will share config data between installs |
|---|
| 1648 | setting( |
|---|
| 1649 | name => 'config_sync_server', |
|---|
| 1650 | type => Padre::Constant::ASCII, |
|---|
| 1651 | store => Padre::Constant::HUMAN, |
|---|
| 1652 | default => 'http://sync.perlide.org/', |
|---|
| 1653 | ); |
|---|
| 1654 | |
|---|
| 1655 | setting( |
|---|
| 1656 | name => 'config_sync_username', |
|---|
| 1657 | type => Padre::Constant::ASCII, |
|---|
| 1658 | store => Padre::Constant::HUMAN, |
|---|
| 1659 | default => '', |
|---|
| 1660 | ); |
|---|
| 1661 | |
|---|
| 1662 | setting( |
|---|
| 1663 | name => 'config_sync_password', |
|---|
| 1664 | type => Padre::Constant::ASCII, |
|---|
| 1665 | store => Padre::Constant::HUMAN, |
|---|
| 1666 | default => '', |
|---|
| 1667 | ); |
|---|
| 1668 | |
|---|
| 1669 | # Location of the Perl::Tidy RC file, if a project wants to set a custom one. |
|---|
| 1670 | # When set to false, allow Perl::Tidy to use its own default config location. |
|---|
| 1671 | # Load this from the project backend in preference to the host one, so that |
|---|
| 1672 | # projects can set their own project-specific config file. |
|---|
| 1673 | setting( |
|---|
| 1674 | name => 'config_perltidy', |
|---|
| 1675 | type => Padre::Constant::PATH, |
|---|
| 1676 | store => Padre::Constant::PROJECT, |
|---|
| 1677 | default => '', |
|---|
| 1678 | ); |
|---|
| 1679 | |
|---|
| 1680 | # Location of the Perl::Critic RC file, if a project wants to set a custom |
|---|
| 1681 | # one. When set to false, allow Perl::Critic to use its own default config |
|---|
| 1682 | # location. Load this from the project backend in preference to the host one, |
|---|
| 1683 | # so that projects can set their own project-specific config file. |
|---|
| 1684 | setting( |
|---|
| 1685 | name => 'config_perlcritic', |
|---|
| 1686 | type => Padre::Constant::PATH, |
|---|
| 1687 | store => Padre::Constant::PROJECT, |
|---|
| 1688 | default => '', |
|---|
| 1689 | ); |
|---|
| 1690 | |
|---|
| 1691 | 1; |
|---|
| 1692 | |
|---|
| 1693 | __END__ |
|---|
| 1694 | |
|---|
| 1695 | =pod |
|---|
| 1696 | |
|---|
| 1697 | =head1 NAME |
|---|
| 1698 | |
|---|
| 1699 | Padre::Config - Configuration subsystem for Padre |
|---|
| 1700 | |
|---|
| 1701 | =head1 SYNOPSIS |
|---|
| 1702 | |
|---|
| 1703 | use Padre::Config; |
|---|
| 1704 | [...] |
|---|
| 1705 | if ( Padre::Config->main_statusbar ) { [...] } |
|---|
| 1706 | |
|---|
| 1707 | =head1 DESCRIPTION |
|---|
| 1708 | |
|---|
| 1709 | This module not only stores the complete Padre configuration, it also holds |
|---|
| 1710 | the functions for loading and saving the configuration. |
|---|
| 1711 | |
|---|
| 1712 | The Padre configuration lives in two places: |
|---|
| 1713 | |
|---|
| 1714 | =over |
|---|
| 1715 | |
|---|
| 1716 | =item a user-editable text file usually called F<config.yml> |
|---|
| 1717 | |
|---|
| 1718 | =item an SQLite database which shouldn't be edited by the user |
|---|
| 1719 | |
|---|
| 1720 | =back |
|---|
| 1721 | |
|---|
| 1722 | =head2 Generic usage |
|---|
| 1723 | |
|---|
| 1724 | Every setting is accessed by a mutator named after it, |
|---|
| 1725 | i.e. it can be used both as a getter and a setter depending on the number |
|---|
| 1726 | of arguments passed to it. |
|---|
| 1727 | |
|---|
| 1728 | =head2 Different types of settings |
|---|
| 1729 | |
|---|
| 1730 | Padre needs to store different settings. Those preferences are stored in |
|---|
| 1731 | different places depending on their impact. But C<Padre::Config> allows to |
|---|
| 1732 | access them with a unified API (a mutator). Only their declaration differs |
|---|
| 1733 | in the module. |
|---|
| 1734 | |
|---|
| 1735 | Here are the various types of settings that C<Padre::Config> can manage: |
|---|
| 1736 | |
|---|
| 1737 | =over 4 |
|---|
| 1738 | |
|---|
| 1739 | =item * User settings |
|---|
| 1740 | |
|---|
| 1741 | Those settings are general settings that relates to user preferences. They range |
|---|
| 1742 | from general user interface I<look & feel> (whether to show the line numbers, etc.) |
|---|
| 1743 | to editor preferences (tab width, etc.) and other personal settings. |
|---|
| 1744 | |
|---|
| 1745 | Those settings are stored in a YAML file, and accessed with C<Padre::Config::Human>. |
|---|
| 1746 | |
|---|
| 1747 | =item * Host settings |
|---|
| 1748 | |
|---|
| 1749 | Those preferences are related to the host on which Padre is run. The principal |
|---|
| 1750 | example of those settings are window appearance. |
|---|
| 1751 | |
|---|
| 1752 | Those settings are stored in a DB file, and accessed with C<Padre::Config::Host>. |
|---|
| 1753 | |
|---|
| 1754 | =item * Project settings |
|---|
| 1755 | |
|---|
| 1756 | Those preferences are related to the project of the file you are currently |
|---|
| 1757 | editing. Examples of those settings are whether to use tabs or spaces, etc. |
|---|
| 1758 | |
|---|
| 1759 | Those settings are accessed with C<Padre::Config::Project>. |
|---|
| 1760 | |
|---|
| 1761 | =back |
|---|
| 1762 | |
|---|
| 1763 | =head1 ADDING CONFIGURATION OPTIONS |
|---|
| 1764 | |
|---|
| 1765 | Add a "setting()" - call to the correct section of this file. |
|---|
| 1766 | |
|---|
| 1767 | The setting() call initially creates the option and defines some |
|---|
| 1768 | metadata like the type of the option, it's living place and the |
|---|
| 1769 | default value which should be used until the user configures |
|---|
| 1770 | a own value. |
|---|
| 1771 | |
|---|
| 1772 | =head1 COPYRIGHT & LICENSE |
|---|
| 1773 | |
|---|
| 1774 | Copyright 2008-2012 The Padre development team as listed in Padre.pm. |
|---|
| 1775 | |
|---|
| 1776 | This program is free software; you can redistribute it and/or modify it under the |
|---|
| 1777 | same terms as Perl 5 itself. |
|---|
| 1778 | |
|---|
| 1779 | =cut |
|---|
| 1780 | |
|---|
| 1781 | # Copyright 2008-2012 The Padre development team as listed in Padre.pm. |
|---|
| 1782 | # LICENSE |
|---|
| 1783 | # This program is free software; you can redistribute it and/or |
|---|
| 1784 | # modify it under the same terms as Perl 5 itself. |
|---|