#main application our $MAIN_WINDOW=MainWindow->new; #make call here to init the fonts from the very beginning &init_mw_fonts($ctlRef,$MAIN_WINDOW); $MAIN_WINDOW->title("CadEnhance:Part Builder Schematic Symbol Creator"); $MAIN_WINDOW->configure(-menu=>my $menubar=$MAIN_WINDOW->Menu); # # # MainLoop; sub init_mw_fonts{ #set the default font types or all of our widget classes my $ctlRef=shift; my $mw=shift; require allToolCtlVariables; my $boldFont =&my_tk_cfg_vars("BOLD_FONT") || &all_tk_cfg_vars("BOLD_FONT"); my $normalFont =&my_tk_cfg_vars("NORMAL_FONT") || &all_tk_cfg_vars("NORMAL_FONT"); my $textFont =&my_tk_cfg_vars("TEXT_FONT") || &all_tk_cfg_vars("TEXT_FONT"); #first set ALL fonts to $normalFont $mw->optionAdd("*font",$normalFont); #then we pick and choose the items we want to be bold foreach my $boldClass (qw(Checkbutton Label Listbox Button Menu Menubutton Message Radiobutton Scale ProgressBar)) { $mw->optionAdd("*$boldClass.font",$boldFont); } #now set the text Font $mw->optionAdd("*Text.font",$textFont); } #This subroutine lets us program the fonts we want to use #and we can create a similar one for each application called #my_tk_cfg_vars which will override the global one sub all_tk_cfg_vars { my $selection=shift; my %gui_vars=( ENTRY_WIDTH=>80, CFG_ENTRY_WIDTH=>40, DT_ENTRY_WIDTH=>98, TEXT_WIDTH=>110, BACK_GROUND_COLOR=>"light grey", YPAD_SMALL=>0.5, YPAD_MED=>1.0, YPAD_LARGE=>5.0, XPAD_SMALL=>0.5, XPAD_MED=>1.25, XPAD_LARGE=>15, LABEL_FONT=>"Arial 9 bold", BOLD_FONT=>"Arial 9 bold", NORMAL_FONT=>"Arial 9", TEXT_FONT=>"Helvetica 10", ); if (defined ($gui_vars{$selection})) { return $gui_vars{$selection}; } else { return 0; } } sub my_tk_cfg_vars{ my $param=shift; return ""; #or override the values defined in all_tk_cfg_vars }