Changeset 3274


Ignore:
Timestamp:
03/12/09 02:58:22 (3 years ago)
Author:
jquelin
Message:

using constants exported by padre::config::constants

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Padre/lib/Padre/Config.pm

    r3273 r3274  
    1919use Padre::Config::Host    (); 
    2020 
    21 use Padre::Config::Constants qw{ $PADRE_CONFIG_DIR }; 
     21use Padre::Config::Constants qw{ :stores :types $PADRE_CONFIG_DIR }; 
    2222 
    2323our $VERSION   = '0.28'; 
     
    5151use Class::XSAccessor::Array 
    5252    getters => { 
    53         host    => HOST, 
    54         human   => HUMAN, 
    55         project => PROJECT, 
     53        host    => $HOST, 
     54        human   => $HUMAN, 
     55        project => $PROJECT, 
    5656    }; 
    5757 
     
    7070    # Initially, this must be ascii only 
    7171    name    => 'identity_name', 
    72     type    => ASCII, 
    73     store   => HUMAN, 
     72    type    => $ASCII, 
     73    store   => $HUMAN, 
    7474    default => '', 
    7575); 
    7676setting( 
    7777    name    => 'identity_email', 
    78     type    => ASCII, 
    79     store   => HUMAN, 
     78    type    => $ASCII, 
     79    store   => $HUMAN, 
    8080    default => '', 
    8181); 
     
    8585setting( 
    8686    name    => 'license', 
    87     type    => ASCII, 
    88     store   => HUMAN, 
     87    type    => $ASCII, 
     88    store   => $HUMAN, 
    8989    default => '', 
    9090); 
    9191setting( 
    9292    name    => 'builder', 
    93     type    => ASCII, 
    94     store   => HUMAN, 
     93    type    => $ASCII, 
     94    store   => $HUMAN, 
    9595    default => '', 
    9696); 
    9797setting( 
    9898    name    => 'module_start_directory', 
    99     type    => ASCII, 
    100     store   => HUMAN, 
     99    type    => $ASCII, 
     100    store   => $HUMAN, 
    101101    default => '', 
    102102); 
     
    107107setting( 
    108108    name    => 'editor_indent_auto', 
    109     type    => BOOLEAN, 
    110     store   => HUMAN, 
     109    type    => $BOOLEAN, 
     110    store   => $HUMAN, 
    111111    default => 1, 
    112112); 
    113113setting( 
    114114    name    => 'editor_indent_tab', 
    115     type    => BOOLEAN, 
    116     store   => HUMAN, 
     115    type    => $BOOLEAN, 
     116    store   => $HUMAN, 
    117117    default => 1, 
    118118); 
    119119setting( 
    120120    name    => 'editor_indent_tab_width', 
    121     type    => POSINT, 
    122     store   => HUMAN, 
     121    type    => $POSINT, 
     122    store   => $HUMAN, 
    123123    default => 8, 
    124124); 
    125125setting( 
    126126    name    => 'editor_indent_width', 
    127     type    => POSINT, 
    128     store   => HUMAN, 
     127    type    => $POSINT, 
     128    store   => $HUMAN, 
    129129    default => 8, 
    130130); 
     
    137137    #   last       - the files that were open last time 
    138138    name    => 'main_startup', 
    139     type    => ASCII, 
    140     store   => HUMAN, 
     139    type    => $ASCII, 
     140    store   => $HUMAN, 
    141141    default => 'new', 
    142142); 
    143143setting( 
    144144    name    => 'main_lockinterface', 
    145     type    => BOOLEAN, 
    146     store   => HUMAN, 
     145    type    => $BOOLEAN, 
     146    store   => $HUMAN, 
    147147    default => 1, 
    148148); 
    149149setting( 
    150150    name    => 'main_functions', 
    151     type    => BOOLEAN, 
    152     store   => HUMAN, 
     151    type    => $BOOLEAN, 
     152    store   => $HUMAN, 
    153153    default => 0, 
    154154); 
    155155setting( 
    156156    name    => 'main_functions_order', 
    157     type    => ASCII, 
    158     store   => HUMAN, 
     157    type    => $ASCII, 
     158    store   => $HUMAN, 
    159159    default => 'alphabetical', 
    160160); 
    161161setting( 
    162162    name    => 'main_outline', 
    163     type    => BOOLEAN, 
    164     store   => HUMAN, 
     163    type    => $BOOLEAN, 
     164    store   => $HUMAN, 
    165165    default => 0, 
    166166); 
    167167setting( 
    168168    name    => 'main_directory', 
    169     type    => BOOLEAN, 
    170     store   => HUMAN, 
     169    type    => $BOOLEAN, 
     170    store   => $HUMAN, 
    171171    default => 0, 
    172172); 
    173173setting( 
    174174    name    => 'main_output', 
    175     type    => BOOLEAN, 
    176     store   => HUMAN, 
     175    type    => $BOOLEAN, 
     176    store   => $HUMAN, 
    177177    default => 0, 
    178178); 
    179179setting( 
    180180    name    => 'main_output_ansi', 
    181     type    => BOOLEAN, 
    182     store   => HUMAN, 
     181    type    => $BOOLEAN, 
     182    store   => $HUMAN, 
    183183    default => 1, 
    184184); 
    185185setting( 
    186186    name    => 'main_syntaxcheck', 
    187     type    => BOOLEAN, 
    188     store   => HUMAN, 
     187    type    => $BOOLEAN, 
     188    store   => $HUMAN, 
    189189    default => 0, 
    190190); 
    191191setting( 
    192192    name    => 'main_errorlist', 
    193     type    => BOOLEAN, 
    194     store   => HUMAN, 
     193    type    => $BOOLEAN, 
     194    store   => $HUMAN, 
    195195    default => 0, 
    196196); 
    197197setting( 
    198198    name    => 'main_statusbar', 
    199     type    => BOOLEAN, 
    200     store   => HUMAN, 
     199    type    => $BOOLEAN, 
     200    store   => $HUMAN, 
    201201    default => 1, 
    202202); 
     
    205205setting( 
    206206    name    => 'editor_font', 
    207     type    => ASCII, 
    208     store   => HUMAN, 
     207    type    => $ASCII, 
     208    store   => $HUMAN, 
    209209    default => '', 
    210210); 
    211211setting( 
    212212    name    => 'editor_linenumbers', 
    213     type    => BOOLEAN, 
    214     store   => HUMAN, 
     213    type    => $BOOLEAN, 
     214    store   => $HUMAN, 
    215215    default => 1, 
    216216); 
    217217setting( 
    218218    name    => 'editor_eol', 
    219     type    => BOOLEAN, 
    220     store   => HUMAN, 
     219    type    => $BOOLEAN, 
     220    store   => $HUMAN, 
    221221    default => 0, 
    222222); 
    223223setting( 
    224224    name    => 'editor_whitespace', 
    225     type    => BOOLEAN, 
    226     store   => HUMAN, 
     225    type    => $BOOLEAN, 
     226    store   => $HUMAN, 
    227227    default => 0, 
    228228); 
    229229setting( 
    230230    name    => 'editor_indentationguides', 
    231     type    => BOOLEAN, 
    232     store   => HUMAN, 
     231    type    => $BOOLEAN, 
     232    store   => $HUMAN, 
    233233    default => 0, 
    234234); 
    235235setting( 
    236236    name    => 'editor_calltips', 
    237     type    => BOOLEAN, 
    238     store   => HUMAN, 
     237    type    => $BOOLEAN, 
     238    store   => $HUMAN, 
    239239    default => 0, 
    240240); 
    241241setting( 
    242242    name    => 'editor_autoindent', 
    243     type    => ASCII, 
    244     store   => HUMAN, 
     243    type    => $ASCII, 
     244    store   => $HUMAN, 
    245245    default => 'deep', 
    246246); 
    247247setting( 
    248248    name    => 'editor_folding', 
    249     type    => BOOLEAN, 
    250     store   => HUMAN, 
     249    type    => $BOOLEAN, 
     250    store   => $HUMAN, 
    251251    default => 0, 
    252252); 
    253253setting( 
    254254    name    => 'editor_currentline', 
    255     type    => BOOLEAN, 
    256     store   => HUMAN, 
     255    type    => $BOOLEAN, 
     256    store   => $HUMAN, 
    257257    default => 1, 
    258258); 
    259259setting( 
    260260    name    => 'editor_currentline_color', 
    261     type    => ASCII, 
    262     store   => HUMAN, 
     261    type    => $ASCII, 
     262    store   => $HUMAN, 
    263263    default => 'FFFF04', 
    264264); 
    265265setting( 
    266266    name    => 'editor_beginner', 
    267     type    => BOOLEAN, 
    268     store   => HUMAN, 
     267    type    => $BOOLEAN, 
     268    store   => $HUMAN, 
    269269    default => 1, 
    270270); 
    271271setting( 
    272272    name    => 'editor_wordwrap', 
    273     type    => BOOLEAN, 
    274     store   => HUMAN, 
     273    type    => $BOOLEAN, 
     274    store   => $HUMAN, 
    275275    default => 0, 
    276276); 
    277277setting( 
    278278    name    => 'find_case', 
    279     type    => BOOLEAN, 
    280     store   => HUMAN, 
     279    type    => $BOOLEAN, 
     280    store   => $HUMAN, 
    281281    default => 1, 
    282282); 
    283283setting( 
    284284    name    => 'find_regex', 
    285     type    => BOOLEAN, 
    286     store   => HUMAN, 
     285    type    => $BOOLEAN, 
     286    store   => $HUMAN, 
    287287    default => 0, 
    288288); 
    289289setting( 
    290290    name    => 'find_reverse', 
    291     type    => BOOLEAN, 
    292     store   => HUMAN, 
     291    type    => $BOOLEAN, 
     292    store   => $HUMAN, 
    293293    default => 0, 
    294294); 
    295295setting( 
    296296    name    => 'find_first', 
    297     type    => BOOLEAN, 
    298     store   => HUMAN, 
     297    type    => $BOOLEAN, 
     298    store   => $HUMAN, 
    299299    default => 0, 
    300300); 
    301301setting( 
    302302    name    => 'find_nohidden', 
    303     type    => BOOLEAN, 
    304     store   => HUMAN, 
     303    type    => $BOOLEAN, 
     304    store   => $HUMAN, 
    305305    default => 1, 
    306306); 
    307307setting( 
    308308    name    => 'find_quick', 
    309     type    => BOOLEAN, 
    310     store   => HUMAN, 
     309    type    => $BOOLEAN, 
     310    store   => $HUMAN, 
    311311    default => 0, 
    312312); 
    313313setting( 
    314314    name    => 'ppi_highlight', 
    315     type    => BOOLEAN, 
    316     store   => HUMAN, 
     315    type    => $BOOLEAN, 
     316    store   => $HUMAN, 
    317317    default => 0, 
    318318); 
    319319setting( 
    320320    name    => 'ppi_highlight_limit', 
    321     type    => POSINT, 
    322     store   => HUMAN, 
     321    type    => $POSINT, 
     322    store   => $HUMAN, 
    323323    default => 2000, 
    324324); 
     
    333333    # all_buffers - all the buffers even if they don't have a name yet 
    334334    name    => 'run_save', 
    335     type    => ASCII, 
    336     store   => HUMAN, 
     335    type    => $ASCII, 
     336    store   => $HUMAN, 
    337337    default => 'same', 
    338338); 
     
    340340setting( 
    341341    name    => 'run_stacktrace', 
    342     type    => BOOLEAN, 
    343     store   => HUMAN, 
     342    type    => $BOOLEAN, 
     343    store   => $HUMAN, 
    344344    default => 0, 
    345345); 
    346346setting( 
    347347    name    => 'autocomplete_brackets', 
    348     type    => BOOLEAN, 
    349     store   => HUMAN, 
     348    type    => $BOOLEAN, 
     349    store   => $HUMAN, 
    350350    default => 0, 
    351351); 
     
    354354    # TODO - Make the default actually change 
    355355    name    => 'threads', 
    356     type    => BOOLEAN, 
    357     store   => HUMAN, 
     356    type    => $BOOLEAN, 
     357    store   => $HUMAN, 
    358358    default => 1, 
    359359); 
    360360setting( 
    361361    name    => 'locale', 
    362     type    => ASCII, 
    363     store   => HUMAN, 
     362    type    => $ASCII, 
     363    store   => $HUMAN, 
    364364    default => '', 
    365365); 
    366366setting( 
    367367    name    => 'locale_perldiag', 
    368     type    => ASCII, 
    369     store   => HUMAN, 
     368    type    => $ASCII, 
     369    store   => $HUMAN, 
    370370    default => '', 
    371371); 
    372372setting( 
    373373    name    => 'experimental', 
    374     type    => BOOLEAN, 
    375     store   => HUMAN, 
     374    type    => $BOOLEAN, 
     375    store   => $HUMAN, 
    376376    default => 0, 
    377377); 
     
    381381setting( 
    382382    name    => 'editor_style', 
    383     type    => ASCII, 
    384     store   => HOST, 
     383    type    => $ASCII, 
     384    store   => $HOST, 
    385385    default => 'default', 
    386386); 
     
    389389setting( 
    390390    name    => 'main_maximized', 
    391     type    => BOOLEAN, 
    392     store   => HOST, 
     391    type    => $BOOLEAN, 
     392    store   => $HOST, 
    393393    default => 0, 
    394394); 
    395395setting( 
    396396    name    => 'main_top', 
    397     type    => INTEGER, 
    398     store   => HOST, 
     397    type    => $INTEGER, 
     398    store   => $HOST, 
    399399    default => 40, 
    400400); 
    401401setting( 
    402402    name    => 'main_left', 
    403     type    => INTEGER, 
    404     store   => HOST, 
     403    type    => $INTEGER, 
     404    store   => $HOST, 
    405405    default => 20, 
    406406); 
    407407setting( 
    408408    name    => 'main_width', 
    409     type    => POSINT, 
    410     store   => HOST, 
     409    type    => $POSINT, 
     410    store   => $HOST, 
    411411    default => 600, 
    412412); 
    413413setting( 
    414414    name    => 'main_height', 
    415     type    => POSINT, 
    416     store   => HOST, 
     415    type    => $POSINT, 
     416    store   => $HOST, 
    417417    default => 400, 
    418418); 
     
    509509    Carp::croak("The configuration setting '$name' does not exist"); 
    510510 
    511     # All types are ASCII-like 
     511    # All types are $ASCII-like 
    512512    unless ( defined $value and not ref $value ) { 
    513513        Carp::croak("Missing or non-scalar value for setting '$name'"); 
    514514    } 
    515515 
    516     # We don't need to do additional checks on ASCII types at this point 
     516    # We don't need to do additional checks on $ASCII types at this point 
    517517    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' ) { 
    519519        Carp::croak("Tried to change setting '$name' to non-boolean '$value'"); 
    520520    } 
    521     if ( $type == POSINT and not _POSINT($value) ) { 
     521    if ( $type == $POSINT and not _POSINT($value) ) { 
    522522        Carp::croak("Tried to change setting '$name' to non-posint '$value'"); 
    523523    } 
    524     if ( $type == INTEGER and not _INTEGER($value) ) { 
     524    if ( $type == $INTEGER and not _INTEGER($value) ) { 
    525525        Carp::croak("Tried to change setting '$name' to non-integer '$value'"); 
    526526    } 
     
    572572 
    573573    # Save the user configuration 
    574     $self->[HUMAN]->{version} = $REVISION; 
    575     $self->[HUMAN]->write(); 
     574    $self->[$HUMAN]->{version} = $REVISION; 
     575    $self->[$HUMAN]->write(); 
    576576 
    577577    # Save the host configuration 
    578     $self->[HOST]->{version} = $REVISION; 
    579     $self->[HOST]->write; 
     578    $self->[$HOST]->{version} = $REVISION; 
     579    $self->[$HOST]->write; 
    580580 
    581581    return 1; 
Note: See TracChangeset for help on using the changeset viewer.