summaryrefslogtreecommitdiff
path: root/src/ivymon
diff options
context:
space:
mode:
Diffstat (limited to 'src/ivymon')
-rwxr-xr-xsrc/ivymon47
1 files changed, 35 insertions, 12 deletions
diff --git a/src/ivymon b/src/ivymon
index e520ea7..8c39783 100755
--- a/src/ivymon
+++ b/src/ivymon
@@ -13,7 +13,7 @@ my $minH = 768;
my $ivy_port; # undef:=> default value is treated by ivy-perl
my $history = 10000;
-
+my $casesensitiveflag = 1;
# divers
my %connectedClients;
my %clientsIndex;
@@ -427,7 +427,7 @@ my $searchEntry =
$frame122search->Entry(-width => 20)->pack(-fill => 'none',
-ipady => 3,
-expand => 1,
- -padx => 10, -pady => 14);
+ -padx => 10, -pady => 3);
$searchEntry->bind('<Return>' => [\&searchNext, 1]);
$searchEntry->bind('<Next>' => [\&searchNext, 1]);
$searchEntry->bind('<Control-s>' => [\&searchNext, 1]);
@@ -441,12 +441,17 @@ $searchEntry->bind('<Control-n>' => [\&searchNextExpression]);
$searchEntry->bind('<Up>' => [\&searchPrevExpression]);
$searchEntry->bind('<Control-p>' => [\&searchPrevExpression]);
-# la frame comprenant les boutons associes
+# la frame comprenant les boutons associes et le Min/Maj checkbutton
my $frame1220 =
$frame122search->Frame()->pack(-fill => 'both',
-side => 'top',
-expand => 0,
-padx => 10, -pady => 5);
+my $casesensitivecb = $frame1220->Checkbutton(-text => 'Case sensitive',
+ -variable => \$casesensitiveflag
+ )->pack(-fill => 'x',
+ -side => 'top',
+ -expand => 1);
# la frame comprenant la rangee superieure de bouton Previous et Next
my $frame1221 =
$frame1220->Frame()->pack(-fill => 'x',
@@ -802,7 +807,7 @@ sub clearMessages {
&start;
}
-sub flashMessages {
+sub searchLoopEvt {
$messagesText->configure(-background => 'gray90');
$messagesText->after(100, sub {$messagesText->configure(-background =>
$messagesBg);
@@ -810,6 +815,14 @@ sub flashMessages {
$messagesText->bell;
}
+sub searchNotFoundEvt {
+ $messagesText->configure(-background => 'gray30');
+ $messagesText->after(100, sub {$messagesText->configure(-background =>
+ $messagesBg);
+ });
+ $messagesText->bell;
+}
+
#----------------------------------------------------------------------------------
# Fonctions associees a la gestion des abonnements
#----------------------------------------------------------------------------------
@@ -1124,15 +1137,18 @@ sub searchNext {
my $strlen = length($string);
return unless $string;
my $index0 = ($searchIndex) ? "$searchIndex + 1 chars": '0.0';
- my $index = $messagesText->search(-forwards, $string, $index0);
+ my @searchopts = (-forwards);
+ push(@searchopts, -nocase) unless ($casesensitiveflag);
+ my $index = $messagesText->search(@searchopts, $string, $index0);
#print "index=$index searchIndex=$searchIndex\n";
&highlightStringOff;
if ($index) {
&highlightString($index, "$index + $strlen chars");
$messagesText->see($index);
- &flashMessages if $index <= $searchIndex;
+ &searchLoopEvt if defined($searchIndex) and
+ $messagesText->compare($index, "<=" ,$searchIndex);
} else {
- &flashMessages;
+ &searchNotFoundEvt;
}
$searchIndex = $index;
$searchHistoryIndex = -1;
@@ -1145,14 +1161,17 @@ sub searchPrev {
return unless $string;
#my $index0 = ($searchIndex) ? "$searchIndex - 1 chars": '0.0';
my $index0 = ($searchIndex) ? $searchIndex : '0.0';
- my $index = $messagesText->search(-backwards, $string, $index0);
+ my @searchopts = (-backwards);
+ push(@searchopts, -nocase) unless ($casesensitiveflag);
+ my $index = $messagesText->search(@searchopts, $string, $index0);
&highlightStringOff;
if ($index) {
&highlightString($index, "$index + $strlen chars");
$messagesText->see($index);
- &flashMessages if $index >= $searchIndex;
+ &searchLoopEvt if defined($searchIndex) and
+ $messagesText->compare($index, ">=" ,$searchIndex);
} else {
- &flashMessages;
+ &searchNotFoundEvt;
}
$searchIndex = $index;
$searchHistoryIndex = -1;
@@ -1161,6 +1180,7 @@ sub searchPrev {
sub searchAll {
+ &highlightStringOff;
my $string = $searchEntry->get;
my $strlen = length($string);
return unless $string;
@@ -1169,14 +1189,17 @@ sub searchAll {
-foreground => 'ivory');
my $index = '0.0';
my $found = 0;
+ my @searchopts = (-forwards);
+ push(@searchopts, -nocase) unless ($casesensitiveflag);
+
while ($index) {
- $index = $messagesText->search(-forwards, $string, $index, 'end');
+ $index = $messagesText->search(@searchopts, $string, $index, 'end');
last unless $index;
$messagesText->tagAdd('found', $index, "$index + $strlen chars");
$index = "$index + 1 chars";
$found++;
}
- &flashMessages unless $found;
+ &searchNotFoundEvt unless ($found);
$searchHistoryIndex = -1;
&searchHistoryGenList($string);