"Fossies" - the Fresh Open Source Software Archive

Member "namefix.pl/libs/gui/config_dialog.pm" (13 Dec 2008, 8294 Bytes) of package /linux/privat/old/namefix.pl_4.0.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "config_dialog.pm" see the Fossies "Dox" file reference documentation.

A hint: This file contains one or more very long lines, so maybe it is better readable using the pure text view mode that shows the contents as wrapped lines within the browser window.


    1 use strict;
    2 use warnings;
    3 
    4 #--------------------------------------------------------------------------------------------------------------
    5 # Edit Preferences
    6 #--------------------------------------------------------------------------------------------------------------
    7 
    8 sub edit_prefs 
    9 {
   10     $main::load_defaults = 0;
   11     my $n = 0;
   12 
   13         my $top = $main::mw -> Toplevel
   14     (
   15             -padx => 5,
   16             -pady => 5
   17         );
   18 
   19         $top -> title("Edit Preferences");
   20 
   21         my $book = $top->NoteBook()
   22         -> grid
   23     (
   24             -row=>1,
   25             -column=>1,
   26             -columnspan=>2,
   27             -sticky=>'nw'
   28         );
   29 
   30     # ----------------------------------------------------------------------------------------------------------
   31     # Main prefences tab
   32 
   33         my $tab1 = $book->add
   34     (
   35             "Sheet 1",
   36             -label=>"Main"
   37         );
   38 
   39         my $tab1_label_mo = $tab1 -> Label
   40     (
   41             -justify=>"left",
   42             -text=>"Main system options for namefix.pl:\n"
   43         )
   44     -> grid
   45     (
   46         -row=>1,
   47         -column=>1,
   48         -sticky=>"nw"
   49     );
   50 
   51     $tab1 -> Label
   52     (
   53         -text=>" "
   54     )
   55     -> grid
   56     (
   57         -row=>4,
   58         -column=>1,
   59         -sticky=>"nw"
   60     );
   61 
   62     my $label6 = $tab1 -> Label
   63     (
   64         -justify=>"left",
   65         -text=>"Space Delimter: "
   66     )
   67     -> grid
   68     (
   69         -row=>5,
   70         -column=>1,
   71         -sticky=>"nw"
   72     );
   73 
   74     my $e_ent = $tab1 -> Entry
   75     (
   76         -textvariable=>\$main::space_character,
   77         -width=>5
   78     )
   79     -> grid
   80     (
   81         -row=>5,
   82         -column=>2,
   83         -sticky=>"nw"
   84     );
   85     $main::balloon->attach
   86     (
   87         $e_ent,
   88         -msg => "Enter your \ prefered space delimiter.\n\nPopular choices are: \"_\" \".\" \" \" "
   89     );
   90 
   91     $tab1 -> Label
   92     (
   93         -text=>" "
   94     )
   95     -> grid
   96     (
   97         -row=>7,
   98         -column=>1,
   99         -sticky=>"nw"
  100     );
  101 
  102     $tab1 -> Label
  103     (
  104         -justify=>"left",
  105         -text=>"Maximum Filename Length: "
  106     )
  107     -> grid
  108     (
  109         -row=>8,
  110         -column=>1,
  111         -sticky=>"nw"
  112     );
  113 
  114     my $mfnl_ent = $tab1 -> Entry
  115     (
  116         -textvariable=>\$main::max_fn_length,
  117         -width=>5
  118         )
  119     -> grid
  120     (
  121         -row=>8,
  122         -column=>2,
  123         -sticky=>"nw"
  124     );
  125     $main::balloon->attach
  126     (
  127         $mfnl_ent,
  128         -msg => "Files will not be renamed if new name exceeds max length"
  129     );
  130 
  131     $tab1 -> Label
  132     (
  133         -justify=>"left",
  134         -text=>" "
  135     )
  136     -> grid
  137     (
  138         -row=>9,
  139         -column=>1,
  140         -sticky=>"nw"
  141     );
  142 
  143     $tab1 -> Label
  144     (
  145         -text=>" "
  146     )
  147     -> grid
  148     (
  149         -row=>13,
  150         -column=>1,
  151         -sticky=>"nw"
  152     );
  153 
  154     my $save_window_size_chk = $tab1 -> Checkbutton
  155     (
  156         -text=>"Save main window size and position",
  157         -variable=>\$main::SAVE_WINDOW_SIZE,
  158         -activeforeground => "blue"
  159     )
  160     -> grid
  161     (
  162         -row=>14,
  163         -column=>1,
  164         -columnspan=>2,
  165         -sticky=>"sw"
  166     );
  167 
  168     my $save_defs_chk = $tab1 -> Checkbutton
  169     (
  170         -text=>"Save main window options",
  171         -variable=>\$main::load_defaults,
  172         -activeforeground => "blue"
  173     )
  174     -> grid
  175     (
  176         -row=>15,
  177         -column=>1,
  178         -columnspan=>2,
  179         -sticky=>"sw"
  180     );
  181     $main::balloon->attach
  182     (
  183         $save_defs_chk,
  184         -msg => "Saves safe options from main window as defaults.\nUnsafe options can be set by manually editing the\nconfig file.\n\nOptions Deemed Safe:\n\n\tCleanup\n\tCasing\n\tSpecific Casing\n\tSpaces\n\t. to Space\n\tRM Word List\n\tRM Pattern List\n\n\tid3 mode\n\n\tUppercase All\n\tLowercase All\n\tInternational.\n\n\tEnumerate Styles\n\tTruncate Styles"
  185     );
  186 
  187     $tab1 -> Label
  188     (
  189         -text=>"\n"
  190     )
  191     -> grid
  192     (
  193         -row=>20,
  194         -column=>1,
  195         -sticky=>"nw"
  196     );
  197 
  198     # ----------------------------------------------------------------------------------------------------------
  199     # Advanced options tab
  200 
  201     my $tab7 = $book->add
  202     (
  203         "Sheet 2",
  204         -label=>"Advanced"
  205     );
  206 
  207     $tab7 -> Label
  208     (
  209         -justify=>"left",
  210         -text=>"Advance system options for namefix.pl:\n"
  211     )
  212     -> grid(
  213         -row=>1,
  214         -column=>1,
  215         -sticky=>"nw"
  216     );
  217 
  218     my $F_chk = $tab7 -> Checkbutton
  219     (
  220         -text=>"FS Fix (Case insensitive file system workaround)",
  221         -variable=>\$main::fat32fix,
  222         -activeforeground => "blue"
  223     )
  224     -> grid
  225     (
  226         -row=>2,
  227         -column=>1,
  228         -sticky=>"nw",
  229         -columnspan=>2
  230     );
  231     $main::balloon->attach
  232     (
  233         $F_chk,
  234         -msg => "Enabled by default for win32 OS's\nFile systems known to have this issue: NTFS, Fat32, HFS.\n\neg: renaming test.mp3 to Test.mp3 will fail if FS is case insensitive."
  235     );
  236 
  237     my $tab7_regexp_chk = $tab7 -> Checkbutton
  238     (
  239         -text=>"Disable Regexp pattern matching for Remove option",
  240         -variable=>\$main::disable_regexp,
  241         -activeforeground => "blue"
  242     )
  243     -> grid
  244     (
  245         -row=>3,
  246         -column=>1,
  247         -sticky=>"nw",
  248         -columnspan=>2
  249     );
  250     $main::balloon->attach
  251     (
  252         $tab7_regexp_chk,
  253         -msg => "Disabled by default for novice users"
  254     );
  255 
  256     $tab7 -> Label
  257     (
  258         -text=>" "
  259     )
  260     -> grid
  261     (
  262         -row=>4,
  263         -column=>1,
  264         -sticky=>"nw"
  265     );
  266 
  267     $tab7 -> Label
  268     (
  269         -justify=>"left",
  270         -text=>"Media File Extensions: "
  271     )
  272     -> grid
  273     (
  274         -row=>11,
  275         -column=>1,
  276         -sticky=>"nw"
  277     );
  278 
  279     my $mfe_ent = $tab7 -> Entry
  280     (
  281         -textvariable=>\$main::file_ext_2_proc,
  282         -width=>60
  283     )
  284     -> grid
  285     (
  286         -row=>12,
  287         -column=>1,
  288         -columnspan=>2,
  289         -sticky=>"nw"
  290     );
  291     $main::balloon->attach
  292     (
  293         $mfe_ent,
  294         -msg => "Enter File extensions of files you wish seperated by |.\nThey will be processed by default.\n\nNote: Case insensitive matching is used."
  295     );
  296 
  297     $tab7 -> Label
  298     (
  299         -text=>"\n"
  300     )
  301     -> grid
  302     (
  303         -row=>20,
  304         -column=>1,
  305         -sticky=>"nw"
  306     );
  307 
  308     my $overwrite_chk = $tab7 -> Checkbutton
  309     (
  310         -text=>"Overwrite",
  311         -variable=>\$main::overwrite,
  312         -activeforeground => "blue"
  313     )
  314     -> grid
  315     (
  316         -row=>23,
  317         -column=>1,
  318         -sticky=>"nw",
  319     );
  320 
  321     $main::balloon->attach
  322     (
  323         $overwrite_chk,
  324         -msg => "Overwrite: Preform rename without checking if new filename exists.\n\nThis Option is not saved, Please be carefull witht this option"
  325     );
  326 
  327     # ----------------------------------------------------------------------------------------------------------
  328     # Debug tab
  329 
  330     $n = 1;
  331 
  332     my $tab_debug = $book->add
  333     (
  334         "Sheet 3",
  335         -label=>"Debug"
  336     );
  337 
  338     $tab_debug -> Label
  339     (
  340         -justify=>"left",
  341         -text=>"Debug Level"
  342     )
  343     -> grid
  344     (
  345         -row=>$n,
  346         -column=>1,
  347         -sticky=>"nw"
  348     );
  349 
  350     my $spin_pad_enum = $tab_debug -> Spinbox
  351     (
  352         -textvariable=>\$main::debug,
  353         -from=>0,
  354         -to=>10,
  355         -increment=>1,
  356         -width=>2
  357     )
  358     -> grid
  359     (
  360         -row=>$n++,
  361         -column=>2,
  362         -sticky=>"nw",
  363     );
  364 
  365     $tab_debug -> Checkbutton
  366     (
  367         -text=>"Print log to stdout",
  368         -variable=>\$main::LOG_STDOUT,
  369         -activeforeground => "blue"
  370     )
  371     -> grid
  372     (
  373         -row=>$n++,
  374         -column=>1,
  375         -sticky=>"nw",
  376     );
  377 
  378     $tab_debug -> Checkbutton
  379     (
  380         -text=>"Print errors to stdout",
  381         -variable=>\$main::ERROR_STDOUT,
  382         -activeforeground => "blue"
  383     )
  384     -> grid
  385     (
  386         -row=>$n++,
  387         -column=>1,
  388         -sticky=>"nw",
  389     );
  390 
  391     $tab_debug -> Checkbutton
  392     (
  393         -text=>"Pop up errors in a dialog box",
  394         -variable=>\$main::ERROR_NOTIFY,
  395         -activeforeground => "blue"
  396     )
  397     -> grid
  398     (
  399         -row=>$n++,
  400         -column=>1,
  401         -sticky=>"nw",
  402     );
  403 
  404     $tab_debug -> Checkbutton
  405     (
  406         -text=>"Zero logfile on start",
  407         -variable=>\$main::ZERO_LOG,
  408         -activeforeground => "blue"
  409     )
  410     -> grid
  411     (
  412         -row=>$n++,
  413         -column=>1,
  414         -sticky=>"nw",
  415     );
  416 
  417     # ----------------------------------------------------------------------------------------------------------
  418     # Save n Close Buttons
  419 
  420         my $but_save = $top -> Button(
  421             -text=>"Save",
  422             -activebackground => 'white',
  423             -command => sub {
  424                 \&save_config();
  425             }
  426         )
  427         -> grid(
  428             -row =>5,
  429             -column => 1,
  430             -sticky=>"ne"
  431         );
  432         my $but_close = $top -> Button(
  433             -text=>"Close",
  434             -activebackground => 'white',
  435             -command => sub {
  436                 destroy $top;
  437             }
  438         )
  439         -> grid(
  440             -row =>5,
  441             -column => 2,
  442             -sticky=>"nw"
  443         );
  444 
  445     $main::balloon->attach(
  446         $but_save,
  447         -msg => "Save Preferences to config file."
  448     );
  449 
  450     $top->resizable(0,0);
  451 }
  452 
  453 #--------------------------------------------------------------------------------------------------------------
  454 # Save Fonts Config File
  455 #--------------------------------------------------------------------------------------------------------------
  456 
  457 sub save_fonts 
  458 {
  459     open(FILE, ">$main::fonts_file") or die "ERROR: couldnt open $main::fonts_file to write to\n$!\n";
  460 
  461     print FILE
  462 
  463     "# namefix.pl $main::version fonts configuration file\n",
  464     "# manually edit the fonts below if your sizes are screwed up in the dialog windows\n",
  465     "\n",
  466     "\$dialog_font      = \"$main::dialog_font\";       \n",
  467     "\$dialog_title_font    = \"$main::dialog_title_font\";     \n",
  468     "\$edit_pat_font    = \"$main::edit_pat_font\";         \n",
  469     "\n";
  470 
  471     close(FILE);
  472 }
  473 
  474 
  475 1;