mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-25 23:46:04 +08:00
[shortkey] allow to use Qt style for common key modifiers
this allow to avoid GTK style which makes the xml not valid because of < and > characters (this makes some parsers fail)
This commit is contained in:
@@ -41,7 +41,7 @@
|
||||
<set value="0" var="autopilot_flight_time"/>
|
||||
<go from="HOME" throttle="1.0" vmode="throttle" wp="CLIMB" pitch="15"/>
|
||||
</block>
|
||||
<block key="<Control>a" name="Standby" strip_button="Standby" strip_icon="home.png" group="home">
|
||||
<block key="Ctrl+a" name="Standby" strip_button="Standby" strip_icon="home.png" group="home">
|
||||
<circle radius="nav_radius" wp="STDBY"/>
|
||||
</block>
|
||||
<block key="F8" name="Figure 8 around wp 1" strip_button="Figure 8 (wp 1-2)" strip_icon="eight.png" group="base_pattern">
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<set value="0" var="autopilot_flight_time"/>
|
||||
<go from="HOME" throttle="1.0" vmode="throttle" wp="CLIMB" pitch="15"/>
|
||||
</block>
|
||||
<block key="<Control>a" name="Standby" strip_button="Standby" strip_icon="home.png" group="home">
|
||||
<block key="Ctrl+a" name="Standby" strip_button="Standby" strip_icon="home.png" group="home">
|
||||
<circle radius="nav_radius" wp="STDBY"/>
|
||||
</block>
|
||||
<block name="Mission" strip_button="Mission">
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<set value="0" var="autopilot_flight_time"/>
|
||||
<go from="HOME" pitch="15" throttle="1.0" vmode="throttle" wp="CLIMB"/>
|
||||
</block>
|
||||
<block key="<Control>a" name="Standby" strip_button="Standby" strip_icon="home.png">
|
||||
<block key="Ctrl+a" name="Standby" strip_button="Standby" strip_icon="home.png">
|
||||
<circle radius="nav_radius" wp="STDBY"/>
|
||||
</block>
|
||||
<block name="Poles 1" strip_button="Line (wp 1-2)" strip_icon="line.png">
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
<go approaching_time="0" from="AF" hmode="route" throttle="0.0" vmode="throttle" wp="TD"/>
|
||||
<attitude roll="0.0" throttle="0.0" until="FALSE" vmode="throttle"/>
|
||||
</block>
|
||||
<block group="home" key="<Control>a" name="Standby" strip_button="Standby" strip_icon="home.png">
|
||||
<block group="home" key="Ctrl+a" name="Standby" strip_button="Standby" strip_icon="home.png">
|
||||
<circle radius="nav_radius" wp="STDBY"/>
|
||||
</block>
|
||||
</blocks>
|
||||
|
||||
@@ -525,7 +525,7 @@ let create_ac = fun alert (geomap:G.widget) (acs_notebook:GPack.notebook) (ac_id
|
||||
let id = ExtXml.int_attrib block "no" in
|
||||
begin (* Is it a key short cut ? *)
|
||||
try
|
||||
let key, modifiers = GtkData.AccelGroup.parse (Xml.attrib block "key") in
|
||||
let key, modifiers = GtkData.AccelGroup.parse (Pprz.key_modifiers_of_string (Xml.attrib block "key")) in
|
||||
keys := (key, (modifiers, id)) :: !keys
|
||||
with
|
||||
_ -> ()
|
||||
|
||||
@@ -58,7 +58,7 @@ let search_index = fun value array ->
|
||||
|
||||
|
||||
let add_key = fun xml do_change keys ->
|
||||
let key, modifiers = GtkData.AccelGroup.parse (Xml.attrib xml "key")
|
||||
let key, modifiers = GtkData.AccelGroup.parse (Pprz.key_modifiers_of_string (Xml.attrib xml "key"))
|
||||
and value = ExtXml.float_attrib xml "value" in
|
||||
keys := (key, (modifiers, fun () -> do_change value)) :: !keys
|
||||
|
||||
|
||||
@@ -241,6 +241,17 @@ let alt_unit_coef_of_xml = fun ?auto xml ->
|
||||
in
|
||||
coef
|
||||
|
||||
let key_modifiers_of_string = fun key ->
|
||||
let key_split = Str.split (Str.regexp "[A-Za-z]+\\+") key in
|
||||
let keys = List.map (fun k ->
|
||||
match k with
|
||||
| "Ctrl" -> "<Control>"
|
||||
| "Alt" -> "<Alt>"
|
||||
| "Shift" -> "<Shift>"
|
||||
| "Meta" -> "<Meta>"
|
||||
| x -> x
|
||||
) key_split in
|
||||
String.concat "" keys
|
||||
|
||||
let pipe_regexp = Str.regexp "|"
|
||||
let field_of_xml = fun xml ->
|
||||
|
||||
@@ -109,6 +109,12 @@ val alt_unit_coef_of_xml : ?auto:string -> Xml.xml -> string
|
||||
(** Return coef for alternate unit
|
||||
*)
|
||||
|
||||
val key_modifiers_of_string : string -> string
|
||||
(** Convert key modifiers from Qt style (without '<' or '>', separated with '+')
|
||||
* to GTK style.
|
||||
* Supported modifiers are Alt, Ctrl, Shift and Meta
|
||||
*)
|
||||
|
||||
exception Unknown_msg_name of string * string
|
||||
(** [Unknown_msg_name (name, class_name)] Raised if message [name] is not
|
||||
found in class [class_name]. *)
|
||||
|
||||
Reference in New Issue
Block a user