From 2d6f3994f219891fd0478422bdea39ee626eca51 Mon Sep 17 00:00:00 2001 From: Gautier Hattenberger Date: Sat, 17 Jan 2015 14:29:27 +0100 Subject: [PATCH] [papgets] save ac_id in layout if needed --- sw/ground_segment/cockpit/papgets.ml | 9 +++++++-- sw/lib/ocaml/papget.ml | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/sw/ground_segment/cockpit/papgets.ml b/sw/ground_segment/cockpit/papgets.ml index 6967bd54fcc..b887083eeff 100644 --- a/sw/ground_segment/cockpit/papgets.ml +++ b/sw/ground_segment/cockpit/papgets.ml @@ -106,6 +106,11 @@ let locked = fun config -> [PC.property "locked" (PC.get_property "locked" config)] with _ -> [] +let ac_id_prop = fun config -> + try + [PC.property "ac_id" (PC.get_property "ac_id" config)] + with _ -> [] + let create = fun canvas_group papget -> try let type_ = ExtXml.attrib papget "type" @@ -144,7 +149,7 @@ let create = fun canvas_group papget -> Hashtbl.iter jump_to_block Live.aircrafts in let properties = - [ Papget_common.property "block_name" block_name ] @ locked papget in + [ Papget_common.property "block_name" block_name ] @ locked papget @ ac_id_prop papget in let p = new Papget.canvas_goto_block_item properties clicked renderer in let p = (p :> Papget.item) in @@ -177,7 +182,7 @@ let create = fun canvas_group papget -> let properties = [ Papget_common.property "variable" varname; Papget_common.float_property "value" value ] - @ locked papget in + @ locked papget @ ac_id_prop papget in let p = new Papget.canvas_variable_setting_item properties clicked renderer in let p = (p :> Papget.item) in register_papget p diff --git a/sw/lib/ocaml/papget.ml b/sw/lib/ocaml/papget.ml index 49e0a177e67..2e79863ddbd 100644 --- a/sw/lib/ocaml/papget.ml +++ b/sw/lib/ocaml/papget.ml @@ -64,7 +64,8 @@ object method connect = fun cb -> callbacks <- cb :: callbacks method config = fun () -> let field = sprintf "%s:%s" msg_name field_descr in - [ PC.property "field" field ] + let ac_id = match sender with None -> [] | Some id -> [PC.property "ac_id" id] in + [ PC.property "field" field ] @ ac_id method type_ = "message_field" initializer @@ -148,7 +149,8 @@ object method connect = fun cb -> callbacks <- cb :: callbacks method config = fun () -> - [ PC.property "expr" (Expr_syntax.sprint expr)] + let ac_id = match sender with None -> [] | Some id -> [PC.property "ac_id" id] in + [ PC.property "expr" (Expr_syntax.sprint expr)] @ ac_id method type_ = "expression"