On Thu, Nov 29, 2012 at 05:34:28PM +0100, Olivier Fourdan wrote:
> Updated patch.
>
> Uses CW and CCW instead of Up and Down for touch rings, adds
> (optional) arrows to show rotation on touch rings, renamed
> "indicator" as "leader" as per previous reviews.
ack to the leader part of it, but the other comments still stand
(change of colours, timeout change, splitting the API change for print_label
into a separate patch)
one more nitpick, but you don't have to address this one if you don't agree:
> - markup = g_strdup_printf ("<span foreground=\""
> ACTIVE_COLOR "\" weight=\"bold\">Button %c</span>", button);
make this
g_strdup_printf("<span foreground=\"%s\" ...", ACTIVE_COLOR, button);
nicer to read and we're already using printf here anyway. should probably go
into a separate patch since you're just renaming here
Cheers,
Peter
> From b877ff84ee108ce2115a40b4d7c8edfd47382b73 Mon Sep 17 00:00:00 2001
> From: Olivier Fourdan <[email protected]>
> Date: Tue, 27 Nov 2012 09:52:42 +0100
> Subject: [PATCH] data: Add leaders to layouts
>
> To match the buttons with their corresponding labels, the
> layout SVG must also provide a leader line for each label
> in the form of a line that links each button and its
> label.
>
> Improves the layout SVG for the Cintiq 12WX and Intuos 5 M
> by adding details and rounded buttons to match the look of
> the real device.
>
> Buttons, labels and indicators are now grouped in the SVG
> layout for better clarity of the SVG.
>
> Adds indicators to the SVG check test iprogram so that
> incomplete layouts would be detected.
>
> Replace use of ambiguous "Up" and "Down" in ring
> controls with "CW" (Clockwise) and "CCW" (Counter
> Clockwise) which are more appropriate for circular
> motion (note that "CCW" is used in place of "Up"
> and "CW" in place of "Down").
>
> Add possible use of "fake" buttons to materialize
> the type of motion expected in touch strips/rings
> (optional, not mandatory as not present on the
> real device).
>
> Improves the SVG layout display sample program to show
> touch ring/touch strips labels and label indicators.
>
> Signed-off-by: Olivier Fourdan <[email protected]>
> ---
> data/layouts/README | 124 +++++++++++++++++++++++++++---
> data/layouts/cintiq-12wx.svg | 118 ++++++++++++++++++++++-------
> data/layouts/intuos5-m.svg | 87 +++++++++++++++------
> test/tablet-svg-validity.c | 83 ++++++++++++++++++--
> tools/show-svg-image.c | 176
> +++++++++++++++++++++++++------------------
> 5 files changed, 448 insertions(+), 140 deletions(-)
>
> diff --git a/data/layouts/README b/data/layouts/README
> index 37b644d..fda7814 100644
> --- a/data/layouts/README
> +++ b/data/layouts/README
> @@ -56,6 +56,56 @@ Touch rings use the following convention:
> id="Strip2"
> class="Strip2 TouchStrip"
>
> +Note: Additional "fake" buttons (ie actual controls not found on the real
> +device) can be added to touch controls to help showing the type of action
> +expected on the control, like for example circular motion on a touch ring
> +or vertical motion on a touch strip.
> +
> +These controls can be named:
> +
> + - First touch ring, rotating clockwise:
> +
> + id="RingCW"
> + class="RingCW Button"
> +
> + - First touch ring, rotating counter clockwise:
> +
> + id="RingCCW"
> + class="RingCCW Button"
> +
> + - Second touch ring, rotating clockwise:
> +
> + id="Ring2CW"
> + class="Ring2CW Button"
> +
> + - Second touch ring, rotating counter clockwise:
> +
> + id="Ring2CCW"
> + class="Ring2CCW Button"
> +
> + - First touch strip, moving up:
> +
> + id="StripUp"
> + class="StripUp Button"
> +
> + - First touch strip, moving down:
> +
> + id="StripDown"
> + class="StripDown Button"
> +
> + - Second touch strip, moving up:
> +
> + id="Strip2Up"
> + class="Strip2Up Button"
> +
> + - Second touch strip, moving down:
> +
> + id="Strip2Down"
> + class="Strip2Down Button"
> +
> +The use of those "fake" buttons is left at the discretion of the designer
> +and is not mandatory nor enforced.
> +
> * Labels
>
> The role of the labels in the SVG is to give applications an indication on
> @@ -71,6 +121,7 @@ Each button's label ID in the SVG is made of the string
> "Label" with ID of the
> button to which it applies, between 'A' and 'Z'.
>
> Class includes both the button ID and the string "Label".
> +
> id="LabelA"
> class="A Label"
>
> @@ -84,23 +135,23 @@ For the special case of mode-switch buttons, the class
> also list "ModeSwitch":
> Touch-rings and touch-strips generate Up and Down events, therefore 2
> different
> labels are needed for each touch-ring/touch-strip control.
>
> - id="LabelRingUp"
> - class="RingUp Ring Label"
> + id="LabelRingCCW"
> + class="RingCCW Ring Label"
>
> and
>
> - id="LabelRingDown"
> - class="RingDown Ring Label"
> + id="LabelRingCW"
> + class="RingCW Ring Label"
>
> The second touch-ring button is identified by "Ring2" in place of "Ring":
>
> - id="LabelRing2Up"
> - class="Ring2Up Ring2 Label"
> + id="LabelRing2CCW"
> + class="Ring2CCW Ring2 Label"
>
> and
>
> - id="LabelRingDown"
> - class="Ring2Down Ring2 Label"
> + id="LabelRingCW"
> + class="Ring2CW Ring2 Label"
>
> Touchstrips button follow the same naming scheme, using "Strip" and "Strip2"
> to name the first and second touch-strip.
> @@ -120,5 +171,60 @@ Second touch-strip:
>
> and
>
> - id="LabelRingDown"
> + id="LabelRingCW"
> class="Strip2Down Strip2 Label"
> +
> + - Caption leader lines
> +
> +To match the buttons with their corresponding labels, the SVG must also
> +provide a leader line for each label in the form of a line that links
> +each button and its label.
> +
> +Each leader line follows the same naming convention as the labels, using
> +the special name "Leader" in place of "Label", ie:
> +
> + id="LeaderA"
> + class="A Leader"
> +
> +Touch-rings and touch-strips have 2 different labels and therefore 2 leader
> +lines.
> +
> + id="LeaderRingCCW"
> + class="RingCCW Ring Leader"
> +
> + and
> +
> + id="LeaderRingCW"
> + class="RingCW Ring Leader"
> +
> +The second touch-ring button is identified by "Ring2" in place of "Ring":
> +
> + id="LeaderRing2CCW"
> + class="Ring2CCW Ring2 Leader"
> +
> + and
> +
> + id="LeaderRingCW"
> + class="Ring2CW Ring2 Leader"
> +
> +Touchstrips button follow the same naming scheme, using "Strip" and "Strip2"
> +to name the first and second touch-strip.
> +
> + id="LeaderStripUp"
> + class="StripUp Strip Leader"
> +
> + and
> +
> + id="LeaderStripDown"
> + class="StripDown Strip Leader"
> +
> +Second touch-strip:
> +
> + id="LeaderStrip2Up"
> + class="Strip2Up Strip2 Leader"
> +
> + and
> +
> + id="LeaderStrip2Down"
> + class="Strip2Down Strip2 Leader"
> +
> diff --git a/data/layouts/cintiq-12wx.svg b/data/layouts/cintiq-12wx.svg
> index 370283d..1095293 100644
> --- a/data/layouts/cintiq-12wx.svg
> +++ b/data/layouts/cintiq-12wx.svg
> @@ -2,33 +2,93 @@
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
> "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
> <svg xmlns="http://www.w3.org/2000/svg" version="1.1"
> -
> style="color:#000000;stroke:#bebebe;fill:#000000;stroke-linejoin:round;stroke-width:1;font-size:8"
> - id="cintiq-12wx"
> width="405" height="270" >
> - <title id="title"
> >Wacom Cintiq 12WX</title>
> - <rect id="ButtonA" class="A Button" x="40" y="54"
> width="11" height="17" />
> - <text id="LabelA" class="A Label" x="60" y="63"
> >A</text>
> - <rect id="ButtonB" class="B Button" x="40" y="72"
> width="11" height="17" />
> - <text id="LabelB" class="B Label" x="60" y="81"
> >B</text>
> - <rect id="ButtonC" class="C Button" x="28" y="54"
> width="11" height="35" />
> - <text id="LabelC" class="C Label" x="60" y="72"
> >C</text>
> - <rect id="ButtonD" class="D Button" x="28" y="90"
> width="23" height="11" />
> - <text id="LabelD" class="D Label" x="60" y="96"
> >D</text>
> - <rect id="ButtonE" class="E Button" x="352" y="54"
> width="11" height="17" />
> - <text id="LabelE" class="E Label" x="342" y="63"
> >E</text>
> - <rect id="ButtonF" class="F Button" x="352" y="72"
> width="11" height="17" />
> - <text id="LabelF" class="F Label" x="342" y="81"
> >F</text>
> - <rect id="ButtonG" class="G Button" x="364" y="54"
> width="11" height="35" />
> - <text id="LabelG" class="G Label" x="342" y="72"
> >G</text>
> - <rect id="ButtonH" class="H Button" x="352" y="90"
> width="23" height="11" />
> - <text id="LabelH" class="H Label" x="342" y="96"
> >H</text>
> - <rect id="ButtonI" class="I Button" x="28" y="42"
> width="23" height="11" />
> - <text id="LabelI" class="I Label" x="60" y="51"
> >I</text>
> - <rect id="ButtonJ" class="J Button" x="352" y="42"
> width="23" height="11" />
> - <text id="LabelJ" class="J Label" x="342" y="51"
> >J</text>
> - <rect id="Strip" class="Strip TouchStrip" x="10" y="41"
> width="12" height="60" />
> - <text id="LabelStripUp" class="StripUp Strip Label" x="16" y="30"
> >Up</text>
> - <text id="LabelStripDown" class="StripDown Strip Label" x="16"
> y="110" >Down</text>
> - <rect id="Strip2" class="Strip2 TouchStrip" x="382" y="41"
> width="12" height="60" />
> - <text id="LabelStrip2Up" class="Strip2Up Strip2 Label" x="388" y="30"
> >Up</text>
> - <text id="LabelStrip2Down" class="Strip2Down Strip2 Label" x="388"
> y="110" >Down</text>
> +
> style="color:#000000;stroke:#7f7f7f;fill:#none;stroke-width:.25;font-size:8"
> + id="cintiq-12wx"
> width="405" height="270" >
> + <title id="title"
> >Wacom Cintiq 12WX</title>
> + <g>
> + <rect id="ButtonA" class="A Button" rx=".5" ry=".5" x="40"
> y="54" width="11" height="17" />
> + <path id="LeaderA" class="A Leader" d="M 53
> 63 L 65 63 L 65 72 L 78 72" />
> + <text id="LabelA" class="A Label" x="80"
> y="72" style="text-anchor:start;" >A</text>
> + </g>
> + <g>
> + <rect id="ButtonB" class="B Button" rx=".5" ry=".5" x="40"
> y="72" width="11" height="17" />
> + <circle id="DotB1" cx="45.5"
> cy="77.5" r=".5" />
> + <circle id="DotB2" cx="45.5"
> cy="80.5" r=".5" />
> + <circle id="DotB3" cx="45.5"
> cy="83.5" r=".5" />
> + <path id="LeaderB" class="B Leader" d="M 53
> 81 L 65 81 L 65 87 L 78 87" />
> + <text id="LabelB" class="B Label" x="80"
> y="87" style="text-anchor:start;" >B</text>
> + </g>
> + <g>
> + <rect id="ButtonC" class="C Button" x="28"
> y="54"
> + rx=".5"
> ry=".5" width="11" height="35" />
> + <path id="LeaderC" class="C Leader" d="M 26
> 72 L 25 72 L 25 35 L 65 35 L 65 42 L 78 42" />
> + <text id="LabelC" class="C Label" x="80"
> y="42" style="text-anchor:start;" >C</text>
> + </g>
> + <g>
> + <rect id="ButtonD" class="D Button" x="28"
> y="90"
> + rx=".5"
> ry=".5" width="23" height="11" />
> + <path id="LeaderD" class="D Leader" d="M 53
> 96 L 65 96 L 65 102 L 78 102" />
> + <text id="LabelD" class="D Label" x="80"
> y="102" style="text-anchor:start;" >D</text>
> + </g>
> + <g>
> + <rect id="ButtonE" class="E Button" x="352"
> y="54"
> + rx=".5"
> ry=".5" width="11" height="17" />
> + <path id="LeaderE" class="E Leader" d="M 350
> 63 L 338 63 L 338 72 L 324 72" />
> + <text id="LabelE" class="E Label" x="322"
> y="72" style="text-anchor:end;" >E</text>
> + </g>
> + <g>
> + <rect id="ButtonF" class="F Button" x="352"
> y="72"
> + rx=".5"
> ry=".5" width="11" height="17" />
> + <circle id="DotF1" cx="357.5"
> cy="77.5" r=".5" />
> + <circle id="DotF2" cx="357.5"
> cy="80.5" r=".5" />
> + <circle id="DotF3" cx="357.5"
> cy="83.5" r=".5" />
> + <path id="LeaderF" class="F Leader" d="M 350
> 81 L 338 81 L 338 87 L 324 87" />
> + <text id="LabelF" class="F Label" x="322"
> y="87" style="text-anchor:end;" >F</text>
> + </g>
> + <g>
> + <rect id="ButtonG" class="G Button" x="364"
> y="54"
> + rx=".5"
> ry=".5" width="11" height="35" />
> + <path id="LeaderG" class="G Leader" d="M 377
> 72 L 378 72 L 378 35 L 338 35 L 338 42 L 324 42" />
> + <text id="LabelG" class="G Label" x="322"
> y="42" style="text-anchor:end;" >G</text>
> + </g>
> + <g>
> + <rect id="ButtonH" class="H Button" x="352"
> y="90"
> + rx=".5"
> ry=".5" width="23" height="11" />
> + <path id="LeaderH" class="H Leader" d="M 350
> 96 L 338 96 L 338 102 L 324 102" />
> + <text id="LabelH" class="H Label" x="322"
> y="102" style="text-anchor:end;" >H</text>
> + </g>
> + <g>
> + <rect id="ButtonI" class="I Button" x="28"
> y="42"
> + rx=".5"
> ry=".5" width="23" height="11" />
> + <circle id="DotI1" cx="36.5"
> cy="47.5" r=".5" />
> + <circle id="DotI2" cx="39.5"
> cy="47.5" r=".5" />
> + <circle id="DotI3" cx="42.5"
> cy="47.5" r=".5" />
> + <path id="LeaderI" class="I Leader" d="M 53
> 48 L 65 48 L 65 57 L 78 57" />
> + <text id="LabelI" class="I Label" x="80"
> y="57" style="text-anchor:start;" >I</text>
> + </g>
> + <g>
> + <rect id="ButtonJ" class="J Button" x="352"
> y="42"
> + rx=".5"
> ry=".5" width="23" height="11" />
> + <circle id="DotJ1" cx="360.5"
> cy="47.5" r=".5" />
> + <circle id="DotJ2" cx="363.5"
> cy="47.5" r=".5" />
> + <circle id="DotJ3" cx="366.5"
> cy="47.5" r=".5" />
> + <path id="LeaderJ" class="J Leader" d="M 350
> 48 L 338 48 L 338 57 L 324 57" />
> + <text id="LabelJ" class="J Label" x="322"
> y="57" style="text-anchor:end;" >J</text>
> + </g>
> + <g>
> + <rect id="Strip" class="Strip TouchStrip" x="10"
> y="41"
> + rx="1"
> ry="1" width="12" height="60" />
> + <path id="LeaderStripUp" class="StripUp Strip Leader" d="M 16
> 39 L 16 27 L 78 27" />
> + <text id="LabelStripUp" class="StripUp Strip Label" x="80"
> y="27" style="text-anchor:start;" >Up</text>
> + <path id="LeaderStripDown" class="StripDown Strip Leader" d="M 16
> 103 L 16 117 L 78 117" />
> + <text id="LabelStripDown" class="StripDown Strip Label" x="80"
> y="117" style="text-anchor:start;" >Down</text>
> + </g>
> + <g>
> + <rect id="Strip2" class="Strip2 TouchStrip" x="382"
> y="41"
> + rx="1"
> ry="1" width="12" height="60" />
> + <path id="LeaderStrip2Up" class="Strip2Up Strip2 Leader" d="M 388
> 39 L 388 27 L 325 27" />
> + <text id="LabelStrip2Up" class="Strip2Up Strip2 Label" x="322"
> y="27" style="text-anchor:end;" >Up</text>
> + <path id="LeaderStrip2Down" class="Strip2Down Strip2 Leader" d="M 388
> 103 L 388 117 L 325 117" />
> + <text id="LabelStrip2Down" class="Strip2Down Strip2 Label" x="322"
> y="117" style="text-anchor:end;" >Down</text>
> + </g>
> </svg>
> diff --git a/data/layouts/intuos5-m.svg b/data/layouts/intuos5-m.svg
> index 748959f..edb9f42 100644
> --- a/data/layouts/intuos5-m.svg
> +++ b/data/layouts/intuos5-m.svg
> @@ -2,28 +2,67 @@
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
> "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
> <svg xmlns="http://www.w3.org/2000/svg" version="1.1"
> -
> style="color:#000000;stroke:#bebebe;fill:#f0f0f0;stroke-linejoin:round;stroke-width:1;font-size:8"
> - id="intuos5-m"
> width="380" height="250">
> - <title id="title"
> >Wacom Intuos5 M Touch</title>
> - <rect id="ButtonB" class="B Button" x="24" y="40"
> width="20" height="12" />
> - <text id="LabelB" class="B Label" x="50" y="46"
> >A</text>
> - <rect id="ButtonC" class="C Button" x="24" y="54"
> width="20" height="12" />
> - <text id="LabelC" class="C Label" x="50" y="60"
> >B</text>
> - <rect id="ButtonD" class="D Button" x="24" y="68"
> width="20" height="12" />
> - <text id="LabelD" class="D Label" x="50" y="74"
> >C</text>
> - <rect id="ButtonE" class="E Button" x="24" y="82"
> width="20" height="12" />
> - <text id="LabelE" class="E Label" x="50" y="88"
> >D</text>
> - <rect id="ButtonF" class="F Button" x="24" y="156"
> width="20" height="12" />
> - <text id="LabelF" class="F Label" x="50" y="162"
> >E</text>
> - <rect id="ButtonG" class="G Button" x="24" y="170"
> width="20" height="12" />
> - <text id="LabelG" class="G Label" x="50" y="176"
> >F</text>
> - <rect id="ButtonH" class="H Button" x="24" y="184"
> width="20" height="12" />
> - <text id="LabelH" class="H Label" x="50" y="190"
> >G</text>
> - <rect id="ButtonI" class="I Button" x="24" y="198"
> width="20" height="12" />
> - <text id="LabelI" class="I Label" x="50" y="206"
> >H</text>
> - <circle id="Ring" class="Ring TouchRing" cx="34" cy="125"
> r="19.5" />
> - <text id="LabelRingUp" class="RingUp Ring Label" x="60" y="105"
> >Up</text>
> - <text id="LabelRingDown" class="RingDown Ring Label" x="60" y="145"
> >Down</text>
> - <circle id="ButtonA" class="A ModeSwitch Button" cx="34" cy="125"
> r="9.5" />
> - <text id="LabelA" class="A ModeSwitch Label" x="60" y="125"
> >I</text>
> +
> style="color:#000000;stroke:#7f7f7f;fill:none;stroke-width:.25;font-size:8"
> + id="intuos5-m"
> width="380" height="250" >
> + <title id="title"
> >Wacom Intuos5 M Touch</title>
> + <g>
> + <rect id="ButtonB" class="B Button" rx="2" ry="2" x="24"
> y="40" width="20" height="12" />
> + <path id="LeaderB" class="B Leader" d="M 46 46 L
> 50 46" />
> + <text id="LabelB" class="B Label" x="52"
> y="46" style="text-anchor:start;" >B</text>
> + </g>
> + <g>
> + <rect id="ButtonC" class="C Button" rx="2" ry="2" x="24"
> y="54" width="20" height="12" />
> + <rect id="DotC1" rx="1" ry="1" x="30"
> y="59.5" width="8" height="1" />
> + <path id="LeaderC" class="C Leader" d="M 46 60 L
> 50 60" />
> + <text id="LabelC" class="C Label" x="52"
> y="60" style="text-anchor:start;" >C</text>
> + </g>
> + <g>
> + <rect id="ButtonD" class="D Button" rx="2" ry="2" x="24"
> y="68" width="20" height="12" />
> + <circle id="DotD1" cx="34"
> cy="74" r=".75" />
> + <path id="LeaderD" class="D Leader" d="M 46 74 L
> 50 74" />
> + <text id="LabelD" class="D Label" x="52"
> y="74" style="text-anchor:start;" >D</text>
> + </g>
> + <g>
> + <rect id="ButtonE" class="E Button" rx="2" ry="2" x="24"
> y="82" width="20" height="12" />
> + <path id="LeaderE" class="E Leader" d="M 46 88 L
> 50 88" />
> + <text id="LabelE" class="E Label" x="52"
> y="88" style="text-anchor:start;" >E</text>
> + </g>
> + <g>
> + <rect id="ButtonF" class="F Button" rx="2" ry="2" x="24"
> y="156" width="20" height="12" />
> + <path id="LeaderF" class="F Leader" d="M 46 162
> L 50 162" />
> + <text id="LabelF" class="F Label" x="52"
> y="162" style="text-anchor:start;" >F</text>
> + </g>
> + <g>
> + <rect id="ButtonG" class="G Button" rx="2" ry="2" x="24"
> y="170" width="20" height="12" />
> + <circle id="DotG1" cx="34"
> cy="176" r=".75" />
> + <path id="LeaderG" class="G Leader" d="M 46 176
> L 50 176" />
> + <text id="LabelG" class="G Label" x="52"
> y="176" style="text-anchor:start;" >G</text>
> + </g>
> + <g>
> + <rect id="ButtonH" class="H Button" rx="2" ry="2" x="24"
> y="184" width="20" height="12" />
> + <rect id="DotH1" rx="1" ry="1" x="30"
> y="189.5" width="8" height="1" />
> + <path id="LeaderH" class="H Leader" d="M 46 190
> L 50 190" />
> + <text id="LabelH" class="H Label" x="52"
> y="190" style="text-anchor:start;" >H</text>
> + </g>
> + <g>
> + <rect id="ButtonI" class="I Button" rx="2" ry="2" x="24"
> y="198" width="20" height="12" />
> + <path id="LeaderI" class="I Leader" d="M 46 206
> L 50 206" />
> + <text id="LabelI" class="I Label" x="52"
> y="206" style="text-anchor:start;" >I</text>
> + </g>
> + <g>
> + <circle id="Ring" class="Ring TouchRing" cx="34"
> cy="125" r="19.5" />
> + <path id="LeaderRingCCW" class="RingCCW Ring Leader" d="M 34 105
> L 34 103 L 60 103" />
> + <text id="LabelRingCCW" class="RingCCW Ring Label" x="62"
> y="103" style="text-anchor:start;" >CCW</text>
> + <path id="RingCCW" class="RingCCW Button"
> + d="M 31 111 l 3 -1.5 l 0 1 a 7.5 7.5 0 0 1 5 1.5 a
> 6.5 6.5 0 0 0 -5 -0.5 l 0 1 z" />
> + <path id="LeaderRingCW" class="RingCW Ring Leader" d="M 34 145
> L 34 147 L 60 147" />
> + <text id="LabelRingCW" class="RingCW Ring Label" x="62"
> y="147" style="text-anchor:start;" >CW</text>
> + <path id="RingCW" class="RingCW Button"
> + d="M 31 139 l 3 -1.5 l 0 1 a 7.5 7.5 0 0 0 5 -1
> a 6.5 6.5 0 0 1 -5 2 l 0 1 z" />
> + </g>
> + <g>
> + <circle id="ButtonA" class="A ModeSwitch Button" cx="34"
> cy="125" r="9.5" />
> + <path id="LeaderA" class="A ModeSwitch Leader" d="M 56 125
> L 60 125" />
> + <text id="LabelA" class="A ModeSwitch Label" x="62"
> y="125" style="text-anchor:start;" >A</text>
> + </g>
> </svg>
> diff --git a/test/tablet-svg-validity.c b/test/tablet-svg-validity.c
> index 0dca5a4..04cbc0f 100644
> --- a/test/tablet-svg-validity.c
> +++ b/test/tablet-svg-validity.c
> @@ -1,5 +1,5 @@
> /*
> - * Copyright ?? 2012 Red Hat, Inc.
> + * Copyright ?? 2012 Red Hat, Inc.
> *
> * Permission to use, copy, modify, distribute, and sell this software
> * and its documentation for any purpose is hereby granted without
> @@ -127,7 +127,7 @@ check_button (xmlNodePtr cur, WacomDevice *device, char
> button, gchar *type)
> }
>
> static void
> -check_touch (xmlNodePtr cur, gchar *id, gchar *type)
> +check_touchstrip (xmlNodePtr cur, gchar *id, gchar *type)
> {
> char *sub;
> char *class;
> @@ -157,6 +157,76 @@ check_touch (xmlNodePtr cur, gchar *id, gchar *type)
> class = g_strdup_printf ("%sDown %s Label", id, id);
> verify_has_class (node, class);
> g_free (class);
> +
> + sub = g_strdup_printf ("Leader%sUp", id);
> + node = verify_has_sub (cur, sub);
> + g_assert (node != NULL);
> + g_free (sub);
> +
> + class = g_strdup_printf ("%sUp %s Leader", id, id);
> + verify_has_class (node, class);
> + g_free (class);
> +
> + sub = g_strdup_printf ("Leader%sDown", id);
> + node = verify_has_sub (cur, sub);
> + g_assert (node != NULL);
> + g_free (sub);
> +
> + class = g_strdup_printf ("%sDown %s Leader", id, id);
> + verify_has_class (node, class);
> + g_free (class);
> +}
> +
> +
> +static void
> +check_touchring (xmlNodePtr cur, gchar *id, gchar *type)
> +{
> + char *sub;
> + char *class;
> + xmlNodePtr node;
> +
> + node = verify_has_sub (cur, id);
> + g_assert (node != NULL);
> +
> + class = g_strdup_printf ("%s %s", id, type);
> + verify_has_class (node, class);
> + g_free (class);
> +
> + sub = g_strdup_printf ("Label%sCCW", id);
> + node = verify_has_sub (cur, sub);
> + g_assert (node != NULL);
> + g_free (sub);
> +
> + class = g_strdup_printf ("%sCCW %s Label", id, id);
> + verify_has_class (node, class);
> + g_free (class);
> +
> + sub = g_strdup_printf ("Label%sCW", id);
> + node = verify_has_sub (cur, sub);
> + g_assert (node != NULL);
> + g_free (sub);
> +
> + class = g_strdup_printf ("%sCW %s Label", id, id);
> + verify_has_class (node, class);
> + g_free (class);
> +
> + sub = g_strdup_printf ("Leader%sCCW", id);
> + node = verify_has_sub (cur, sub);
> + g_assert (node != NULL);
> + g_free (sub);
> +
> + class = g_strdup_printf ("%sCCW %s Leader", id, id);
> + verify_has_class (node, class);
> + g_free (class);
> +
> + sub = g_strdup_printf ("Leader%sCW", id);
> + node = verify_has_sub (cur, sub);
> + g_assert (node != NULL);
> + g_free (sub);
> +
> + class = g_strdup_printf ("%sCW %s Leader", id, id);
> + verify_has_class (node, class);
> + g_free (class);
> }
>
> static void
> @@ -203,18 +273,19 @@ verify_tablet_layout (WacomDeviceDatabase *db,
> WacomDevice *device)
> for (button = 'A'; button < 'A' + num_buttons; button++) {
> check_button (cur, device, button, "Button");
> check_button (cur, device, button, "Label");
> + check_button (cur, device, button, "Leader");
> }
>
> /* Touch rings */
> if (libwacom_has_ring(device))
> - check_touch (cur, "Ring", "TouchRing");
> + check_touchring (cur, "Ring", "TouchRing");
> if (libwacom_has_ring2(device))
> - check_touch (cur, "Ring2", "TouchRing");
> + check_touchring (cur, "Ring2", "TouchRing");
> /* Touch strips */
> if (libwacom_get_num_strips(device) > 0)
> - check_touch (cur, "Strip", "TouchStrip");
> + check_touchstrip (cur, "Strip", "TouchStrip");
> if (libwacom_get_num_strips(device) > 1)
> - check_touch (cur, "Strip2", "TouchStrip");
> + check_touchstrip (cur, "Strip2", "TouchStrip");
>
> xmlFreeDoc(doc);
>
> diff --git a/tools/show-svg-image.c b/tools/show-svg-image.c
> index 01a7b13..427b5ce 100644
> --- a/tools/show-svg-image.c
> +++ b/tools/show-svg-image.c
> @@ -1,5 +1,5 @@
> /*
> - * Copyright ?? 2012 Red Hat, Inc.
> + * Copyright ?? 2012 Red Hat, Inc.
> *
> * Permission to use, copy, modify, distribute, and sell this software
> * and its documentation for any purpose is hereby granted without
> @@ -37,10 +37,10 @@
> #include "libwacom.h"
>
>
> -#define INACTIVE_COLOR "#2d2d2d"
> -#define ACTIVE_COLOR "#ffffff"
> -#define STROKE_COLOR "#b4b4b4"
> -#define DARK_COLOR "#141414"
> +#define INACTIVE_COLOR "#ededed"
> +#define ACTIVE_COLOR "#729fcf"
> +#define STROKE_COLOR "#000000"
> +#define DARK_COLOR "#535353"
> #define BACK_COLOR "#000000"
>
> /* Convenient struct to store our stuff around */
> @@ -100,76 +100,96 @@ get_sub_location (cairo_t *cairo_context, RsvgHandle
> *handle, const char *sub, d
> }
>
> static void
> -print_button_labels (cairo_t *cairo_context, Tablet *tablet)
> +print_label (cairo_t *cairo_context, Tablet *tablet, const char *sub, const
> char *markup, WacomButtonFlags flags)
> {
> - char button;
> - GtkWidget *widget;
> - GtkAllocation allocation;
> + GtkWidget *widget;
> + GtkAllocation allocation;
> + GtkStyle *style;
> + PangoContext *pango_context;
> + PangoLayout *pango_layout;
> + PangoRectangle pango_rect;
> + double label_x, label_y;
> + int x, y;
> +
> + if (!get_sub_location (cairo_context, tablet->handle, sub, &label_x,
> &label_y, NULL, NULL))
> + return;
>
> widget = GTK_WIDGET(tablet->widget);
> gtk_widget_get_allocation(widget, &allocation);
> + style = gtk_widget_get_style (widget);
> + pango_context = gtk_widget_get_pango_context (widget);
> + pango_layout = pango_layout_new (pango_context);
> +
> + pango_layout_set_markup (pango_layout, markup, -1);
> + pango_layout_get_pixel_extents (pango_layout, NULL, &pango_rect);
> +
> + if (flags & WACOM_BUTTON_POSITION_LEFT) {
> + pango_layout_set_alignment (pango_layout, PANGO_ALIGN_LEFT);
> + x = (int) label_x + pango_rect.x;
> + y = (int) label_y + pango_rect.y - pango_rect.height / 2;
> + } else if (flags & WACOM_BUTTON_POSITION_RIGHT) {
> + pango_layout_set_alignment (pango_layout, PANGO_ALIGN_RIGHT);
> + x = (int) label_x + pango_rect.x - pango_rect.width;
> + y = (int) label_y + pango_rect.y - pango_rect.height / 2;
> + } else {
> + pango_layout_set_alignment (pango_layout, PANGO_ALIGN_CENTER);
> + x = (int) label_x + pango_rect.x - pango_rect.width / 2;
> + y = (int) label_y + pango_rect.y;
> + }
> +
> + gtk_paint_layout (style,
> + gtk_widget_get_window (widget),
> + 0,
> + TRUE,
> + &allocation,
> + widget,
> + NULL,
> + x,
> + y,
> + pango_layout);
> +
> + g_object_unref (pango_layout);
> +}
> +
> +static void
> +print_button_labels (cairo_t *cairo_context, Tablet *tablet)
> +{
> + char button;
>
> for (button = 'A'; button < 'A' + tablet->num_buttons; button++) {
> WacomButtonFlags flags;
> - GtkStyle *style;
> - PangoContext *pango_context;
> - PangoLayout *pango_layout;
> - PangoRectangle pango_rect;
> - double label_x, label_y;
> - int x, y;
> gchar *sub;
> - gchar *markup;
> + gchar *label;
>
> flags = libwacom_get_button_flag(tablet->device, button);
> sub = g_strdup_printf ("#Label%c", button);
> - if (!get_sub_location (cairo_context, tablet->handle, sub,
> &label_x, &label_y, NULL, NULL)) {
> - g_warning ("Failed to retrieve %s position", sub);
> - goto next;
> - }
> -
> - /* Write the label */
> - style = gtk_widget_get_style (widget);
> - pango_context = gtk_widget_get_pango_context (widget);
> - pango_layout = pango_layout_new (pango_context);
> if (button == tablet->active_button)
> - markup = g_strdup_printf ("<span foreground=\""
> ACTIVE_COLOR "\" weight=\"bold\">Button %c</span>", button);
> + label = g_strdup_printf ("<span foreground=\""
> ACTIVE_COLOR "\" >Button %c</span>", button);
> else
> - markup = g_strdup_printf ("<span foreground=\""
> INACTIVE_COLOR "\" weight=\"bold\">Button %c</span>", button);
> - pango_layout_set_markup (pango_layout, markup, -1);
> - g_free (markup);
> -
> - pango_layout_get_pixel_extents (pango_layout, NULL,
> &pango_rect);
> -
> - if (flags & WACOM_BUTTON_POSITION_LEFT) {
> - pango_layout_set_alignment (pango_layout,
> PANGO_ALIGN_LEFT);
> - x = (int) label_x;
> - y = (int) label_y + pango_rect.height / 2;
> - } else if (flags & WACOM_BUTTON_POSITION_RIGHT) {
> - pango_layout_set_alignment (pango_layout,
> PANGO_ALIGN_RIGHT);
> - x = (int) label_x - pango_rect.width;
> - y = (int) label_y + pango_rect.height / 2;
> -
> - } else {
> - pango_layout_set_alignment (pango_layout,
> PANGO_ALIGN_CENTER);
> - x = (int) label_x - pango_rect.width / 2;
> - y = (int) label_y;
> - }
> -
> - gtk_paint_layout (style,
> - gtk_widget_get_window (widget),
> - 0,
> - TRUE,
> - &allocation,
> - widget,
> - NULL,
> - x,
> - y,
> - pango_layout);
> -
> - g_object_unref (pango_layout);
> -next:
> + label = g_strdup_printf ("<span foreground=\""
> INACTIVE_COLOR "\" >Button %c</span>", button);
> + print_label (cairo_context, tablet, sub, label, flags);
> + g_free (label);
> g_free (sub);
> }
> +
> + /* Touch rings */
> + if (libwacom_has_ring(tablet->device)) {
> + print_label (cairo_context, tablet, "#LabelRingCCW", "<span
> foreground=\"" INACTIVE_COLOR "\" >Ring Counter Clockwise</span>",
> WACOM_BUTTON_POSITION_LEFT);
> + print_label (cairo_context, tablet, "#LabelRingCW", "<span
> foreground=\"" INACTIVE_COLOR "\" >Ring Clockwise</span>",
> WACOM_BUTTON_POSITION_LEFT);
> + }
> + if (libwacom_has_ring2(tablet->device)) {
> + print_label (cairo_context, tablet, "#LabelRing2CCW", "<span
> foreground=\"" INACTIVE_COLOR "\" >2nd Ring Counter Clockwise</span>",
> WACOM_BUTTON_POSITION_RIGHT);
> + print_label (cairo_context, tablet, "#LabelRing2CW", "<span
> foreground=\"" INACTIVE_COLOR "\" >2nd Ring Clockwise</span>",
> WACOM_BUTTON_POSITION_RIGHT);
> + }
> + /* Touch strips */
> + if (libwacom_get_num_strips(tablet->device) > 0) {
> + print_label (cairo_context, tablet, "#LabelStripUp", "<span
> foreground=\"" INACTIVE_COLOR "\" >Strip Up</span>",
> WACOM_BUTTON_POSITION_LEFT);
> + print_label (cairo_context, tablet, "#LabelStripDown", "<span
> foreground=\"" INACTIVE_COLOR "\" >Strip Down</span>",
> WACOM_BUTTON_POSITION_LEFT);
> + }
> + if (libwacom_get_num_strips(tablet->device) > 1) {
> + print_label (cairo_context, tablet, "#LabelStrip2Up", "<span
> foreground=\"" INACTIVE_COLOR "\" >2nd Strip Up</span>",
> WACOM_BUTTON_POSITION_RIGHT);
> + print_label (cairo_context, tablet, "#LabelStrip2Down", "<span
> foreground=\"" INACTIVE_COLOR "\" >2nd Strip Down</span>",
> WACOM_BUTTON_POSITION_RIGHT);
> + }
> }
>
> static void
> @@ -192,10 +212,16 @@ update_tablet (Tablet *tablet)
> "
> xmlns:xi=\"http://www.w3.org/2001/XInclude\"\n"
> " width=\"", width, "\"\n"
> " height=\"", height, "\">\n"
> - " <style type=\"text/css\">\n"
> - " * {\n"
> - " stroke: ", STROKE_COLOR," !important;\n"
> - " fill: ", INACTIVE_COLOR," !important;\n"
> + " <style type=\"text/css\">\n",
> + " .Leader {\n"
> + " stroke-width: .5 !important;\n"
> + " stroke: ", INACTIVE_COLOR, ";\n"
> + " fill: none !important;\n"
> + " }\n",
> + " .Button {\n"
> + " stroke-width: 0.25;\n"
> + " stroke: ", INACTIVE_COLOR, ";\n"
> + " fill: ", INACTIVE_COLOR, ";\n"
> " }\n",
> NULL);
> g_free (width);
> @@ -206,25 +232,31 @@ update_tablet (Tablet *tablet)
> if (button == tablet->active_button) {
> data = g_strconcat (data,
> " .", class, " {\n"
> - " stroke: ", STROKE_COLOR,"
> !important;\n"
> - " fill: ", button ==
> tablet->active_button ? ACTIVE_COLOR : INACTIVE_COLOR, " !important;\n"
> + " stroke: ", ACTIVE_COLOR, "
> !important;\n"
> + " fill: ", ACTIVE_COLOR, "
> !important;\n"
> " }\n",
> NULL);
> }
> }
>
> - /* Hide the existing labels */
> data = g_strconcat (data,
> + " .Leader {\n"
> + " fill: none !important;\n"
> + " }\n",
> " .Label {\n"
> - " stroke: none !important;\n"
> - " fill: ", BACK_COLOR, " !important;\n"
> + " stroke: none !important;\n"
> + " stroke-width: 0.1 !important;\n"
> + " opacity: .0 !important;\n"
> + " font-size: .1 !important;\n"
> + " fill: ", BACK_COLOR, " !important;\n"
> " }\n",
> " .TouchStrip,.TouchRing {\n"
> + " stroke-width: 0.1 !important;\n"
> " stroke: ", INACTIVE_COLOR," !important;\n"
> - " fill: ", DARK_COLOR, " !important;\n"
> + " fill: ", DARK_COLOR, " !important;\n"
> " }\n",
> " </style>\n"
> - " <xi:include href=\"",
> libwacom_get_layout_filename (tablet->device), "\"/>\n"
> + " <xi:include href=\"",
> libwacom_get_layout_filename (tablet->device), "\"/>\n"
> "</svg>",
> NULL);
>
> @@ -371,7 +403,7 @@ main (int argc, char **argv)
>
> g_signal_connect (tablet->widget, "expose-event",
> G_CALLBACK(on_expose_cb), tablet);
> g_signal_connect (tablet->widget, "delete-event",
> G_CALLBACK(on_delete_cb), tablet);
> - tablet->timeout = g_timeout_add(500 /* ms */, (GSourceFunc)
> on_timer_cb, tablet);
> + tablet->timeout = g_timeout_add(750 /* ms */, (GSourceFunc)
> on_timer_cb, tablet);
>
> gtk_widget_show (tablet->widget);
>
> --
> 1.8.0
>
------------------------------------------------------------------------------
Keep yourself connected to Go Parallel:
TUNE You got it built. Now make it sing. Tune shows you how.
http://goparallel.sourceforge.net
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel