From 28a52952066ccd7c4b4ff4194daa9cbcea98d5d6 Mon Sep 17 00:00:00 2001 From: etienne Date: Fri, 23 Mar 2018 10:55:37 +0000 Subject: ajout de l'option -fsd (font size delta) permettant de grossir/reduire la taille de police des champs de saisie, des listes et de la zone d'affichage des messages. --- src/ivymon | 142 +++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 87 insertions(+), 55 deletions(-) (limited to 'src') diff --git a/src/ivymon b/src/ivymon index 92c2892..0abdc7f 100755 --- a/src/ivymon +++ b/src/ivymon @@ -92,14 +92,16 @@ use strict; use Getopt::Long; use Tk::CmdLine; use vars qw/$VERSION $opt_help $opt_b $opt_bus $opt_history @opt_bind $opt_verbose - @opt_send $opt_size $opt_undersize $opt_out $opt_debug $opt_buf/; + @opt_send $opt_size $opt_undersize $opt_out $opt_debug $opt_buf + $opt_fsd/; # **** VERSION **** -$VERSION = '1.29'; # TODO a modifier +$VERSION = '1.30~pre1'; # TODO a modifier # options initialisation # geometry -my $minW = 1024; -my $minH = 768; +my $minW; +my $minH; +my $size_def = "XGA"; my $smallsized = 0; my $coef = 1; @@ -189,13 +191,9 @@ my $historywarning = 0; # command line options management #---------------------------------------------------------------------------------- -Tk::CmdLine::SetArguments(-font => - '-Misc-Fixed-Medium-R-Normal--10-100-75-75-C-60-ISO8859-1'); -Tk::CmdLine::SetArguments(); - if (not GetOptions('-help', '-history=s', '-b=s', '-bus=s', '-bind=s@', '-send=s@', '-size=s', '-undersize', '-debug', '-buf', '-verbose', - '-out=s') or $opt_help) { + '-out=s', '-fsd=i') or $opt_help) { print "\n"; print "IvyMon version $VERSION\n"; print "\n"; @@ -211,6 +209,7 @@ if (not GetOptions('-help', '-history=s', '-b=s', '-bus=s', '-bind=s@', print " -history Messages list history length\n"; print " ($historylabel by default)\n"; print " -size Size of the main window\n"; + print " -fsd <+n|-n> Font size delta for lists and messages frame\n"; print " -undersize If set, slightly reduces the main window\n"; print " -bind Ivy binding regular expression\n"; print " ((.*) by default)\n"; @@ -267,54 +266,54 @@ push(@send_def, @opt_send); #=================================== # # Size options -$opt_size = '' unless defined $opt_size; +$opt_size = $size_def unless defined $opt_size; +$opt_fsd = 0 unless defined $opt_fsd; +my $fnsize; +my $font_fmt; if($opt_size eq "UXGA" || $opt_size eq "1600") { - $minW = 1600; + $minW = 1600; $minH = 1200; $smallsized = 0; - $coef = 1.2; - # Tk::CmdLine::SetArguments(-font => '10x20'); - Tk::CmdLine::SetArguments(-font => - '-Misc-Fixed-Medium-R-Normal--13-120-75-75-C-80-ISO8859-1'); - Tk::CmdLine::SetArguments(); + $coef = 1.2; + $fnsize = 13; + $font_fmt = '-Misc-Fixed-Medium-R-Normal--%s-120-75-75-C-80-ISO8859-1'; }elsif($opt_size eq "SXGA" || $opt_size eq "1280") { $minW = 1280; $minH = 1024; $smallsized = 0; $coef = 1.1; - # Tk::CmdLine::SetArguments(-font => '8x13'); - Tk::CmdLine::SetArguments(-font => - '-Misc-Fixed-Medium-R-Normal--13-120-75-75-C-80-ISO8859-1'); - Tk::CmdLine::SetArguments(); -}elsif($opt_size eq "XGA" || $opt_size eq "1024") { - $minW = 1024; - $minH = 768; - $smallsized = 1; - $coef = 1; - # Tk::CmdLine::SetArguments(-font => '7x14'); - Tk::CmdLine::SetArguments(-font => - '-Misc-Fixed-Medium-R-Normal--10-100-75-75-C-60-ISO8859-1'); - # '-Misc-Fixed-Medium-R-Normal--14-130-75-75-C-70-ISO8859-1'); - Tk::CmdLine::SetArguments(); + $fnsize = 12; + $font_fmt = '-Misc-Fixed-Medium-R-Normal--%s-120-75-75-C-80-ISO8859-1'; }elsif($opt_size eq "SVGA" || $opt_size eq "800") { - $minW = 800; + $minW = 800; $minH = 600; $smallsized = 1; $coef = 0.64; - # Tk::CmdLine::SetArguments(-font => '6x10'); - Tk::CmdLine::SetArguments(-font => - '-Misc-Fixed-Medium-R-Normal--10-100-75-75-C-60-ISO8859-1'); - Tk::CmdLine::SetArguments(); + $fnsize = 10; + $font_fmt = '-Misc-Fixed-Medium-R-Normal--%s-100-75-75-C-60-ISO8859-1'; }elsif($opt_size eq "VGA" || $opt_size eq "640"){ - $minW = 640; + $minW = 640; $minH = 480; $smallsized = 1; $coef = 0.48; - # Tk::CmdLine::SetArguments(-font => '5x7'); - Tk::CmdLine::SetArguments(-font => - '-Misc-Fixed-Medium-R-Normal--7-70-75-75-C-50-ISO8859-1'); - Tk::CmdLine::SetArguments(); + $fnsize = 7; + $font_fmt = '-Misc-Fixed-Medium-R-Normal--%s-70-75-75-C-50-ISO8859-1'; +} else { + unless ($opt_size eq "XGA" || $opt_size eq "1024") { + carp "Unknown -size value (=$opt_size). Forced to XGA\n"; + } + $minW = 1024; + $minH = 768; + $smallsized = 0; + $coef = 1; + $fnsize = 11; + $font_fmt = '-Misc-Fixed-Medium-R-Normal--%s-100-75-75-C-60-ISO8859-1'; } +my $default_font = sprintf($font_fmt, $fnsize); +my $specific_font = sprintf($font_fmt, $fnsize+$opt_fsd); + +Tk::CmdLine::SetArguments(-font => $default_font); +Tk::CmdLine::SetArguments(); if($opt_undersize) { @@ -559,6 +558,7 @@ my $messagesText = -spacing1 => 2, -spacing2 => 0, -spacing3 => 2, + -font => $specific_font, -state => 'disabled', )->pack(-fill => 'both', -expand => 1, @@ -689,7 +689,9 @@ $status_fm->Label(-bg => 'gray92', -textvariable => \$runningtime_str)->pack(-fi # Bindings frame #---------------------------------------------------------------------------------- my $bindingsEntry = - $bindings_fm->Entry(-width => 30*$coef)->pack(-fill => 'x', + $bindings_fm->Entry(-font => $specific_font, + # -width => 30*$coef)->pack(-fill => 'x', # UPD + )->pack(-fill => 'x', -side => 'top', -anchor => 'w', -ipady => 3, @@ -710,8 +712,10 @@ my $bindingsList = # need intermediate frame for balloon help $bindings_fm->Frame()->pack(-fill => 'both', -expand => 1)->Scrolled('Listbox', -scrollbars => 'osoe', + -font => $specific_font, -height => 4, - -width => 30*$coef)->pack(-fill => 'both', + # -width => 30*$coef)->pack(-fill => 'both', #UPD + )->pack(-fill => 'both', -side => 'top', -anchor => 'w', -expand => 1); @@ -725,8 +729,10 @@ my $effectivebindingsList = $bindings_fm->Frame()->pack(-fill => 'both', -expand => 1) ->Scrolled('Listbox', -scrollbars => 'osoe', + -font => $specific_font, -height => 4, - -width => 30*$coef)->pack(-fill => 'both', + # -width => 30*$coef)->pack(-fill => 'both', # UPD + )->pack(-fill => 'both', -side => 'bottom', -anchor => 'w', -expand => 1); @@ -740,6 +746,7 @@ $effectivebindingsList->bind('', [\&removeBinding]); my $clientsListbox = $clients_fm->Scrolled('Listbox', -height => 9, + -font => $specific_font, -scrollbars => 'osoe')->pack(-fill => 'both', -expand => 0, -side => 'top'); @@ -780,7 +787,9 @@ my $send1_fm = $send_fm->Frame()->pack(-side => 'top', -expand => 1, -fill => 'both'); my $sendEntry = - $send1_fm->Entry(-width => 40*$coef)->pack(-fill => 'x', + $send1_fm->Entry(-font => $specific_font, + # -width => 40*$coef)->pack(-fill => 'x', # UPD + )->pack(-fill => 'x', -side => 'left', -anchor => 'w', -ipady => 3, @@ -788,7 +797,8 @@ my $sendEntry = -pady => 0); my $recipientLabel = $send1_fm->Label(-width => 2, - -relief => 'sunken')->pack(-fill => 'x', + -font => $specific_font, + -relief => 'sunken')->pack(-fill => 'x', -side => 'left', -anchor => 'w', -ipady => 3, @@ -804,8 +814,7 @@ my $clockstopButtonmsg = "Clock Stop"; my $clockbackCheckButtonmsg = "Backward"; if($smallsized){ -# $clockstartButtonmsg = "Start"; - $clockstartButtonmsg = "Go"; + $clockstartButtonmsg = "Start"; $clockstopButtonmsg = "Stop"; $clockbackCheckButtonmsg = "Backw"; } @@ -832,8 +841,10 @@ my $clockbackCheckbutton = my $sendList = $send_fm->Scrolled('Listbox', -scrollbars => 'osoe', - -height => 9, - -width => 40*$coef)->pack(-fill => 'both', + -font => $specific_font, + # -height => 9, #UPD + # -width => 40*$coef)->pack(-fill => 'both', #UPD + )->pack(-fill => 'both', -anchor => 'w', -side => 'top', -expand => 1); @@ -860,9 +871,12 @@ $sendList->bind('', [\&addMsgToSend, undef, 1]); # Search frame #---------------------------------------------------------------------------------- my $searchEntry = - $search_fm->Entry(-width => 24)->grid(-column => 1, + $search_fm->Entry(-font => $specific_font, + # -width => 24)->grid(-column => 1, #UPD + )->grid(-column => 1, -row => 1, - -columnspan => 3); + -columnspan => 3, + -sticky => 'nsew');# UPD $searchEntry->eventAdd('<>', '', '', '', ''); $searchEntry->eventAdd('<>', '', '', @@ -3147,7 +3161,7 @@ ivymon - a graphical application for monitoring Ivy =head1 SYNOPSIS B [B<-b> ivybus] [B<-help>] [B<-history> size] [B<-buf>] - [B<-size> window size] [B<-undersize>] + [B<-size> window size] [B<-undersize>] [B<-fsd> font size delta] [B<-bind> regexpB<1>] ... [B<-bind> regexpB] [B<-send> messageB<1>] ... [B<-send> messageB] [B<-out> outputfile] [B<-verbose>] [standard X11 options...] @@ -3189,14 +3203,32 @@ Bufferize received messages from the beginning. To display them in the 'Messages Set the history size of kept messages (default: 200000). If size is integer, only the first received messages will be kept. If size ends with 'm' character, only the messages received during the first minutes will be kept. If size is set to 'infinite' or 'inf', ivymon will keep all messages. -=item B<-size> window size +=item B<-size> window_size + +Set the size of the IvyMon window. Can be : + +=over + +=item . B or 640 (=640x480), + +=item . B or 800 (=800x600), -Set the size of the IvyMon window. Can be VGA or 640, SVGA or 800, XGA or 1024, SXGA or 1280, UXGA or 1600. Default is XGA (1024x768). +=item . B or 1024 (=1024x768), B value + +=item . B or 1280 (=1280x1024), + +=item . B or 1600 (=1600x1200). + +=back =item B<-undersize> Slightly reduce the IvyMon window to fit it in screen with borders of the window manager. Option not set by default. +=item B<-fsd> font_size_delta + +Increase or decrease the font size in lists, entries and messages frame. + =item B<-bind> regular_expression Subscribe to ivy messages, by using regular expression. This option may be used several times. @@ -3205,7 +3237,7 @@ Subscribe to ivy messages, by using regular expression. This option may be used Add an ivy message in the list of potential messages to send. This option may be used several times. -=item B<-out> output file +=item B<-out> output_file Specify the output filename and pass in storage mode : the content of the Messages frame will be written to file when you exit the application excepted if the B function was invoked manually. Note that output filename can be set or updated by sending the following message "Ivymon Output=". This option guarantees that data will be saved even if ivymon is interrupted (by Ctrl-C or ivy die message). -- cgit v1.1