Changeset 3274
- Timestamp:
- 03/12/09 02:58:22 (3 years ago)
- File:
-
- 1 edited
-
trunk/Padre/lib/Padre/Config.pm (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre/lib/Padre/Config.pm
r3273 r3274 19 19 use Padre::Config::Host (); 20 20 21 use Padre::Config::Constants qw{ $PADRE_CONFIG_DIR };21 use Padre::Config::Constants qw{ :stores :types $PADRE_CONFIG_DIR }; 22 22 23 23 our $VERSION = '0.28'; … … 51 51 use Class::XSAccessor::Array 52 52 getters => { 53 host => HOST,54 human => HUMAN,55 project => PROJECT,53 host => $HOST, 54 human => $HUMAN, 55 project => $PROJECT, 56 56 }; 57 57 … … 70 70 # Initially, this must be ascii only 71 71 name => 'identity_name', 72 type => ASCII,73 store => HUMAN,72 type => $ASCII, 73 store => $HUMAN, 74 74 default => '', 75 75 ); 76 76 setting( 77 77 name => 'identity_email', 78 type => ASCII,79 store => HUMAN,78 type => $ASCII, 79 store => $HUMAN, 80 80 default => '', 81 81 ); … … 85 85 setting( 86 86 name => 'license', 87 type => ASCII,88 store => HUMAN,87 type => $ASCII, 88 store => $HUMAN, 89 89 default => '', 90 90 ); 91 91 setting( 92 92 name => 'builder', 93 type => ASCII,94 store => HUMAN,93 type => $ASCII, 94 store => $HUMAN, 95 95 default => '', 96 96 ); 97 97 setting( 98 98 name => 'module_start_directory', 99 type => ASCII,100 store => HUMAN,99 type => $ASCII, 100 store => $HUMAN, 101 101 default => '', 102 102 ); … … 107 107 setting( 108 108 name => 'editor_indent_auto', 109 type => BOOLEAN,110 store => HUMAN,109 type => $BOOLEAN, 110 store => $HUMAN, 111 111 default => 1, 112 112 ); 113 113 setting( 114 114 name => 'editor_indent_tab', 115 type => BOOLEAN,116 store => HUMAN,115 type => $BOOLEAN, 116 store => $HUMAN, 117 117 default => 1, 118 118 ); 119 119 setting( 120 120 name => 'editor_indent_tab_width', 121 type => POSINT,122 store => HUMAN,121 type => $POSINT, 122 store => $HUMAN, 123 123 default => 8, 124 124 ); 125 125 setting( 126 126 name => 'editor_indent_width', 127 type => POSINT,128 store => HUMAN,127 type => $POSINT, 128 store => $HUMAN, 129 129 default => 8, 130 130 ); … … 137 137 # last - the files that were open last time 138 138 name => 'main_startup', 139 type => ASCII,140 store => HUMAN,139 type => $ASCII, 140 store => $HUMAN, 141 141 default => 'new', 142 142 ); 143 143 setting( 144 144 name => 'main_lockinterface', 145 type => BOOLEAN,146 store => HUMAN,145 type => $BOOLEAN, 146 store => $HUMAN, 147 147 default => 1, 148 148 ); 149 149 setting( 150 150 name => 'main_functions', 151 type => BOOLEAN,152 store => HUMAN,151 type => $BOOLEAN, 152 store => $HUMAN, 153 153 default => 0, 154 154 ); 155 155 setting( 156 156 name => 'main_functions_order', 157 type => ASCII,158 store => HUMAN,157 type => $ASCII, 158 store => $HUMAN, 159 159 default => 'alphabetical', 160 160 ); 161 161 setting( 162 162 name => 'main_outline', 163 type => BOOLEAN,164 store => HUMAN,163 type => $BOOLEAN, 164 store => $HUMAN, 165 165 default => 0, 166 166 ); 167 167 setting( 168 168 name => 'main_directory', 169 type => BOOLEAN,170 store => HUMAN,169 type => $BOOLEAN, 170 store => $HUMAN, 171 171 default => 0, 172 172 ); 173 173 setting( 174 174 name => 'main_output', 175 type => BOOLEAN,176 store => HUMAN,175 type => $BOOLEAN, 176 store => $HUMAN, 177 177 default => 0, 178 178 ); 179 179 setting( 180 180 name => 'main_output_ansi', 181 type => BOOLEAN,182 store => HUMAN,181 type => $BOOLEAN, 182 store => $HUMAN, 183 183 default => 1, 184 184 ); 185 185 setting( 186 186 name => 'main_syntaxcheck', 187 type => BOOLEAN,188 store => HUMAN,187 type => $BOOLEAN, 188 store => $HUMAN, 189 189 default => 0, 190 190 ); 191 191 setting( 192 192 name => 'main_errorlist', 193 type => BOOLEAN,194 store => HUMAN,193 type => $BOOLEAN, 194 store => $HUMAN, 195 195 default => 0, 196 196 ); 197 197 setting( 198 198 name => 'main_statusbar', 199 type => BOOLEAN,200 store => HUMAN,199 type => $BOOLEAN, 200 store => $HUMAN, 201 201 default => 1, 202 202 ); … … 205 205 setting( 206 206 name => 'editor_font', 207 type => ASCII,208 store => HUMAN,207 type => $ASCII, 208 store => $HUMAN, 209 209 default => '', 210 210 ); 211 211 setting( 212 212 name => 'editor_linenumbers', 213 type => BOOLEAN,214 store => HUMAN,213 type => $BOOLEAN, 214 store => $HUMAN, 215 215 default => 1, 216 216 ); 217 217 setting( 218 218 name => 'editor_eol', 219 type => BOOLEAN,220 store => HUMAN,219 type => $BOOLEAN, 220 store => $HUMAN, 221 221 default => 0, 222 222 ); 223 223 setting( 224 224 name => 'editor_whitespace', 225 type => BOOLEAN,226 store => HUMAN,225 type => $BOOLEAN, 226 store => $HUMAN, 227 227 default => 0, 228 228 ); 229 229 setting( 230 230 name => 'editor_indentationguides', 231 type => BOOLEAN,232 store => HUMAN,231 type => $BOOLEAN, 232 store => $HUMAN, 233 233 default => 0, 234 234 ); 235 235 setting( 236 236 name => 'editor_calltips', 237 type => BOOLEAN,238 store => HUMAN,237 type => $BOOLEAN, 238 store => $HUMAN, 239 239 default => 0, 240 240 ); 241 241 setting( 242 242 name => 'editor_autoindent', 243 type => ASCII,244 store => HUMAN,243 type => $ASCII, 244 store => $HUMAN, 245 245 default => 'deep', 246 246 ); 247 247 setting( 248 248 name => 'editor_folding', 249 type => BOOLEAN,250 store => HUMAN,249 type => $BOOLEAN, 250 store => $HUMAN, 251 251 default => 0, 252 252 ); 253 253 setting( 254 254 name => 'editor_currentline', 255 type => BOOLEAN,256 store => HUMAN,255 type => $BOOLEAN, 256 store => $HUMAN, 257 257 default => 1, 258 258 ); 259 259 setting( 260 260 name => 'editor_currentline_color', 261 type => ASCII,262 store => HUMAN,261 type => $ASCII, 262 store => $HUMAN, 263 263 default => 'FFFF04', 264 264 ); 265 265 setting( 266 266 name => 'editor_beginner', 267 type => BOOLEAN,268 store => HUMAN,267 type => $BOOLEAN, 268 store => $HUMAN, 269 269 default => 1, 270 270 ); 271 271 setting( 272 272 name => 'editor_wordwrap', 273 type => BOOLEAN,274 store => HUMAN,273 type => $BOOLEAN, 274 store => $HUMAN, 275 275 default => 0, 276 276 ); 277 277 setting( 278 278 name => 'find_case', 279 type => BOOLEAN,280 store => HUMAN,279 type => $BOOLEAN, 280 store => $HUMAN, 281 281 default => 1, 282 282 ); 283 283 setting( 284 284 name => 'find_regex', 285 type => BOOLEAN,286 store => HUMAN,285 type => $BOOLEAN, 286 store => $HUMAN, 287 287 default => 0, 288 288 ); 289 289 setting( 290 290 name => 'find_reverse', 291 type => BOOLEAN,292 store => HUMAN,291 type => $BOOLEAN, 292 store => $HUMAN, 293 293 default => 0, 294 294 ); 295 295 setting( 296 296 name => 'find_first', 297 type => BOOLEAN,298 store => HUMAN,297 type => $BOOLEAN, 298 store => $HUMAN, 299 299 default => 0, 300 300 ); 301 301 setting( 302 302 name => 'find_nohidden', 303 type => BOOLEAN,304 store => HUMAN,303 type => $BOOLEAN, 304 store => $HUMAN, 305 305 default => 1, 306 306 ); 307 307 setting( 308 308 name => 'find_quick', 309 type => BOOLEAN,310 store => HUMAN,309 type => $BOOLEAN, 310 store => $HUMAN, 311 311 default => 0, 312 312 ); 313 313 setting( 314 314 name => 'ppi_highlight', 315 type => BOOLEAN,316 store => HUMAN,315 type => $BOOLEAN, 316 store => $HUMAN, 317 317 default => 0, 318 318 ); 319 319 setting( 320 320 name => 'ppi_highlight_limit', 321 type => POSINT,322 store => HUMAN,321 type => $POSINT, 322 store => $HUMAN, 323 323 default => 2000, 324 324 ); … … 333 333 # all_buffers - all the buffers even if they don't have a name yet 334 334 name => 'run_save', 335 type => ASCII,336 store => HUMAN,335 type => $ASCII, 336 store => $HUMAN, 337 337 default => 'same', 338 338 ); … … 340 340 setting( 341 341 name => 'run_stacktrace', 342 type => BOOLEAN,343 store => HUMAN,342 type => $BOOLEAN, 343 store => $HUMAN, 344 344 default => 0, 345 345 ); 346 346 setting( 347 347 name => 'autocomplete_brackets', 348 type => BOOLEAN,349 store => HUMAN,348 type => $BOOLEAN, 349 store => $HUMAN, 350 350 default => 0, 351 351 ); … … 354 354 # TODO - Make the default actually change 355 355 name => 'threads', 356 type => BOOLEAN,357 store => HUMAN,356 type => $BOOLEAN, 357 store => $HUMAN, 358 358 default => 1, 359 359 ); 360 360 setting( 361 361 name => 'locale', 362 type => ASCII,363 store => HUMAN,362 type => $ASCII, 363 store => $HUMAN, 364 364 default => '', 365 365 ); 366 366 setting( 367 367 name => 'locale_perldiag', 368 type => ASCII,369 store => HUMAN,368 type => $ASCII, 369 store => $HUMAN, 370 370 default => '', 371 371 ); 372 372 setting( 373 373 name => 'experimental', 374 type => BOOLEAN,375 store => HUMAN,374 type => $BOOLEAN, 375 store => $HUMAN, 376 376 default => 0, 377 377 ); … … 381 381 setting( 382 382 name => 'editor_style', 383 type => ASCII,384 store => HOST,383 type => $ASCII, 384 store => $HOST, 385 385 default => 'default', 386 386 ); … … 389 389 setting( 390 390 name => 'main_maximized', 391 type => BOOLEAN,392 store => HOST,391 type => $BOOLEAN, 392 store => $HOST, 393 393 default => 0, 394 394 ); 395 395 setting( 396 396 name => 'main_top', 397 type => INTEGER,398 store => HOST,397 type => $INTEGER, 398 store => $HOST, 399 399 default => 40, 400 400 ); 401 401 setting( 402 402 name => 'main_left', 403 type => INTEGER,404 store => HOST,403 type => $INTEGER, 404 store => $HOST, 405 405 default => 20, 406 406 ); 407 407 setting( 408 408 name => 'main_width', 409 type => POSINT,410 store => HOST,409 type => $POSINT, 410 store => $HOST, 411 411 default => 600, 412 412 ); 413 413 setting( 414 414 name => 'main_height', 415 type => POSINT,416 store => HOST,415 type => $POSINT, 416 store => $HOST, 417 417 default => 400, 418 418 ); … … 509 509 Carp::croak("The configuration setting '$name' does not exist"); 510 510 511 # All types are ASCII-like511 # All types are $ASCII-like 512 512 unless ( defined $value and not ref $value ) { 513 513 Carp::croak("Missing or non-scalar value for setting '$name'"); 514 514 } 515 515 516 # We don't need to do additional checks on ASCII types at this point516 # We don't need to do additional checks on $ASCII types at this point 517 517 my $type = $setting->type; 518 if ( $type == BOOLEAN and $value ne '1' and $value ne '0' ) {518 if ( $type == $BOOLEAN and $value ne '1' and $value ne '0' ) { 519 519 Carp::croak("Tried to change setting '$name' to non-boolean '$value'"); 520 520 } 521 if ( $type == POSINT and not _POSINT($value) ) {521 if ( $type == $POSINT and not _POSINT($value) ) { 522 522 Carp::croak("Tried to change setting '$name' to non-posint '$value'"); 523 523 } 524 if ( $type == INTEGER and not _INTEGER($value) ) {524 if ( $type == $INTEGER and not _INTEGER($value) ) { 525 525 Carp::croak("Tried to change setting '$name' to non-integer '$value'"); 526 526 } … … 572 572 573 573 # Save the user configuration 574 $self->[ HUMAN]->{version} = $REVISION;575 $self->[ HUMAN]->write();574 $self->[$HUMAN]->{version} = $REVISION; 575 $self->[$HUMAN]->write(); 576 576 577 577 # Save the host configuration 578 $self->[ HOST]->{version} = $REVISION;579 $self->[ HOST]->write;578 $self->[$HOST]->{version} = $REVISION; 579 $self->[$HOST]->write; 580 580 581 581 return 1;
Note: See TracChangeset
for help on using the changeset viewer.
