diff --git a/conf/messages.xml b/conf/messages.xml index 65401d989a..61a4911772 100644 --- a/conf/messages.xml +++ b/conf/messages.xml @@ -328,13 +328,12 @@ - - + + - diff --git a/sw/ground_segment/cockpit/Paparazzi/MissionD.pm b/sw/ground_segment/cockpit/Paparazzi/MissionD.pm index 7931286ae4..989f111d30 100644 --- a/sw/ground_segment/cockpit/Paparazzi/MissionD.pm +++ b/sw/ground_segment/cockpit/Paparazzi/MissionD.pm @@ -34,27 +34,6 @@ sub get_stage_id { return "stage_".$no_block."_".$no_stage; } -sub set_block_and_stage { - my ($self, $new_block, $new_stage) = @_; - my $text = $self->Subwidget('text'); - if ($self->{cur_block} != $new_block) { - $text->tagConfigure(get_block_id($self->{cur_block}), -background => undef); - $text->tagConfigure(get_block_id($new_block), -background => 'green3'); - $text->tagConfigure(get_stage_id($self->{cur_block}, $self->{cur_stage}), -background => undef); - $text->tagConfigure(get_stage_id($new_block, $new_stage), -background => 'green1'); - $self->{cur_block} = $new_block; - $self->{cur_stage} = $new_stage; - } - else { - if ($self->{cur_stage} != $new_stage) { - $text->tagConfigure(get_stage_id($self->{cur_block}, $self->{cur_stage}), -background => undef); - $text->tagConfigure(get_stage_id($self->{cur_block}, $new_stage), -background => 'green1'); - $self->{cur_stage} = $new_stage; - } - } -} - - sub add_aircraft { my ($self, $aircraft ) = @_; my $notebook = $self->Subwidget('notebook'); @@ -66,16 +45,33 @@ sub add_aircraft { $text->insert('end', "coucou"); $self->{'text'.$aircraft->get('-ac_id')} = $text; - $aircraft->attach($self, 'flight_plan', [\&on_flight_plan]); + $aircraft->attach($self, 'flight_plan', [\&on_ac_changed]); + $aircraft->attach($self, 'cur_block', [\&on_ac_changed]); + $aircraft->attach($self, 'cur_stage', [\&on_ac_changed]); } -sub on_flight_plan { +sub on_ac_changed { my ($self, $aircraft, $event, $new_value) = @_; print "in MissionD : on_flight_plan @_\n"; - - if (defined $new_value) { - my $compiled_xml = $new_value->get('-compiled_xml') ; - $self->load_flight_plan(scalar $aircraft->get('-ac_id'), $compiled_xml); + my $ac_id = $aircraft->get('-ac_id'); + if ($event eq 'flight_plan') { + if (defined $new_value) { + my $compiled_xml = $new_value->get('-compiled_xml') ; + $self->load_flight_plan($ac_id , $compiled_xml); + } + } + elsif ($event eq 'cur_block') { + my $text = $self->{'text'.$ac_id}; + $text->tagConfigure(get_block_id($self->{cur_block}), -background => undef); + $text->tagConfigure(get_block_id($new_value), -background => 'green3'); + $text->tagConfigure(get_stage_id($self->{cur_block}, $self->{cur_stage}), -background => undef); + $self->{cur_block} = $new_value; + } + elsif ($event eq 'cur_stage') { + my $text = $self->{'text'.$ac_id}; + $text->tagConfigure(get_stage_id($self->{cur_block}, $self->{cur_stage}), -background => undef); + $text->tagConfigure(get_stage_id($self->{cur_block}, $new_value), -background => 'green1'); + $self->{cur_stage} = $new_value; } } diff --git a/sw/ground_segment/cockpit/Paparazzi/Strip.pm b/sw/ground_segment/cockpit/Paparazzi/Strip.pm index b67486b93d..71afbbb054 100644 --- a/sw/ground_segment/cockpit/Paparazzi/Strip.pm +++ b/sw/ground_segment/cockpit/Paparazzi/Strip.pm @@ -134,6 +134,9 @@ sub draw { my $ident = $self->get(-aircraft)->get('-ac_id'); my ($x, $y) = @{$self->get('-origin')}; # my $fp = $self->get(-flight_plan); + + my $width = 300; + ## main group of the strip $self->{'topgroup'} = $zinc->add('group', scalar $self->get('-parent_grp'), -sensitive => 1, @@ -141,9 +144,9 @@ sub draw { $self->{'contentgroup'} = $zinc->add('group', $self->{'topgroup'}, -composealpha=>0, -sensitive=>1); ## the strip - $self->{'frame'} = $zinc->add('rectangle', $self->{'topgroup'}, [5,5,795, 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,795, 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'}); ## bindings to highlight the strip when the mouse is over @@ -305,17 +308,17 @@ sub border_block { my $clip = $zinc->add('rectangle', $groups[$i], [$x[$i], 10, $x[$i]+46, 90], -visible => 0); $zinc->itemconfigure($groups[$i], -clip => $clip); $zinc->add('text', $groups[$i], -text => $block_name, - -position => [ $x[$i]+3, 20], -font => $self->{options}->{normal_font}, - -tags => [ $self->{prefix}."block_".$block_name, "block_label", $self->{prefix}."block_num_".$i ] - ); - $zinc->add('text', $groups[$i], -text => $blocks[$i]->{rc1}, - -position => [ $x[$i]+3, 50], -font => $self->{options}->{small_font}, - -color => $self->{options}->{value_color} -); -$zinc->add('text', $groups[$i], -text => $blocks[$i]->{rc2}, --position => [ $x[$i]+3, 60], -font => $self->{options}->{small_font}, --color => $self->{options}->{value_color} - ); + -position => [ $x[$i]+3, 20], -font => $self->{options}->{normal_font}, + -tags => [ $self->{prefix}."block_".$block_name, "block_label", $self->{prefix}."block_num_".$i ] + ); + $zinc->add('text', $groups[$i], -text => $blocks[$i]->{rc1}, + -position => [ $x[$i]+3, 50], -font => $self->{options}->{small_font}, + -color => $self->{options}->{value_color} + ); + $zinc->add('text', $groups[$i], -text => $blocks[$i]->{rc2}, + -position => [ $x[$i]+3, 60], -font => $self->{options}->{small_font}, + -color => $self->{options}->{value_color} + ); } } diff --git a/sw/ground_segment/cockpit/cockpit.pl b/sw/ground_segment/cockpit/cockpit.pl index 853575422c..1edd1f7004 100755 --- a/sw/ground_segment/cockpit/cockpit.pl +++ b/sw/ground_segment/cockpit/cockpit.pl @@ -80,7 +80,7 @@ sub build_gui { # $self->{mw}->geometry("1280x1024"); my $top_frame = $self->{mw}->Frame()->pack(-side => 'top', -fill => 'both'); my $bot_frame = $self->{mw}->Frame()->pack(-side => 'bottom', -fill => 'both', -expand => 1); - my ($stp_p, $stp_w, $stp_h) = ([0, 0], 800, 300); + my ($stp_p, $stp_w, $stp_h) = ([0, 0], 315, 300); my ($pfd_p, $pfd_w, $pfd_h) = ([$stp_w, 0] , 300, $stp_h); my ($nd_p, $nd_w, $nd_h) = ([$pfd_p->[0]+ $pfd_w, 0], 300, 300); my $zinc = $top_frame->Zinc(-width => $stp_w + $pfd_w + $nd_w , diff --git a/sw/lib/perl/Paparazzi/Aircraft.pm b/sw/lib/perl/Paparazzi/Aircraft.pm index 62a4ed2432..f2527a481b 100644 --- a/sw/lib/perl/Paparazzi/Aircraft.pm +++ b/sw/lib/perl/Paparazzi/Aircraft.pm @@ -48,6 +48,14 @@ sub populate { alt => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], climb => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], + ap_mode => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], + h_mode => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], + v_mode => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], + target_climb => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], + target_alt => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], + target_heading=> [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], + gps_mode => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], + cur_block => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], cur_stage => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], flight_time => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], @@ -56,14 +64,6 @@ sub populate { target_east => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], target_north => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], - mode => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], - h_mode => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], - v_mode => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], - target_climb => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], - target_alt => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], - target_heading=> [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], - gps_mode => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], - throttle => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], rpm => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.], temp => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 0.],