*** empty log message ***

This commit is contained in:
Antoine Drouin
2005-08-17 14:14:55 +00:00
parent 9c339814df
commit e4ce195c1f
7 changed files with 70 additions and 55 deletions
@@ -23,6 +23,12 @@ sub Populate {
$self->{cur_block} = $self->{cur_stage} = -1;
}
sub set_selected_ac {
my ($self, $aircraft ) = @_;
my $notebook = $self->Subwidget('notebook');
$notebook->raise(scalar $aircraft->get('-ac_id'));
}
use Data::Dumper;
sub get_block_id {
@@ -19,6 +19,7 @@ sub populate {
-origin => [S_NEEDINIT, S_PASSIVE, S_RDONLY, S_OVRWRT, S_NOPRPG, undef],
-width => [S_NEEDINIT, S_PASSIVE, S_RDONLY, S_OVRWRT, S_NOPRPG, undef],
-height => [S_NEEDINIT, S_PASSIVE, S_RDONLY, S_OVRWRT, S_NOPRPG, undef],
-selected_ac => [S_NOINIT, S_METHOD, S_RDWR, S_OVRWRT, S_NOPRPG, undef],
-page => [S_NOINIT, S_METHOD, S_RDWR, S_OVRWRT, S_NOPRPG, "gps"],
-engine_status => [S_NOINIT, S_PRPGONLY, S_RDWR, S_OVRWRT, S_CHILDREN, undef],
-ap_status => [S_NOINIT, S_PRPGONLY, S_RDWR, S_OVRWRT, S_CHILDREN, undef],
@@ -47,6 +48,13 @@ sub page {
sub put_lls {
my ($self, $value) = @_;
# $self->{IR}->put_lls($value);
}
sub selected_ac {
my ($self, $old_ac, $new_ac) = @_;
}
sub build_gui() {
+5 -5
View File
@@ -60,18 +60,18 @@ sub completeinit {
sub selected_ac {
my ($self, $previous_ac, $new_ac) = @_;
print "###########";
print "in PFD selected_ac $previous_ac $new_ac\n";
# print "###########\n";
# print "in PFD selected_ac $previous_ac $new_ac\n";
my @fields = ('roll', 'alt', 'speed', 'alt', 'target_alt', 'target_heading', 'gps_mode');
my @fields = ('roll', 'pitch', 'speed', 'alt', 'target_alt', 'target_heading', 'gps_mode', 'ap_mode');
foreach my $field ( @fields ) {
$previous_ac->detach($self, $field, [\&foo_cbk, $field]) if ($previous_ac);
$new_ac->attach($self, $field, [\&foo_cbk, $field]);
}
@fields = (['mode', 'ap_mode'],
['course', 'heading'],
@fields = (['course', 'heading'],
['climb', 'vz']
);
foreach my $field ( @fields ) {
$previous_ac->detach($self, $field->[0], [\&foo_cbk, $field->[1]]) if ($previous_ac);
+45 -42
View File
@@ -87,12 +87,12 @@ sub completeinit {
}
};
$self->{'frame'} = undef;
$self->{'frame_clip'} = undef;
$self->{frame} = undef;
$self->{frame_clip} = undef;
$self->{'battery'} = 12.5;
$self->{'topgroup'} = undef;
$self->{'contentgroup'} = undef;
$self->{battery} = 12.5;
$self->{topgroup} = undef;
$self->{contentgroup} = undef;
$self->{mission} = undef;
$self->{options} = {
@@ -107,8 +107,8 @@ sub completeinit {
$self->{prefix} = "STRIP_".$self->get(-aircraft)->get('-ac_id')."_";
$self->{'zinc_bat'} = "";
$self->{'zinc_bat_value'} = "";
$self->{zinc_bat} = undef;
$self->{zinc_bat_value} = undef;
$self->attach_to_aircraft();
$self->draw();
@@ -142,15 +142,15 @@ sub draw {
## main group of the strip
$self->{'topgroup'} = $zinc->add('group', scalar $self->get('-parent_grp'), -sensitive => 1,
$self->{topgroup} = $zinc->add('group', scalar $self->get('-parent_grp'), -sensitive => 1,
-atomic => 0, -tags => ["strip_".$ident]);
$self->{'contentgroup'} = $zinc->add('group', $self->{'topgroup'}, -composealpha=>0, -sensitive=>1);
$self->{contentgroup} = $zinc->add('group', $self->{topgroup}, -composealpha=>0, -sensitive=>1);
## the strip
$self->{'frame'} = $zinc->add('rectangle', $self->{'topgroup'}, [5,5,$width, 95], -fillcolor => $self->{options}->{background_color}, -filled=>1, -linecolor => $self->{options}->{border_color}, -sensitive => 1, -tags => ["strip_".$ident]);
$self->{frame} = $zinc->add('rectangle', $self->{topgroup}, [5,5,$width, 95], -fillcolor => $self->{options}->{background_color}, -filled=>1, -linecolor => $self->{options}->{border_color}, -sensitive => 1, -tags => ["strip_".$ident]);
# cliping contour of the strip
$self->{'frame_clip'} = $zinc->add('rectangle', $self->{'contentgroup'}, [5,5,$width, 95], -visible=>0);
$zinc->itemconfigure($self->{'contentgroup'}, -clip=> $self->{'frame_clip'});
$self->{frame_clip} = $zinc->add('rectangle', $self->{contentgroup}, [5,5,$width, 95], -visible=>0);
$zinc->itemconfigure($self->{contentgroup}, -clip=> $self->{frame_clip});
## bindings to highlight the strip when the mouse is over
$zinc->bind($self->{frame}, '<Enter>', sub { $zinc->itemconfigure($self->{frame}, -linecolor => 'red'); });
@@ -158,7 +158,7 @@ sub draw {
$zinc->bind($self->{frame}, '<1>', [\&onStripPressed, $self, $ident]);
## ident of the plane
$zinc->add('text', $self->{'contentgroup'}, -text => uc($ident), -position=>[10,10], -font => $self->{options}->{normal_font}, -color => "midnightblue");
$zinc->add('text', $self->{contentgroup}, -text => uc($ident), -position=>[10,10], -font => $self->{options}->{normal_font}, -color => "midnightblue");
my @label_attr = (['AP', 'ap_mode', 70, 10],
['RC', 'rc_status', 70, 22],
@@ -175,23 +175,23 @@ sub draw {
$self->add_value_text($attr->[1]);
}
$zinc->add('text', $self->{'contentgroup'}, -text => $self->string_of_time(0), -position => [8, 82], -font => $self->{options}->{small_font}, -color => $self->{options}->{label_color}, -tags => [ $self->{prefix}."flight_time_value"] );
$zinc->add('text', $self->{contentgroup}, -text => $self->string_of_time(0), -position => [8, 82], -font => $self->{options}->{small_font}, -color => $self->{options}->{label_color}, -tags => [ $self->{prefix}."flight_time_value"] );
##
# QUICK and DIRTY flight time an battery
#
## flight_time
# FIXME: use tags instead of reference to zinc item
$zinc->add('rectangle', $self->{'contentgroup'}, [10,25, 41,81], -filled=>1, -fillcolor=> '#d1d1d1');
$self->{'zinc_bat'} = $zinc->add('rectangle', $self->{'contentgroup'}, [11,80-(($self->{'battery'}-6)/7)*55,40,80], -filled=>1,-fillcolor=>'#8080ff', -linewidth=>0);
$zinc->add('rectangle', $self->{contentgroup}, [10,25, 41,81], -filled=>1, -fillcolor=> '#d1d1d1');
$self->{zinc_bat} = $zinc->add('rectangle', $self->{contentgroup}, [11,80-(($self->{battery}-6)/7)*55,40,80], -filled=>1,-fillcolor=>'#8080ff', -linewidth=>0);
$self->{'zinc_bat_value'} = $zinc->add('text', $self->{'contentgroup'}, -text => sprintf("%s",$self->{'battery'}), -position=>[12,40], -font => $self->{options}->{small_font});
$self->{zinc_bat_value} = $zinc->add('text', $self->{contentgroup}, -text => sprintf("%s",$self->{battery}), -position=>[12,40], -font => $self->{options}->{small_font});
$zinc->translate($self->{'topgroup'}, $x, $y);
$zinc->raise($self->{'topgroup'});
$zinc->raise($self->{'contentgroup'});
$zinc->translate($self->{topgroup}, $x, $y);
$zinc->raise($self->{topgroup});
$zinc->raise($self->{contentgroup});
# $self->border_block(); # display blocks of flight plan
return $self->{'topgroup'};
return $self->{topgroup};
}
# add_label
@@ -199,8 +199,8 @@ sub draw {
##############################################################################
sub add_label {
my ($self, $label, $tag, $x, $y) = @_;
print "adding $tag\n";
$self->get('-zinc')->add('text',$self->{'contentgroup'}, -text => $label, -position => [$x, $y], -font => $self->{options}->{normal_font}, -color => $self->{options}->{label_color}, -tags => [ $self->{prefix}.$tag ]);
# print "adding $tag\n";
$self->get('-zinc')->add('text',$self->{contentgroup}, -text => $label, -position => [$x, $y], -font => $self->{options}->{normal_font}, -color => $self->{options}->{label_color}, -tags => [ $self->{prefix}.$tag ]);
}
# add_value_text
@@ -322,19 +322,20 @@ sub set_block {
# FIXME: should be deprecated and we should use set_item or something like that
sub setBat {
sub set_bat {
my ($self, $bat) = @_;
print "in Strip::set_bat $bat ($self->{prefix})\n";
$self->{'battery'} = $bat;
# print "in Strip::set_bat $bat ($self->{prefix})\n";
my $zinc = $self->get('-zinc');
$self->{battery} = $bat;
my $batcolor = '#8080ff';
$self->{'zinc'}->remove($self->{'zinc_bat'});
$self->{'zinc_bat'} =
$self->{'zinc'}->add('rectangle',
$self->{'contentgroup'}, [11,80-(($self->{'battery'}-6)/7)*55,40,80],
-filled=>1,-fillcolor=>$batcolor, -linewidth=>0);
$self->{'zinc'}->itemconfigure($self->{'zinc_bat_value'},
-text => sprintf("%2.1f",$self->{'battery'}),);
$self->{'zinc'}->raise($self->{'zinc_bat_value'});
$zinc->remove($self->{zinc_bat}) if (defined $self->{zinc_bat});
$self->{zinc_bat} = $zinc->add('rectangle',
$self->{contentgroup},
[11,80-(($self->{battery}-6)/7)*55,40,80],
-filled=>1, -fillcolor=>$batcolor, -linewidth=>0) if (defined $self->{contentgroup});
$zinc->itemconfigure($self->{zinc_bat_value},
-text => sprintf("%2.1f",$self->{battery}),);
$zinc->raise($self->{zinc_bat_value});
}
sub string_of_time {
@@ -350,8 +351,8 @@ sub string_of_time {
##############################################################################
sub attach_to_aircraft {
my ($self) = @_;
my @options = ('flight_plan', 'ap_mode', 'rc_mode', 'gps_mode', 'contrast_status', 'contrast_value',
'flight_time', 'alt', 'target_alt', 'speed', 'climb');
my @options = ('flight_plan', 'ap_mode', 'rc_status', 'gps_mode', 'contrast_status', 'contrast_value',
'flight_time', 'alt', 'target_alt', 'speed', 'climb', 'bat');
foreach my $option (@options) {
$self->get('-aircraft')->attach($self, $option, [\&aircraft_config_changed]);
}
@@ -364,8 +365,8 @@ sub aircraft_config_changed {
if ($event eq 'flight_plan') {
# $self->border_block() if (defined $new_value) ; # display blocks of flight plan
}
elsif ($event eq 'ap_mode' or $event eq 'rc_status' or
$event eq 'gps_mode' or $event eq 'contrast_status') {
elsif ($event eq 'ap_mode' or $event eq 'rc_status' or #$event eq 'rc_mode' or
$event eq 'gps_mode' or $event eq 'contrast_status' ) {
my $names = $self->{modes}->{$event}->{name};
my $colors = $self->{modes}->{$event}->{color};
if ($new_value < @{$names} ) {
@@ -377,15 +378,17 @@ sub aircraft_config_changed {
$self->set_item("flight_time",$self->string_of_time($new_value), $self->{options}->{value_color});
}
elsif ($event eq 'bat') {
$self->set_bat($new_value); # display blocks of flight plan
$self->set_bat($new_value);
}
elsif ( $event eq 'speed' or $event eq 'climb' or $event eq 'alt' or $event eq 'target_alt') {
elsif ( $event eq 'speed' or $event eq 'climb' or $event eq 'alt' or $event eq 'target_alt' or $event eq 'contrast_value') {
my $fmt = { speed => "%2.1fm/s",
climb => "%+2.1fm/s",
alt => "%4.1fm",
target_alt => "%4.1fm"
target_alt => "%4.1fm",
contrast_value => "%03d",
};
$self->set_item($event, sprintf($fmt->{$event}, $new_value), $self->{options}->{value_color});
}
# cur_block
elsif ($event eq 'cur_block') {
@@ -401,7 +404,7 @@ sub aircraft_config_changed {
sub selected {
my ($self, $previous_val, $new_val) = @_;
my $zinc = $self->get('-zinc');
$zinc->itemconfigure($self->{'frame'},
$zinc->itemconfigure($self->{frame},
-fillcolor => $new_val ? $self->{options}->{selected_background_color} :
$self->{options}->{background_color});
}
@@ -70,7 +70,7 @@ sub add_strip {
}
sub OnStripPressed {
print ("OnStripPressed @_\n");
# print ("OnStripPressed @_\n");
my ($zinc, $self, $ac_id) = @_;
$self->{strips}->{$self->get('-selected')}->configure('-selected' => 0) if defined $self->get('-selected');
$self->configure('-selected' => $ac_id);
+1 -3
View File
@@ -129,11 +129,8 @@ sub ivy_on_selected {
}
sub on_aircraft_selection {
# print ("onAircratftSelection @_\n");
my ($self, $_sp, $what, $new_selected_ac ) = @_;
print "on_aircraft_selection @_\n";
$self->select_ac($new_selected_ac);
}
sub select_ac {
@@ -142,6 +139,7 @@ sub select_ac {
$self->{aircrafts_manager}->listen_to_ac($ac_id);
my $aircraft = $self->{aircrafts_manager}->get_aircraft_by_id($ac_id);
$self->{pfd}->configure('-selected_ac', $aircraft);
$self->{nd}->configure('-selected_ac', $aircraft);
$self->{md}->set_selected_ac($aircraft);
}
+4 -4
View File
@@ -29,8 +29,8 @@ sub init {
sub send_request {
my ($sender_name, $msg_class, $msg_name, $known_fields, $user_cb) = @_;
print "in send request $msg_class $msg_name\n";
print Dumper($known_fields);
# print "in send request $msg_class $msg_name\n";
# print Dumper($known_fields);
my $result_name = $msg_name;#."_RES";
my $regexp = get_regexp($sender_name, $msg_class, $msg_name, $known_fields);
$regexp =~ s/$msg_name/$result_name/;
@@ -45,8 +45,8 @@ sub send_request {
sub on_res_received {
my ($sender_name, $msg_class, $msg_name, $known_fields, $regexp, $user_cb, @matched_regexps) = @_;
print "on res received\n";
print Dumper($known_fields);
# print "on res received\n";
# print Dumper($known_fields);
$ivy->bindRegexp($regexp);
on_msg_received($sender_name, $msg_class, $msg_name, $known_fields, $user_cb, @matched_regexps);