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