From 84a27086bbd9f493128b354300f9c77ccb32a56b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 18 Apr 2015 15:42:59 +0200 Subject: Imported Upstream version 0.6.0 --- AUTHORS | 2 + resources/gnome-pie-symbolic.svg | 94 +- resources/gnome-pie.svg | 4486 ++++++++++++--------------- resources/locale/de/LC_MESSAGES/de.po | 459 +-- resources/locale/de/LC_MESSAGES/gnomepie.mo | Bin 8658 -> 9902 bytes resources/locale/es/LC_MESSAGES/es.po | 489 +-- resources/locale/es/LC_MESSAGES/gnomepie.mo | Bin 8741 -> 10153 bytes resources/locale/gnomepie.pot | 478 +-- resources/themes/adwaita/arrow.svg | 28 +- resources/themes/adwaita/arrow_bg.svg | 129 + resources/themes/adwaita/icon.svg | 245 ++ resources/themes/adwaita/icon_active.svg | 152 - resources/themes/adwaita/icon_highlight.svg | 248 ++ resources/themes/adwaita/icon_inactive.svg | 152 - resources/themes/adwaita/preview.png | Bin 1412 -> 1397 bytes resources/themes/adwaita/ring.svg | 69 +- resources/themes/adwaita/theme.xml | 24 +- resources/themes/bright/gloss.svg | 198 +- resources/themes/bright/preview.png | Bin 2543 -> 1003 bytes resources/themes/elementary/arrow.svg | 146 + resources/themes/elementary/preview.png | Bin 1410 -> 1448 bytes resources/themes/elementary/ring.svg | 56 +- resources/themes/elementary/theme.xml | 17 +- resources/themes/simple/preview.png | Bin 0 -> 2336 bytes resources/themes/simple/slice_caption.svg | 130 + resources/themes/simple/theme.xml | 20 + resources/themes/unity/gloss.svg | 198 +- resources/themes/unity/preview.png | Bin 2933 -> 1185 bytes resources/themes/unity/ring.svg | 28 +- resources/themes/unity/theme.xml | 2 +- resources/ui/settings.ui | 74 +- resources/ui/shapes/shape1.svg | 128 + resources/ui/shapes/shape2.svg | 146 + resources/ui/shapes/shape3.svg | 128 + resources/ui/shapes/shape4.svg | 145 + resources/ui/shapes/shape5.svg | 176 ++ resources/ui/shapes/shape6.svg | 145 + resources/ui/shapes/shape7.svg | 127 + resources/ui/shapes/shape8.svg | 145 + resources/ui/shapes/shape9.svg | 127 + resources/ui/trigger_select.ui | 279 ++ src/CMakeLists.txt | 72 +- src/actionGroups/actionGroup.vala | 68 +- src/actionGroups/bookmarkGroup.vala | 80 +- src/actionGroups/clipboardGroup.vala | 80 +- src/actionGroups/devicesGroup.vala | 72 +- src/actionGroups/groupRegistry.vala | 68 +- src/actionGroups/menuGroup.vala | 148 +- src/actionGroups/sessionGroup.vala | 70 +- src/actionGroups/windowListGroup.vala | 100 +- src/actions/action.vala | 52 +- src/actions/actionRegistry.vala | 132 +- src/actions/appAction.vala | 46 +- src/actions/keyAction.vala | 52 +- src/actions/pieAction.vala | 54 +- src/actions/sigAction.vala | 44 +- src/actions/uriAction.vala | 56 +- src/deamon.vala | 40 +- src/gui/aboutWindow.vala | 72 +- src/gui/iconSelectWindow.vala | 32 +- src/gui/indicator.vala | 32 +- src/gui/newSliceWindow.vala | 32 +- src/gui/newsWindow.vala | 32 +- src/gui/pieComboList.vala | 92 +- src/gui/pieList.vala | 144 +- src/gui/piePreview.vala | 32 +- src/gui/piePreviewAddSign.vala | 140 +- src/gui/piePreviewCenter.vala | 32 +- src/gui/piePreviewDeleteSign.vala | 110 +- src/gui/piePreviewRenderer.vala | 32 +- src/gui/piePreviewSliceRenderer.vala | 158 +- src/gui/preferencesWindow.vala | 32 +- src/gui/renameWindow.vala | 78 +- src/gui/settingsWindow.vala | 42 +- src/gui/sliceTypeList.vala | 106 +- src/gui/themeList.vala | 68 +- src/gui/triggerSelectButton.vala | 97 +- src/gui/triggerSelectWindow.vala | 98 +- src/images/icon.vala | 82 +- src/images/image.vala | 38 +- src/images/renderedText.vala | 118 +- src/images/themedIcon.vala | 82 +- src/pies/defaultConfig.vala | 48 +- src/pies/load.vala | 82 +- src/pies/pie.vala | 86 +- src/pies/pieManager.vala | 194 +- src/pies/save.vala | 50 +- src/renderers/centerRenderer.vala | 214 +- src/renderers/pieRenderer.vala | 768 ++++- src/renderers/pieWindow.vala | 216 +- src/renderers/sliceRenderer.vala | 68 +- src/themes/centerLayer.vala | 74 +- src/themes/sliceLayer.vala | 64 +- src/themes/theme.vala | 139 +- src/utilities/animatedValue.vala | 116 +- src/utilities/bindingManager.vala | 153 +- src/utilities/color.vala | 100 +- src/utilities/config.vala | 48 +- src/utilities/focusGrabber.vala | 32 +- src/utilities/key.vala | 78 +- src/utilities/logger.vala | 290 +- src/utilities/paths.vala | 32 +- src/utilities/trigger.vala | 302 +- update_copy_notice.sh | 51 + 104 files changed, 9432 insertions(+), 6258 deletions(-) create mode 100644 resources/themes/adwaita/arrow_bg.svg create mode 100644 resources/themes/adwaita/icon.svg delete mode 100644 resources/themes/adwaita/icon_active.svg create mode 100644 resources/themes/adwaita/icon_highlight.svg delete mode 100644 resources/themes/adwaita/icon_inactive.svg create mode 100644 resources/themes/elementary/arrow.svg create mode 100644 resources/themes/simple/preview.png create mode 100644 resources/themes/simple/slice_caption.svg create mode 100644 resources/themes/simple/theme.xml create mode 100644 resources/ui/shapes/shape1.svg create mode 100644 resources/ui/shapes/shape2.svg create mode 100644 resources/ui/shapes/shape3.svg create mode 100644 resources/ui/shapes/shape4.svg create mode 100644 resources/ui/shapes/shape5.svg create mode 100644 resources/ui/shapes/shape6.svg create mode 100644 resources/ui/shapes/shape7.svg create mode 100644 resources/ui/shapes/shape8.svg create mode 100644 resources/ui/shapes/shape9.svg mode change 100644 => 100755 src/renderers/pieWindow.vala create mode 100755 update_copy_notice.sh diff --git a/AUTHORS b/AUTHORS index b31cf9f..a3795ba 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,6 +1,7 @@ Code: Simon Schneegans +Gabriel Dubatti Francesco Piccinno Translations: @@ -14,3 +15,4 @@ Alex Maxime Eugene Roskin Ting Zhou Martin Dinov +Gabriel Dubatti diff --git a/resources/gnome-pie-symbolic.svg b/resources/gnome-pie-symbolic.svg index 63a662f..724ce61 100644 --- a/resources/gnome-pie-symbolic.svg +++ b/resources/gnome-pie-symbolic.svg @@ -14,7 +14,7 @@ width="16" height="16" id="svg2408" - inkscape:version="0.48.2 r9819" + inkscape:version="0.48.4 r9939" sodipodi:docname="gnome-pie-symbolic.svg"> + inkscape:current-layer="svg2408" + showguides="true" + inkscape:guide-bbox="true" + inkscape:snap-center="true" + inkscape:snap-object-midpoints="true"> + + + - - + + + + + + diff --git a/resources/gnome-pie.svg b/resources/gnome-pie.svg index c001a21..99573c3 100644 --- a/resources/gnome-pie.svg +++ b/resources/gnome-pie.svg @@ -10,2887 +10,2315 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="256" - height="256" - id="svg2" - version="1.1" - inkscape:version="0.48.1 r9760" + version="1.0" + width="64" + height="64" + id="svg2408" + inkscape:version="0.48.4 r9939" sodipodi:docname="gnome-pie.svg"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + id="linearGradient4225"> + + + + id="linearGradient3858"> + style="stop-color:#ffffff;stop-opacity:1" + id="stop3860" /> + style="stop-color:#aaaaaa;stop-opacity:1" + id="stop3862" /> - - - - - + id="linearGradient3637"> + + + - + gradientTransform="scale(1.0058652,0.994169)"> + id="stop3750" + style="stop-color:#000000;stop-opacity:1" + offset="0" /> + id="stop3752" + style="stop-color:#000000;stop-opacity:0.58823532" + offset="1" /> + id="linearGradient3737"> + id="stop3739" + style="stop-color:#ffffff;stop-opacity:1" + offset="0" /> + id="stop3741" + style="stop-color:#ffffff;stop-opacity:0" + offset="1" /> + id="linearGradient3700"> + id="stop3702" + style="stop-color:#2276c5;stop-opacity:1" + offset="0" /> + id="stop3704" + style="stop-color:#68baf4;stop-opacity:1" + offset="1" /> + + + + + + + + y2="138.66119" + id="linearGradient3613" + xlink:href="#linearGradient3737" + gradientUnits="userSpaceOnUse" /> + + id="clipPath3613"> + rx="6" + ry="6" + x="6" + y="6" + id="rect3615" + style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /> - - - - - + + + + + x2="44.512066" + y2="90.015434" + id="linearGradient3643" + xlink:href="#linearGradient3637" + gradientUnits="userSpaceOnUse" /> + + + + color-interpolation-filters="sRGB" + id="filter3657"> + id="feGaussianBlur3659" + stdDeviation="1.14" /> - - - - - - - - + x2="45.447727" + y2="7.0165396" + id="ButtonShadow-0" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(1.0058652,0,0,0.994169,100,0)"> + offset="0" /> - - - - - - - - - - - - - - - - - - - - - - - - + offset="1" /> - - + gradientTransform="matrix(1.0238095,0,0,-1.0119048,-1.1428571,98.071429)" /> - + - + - + y2="90.238609" + id="linearGradient3721" + xlink:href="#ButtonShadow-0" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(1,0,0,-1,0,97)" /> + - + + + + + - + gradientTransform="matrix(1.1573129,0,0,0.99590774,-14.868094,-6.095551)" /> + gradientTransform="translate(-104,104)" /> + gradientTransform="translate(-144,104)" /> + id="linearGradient3183-0"> + + + + gradientTransform="matrix(3.25,0,0,3.25,12.25,12.25)" /> + gradientTransform="translate(-144,104)" + x1="104" + y1="8" + x2="120" + y2="8" /> + gradientTransform="translate(-104,104)" + x1="104" + y1="8" + x2="120" + y2="8" /> + gradientTransform="matrix(5.2543554,0,0,5.2543554,-105.50523,-10.414634)" + x1="13" + y1="3" + x2="13" + y2="19" /> + gradientTransform="matrix(1.4967108,0,0,1.4967108,-2.4094778,0.11280244)" + x1="13" + y1="3" + x2="13" + y2="19" /> - + + xlink:href="#linearGradient3242-7-3-8-9-9-3" + id="radialGradient3034" + fy="8.5985041" + fx="8.894803" + r="19.99999" + cy="8.449769" + cx="18.164446" /> - + id="linearGradient3242-7-3-8-9-9-3"> + + + + + + xlink:href="#linearGradient3820-7-2-1" + id="radialGradient6873" + fy="186.17059" + fx="99.157013" + r="62.769119" + cy="186.17059" + cx="99.157013" /> + id="linearGradient3820-7-2-1"> + + + + + + + + + + + + id="XMLID_2_-8-6-1-4" + fy="-289.9133" + fx="297.44989" + r="17.1528" + cy="-290.5918" + cx="299.44821"> + + + + xlink:href="#XMLID_2_-8-6-1-4" + id="linearGradient6191-7-5" + y2="375.61926" + x2="-474.68497" + y1="539.40955" + x1="-1085.9586" /> + + + + + + + xlink:href="#linearGradient3242-7-3-8-9-9" + id="radialGradient3126-7-25-24" + fy="8.5985041" + fx="8.894803" + r="19.99999" + cy="8.449769" + cx="18.164446" /> + id="linearGradient4806-2"> + + + + + + xlink:href="#linearGradient4806-2" + id="linearGradient4338-5-6" + y2="40.495617" + x2="71.204407" + y1="15.369057" + x1="71.204407" /> - + gradientTransform="matrix(0.11840253,0,0,0.11840253,-3.9022919,10.149362)" + x1="71.204407" + y1="15.369057" + x2="71.204407" + y2="40.495617" /> - - - + gradientTransform="matrix(0.16701358,0,0,0.05403384,23.732254,50.093166)" + cx="99.157013" + cy="186.17059" + fx="99.157013" + fy="186.17059" + r="62.769119" /> - - + + xlink:href="#linearGradient3242-7-3-8-9-9-3" + id="radialGradient4085" + cx="4.6305943" + cy="11.979008" + fx="4.6305943" + fy="11.979008" + r="1.7095779" + gradientTransform="matrix(2.7860628,0,0,2.3360267,-8.3132888,-16.467814)" + gradientUnits="userSpaceOnUse" /> + id="linearGradient3957-2"> + + + + xlink:href="#linearGradient3957-2" + id="linearGradient3963-7" + y2="27.343702" + x2="22.805599" + y1="25.433903" + x1="21.013996" /> + xlink:href="#linearGradient3957" + id="linearGradient3963" + y2="26" + x2="24" + y1="22" + x1="24" /> - + + + xlink:href="#linearGradient2867-449-88-871-390-598-476-591-434-148-57-177-3-8" + id="radialGradient3015" + fy="8.4497671" + fx="3.9722471" + r="19.99999" + cy="8.4497671" + cx="3.9722471" /> + xlink:href="#linearGradient4011" + id="linearGradient3012" + y2="44.340794" + x2="71.204407" + y1="6.2375584" + x1="71.204407" /> + id="linearGradient3820-7-2-1-7"> + + + + + id="linearGradient2867-449-88-871-390-598-476-591-434-148-57-177-3-8"> + + + + + + id="linearGradient4011"> + + + + + + id="linearGradient3957"> + + + + + + + + + + gradientTransform="matrix(2.8367722,0,0,2.3785451,-8.502932,-16.813888)" + cx="4.6305943" + cy="11.979008" + fx="4.6305943" + fy="11.979008" + r="1.7095779" /> - + + gradientTransform="matrix(2.4584939,0,0,2.0613705,-6.9627376,-12.810133)" + cx="4.6754603" + cy="11.925498" + fx="4.6754603" + fy="11.925498" + r="1.7095779" /> - + + gradientTransform="matrix(3.5789237,0,0,1.9103653,-12.061867,-10.073052)" + cx="4.6305943" + cy="11.348989" + fx="4.6305943" + fy="11.348989" + r="1.7095779" /> + gradientTransform="matrix(0.06769692,0,0,0.06769692,-0.34357466,11.66806)" + x1="71.204407" + y1="15.369057" + x2="71.204407" + y2="40.495617" /> + + gradientTransform="matrix(0.09045592,0,0,0.09045592,-1.85142,10.998218)" + x1="71.204407" + y1="15.369057" + x2="71.204407" + y2="40.495617" /> + gradientTransform="matrix(2.5659794,0.13994291,-0.11733776,2.1514936,-6.0660038,-14.380471)" + cx="4.7574949" + cy="11.811036" + fx="4.7574949" + fy="11.811036" + r="1.7095779" /> + + gradientTransform="matrix(3.1062583,0,0,1.9723143,-9.9165629,-12.111694)" + cx="4.6305943" + cy="11.979008" + fx="4.6305943" + fy="11.979008" + r="1.7095779" /> + gradientTransform="matrix(0.12558785,0,0,0.12558785,-4.538099,10.065665)" + x1="71.204407" + y1="15.369057" + x2="71.204407" + y2="40.495617" /> + id="linearGradient3895" + xlink:href="#linearGradient5803" + inkscape:collect="always" /> + id="linearGradient3892" + xlink:href="#linearGradient5048" + inkscape:collect="always" /> + + + id="linearGradient3883" + xlink:href="#linearGradient3895-9-0-3-9" + inkscape:collect="always" /> + + + id="linearGradient3875" + xlink:href="#linearGradient3977" + inkscape:collect="always" /> + + + + + + + xlink:href="#linearGradient3977" + id="linearGradient3988" + y2="43" + x2="23.99999" + y1="5.5641499" + x1="23.99999" /> + + + + + xlink:href="#linearGradient4067-0-2" + id="radialGradient4232" + fy="8.4497671" + fx="7.4956832" + r="19.99999" + cy="8.4497671" + cx="7.4956832" /> + + + + + xlink:href="#linearGradient3895-9-0-3-9" + id="linearGradient4090-3" + y2="43.2943" + x2="13.990655" + y1="3.9626207" + x1="13.990655" /> + + + + + xlink:href="#linearGradient4644-104-3-3-6-2-0" + id="radialGradient4088-6" + fy="8.4497671" + fx="7.4956832" + r="19.99999" + cy="8.4497671" + cx="7.4956832" /> + + + + + xlink:href="#linearGradient5060" + id="radialGradient3327" + fy="486.64789" + fx="605.71429" + r="117.14286" + cy="486.64789" + cx="605.71429" /> + + + + + xlink:href="#linearGradient5060" + id="radialGradient3330" + fy="486.64789" + fx="605.71429" + r="117.14286" + cy="486.64789" + cx="605.71429" /> + + + + + + xlink:href="#linearGradient5048" + id="linearGradient4286" + y2="609.50507" + x2="302.85715" + y1="366.64789" + x1="302.85715" /> + xlink:href="#linearGradient3702-501-757" + id="linearGradient6647" + y2="39.999443" + x2="25.058096" + y1="47.027729" + x1="25.058096" /> + + + + + + + + + + xlink:href="#linearGradient3688-464-309" + id="radialGradient3015-3" + fy="43.5" + fx="4.9929786" + r="2.5" + cy="43.5" + cx="4.9929786" /> + + + + + xlink:href="#linearGradient3688-166-749" + id="radialGradient3013" + fy="43.5" + fx="4.9929786" + r="2.5" + cy="43.5" + cx="4.9929786" /> + + + + + + + xlink:href="#linearGradient4644-104-3-3-6-2-0" + id="radialGradient5521-1" + fy="9.9571075" + fx="6.2001843" + r="12.671875" + cy="9.9571075" + cx="6.7304144" /> + + + + + + + xlink:href="#linearGradient3924-1" + id="linearGradient3058" + y2="43" + x2="23.99999" + y1="4.999989" + x1="23.99999" /> + + + + + xlink:href="#linearGradient5803" + id="linearGradient5414" + y2="54.780239" + x2="167.98311" + y1="8.50811" + x1="167.98311" /> + + + + + + + xlink:href="#linearGradient3977-6" + id="linearGradient3254" + y2="43" + x2="23.99999" + y1="5.5641499" + x1="23.99999" /> + xlink:href="#linearGradient3878" + id="linearGradient3251" + y2="43" + x2="23.99999" + y1="7.3472824" + x1="23.99999" /> + + + + + + + + + + + + + + + + + + + + + + + + + - + xlink:href="#linearGradient3703" + id="linearGradient3920" + y2="34.999718" + x2="17.554192" + y1="46.000275" + x1="17.554192" /> + + + + + xlink:href="#linearGradient3681" + id="radialGradient3917" + fy="41.5" + fx="5" + r="5" + cy="41.5" + cx="5" /> + id="linearGradient3295"> + + + + + + xlink:href="#linearGradient3295" + id="linearGradient3408" + y2="45.04248" + x2="15.464298" + y1="7.9756851" + x1="15.464298" /> + id="linearGradient3199-5"> + + + + + + xlink:href="#linearGradient3199-5" + id="linearGradient3406" + y2="37.27668" + x2="24.996943" + y1="15.377745" + x1="24.822832" /> + id="linearGradient4559"> + + + + xlink:href="#linearGradient4559" + id="linearGradient3400" + y2="45.934479" + x2="43.00663" + y1="30.554907" + x1="23.451576" /> + id="linearGradient3827"> + style="stop-color:#ffffff;stop-opacity:1" + id="stop3829" /> + + + style="stop-color:#ffffff;stop-opacity:0.39130434" + id="stop3832" /> + x2="26" + y1="22" + x1="26" /> - + + + + + + + xlink:href="#linearGradient3977-6" + id="linearGradient3033" + y2="43" + x2="23.99999" + y1="5.5641499" + x1="23.99999" /> + id="linearGradient3878"> + id="stop3880" /> + + + style="stop-color:#ffffff;stop-opacity:0.39215687" + id="stop3886" /> + xlink:href="#linearGradient3878" + id="linearGradient3855" + y2="43" + x2="23.99999" + y1="7.3472824" + x1="23.99999" /> + xlink:href="#linearGradient3702-501-757-6-946" + id="linearGradient4469" + y2="39.999443" + x2="25.058096" + y1="47.027729" + x1="25.058096" /> + id="linearGradient3702-501-757-6-946"> + + + + + + + + + xlink:href="#linearGradient3688-464-309-8-331" + id="radialGradient3015-826" + fy="43.5" + fx="4.9929786" + r="2.5" + cy="43.5" + cx="4.9929786" /> + + + + + xlink:href="#linearGradient3688-166-749-2-324" + id="radialGradient3013-896" + fy="43.5" + fx="4.9929786" + r="2.5" + cy="43.5" + cx="4.9929786" /> + + + + + xlink:href="#linearGradient3856" + id="linearGradient3157" + y2="3.8990016" + x2="24" + y1="44" + x1="24" /> + + + + + + + xlink:href="#linearGradient3846" + id="radialGradient3155" + fy="8.4497671" + fx="19.740461" + r="19.99999" + cy="8.4497671" + cx="19.740461" /> + + style="stop-color:#f4f4f4;stop-opacity:1" + id="stop3602" /> + style="stop-color:#dbdbdb;stop-opacity:1" + id="stop3604" /> - - - - - - - - - + xlink:href="#linearGradient3600" + id="linearGradient3086" + y2="45.243549" + x2="20.052792" + y1="10.636821" + x1="20.052792" /> - - - - + + + + + + xlink:href="#linearGradient3866" + id="linearGradient3083" + y2="15.737678" + x2="25.525208" + y1="30.188753" + x1="25.525208" /> + + + + - - - + xlink:href="#linearGradient3333-4" + id="linearGradient3080" + y2="15.737678" + x2="25.525208" + y1="30.188753" + x1="25.525208" /> + + + + + - - - + xlink:href="#linearGradient3495" + id="linearGradient3077-6" + y2="20.443331" + x2="23.903786" + y1="35.75" + x1="23.903786" /> + id="linearGradient3333-4-4"> + style="stop-color:#ffffff;stop-opacity:1" + id="stop3335-4-6" /> + style="stop-color:#ffffff;stop-opacity:0" + id="stop3337-7-2" /> + spreadMethod="reflect" + gradientTransform="matrix(0.73482181,0,0,0.63395351,6.3644351,-0.2093677)" + gradientUnits="userSpaceOnUse" + xlink:href="#linearGradient3333-4-4" + id="linearGradient3074" + y2="15.737678" + x2="25.525208" + y1="30.188753" + x1="25.525208" /> + + id="stop2687-1-9" /> + id="stop2689-5-4" /> + xlink:href="#linearGradient8265-821-176-38-919-66-249-7-7" + id="linearGradient3071" + y2="24.627615" + x2="20.054544" + y1="15.298182" + x1="16.626165" /> + + style="stop-color:#ffffff;stop-opacity:1" + id="stop3252-06" /> + + + style="stop-color:#ffffff;stop-opacity:0.39215687" + id="stop3258-2" /> + gradientTransform="matrix(0.8378378,0,0,0.51351349,3.8918946,7.6756805)" + gradientUnits="userSpaceOnUse" + xlink:href="#linearGradient3924-803-0" + id="linearGradient3068" + y2="43" + x2="23.99999" + y1="4.999989" + x1="23.99999" /> + + style="stop-color:#ffeeb6;stop-opacity:1" + id="stop4028" /> + style="stop-color:#feeeb7;stop-opacity:1" + id="stop4030" /> + xlink:href="#linearGradient4026" + id="linearGradient4004-9" + y2="34.480747" + x2="19.567474" + y1="38.228374" + x1="19.567474" /> + + + + + xlink:href="#linearGradient3909-3" + id="linearGradient4004-8" + y2="6" + x2="15" + y1="32" + x1="15" /> + + + + + + + xlink:href="#linearGradient3924-803" + id="linearGradient3473" + y2="43" + x2="23.99999" + y1="4.999989" + x1="23.99999" /> + + + + + + + xlink:href="#linearGradient3924-803-9" + id="linearGradient3473-5" + y2="37.992332" + x2="23.99999" + y1="4.999989" + x1="23.99999" /> + + + + + + + + + + + - + id="metadata2413"> image/svg+xml - + + + id="layer2" + style="display:none" + transform="translate(0,-32)"> + + + + - + inkscape:export-ydpi="1637.5708" + inkscape:export-xdpi="1637.5708" + inkscape:export-filename="/home/simon/Desktop/gnome-pie-symbolic.png" + id="path3905" + d="M 5.5028447,11.959141 C 6.3223926,12.42765 6.6069654,13.471827 6.1384561,14.291375 5.6699468,15.110923 4.6257703,15.395496 3.8062225,14.926986 2.9866747,14.458477 2.7021019,13.4143 3.1706112,12.594752 3.6391205,11.775205 4.683297,11.490632 5.5028447,11.959141 z" + inkscape:transform-center-y="3.5807564" + inkscape:transform-center-x="2.0673504" + style="fill:url(#radialGradient4356);fill-opacity:1;stroke:none" /> + d="m 4.6436742,11.693036 c -0.9747596,0 -1.7666192,0.791858 -1.7666192,1.766618 0,0.97476 0.7918596,1.766618 1.7666192,1.766618 0.9747595,0 1.7666197,-0.791858 1.7666192,-1.766618 0,-0.97476 -0.7918597,-1.766618 -1.7666192,-1.766618 z" /> + d="m 6.0714204,13.448876 c 0,0.788594 -0.639283,1.427875 -1.4278751,1.427875 -0.788591,0 -1.4278833,-0.639281 -1.4278833,-1.427875 0,-0.788595 0.6392923,-1.427876 1.4278833,-1.427876 0.7885921,0 1.4278751,0.639281 1.4278751,1.427876 z" /> + + - - - - + id="path4300" + style="opacity:0.3;color:#000000;fill:none;stroke:#2b2200;stroke-width:0.30135387;stroke-miterlimit:4;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + sodipodi:nodetypes="sssss" /> - + id="path4302" + style="opacity:0.5;color:#000000;fill:none;stroke:url(#linearGradient4306);stroke-width:0.29724404;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + sodipodi:nodetypes="sssss" /> + + + inkscape:export-ydpi="1637.5708" + inkscape:export-xdpi="1637.5708" + inkscape:export-filename="/home/simon/Desktop/gnome-pie-symbolic.png" + id="path4310" + d="M 5.5028447,11.959141 C 6.3223926,12.42765 6.6069654,13.471827 6.1384561,14.291375 5.6699468,15.110923 4.6257703,15.395496 3.8062225,14.926986 2.9866747,14.458477 2.7021019,13.4143 3.1706112,12.594752 3.6391205,11.775205 4.683297,11.490632 5.5028447,11.959141 z" + inkscape:transform-center-y="-5.3725036" + inkscape:transform-center-x="2.8524709" + style="fill:url(#radialGradient4316);fill-opacity:1;stroke:none" /> - - + d="m 4.6436742,11.741854 c -0.9478233,0 -1.7178008,0.769976 -1.7178008,1.7178 0,0.947824 0.7699775,1.7178 1.7178008,1.7178 0.9478232,0 1.7178013,-0.769976 1.7178008,-1.7178 0,-0.947824 -0.7699776,-1.7178 -1.7178008,-1.7178 z" /> - - + d="m 6.103966,13.448876 c 0,0.806568 -0.6538542,1.46042 -1.4604207,1.46042 -0.8065654,0 -1.460429,-0.653852 -1.460429,-1.46042 0,-0.80657 0.6538636,-1.460422 1.460429,-1.460422 0.8065665,0 1.4604207,0.653852 1.4604207,1.460422 z" /> + + - + id="path4324" + style="opacity:0.3;color:#000000;fill:none;stroke:#2b2200;stroke-width:0.18809408;stroke-miterlimit:4;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + sodipodi:nodetypes="sssss" /> - - - + id="path4326" + style="opacity:0.5;color:#000000;fill:none;stroke:url(#linearGradient4330);stroke-width:0.18552889;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + sodipodi:nodetypes="sssss" /> + + + inkscape:export-ydpi="1637.5708" + inkscape:export-xdpi="1637.5708" + inkscape:export-filename="/home/simon/Desktop/gnome-pie-symbolic.png" + id="path4334" + d="M 5.5028447,11.959141 C 6.3223926,12.42765 6.6069654,13.471827 6.1384561,14.291375 5.6699468,15.110923 4.6257703,15.395496 3.8062225,14.926986 2.9866747,14.458477 2.7021019,13.4143 3.1706112,12.594752 3.6391205,11.775205 4.683297,11.490632 5.5028447,11.959141 z" + inkscape:transform-center-y="3.5807564" + inkscape:transform-center-x="2.0673504" + style="fill:url(#radialGradient4340);fill-opacity:1;stroke:none" /> + d="m 4.6436742,11.726799 c -0.9561303,0 -1.7328562,0.776724 -1.7328562,1.732855 0,0.956131 0.7767259,1.732855 1.7328562,1.732855 0.9561302,0 1.7328567,-0.776724 1.7328562,-1.732855 0,-0.956131 -0.776726,-1.732855 -1.7328562,-1.732855 z" /> + d="m 6.1220649,13.448876 c 0,0.816564 -0.6619574,1.478519 -1.4785196,1.478519 -0.816561,0 -1.478528,-0.661955 -1.478528,-1.478519 0,-0.816566 0.661967,-1.478521 1.478528,-1.478521 0.8165622,0 1.4785196,0.661955 1.4785196,1.478521 z" /> + + + style="fill:url(#radialGradient4352);fill-opacity:1;stroke:none" + inkscape:transform-center-x="2.0673504" + inkscape:transform-center-y="3.5807564" + d="M 5.5028447,11.959141 C 6.3223926,12.42765 6.6069654,13.471827 6.1384561,14.291375 5.6699468,15.110923 4.6257703,15.395496 3.8062225,14.926986 2.9866747,14.458477 2.7021019,13.4143 3.1706112,12.594752 3.6391205,11.775205 4.683297,11.490632 5.5028447,11.959141 z" + id="path4346" + inkscape:export-filename="/home/simon/Desktop/gnome-pie-symbolic.png" + inkscape:export-xdpi="1637.5708" + inkscape:export-ydpi="1637.5708" + inkscape:connector-curvature="0" /> + id="path4348" + style="opacity:0.3;color:#000000;fill:none;stroke:#2b2200;stroke-width:0.30344108;stroke-miterlimit:4;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + sodipodi:nodetypes="sssss" /> - - + id="path4350" + style="opacity:0.5;color:#000000;fill:none;stroke:url(#linearGradient4354);stroke-width:0.29930273;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + sodipodi:nodetypes="sssss" /> diff --git a/resources/locale/de/LC_MESSAGES/de.po b/resources/locale/de/LC_MESSAGES/de.po index 5012a3b..74e4175 100644 --- a/resources/locale/de/LC_MESSAGES/de.po +++ b/resources/locale/de/LC_MESSAGES/de.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: gnomepie 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-29 15:58+0100\n" +"POT-Creation-Date: 2015-04-07 08:55+0200\n" "PO-Revision-Date: 2011-08-25 21:04+0200\n" "Last-Translator: Simon Schneegans \n" "Language-Team: German\n" @@ -25,14 +25,6 @@ msgstr "Tastenkombination" msgid "Simulates the activation of a hotkey." msgstr "Simuliert einen Tastendruck." -#: ../../src/actions/appAction.vala:34 -msgid "Launch application" -msgstr "Programm ausführen" - -#: ../../src/actions/appAction.vala:36 -msgid "Executes the given command." -msgstr "Führt einen gegebenen Befehl aus." - #: ../../src/actions/uriAction.vala:34 msgid "Open URI" msgstr "URI öffnen" @@ -45,6 +37,14 @@ msgstr "Öffnet URLs oder Dateipfade." msgid "Trash" msgstr "Müll" +#: ../../src/actions/appAction.vala:34 +msgid "Launch application" +msgstr "Programm ausführen" + +#: ../../src/actions/appAction.vala:36 +msgid "Executes the given command." +msgstr "Führt einen gegebenen Befehl aus." + #: ../../src/actions/pieAction.vala:34 msgid "Open Pie" msgstr "Pie öffnen" @@ -54,111 +54,176 @@ msgid "Opens another Pie of Gnome-Pie. You may create sub menus this way." msgstr "" "Öffnet einen anderen Pie. Auf diese Art können Submenüs erstellt werden." -#: ../../src/gui/triggerSelectWindow.vala:166 -msgid "" -"This hotkey is already assigned to the pie \"%s\"! \n" -"\n" -"Please select another one or cancel your selection." -msgstr "" -"Dieser Hotkey ist schon dem Pie \"%s\" zugeordnet!\n" -" Bitte wähle einen anderen!" - -#: ../../src/gui/preferencesWindow.vala:175 +#: ../../src/gui/preferencesWindow.vala:166 msgid "No Pie selected." msgstr "Kein Pie gewählt." -#: ../../src/gui/preferencesWindow.vala:215 +#: ../../src/gui/preferencesWindow.vala:206 msgid "New Pie" msgstr "Neuer Pie" -#: ../../src/gui/preferencesWindow.vala:228 +#: ../../src/gui/preferencesWindow.vala:219 msgid "" "Do you really want to delete the selected Pie with all contained Slices?" msgstr "Soll dieser Pie wirklich mit allen Slices gelöscht werden?" -#: ../../src/gui/newSliceWindow.vala:291 -msgid "Rename me!" -msgstr "Benenne mich!" +#: ../../src/gui/triggerSelectWindow.vala:226 +msgid "" +"This hotkey is already assigned to the pie \"%s\"! \n" +"\n" +"Please select another one or cancel your selection." +msgstr "" +"Dieser Hotkey ist schon dem Pie \"%s\" zugeordnet!\n" +" Bitte wähle einen anderen!" -#: ../../src/gui/piePreviewRenderer.vala:412 +#: ../../src/gui/piePreview.vala:148 +msgid "Do you really want to delete this Slice?" +msgstr "Soll die ausgewählte Slice wirklich gelöscht werden?" + +#: ../../src/gui/sliceTypeList.vala:60 +msgid "Slice types" +msgstr "Slice-Typen" + +#: ../../src/gui/piePreviewRenderer.vala:419 msgid "Click to edit" msgstr "Editieren durch klicken" -#: ../../src/gui/piePreviewRenderer.vala:412 -#: ../../src/gui/piePreviewRenderer.vala:427 +#: ../../src/gui/piePreviewRenderer.vala:419 +#: ../../src/gui/piePreviewRenderer.vala:434 msgid "Drag to move" msgstr "Verschieben durch ziehen" -#: ../../src/gui/piePreviewRenderer.vala:415 +#: ../../src/gui/piePreviewRenderer.vala:422 msgid "Click to add a new Slice" msgstr "Neue Slice durch Klicken hinzufügen" -#: ../../src/gui/piePreviewRenderer.vala:419 +#: ../../src/gui/piePreviewRenderer.vala:426 msgid "Drop to add as new Slice" msgstr "Als neue Slice hinzuzufügen" -#: ../../src/gui/piePreviewRenderer.vala:422 +#: ../../src/gui/piePreviewRenderer.vala:429 msgid "Drop to move Slice" msgstr "Slice verschieben" -#: ../../src/gui/piePreviewRenderer.vala:427 +#: ../../src/gui/piePreviewRenderer.vala:434 msgid "Click to delete" msgstr "Löschen durch klicken" -#: ../../src/gui/triggerSelectButton.vala:63 -msgid "Press a hotkey ..." -msgstr "Wählen..." - -#: ../../src/gui/piePreview.vala:155 -msgid "Do you really want to delete this Slice?" -msgstr "Soll die ausgewählte Slice wirklich gelöscht werden?" - -#: ../../src/gui/themeList.vala:62 -msgid "Themes" -msgstr "Themen" - -#: ../../src/gui/themeList.vala:99 -msgid "By" -msgstr "Von" - -#: ../../src/gui/sliceTypeList.vala:60 -msgid "Slice types" -msgstr "Slice-Typen" - -#: ../../src/gui/iconSelectWindow.vala:186 +#: ../../src/gui/iconSelectWindow.vala:182 msgid "All icons" msgstr "Alle Symbole" -#: ../../src/gui/iconSelectWindow.vala:187 +#: ../../src/gui/iconSelectWindow.vala:183 #: ../../src/pies/defaultConfig.vala:36 msgid "Applications" msgstr "Anwendungen" -#: ../../src/gui/iconSelectWindow.vala:188 +#: ../../src/gui/iconSelectWindow.vala:184 msgid "Actions" msgstr "Aktionen" -#: ../../src/gui/iconSelectWindow.vala:189 +#: ../../src/gui/iconSelectWindow.vala:185 msgid "Places" msgstr "Orte" -#: ../../src/gui/iconSelectWindow.vala:190 +#: ../../src/gui/iconSelectWindow.vala:186 msgid "File types" msgstr "Dateitypen" -#: ../../src/gui/iconSelectWindow.vala:191 +#: ../../src/gui/iconSelectWindow.vala:187 msgid "Emotes" msgstr "Smilies" -#: ../../src/gui/iconSelectWindow.vala:192 +#: ../../src/gui/iconSelectWindow.vala:188 msgid "Miscellaneous" msgstr "Sonstige" -#: ../../src/gui/iconSelectWindow.vala:267 -#: ../../src/gui/iconSelectWindow.vala:269 +#: ../../src/gui/iconSelectWindow.vala:261 msgid "All supported image formats" msgstr "Alle unterstützten Bildformate" +#: ../../src/gui/newSliceWindow.vala:291 +msgid "Rename me!" +msgstr "Benenne mich!" + +#: ../../src/gui/themeList.vala:62 +msgid "Themes" +msgstr "Themen" + +#: ../../src/gui/themeList.vala:99 +msgid "By" +msgstr "Von" + +#: ../../src/gui/indicator.vala:114 +msgid "_Preferences" +msgstr "Einstellungen" + +#: ../../src/gui/indicator.vala:123 +msgid "_About" +msgstr "Über" + +#: ../../src/gui/indicator.vala:138 +msgid "_Quit" +msgstr "Beenden" + +#: ../../src/gui/newsWindow.vala:64 +msgid "_Close" +msgstr "Schließen" + +#: ../../src/gui/triggerSelectButton.vala:64 +msgid "Press a hotkey ..." +msgstr "Wählen..." + +#: ../../src/utilities/key.vala:65 ../../src/utilities/bindingManager.vala:177 +#: ../../src/utilities/trigger.vala:195 ../../src/utilities/trigger.vala:280 +#: ../../src/utilities/trigger.vala:281 +msgid "Not bound" +msgstr "Nicht zugewiesen" + +#: ../../src/utilities/trigger.vala:182 +msgid "Button %i" +msgstr "Taste %i" + +#: ../../src/utilities/trigger.vala:185 +msgid "LeftButton" +msgstr "MausLinks" + +#: ../../src/utilities/trigger.vala:187 +msgid "RightButton" +msgstr "MausRechts" + +#: ../../src/utilities/trigger.vala:189 +msgid "MiddleButton" +msgstr "Mausrad" + +#: ../../src/utilities/trigger.vala:216 +msgid "Turbo" +msgstr "Turbo" + +#: ../../src/utilities/trigger.vala:220 ../../src/utilities/trigger.vala:222 +msgid "Delayed" +msgstr "Verzögert" + +#: ../../src/utilities/trigger.vala:226 ../../src/utilities/trigger.vala:228 +msgid "Centered" +msgstr "Zentriert" + +#: ../../src/utilities/trigger.vala:232 ../../src/utilities/trigger.vala:234 +msgid "Warp" +msgstr "Warp" + +#: ../../src/utilities/trigger.vala:238 ../../src/utilities/trigger.vala:240 +msgid "Auto-shaped" +msgstr "Dynamische" + +#: ../../src/utilities/trigger.vala:243 ../../src/utilities/trigger.vala:245 +msgid "Quarter pie" +msgstr "Viertel-Pie" + +#: ../../src/utilities/trigger.vala:249 ../../src/utilities/trigger.vala:251 +msgid "Half pie" +msgstr "Halb-Pie" + #: ../../src/actionGroups/windowListGroup.vala:34 msgid "Group: Window List" msgstr "Gruppe: Fensterliste" @@ -167,14 +232,6 @@ msgstr "Gruppe: Fensterliste" msgid "Shows a Slice for each of your opened Windows. Almost like Alt-Tab." msgstr "Zeigt eine Slice für jedes geöffnete Fenster an." -#: ../../src/actionGroups/menuGroup.vala:35 -msgid "Group: Main menu" -msgstr "Gruppe: Hauptmenü" - -#: ../../src/actionGroups/menuGroup.vala:37 -msgid "Displays your main menu structure." -msgstr "Zeigt das Hauptmenü an." - #: ../../src/actionGroups/clipboardGroup.vala:64 msgid "Group: Clipboard" msgstr "Gruppe: Zwischenablage" @@ -183,6 +240,27 @@ msgstr "Gruppe: Zwischenablage" msgid "Manages your Clipboard." msgstr "Verwaltet die Zwischenablage." +#: ../../src/actionGroups/devicesGroup.vala:35 +msgid "Group: Devices" +msgstr "Gruppe: Laufwerke" + +#: ../../src/actionGroups/devicesGroup.vala:37 +msgid "Shows a Slice for each plugged in devices, like USB-Sticks." +msgstr "" +"Zeigt eine Slice für jedes angeschlossene Gerät, wie z. B. USB Sticks, an. " + +#: ../../src/actionGroups/devicesGroup.vala:85 +msgid "Root" +msgstr "Dateisystem" + +#: ../../src/actionGroups/menuGroup.vala:35 +msgid "Group: Main menu" +msgstr "Gruppe: Hauptmenü" + +#: ../../src/actionGroups/menuGroup.vala:37 +msgid "Displays your main menu structure." +msgstr "Zeigt das Hauptmenü an." + #: ../../src/actionGroups/sessionGroup.vala:35 msgid "Group: Session Control" msgstr "Gruppe: Sitzung" @@ -212,55 +290,6 @@ msgstr "Gruppe: Lesezeichen" msgid "Shows a Slice for each of your directory Bookmarks." msgstr "Zeigt eine Slice für jedes Ordner-Lesezeichen an." -#: ../../src/actionGroups/devicesGroup.vala:35 -msgid "Group: Devices" -msgstr "Gruppe: Laufwerke" - -#: ../../src/actionGroups/devicesGroup.vala:37 -msgid "Shows a Slice for each plugged in devices, like USB-Sticks." -msgstr "" -"Zeigt eine Slice für jedes angeschlossene Gerät, wie z. B. USB Sticks, an. " - -#: ../../src/actionGroups/devicesGroup.vala:85 -msgid "Root" -msgstr "Dateisystem" - -#: ../../src/utilities/bindingManager.vala:161 ../../src/utilities/key.vala:65 -#: ../../src/utilities/trigger.vala:212 ../../src/utilities/trigger.vala:213 -msgid "Not bound" -msgstr "Nicht zugewiesen" - -#: ../../src/utilities/trigger.vala:163 -msgid "Button %i" -msgstr "Taste %i" - -#: ../../src/utilities/trigger.vala:166 -msgid "LeftButton" -msgstr "MausLinks" - -#: ../../src/utilities/trigger.vala:168 -msgid "RightButton" -msgstr "MausRechts" - -#: ../../src/utilities/trigger.vala:170 -msgid "MiddleButton" -msgstr "Mausrad" - -#: ../../src/utilities/trigger.vala:188 ../../src/utilities/trigger.vala:190 -#: ../../src/utilities/trigger.vala:192 ../../src/utilities/trigger.vala:196 -msgid "Turbo" -msgstr "Turbo" - -#: ../../src/utilities/trigger.vala:188 ../../src/utilities/trigger.vala:192 -#: ../../src/utilities/trigger.vala:194 ../../src/utilities/trigger.vala:198 -msgid "Delayed" -msgstr "Verzögert" - -#: ../../src/utilities/trigger.vala:188 ../../src/utilities/trigger.vala:190 -#: ../../src/utilities/trigger.vala:194 ../../src/utilities/trigger.vala:200 -msgid "Centered" -msgstr "Zentriert" - #: ../../src/pies/defaultConfig.vala:29 msgid "Multimedia" msgstr "Multimedia" @@ -317,52 +346,40 @@ msgstr "Maximieren" msgid "Restore" msgstr "Wiederherstellen" -#: ../ui/icon_select.ui:8 -msgid "Select an icon" -msgstr "Wähle ein Symbol" - -#: ../ui/icon_select.ui:85 -msgid "Icon Theme" -msgstr "Symbolthema" - -#: ../ui/icon_select.ui:105 -msgid "Custom Icon" -msgstr "Benutzerdefiniertes Symbol" - -#: ../ui/trigger_select.ui:8 +#: ../ui/trigger_select.ui:53 msgid "Activation Settings" msgstr "Aktivierungsoptionen" -#: ../ui/trigger_select.ui:86 +#: ../ui/trigger_select.ui:132 msgid "It's possible to bind mouse buttons as well!" msgstr "Es ist auch möglich, Maustasten zu binden!" -#: ../ui/trigger_select.ui:118 +#: ../ui/trigger_select.ui:165 msgid "Turbo mode" msgstr "Turbo-Mode" -#: ../ui/trigger_select.ui:123 ../ui/trigger_select.ui:124 +#: ../ui/trigger_select.ui:171 ../ui/trigger_select.ui:172 msgid "If checked, the Pie will close when you release the chosen hot key." msgstr "" "Falls aktiviert schließt sich der Pie wieder automatisch, wenn der Hotkey " "losgelassen wird." -#: ../ui/trigger_select.ui:137 +#: ../ui/trigger_select.ui:184 msgid "Long press for activation" msgstr "Verzögerte Aktivierung" -#: ../ui/trigger_select.ui:142 ../ui/trigger_select.ui:143 +#: ../ui/trigger_select.ui:190 ../ui/trigger_select.ui:191 msgid "" "If checked, the Pie will only open if you press this hot key a bit longer." msgstr "" "Falls aktiviert, wird sich der Pie erst öffnen, wenn der Hotkey länger " "gedrückt gehalten wird." -#: ../ui/trigger_select.ui:156 +#: ../ui/trigger_select.ui:203 msgid "Open Pie centered on the screen" msgstr "Zentriert auf dem Bildschirm öffnen" -#: ../ui/trigger_select.ui:161 ../ui/trigger_select.ui:162 +#: ../ui/trigger_select.ui:209 ../ui/trigger_select.ui:210 msgid "" "If checked, the Pie will open in the middle of your screen. Else it will pop " "up at your pointer." @@ -370,71 +387,51 @@ msgstr "" "Falls aktiviert, wird sich der Pie nicht an der Maus, sondern in der Mitte " "des Bildschirms öffnen." -#: ../ui/trigger_select.ui:181 -msgid "Activation options" -msgstr "Aktivierungsoptionen" +#: ../ui/trigger_select.ui:222 +msgid "Warp mouse pointer to center of Pie" +msgstr "Bewege den Mauszeiger zur Mitte des Pies" -#: ../ui/settings.ui:9 ../ui/preferences.ui:27 -msgid "General Settings" -msgstr "Allgemeine Einstellungen" - -#: ../ui/settings.ui:74 -msgid "Start Gnome-Pie on login" -msgstr "Beim Anmelden automatisch ausführen" - -#: ../ui/settings.ui:79 ../ui/settings.ui:80 -msgid "If checked, Gnome-Pie will start silently everytime you log in." -msgstr "Wenn aktiviert, startet Gnome-Pie im Hintergrund beim Anmelden." - -#: ../ui/settings.ui:93 -msgid "Display panel icon " -msgstr "Zeige ein Symbol im Panel" - -#: ../ui/settings.ui:98 ../ui/settings.ui:99 +#: ../ui/trigger_select.ui:228 ../ui/trigger_select.ui:229 msgid "" -"If not checked, you can access this menu by launching Gnome-Pie a second " -"time." -msgstr "" -"Falls nicht aktiviert, kann dieses Menü durch ein nochmaliges starten von " -"Gnome-Pie geöffnet werden." - -#: ../ui/settings.ui:118 -msgid "Behavior" -msgstr "Verhalten" - -#: ../ui/settings.ui:175 -msgid "Global scale" -msgstr "Skalierungsfaktor" +"If checked, the mouse pointer will be warped to the center of the Pie. This " +"allows for quick selections even if the Pie is opened at the screen's " +"boundary." +msgstr "Falls aktiviert, wird der Mauszeiger nach dem dem Öffenen des Pies zu " +"dessen Mitte bewegt. Dadurch kann auch an den Seiten des Bildschirms schnell " +"selektiert werden." + +#: ../ui/trigger_select.ui:247 +msgid "Activation options" +msgstr "Aktivierungsoptionen" -#: ../ui/settings.ui:207 -msgid "Display Slice labels" -msgstr "Zeige Namen der Slices" +#: ../ui/trigger_select.ui:438 +msgid "Automatically select the best pie shape" +msgstr "Wähle die Anordnung automatisch" -#: ../ui/settings.ui:212 ../ui/settings.ui:213 +#: ../ui/trigger_select.ui:442 msgid "" -"Displays the name of each Slice next to it. Only available if supported by " -"the theme." -msgstr "" -"Zeigt den Name jeder Slice an. Nur möglich, wenn durch das aktuelle Thema " -"unterstützt." +"If checked, the shape will be automatically selected to minimize mouse " +"travelling." +msgstr "Falls aktiviert, wird je nach Position auf dem Bildschirm eine " +"passende Anordnung gweählt." -#: ../ui/settings.ui:232 -msgid "Appearance" -msgstr "Erscheinungsbild" +#: ../ui/trigger_select.ui:462 +msgid "Pie shape" +msgstr "Anordnung" -#: ../ui/slice_select.ui:9 +#: ../ui/slice_select.ui:8 msgid "Slice Options" msgstr "Slice-Optionen" -#: ../ui/slice_select.ui:139 +#: ../ui/slice_select.ui:141 msgid "There are no options for this Slice type." msgstr "Es gibt keine Otionen für diesen Slice-Typ." -#: ../ui/slice_select.ui:165 +#: ../ui/slice_select.ui:167 msgid "Name of the Slice " msgstr "Name" -#: ../ui/slice_select.ui:204 +#: ../ui/slice_select.ui:205 msgid "URI to open" msgstr "URI" @@ -442,15 +439,15 @@ msgstr "URI" msgid "Command to execute" msgstr "Befehl" -#: ../ui/slice_select.ui:282 +#: ../ui/slice_select.ui:281 msgid "Hotkey to press" msgstr "Tastenkomination" -#: ../ui/slice_select.ui:311 +#: ../ui/slice_select.ui:310 msgid "Pie to open" msgstr "Pie" -#: ../ui/slice_select.ui:340 +#: ../ui/slice_select.ui:339 msgid "Is Quick Action" msgstr "Ist Quick Action" @@ -458,21 +455,41 @@ msgstr "Ist Quick Action" msgid "This Slice will be executed when you click in the middle of the Pie." msgstr "Diese Slice wird aktiviert, falls du in die Mitte des Pies klickst." -#: ../ui/slice_select.ui:388 +#: ../ui/slice_select.ui:387 msgid "Slice options" msgstr "Slice-Optionen" -#: ../ui/preferences.ui:8 +#: ../ui/icon_select.ui:9 +msgid "Select an icon" +msgstr "Wähle ein Symbol" + +#: ../ui/icon_select.ui:103 +msgid "Icon Theme" +msgstr "Symbolthema" + +#: ../ui/icon_select.ui:123 +msgid "Custom Icon" +msgstr "Benutzerdefiniertes Symbol" + +#: ../ui/rename_pie.ui:8 +msgid "Rename a Pie" +msgstr "Pie umbenennen" + +#: ../ui/preferences.ui:7 msgid "Gnome-Pie Settings" msgstr "Gnome-Pie - Einstellungen" -#: ../ui/preferences.ui:261 +#: ../ui/preferences.ui:27 ../ui/settings.ui:8 +msgid "General Settings" +msgstr "Allgemeine Einstellungen" + +#: ../ui/preferences.ui:266 msgid "" "This Pie is empty!\n" "\n" "Start adding Slices to it! This can be done by dragging stuff to the " "plus sign below. You can try a lot! For example application launchers or " -"folders. Even URLs from your browser are possible... \n" +"folders. Even URLs from your browser are possible...\n" "\n" "For manual and advanced configuration click on the plus sign." msgstr "" @@ -484,7 +501,7 @@ msgstr "" "\n" "Zur manuellen und fortgeschrittenen Konfiguration klicke auf das Symbol." -#: ../ui/preferences.ui:282 +#: ../ui/preferences.ui:287 msgid "" "You have no Pies!\n" "\n" @@ -496,6 +513,54 @@ msgstr "" "Erstelle einen neuen! Klicke dazu einfach auf das kleine Pluszeichen " "unter der leeren Liste auf der linken Seite." -#: ../ui/rename_pie.ui:8 -msgid "Rename a Pie" -msgstr "Pie umbenennen" +#: ../ui/settings.ui:75 +msgid "Start Gnome-Pie on login" +msgstr "Beim Anmelden automatisch ausführen" + +#: ../ui/settings.ui:81 ../ui/settings.ui:82 +msgid "If checked, Gnome-Pie will start silently everytime you log in." +msgstr "Wenn aktiviert, startet Gnome-Pie im Hintergrund beim Anmelden." + +#: ../ui/settings.ui:94 +msgid "Display panel icon " +msgstr "Zeige ein Symbol im Panel" + +#: ../ui/settings.ui:100 ../ui/settings.ui:101 +msgid "" +"If not checked, you can access this menu by launching Gnome-Pie a second " +"time." +msgstr "" +"Falls nicht aktiviert, kann dieses Menü durch ein nochmaliges starten von " +"Gnome-Pie geöffnet werden." + +#: ../ui/settings.ui:119 +msgid "Behavior" +msgstr "Verhalten" + +#: ../ui/settings.ui:178 +msgid "Global scale" +msgstr "Skalierungsfaktor" + +#: ../ui/settings.ui:217 +msgid "Maximum slices per pie" +msgstr "Maximale Zahl von Einträgen pro Pie" + +#: ../ui/settings.ui:256 +msgid "Maximum activation radius" +msgstr "Maximale Aktivierungsentfernung" + +#: ../ui/settings.ui:287 +msgid "Display Slice labels" +msgstr "Zeige Namen der Slices" + +#: ../ui/settings.ui:293 ../ui/settings.ui:294 +msgid "" +"Displays the name of each Slice next to it. Only available if supported by " +"the theme." +msgstr "" +"Zeigt den Name jeder Slice an. Nur möglich, wenn durch das aktuelle Thema " +"unterstützt." + +#: ../ui/settings.ui:312 +msgid "Appearance" +msgstr "Erscheinungsbild" diff --git a/resources/locale/de/LC_MESSAGES/gnomepie.mo b/resources/locale/de/LC_MESSAGES/gnomepie.mo index 1701aa6..b888b32 100644 Binary files a/resources/locale/de/LC_MESSAGES/gnomepie.mo and b/resources/locale/de/LC_MESSAGES/gnomepie.mo differ diff --git a/resources/locale/es/LC_MESSAGES/es.po b/resources/locale/es/LC_MESSAGES/es.po index b1ba6ce..9f916ea 100644 --- a/resources/locale/es/LC_MESSAGES/es.po +++ b/resources/locale/es/LC_MESSAGES/es.po @@ -2,14 +2,15 @@ # Copyright (C) 2012 Simon Schneegans # This file is distributed under the same license as the gnomepie package. # Eduardo Anabalon , 2012. +# Gabriel Dubatti , 2015. # msgid "" msgstr "" "Project-Id-Version: gnomepie 0.4\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-29 15:58+0100\n" +"POT-Creation-Date: 2015-04-07 08:55+0200\n" "PO-Revision-Date: 2012-01-22 15:30-0300\n" -"Last-Translator: Eduardo Anabalon \n" +"Last-Translator: Gabriel Dubatti \n" "Language-Team: Spanish\n" "Language: es\n" "MIME-Version: 1.0\n" @@ -19,20 +20,12 @@ msgstr "" #: ../../src/actions/keyAction.vala:34 msgid "Press hotkey" -msgstr "Presiona un atajo." +msgstr "Presiona un atajo" #: ../../src/actions/keyAction.vala:36 msgid "Simulates the activation of a hotkey." msgstr "Simula la activación de un atajo." -#: ../../src/actions/appAction.vala:34 -msgid "Launch application" -msgstr "Lanzar una aplicación" - -#: ../../src/actions/appAction.vala:36 -msgid "Executes the given command." -msgstr "Ejecutar un comando dado." - #: ../../src/actions/uriAction.vala:34 msgid "Open URI" msgstr "Abrir URI" @@ -43,7 +36,15 @@ msgstr "Abre un lugar determinado. Puedes usar URI's o ruta de archivos." #: ../../src/actions/actionRegistry.vala:119 msgid "Trash" -msgstr "Borrar" +msgstr "Papelera" + +#: ../../src/actions/appAction.vala:34 +msgid "Launch application" +msgstr "Lanzar una aplicación" + +#: ../../src/actions/appAction.vala:36 +msgid "Executes the given command." +msgstr "Ejecutar un comando dado." #: ../../src/actions/pieAction.vala:34 msgid "Open Pie" @@ -53,114 +54,179 @@ msgstr "Abrir Pastel" msgid "Opens another Pie of Gnome-Pie. You may create sub menus this way." msgstr "Abre otro Pastel de Gnome-Pie. De esta manera puedes crear submenús." -#: ../../src/gui/triggerSelectWindow.vala:166 -msgid "" -"This hotkey is already assigned to the pie \"%s\"! \n" -"\n" -"Please select another one or cancel your selection." -msgstr "" -"Este atajo ya está asignado al pastel \"%s\"! \n" -"\n" -"Por favor selecciona otro atajo o cancela tu selección." - -#: ../../src/gui/preferencesWindow.vala:175 +#: ../../src/gui/preferencesWindow.vala:166 msgid "No Pie selected." msgstr "Pastel no seleccionado." -#: ../../src/gui/preferencesWindow.vala:215 +#: ../../src/gui/preferencesWindow.vala:206 msgid "New Pie" msgstr "Nuevo Pastel" -#: ../../src/gui/preferencesWindow.vala:228 +#: ../../src/gui/preferencesWindow.vala:219 msgid "" "Do you really want to delete the selected Pie with all contained Slices?" msgstr "" -"Realmente quieres borrar el Pastel seleccionado incluyendo todas sus " +"¿Realmente quieres borrar el Pastel seleccionado incluyendo todas sus " "Rebanadas?" -#: ../../src/gui/newSliceWindow.vala:291 -msgid "Rename me!" -msgstr "Renombrame!" +#: ../../src/gui/triggerSelectWindow.vala:226 +msgid "" +"This hotkey is already assigned to the pie \"%s\"! \n" +"\n" +"Please select another one or cancel your selection." +msgstr "" +"Este atajo ya está asignado al Pastel \"%s\"! \n" +"\n" +"Por favor selecciona otro atajo o cancela tu selección." -#: ../../src/gui/piePreviewRenderer.vala:412 +#: ../../src/gui/piePreview.vala:148 +msgid "Do you really want to delete this Slice?" +msgstr "¿Realmente quieres borrar esta Rebanada?" + +#: ../../src/gui/sliceTypeList.vala:60 +msgid "Slice types" +msgstr "Tipos de Rebanada" + +#: ../../src/gui/piePreviewRenderer.vala:419 msgid "Click to edit" msgstr "Click para editar" -#: ../../src/gui/piePreviewRenderer.vala:412 -#: ../../src/gui/piePreviewRenderer.vala:427 +#: ../../src/gui/piePreviewRenderer.vala:419 +#: ../../src/gui/piePreviewRenderer.vala:434 msgid "Drag to move" msgstr "Arrastra para mover" -#: ../../src/gui/piePreviewRenderer.vala:415 +#: ../../src/gui/piePreviewRenderer.vala:422 msgid "Click to add a new Slice" msgstr "Click para añadir una nueva Rebanada" -#: ../../src/gui/piePreviewRenderer.vala:419 +#: ../../src/gui/piePreviewRenderer.vala:426 msgid "Drop to add as new Slice" msgstr "Suelta para añadir una nueva Rebanada" -#: ../../src/gui/piePreviewRenderer.vala:422 +#: ../../src/gui/piePreviewRenderer.vala:429 msgid "Drop to move Slice" msgstr "Suelta para mover la Rebanada" -#: ../../src/gui/piePreviewRenderer.vala:427 +#: ../../src/gui/piePreviewRenderer.vala:434 msgid "Click to delete" msgstr "Click para borrar" -#: ../../src/gui/triggerSelectButton.vala:63 -msgid "Press a hotkey ..." -msgstr "Presiona un atajo ..." - -#: ../../src/gui/piePreview.vala:155 -msgid "Do you really want to delete this Slice?" -msgstr "Realmente quieres borrar ésta Rebanada?" - -#: ../../src/gui/themeList.vala:62 -msgid "Themes" -msgstr "Temas" - -#: ../../src/gui/themeList.vala:99 -msgid "By" -msgstr "Por" - -#: ../../src/gui/sliceTypeList.vala:60 -msgid "Slice types" -msgstr "Tipos de Rebanada" - -#: ../../src/gui/iconSelectWindow.vala:186 +#: ../../src/gui/iconSelectWindow.vala:182 msgid "All icons" msgstr "Todos los iconos" -#: ../../src/gui/iconSelectWindow.vala:187 +#: ../../src/gui/iconSelectWindow.vala:183 #: ../../src/pies/defaultConfig.vala:36 msgid "Applications" msgstr "Aplicaciones" -#: ../../src/gui/iconSelectWindow.vala:188 +#: ../../src/gui/iconSelectWindow.vala:184 msgid "Actions" msgstr "Acciones" -#: ../../src/gui/iconSelectWindow.vala:189 +#: ../../src/gui/iconSelectWindow.vala:185 msgid "Places" msgstr "Lugares" -#: ../../src/gui/iconSelectWindow.vala:190 +#: ../../src/gui/iconSelectWindow.vala:186 msgid "File types" msgstr "Tipos de archivo" -#: ../../src/gui/iconSelectWindow.vala:191 +#: ../../src/gui/iconSelectWindow.vala:187 msgid "Emotes" -msgstr "Emotes" +msgstr "Emoticones" -#: ../../src/gui/iconSelectWindow.vala:192 +#: ../../src/gui/iconSelectWindow.vala:188 msgid "Miscellaneous" msgstr "Misceláneos" -#: ../../src/gui/iconSelectWindow.vala:267 -#: ../../src/gui/iconSelectWindow.vala:269 +#: ../../src/gui/iconSelectWindow.vala:261 msgid "All supported image formats" msgstr "Todos los formatos de imágenes soportados" +#: ../../src/gui/newSliceWindow.vala:291 +msgid "Rename me!" +msgstr "Renómbrame!" + +#: ../../src/gui/themeList.vala:62 +msgid "Themes" +msgstr "Temas" + +#: ../../src/gui/themeList.vala:99 +msgid "By" +msgstr "Por" + +#: ../../src/gui/indicator.vala:114 +msgid "_Preferences" +msgstr "_Preferencias" + +#: ../../src/gui/indicator.vala:123 +msgid "_About" +msgstr "_Acerca de" + +#: ../../src/gui/indicator.vala:138 +msgid "_Quit" +msgstr "_Salir" + +#: ../../src/gui/newsWindow.vala:64 +msgid "_Close" +msgstr "_Cerrar" + +#: ../../src/gui/triggerSelectButton.vala:64 +msgid "Press a hotkey ..." +msgstr "Presiona un atajo ..." + +#: ../../src/utilities/key.vala:65 ../../src/utilities/bindingManager.vala:177 +#: ../../src/utilities/trigger.vala:195 ../../src/utilities/trigger.vala:280 +#: ../../src/utilities/trigger.vala:281 +msgid "Not bound" +msgstr "Sin atajo" + +#: ../../src/utilities/trigger.vala:182 +msgid "Button %i" +msgstr "Botón %i" + +#: ../../src/utilities/trigger.vala:185 +msgid "LeftButton" +msgstr "BotónIzquierdo" + +#: ../../src/utilities/trigger.vala:187 +msgid "RightButton" +msgstr "BotónDerecho" + +#: ../../src/utilities/trigger.vala:189 +msgid "MiddleButton" +msgstr "BotónCentral" + +#: ../../src/utilities/trigger.vala:216 +msgid "Turbo" +msgstr "Turbo" + +#: ../../src/utilities/trigger.vala:220 ../../src/utilities/trigger.vala:222 +msgid "Delayed" +msgstr "Retrasado" + +#: ../../src/utilities/trigger.vala:226 ../../src/utilities/trigger.vala:228 +msgid "Centered" +msgstr "Centrado" + +#: ../../src/utilities/trigger.vala:232 ../../src/utilities/trigger.vala:234 +msgid "Warp" +msgstr "Teletransportar" + +#: ../../src/utilities/trigger.vala:238 ../../src/utilities/trigger.vala:240 +msgid "Auto-shaped" +msgstr "Auto-forma" + +#: ../../src/utilities/trigger.vala:243 ../../src/utilities/trigger.vala:245 +msgid "Quarter pie" +msgstr "Cuarto de Pastel" + +#: ../../src/utilities/trigger.vala:249 ../../src/utilities/trigger.vala:251 +msgid "Half pie" +msgstr "Medio Pastel" + #: ../../src/actionGroups/windowListGroup.vala:34 msgid "Group: Window List" msgstr "Grupo: Lista de Ventanas" @@ -168,17 +234,9 @@ msgstr "Grupo: Lista de Ventanas" #: ../../src/actionGroups/windowListGroup.vala:36 msgid "Shows a Slice for each of your opened Windows. Almost like Alt-Tab." msgstr "" -"Muestra una Rebanada para cada uno de tus Ventanas abiertas. Casi como Alt-" +"Muestra una Rebanada para cada una de tus Ventanas abiertas. Casi como Alt-" "Tab." -#: ../../src/actionGroups/menuGroup.vala:35 -msgid "Group: Main menu" -msgstr "Grupo: Menú Principal" - -#: ../../src/actionGroups/menuGroup.vala:37 -msgid "Displays your main menu structure." -msgstr "Muestra la estructura de tu Menú Principal." - #: ../../src/actionGroups/clipboardGroup.vala:64 msgid "Group: Clipboard" msgstr "Grupo: Portapapeles" @@ -187,13 +245,33 @@ msgstr "Grupo: Portapapeles" msgid "Manages your Clipboard." msgstr "Gestiona tus Portapapeles." +#: ../../src/actionGroups/devicesGroup.vala:35 +msgid "Group: Devices" +msgstr "Grupo: Dispositivos" + +#: ../../src/actionGroups/devicesGroup.vala:37 +msgid "Shows a Slice for each plugged in devices, like USB-Sticks." +msgstr "Muestra una Rebanada por cada dispositivo conectado, como USB-Sticks." + +#: ../../src/actionGroups/devicesGroup.vala:85 +msgid "Root" +msgstr "Root" + +#: ../../src/actionGroups/menuGroup.vala:35 +msgid "Group: Main menu" +msgstr "Grupo: Menú Principal" + +#: ../../src/actionGroups/menuGroup.vala:37 +msgid "Displays your main menu structure." +msgstr "Muestra la estructura de tu Menú Principal." + #: ../../src/actionGroups/sessionGroup.vala:35 msgid "Group: Session Control" msgstr "Grupo: Control de Sesión" #: ../../src/actionGroups/sessionGroup.vala:37 msgid "Shows a Slice for Shutdown, Reboot, and Hibernate." -msgstr "Muestra una Rebanada para Apagar, Reiniciar, e Hibernar." +msgstr "Muestra una Rebanada para Apagar, Reiniciar e Hibernar." #: ../../src/actionGroups/sessionGroup.vala:60 msgid "Shutdown" @@ -215,54 +293,6 @@ msgstr "Grupo: Marcadores" msgid "Shows a Slice for each of your directory Bookmarks." msgstr "Muestra una Rebanada por cada uno de los directorios en los Marcadores." -#: ../../src/actionGroups/devicesGroup.vala:35 -msgid "Group: Devices" -msgstr "Grupo: Dispositivos" - -#: ../../src/actionGroups/devicesGroup.vala:37 -msgid "Shows a Slice for each plugged in devices, like USB-Sticks." -msgstr "Muestra una Rebanada por cada dispositivo conectado, como USB-Sticks." - -#: ../../src/actionGroups/devicesGroup.vala:85 -msgid "Root" -msgstr "Root" - -#: ../../src/utilities/bindingManager.vala:161 ../../src/utilities/key.vala:65 -#: ../../src/utilities/trigger.vala:212 ../../src/utilities/trigger.vala:213 -msgid "Not bound" -msgstr "No encontrado" - -#: ../../src/utilities/trigger.vala:163 -msgid "Button %i" -msgstr "Botón %i" - -#: ../../src/utilities/trigger.vala:166 -msgid "LeftButton" -msgstr "BotónIzquierdo" - -#: ../../src/utilities/trigger.vala:168 -msgid "RightButton" -msgstr "BotónDerecho" - -#: ../../src/utilities/trigger.vala:170 -msgid "MiddleButton" -msgstr "BotónCentral" - -#: ../../src/utilities/trigger.vala:188 ../../src/utilities/trigger.vala:190 -#: ../../src/utilities/trigger.vala:192 ../../src/utilities/trigger.vala:196 -msgid "Turbo" -msgstr "Turbo" - -#: ../../src/utilities/trigger.vala:188 ../../src/utilities/trigger.vala:192 -#: ../../src/utilities/trigger.vala:194 ../../src/utilities/trigger.vala:198 -msgid "Delayed" -msgstr "Retrasado" - -#: ../../src/utilities/trigger.vala:188 ../../src/utilities/trigger.vala:190 -#: ../../src/utilities/trigger.vala:194 ../../src/utilities/trigger.vala:200 -msgid "Centered" -msgstr "Centrado" - #: ../../src/pies/defaultConfig.vala:29 msgid "Multimedia" msgstr "Multimedia" @@ -319,120 +349,90 @@ msgstr "Maximizar" msgid "Restore" msgstr "Restaurar" -#: ../ui/icon_select.ui:8 -msgid "Select an icon" -msgstr "Selecciona un icono" - -#: ../ui/icon_select.ui:85 -msgid "Icon Theme" -msgstr "Tema de iconos" - -#: ../ui/icon_select.ui:105 -msgid "Custom Icon" -msgstr "Icono personalizado" - -#: ../ui/trigger_select.ui:8 +#: ../ui/trigger_select.ui:53 msgid "Activation Settings" msgstr "Configuración de activación" -#: ../ui/trigger_select.ui:86 +#: ../ui/trigger_select.ui:132 msgid "It's possible to bind mouse buttons as well!" -msgstr "Es posible enlazar los botones del ratón también!" +msgstr "También es posible enlazar los botones del ratón!" -#: ../ui/trigger_select.ui:118 +#: ../ui/trigger_select.ui:165 msgid "Turbo mode" msgstr "Modo Turbo" -#: ../ui/trigger_select.ui:123 ../ui/trigger_select.ui:124 +#: ../ui/trigger_select.ui:171 ../ui/trigger_select.ui:172 msgid "If checked, the Pie will close when you release the chosen hot key." -msgstr "el Pastel cerrará cuando sueltes el atajo seleccionado." +msgstr "El Pastel cerrará cuando sueltes el atajo seleccionado." -#: ../ui/trigger_select.ui:137 +#: ../ui/trigger_select.ui:184 msgid "Long press for activation" -msgstr "Larga pulsación para la activación" +msgstr "Pulsación larga para activar" -#: ../ui/trigger_select.ui:142 ../ui/trigger_select.ui:143 +#: ../ui/trigger_select.ui:190 ../ui/trigger_select.ui:191 msgid "" "If checked, the Pie will only open if you press this hot key a bit longer." -msgstr "el Pastel solo se abrirá si presionas el atajo un poco más." +msgstr "El Pastel sólo se abrirá si presionas el atajo un poco más." -#: ../ui/trigger_select.ui:156 +#: ../ui/trigger_select.ui:203 msgid "Open Pie centered on the screen" msgstr "Abrir el Pastel en el centro de la pantalla" -#: ../ui/trigger_select.ui:161 ../ui/trigger_select.ui:162 +#: ../ui/trigger_select.ui:209 ../ui/trigger_select.ui:210 msgid "" "If checked, the Pie will open in the middle of your screen. Else it will pop " "up at your pointer." msgstr "" -"el Pastel abrirá en el centro de la pantalla. De lo contrario abrirá encima " +"El Pastel abrirá en el centro de la pantalla. De lo contrario abrirá encima " "del puntero." -#: ../ui/trigger_select.ui:181 -msgid "Activation options" -msgstr "Opciones de activación" - -#: ../ui/settings.ui:9 ../ui/preferences.ui:27 -msgid "General Settings" -msgstr "Configuraciones Generales" - -#: ../ui/settings.ui:74 -msgid "Start Gnome-Pie on login" -msgstr "Arrancar Gnome-Pie al inicio" - -#: ../ui/settings.ui:79 ../ui/settings.ui:80 -msgid "If checked, Gnome-Pie will start silently everytime you log in." -msgstr "Gnome-Pie se iniciará en silencio cada vez que inicies sesión." - -#: ../ui/settings.ui:93 -msgid "Display panel icon " -msgstr "Mostrar panel de íconos" +#: ../ui/trigger_select.ui:222 +msgid "Warp mouse pointer to center of Pie" +msgstr "Teletransportar el mouse al centro del Pastel" -#: ../ui/settings.ui:98 ../ui/settings.ui:99 +#: ../ui/trigger_select.ui:228 ../ui/trigger_select.ui:229 msgid "" -"If not checked, you can access this menu by launching Gnome-Pie a second " -"time." -msgstr "Si no esta activado, puedes acceder a este menú lanzando Gnome-Pie " -"por segunda vez." - -#: ../ui/settings.ui:118 -msgid "Behavior" -msgstr "Comportamiento" +"If checked, the mouse pointer will be warped to the center of the Pie. This " +"allows for quick selections even if the Pie is opened at the screen's " +"boundary." +msgstr "" +"El puntero será teletransportado al centro del Pastel. Esto permite " +"acelerar la selección cuando el pastel es abierto cerca de un borde o en el " +"centro de la pantalla." -#: ../ui/settings.ui:175 -msgid "Global scale" -msgstr "Escala Global" +#: ../ui/trigger_select.ui:247 +msgid "Activation options" +msgstr "Opciones de activación" -#: ../ui/settings.ui:207 -#, fuzzy -msgid "Display Slice labels" -msgstr "Mostrar las etiquetas de las Rebanadas" +#: ../ui/trigger_select.ui:438 +msgid "Automatically select the best pie shape" +msgstr "Seleccionar automáticamente la mejor forma de Pastel" -#: ../ui/settings.ui:212 ../ui/settings.ui:213 +#: ../ui/trigger_select.ui:442 msgid "" -"Displays the name of each Slice next to it. Only available if supported by " -"the theme." +"If checked, the shape will be automatically selected to minimize mouse " +"travelling." msgstr "" -"Mostrar el nombre de cada Rebanada. Solo si es soportado por el theme." +"La forma del Pastel se ajustará según la posición del puntero para " +"minimizar la distancia al centro" -#: ../ui/settings.ui:232 -#, fuzzy -msgid "Appearance" -msgstr "Apariencia" +#: ../ui/trigger_select.ui:462 +msgid "Pie shape" +msgstr "Forma del Pastel" -#: ../ui/slice_select.ui:9 +#: ../ui/slice_select.ui:8 msgid "Slice Options" msgstr "Opciones de Rebanadas" -#: ../ui/slice_select.ui:139 +#: ../ui/slice_select.ui:141 msgid "There are no options for this Slice type." msgstr "No hay opciones para este tipo de Rebanada." -#: ../ui/slice_select.ui:165 +#: ../ui/slice_select.ui:167 msgid "Name of the Slice " msgstr "Nombre de la Rebanada " -#: ../ui/slice_select.ui:204 +#: ../ui/slice_select.ui:205 msgid "URI to open" msgstr "URI a abrir" @@ -440,49 +440,69 @@ msgstr "URI a abrir" msgid "Command to execute" msgstr "Comando a ejecutar" -#: ../ui/slice_select.ui:282 +#: ../ui/slice_select.ui:281 msgid "Hotkey to press" msgstr "Atajo a presionar" -#: ../ui/slice_select.ui:311 +#: ../ui/slice_select.ui:310 msgid "Pie to open" msgstr "Pastel a abrir" -#: ../ui/slice_select.ui:340 +#: ../ui/slice_select.ui:339 msgid "Is Quick Action" msgstr "Es una Acción Rápida" #: ../ui/slice_select.ui:354 ../ui/slice_select.ui:355 msgid "This Slice will be executed when you click in the middle of the Pie." -msgstr "Esta Rebanada se ejecutará cuando hagas click en el medio del Pastel." +msgstr "Esta Rebanada se ejecutará cuando hagas click en el centro del Pastel." -#: ../ui/slice_select.ui:388 +#: ../ui/slice_select.ui:387 msgid "Slice options" msgstr "Opciones de Rebanadas" -#: ../ui/preferences.ui:8 +#: ../ui/icon_select.ui:9 +msgid "Select an icon" +msgstr "Selecciona un icono" + +#: ../ui/icon_select.ui:103 +msgid "Icon Theme" +msgstr "Tema de iconos" + +#: ../ui/icon_select.ui:123 +msgid "Custom Icon" +msgstr "Icono personalizado" + +#: ../ui/rename_pie.ui:8 +msgid "Rename a Pie" +msgstr "Renombrar un Pastel" + +#: ../ui/preferences.ui:7 msgid "Gnome-Pie Settings" msgstr "Configuraciones de Gnome-Pie" -#: ../ui/preferences.ui:261 +#: ../ui/preferences.ui:27 ../ui/settings.ui:8 +msgid "General Settings" +msgstr "Configuraciones Generales" + +#: ../ui/preferences.ui:266 msgid "" "This Pie is empty!\n" "\n" "Start adding Slices to it! This can be done by dragging stuff to the " "plus sign below. You can try a lot! For example application launchers or " -"folders. Even URLs from your browser are possible... \n" +"folders. Even URLs from your browser are possible...\n" "\n" "For manual and advanced configuration click on the plus sign." msgstr "" "Un Pastel vacío!\n" "\n" -"Empieza añadiendo Rebanadas! Puedes hacerlo añadiendo cosas al signo " +"Empieza añadiendo Rebanadas! Puedes hacerlo arrastrando cosas al signo " "más. Puedes intentar muchas cosas! Por ejemplo lanzadores de aplicaciones o " -"directorios. Incluso puedes añadir URLs desde tu navegador... \n" +"directorios. Incluso puedes añadir URLs desde tu navegador...\n" "\n" "Para configuración manual y avanzada, click en el signo más." -#: ../ui/preferences.ui:282 +#: ../ui/preferences.ui:287 msgid "" "You have no Pies!\n" "\n" @@ -494,12 +514,53 @@ msgstr "" "Empieza por crear uno! Puedes hacerlo haciendo click en el pequeño " "signo más en la esquina inferior izquierda." -#: ../ui/rename_pie.ui:8 -msgid "Rename a Pie" -msgstr "Renombrar un Pastel" +#: ../ui/settings.ui:75 +msgid "Start Gnome-Pie on login" +msgstr "Arrancar Gnome-Pie al inicio" + +#: ../ui/settings.ui:81 ../ui/settings.ui:82 +msgid "If checked, Gnome-Pie will start silently everytime you log in." +msgstr "Gnome-Pie se iniciará en silencio cada vez que inicies sesión." + +#: ../ui/settings.ui:94 +msgid "Display panel icon " +msgstr "Mostrar panel de íconos " + +#: ../ui/settings.ui:100 ../ui/settings.ui:101 +msgid "" +"If not checked, you can access this menu by launching Gnome-Pie a second " +"time." +msgstr "Si no esta activado, puedes acceder a este menú lanzando Gnome-Pie " +"por segunda vez." + +#: ../ui/settings.ui:119 +msgid "Behavior" +msgstr "Comportamiento" + +#: ../ui/settings.ui:178 +msgid "Global scale" +msgstr "Escala Global" + +#: ../ui/settings.ui:217 +msgid "Maximum slices per pie" +msgstr "Máximo de Rebanadas por Pastel" + +#: ../ui/settings.ui:256 +msgid "Maximum activation radius" +msgstr "Radio máximo de activación" + +#: ../ui/settings.ui:287 +msgid "Display Slice labels" +msgstr "Mostrar etiquetas en las Rebanadas" + +#: ../ui/settings.ui:293 ../ui/settings.ui:294 +msgid "" +"Displays the name of each Slice next to it. Only available if supported by " +"the theme." +msgstr "" +"Mostrar el nombre de cada Rebanada. Sólo si es soportado por el Tema." -#~ msgid "Suspend" -#~ msgstr "Suspender" +#: ../ui/settings.ui:312 +msgid "Appearance" +msgstr "Apariencia" -#~ msgid "Hibernate" -#~ msgstr "Hibernar" diff --git a/resources/locale/es/LC_MESSAGES/gnomepie.mo b/resources/locale/es/LC_MESSAGES/gnomepie.mo index 9b22914..63ef92f 100644 Binary files a/resources/locale/es/LC_MESSAGES/gnomepie.mo and b/resources/locale/es/LC_MESSAGES/gnomepie.mo differ diff --git a/resources/locale/gnomepie.pot b/resources/locale/gnomepie.pot index 9684268..b87c651 100644 --- a/resources/locale/gnomepie.pot +++ b/resources/locale/gnomepie.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: gnomepie 0.4\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-29 16:07-0300\n" +"POT-Creation-Date: 2015-04-07 08:55+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -25,22 +25,6 @@ msgstr "" msgid "Simulates the activation of a hotkey." msgstr "" -#: ../../src/actions/pieAction.vala:34 -msgid "Open Pie" -msgstr "" - -#: ../../src/actions/pieAction.vala:36 -msgid "Opens another Pie of Gnome-Pie. You may create sub menus this way." -msgstr "" - -#: ../../src/actions/appAction.vala:34 -msgid "Launch application" -msgstr "" - -#: ../../src/actions/appAction.vala:36 -msgid "Executes the given command." -msgstr "" - #: ../../src/actions/uriAction.vala:34 msgid "Open URI" msgstr "" @@ -53,199 +37,188 @@ msgstr "" msgid "Trash" msgstr "" -#: ../../src/utilities/trigger.vala:163 -msgid "Button %i" -msgstr "" - -#: ../../src/utilities/trigger.vala:166 -msgid "LeftButton" -msgstr "" - -#: ../../src/utilities/trigger.vala:168 -msgid "RightButton" +#: ../../src/actions/appAction.vala:34 +msgid "Launch application" msgstr "" -#: ../../src/utilities/trigger.vala:170 -msgid "MiddleButton" +#: ../../src/actions/appAction.vala:36 +msgid "Executes the given command." msgstr "" -#: ../../src/utilities/trigger.vala:188 ../../src/utilities/trigger.vala:190 -#: ../../src/utilities/trigger.vala:192 ../../src/utilities/trigger.vala:196 -msgid "Turbo" +#: ../../src/actions/pieAction.vala:34 +msgid "Open Pie" msgstr "" -#: ../../src/utilities/trigger.vala:188 ../../src/utilities/trigger.vala:192 -#: ../../src/utilities/trigger.vala:194 ../../src/utilities/trigger.vala:198 -msgid "Delayed" +#: ../../src/actions/pieAction.vala:36 +msgid "Opens another Pie of Gnome-Pie. You may create sub menus this way." msgstr "" -#: ../../src/utilities/trigger.vala:188 ../../src/utilities/trigger.vala:190 -#: ../../src/utilities/trigger.vala:194 ../../src/utilities/trigger.vala:200 -msgid "Centered" +#: ../../src/gui/preferencesWindow.vala:166 +msgid "No Pie selected." msgstr "" -#: ../../src/utilities/trigger.vala:212 ../../src/utilities/trigger.vala:213 -#: ../../src/utilities/key.vala:65 ../../src/utilities/bindingManager.vala:161 -msgid "Not bound" +#: ../../src/gui/preferencesWindow.vala:206 +msgid "New Pie" msgstr "" -#: ../../src/pies/defaultConfig.vala:29 -msgid "Multimedia" +#: ../../src/gui/preferencesWindow.vala:219 +msgid "" +"Do you really want to delete the selected Pie with all contained Slices?" msgstr "" -#: ../../src/pies/defaultConfig.vala:30 -msgid "Next Track" +#: ../../src/gui/triggerSelectWindow.vala:226 +msgid "" +"This hotkey is already assigned to the pie \"%s\"! \n" +"\n" +"Please select another one or cancel your selection." msgstr "" -#: ../../src/pies/defaultConfig.vala:31 -msgid "Stop" +#: ../../src/gui/piePreview.vala:148 +msgid "Do you really want to delete this Slice?" msgstr "" -#: ../../src/pies/defaultConfig.vala:32 -msgid "Previous Track" +#: ../../src/gui/sliceTypeList.vala:60 +msgid "Slice types" msgstr "" -#: ../../src/pies/defaultConfig.vala:33 -msgid "Play/Pause" +#: ../../src/gui/piePreviewRenderer.vala:419 +msgid "Click to edit" msgstr "" -#: ../../src/pies/defaultConfig.vala:36 -#: ../../src/gui/iconSelectWindow.vala:187 -msgid "Applications" +#: ../../src/gui/piePreviewRenderer.vala:419 +#: ../../src/gui/piePreviewRenderer.vala:434 +msgid "Drag to move" msgstr "" -#: ../../src/pies/defaultConfig.vala:45 -msgid "Bookmarks" +#: ../../src/gui/piePreviewRenderer.vala:422 +msgid "Click to add a new Slice" msgstr "" -#: ../../src/pies/defaultConfig.vala:50 -msgid "Session" +#: ../../src/gui/piePreviewRenderer.vala:426 +msgid "Drop to add as new Slice" msgstr "" -#: ../../src/pies/defaultConfig.vala:54 -msgid "Main Menu" +#: ../../src/gui/piePreviewRenderer.vala:429 +msgid "Drop to move Slice" msgstr "" -#: ../../src/pies/defaultConfig.vala:58 -msgid "Window" +#: ../../src/gui/piePreviewRenderer.vala:434 +msgid "Click to delete" msgstr "" -#: ../../src/pies/defaultConfig.vala:59 -msgid "Scale" +#: ../../src/gui/iconSelectWindow.vala:182 +msgid "All icons" msgstr "" -#: ../../src/pies/defaultConfig.vala:60 -msgid "Minimize" +#: ../../src/gui/iconSelectWindow.vala:183 +#: ../../src/pies/defaultConfig.vala:36 +msgid "Applications" msgstr "" -#: ../../src/pies/defaultConfig.vala:61 -msgid "Close" +#: ../../src/gui/iconSelectWindow.vala:184 +msgid "Actions" msgstr "" -#: ../../src/pies/defaultConfig.vala:62 -msgid "Maximize" +#: ../../src/gui/iconSelectWindow.vala:185 +msgid "Places" msgstr "" -#: ../../src/pies/defaultConfig.vala:63 -msgid "Restore" +#: ../../src/gui/iconSelectWindow.vala:186 +msgid "File types" msgstr "" -#: ../../src/gui/piePreview.vala:155 -msgid "Do you really want to delete this Slice?" +#: ../../src/gui/iconSelectWindow.vala:187 +msgid "Emotes" msgstr "" -#: ../../src/gui/themeList.vala:62 -msgid "Themes" +#: ../../src/gui/iconSelectWindow.vala:188 +msgid "Miscellaneous" msgstr "" -#: ../../src/gui/themeList.vala:99 -msgid "By" +#: ../../src/gui/iconSelectWindow.vala:261 +msgid "All supported image formats" msgstr "" #: ../../src/gui/newSliceWindow.vala:291 msgid "Rename me!" msgstr "" -#: ../../src/gui/triggerSelectWindow.vala:166 -msgid "" -"This hotkey is already assigned to the pie \"%s\"! \n" -"\n" -"Please select another one or cancel your selection." +#: ../../src/gui/themeList.vala:62 +msgid "Themes" msgstr "" -#: ../../src/gui/piePreviewRenderer.vala:412 -msgid "Click to edit" +#: ../../src/gui/themeList.vala:99 +msgid "By" msgstr "" -#: ../../src/gui/piePreviewRenderer.vala:412 -#: ../../src/gui/piePreviewRenderer.vala:427 -msgid "Drag to move" +#: ../../src/gui/indicator.vala:114 +msgid "_Preferences" msgstr "" -#: ../../src/gui/piePreviewRenderer.vala:415 -msgid "Click to add a new Slice" +#: ../../src/gui/indicator.vala:123 +msgid "_About" msgstr "" -#: ../../src/gui/piePreviewRenderer.vala:419 -msgid "Drop to add as new Slice" +#: ../../src/gui/indicator.vala:138 +msgid "_Quit" msgstr "" -#: ../../src/gui/piePreviewRenderer.vala:422 -msgid "Drop to move Slice" +#: ../../src/gui/newsWindow.vala:64 +msgid "_Close" msgstr "" -#: ../../src/gui/piePreviewRenderer.vala:427 -msgid "Click to delete" +#: ../../src/gui/triggerSelectButton.vala:64 +msgid "Press a hotkey ..." msgstr "" -#: ../../src/gui/preferencesWindow.vala:175 -msgid "No Pie selected." +#: ../../src/utilities/key.vala:65 ../../src/utilities/bindingManager.vala:177 +#: ../../src/utilities/trigger.vala:195 ../../src/utilities/trigger.vala:280 +#: ../../src/utilities/trigger.vala:281 +msgid "Not bound" msgstr "" -#: ../../src/gui/preferencesWindow.vala:215 -msgid "New Pie" +#: ../../src/utilities/trigger.vala:182 +msgid "Button %i" msgstr "" -#: ../../src/gui/preferencesWindow.vala:228 -msgid "" -"Do you really want to delete the selected Pie with all contained Slices?" +#: ../../src/utilities/trigger.vala:185 +msgid "LeftButton" msgstr "" -#: ../../src/gui/triggerSelectButton.vala:63 -msgid "Press a hotkey ..." +#: ../../src/utilities/trigger.vala:187 +msgid "RightButton" msgstr "" -#: ../../src/gui/sliceTypeList.vala:60 -msgid "Slice types" +#: ../../src/utilities/trigger.vala:189 +msgid "MiddleButton" msgstr "" -#: ../../src/gui/iconSelectWindow.vala:186 -msgid "All icons" +#: ../../src/utilities/trigger.vala:216 +msgid "Turbo" msgstr "" -#: ../../src/gui/iconSelectWindow.vala:188 -msgid "Actions" +#: ../../src/utilities/trigger.vala:220 ../../src/utilities/trigger.vala:222 +msgid "Delayed" msgstr "" -#: ../../src/gui/iconSelectWindow.vala:189 -msgid "Places" +#: ../../src/utilities/trigger.vala:226 ../../src/utilities/trigger.vala:228 +msgid "Centered" msgstr "" -#: ../../src/gui/iconSelectWindow.vala:190 -msgid "File types" +#: ../../src/utilities/trigger.vala:232 ../../src/utilities/trigger.vala:234 +msgid "Warp" msgstr "" -#: ../../src/gui/iconSelectWindow.vala:191 -msgid "Emotes" +#: ../../src/utilities/trigger.vala:238 ../../src/utilities/trigger.vala:240 +msgid "Auto-shaped" msgstr "" -#: ../../src/gui/iconSelectWindow.vala:192 -msgid "Miscellaneous" +#: ../../src/utilities/trigger.vala:243 ../../src/utilities/trigger.vala:245 +msgid "Quarter pie" msgstr "" -#: ../../src/gui/iconSelectWindow.vala:267 -#: ../../src/gui/iconSelectWindow.vala:269 -msgid "All supported image formats" +#: ../../src/utilities/trigger.vala:249 ../../src/utilities/trigger.vala:251 +msgid "Half pie" msgstr "" #: ../../src/actionGroups/windowListGroup.vala:34 @@ -256,6 +229,14 @@ msgstr "" msgid "Shows a Slice for each of your opened Windows. Almost like Alt-Tab." msgstr "" +#: ../../src/actionGroups/clipboardGroup.vala:64 +msgid "Group: Clipboard" +msgstr "" + +#: ../../src/actionGroups/clipboardGroup.vala:66 +msgid "Manages your Clipboard." +msgstr "" + #: ../../src/actionGroups/devicesGroup.vala:35 msgid "Group: Devices" msgstr "" @@ -268,12 +249,12 @@ msgstr "" msgid "Root" msgstr "" -#: ../../src/actionGroups/bookmarkGroup.vala:36 -msgid "Group: Bookmarks" +#: ../../src/actionGroups/menuGroup.vala:35 +msgid "Group: Main menu" msgstr "" -#: ../../src/actionGroups/bookmarkGroup.vala:38 -msgid "Shows a Slice for each of your directory Bookmarks." +#: ../../src/actionGroups/menuGroup.vala:37 +msgid "Displays your main menu structure." msgstr "" #: ../../src/actionGroups/sessionGroup.vala:35 @@ -296,78 +277,147 @@ msgstr "" msgid "Reboot" msgstr "" -#: ../../src/actionGroups/menuGroup.vala:35 -msgid "Group: Main menu" +#: ../../src/actionGroups/bookmarkGroup.vala:36 +msgid "Group: Bookmarks" msgstr "" -#: ../../src/actionGroups/menuGroup.vala:37 -msgid "Displays your main menu structure." +#: ../../src/actionGroups/bookmarkGroup.vala:38 +msgid "Shows a Slice for each of your directory Bookmarks." msgstr "" -#: ../../src/actionGroups/clipboardGroup.vala:64 -msgid "Group: Clipboard" +#: ../../src/pies/defaultConfig.vala:29 +msgid "Multimedia" msgstr "" -#: ../../src/actionGroups/clipboardGroup.vala:66 -msgid "Manages your Clipboard." +#: ../../src/pies/defaultConfig.vala:30 +msgid "Next Track" msgstr "" -#: ../ui/icon_select.ui:8 -msgid "Select an icon" +#: ../../src/pies/defaultConfig.vala:31 +msgid "Stop" msgstr "" -#: ../ui/icon_select.ui:85 -msgid "Icon Theme" +#: ../../src/pies/defaultConfig.vala:32 +msgid "Previous Track" msgstr "" -#: ../ui/icon_select.ui:105 -msgid "Custom Icon" +#: ../../src/pies/defaultConfig.vala:33 +msgid "Play/Pause" msgstr "" -#: ../ui/rename_pie.ui:8 -msgid "Rename a Pie" +#: ../../src/pies/defaultConfig.vala:45 +msgid "Bookmarks" msgstr "" -#: ../ui/preferences.ui:8 -msgid "Gnome-Pie Settings" +#: ../../src/pies/defaultConfig.vala:50 +msgid "Session" msgstr "" -#: ../ui/preferences.ui:27 ../ui/settings.ui:9 -msgid "General Settings" +#: ../../src/pies/defaultConfig.vala:54 +msgid "Main Menu" +msgstr "" + +#: ../../src/pies/defaultConfig.vala:58 +msgid "Window" +msgstr "" + +#: ../../src/pies/defaultConfig.vala:59 +msgid "Scale" +msgstr "" + +#: ../../src/pies/defaultConfig.vala:60 +msgid "Minimize" +msgstr "" + +#: ../../src/pies/defaultConfig.vala:61 +msgid "Close" +msgstr "" + +#: ../../src/pies/defaultConfig.vala:62 +msgid "Maximize" +msgstr "" + +#: ../../src/pies/defaultConfig.vala:63 +msgid "Restore" +msgstr "" + +#: ../ui/trigger_select.ui:53 +msgid "Activation Settings" +msgstr "" + +#: ../ui/trigger_select.ui:132 +msgid "It's possible to bind mouse buttons as well!" +msgstr "" + +#: ../ui/trigger_select.ui:165 +msgid "Turbo mode" +msgstr "" + +#: ../ui/trigger_select.ui:171 ../ui/trigger_select.ui:172 +msgid "If checked, the Pie will close when you release the chosen hot key." msgstr "" -#: ../ui/preferences.ui:261 +#: ../ui/trigger_select.ui:184 +msgid "Long press for activation" +msgstr "" + +#: ../ui/trigger_select.ui:190 ../ui/trigger_select.ui:191 msgid "" -"This Pie is empty!\n" -"\n" -"Start adding Slices to it! This can be done by dragging stuff to the " -"plus sign below. You can try a lot! For example application launchers or " -"folders. Even URLs from your browser are possible... \n" -"\n" -"For manual and advanced configuration click on the plus sign." +"If checked, the Pie will only open if you press this hot key a bit longer." msgstr "" -#: ../ui/preferences.ui:282 +#: ../ui/trigger_select.ui:203 +msgid "Open Pie centered on the screen" +msgstr "" + +#: ../ui/trigger_select.ui:209 ../ui/trigger_select.ui:210 msgid "" -"You have no Pies!\n" -"\n" -"Start by creating one! This can be done by clicking on the tiny little " -"plus sign in the lower left corner." +"If checked, the Pie will open in the middle of your screen. Else it will pop " +"up at your pointer." +msgstr "" + +#: ../ui/trigger_select.ui:222 +msgid "Warp mouse pointer to center of Pie" +msgstr "" + +#: ../ui/trigger_select.ui:228 ../ui/trigger_select.ui:229 +msgid "" +"If checked, the mouse pointer will be warped to the center of the Pie. This " +"allows for quick selections even if the Pie is opened at the screen's " +"boundary." +msgstr "" + +#: ../ui/trigger_select.ui:247 +msgid "Activation options" +msgstr "" + +#: ../ui/trigger_select.ui:438 +msgid "Automatically select the best pie shape" msgstr "" -#: ../ui/slice_select.ui:9 +#: ../ui/trigger_select.ui:442 +msgid "" +"If checked, the shape will be automatically selected to minimize mouse " +"travelling." +msgstr "" + +#: ../ui/trigger_select.ui:462 +msgid "Pie shape" +msgstr "" + +#: ../ui/slice_select.ui:8 msgid "Slice Options" msgstr "" -#: ../ui/slice_select.ui:139 +#: ../ui/slice_select.ui:141 msgid "There are no options for this Slice type." msgstr "" -#: ../ui/slice_select.ui:165 +#: ../ui/slice_select.ui:167 msgid "Name of the Slice " msgstr "" -#: ../ui/slice_select.ui:204 +#: ../ui/slice_select.ui:205 msgid "URI to open" msgstr "" @@ -375,15 +425,15 @@ msgstr "" msgid "Command to execute" msgstr "" -#: ../ui/slice_select.ui:282 +#: ../ui/slice_select.ui:281 msgid "Hotkey to press" msgstr "" -#: ../ui/slice_select.ui:311 +#: ../ui/slice_select.ui:310 msgid "Pie to open" msgstr "" -#: ../ui/slice_select.ui:340 +#: ../ui/slice_select.ui:339 msgid "Is Quick Action" msgstr "" @@ -391,85 +441,97 @@ msgstr "" msgid "This Slice will be executed when you click in the middle of the Pie." msgstr "" -#: ../ui/slice_select.ui:388 +#: ../ui/slice_select.ui:387 msgid "Slice options" msgstr "" -#: ../ui/settings.ui:74 -msgid "Start Gnome-Pie on login" +#: ../ui/icon_select.ui:9 +msgid "Select an icon" msgstr "" -#: ../ui/settings.ui:79 ../ui/settings.ui:80 -msgid "If checked, Gnome-Pie will start silently everytime you log in." +#: ../ui/icon_select.ui:103 +msgid "Icon Theme" msgstr "" -#: ../ui/settings.ui:93 -msgid "Display panel icon " +#: ../ui/icon_select.ui:123 +msgid "Custom Icon" msgstr "" -#: ../ui/settings.ui:98 ../ui/settings.ui:99 -msgid "" -"If not checked, you can access this menu by launching Gnome-Pie a second " -"time." +#: ../ui/rename_pie.ui:8 +msgid "Rename a Pie" msgstr "" -#: ../ui/settings.ui:118 -msgid "Behavior" +#: ../ui/preferences.ui:7 +msgid "Gnome-Pie Settings" msgstr "" -#: ../ui/settings.ui:175 -msgid "Global scale" +#: ../ui/preferences.ui:27 ../ui/settings.ui:8 +msgid "General Settings" msgstr "" -#: ../ui/settings.ui:207 -msgid "Display Slice labels" +#: ../ui/preferences.ui:266 +msgid "" +"This Pie is empty!\n" +"\n" +"Start adding Slices to it! This can be done by dragging stuff to the " +"plus sign below. You can try a lot! For example application launchers or " +"folders. Even URLs from your browser are possible...\n" +"\n" +"For manual and advanced configuration click on the plus sign." msgstr "" -#: ../ui/settings.ui:212 ../ui/settings.ui:213 +#: ../ui/preferences.ui:287 msgid "" -"Displays the name of each Slice next to it. Only available if supported by " -"the theme." +"You have no Pies!\n" +"\n" +"Start by creating one! This can be done by clicking on the tiny little " +"plus sign in the lower left corner." msgstr "" -#: ../ui/settings.ui:232 -msgid "Appearance" +#: ../ui/settings.ui:75 +msgid "Start Gnome-Pie on login" msgstr "" -#: ../ui/trigger_select.ui:8 -msgid "Activation Settings" +#: ../ui/settings.ui:81 ../ui/settings.ui:82 +msgid "If checked, Gnome-Pie will start silently everytime you log in." msgstr "" -#: ../ui/trigger_select.ui:86 -msgid "It's possible to bind mouse buttons as well!" +#: ../ui/settings.ui:94 +msgid "Display panel icon " msgstr "" -#: ../ui/trigger_select.ui:118 -msgid "Turbo mode" +#: ../ui/settings.ui:100 ../ui/settings.ui:101 +msgid "" +"If not checked, you can access this menu by launching Gnome-Pie a second " +"time." msgstr "" -#: ../ui/trigger_select.ui:123 ../ui/trigger_select.ui:124 -msgid "If checked, the Pie will close when you release the chosen hot key." +#: ../ui/settings.ui:119 +msgid "Behavior" msgstr "" -#: ../ui/trigger_select.ui:137 -msgid "Long press for activation" +#: ../ui/settings.ui:178 +msgid "Global scale" msgstr "" -#: ../ui/trigger_select.ui:142 ../ui/trigger_select.ui:143 -msgid "" -"If checked, the Pie will only open if you press this hot key a bit longer." +#: ../ui/settings.ui:217 +msgid "Maximum slices per pie" msgstr "" -#: ../ui/trigger_select.ui:156 -msgid "Open Pie centered on the screen" +#: ../ui/settings.ui:256 +msgid "Maximum activation radius" msgstr "" -#: ../ui/trigger_select.ui:161 ../ui/trigger_select.ui:162 +#: ../ui/settings.ui:287 +msgid "Display Slice labels" +msgstr "" + +#: ../ui/settings.ui:293 ../ui/settings.ui:294 msgid "" -"If checked, the Pie will open in the middle of your screen. Else it will pop " -"up at your pointer." +"Displays the name of each Slice next to it. Only available if supported by " +"the theme." msgstr "" -#: ../ui/trigger_select.ui:181 -msgid "Activation options" +#: ../ui/settings.ui:312 +msgid "Appearance" msgstr "" diff --git a/resources/themes/adwaita/arrow.svg b/resources/themes/adwaita/arrow.svg index 4b81a6d..d6e0e84 100644 --- a/resources/themes/adwaita/arrow.svg +++ b/resources/themes/adwaita/arrow.svg @@ -14,7 +14,7 @@ height="100" id="svg2" version="1.1" - inkscape:version="0.48.1 r9760" + inkscape:version="0.48.4 r9939" sodipodi:docname="arrow.svg"> @@ -76,8 +76,8 @@ inkscape:pageopacity="1" inkscape:pageshadow="2" inkscape:zoom="11.2" - inkscape:cx="77.449971" - inkscape:cy="47.388963" + inkscape:cx="93.12865" + inkscape:cy="42.239723" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" @@ -86,13 +86,17 @@ inkscape:guide-bbox="true" inkscape:window-width="1174" inkscape:window-height="737" - inkscape:window-x="552" - inkscape:window-y="163" + inkscape:window-x="225" + inkscape:window-y="142" inkscape:window-maximized="0"> + @@ -112,10 +116,14 @@ id="layer1" transform="translate(0,-952.36218)"> + sodipodi:type="arc" + style="fill:#efefef;fill-opacity:1;stroke:none" + id="path3765" + sodipodi:cx="83.125" + sodipodi:cy="50" + sodipodi:rx="16.696428" + sodipodi:ry="16.696428" + d="m 99.821428,50 a 16.696428,16.696428 0 1 1 -33.392856,0 16.696428,16.696428 0 1 1 33.392856,0 z" + transform="matrix(0.47058823,0,0,0.47058823,44.007354,978.83277)" /> diff --git a/resources/themes/adwaita/arrow_bg.svg b/resources/themes/adwaita/arrow_bg.svg new file mode 100644 index 0000000..128deb7 --- /dev/null +++ b/resources/themes/adwaita/arrow_bg.svg @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/adwaita/icon.svg b/resources/themes/adwaita/icon.svg new file mode 100644 index 0000000..577fc54 --- /dev/null +++ b/resources/themes/adwaita/icon.svg @@ -0,0 +1,245 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/resources/themes/adwaita/icon_active.svg b/resources/themes/adwaita/icon_active.svg deleted file mode 100644 index 8393747..0000000 --- a/resources/themes/adwaita/icon_active.svg +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - diff --git a/resources/themes/adwaita/icon_highlight.svg b/resources/themes/adwaita/icon_highlight.svg new file mode 100644 index 0000000..16019c8 --- /dev/null +++ b/resources/themes/adwaita/icon_highlight.svg @@ -0,0 +1,248 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/adwaita/icon_inactive.svg b/resources/themes/adwaita/icon_inactive.svg deleted file mode 100644 index 1120dc9..0000000 --- a/resources/themes/adwaita/icon_inactive.svg +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - diff --git a/resources/themes/adwaita/preview.png b/resources/themes/adwaita/preview.png index d8dd27a..f104653 100644 Binary files a/resources/themes/adwaita/preview.png and b/resources/themes/adwaita/preview.png differ diff --git a/resources/themes/adwaita/ring.svg b/resources/themes/adwaita/ring.svg index acc7c61..7973fb3 100644 --- a/resources/themes/adwaita/ring.svg +++ b/resources/themes/adwaita/ring.svg @@ -14,30 +14,18 @@ height="100" id="svg2" version="1.1" - inkscape:version="0.48.1 r9760" + inkscape:version="0.48.4 r9939" sodipodi:docname="ring.svg"> - - - - @@ -177,15 +165,6 @@ r="49.47143" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.194041,0,0,1.1819698,-9.7020495,-9.098491)" /> - + + + + inkscape:window-y="30" + inkscape:window-maximized="0" /> @@ -235,24 +222,24 @@ id="layer1" transform="translate(0,-952.36218)"> + sodipodi:ry="48.57143" + sodipodi:rx="48.57143" + sodipodi:cy="50" + sodipodi:cx="50" + id="path3792" + style="fill:#000000;fill-opacity:0.43529412;stroke:none;filter:url(#filter3801)" + sodipodi:type="arc" /> diff --git a/resources/themes/adwaita/theme.xml b/resources/themes/adwaita/theme.xml index d7e2d04..6805ad0 100644 --- a/resources/themes/adwaita/theme.xml +++ b/resources/themes/adwaita/theme.xml @@ -1,31 +1,29 @@ - -
- +
+ -
- + - + + - + - + - + - + diff --git a/resources/themes/bright/gloss.svg b/resources/themes/bright/gloss.svg index 60a795f..7828bc9 100644 --- a/resources/themes/bright/gloss.svg +++ b/resources/themes/bright/gloss.svg @@ -14,10 +14,84 @@ height="100" id="svg2" version="1.1" - inkscape:version="0.48.1 r9760" + inkscape:version="0.48.4 r9939" sodipodi:docname="gloss.svg"> + + + + + + + + + + + + + + + + + + + + + + + @@ -34,7 +108,7 @@ inkscape:collect="always" id="linearGradient3772"> + + + + + inkscape:window-y="30" + inkscape:window-maximized="0" /> @@ -130,27 +244,63 @@ transform="translate(0,-952.36218)" style="display:inline"> + width="93.954247" + height="93.954247" + x="3.1132965" + y="955.36566" + ry="6.2805519" + rx="6.2805519" /> + width="92.571426" + height="54.321426" + x="3.7857144" + y="956.07648" + rx="6.083446" + ry="5.366394" /> + + + + diff --git a/resources/themes/bright/preview.png b/resources/themes/bright/preview.png index babbafa..5e17ca5 100644 Binary files a/resources/themes/bright/preview.png and b/resources/themes/bright/preview.png differ diff --git a/resources/themes/elementary/arrow.svg b/resources/themes/elementary/arrow.svg new file mode 100644 index 0000000..708089e --- /dev/null +++ b/resources/themes/elementary/arrow.svg @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/resources/themes/elementary/preview.png b/resources/themes/elementary/preview.png index 4825ba1..67e91ad 100644 Binary files a/resources/themes/elementary/preview.png and b/resources/themes/elementary/preview.png differ diff --git a/resources/themes/elementary/ring.svg b/resources/themes/elementary/ring.svg index 379a8db..ce05f78 100644 --- a/resources/themes/elementary/ring.svg +++ b/resources/themes/elementary/ring.svg @@ -14,7 +14,7 @@ height="100" id="svg2" version="1.1" - inkscape:version="0.48.2 r9819" + inkscape:version="0.48.4 r9939" sodipodi:docname="ring.svg"> @@ -69,27 +69,11 @@ r="49.750011" /> + id="filter3769"> - - - + stdDeviation="3.063616" + id="feGaussianBlur3771" /> @@ -121,7 +105,7 @@ image/svg+xml - + @@ -131,24 +115,24 @@ id="layer1" transform="translate(0,-952.36218)"> + sodipodi:ry="49.017857" + sodipodi:rx="49.017857" + sodipodi:cy="49.910713" + sodipodi:cx="50.089287" + id="path3767" + style="fill:#f5f5f5;fill-opacity:1;stroke:#000000;stroke-opacity:0.38674033000000002;stroke-width:0.57717301;stroke-miterlimit:4;stroke-dasharray:none" + sodipodi:type="arc" /> diff --git a/resources/themes/elementary/theme.xml b/resources/themes/elementary/theme.xml index 0667707..0286f21 100644 --- a/resources/themes/elementary/theme.xml +++ b/resources/themes/elementary/theme.xml @@ -1,27 +1,30 @@ - -
- +
+ +
- + - + - + diff --git a/resources/themes/simple/preview.png b/resources/themes/simple/preview.png new file mode 100644 index 0000000..c75ff2e Binary files /dev/null and b/resources/themes/simple/preview.png differ diff --git a/resources/themes/simple/slice_caption.svg b/resources/themes/simple/slice_caption.svg new file mode 100644 index 0000000..d2aa2cb --- /dev/null +++ b/resources/themes/simple/slice_caption.svg @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/simple/theme.xml b/resources/themes/simple/theme.xml new file mode 100644 index 0000000..88aba34 --- /dev/null +++ b/resources/themes/simple/theme.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + diff --git a/resources/themes/unity/gloss.svg b/resources/themes/unity/gloss.svg index 60a795f..7828bc9 100644 --- a/resources/themes/unity/gloss.svg +++ b/resources/themes/unity/gloss.svg @@ -14,10 +14,84 @@ height="100" id="svg2" version="1.1" - inkscape:version="0.48.1 r9760" + inkscape:version="0.48.4 r9939" sodipodi:docname="gloss.svg"> + + + + + + + + + + + + + + + + + + + + + + + @@ -34,7 +108,7 @@ inkscape:collect="always" id="linearGradient3772"> + + + + + inkscape:window-y="30" + inkscape:window-maximized="0" /> @@ -130,27 +244,63 @@ transform="translate(0,-952.36218)" style="display:inline"> + width="93.954247" + height="93.954247" + x="3.1132965" + y="955.36566" + ry="6.2805519" + rx="6.2805519" /> + width="92.571426" + height="54.321426" + x="3.7857144" + y="956.07648" + rx="6.083446" + ry="5.366394" /> + + + + diff --git a/resources/themes/unity/preview.png b/resources/themes/unity/preview.png index 058f558..7ad2a64 100644 Binary files a/resources/themes/unity/preview.png and b/resources/themes/unity/preview.png differ diff --git a/resources/themes/unity/ring.svg b/resources/themes/unity/ring.svg index 1fb2dcd..8177eab 100644 --- a/resources/themes/unity/ring.svg +++ b/resources/themes/unity/ring.svg @@ -14,7 +14,7 @@ height="100" id="svg2" version="1.1" - inkscape:version="0.48.1 r9760" + inkscape:version="0.48.4 r9939" sodipodi:docname="ring.svg"> @@ -149,20 +149,20 @@ borderopacity="1.0" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:zoom="3.959798" - inkscape:cx="-48.85178" - inkscape:cy="58.882718" + inkscape:zoom="5.6" + inkscape:cx="58.266215" + inkscape:cy="49.681706" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" inkscape:showpageshadow="false" showguides="true" inkscape:guide-bbox="true" - inkscape:window-width="1920" - inkscape:window-height="1056" - inkscape:window-x="0" - inkscape:window-y="24" - inkscape:window-maximized="1" /> + inkscape:window-width="958" + inkscape:window-height="1024" + inkscape:window-x="960" + inkscape:window-y="30" + inkscape:window-maximized="0" /> @@ -181,14 +181,14 @@ id="layer1" transform="translate(0,-952.36218)"> + transform="matrix(0.81543425,0,0,0.81543425,9.2282872,961.59046)" /> diff --git a/resources/themes/unity/theme.xml b/resources/themes/unity/theme.xml index 3e9f3d1..6bf9cc8 100644 --- a/resources/themes/unity/theme.xml +++ b/resources/themes/unity/theme.xml @@ -2,7 +2,7 @@ + fadeInTime="0.3" fadeOutTime="0.3" fadeInZoom="1.5" fadeOutZoom="0.7" fadeInRotation="0.2" fadeOutRotation="-0.3">
+ False 5 General Settings - True True center-on-parent True dialog - False 550 @@ -24,10 +23,10 @@ gtk-close + False True True True - False True @@ -46,10 +45,10 @@ - vertical True False 6 + vertical 6 @@ -67,20 +66,20 @@ 6 - vertical True False + vertical 6 Start Gnome-Pie on login + False True True False True If checked, Gnome-Pie will start silently everytime you log in. If checked, Gnome-Pie will start silently everytime you log in. - False 0 True @@ -93,13 +92,13 @@ Display panel icon + False True True False True If not checked, you can access this menu by launching Gnome-Pie a second time. If not checked, you can access this menu by launching Gnome-Pie a second time. - False 0 True @@ -146,9 +145,9 @@ 6 - vertical True False + vertical 6 @@ -170,16 +169,17 @@ True False - 6 + True True False + start Global scale False - False + True 0 @@ -190,7 +190,6 @@ 2 2 2 - right True @@ -209,16 +208,56 @@ True False - 6 + True True False + start + Maximum slices per pie + + + False + True + 0 + + + + + True + True + 2000 + 0 + 0 + + + True + True + 1 + + + + + False + True + 2 + + + + + True + False + True + + + True + False + start Maximum activation radius False - False + True 0 @@ -229,7 +268,6 @@ 2000 0 0 - right True @@ -241,26 +279,26 @@ False True - 2 + 3 Display Slice labels + False True True False True Displays the name of each Slice next to it. Only available if supported by the theme. Displays the name of each Slice next to it. Only available if supported by the theme. - False 0 True False True - 3 + 4 @@ -268,7 +306,7 @@ - + True False Appearance diff --git a/resources/ui/shapes/shape1.svg b/resources/ui/shapes/shape1.svg new file mode 100644 index 0000000..84ccfc6 --- /dev/null +++ b/resources/ui/shapes/shape1.svg @@ -0,0 +1,128 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/ui/shapes/shape2.svg b/resources/ui/shapes/shape2.svg new file mode 100644 index 0000000..bc252b1 --- /dev/null +++ b/resources/ui/shapes/shape2.svg @@ -0,0 +1,146 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/ui/shapes/shape3.svg b/resources/ui/shapes/shape3.svg new file mode 100644 index 0000000..b0a9816 --- /dev/null +++ b/resources/ui/shapes/shape3.svg @@ -0,0 +1,128 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/ui/shapes/shape4.svg b/resources/ui/shapes/shape4.svg new file mode 100644 index 0000000..5d02413 --- /dev/null +++ b/resources/ui/shapes/shape4.svg @@ -0,0 +1,145 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/ui/shapes/shape5.svg b/resources/ui/shapes/shape5.svg new file mode 100644 index 0000000..7d749b5 --- /dev/null +++ b/resources/ui/shapes/shape5.svg @@ -0,0 +1,176 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/ui/shapes/shape6.svg b/resources/ui/shapes/shape6.svg new file mode 100644 index 0000000..242bad9 --- /dev/null +++ b/resources/ui/shapes/shape6.svg @@ -0,0 +1,145 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/ui/shapes/shape7.svg b/resources/ui/shapes/shape7.svg new file mode 100644 index 0000000..28cecd9 --- /dev/null +++ b/resources/ui/shapes/shape7.svg @@ -0,0 +1,127 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/ui/shapes/shape8.svg b/resources/ui/shapes/shape8.svg new file mode 100644 index 0000000..4a14471 --- /dev/null +++ b/resources/ui/shapes/shape8.svg @@ -0,0 +1,145 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/ui/shapes/shape9.svg b/resources/ui/shapes/shape9.svg new file mode 100644 index 0000000..d51f33c --- /dev/null +++ b/resources/ui/shapes/shape9.svg @@ -0,0 +1,127 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/ui/trigger_select.ui b/resources/ui/trigger_select.ui index d98d889..ab12270 100644 --- a/resources/ui/trigger_select.ui +++ b/resources/ui/trigger_select.ui @@ -2,6 +2,51 @@ + + True + False + shapes/shape1.svg + + + True + False + shapes/shape2.svg + + + True + False + shapes/shape3.svg + + + True + False + shapes/shape4.svg + + + True + False + shapes/shape5.svg + + + True + False + shapes/shape6.svg + + + True + False + shapes/shape7.svg + + + True + False + shapes/shape8.svg + + + True + False + shapes/shape9.svg + False 5 @@ -172,6 +217,25 @@ 2 + + + Warp mouse pointer to center of Pie + False + True + True + False + True + If checked, the mouse pointer will be warped to the center of the Pie. This allows for quick selections even if the Pie is opened at the screen's boundary. + If checked, the mouse pointer will be warped to the center of the Pie. This allows for quick selections even if the Pie is opened at the screen's boundary. + 0 + True + + + False + True + 3 + + @@ -193,6 +257,221 @@ 2 + + + True + False + 0 + in + + + True + False + 6 + 6 + 6 + 6 + + + True + False + vertical + + + True + False + center + 5 + 20 + + + True + True + False + shape1 + 0 + True + True + + + 0 + 0 + + + + + True + True + False + shape2 + 0 + True + True + rshape1 + + + 0 + 1 + + + + + True + True + False + shape3 + 0 + True + True + rshape1 + + + 0 + 2 + + + + + True + True + False + shape4 + 0 + True + True + rshape1 + + + 1 + 0 + + + + + True + True + False + shape5 + 0 + True + True + rshape1 + + + 1 + 1 + + + + + True + True + False + shape6 + 0 + True + True + rshape1 + + + 1 + 2 + + + + + True + True + False + shape7 + 0 + True + True + rshape1 + + + 2 + 0 + + + + + True + True + False + shape8 + 0 + True + True + rshape1 + + + 2 + 1 + + + + + True + True + False + shape9 + 0 + True + True + rshape1 + + + 2 + 2 + + + + + False + True + 0 + + + + + Automatically select the best pie shape + True + True + False + If checked, the shape will be automatically selected to minimize mouse travelling. + 0 + True + True + rshape1 + + + False + True + 1 + + + + + + + + + True + False + Pie shape + + + + + + + + False + True + 3 + + True diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ee08045..af412a6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -33,69 +33,69 @@ add_executable(gnome-pie ${VALA_C}) # install executable install( - TARGETS - gnome-pie - RUNTIME DESTINATION - ${CMAKE_INSTALL_PREFIX}/bin + TARGETS + gnome-pie + RUNTIME DESTINATION + ${CMAKE_INSTALL_PREFIX}/bin ) # install credits install( - FILES - ${CMAKE_SOURCE_DIR}/README.md - DESTINATION - ${CMAKE_INSTALL_PREFIX}/share/doc/gnome-pie + FILES + ${CMAKE_SOURCE_DIR}/README.md + DESTINATION + ${CMAKE_INSTALL_PREFIX}/share/doc/gnome-pie ) # install locales install( - DIRECTORY - ${CMAKE_SOURCE_DIR}/resources/locale - DESTINATION - ${CMAKE_INSTALL_PREFIX}/share - PATTERN *.po EXCLUDE - PATTERN *.pot EXCLUDE - PATTERN *.sh EXCLUDE + DIRECTORY + ${CMAKE_SOURCE_DIR}/resources/locale + DESTINATION + ${CMAKE_INSTALL_PREFIX}/share + PATTERN *.po EXCLUDE + PATTERN *.pot EXCLUDE + PATTERN *.sh EXCLUDE ) # install themes install( - DIRECTORY - ${CMAKE_SOURCE_DIR}/resources/themes - DESTINATION - ${CMAKE_INSTALL_PREFIX}/share/gnome-pie + DIRECTORY + ${CMAKE_SOURCE_DIR}/resources/themes + DESTINATION + ${CMAKE_INSTALL_PREFIX}/share/gnome-pie ) # install UI files install( - DIRECTORY - ${CMAKE_SOURCE_DIR}/resources/ui - DESTINATION - ${CMAKE_INSTALL_PREFIX}/share/gnome-pie + DIRECTORY + ${CMAKE_SOURCE_DIR}/resources/ui + DESTINATION + ${CMAKE_INSTALL_PREFIX}/share/gnome-pie ) # install icons install( - FILES - ${CMAKE_SOURCE_DIR}/resources/gnome-pie.svg - ${CMAKE_SOURCE_DIR}/resources/gnome-pie-symbolic.svg - DESTINATION - ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps + FILES + ${CMAKE_SOURCE_DIR}/resources/gnome-pie.svg + ${CMAKE_SOURCE_DIR}/resources/gnome-pie-symbolic.svg + DESTINATION + ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps ) # desktop file install( - FILES - ${CMAKE_SOURCE_DIR}/resources/gnome-pie.desktop - DESTINATION - ${CMAKE_INSTALL_PREFIX}/share/applications + FILES + ${CMAKE_SOURCE_DIR}/resources/gnome-pie.desktop + DESTINATION + ${CMAKE_INSTALL_PREFIX}/share/applications ) # install manpage install( - FILES - ${CMAKE_SOURCE_DIR}/resources/gnome-pie.1 - DESTINATION - ${CMAKE_INSTALL_PREFIX}/share/man/man1 + FILES + ${CMAKE_SOURCE_DIR}/resources/gnome-pie.1 + DESTINATION + ${CMAKE_INSTALL_PREFIX}/share/man/man1 ) diff --git a/src/actionGroups/actionGroup.vala b/src/actionGroups/actionGroup.vala index c54be2f..8bbcde4 100644 --- a/src/actionGroups/actionGroup.vala +++ b/src/actionGroups/actionGroup.vala @@ -1,23 +1,23 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// // A base class storing a set of Actions. Derived classes may define // how these Actions are created. This base class serves for custom // actions, defined by the user. @@ -28,67 +28,67 @@ public class ActionGroup : GLib.Object { ///////////////////////////////////////////////////////////////////// /// A list of all stored actions. ///////////////////////////////////////////////////////////////////// - + public Gee.ArrayList actions { get; private set; } - + ///////////////////////////////////////////////////////////////////// /// The ID of the pie to which this group is attached. ///////////////////////////////////////////////////////////////////// - + public string parent_id { get; construct set; } - + ///////////////////////////////////////////////////////////////////// /// C'tor, initializes all members. ///////////////////////////////////////////////////////////////////// - + public ActionGroup(string parent_id) { GLib.Object(parent_id : parent_id); } - + construct { this.actions = new Gee.ArrayList(); } - + ///////////////////////////////////////////////////////////////////// /// This one is called, when the ActionGroup is deleted. ///////////////////////////////////////////////////////////////////// - + public virtual void on_remove() {} - + ///////////////////////////////////////////////////////////////////// /// Adds a new Action to the group. ///////////////////////////////////////////////////////////////////// - + public void add_action(Action new_action) { this.actions.add(new_action); } - + ///////////////////////////////////////////////////////////////////// /// Removes all Actions from the group. ///////////////////////////////////////////////////////////////////// - + public void delete_all() { actions.clear(); } - + ///////////////////////////////////////////////////////////////////// /// Makes all contained Slices no Quick Actions. ///////////////////////////////////////////////////////////////////// - + public void disable_quickactions() { foreach (var action in actions) action.is_quickaction = false; } - + ///////////////////////////////////////////////////////////////////// /// Returns true, if one o the contained Slices is a Quick Action ///////////////////////////////////////////////////////////////////// - + public bool has_quickaction() { foreach (var action in actions) if (action.is_quickaction) return true; - + return false; } } diff --git a/src/actionGroups/bookmarkGroup.vala b/src/actionGroups/bookmarkGroup.vala index 0a560c5..791d609 100644 --- a/src/actionGroups/bookmarkGroup.vala +++ b/src/actionGroups/bookmarkGroup.vala @@ -1,36 +1,36 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A group of Actions, which represent the users gtk-bookmarks, his home -/// directory, desktop and trash. It stay up-to-date, even if the +/// directory, desktop and trash. It stay up-to-date, even if the /// bookmarks change. ///////////////////////////////////////////////////////////////////////// public class BookmarkGroup : ActionGroup { - + ///////////////////////////////////////////////////////////////////// /// Used to register this type of ActionGroup. It sets the display - /// name for this ActionGroup, it's icon name and the string used in + /// name for this ActionGroup, it's icon name and the string used in /// the pies.conf file for this kind of ActionGroups. ///////////////////////////////////////////////////////////////////// - + public static GroupRegistry.TypeDescription register() { var description = new GroupRegistry.TypeDescription(); description.name = _("Group: Bookmarks"); @@ -41,34 +41,34 @@ public class BookmarkGroup : ActionGroup { } ///////////////////////////////////////////////////////////////////// - /// Two members needed to avoid useless, frequent changes of the + /// Two members needed to avoid useless, frequent changes of the /// stored Actions. ///////////////////////////////////////////////////////////////////// private bool changing = false; private bool changed_again = false; - + ///////////////////////////////////////////////////////////////////// /// C'tor, initializes all members. ///////////////////////////////////////////////////////////////////// - + public BookmarkGroup(string parent_id) { GLib.Object(parent_id : parent_id); } - + ///////////////////////////////////////////////////////////////////// /// Construct block loads the bookmarks of the user and adds a file /// monitor in order to update the BookmarkGroup when the bookmarks /// of the user change. ///////////////////////////////////////////////////////////////////// - + construct { this.load(); - + // add monitor var bookmark_file = GLib.File.new_for_path( GLib.Environment.get_home_dir()).get_child(".gtk-bookmarks"); - + if (bookmark_file.query_exists()) { try { var monitor = bookmark_file.monitor(GLib.FileMonitorFlags.NONE); @@ -78,31 +78,31 @@ public class BookmarkGroup : ActionGroup { } } } - + ///////////////////////////////////////////////////////////////////// /// Adds Actions for each gtk-bookmark of the user and for his home /// folder, desktop and trash. ///////////////////////////////////////////////////////////////////// - + private void load() { // add home folder this.add_action(ActionRegistry.new_for_uri("file://" + GLib.Environment.get_home_dir())); - + // add .gtk-bookmarks var bookmark_file = GLib.File.new_for_path( GLib.Environment.get_home_dir()).get_child(".gtk-bookmarks"); - + if (!bookmark_file.query_exists()) { warning("Failed to find file \".gtk-bookmarks\"!"); return; } - + try { var dis = new DataInputStream(bookmark_file.read()); string line; while ((line = dis.read_line(null)) != null) { var parts = line.split(" "); - + string uri = parts[0]; string name = parts[1]; @@ -111,19 +111,19 @@ public class BookmarkGroup : ActionGroup { } catch (Error e) { error ("%s", e.message); } - + // add trash this.add_action(ActionRegistry.new_for_uri("trash://")); - + // add desktop this.add_action(ActionRegistry.new_for_uri("file://" + GLib.Environment.get_user_special_dir(GLib.UserDirectory.DESKTOP))); } - + ///////////////////////////////////////////////////////////////////// /// Reloads all Bookmarks. Is called when the user's gtk-bookmarks /// file changes. ///////////////////////////////////////////////////////////////////// - + private void reload() { // avoid too frequent changes... if (!this.changing) { @@ -138,13 +138,13 @@ public class BookmarkGroup : ActionGroup { message("Bookmarks changed..."); this.delete_all(); this.load(); - + this.changing = false; return false; }); } else { this.changed_again = true; - } + } } } diff --git a/src/actionGroups/clipboardGroup.vala b/src/actionGroups/clipboardGroup.vala index c104d62..ad18740 100644 --- a/src/actionGroups/clipboardGroup.vala +++ b/src/actionGroups/clipboardGroup.vala @@ -1,23 +1,23 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// This Group keeps a history of the last used Clipboard entries. /// Experimental. Not enabled. ///////////////////////////////////////////////////////////////////////// @@ -25,40 +25,40 @@ namespace GnomePie { public class ClipboardGroup : ActionGroup { ///////////////////////////////////////////////////////////////////// - /// + /// ///////////////////////////////////////////////////////////////////// private class ClipboardItem : GLib.Object { - + public string name { get; private set; } public string icon { get; private set; } - + private Gtk.SelectionData contents; - + public ClipboardItem(Gtk.SelectionData contents) { this.contents = contents.copy(); this.name = this.contents.get_text() ?? ""; this.icon = "edit-paste"; } - + public void paste() { debug(name); } } - + public ClipboardGroup(string parent_id) { GLib.Object(parent_id : parent_id); } - + ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// - + ///////////////////////////////////////////////////////////////////// /// Used to register this type of ActionGroup. It sets the display - /// name for this ActionGroup, it's icon name and the string used in + /// name for this ActionGroup, it's icon name and the string used in /// the pies.conf file for this kind of ActionGroups. ///////////////////////////////////////////////////////////////////// - + public static GroupRegistry.TypeDescription register() { var description = new GroupRegistry.TypeDescription(); description.name = _("Group: Clipboard"); @@ -67,45 +67,45 @@ public class ClipboardGroup : ActionGroup { description.id = "clipboard"; return description; } - + ///////////////////////////////////////////////////////////////////// /// The clipboard to be monitored. ///////////////////////////////////////////////////////////////////// - + private Gtk.Clipboard clipboard; - - + + ///////////////////////////////////////////////////////////////////// /// The maximum remembered items of the clipboard. ///////////////////////////////////////////////////////////////////// - + private static const int max_items = 6; - + private Gee.ArrayList items; - + construct { this.items = new Gee.ArrayList(); this.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD); this.clipboard.owner_change.connect(this.on_change); } - + private void on_change() { if (this.clipboard.wait_is_text_available()) { this.clipboard.request_contents(Gdk.Atom.intern("text/plain", false), this.add_item); } } - + private void add_item(Gtk.Clipboard c, Gtk.SelectionData contents) { var new_item = new ClipboardItem(contents); - + if (this.items.size == ClipboardGroup.max_items) this.items.remove_at(0); - + this.items.add(new_item); - + // update slices this.delete_all(); - + for (int i=0; i { diff --git a/src/actionGroups/devicesGroup.vala b/src/actionGroups/devicesGroup.vala index d3892fe..1078296 100644 --- a/src/actionGroups/devicesGroup.vala +++ b/src/actionGroups/devicesGroup.vala @@ -1,35 +1,35 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { ///////////////////////////////////////////////////////////////////// -/// An ActionGroup which contains all currently plugged-in devices, +/// An ActionGroup which contains all currently plugged-in devices, /// such as CD-ROM's or USB-sticks. ///////////////////////////////////////////////////////////////////// public class DevicesGroup : ActionGroup { - + ///////////////////////////////////////////////////////////////////// /// Used to register this type of ActionGroup. It sets the display - /// name for this ActionGroup, it's icon name and the string used in + /// name for this ActionGroup, it's icon name and the string used in /// the pies.conf file for this kind of ActionGroups. ///////////////////////////////////////////////////////////////////// - + public static GroupRegistry.TypeDescription register() { var description = new GroupRegistry.TypeDescription(); description.name = _("Group: Devices"); @@ -40,63 +40,63 @@ public class DevicesGroup : ActionGroup { } ///////////////////////////////////////////////////////////////////// - /// Two members needed to avoid useless, frequent changes of the + /// Two members needed to avoid useless, frequent changes of the /// stored Actions. ///////////////////////////////////////////////////////////////////// private bool changing = false; private bool changed_again = false; - + ///////////////////////////////////////////////////////////////////// /// The VolumeMonitor used to check for added or removed devices. ///////////////////////////////////////////////////////////////////// - + private GLib.VolumeMonitor monitor; - + ///////////////////////////////////////////////////////////////////// /// C'tor, initializes all members. ///////////////////////////////////////////////////////////////////// - + public DevicesGroup(string parent_id) { GLib.Object(parent_id : parent_id); } - + ///////////////////////////////////////////////////////////////////// /// Construct block loads all currently plugged-in devices and /// connects signal handlers to the VolumeMonitor. ///////////////////////////////////////////////////////////////////// - + construct { this.monitor = GLib.VolumeMonitor.get(); - + this.load(); // add monitor this.monitor.mount_added.connect(this.reload); this.monitor.mount_removed.connect(this.reload); } - + ///////////////////////////////////////////////////////////////////// /// Loads all currently plugged-in devices. ///////////////////////////////////////////////////////////////////// - + private void load() { // add root device this.add_action(new UriAction(_("Root"), "harddrive", "file:///")); - + // add all other devices foreach(var mount in this.monitor.get_mounts()) { // get icon var icon = mount.get_icon(); - + this.add_action(new UriAction(mount.get_name(), Icon.get_icon_name(icon), mount.get_root().get_uri())); } } - + ///////////////////////////////////////////////////////////////////// /// Reloads all devices. Is called when the VolumeMonitor changes. ///////////////////////////////////////////////////////////////////// - + private void reload() { // avoid too frequent changes... if (!this.changing) { @@ -111,13 +111,13 @@ public class DevicesGroup : ActionGroup { message("Devices changed..."); this.delete_all(); this.load(); - + this.changing = false; return false; }); } else { this.changed_again = true; - } + } } } diff --git a/src/actionGroups/groupRegistry.vala b/src/actionGroups/groupRegistry.vala index 7510a03..ca0dc4d 100644 --- a/src/actionGroups/groupRegistry.vala +++ b/src/actionGroups/groupRegistry.vala @@ -1,83 +1,83 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A which has knowledge on all possible acion group types. ///////////////////////////////////////////////////////////////////////// public class GroupRegistry : GLib.Object { - + ///////////////////////////////////////////////////////////////////// /// A list containing all available ActionGroup types. ///////////////////////////////////////////////////////////////////// - + public static Gee.ArrayList types { get; private set; } - + ///////////////////////////////////////////////////////////////////// - /// A map associating a displayable name for each ActionGroup, + /// A map associating a displayable name for each ActionGroup, /// an icon name and a name for the pies.conf file with it's type. ///////////////////////////////////////////////////////////////////// - + public static Gee.HashMap descriptions { get; private set; } - + public class TypeDescription { public string name { get; set; default=""; } public string icon { get; set; default=""; } public string description { get; set; default=""; } public string id { get; set; default=""; } } - + ///////////////////////////////////////////////////////////////////// /// Registers all ActionGroup types. ///////////////////////////////////////////////////////////////////// - + public static void init() { types = new Gee.ArrayList(); descriptions = new Gee.HashMap(); - + TypeDescription type_description; - + type_description = BookmarkGroup.register(); types.add(typeof(BookmarkGroup).name()); descriptions.set(typeof(BookmarkGroup).name(), type_description); - + type_description = DevicesGroup.register(); types.add(typeof(DevicesGroup).name()); descriptions.set(typeof(DevicesGroup).name(), type_description); - + type_description = MenuGroup.register(); types.add(typeof(MenuGroup).name()); descriptions.set(typeof(MenuGroup).name(), type_description); - + type_description = SessionGroup.register(); types.add(typeof(SessionGroup).name()); descriptions.set(typeof(SessionGroup).name(), type_description); - + type_description = WindowListGroup.register(); types.add(typeof(WindowListGroup).name()); descriptions.set(typeof(WindowListGroup).name(), type_description); } - + ///////////////////////////////////////////////////////////////////// /// Creates a Group for a given type name. ///////////////////////////////////////////////////////////////////// - + public static ActionGroup? create_group(string type_id, string parent_id) { switch (type_id) { case "bookmarks": return new BookmarkGroup(parent_id); @@ -86,7 +86,7 @@ public class GroupRegistry : GLib.Object { case "session": return new SessionGroup(parent_id); case "window_list": return new WindowListGroup(parent_id); } - + return null; } } diff --git a/src/actionGroups/menuGroup.vala b/src/actionGroups/menuGroup.vala index 26a2662..7a1e344 100644 --- a/src/actionGroups/menuGroup.vala +++ b/src/actionGroups/menuGroup.vala @@ -1,35 +1,35 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// An ActionGroup which displays the user's main menu. It's a bit ugly, /// but it supports both, an older version and libgnome-menus-3 at the /// same time. ///////////////////////////////////////////////////////////////////////// - + public class MenuGroup : ActionGroup { ///////////////////////////////////////////////////////////////////// /// Used to register this type of ActionGroup. It sets the display - /// name for this ActionGroup, it's icon name and the string used in + /// name for this ActionGroup, it's icon name and the string used in /// the pies.conf file for this kind of ActionGroups. ///////////////////////////////////////////////////////////////////// - + public static GroupRegistry.TypeDescription register() { var description = new GroupRegistry.TypeDescription(); description.name = _("Group: Main menu"); @@ -38,50 +38,50 @@ public class MenuGroup : ActionGroup { description.id = "menu"; return description; } - + ///////////////////////////////////////////////////////////////////// /// True, if this MenuGroup is the top most menu. ///////////////////////////////////////////////////////////////////// - + public bool is_toplevel {get; construct set; default = true;} - + ///////////////////////////////////////////////////////////////////// /// The menu tree displayed by the MenuGroup. Only set for the /// toplevel MenuGroup. ///////////////////////////////////////////////////////////////////// - + private GMenu.Tree menu = null; - + ///////////////////////////////////////////////////////////////////// /// A list of all sub menus of this MenuGroup. ///////////////////////////////////////////////////////////////////// - + private Gee.ArrayList childs; - + ///////////////////////////////////////////////////////////////////// - /// Two members needed to avoid useless, frequent changes of the + /// Two members needed to avoid useless, frequent changes of the /// stored Actions. ///////////////////////////////////////////////////////////////////// - + private bool changing = false; private bool changed_again = false; - + ///////////////////////////////////////////////////////////////////// /// C'tor, initializes all members. Used for the toplevel menu. ///////////////////////////////////////////////////////////////////// - + public MenuGroup(string parent_id) { GLib.Object(parent_id : parent_id, is_toplevel : true); } - + ///////////////////////////////////////////////////////////////////// /// C'tor, initializes all members. Used for sub menus. ///////////////////////////////////////////////////////////////////// - + public MenuGroup.sub_menu(string parent_id) { GLib.Object(parent_id : parent_id, is_toplevel : false); } - + construct { this.childs = new Gee.ArrayList(); @@ -89,16 +89,16 @@ public class MenuGroup : ActionGroup { #if HAVE_GMENU_3 this.menu = new GMenu.Tree("applications.menu", GMenu.TreeFlags.INCLUDE_EXCLUDED); this.menu.changed.connect(this.reload); - #endif - - this.load_toplevel(); - } + #endif + + this.load_toplevel(); + } } - + ///////////////////////////////////////////////////////////////////// /// Starts to load the menu. ///////////////////////////////////////////////////////////////////// - + private void load_toplevel() { #if HAVE_GMENU_3 try { @@ -113,13 +113,13 @@ public class MenuGroup : ActionGroup { this.menu.add_monitor(this.reload); var dir = this.menu.get_root_directory(); this.load_contents(dir, this.parent_id); - #endif + #endif } ///////////////////////////////////////////////////////////////////// /// Parses the main menu recursively. ///////////////////////////////////////////////////////////////////// - + private void load_contents(GMenu.TreeDirectory dir, string parent_id) { #if HAVE_GMENU_3 var item = dir.iter(); @@ -128,35 +128,35 @@ public class MenuGroup : ActionGroup { var type = item.next(); if (type == GMenu.TreeItemType.INVALID) break; - + if (type == GMenu.TreeItemType.DIRECTORY && !item.get_directory().get_is_nodisplay()) { - // create a MenuGroup for sub menus - + // create a MenuGroup for sub menus + // get icon var icon = item.get_directory().get_icon(); - + var sub_menu = PieManager.create_dynamic_pie(item.get_directory().get_name(), Icon.get_icon_name(icon)); var group = new MenuGroup.sub_menu(sub_menu.id); group.add_action(new PieAction(parent_id, true)); group.load_contents(item.get_directory(), sub_menu.id); childs.add(group); - + sub_menu.add_group(group); - - this.add_action(new PieAction(sub_menu.id)); + + this.add_action(new PieAction(sub_menu.id)); } else if (type == GMenu.TreeItemType.ENTRY ) { // create an AppAction for entries if (!item.get_entry().get_is_excluded()) { - this.add_action(ActionRegistry.new_for_app_info(item.get_entry().get_app_info())); - } + this.add_action(ActionRegistry.new_for_app_info(item.get_entry().get_app_info())); + } } } #else foreach (var item in dir.get_contents()) { switch(item.get_type()) { case GMenu.TreeItemType.DIRECTORY: - // create a MenuGroup for sub menus + // create a MenuGroup for sub menus if (!((GMenu.TreeDirectory)item).get_is_nodisplay()) { var sub_menu = PieManager.create_dynamic_pie( ((GMenu.TreeDirectory)item).get_name(), @@ -165,30 +165,30 @@ public class MenuGroup : ActionGroup { group.add_action(new PieAction(parent_id, true)); group.load_contents((GMenu.TreeDirectory)item, sub_menu.id); childs.add(group); - + sub_menu.add_group(group); - - this.add_action(new PieAction(sub_menu.id)); - } + + this.add_action(new PieAction(sub_menu.id)); + } break; - + case GMenu.TreeItemType.ENTRY: // create an AppAction for entries if (!((GMenu.TreeEntry)item).get_is_nodisplay() && !((GMenu.TreeEntry)item).get_is_excluded()) { - this.add_action(new AppAction(((GMenu.TreeEntry)item).get_name(), - ((GMenu.TreeEntry)item).get_icon(), - ((GMenu.TreeEntry)item).get_exec())); - } + this.add_action(new AppAction(((GMenu.TreeEntry)item).get_name(), + ((GMenu.TreeEntry)item).get_icon(), + ((GMenu.TreeEntry)item).get_exec())); + } break; } } #endif } - + ///////////////////////////////////////////////////////////////////// /// Reloads the menu. ///////////////////////////////////////////////////////////////////// - + private void reload() { // avoid too frequent changes... if (!this.changing) { @@ -204,46 +204,46 @@ public class MenuGroup : ActionGroup { #if !HAVE_GMENU_3 this.menu.remove_monitor(this.reload); #endif - + this.clear(); this.load_toplevel(); - + this.changing = false; return false; }); } else { this.changed_again = true; - } + } } - + ///////////////////////////////////////////////////////////////////// /// Deletes all generated Pies, when the toplevel menu is deleted. ///////////////////////////////////////////////////////////////////// - + public override void on_remove() { if (this.is_toplevel) this.clear(); } - + ///////////////////////////////////////////////////////////////////// /// Clears this ActionGroup recursively. ///////////////////////////////////////////////////////////////////// - + private void clear() { foreach (var child in childs) child.clear(); if (!this.is_toplevel) PieManager.remove_pie(this.parent_id); - + this.delete_all(); - + this.childs.clear(); - + #if !HAVE_GMENU_3 this.menu = null; #endif - + } } diff --git a/src/actionGroups/sessionGroup.vala b/src/actionGroups/sessionGroup.vala index 26f8ebc..7b989a6 100644 --- a/src/actionGroups/sessionGroup.vala +++ b/src/actionGroups/sessionGroup.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { @@ -23,13 +23,13 @@ namespace GnomePie { ///////////////////////////////////////////////////////////////////// public class SessionGroup : ActionGroup { - + ///////////////////////////////////////////////////////////////////// /// Used to register this type of ActionGroup. It sets the display - /// name for this ActionGroup, it's icon name and the string used in + /// name for this ActionGroup, it's icon name and the string used in /// the pies.conf file for this kind of ActionGroups. ///////////////////////////////////////////////////////////////////// - + public static GroupRegistry.TypeDescription register() { var description = new GroupRegistry.TypeDescription(); description.name = _("Group: Session Control"); @@ -38,38 +38,38 @@ public class SessionGroup : ActionGroup { description.id = "session"; return description; } - + ///////////////////////////////////////////////////////////////////// /// C'tor, initializes all members. ///////////////////////////////////////////////////////////////////// - + public SessionGroup(string parent_id) { GLib.Object(parent_id : parent_id); } - + ///////////////////////////////////////////////////////////////////// /// Construct block adds the three Actions. ///////////////////////////////////////////////////////////////////// - + construct { -// string iface = GLib.Bus.get_proxy_sync(GLib.BusType.SESSION, "org.gnome.SessionManager", "/org/gnome/SessionManager"); -// iface = GLib.Bus.get_proxy_sync(GLib.BusType.SESSION, "org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer"); -// iface = GLib.Bus.get_proxy_sync(GLib.BusType.SESSION, "org.kde.ksmserver", "/KSMServer"); -// iface = GLib.Bus.get_proxy_sync(GLib.BusType.SESSION, "org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager"); - - this.add_action(new AppAction(_("Shutdown"), "gnome-shutdown", +// string iface = GLib.Bus.get_proxy_sync(GLib.BusType.SESSION, "org.gnome.SessionManager", "/org/gnome/SessionManager"); +// iface = GLib.Bus.get_proxy_sync(GLib.BusType.SESSION, "org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer"); +// iface = GLib.Bus.get_proxy_sync(GLib.BusType.SESSION, "org.kde.ksmserver", "/KSMServer"); +// iface = GLib.Bus.get_proxy_sync(GLib.BusType.SESSION, "org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager"); + + this.add_action(new AppAction(_("Shutdown"), "gnome-shutdown", "dbus-send --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager.RequestShutdown")); - - this.add_action(new AppAction(_("Logout"), "gnome-session-logout", + + this.add_action(new AppAction(_("Logout"), "gnome-session-logout", "dbus-send --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager.Logout uint32:1")); - - this.add_action(new AppAction(_("Reboot"), "gnome-session-reboot", + + this.add_action(new AppAction(_("Reboot"), "gnome-session-reboot", "dbus-send --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager.RequestReboot")); } - + // TODO: check for available interfaces --- these may work too: // dbus-send --print-reply --dest=org.freedesktop.Hal /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Shutdown - // dbus-send --print-reply --dest=org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.logout 0 2 2 + // dbus-send --print-reply --dest=org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.logout 0 2 2 // dbus-send --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop } diff --git a/src/actionGroups/windowListGroup.vala b/src/actionGroups/windowListGroup.vala index 774666f..a2dc19c 100644 --- a/src/actionGroups/windowListGroup.vala +++ b/src/actionGroups/windowListGroup.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { @@ -22,13 +22,13 @@ namespace GnomePie { ///////////////////////////////////////////////////////////////////// public class WindowListGroup : ActionGroup { - + ///////////////////////////////////////////////////////////////////// /// Used to register this type of ActionGroup. It sets the display - /// name for this ActionGroup, it's icon name and the string used in + /// name for this ActionGroup, it's icon name and the string used in /// the pies.conf file for this kind of ActionGroups. ///////////////////////////////////////////////////////////////////// - + public static GroupRegistry.TypeDescription register() { var description = new GroupRegistry.TypeDescription(); description.name = _("Group: Window List"); @@ -39,86 +39,86 @@ public class WindowListGroup : ActionGroup { } ///////////////////////////////////////////////////////////////////// - /// Two members needed to avoid useless, frequent changes of the + /// Two members needed to avoid useless, frequent changes of the /// stored Actions. ///////////////////////////////////////////////////////////////////// private bool changing = false; private bool changed_again = false; - + private Wnck.Screen screen; - + ///////////////////////////////////////////////////////////////////// /// C'tor, initializes all members. ///////////////////////////////////////////////////////////////////// - + public WindowListGroup(string parent_id) { GLib.Object(parent_id : parent_id); } - + ///////////////////////////////////////////////////////////////////// /// Loads all windows. ///////////////////////////////////////////////////////////////////// - + construct { this.screen = Wnck.Screen.get_default(); - + this.screen.window_opened.connect(reload); this.screen.window_closed.connect(reload); - + this.load(); } - + ///////////////////////////////////////////////////////////////////// /// Loads all currently opened windows and creates actions for them. ///////////////////////////////////////////////////////////////////// - + private void load() { unowned GLib.List windows = this.screen.get_windows(); - + var matcher = Bamf.Matcher.get_default(); foreach (var window in windows) { if (window.get_window_type() == Wnck.WindowType.NORMAL - && !window.is_skip_pager() && !window.is_skip_tasklist()) { + && !window.is_skip_pager() && !window.is_skip_tasklist()) { var application = window.get_application(); var bamf_app = matcher.get_application_for_xid((uint32)window.get_xid()); - + string name = window.get_name(); - + if (name.length > 30) name = name.substring(0, 30) + "..."; - + var action = new SigAction( name, (bamf_app == null) ? application.get_icon_name().down() : bamf_app.get_icon(), - "%lu".printf(window.get_xid()) + "%lu".printf(window.get_xid()) ); action.activated.connect(() => { Wnck.Screen.get_default().force_update(); - + var xid = (X.Window)uint64.parse(action.real_command); var win = Wnck.Window.get(xid); - var time = Gtk.get_current_event_time(); - - if (win.get_workspace() != null - && win.get_workspace() != win.get_screen().get_active_workspace()) - win.get_workspace().activate(time); - - if (win.is_minimized()) - win.unminimize(time); - - win.activate_transient(time); + var time = Gtk.get_current_event_time(); + + if (win.get_workspace() != null + && win.get_workspace() != win.get_screen().get_active_workspace()) + win.get_workspace().activate(time); + + if (win.is_minimized()) + win.unminimize(time); + + win.activate_transient(time); }); this.add_action(action); } } } - + ///////////////////////////////////////////////////////////////////// /// Reloads all running applications. ///////////////////////////////////////////////////////////////////// - + private void reload() { // avoid too frequent changes... if (!this.changing) { @@ -132,13 +132,13 @@ public class WindowListGroup : ActionGroup { // reload this.delete_all(); this.load(); - + this.changing = false; return false; }); } else { this.changed_again = true; - } + } } } diff --git a/src/actions/action.vala b/src/actions/action.vala index ff0e9cd..91fc448 100644 --- a/src/actions/action.vala +++ b/src/actions/action.vala @@ -1,23 +1,23 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A base class for actions, which are executed when the user /// activates a pie's slice. ///////////////////////////////////////////////////////////////////////// @@ -30,33 +30,33 @@ public abstract class Action : GLib.Object { ///////////////////////////////////////////////////////////////////// public abstract string real_command { get; construct set; } - + ///////////////////////////////////////////////////////////////////// /// The command displayed to the user. It should be a bit more /// beautiful than the real_command. ///////////////////////////////////////////////////////////////////// - - public abstract string display_command { get; } - + + public abstract string display_command { get; } + ///////////////////////////////////////////////////////////////////// /// The name of the Action. - ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// public virtual string name { get; set; } - + ///////////////////////////////////////////////////////////////////// /// The name of the icon of this Action. It should be in the users /// current icon theme. ///////////////////////////////////////////////////////////////////// - + public virtual string icon { get; set; } - + ///////////////////////////////////////////////////////////////////// /// True, if this Action is the quickAction of the associated Pie. /// The quickAction of a Pie gets executed when the users clicks on /// the center of a Pie. ///////////////////////////////////////////////////////////////////// - + public virtual bool is_quickaction { get; set; } ///////////////////////////////////////////////////////////////////// diff --git a/src/actions/actionRegistry.vala b/src/actions/actionRegistry.vala index 24cc1fe..9a22cc7 100644 --- a/src/actions/actionRegistry.vala +++ b/src/actions/actionRegistry.vala @@ -1,46 +1,46 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A which has knowledge on all possible acion types. ///////////////////////////////////////////////////////////////////////// public class ActionRegistry : GLib.Object { - + ///////////////////////////////////////////////////////////////////// /// A list containing all available Action types. ///////////////////////////////////////////////////////////////////// - + public static Gee.ArrayList types { get; private set; } - + ///////////////////////////////////////////////////////////////////// - /// A map associating a displayable name for each Action, + /// A map associating a displayable name for each Action, /// whether it has a custom icon and a name for the pies.conf /// file with it's type. ///////////////////////////////////////////////////////////////////// - + public static Gee.HashMap descriptions { get; private set; } - + ///////////////////////////////////////////////////////////////////// /// A helper class storing information on a Action type. ///////////////////////////////////////////////////////////////////// - + public class TypeDescription { public string name { get; set; default=""; } public string icon { get; set; default=""; } @@ -48,38 +48,38 @@ public class ActionRegistry : GLib.Object { public string id { get; set; default=""; } public bool icon_name_editable { get; set; default=false; } } - + ///////////////////////////////////////////////////////////////////// /// Registers all Action types. ///////////////////////////////////////////////////////////////////// - + public static void init() { types = new Gee.ArrayList(); descriptions = new Gee.HashMap(); - + TypeDescription type_description; - + types.add(typeof(AppAction).name()); type_description = AppAction.register(); descriptions.set(typeof(AppAction).name(), type_description); - + types.add(typeof(KeyAction).name()); type_description = KeyAction.register(); descriptions.set(typeof(KeyAction).name(), type_description); - + types.add(typeof(PieAction).name()); type_description = PieAction.register(); descriptions.set(typeof(PieAction).name(), type_description); - + types.add(typeof(UriAction).name()); type_description = UriAction.register(); descriptions.set(typeof(UriAction).name(), type_description); } - + ///////////////////////////////////////////////////////////////////// /// Creates a new Action from the given type name. ///////////////////////////////////////////////////////////////////// - + public static Action? create_action(string type_id, string name, string icon, string command, bool quickaction) { switch (type_id) { case "app": return new AppAction(name, icon, command, quickaction); @@ -87,131 +87,131 @@ public class ActionRegistry : GLib.Object { case "uri": return new UriAction(name, icon, command, quickaction); case "pie": return new PieAction(command, quickaction); } - + return null; } - + ///////////////////////////////////////////////////////////////////// - /// A helper method which creates an Action, appropriate for the + /// A helper method which creates an Action, appropriate for the /// given URI. This can result in an UriAction or in an AppAction, - /// depending on the Type of the URI. + /// depending on the Type of the URI. ///////////////////////////////////////////////////////////////////// public static Action? new_for_uri(string uri, string? name = null) { var file = GLib.File.new_for_uri(uri); var scheme = file.get_uri_scheme(); - + string final_icon = ""; string final_name = file.get_basename(); switch (scheme) { case "application": var file_name = uri.split("//")[1]; - + var desktop_file = GLib.File.new_for_path("/usr/share/applications/" + file_name); if (desktop_file.query_exists()) return new_for_desktop_file(desktop_file.get_path()); break; - + case "trash": final_icon = "user-trash"; final_name = _("Trash"); break; - + case "http": case "https": final_icon = "www"; final_name = get_domain_name(uri); break; - + case "ftp": case "sftp": final_icon = "folder-remote"; final_name = get_domain_name(uri); break; - + default: try { var info = file.query_info("*", GLib.FileQueryInfoFlags.NONE); - + if (info.get_content_type() == "application/x-desktop") return new_for_desktop_file(file.get_parse_name()); - + // search for an appropriate icon - var icon = info.get_icon(); + var icon = info.get_icon(); final_icon = Icon.get_icon_name(icon); - + } catch (GLib.Error e) { warning(e.message); } break; } - + if (!Gtk.IconTheme.get_default().has_icon(final_icon)) final_icon = "stock_unknown"; - + if (name != null) final_name = name; - + return new UriAction(final_name, final_icon, uri); } - + ///////////////////////////////////////////////////////////////////// /// A helper method which creates an AppAction for given AppInfo. ///////////////////////////////////////////////////////////////////// - - public static Action? new_for_app_info(GLib.AppInfo info) { + + public static Action? new_for_app_info(GLib.AppInfo info) { // get icon - var icon = info.get_icon(); - + var icon = info.get_icon(); + return new AppAction(info.get_display_name(), Icon.get_icon_name(icon), info.get_commandline()); } - + ///////////////////////////////////////////////////////////////////// /// A helper method which creates an AppAction for given *.desktop /// file. ///////////////////////////////////////////////////////////////////// - + public static Action? new_for_desktop_file(string file_name) { // check whether its a desktop file to open one of Gnome-Pie's pies if (file_name.has_prefix(Paths.launchers)) { string id = file_name.substring((long)file_name.length - 11, 3); return new PieAction(id); } - + var info = new DesktopAppInfo.from_filename(file_name); return new_for_app_info(info); } - + ///////////////////////////////////////////////////////////////////// /// A helper method which creates an AppAction for given mime type. ///////////////////////////////////////////////////////////////////// - + public static Action? default_for_mime_type(string type) { var info = AppInfo.get_default_for_type(type, false); return new_for_app_info(info); } - + ///////////////////////////////////////////////////////////////////// /// A helper method which creates an AppAction for given uri scheme. ///////////////////////////////////////////////////////////////////// - + public static Action? default_for_uri(string uri) { var info = AppInfo.get_default_for_uri_scheme(uri); return new_for_app_info(info); } - + ///////////////////////////////////////////////////////////////////// /// Returns for example www.google.com when http://www.google.de/?q=h /// is given. ///////////////////////////////////////////////////////////////////// - + private static string get_domain_name(string url) { int domain_end = url.index_of_char('/', 7); int domain_begin = url.index_of_char('/', 0) + 2; - + if (domain_begin < domain_end) return url.substring(domain_begin, domain_end-domain_begin); - + return url; } } diff --git a/src/actions/appAction.vala b/src/actions/appAction.vala index 2371f7c..859baf8 100644 --- a/src/actions/appAction.vala +++ b/src/actions/appAction.vala @@ -1,23 +1,23 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// This type of Action launches an application or a custom command. ///////////////////////////////////////////////////////////////////////// @@ -38,17 +38,17 @@ public class AppAction : Action { description.id = "app"; return description; } - + ///////////////////////////////////////////////////////////////////// /// Stores the command line. ///////////////////////////////////////////////////////////////////// public override string real_command { get; construct set; } - + ///////////////////////////////////////////////////////////////////// /// Simply returns the real_command. No beautification. ///////////////////////////////////////////////////////////////////// - + public override string display_command { get {return real_command;} } ///////////////////////////////////////////////////////////////////// @@ -67,10 +67,10 @@ public class AppAction : Action { try{ var item = GLib.AppInfo.create_from_commandline(this.real_command, null, GLib.AppInfoCreateFlags.NONE); item.launch(null, null); - } catch (Error e) { - warning(e.message); + } catch (Error e) { + warning(e.message); } - } + } } } diff --git a/src/actions/keyAction.vala b/src/actions/keyAction.vala index 3816686..68a2ec1 100644 --- a/src/actions/keyAction.vala +++ b/src/actions/keyAction.vala @@ -1,23 +1,23 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// This type of Action "presses" a key stroke. ///////////////////////////////////////////////////////////////////////// @@ -37,24 +37,24 @@ public class KeyAction : Action { description.icon_name_editable = true; description.id = "key"; return description; - } - + } + ///////////////////////////////////////////////////////////////////// /// Stores the accelerator of this action. ///////////////////////////////////////////////////////////////////// - + public override string real_command { get; construct set; } - + ///////////////////////////////////////////////////////////////////// /// Returns a human readable form of the accelerator. ///////////////////////////////////////////////////////////////////// - + public override string display_command { get {return key.label;} } - + ///////////////////////////////////////////////////////////////////// /// The simulated key which gets 'pressed' on execution. ///////////////////////////////////////////////////////////////////// - + public Key key { get; set; } ///////////////////////////////////////////////////////////////////// @@ -64,11 +64,11 @@ public class KeyAction : Action { public KeyAction(string name, string icon, string command, bool is_quickaction = false) { GLib.Object(name : name, icon : icon, real_command : command, is_quickaction : is_quickaction); } - + construct { this.key = new Key.from_string(real_command); } - + ///////////////////////////////////////////////////////////////////// /// Presses the desired key. ///////////////////////////////////////////////////////////////////// diff --git a/src/actions/pieAction.vala b/src/actions/pieAction.vala index c65c1d6..8069ff3 100644 --- a/src/actions/pieAction.vala +++ b/src/actions/pieAction.vala @@ -1,23 +1,23 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// This Action opens another pie. ///////////////////////////////////////////////////////////////////////// @@ -38,23 +38,23 @@ public class PieAction : Action { description.id = "pie"; return description; } - + ///////////////////////////////////////////////////////////////////// /// Stores the ID of the referenced Pie. ///////////////////////////////////////////////////////////////////// public override string real_command { get; construct set; } - + ///////////////////////////////////////////////////////////////////// /// Returns the name of the referenced Pie. ///////////////////////////////////////////////////////////////////// - + public override string display_command { get {return name;} } - + ///////////////////////////////////////////////////////////////////// /// Returns the name of the referenced Pie. ///////////////////////////////////////////////////////////////////// - + public override string name { get { var referee = PieManager.all_pies[real_command]; @@ -66,13 +66,13 @@ public class PieAction : Action { } protected set {} } - + private string owned_name; - + ///////////////////////////////////////////////////////////////////// /// Returns the icon of the referenced Pie. ///////////////////////////////////////////////////////////////////// - + public override string icon { get { var referee = PieManager.all_pies[real_command]; @@ -90,14 +90,14 @@ public class PieAction : Action { public PieAction(string id, bool is_quickaction = false) { GLib.Object(name : "", icon : "", real_command : id, is_quickaction : is_quickaction); } - + ///////////////////////////////////////////////////////////////////// /// Opens the desired Pie. ///////////////////////////////////////////////////////////////////// public override void activate() { PieManager.open_pie(real_command); - } + } } } diff --git a/src/actions/sigAction.vala b/src/actions/sigAction.vala index 1edbc08..4eebbca 100644 --- a/src/actions/sigAction.vala +++ b/src/actions/sigAction.vala @@ -1,23 +1,23 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// This type of Action can't be selected by the user, therefore there is /// no register() method for this class. But it may be useful for /// ActionGroups: It emits a signal on activation. @@ -30,19 +30,19 @@ public class SigAction : Action { ///////////////////////////////////////////////////////////////////// public signal void activated(); - + ///////////////////////////////////////////////////////////////////// /// This may store something useful. ///////////////////////////////////////////////////////////////////// public override string real_command { get; construct set; } - + ///////////////////////////////////////////////////////////////////// /// Only for inheritance... Greetings to Liskov. ///////////////////////////////////////////////////////////////////// - + public override string display_command { get {return real_command;} } - + ///////////////////////////////////////////////////////////////////// /// C'tor, initializes all members. ///////////////////////////////////////////////////////////////////// @@ -57,7 +57,7 @@ public class SigAction : Action { public override void activate() { this.activated(); - } + } } } diff --git a/src/actions/uriAction.vala b/src/actions/uriAction.vala index f407f6c..dfc1029 100644 --- a/src/actions/uriAction.vala +++ b/src/actions/uriAction.vala @@ -1,34 +1,34 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// This type of Action opens the default application for an URI. ///////////////////////////////////////////////////////////////////////// public class UriAction : Action { - + ///////////////////////////////////////////////////////////////////// /// Used to register this type of Action. It sets the display name /// for this Action, whether it has a custom Icon/Name and the string /// used in the pies.conf file for this kind of Actions. ///////////////////////////////////////////////////////////////////// - + public static ActionRegistry.TypeDescription register() { var description = new ActionRegistry.TypeDescription(); description.name = _("Open URI"); @@ -38,17 +38,17 @@ public class UriAction : Action { description.id = "uri"; return description; } - + ///////////////////////////////////////////////////////////////////// /// The URI of this Action. ///////////////////////////////////////////////////////////////////// - + public override string real_command { get; construct set; } - + ///////////////////////////////////////////////////////////////////// /// Returns only the real URI. An URI can't be beautified. ///////////////////////////////////////////////////////////////////// - + public override string display_command { get {return real_command;} } ///////////////////////////////////////////////////////////////////// @@ -56,8 +56,8 @@ public class UriAction : Action { ///////////////////////////////////////////////////////////////////// public UriAction(string name, string icon, string command, bool is_quickaction = false) { - GLib.Object(name : name, icon : icon, - real_command : command.has_prefix("www") ? "http://" + command : command, + GLib.Object(name : name, icon : icon, + real_command : command.has_prefix("www") ? "http://" + command : command, is_quickaction : is_quickaction); } @@ -68,10 +68,10 @@ public class UriAction : Action { public override void activate() { try{ GLib.AppInfo.launch_default_for_uri(real_command, null); - } catch (Error e) { - warning(e.message); + } catch (Error e) { + warning(e.message); } - } + } } } diff --git a/src/deamon.vala b/src/deamon.vala index 2e79d10..daa6d9d 100644 --- a/src/deamon.vala +++ b/src/deamon.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { @@ -36,7 +36,7 @@ public class Deamon : GLib.Object { ///////////////////////////////////////////////////////////////////// public static int main(string[] args) { - version = "0.5.7"; + version = "0.6.0"; Logger.init(); Gtk.init(ref args); @@ -133,9 +133,9 @@ public class Deamon : GLib.Object { private static void sig_handler(int sig) { stdout.printf("\n"); - message("Caught signal (%d), bye!".printf(sig)); - Gtk.main_quit(); - } + message("Caught signal (%d), bye!".printf(sig)); + Gtk.main_quit(); + } ///////////////////////////////////////////////////////////////////// /// Handles command line parameters. diff --git a/src/gui/aboutWindow.vala b/src/gui/aboutWindow.vala index 39258cb..cf1ce8a 100644 --- a/src/gui/aboutWindow.vala +++ b/src/gui/aboutWindow.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { @@ -29,38 +29,40 @@ public class AboutWindow: Gtk.AboutDialog { ///////////////////////////////////////////////////////////////////// public AboutWindow () { - string[] devs = { - "Simon Schneegans ", + string[] devs = { + "Simon Schneegans ", + "Gabriel Dubatti ", "Francesco Piccinno " }; string[] artists = { - "Simon Schneegans " + "Simon Schneegans " }; - string[] translators = { - "Simon Schneegans (DE, EN)", - "Riccardo Traverso (IT)", - "Magnun Leno (PT-BR)", - "Kim Boram (KO)", + string[] translators = { + "Simon Schneegans (DE, EN)", + "Riccardo Traverso (IT)", + "Magnun Leno (PT-BR)", + "Kim Boram (KO)", "Eduardo Anabalon (ES)", + "Gabriel Dubatti (ES)", "Grégoire Bellon-Gervais (FR)", "Alex Maxime (FR)", "Eugene Roskin (RU)", "Ting Zhou (ZH-CN)", "Martin Dinov (BG)" - }; + }; - // sort translators - GLib.List translator_list = new GLib.List(); - foreach (var translator in translators) - translator_list.append(translator); + // sort translators + GLib.List translator_list = new GLib.List(); + foreach (var translator in translators) + translator_list.append(translator); - translator_list.sort((a, b) => { - return a.ascii_casecmp(b); - }); + translator_list.sort((a, b) => { + return a.ascii_casecmp(b); + }); - string translator_string = ""; - foreach (var translator in translator_list) - translator_string += translator + "\n"; + string translator_string = ""; + foreach (var translator in translator_list) + translator_string += translator + "\n"; GLib.Object ( artists : artists, diff --git a/src/gui/iconSelectWindow.vala b/src/gui/iconSelectWindow.vala index 2560811..ce610ea 100644 --- a/src/gui/iconSelectWindow.vala +++ b/src/gui/iconSelectWindow.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { diff --git a/src/gui/indicator.vala b/src/gui/indicator.vala index 1277fb8..b46ee59 100644 --- a/src/gui/indicator.vala +++ b/src/gui/indicator.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { diff --git a/src/gui/newSliceWindow.vala b/src/gui/newSliceWindow.vala index 92c7701..a17c819 100644 --- a/src/gui/newSliceWindow.vala +++ b/src/gui/newSliceWindow.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { diff --git a/src/gui/newsWindow.vala b/src/gui/newsWindow.vala index 373135f..cc1a77d 100644 --- a/src/gui/newsWindow.vala +++ b/src/gui/newsWindow.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { diff --git a/src/gui/pieComboList.vala b/src/gui/pieComboList.vala index 3be3bff..f0fd22f 100644 --- a/src/gui/pieComboList.vala +++ b/src/gui/pieComboList.vala @@ -1,23 +1,23 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A drop-down list, containing one entry for each existing Pie. ///////////////////////////////////////////////////////////////////////// @@ -26,19 +26,19 @@ class PieComboList : Gtk.ComboBox { ///////////////////////////////////////////////////////////////////// /// This signal gets emitted when the user selects a new Pie. ///////////////////////////////////////////////////////////////////// - + public signal void on_select(string id); - + ///////////////////////////////////////////////////////////////////// /// The currently selected row. ///////////////////////////////////////////////////////////////////// - + public string current_id { get; private set; default=""; } - + ///////////////////////////////////////////////////////////////////// /// Stores the data internally. ///////////////////////////////////////////////////////////////////// - + private Gtk.ListStore data; private enum DataPos {ICON, NAME, ID} @@ -48,25 +48,25 @@ class PieComboList : Gtk.ComboBox { public PieComboList() { GLib.Object(); - - this.data = new Gtk.ListStore(3, typeof(Gdk.Pixbuf), + + this.data = new Gtk.ListStore(3, typeof(Gdk.Pixbuf), typeof(string), typeof(string)); - + this.data.set_sort_column_id(1, Gtk.SortType.ASCENDING); - + base.set_model(this.data); - + var icon_render = new Gtk.CellRendererPixbuf(); icon_render.xpad = 4; this.pack_start(icon_render, false); - + var name_render = new Gtk.CellRendererText(); this.pack_start(name_render, true); - + this.add_attribute(icon_render, "pixbuf", DataPos.ICON); this.add_attribute(name_render, "text", DataPos.NAME); - + this.changed.connect(() => { Gtk.TreeIter active; if (this.get_active_iter(out active)) { @@ -76,36 +76,36 @@ class PieComboList : Gtk.ComboBox { this.current_id = id; } }); - + reload(); } - + ///////////////////////////////////////////////////////////////////// /// Loads all existing Pies to the list. ///////////////////////////////////////////////////////////////////// - + public void reload() { Gtk.TreeIter active; string id = ""; if (this.get_active_iter(out active)) this.data.get(active, DataPos.ID, out id); - + data.clear(); foreach (var pie in PieManager.all_pies.entries) { this.load_pie(pie.value); } - + select_first(); select(id); } - + ///////////////////////////////////////////////////////////////////// /// Selects the first Pie. ///////////////////////////////////////////////////////////////////// - + public void select_first() { Gtk.TreeIter active; - + if(this.data.get_iter_first(out active) ) { this.set_active_iter(active); string id = ""; @@ -117,37 +117,37 @@ class PieComboList : Gtk.ComboBox { this.current_id = ""; } } - + ///////////////////////////////////////////////////////////////////// /// Selects the Pie with the given ID. ///////////////////////////////////////////////////////////////////// - + public void select(string id) { this.data.foreach((model, path, iter) => { string pie_id; this.data.get(iter, DataPos.ID, out pie_id); - + if (id == pie_id) { this.set_active_iter(iter); return true; } - + return false; }); } - + ///////////////////////////////////////////////////////////////////// /// Loads one given pie to the list. ///////////////////////////////////////////////////////////////////// - + private void load_pie(Pie pie) { if (pie.id.length == 3) { Gtk.TreeIter last; this.data.append(out last); var icon = new Icon(pie.icon, 24); - this.data.set(last, DataPos.ICON, icon.to_pixbuf(), + this.data.set(last, DataPos.ICON, icon.to_pixbuf(), DataPos.NAME, pie.name, - DataPos.ID, pie.id); + DataPos.ID, pie.id); } } } diff --git a/src/gui/pieList.vala b/src/gui/pieList.vala index f9fb54b..29c0a1e 100644 --- a/src/gui/pieList.vala +++ b/src/gui/pieList.vala @@ -1,23 +1,23 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A list, containing one entry for each existing Pie. ///////////////////////////////////////////////////////////////////////// @@ -26,22 +26,22 @@ class PieList : Gtk.TreeView { ///////////////////////////////////////////////////////////////////// /// This signal gets emitted when the user selects a new Pie. ///////////////////////////////////////////////////////////////////// - + public signal void on_select(string id); - + ///////////////////////////////////////////////////////////////////// /// Stores the data internally. ///////////////////////////////////////////////////////////////////// - + private Gtk.ListStore data; private enum DataPos {ICON, ICON_NAME, NAME, ID} - + ///////////////////////////////////////////////////////////////////// /// Stores where a drag startet. ///////////////////////////////////////////////////////////////////// - + private Gtk.TreeIter? drag_start = null; - + ///////////////////////////////////////////////////////////////////// /// Rembers the time when a last drag move event was reported. Used /// to avoid frequent changes of selected Pie when a Pie is dragged @@ -49,45 +49,45 @@ class PieList : Gtk.TreeView { ///////////////////////////////////////////////////////////////////// private uint last_hover = 0; - + ///////////////////////////////////////////////////////////////////// /// C'tor, constructs the Widget. ///////////////////////////////////////////////////////////////////// public PieList() { GLib.Object(); - - this.data = new Gtk.ListStore(4, typeof(Gdk.Pixbuf), + + this.data = new Gtk.ListStore(4, typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string)); - + this.data.set_sort_column_id(DataPos.NAME, Gtk.SortType.ASCENDING); - + this.set_model(this.data); this.set_headers_visible(false); this.set_grid_lines(Gtk.TreeViewGridLines.NONE); this.width_request = 170; this.set_enable_search(false); - + this.set_events(Gdk.EventMask.POINTER_MOTION_MASK); - + var main_column = new Gtk.TreeViewColumn(); var icon_render = new Gtk.CellRendererPixbuf(); icon_render.xpad = 4; icon_render.ypad = 4; main_column.pack_start(icon_render, false); - + var name_render = new Gtk.CellRendererText(); name_render.ellipsize = Pango.EllipsizeMode.END; name_render.ellipsize_set = true; main_column.pack_start(name_render, true); - + base.append_column(main_column); - + main_column.add_attribute(icon_render, "pixbuf", DataPos.ICON); main_column.add_attribute(name_render, "text", DataPos.NAME); - + // setup drag'n'drop Gtk.TargetEntry uri_source = {"text/uri-list", 0, 0}; Gtk.TargetEntry[] entries = { uri_source }; @@ -100,7 +100,7 @@ class PieList : Gtk.TreeView { this.drag_leave.connect(() => { this.last_hover = 0; }); - + this.get_selection().changed.connect(() => { Gtk.TreeIter active; if (this.get_selection().get_selected(null, out active)) { @@ -109,35 +109,35 @@ class PieList : Gtk.TreeView { this.on_select(id); } }); - + reload_all(); } - + ///////////////////////////////////////////////////////////////////// /// Loads all existing Pies to the list. ///////////////////////////////////////////////////////////////////// - + public void reload_all() { Gtk.TreeIter active; string id = ""; if (this.get_selection().get_selected(null, out active)) this.data.get(active, DataPos.ID, out id); - + data.clear(); foreach (var pie in PieManager.all_pies.entries) { this.load_pie(pie.value); } - + select(id); } - + ///////////////////////////////////////////////////////////////////// /// Selects the first Pie. ///////////////////////////////////////////////////////////////////// - + public void select_first() { Gtk.TreeIter active; - + if(this.data.get_iter_first(out active) ) { this.get_selection().select_iter(active); string id = ""; @@ -147,45 +147,45 @@ class PieList : Gtk.TreeView { this.on_select(""); } } - + ///////////////////////////////////////////////////////////////////// /// Selects the Pie with the given ID. ///////////////////////////////////////////////////////////////////// - + public void select(string id) { this.data.foreach((model, path, iter) => { string pie_id; this.data.get(iter, DataPos.ID, out pie_id); - + if (id == pie_id) { this.get_selection().select_iter(iter); return true; } - + return false; }); } - + ///////////////////////////////////////////////////////////////////// /// Loads one given pie to the list. ///////////////////////////////////////////////////////////////////// - + private void load_pie(Pie pie) { if (pie.id.length == 3) { Gtk.TreeIter last; this.data.append(out last); var icon = new Icon(pie.icon, 24); - this.data.set(last, DataPos.ICON, icon.to_pixbuf(), + this.data.set(last, DataPos.ICON, icon.to_pixbuf(), DataPos.ICON_NAME, pie.icon, DataPos.NAME, pie.name, - DataPos.ID, pie.id); + DataPos.ID, pie.id); } } - + ///////////////////////////////////////////////////////////////////// /// Called when a drag which started on this Widget was successfull. ///////////////////////////////////////////////////////////////////// - + private void on_dnd_source(Gdk.DragContext context, Gtk.SelectionData selection_data, uint info, uint time_) { if (this.drag_start != null) { string id = ""; @@ -193,72 +193,72 @@ class PieList : Gtk.TreeView { selection_data.set_uris({"file://" + Paths.launchers + "/" + id + ".desktop"}); } } - + ///////////////////////////////////////////////////////////////////// /// Called when a drag operation is started on this Widget. ///////////////////////////////////////////////////////////////////// - + private void on_start_drag(Gdk.DragContext ctx) { if (this.get_selection().get_selected(null, out this.drag_start)) { string icon_name = ""; this.data.get(this.drag_start, DataPos.ICON_NAME, out icon_name); - + var icon = new Icon(icon_name, 48); var pixbuf = icon.to_pixbuf(); Gtk.drag_set_icon_pixbuf(ctx, pixbuf, icon.size()/2, icon.size()/2); } } - + ///////////////////////////////////////////////////////////////////// /// Called when something is dragged over this Widget. ///////////////////////////////////////////////////////////////////// - + private bool on_drag_move(Gdk.DragContext context, int x, int y, uint time) { - + Gtk.TreeViewDropPosition position; Gtk.TreePath path; - + if (!this.get_dest_row_at_pos(x, y, out path, out position)) return false; - + if (position == Gtk.TreeViewDropPosition.BEFORE) this.set_drag_dest_row(path, Gtk.TreeViewDropPosition.INTO_OR_BEFORE); else if (position == Gtk.TreeViewDropPosition.AFTER) this.set_drag_dest_row(path, Gtk.TreeViewDropPosition.INTO_OR_AFTER); Gdk.drag_status(context, context.get_suggested_action(), time); - + // avoid too frequent selection... this.last_hover = time; - + GLib.Timeout.add(150, () => { if (this.last_hover == time) - this.get_selection().select_path(path); + this.get_selection().select_path(path); return false; }); - + return true; } - + ///////////////////////////////////////////////////////////////////// /// Called when the user finishes a drag operation on this widget. /// Only used for external drags. ///////////////////////////////////////////////////////////////////// - - private void on_dnd_received(Gdk.DragContext context, int x, int y, + + private void on_dnd_received(Gdk.DragContext context, int x, int y, Gtk.SelectionData selection_data, uint info, uint time_) { - + Gtk.TreeIter active; if (this.get_selection().get_selected(null, out active)) { string id = ""; this.data.get(active, DataPos.ID, out id); - + var pie = PieManager.all_pies[id]; - + foreach (var uri in selection_data.get_uris()) { pie.add_action(ActionRegistry.new_for_uri(uri), 0); } - + this.on_select(id); } } diff --git a/src/gui/piePreview.vala b/src/gui/piePreview.vala index 0420d5e..ce1ba96 100644 --- a/src/gui/piePreview.vala +++ b/src/gui/piePreview.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { diff --git a/src/gui/piePreviewAddSign.vala b/src/gui/piePreviewAddSign.vala index ee8c14b..fb5e9fa 100644 --- a/src/gui/piePreviewAddSign.vala +++ b/src/gui/piePreviewAddSign.vala @@ -1,25 +1,25 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// using GLib.Math; namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A liitle plus-sign displayed on the preview widget to indicate where /// the user may add a new Slice. ///////////////////////////////////////////////////////////////////////// @@ -31,57 +31,57 @@ public class PiePreviewAddSign : GLib.Object { ///////////////////////////////////////////////////////////////////// public signal void on_clicked(int position); - + ///////////////////////////////////////////////////////////////////// /// The image used to display this oject. ///////////////////////////////////////////////////////////////////// - + public Image icon { get; private set; } - + ///////////////////////////////////////////////////////////////////// /// True, when the add sign is currently visible. ///////////////////////////////////////////////////////////////////// - + public bool visible { get; private set; default=false; } - + ///////////////////////////////////////////////////////////////////// /// The position of the sign in its parent Pie. May be 2.5 for /// example. ///////////////////////////////////////////////////////////////////// - + private double position = 0; - + ///////////////////////////////////////////////////////////////////// /// The parent renderer. ///////////////////////////////////////////////////////////////////// - private unowned PiePreviewRenderer parent; - + private unowned PiePreviewRenderer parent; + ///////////////////////////////////////////////////////////////////// /// Some values used for displaying this sign. ///////////////////////////////////////////////////////////////////// - + private double time = 0; - private double max_size = 0; - private double angle = 0; - private AnimatedValue size; - private AnimatedValue alpha; - private AnimatedValue activity; - private AnimatedValue clicked; - + private double max_size = 0; + private double angle = 0; + private AnimatedValue size; + private AnimatedValue alpha; + private AnimatedValue activity; + private AnimatedValue clicked; + ///////////////////////////////////////////////////////////////////// /// C'tor, sets everything up. ///////////////////////////////////////////////////////////////////// public PiePreviewAddSign(PiePreviewRenderer parent) { this.parent = parent; - + this.size = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, 0, 0, 0, 2.0); this.alpha = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, 0, 0, 0, 0.0); this.activity = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, -3, -3, 0, 0.0); this.clicked = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, 1, 1, 0, 0.0); } - + ///////////////////////////////////////////////////////////////////// /// Loads the desired icon for this sign. ///////////////////////////////////////////////////////////////////// @@ -89,41 +89,41 @@ public class PiePreviewAddSign : GLib.Object { public void load() { this.icon = new Icon("add", 36); } - + ///////////////////////////////////////////////////////////////////// /// Updates the position where this object should be displayed. ///////////////////////////////////////////////////////////////////// public void set_position(int position) { double new_position = position; - + if (!this.parent.drag_n_drop_mode) new_position += 0.5; this.position = new_position; this.angle = 2.0 * PI * new_position/parent.slice_count(); } - + ///////////////////////////////////////////////////////////////////// /// Makes this object visible. ///////////////////////////////////////////////////////////////////// - + public void show() { this.visible = true; - this.size.reset_target(this.max_size, 0.3); - this.alpha.reset_target(1.0, 0.3); + this.size.reset_target(this.max_size, 0.3); + this.alpha.reset_target(1.0, 0.3); } - + ///////////////////////////////////////////////////////////////////// /// Makes this object invisible. ///////////////////////////////////////////////////////////////////// - + public void hide() { this.visible = false; - this.size.reset_target(0.0, 0.3); - this.alpha.reset_target(0.0, 0.3); + this.size.reset_target(0.0, 0.3); + this.alpha.reset_target(0.0, 0.3); } - + ///////////////////////////////////////////////////////////////////// /// Updates the size of this object. All transitions will be smooth. ///////////////////////////////////////////////////////////////////// @@ -132,7 +132,7 @@ public class PiePreviewAddSign : GLib.Object { this.max_size = size; this.size.reset_target(size, 0.5); } - + ///////////////////////////////////////////////////////////////////// /// Draws the sign to the given context. ///////////////////////////////////////////////////////////////////// @@ -140,75 +140,75 @@ public class PiePreviewAddSign : GLib.Object { public void draw(double frame_time, Cairo.Context ctx) { this.time += frame_time; - + this.size.update(frame_time); this.alpha.update(frame_time); this.activity.update(frame_time); this.clicked.update(frame_time); - + if (this.parent.slice_count() == 0) { ctx.save(); - - double scale = this.clicked.val + + double scale = this.clicked.val + GLib.Math.sin(this.time*10)*0.02*this.alpha.val + this.alpha.val*0.08 - 0.1; ctx.scale(scale, scale); - + // paint the image icon.paint_on(ctx); - + ctx.restore(); - + } else if (this.alpha.val*this.activity.val > 0) { ctx.save(); - + // distance from the center double radius = 120; - + // transform the context ctx.translate(cos(this.angle)*radius, sin(this.angle)*radius); - double scale = this.size.val*this.clicked.val + double scale = this.size.val*this.clicked.val + this.activity.val*0.07 + GLib.Math.sin(this.time*10)*0.03*this.activity.val - 0.1; ctx.scale(scale, scale); - + // paint the image icon.paint_on(ctx, this.alpha.val*this.activity.val); - + ctx.restore(); } } - + ///////////////////////////////////////////////////////////////////// /// Called when the mouse moves to another position. ///////////////////////////////////////////////////////////////////// - + public void on_mouse_move(double angle) { double direction = 2.0 * PI * position/parent.slice_count(); double diff = fabs(angle-direction); - + if (diff > PI) - diff = 2 * PI - diff; - - if (diff < 0.5*PI/parent.slice_count()) this.activity.reset_target(1.0, 1.0); + diff = 2 * PI - diff; + + if (diff < 0.5*PI/parent.slice_count()) this.activity.reset_target(1.0, 1.0); else this.activity.reset_target(-3.0, 1.5); } - + ///////////////////////////////////////////////////////////////////// /// Called when a button of the mouse is pressed. ///////////////////////////////////////////////////////////////////// - + public void on_button_press(double x, double y) { if (this.activity.end == 1.0) { this.clicked.reset_target(0.9, 0.1); } } - + ///////////////////////////////////////////////////////////////////// /// Called when a button of the mouse is released. ///////////////////////////////////////////////////////////////////// - + public void on_button_release(double x, double y) { if (this.clicked.end == 0.9) { this.clicked.reset_target(1.0, 0.1); diff --git a/src/gui/piePreviewCenter.vala b/src/gui/piePreviewCenter.vala index 20527bc..2a163b6 100644 --- a/src/gui/piePreviewCenter.vala +++ b/src/gui/piePreviewCenter.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// using GLib.Math; diff --git a/src/gui/piePreviewDeleteSign.vala b/src/gui/piePreviewDeleteSign.vala index 500d876..6ba4dcb 100644 --- a/src/gui/piePreviewDeleteSign.vala +++ b/src/gui/piePreviewDeleteSign.vala @@ -1,25 +1,25 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// using GLib.Math; namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// The delete sign, displayed in the upper right corner of each /// Slice. ///////////////////////////////////////////////////////////////////////// @@ -31,17 +31,17 @@ public class PiePreviewDeleteSign : GLib.Object { ///////////////////////////////////////////////////////////////////// public signal void on_clicked(); - + ///////////////////////////////////////////////////////////////////// /// The image used to display this oject. ///////////////////////////////////////////////////////////////////// - + public Image icon { get; private set; } - + ///////////////////////////////////////////////////////////////////// /// Some constants determining the look and behaviour of this Slice. ///////////////////////////////////////////////////////////////////// - + private static const int radius = 18; private static const double globale_scale = 0.8; private static const double click_cancel_treshold = 5; @@ -51,24 +51,24 @@ public class PiePreviewDeleteSign : GLib.Object { ///////////////////////////////////////////////////////////////////// private bool visible = false; - + ///////////////////////////////////////////////////////////////////// /// Some AnimatedValues for smooth transitions. ///////////////////////////////////////////////////////////////////// - + private AnimatedValue size; - private AnimatedValue alpha; - private AnimatedValue activity; - private AnimatedValue clicked; - + private AnimatedValue alpha; + private AnimatedValue activity; + private AnimatedValue clicked; + ///////////////////////////////////////////////////////////////////// /// Storing the position where a mouse click was executed. Useful for /// canceling the click when the mouse moves some pixels. ///////////////////////////////////////////////////////////////////// - + private double clicked_x = 0.0; private double clicked_y = 0.0; - + ///////////////////////////////////////////////////////////////////// /// C'tor, sets everything up. ///////////////////////////////////////////////////////////////////// @@ -79,7 +79,7 @@ public class PiePreviewDeleteSign : GLib.Object { this.activity = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, -3, -3, 0, 0.0); this.clicked = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, 1, 1, 0, 0.0); } - + ///////////////////////////////////////////////////////////////////// /// Loads an Action. All members are initialized accordingly. ///////////////////////////////////////////////////////////////////// @@ -87,26 +87,26 @@ public class PiePreviewDeleteSign : GLib.Object { public void load() { this.icon = new Icon("stock_delete", PiePreviewDeleteSign.radius*2); } - + ///////////////////////////////////////////////////////////////////// /// Makes this object visible. ///////////////////////////////////////////////////////////////////// - + public void show() { if (!this.visible) { this.visible = true; - this.alpha.reset_target(1.0, 0.3); + this.alpha.reset_target(1.0, 0.3); } } - + ///////////////////////////////////////////////////////////////////// /// Makes this object invisible. ///////////////////////////////////////////////////////////////////// - + public void hide() { if (this.visible) { this.visible = false; - this.alpha.reset_target(0.0, 0.3); + this.alpha.reset_target(0.0, 0.3); } } @@ -117,7 +117,7 @@ public class PiePreviewDeleteSign : GLib.Object { public void set_size(double size) { this.size.reset_target(size, 0.2); } - + ///////////////////////////////////////////////////////////////////// /// Draws the sign to the given context. ///////////////////////////////////////////////////////////////////// @@ -127,46 +127,46 @@ public class PiePreviewDeleteSign : GLib.Object { this.alpha.update(frame_time); this.activity.update(frame_time); this.clicked.update(frame_time); - + if (this.alpha.val > 0) { ctx.save(); - + // transform the context - double scale = (this.size.val*this.clicked.val + double scale = (this.size.val*this.clicked.val + this.activity.val*0.2 - 0.2)*PiePreviewDeleteSign.globale_scale; ctx.scale(scale, scale); - + // paint the image icon.paint_on(ctx, this.alpha.val); - + ctx.restore(); } } - + ///////////////////////////////////////////////////////////////////// /// Called when the mouse moves to another position. ///////////////////////////////////////////////////////////////////// - + public bool on_mouse_move(double x, double y) { if (this.clicked.end == 0.9) { double dist = GLib.Math.pow(x-this.clicked_x, 2) + GLib.Math.pow(y-this.clicked_y, 2); if (dist > PiePreviewDeleteSign.click_cancel_treshold*PiePreviewDeleteSign.click_cancel_treshold) this.clicked.reset_target(1.0, 0.1); } - - if (GLib.Math.fabs(x) <= PiePreviewDeleteSign.radius*PiePreviewDeleteSign.globale_scale && GLib.Math.fabs(y) <= PiePreviewDeleteSign.radius*PiePreviewDeleteSign.globale_scale) { - this.activity.reset_target(1.0, 0.2); - return true; - } - + + if (GLib.Math.fabs(x) <= PiePreviewDeleteSign.radius*PiePreviewDeleteSign.globale_scale && GLib.Math.fabs(y) <= PiePreviewDeleteSign.radius*PiePreviewDeleteSign.globale_scale) { + this.activity.reset_target(1.0, 0.2); + return true; + } + this.activity.reset_target(0.0, 0.2); return false; } - + ///////////////////////////////////////////////////////////////////// /// Called when a button of the mouse is pressed. ///////////////////////////////////////////////////////////////////// - + public bool on_button_press(double x, double y) { if (this.activity.end == 1.0) { this.clicked.reset_target(0.9, 0.1); @@ -176,16 +176,16 @@ public class PiePreviewDeleteSign : GLib.Object { } return false; } - + ///////////////////////////////////////////////////////////////////// /// Called when a button of the mouse is released. ///////////////////////////////////////////////////////////////////// - + public bool on_button_release(double x, double y) { if (this.clicked.end == 0.9) { this.clicked.reset_target(1.0, 0.1); this.on_clicked(); - + return true; } return false; diff --git a/src/gui/piePreviewRenderer.vala b/src/gui/piePreviewRenderer.vala index 626ab73..53dd2fb 100644 --- a/src/gui/piePreviewRenderer.vala +++ b/src/gui/piePreviewRenderer.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// using GLib.Math; diff --git a/src/gui/piePreviewSliceRenderer.vala b/src/gui/piePreviewSliceRenderer.vala index 6a12a47..5b4d939 100644 --- a/src/gui/piePreviewSliceRenderer.vala +++ b/src/gui/piePreviewSliceRenderer.vala @@ -1,25 +1,25 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// using GLib.Math; namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// Displays the preview of a Slice. ///////////////////////////////////////////////////////////////////////// @@ -30,17 +30,17 @@ public class PiePreviewSliceRenderer : GLib.Object { ///////////////////////////////////////////////////////////////////// public signal void on_clicked(int position); - + ///////////////////////////////////////////////////////////////////// /// Called when the user clicked on the delete sign. ///////////////////////////////////////////////////////////////////// - + public signal void on_remove(int position); - + ///////////////////////////////////////////////////////////////////// /// The image used to display this oject. ///////////////////////////////////////////////////////////////////// - + public Icon icon { get; private set; } public ActionGroup action_group { get; private set; } public string name { get; private set; default=""; } @@ -50,47 +50,47 @@ public class PiePreviewSliceRenderer : GLib.Object { /// The parent renderer. ///////////////////////////////////////////////////////////////////// - private unowned PiePreviewRenderer parent; - + private unowned PiePreviewRenderer parent; + ///////////////////////////////////////////////////////////////////// /// The delete sign, displayed in the upper right corner of each /// Slice. ///////////////////////////////////////////////////////////////////// - + private PiePreviewDeleteSign delete_sign = null; - + ///////////////////////////////////////////////////////////////////// /// Some AnimatedValues for smooth transitions. ///////////////////////////////////////////////////////////////////// - - private AnimatedValue angle; - private AnimatedValue size; - private AnimatedValue activity; - private AnimatedValue clicked; - + + private AnimatedValue angle; + private AnimatedValue size; + private AnimatedValue activity; + private AnimatedValue clicked; + ///////////////////////////////////////////////////////////////////// /// Some constants determining the look and behaviour of this Slice. ///////////////////////////////////////////////////////////////////// - + private static const double pie_radius = 126; private static const double radius = 24; private static const double delete_x = 13; private static const double delete_y = -13; private static const double click_cancel_treshold = 5; - + ///////////////////////////////////////////////////////////////////// /// Storing the position where a mouse click was executed. Useful for /// canceling the click when the mouse moves some pixels. ///////////////////////////////////////////////////////////////////// - + private double clicked_x = 0.0; private double clicked_y = 0.0; - + ///////////////////////////////////////////////////////////////////// /// The index of this slice in a pie. Clockwise assigned, starting /// from the right-most slice. ///////////////////////////////////////////////////////////////////// - + private int position; ///////////////////////////////////////////////////////////////////// @@ -103,21 +103,21 @@ public class PiePreviewSliceRenderer : GLib.Object { this.delete_sign.on_clicked.connect(() => { this.on_remove(this.position); }); - + this.parent = parent; this.angle = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, 0, 0, 0, 0.5); this.size = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, 0, 0, 0, 1.0); this.activity = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, 0, 0, 0, 0.0); this.clicked = new AnimatedValue.cubic(AnimatedValue.Direction.OUT, 1, 1, 0, 1.0); } - + ///////////////////////////////////////////////////////////////////// /// Loads an Action. All members are initialized accordingly. ///////////////////////////////////////////////////////////////////// public void load(ActionGroup group) { this.action_group = group; - + // if it's a custom ActionGroup if (group.get_type().depth() == 2 && group.actions.size > 0) { this.icon = new Icon(group.actions[0].icon, (int)(PiePreviewSliceRenderer.radius*2)); @@ -127,23 +127,23 @@ public class PiePreviewSliceRenderer : GLib.Object { this.name = GroupRegistry.descriptions[group.get_type().name()].name; } } - + ///////////////////////////////////////////////////////////////////// /// Updates the position where this object should be displayed. ///////////////////////////////////////////////////////////////////// public void set_position(int position, bool smoothly = true) { double direction = 2.0 * PI * position/parent.slice_count(); - + if (direction != this.angle.end) { this.position = position; this.angle.reset_target(direction, smoothly ? 0.5 : 0.0); - + if (!smoothly) this.angle.update(1.0); } } - + ///////////////////////////////////////////////////////////////////// /// Updates the size of this object. All transitions will be smooth. ///////////////////////////////////////////////////////////////////// @@ -152,15 +152,15 @@ public class PiePreviewSliceRenderer : GLib.Object { this.size.reset_target(size, 0.5); this.delete_sign.set_size(size); } - + ///////////////////////////////////////////////////////////////////// /// Notifies that all quick actions should be disabled. ///////////////////////////////////////////////////////////////////// - + public void disable_quickactions() { this.action_group.disable_quickactions(); } - + ///////////////////////////////////////////////////////////////////// /// Draws the slice to the given context. ///////////////////////////////////////////////////////////////////// @@ -172,100 +172,100 @@ public class PiePreviewSliceRenderer : GLib.Object { this.clicked.update(frame_time); ctx.save(); - + // transform the context ctx.translate(cos(this.angle.val)*PiePreviewSliceRenderer.pie_radius, sin(this.angle.val)*PiePreviewSliceRenderer.pie_radius); - - double scale = this.size.val*this.clicked.val + + double scale = this.size.val*this.clicked.val + this.activity.val*0.1 - 0.1; - ctx.save(); - + ctx.save(); + ctx.scale(scale, scale); - + // paint the image icon.paint_on(ctx); - + ctx.restore(); - + ctx.translate(PiePreviewSliceRenderer.delete_x*this.size.val, PiePreviewSliceRenderer.delete_y*this.size.val); this.delete_sign.draw(frame_time, ctx); - + ctx.restore(); } - + ///////////////////////////////////////////////////////////////////// /// Called when the mouse moves to another position. ///////////////////////////////////////////////////////////////////// - + public bool on_mouse_move(double angle, double x, double y) { double direction = 2.0 * PI * position/parent.slice_count(); double diff = fabs(angle-direction); - + if (diff > PI) - diff = 2 * PI - diff; - - bool active = diff < 0.5*PI/parent.slice_count(); - - if (active) { - this.activity.reset_target(1.0, 0.3); - this.delete_sign.show(); + diff = 2 * PI - diff; + + bool active = diff < 0.5*PI/parent.slice_count(); + + if (active) { + this.activity.reset_target(1.0, 0.3); + this.delete_sign.show(); } else { this.activity.reset_target(0.0, 0.3); this.delete_sign.hide(); - } - + } + if (this.clicked.end == 0.9) { double dist = GLib.Math.pow(x-this.clicked_x, 2) + GLib.Math.pow(y-this.clicked_y, 2); if (dist > PiePreviewSliceRenderer.click_cancel_treshold*PiePreviewSliceRenderer.click_cancel_treshold) this.clicked.reset_target(1.0, 0.1); } - + double own_x = cos(this.angle.val)*PiePreviewSliceRenderer.pie_radius; double own_y = sin(this.angle.val)*PiePreviewSliceRenderer.pie_radius; - this.delete_hovered = this.delete_sign.on_mouse_move(x - own_x - PiePreviewSliceRenderer.delete_x*this.size.val, + this.delete_hovered = this.delete_sign.on_mouse_move(x - own_x - PiePreviewSliceRenderer.delete_x*this.size.val, y - own_y - PiePreviewSliceRenderer.delete_y*this.size.val); - + return active; } - + ///////////////////////////////////////////////////////////////////// /// Called when the mouse leaves the area of this widget. ///////////////////////////////////////////////////////////////////// - + public void on_mouse_leave() { this.activity.reset_target(0.0, 0.3); this.delete_sign.hide(); } - + ///////////////////////////////////////////////////////////////////// /// Called when a button of the mouse is pressed. ///////////////////////////////////////////////////////////////////// - + public void on_button_press(double x, double y) { bool delete_pressed = false; if (this.activity.end == 1.0) { double own_x = cos(this.angle.val)*PiePreviewSliceRenderer.pie_radius; double own_y = sin(this.angle.val)*PiePreviewSliceRenderer.pie_radius; - delete_pressed = this.delete_sign.on_button_press(x - own_x - PiePreviewSliceRenderer.delete_x*this.size.val, + delete_pressed = this.delete_sign.on_button_press(x - own_x - PiePreviewSliceRenderer.delete_x*this.size.val, y - own_y - PiePreviewSliceRenderer.delete_y*this.size.val); } - + if (!delete_pressed && this.activity.end == 1.0) { this.clicked.reset_target(0.9, 0.1); this.clicked_x = x; this.clicked_y = y; } } - + ///////////////////////////////////////////////////////////////////// /// Called when a button of the mouse is released. ///////////////////////////////////////////////////////////////////// - + public void on_button_release(double x, double y) { bool deleted = false; if (this.activity.end == 1.0) deleted = this.delete_sign.on_button_release(x, y); - + if (!deleted && this.clicked.end == 0.9) { this.clicked.reset_target(1.0, 0.1); this.on_clicked(this.position); diff --git a/src/gui/preferencesWindow.vala b/src/gui/preferencesWindow.vala index 8cdc853..29b5250 100644 --- a/src/gui/preferencesWindow.vala +++ b/src/gui/preferencesWindow.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { diff --git a/src/gui/renameWindow.vala b/src/gui/renameWindow.vala index 389b460..de65069 100644 --- a/src/gui/renameWindow.vala +++ b/src/gui/renameWindow.vala @@ -1,106 +1,106 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A window which allows selection of a new name for a Pie. ///////////////////////////////////////////////////////////////////////// public class RenameWindow : GLib.Object { - + ///////////////////////////////////////////////////////////////////// /// Gets emitted when the user selects a new name. ///////////////////////////////////////////////////////////////////// - + public signal void on_ok(string new_name); - + ///////////////////////////////////////////////////////////////////// /// Some Widgets used by this dialog. ///////////////////////////////////////////////////////////////////// - + private Gtk.Dialog window = null; private Gtk.Entry entry = null; - + ///////////////////////////////////////////////////////////////////// /// C'tor, constructs the Widget. ///////////////////////////////////////////////////////////////////// - + public RenameWindow() { try { - + Gtk.Builder builder = new Gtk.Builder(); builder.add_from_file (Paths.ui_files + "/rename_pie.ui"); window = builder.get_object("window") as Gtk.Dialog; entry = builder.get_object("name-entry") as Gtk.Entry; - + entry.activate.connect(this.on_ok_button_clicked); - + (builder.get_object("ok-button") as Gtk.Button).clicked.connect(on_ok_button_clicked); (builder.get_object("cancel-button") as Gtk.Button).clicked.connect(on_cancel_button_clicked); - + this.window.delete_event.connect(this.window.hide_on_delete); - + } catch (GLib.Error e) { error("Could not load UI: %s\n", e.message); } } - + ///////////////////////////////////////////////////////////////////// /// Sets the parent window, in order to make this window stay in /// front. ///////////////////////////////////////////////////////////////////// - + public void set_parent(Gtk.Window parent) { this.window.set_transient_for(parent); } - + ///////////////////////////////////////////////////////////////////// /// Displays the window on the screen. ///////////////////////////////////////////////////////////////////// - + public void show() { this.window.show_all(); this.entry.is_focus = true; - } - + } + ///////////////////////////////////////////////////////////////////// /// Make the text entry display the name of the Pie with given ID. ///////////////////////////////////////////////////////////////////// - + public void set_pie(string id) { entry.text = PieManager.get_name_of(id); } - + ///////////////////////////////////////////////////////////////////// /// Called when the ok button is pressed. ///////////////////////////////////////////////////////////////////// - + private void on_ok_button_clicked() { this.on_ok(entry.text); this.window.hide(); } - + ///////////////////////////////////////////////////////////////////// /// Called when the cancel button is pressed. ///////////////////////////////////////////////////////////////////// - + private void on_cancel_button_clicked() { this.window.hide(); } diff --git a/src/gui/settingsWindow.vala b/src/gui/settingsWindow.vala index b03ae2f..6bb10c1 100644 --- a/src/gui/settingsWindow.vala +++ b/src/gui/settingsWindow.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { @@ -99,13 +99,21 @@ public class SettingsWindow : GLib.Object { }); var range_slider = (builder.get_object("range-hscale") as Gtk.Scale); - range_slider.set_range(100, 2000); + range_slider.set_range(0, 2000); range_slider.set_increments(10, 100); range_slider.set_value(Config.global.activation_range); range_slider.value_changed.connect(() => { Config.global.activation_range = (int)range_slider.get_value(); }); + var range_slices = (builder.get_object("range-slices") as Gtk.Scale); + range_slices.set_range(12, 96); + range_slices.set_increments(4, 12); + range_slices.set_value(Config.global.max_visible_slices); + range_slices.value_changed.connect(() => { + Config.global.max_visible_slices = (int)range_slices.get_value(); + }); + this.window.delete_event.connect(this.window.hide_on_delete); } catch (GLib.Error e) { diff --git a/src/gui/sliceTypeList.vala b/src/gui/sliceTypeList.vala index a339e5e..e164dea 100644 --- a/src/gui/sliceTypeList.vala +++ b/src/gui/sliceTypeList.vala @@ -1,23 +1,23 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A list displaying all available Action types and ActionGroup types. ///////////////////////////////////////////////////////////////////////// @@ -26,13 +26,13 @@ class SliceTypeList : Gtk.TreeView { ///////////////////////////////////////////////////////////////////// /// This signal gets emitted when the user selects a new Type. ///////////////////////////////////////////////////////////////////// - + public signal void on_select(string id, string icon_name); - + ///////////////////////////////////////////////////////////////////// /// The listore which staroes all types internally. ///////////////////////////////////////////////////////////////////// - + private Gtk.ListStore data; private enum DataPos {ICON, ICON_NAME, NAME, ID} @@ -42,33 +42,33 @@ class SliceTypeList : Gtk.TreeView { public SliceTypeList() { GLib.Object(); - - this.data = new Gtk.ListStore(4, typeof(Gdk.Pixbuf), + + this.data = new Gtk.ListStore(4, typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string)); - + this.data.set_sort_column_id(2, Gtk.SortType.ASCENDING); - + base.set_model(this.data); base.set_headers_visible(true); base.set_grid_lines(Gtk.TreeViewGridLines.NONE); this.set_fixed_height_mode(true); - + var main_column = new Gtk.TreeViewColumn(); main_column.set_sizing(Gtk.TreeViewColumnSizing.FIXED); main_column.title = _("Slice types"); var icon_render = new Gtk.CellRendererPixbuf(); main_column.pack_start(icon_render, false); - + var name_render = new Gtk.CellRendererText(); main_column.pack_start(name_render, true); - + base.append_column(main_column); - + main_column.add_attribute(icon_render, "pixbuf", DataPos.ICON); main_column.add_attribute(name_render, "markup", DataPos.NAME); - + this.get_selection().changed.connect(() => { Gtk.TreeIter active; if (this.get_selection().get_selected(null, out active)) { @@ -79,59 +79,59 @@ class SliceTypeList : Gtk.TreeView { this.on_select(id, icon); } }); - + reload_all(); } - + ///////////////////////////////////////////////////////////////////// /// Loads a registered actions and action groups. ///////////////////////////////////////////////////////////////////// - + public void reload_all() { Gtk.TreeIter active; string current_id = ""; if (this.get_selection().get_selected(null, out active)) this.data.get(active, DataPos.ID, out current_id); - + data.clear(); - + foreach (var action_type in ActionRegistry.types) { var description = ActionRegistry.descriptions[action_type]; - + Gtk.TreeIter current; data.append(out current); var icon = new Icon(description.icon, 36); - data.set(current, DataPos.ICON, icon.to_pixbuf()); - data.set(current, DataPos.ICON_NAME, description.icon); + data.set(current, DataPos.ICON, icon.to_pixbuf()); + data.set(current, DataPos.ICON_NAME, description.icon); data.set(current, DataPos.NAME, "" + GLib.Markup.escape_text(description.name) + "\n" - + "" + GLib.Markup.escape_text(description.description) + ""); - data.set(current, DataPos.ID, description.id); + + "" + GLib.Markup.escape_text(description.description) + ""); + data.set(current, DataPos.ID, description.id); } - + foreach (var group_type in GroupRegistry.types) { var description = GroupRegistry.descriptions[group_type]; - + Gtk.TreeIter current; data.append(out current); var icon = new Icon(description.icon, 36); - data.set(current, DataPos.ICON, icon.to_pixbuf()); + data.set(current, DataPos.ICON, icon.to_pixbuf()); data.set(current, DataPos.ICON_NAME, description.icon); data.set(current, DataPos.NAME, "" + GLib.Markup.escape_text(description.name) + "\n" - + "" + GLib.Markup.escape_text(description.description) + ""); - data.set(current, DataPos.ID, description.id); + + "" + GLib.Markup.escape_text(description.description) + ""); + data.set(current, DataPos.ID, description.id); } - + select_first(); select(current_id); } - + ///////////////////////////////////////////////////////////////////// /// Selects the first type in the list. ///////////////////////////////////////////////////////////////////// - + public void select_first() { Gtk.TreeIter active; - + if(this.data.get_iter_first(out active) ) { this.get_selection().select_iter(active); string id = ""; @@ -143,16 +143,16 @@ class SliceTypeList : Gtk.TreeView { this.on_select("", "stock_unknown"); } } - + ///////////////////////////////////////////////////////////////////// /// Select the given slice type. ///////////////////////////////////////////////////////////////////// - + public void select(string id) { this.data.foreach((model, path, iter) => { string pie_id; this.data.get(iter, DataPos.ID, out pie_id); - + if (id == pie_id) { this.get_selection().select_iter(iter); string icon = ""; @@ -160,10 +160,10 @@ class SliceTypeList : Gtk.TreeView { this.on_select(pie_id, icon); this.scroll_to_cell(path, null, true, 0.5f, 0.5f); this.has_focus = true; - + return true; } - + return false; }); } diff --git a/src/gui/themeList.vala b/src/gui/themeList.vala index 1c038a9..4173819 100644 --- a/src/gui/themeList.vala +++ b/src/gui/themeList.vala @@ -1,23 +1,23 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A widget displaying all available themes of Gnome-Pie. ///////////////////////////////////////////////////////////////////////// @@ -26,7 +26,7 @@ class ThemeList : Gtk.TreeView { ///////////////////////////////////////////////////////////////////// /// This signal gets emitted, when a new theme is selected by the /// user. This new theme is applied automatically, with this signal - /// actions may be triggered which should be executed AFTER the + /// actions may be triggered which should be executed AFTER the /// change to a new theme. ///////////////////////////////////////////////////////////////////// @@ -37,11 +37,11 @@ class ThemeList : Gtk.TreeView { ///////////////////////////////////////////////////////////////////// private Gtk.TreeIter active { private get; private set; } - + ///////////////////////////////////////////////////////////////////// /// The positions in the data list store. ///////////////////////////////////////////////////////////////////// - + private enum DataPos {ICON, NAME} ///////////////////////////////////////////////////////////////////// @@ -50,57 +50,57 @@ class ThemeList : Gtk.TreeView { public ThemeList() { GLib.Object(); - - var data = new Gtk.ListStore(2, typeof(Gdk.Pixbuf), + + var data = new Gtk.ListStore(2, typeof(Gdk.Pixbuf), typeof(string)); this.set_model(data); this.set_headers_visible(true); this.set_grid_lines(Gtk.TreeViewGridLines.NONE); this.set_fixed_height_mode(true); - + var main_column = new Gtk.TreeViewColumn(); main_column.title = _("Themes"); main_column.set_sizing(Gtk.TreeViewColumnSizing.FIXED); var icon_render = new Gtk.CellRendererPixbuf(); main_column.pack_start(icon_render, false); - + var theme_render = new Gtk.CellRendererText(); main_column.pack_start(theme_render, true); - + this.append_column(main_column); - + main_column.add_attribute(icon_render, "pixbuf", DataPos.ICON); main_column.add_attribute(theme_render, "markup", DataPos.NAME); - + this.get_selection().changed.connect(() => { Gtk.TreeIter active; if (this.get_selection().get_selected(null, out active)) { Timeout.add(10, () => { int index = int.parse(data.get_path(active).to_string()); Config.global.theme = Config.global.themes[index]; - + this.on_select_new(); - + Config.global.theme.load(); Config.global.theme.load_images(); return false; - }); + }); } }); - + // load all themes into the list var themes = Config.global.themes; foreach(var theme in themes) { Gtk.TreeIter current; data.append(out current); - data.set(current, DataPos.ICON, theme.preview_icon.to_pixbuf()); + data.set(current, DataPos.ICON, theme.preview_icon.to_pixbuf()); data.set(current, DataPos.NAME, ""+GLib.Markup.escape_text(theme.name)+" - " +GLib.Markup.escape_text(theme.description)+"\n" +""+GLib.Markup.escape_text(_("By")+" "+theme.author) - +""); + +""); if(theme == Config.global.theme) get_selection().select_iter(current); - } + } } } diff --git a/src/gui/triggerSelectButton.vala b/src/gui/triggerSelectButton.vala index 7132220..92cd8a3 100644 --- a/src/gui/triggerSelectButton.vala +++ b/src/gui/triggerSelectButton.vala @@ -1,64 +1,64 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// This window allows the selection of a hotkey. It is returned in form /// of a Trigger. Therefore it can be either a keyboard driven hotkey or /// a mouse based hotkey. ///////////////////////////////////////////////////////////////////////// public class TriggerSelectButton : Gtk.ToggleButton { - + ///////////////////////////////////////////////////////////////////// /// This signal is emitted when the user selects a new hot key. ///////////////////////////////////////////////////////////////////// - + public signal void on_select(Trigger trigger); - + ///////////////////////////////////////////////////////////////////// /// The currently contained Trigger. ///////////////////////////////////////////////////////////////////// - + private Trigger trigger = null; - + ///////////////////////////////////////////////////////////////////// /// True, if mouse buttons can be bound as well. ///////////////////////////////////////////////////////////////////// - + private bool enable_mouse = false; - + ///////////////////////////////////////////////////////////////////// /// These modifiers are ignored. ///////////////////////////////////////////////////////////////////// - + private Gdk.ModifierType lock_modifiers = Gdk.ModifierType.MOD2_MASK |Gdk.ModifierType.SUPER_MASK |Gdk.ModifierType.LOCK_MASK |Gdk.ModifierType.MOD5_MASK; - + ///////////////////////////////////////////////////////////////////// /// C'tor, constructs a new TriggerSelectWindow. ///////////////////////////////////////////////////////////////////// - + public TriggerSelectButton(bool enable_mouse) { this.enable_mouse = enable_mouse; - + this.toggled.connect(() => { if (this.active) { this.set_label(_("Press a hotkey ...")); @@ -66,49 +66,49 @@ public class TriggerSelectButton : Gtk.ToggleButton { FocusGrabber.grab(this.get_window(), true, true, true); } }); - + this.button_press_event.connect(this.on_button_press); this.key_press_event.connect(this.on_key_press); this.set_trigger(new Trigger()); } - + ///////////////////////////////////////////////////////////////////// /// Makes the button display the given Trigger. ///////////////////////////////////////////////////////////////////// - + public void set_trigger(Trigger trigger) { this.trigger = trigger; this.set_label(trigger.label); } - + ///////////////////////////////////////////////////////////////////// /// Can be called to cancel the selection process. ///////////////////////////////////////////////////////////////////// - + private void cancel() { this.set_label(trigger.label); this.set_active(false); Gtk.grab_remove(this); FocusGrabber.ungrab(true, true); } - + ///////////////////////////////////////////////////////////////////// /// Makes the button display the given Trigger. ///////////////////////////////////////////////////////////////////// - + private void update_trigger(Trigger trigger) { if (this.trigger.name != trigger.name) { this.set_trigger(trigger); this.on_select(this.trigger); } - + this.cancel(); } - + ///////////////////////////////////////////////////////////////////// /// Called when the user presses a keyboard key. ///////////////////////////////////////////////////////////////////// - + private bool on_key_press(Gdk.EventKey event) { if (this.active) { if (Gdk.keyval_name(event.keyval) == "Escape") { @@ -117,44 +117,45 @@ public class TriggerSelectButton : Gtk.ToggleButton { this.update_trigger(new Trigger()); } else if (event.is_modifier == 0) { Gdk.ModifierType state = event.state & ~ this.lock_modifiers; - this.update_trigger(new Trigger.from_values(event.keyval, state, false, false, false, false)); + this.update_trigger(new Trigger.from_values(event.keyval, state, false, false, false, + false, false, 5)); } - + return true; } return false; } - + ///////////////////////////////////////////////////////////////////// /// Called when the user presses a button of the mouse. ///////////////////////////////////////////////////////////////////// - + private bool on_button_press(Gdk.EventButton event) { if (this.active) { Gtk.Allocation rect; this.get_allocation(out rect); if (event.x < 0 || event.x > rect.width || event.y < 0 || event.y > rect.height) { - + this.cancel(); return true; } } - + if (this.active && this.enable_mouse) { Gdk.ModifierType state = event.state & ~ this.lock_modifiers; var new_trigger = new Trigger.from_values((int)event.button, state, true, - false, false, false); - + false, false, false, false, 5); + if (new_trigger.key_code != 1) this.update_trigger(new_trigger); else this.cancel(); - + return true; } else if (this.active) { this.cancel(); return true; } - + return false; } } diff --git a/src/gui/triggerSelectWindow.vala b/src/gui/triggerSelectWindow.vala index 611c179..56781b4 100644 --- a/src/gui/triggerSelectWindow.vala +++ b/src/gui/triggerSelectWindow.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { @@ -39,6 +39,8 @@ public class TriggerSelectWindow : GLib.Object { private Gtk.CheckButton turbo; private Gtk.CheckButton delayed; private Gtk.CheckButton centered; + private Gtk.CheckButton warp; + private Gtk.RadioButton rshape[10]; private TriggerSelectButton button; ///////////////////////////////////////////////////////////////////// @@ -55,6 +57,13 @@ public class TriggerSelectWindow : GLib.Object { private Trigger original_trigger = null; + ///////////////////////////////////////////////////////////////////// + /// Radioboxes call toggled() twice per selection change. + /// This flag is used to discard one of the two notifications. + ///////////////////////////////////////////////////////////////////// + + private static int notify_toggle= 0; + ///////////////////////////////////////////////////////////////////// /// C'tor, constructs a new TriggerSelectWindow. ///////////////////////////////////////////////////////////////////// @@ -76,7 +85,9 @@ public class TriggerSelectWindow : GLib.Object { trigger.with_mouse, this.turbo.active, this.delayed.active, - this.centered.active); + this.centered.active, + this.warp.active, + this.get_radio_shape()); }); (builder.get_object("trigger-box") as Gtk.Box).pack_start(this.button, true, true); @@ -93,6 +104,14 @@ public class TriggerSelectWindow : GLib.Object { this.centered = builder.get_object("center-check") as Gtk.CheckButton; this.centered.toggled.connect(this.on_check_toggled); + this.warp = builder.get_object("warp-check") as Gtk.CheckButton; + this.warp.toggled.connect(this.on_check_toggled); + + for (int i= 0; i < 10; i++) { + this.rshape[i] = builder.get_object("rshape%d".printf(i)) as Gtk.RadioButton; + this.rshape[i].toggled.connect(this.on_radio_toggled); + } + this.window.delete_event.connect(this.window.hide_on_delete); } catch (GLib.Error e) { @@ -128,6 +147,8 @@ public class TriggerSelectWindow : GLib.Object { this.turbo.active = trigger.turbo; this.delayed.active = trigger.delayed; this.centered.active = trigger.centered; + this.warp.active = trigger.warp; + this.set_radio_shape( trigger.shape ); this.original_trigger = trigger; this.trigger = trigger; @@ -135,14 +156,53 @@ public class TriggerSelectWindow : GLib.Object { } ///////////////////////////////////////////////////////////////////// - /// Called when one of the three checkoxes is toggled. + /// Called when one of the checkboxes is toggled. ///////////////////////////////////////////////////////////////////// private void on_check_toggled() { if (this.trigger != null) this.trigger = new Trigger.from_values(this.trigger.key_sym, this.trigger.modifiers, this.trigger.with_mouse, this.turbo.active, - this.delayed.active, this.centered.active); + this.delayed.active, this.centered.active, + this.warp.active, + this.get_radio_shape()); + } + + ///////////////////////////////////////////////////////////////////// + /// Returns the current selected radio-button shape: 0= automatic + /// 5= full pie; 1,3,7,8= quarters; 2,4,6,8=halves + /// 1 | 4 | 7 + /// 2 | 5 | 8 + /// 3 | 6 | 9 + ///////////////////////////////////////////////////////////////////// + + private int get_radio_shape() { + int rs; + for (rs= 0; rs < 10; rs++) + if (this.rshape[rs].active) + break; + return rs; + } + + ///////////////////////////////////////////////////////////////////// + /// Sets the current selected radio-button shape: 0= automatic + /// 5= full pie; 1,3,7,8= quarters; 2,4,6,8=halves + ///////////////////////////////////////////////////////////////////// + + private void set_radio_shape(int rs) { + if (rs < 0 || rs > 9) + rs= 5; //replace invalid value with default= full pie + this.rshape[rs].active= true; + } + + ///////////////////////////////////////////////////////////////////// + /// Called twice when one of the radioboxes is toggled. + ///////////////////////////////////////////////////////////////////// + + private void on_radio_toggled() { + notify_toggle= 1 - notify_toggle; + if (notify_toggle == 1) + on_check_toggled(); //just call once } ///////////////////////////////////////////////////////////////////// diff --git a/src/images/icon.vala b/src/images/icon.vala index 6dfb53b..9cfccf8 100644 --- a/src/images/icon.vala +++ b/src/images/icon.vala @@ -1,23 +1,23 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A class representing a square-shaped icon, loaded from the users /// icon theme. ///////////////////////////////////////////////////////////////////////// @@ -30,34 +30,34 @@ public class Icon : Image { ///////////////////////////////////////////////////////////////////// private static Gee.HashMap cache { private get; private set; } - + ///////////////////////////////////////////////////////////////////// /// Initializes the cache. ///////////////////////////////////////////////////////////////////// - + public static void init() { clear_cache(); - + Gtk.IconTheme.get_default().changed.connect(() => { clear_cache(); }); } - + ///////////////////////////////////////////////////////////////////// /// Clears the cache. ///////////////////////////////////////////////////////////////////// - + public static void clear_cache() { cache = new Gee.HashMap(); } - + ///////////////////////////////////////////////////////////////////// /// Loads an icon from the current icon theme of the user. ///////////////////////////////////////////////////////////////////// - + public Icon(string icon_name, int size) { var cached = Icon.cache.get("%s@%u".printf(icon_name, size)); - + if (cached == null) { this.load_file_at_size(Icon.get_icon_file(icon_name, size), size, size); Icon.cache.set("%s@%u".printf(icon_name, size), this.surface); @@ -65,56 +65,56 @@ public class Icon : Image { this.surface = cached; } } - + ///////////////////////////////////////////////////////////////////// /// Returns the size of the icon in pixels. Greetings to Liskov. ///////////////////////////////////////////////////////////////////// - + public int size() { return base.width(); } - + ///////////////////////////////////////////////////////////////////// /// Returns the icon name for a given GLib.Icon. ///////////////////////////////////////////////////////////////////// - + public static string get_icon_name(GLib.Icon? icon) { if (icon != null) { var icon_names = icon.to_string().split(" "); - + foreach (var icon_name in icon_names) { if (Gtk.IconTheme.get_default().has_icon(icon_name)) { return icon_name; } } } - + return ""; } - + ///////////////////////////////////////////////////////////////////// /// Returns the filename for a given system icon. ///////////////////////////////////////////////////////////////////// - + public static string get_icon_file(string icon_name, int size) { string result = ""; - + if (icon_name.contains("/")) { var file = GLib.File.new_for_path(icon_name); if(file.query_exists()) return icon_name; - + warning("Icon \"" + icon_name + "\" not found! Using default icon..."); } - - + + var icon_theme = Gtk.IconTheme.get_default(); var file = icon_theme.lookup_icon(icon_name, size, 0); if (file != null) result = file.get_filename(); - + if (result == "") { warning("Icon \"" + icon_name + "\" not found! Using default icon..."); - + string[] default_icons = {"application-default-icon", "stock_unknown"}; foreach (var icon in default_icons) { file = icon_theme.lookup_icon(icon, size, 0); @@ -123,11 +123,11 @@ public class Icon : Image { break; } } - + if (result == "") warning("No default icon found! Will be ugly..."); } - + return result; } } diff --git a/src/images/image.vala b/src/images/image.vala index e65e34a..a903493 100644 --- a/src/images/image.vala +++ b/src/images/image.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { @@ -163,10 +163,10 @@ public class Image : GLib.Object { ///////////////////////////////////////////////////////////////////// public Gdk.Pixbuf to_pixbuf() { - if (this.surface == null || this.surface.get_data().length <= 0) + if (this.surface == null || this.surface.get_data() == null) return new Gdk.Pixbuf(Gdk.Colorspace.RGB, true, 8, 1, 1); - var pixbuf = new Gdk.Pixbuf.from_data(this.surface.get_data(), Gdk.Colorspace.RGB, true, 8, + var pixbuf = new Gdk.Pixbuf.with_unowned_data(this.surface.get_data(), Gdk.Colorspace.RGB, true, 8, width(), height(), this.surface.get_stride(), null); pixbuf = pixbuf.copy(); @@ -180,7 +180,7 @@ public class Image : GLib.Object { *(p + i + 2) = tmp; } - return pixbuf; + return pixbuf; } ///////////////////////////////////////////////////////////////////// diff --git a/src/images/renderedText.vala b/src/images/renderedText.vala index 544af1f..2f4b82f 100644 --- a/src/images/renderedText.vala +++ b/src/images/renderedText.vala @@ -1,149 +1,149 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A class representing string, rendered on an Image. ///////////////////////////////////////////////////////////////////////// public class RenderedText : Image { - + ///////////////////////////////////////////////////////////////////// /// C'tor, creates a new image representation of a string. ///////////////////////////////////////////////////////////////////// - + public RenderedText(string text, int width, int height, string font, Color color, double scale) { - + this.render_text(text, width, height, font, color, scale); } - + ///////////////////////////////////////////////////////////////////// /// C'tor, creates a new image representation of a string. This /// string may contain markup information. ///////////////////////////////////////////////////////////////////// - + public RenderedText.with_markup(string text, int width, int height, string font, Color color, double scale) { this.render_markup(text, width, height, font, color, scale); } - + ///////////////////////////////////////////////////////////////////// /// Creates a new transparent image, with text written onto. ///////////////////////////////////////////////////////////////////// - - public void render_text(string text, int width, int height, string font, + + public void render_text(string text, int width, int height, string font, Color color, double scale) { - + this.surface = new Cairo.ImageSurface(Cairo.Format.ARGB32, width, height); if (text != "") { var ctx = this.context(); - + // set the color ctx.set_source_rgb(color.r, color.g, color.g); - - var layout = Pango.cairo_create_layout(ctx); + + var layout = Pango.cairo_create_layout(ctx); layout.set_width(Pango.units_from_double(width)); - + var font_description = Pango.FontDescription.from_string(font); font_description.set_size((int)(font_description.get_size() * scale)); - + layout.set_font_description(font_description); layout.set_text(text, -1); - + // add newlines at the end of each line, in order to allow ellipsizing string broken_string = ""; - + for (int i=0; i height) broken_string = broken_string + next_line; else broken_string = broken_string_tmp; } } - + layout.set_text(broken_string, -1); - + layout.set_ellipsize(Pango.EllipsizeMode.END); layout.set_alignment(Pango.Alignment.CENTER); - + Pango.Rectangle extents; layout.get_pixel_extents(null, out extents); ctx.move_to(0, (int)(0.5*(height - extents.height))); - + Pango.cairo_update_layout(ctx, layout); Pango.cairo_show_layout(ctx, layout); } } - + ///////////////////////////////////////////////////////////////////// /// Creates a new transparent image, with text written onto. ///////////////////////////////////////////////////////////////////// - - public void render_markup(string text, int width, int height, string font, + + public void render_markup(string text, int width, int height, string font, Color color, double scale) { - + this.surface = new Cairo.ImageSurface(Cairo.Format.ARGB32, width, height); var ctx = this.context(); - - // set the color + + // set the color ctx.set_source_rgb(color.r, color.g, color.g); - - var layout = Pango.cairo_create_layout(ctx); + + var layout = Pango.cairo_create_layout(ctx); layout.set_width(Pango.units_from_double(width)); - + var font_description = Pango.FontDescription.from_string(font); font_description.set_size((int)(font_description.get_size() * scale)); - + layout.set_font_description(font_description); layout.set_markup(text, -1); - + layout.set_ellipsize(Pango.EllipsizeMode.END); layout.set_alignment(Pango.Alignment.CENTER); - + Pango.Rectangle extents; layout.get_pixel_extents(null, out extents); ctx.move_to(0, (int)(0.5*(height - extents.height))); - + Pango.cairo_update_layout(ctx, layout); Pango.cairo_show_layout(ctx, layout); } diff --git a/src/images/themedIcon.vala b/src/images/themedIcon.vala index f816e0f..b7b6f74 100644 --- a/src/images/themedIcon.vala +++ b/src/images/themedIcon.vala @@ -1,96 +1,96 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A class representing a square-shaped icon, themed according to the /// current theme of Gnome-Pie. ///////////////////////////////////////////////////////////////////////// public class ThemedIcon : Image { - + ///////////////////////////////////////////////////////////////////// /// Paint a slice icon according to the current theme. ///////////////////////////////////////////////////////////////////// - + public ThemedIcon(string caption, string icon_name, bool active) { - + // get layers for the desired slice type var layers = active ? Config.global.theme.active_slice_layers : Config.global.theme.inactive_slice_layers; - + // get max size int size = 1; foreach (var layer in layers) { - if (layer.image != null && layer.image.width() > size) + if (layer.image != null && layer.image.width() > size) size = layer.image.width(); } - + this.surface = new Cairo.ImageSurface(Cairo.Format.ARGB32, size, size); - + // get size of icon layer int icon_size = size; foreach (var layer in layers) { if (layer.image != null && layer.layer_type == SliceLayer.Type.ICON) icon_size = layer.image.width(); } - + Image icon; if (icon_name.contains("/")) icon = new Image.from_file_at_size(icon_name, icon_size, icon_size); else icon = new Icon(icon_name, icon_size); - + var color = new Color.from_icon(icon); var ctx = this.context(); - + ctx.translate(size/2, size/2); ctx.set_operator(Cairo.Operator.OVER); - + // now render all layers on top of each other foreach (var layer in layers) { - - if (layer.visibility == SliceLayer.Visibility.ANY || + + if (layer.visibility == SliceLayer.Visibility.ANY || (Config.global.show_captions == (layer.visibility == SliceLayer.Visibility.WITH_CAPTION))) { - + if (layer.colorize) { ctx.push_group(); } - + if (layer.layer_type == SliceLayer.Type.ICON) { ctx.push_group(); - + layer.image.paint_on(ctx); - + ctx.set_operator(Cairo.Operator.IN); - + if (layer.image.width() != icon_size) { if (icon_name.contains("/")) icon = new Image.from_file_at_size(icon_name, layer.image.width(), layer.image.width()); else icon = new Icon(icon_name,layer.image.width()); } - + icon.paint_on(ctx); ctx.pop_group_to_source(); ctx.paint(); ctx.set_operator(Cairo.Operator.OVER); - + } else if (layer.layer_type == SliceLayer.Type.CAPTION) { Image text = new RenderedText(caption, layer.width, layer.height, layer.font, layer.color, Config.global.global_scale); ctx.translate(0, layer.position); @@ -99,13 +99,13 @@ public class ThemedIcon : Image { } else if (layer.layer_type == SliceLayer.Type.FILE) { layer.image.paint_on(ctx); } - + // colorize the whole layer if neccasary if (layer.colorize) { ctx.set_operator(Cairo.Operator.ATOP); ctx.set_source_rgb(color.r, color.g, color.b); ctx.paint(); - + ctx.set_operator(Cairo.Operator.OVER); ctx.pop_group_to_source(); ctx.paint(); @@ -113,11 +113,11 @@ public class ThemedIcon : Image { } } } - + ///////////////////////////////////////////////////////////////////// /// Returns the size of the icon in pixels. Greetings to Liskov. ///////////////////////////////////////////////////////////////////// - + public int size() { return base.width(); } diff --git a/src/pies/defaultConfig.vala b/src/pies/defaultConfig.vala index 87fd30d..6ca45e4 100644 --- a/src/pies/defaultConfig.vala +++ b/src/pies/defaultConfig.vala @@ -1,37 +1,37 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A helper class which creates a user-specific default configuration. ///////////////////////////////////////////////////////////////////////// namespace Pies { public void create_default_config() { - + // add a pie with playback controls var multimedia = PieManager.create_persistent_pie(_("Multimedia"), "stock_media-play", new Trigger.from_string("m")); multimedia.add_action(new KeyAction(_("Next Track"), "stock_media-next", "XF86AudioNext", true)); multimedia.add_action(new KeyAction(_("Stop"), "stock_media-stop", "XF86AudioStop")); multimedia.add_action(new KeyAction(_("Previous Track"), "stock_media-prev", "XF86AudioPrev")); multimedia.add_action(new KeyAction(_("Play/Pause"), "stock_media-play", "XF86AudioPlay")); - + // add a pie with the users default applications var apps = PieManager.create_persistent_pie(_("Applications"), "applications-accessories", new Trigger.from_string("a")); apps.add_action(ActionRegistry.default_for_mime_type("text/plain")); @@ -40,20 +40,20 @@ namespace Pies { apps.add_action(ActionRegistry.default_for_mime_type("image/jpg")); apps.add_action(ActionRegistry.default_for_uri("http")); apps.add_action(ActionRegistry.default_for_uri("mailto")); - + // add a pie with the users bookmarks and devices var bookmarks = PieManager.create_persistent_pie(_("Bookmarks"), "user-bookmarks", new Trigger.from_string("b")); bookmarks.add_group(new BookmarkGroup(bookmarks.id)); bookmarks.add_group(new DevicesGroup(bookmarks.id)); - + // add a pie with session controls var session = PieManager.create_persistent_pie(_("Session"), "gnome-session-halt", new Trigger.from_string("q")); session.add_group(new SessionGroup(session.id)); - + // add a pie with a main menu var menu = PieManager.create_persistent_pie(_("Main Menu"), "alacarte", new Trigger.from_string("space")); menu.add_group(new MenuGroup(menu.id)); - + // add a pie with window controls var window = PieManager.create_persistent_pie(_("Window"), "gnome-window-manager", new Trigger.from_string("w")); window.add_action(new KeyAction(_("Scale"), "top", "s")); @@ -61,7 +61,7 @@ namespace Pies { window.add_action(new KeyAction(_("Close"), "window-close", "F4")); window.add_action(new KeyAction(_("Maximize"), "window_fullscreen", "F10")); window.add_action(new KeyAction(_("Restore"), "window_nofullscreen", "F5")); - + // save the configuration to file Pies.save(); } diff --git a/src/pies/load.vala b/src/pies/load.vala index cb08a8a..7402094 100644 --- a/src/pies/load.vala +++ b/src/pies/load.vala @@ -1,25 +1,25 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// using GLib.Math; namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A helper method which loads pies according to the configuration file. ///////////////////////////////////////////////////////////////////////// @@ -28,7 +28,7 @@ namespace Pies { ///////////////////////////////////////////////////////////////////// /// Loads all Pies from the pies.conf file. ///////////////////////////////////////////////////////////////////// - + public void load() { // check whether the config file exists if (!GLib.File.new_for_path(Paths.pie_config).query_exists()) { @@ -36,13 +36,13 @@ namespace Pies { Pies.create_default_config(); return; } - + message("Loading Pies from \"" + Paths.pie_config + "\"."); - + // load the settings file Xml.Parser.init(); Xml.Doc* piesXML = Xml.Parser.parse_file(Paths.pie_config); - + if (piesXML != null) { // begin parsing at the root element Xml.Node* root = piesXML->get_root_element(); @@ -57,36 +57,36 @@ namespace Pies { default: warning("Invalid child element <" + node_name + "> in element pies.conf!"); break; - } + } } } } else { warning("Error loading pies: pies.conf is empty! The cake is a lie..."); } - + delete piesXML; - + } else { warning("Error loading pies: pies.conf not found! The cake is a lie..."); } } - + ///////////////////////////////////////////////////////////////////// /// Parses a element from the pies.conf file. ///////////////////////////////////////////////////////////////////// - + private static void parse_pie(Xml.Node* node) { string hotkey = ""; string name = ""; string icon = ""; string id = ""; int quickaction = -1; - + // parse all attributes of this node for (Xml.Attr* attribute = node->properties; attribute != null; attribute = attribute->next) { string attr_name = attribute->name.down(); string attr_content = attribute->children->content; - + switch (attr_name) { case "hotkey": hotkey = attr_content; @@ -108,15 +108,15 @@ namespace Pies { break; } } - + if (name == "") { warning("Invalid element in pies.conf: No name specified!"); return; } - + // add a new Pie with the loaded properties var pie = PieManager.create_persistent_pie(name, icon, new Trigger.from_string(hotkey), id); - + // and parse all child elements for (Xml.Node* slice = node->children; slice != null; slice = slice->next) { if (slice->type == Xml.ElementType.ELEMENT_NODE) { @@ -131,22 +131,22 @@ namespace Pies { default: warning("Invalid child element <" + node_name + "> in element in pies.conf!"); break; - } + } } } } - + ///////////////////////////////////////////////////////////////////// /// Parses a element from the pies.conf file. ///////////////////////////////////////////////////////////////////// - + private static void parse_slice(Xml.Node* slice, Pie pie) { string name=""; string icon=""; string command=""; string type=""; bool quickaction = false; - + // parse all attributes of this node for (Xml.Attr* attribute = slice->properties; attribute != null; attribute = attribute->next) { string attr_name = attribute->name.down(); @@ -173,20 +173,20 @@ namespace Pies { break; } } - + // create a new Action according to the loaded type Action action = ActionRegistry.create_action(type, name, icon, command, quickaction); - + if (action != null) pie.add_action(action); } - + ///////////////////////////////////////////////////////////////////// /// Parses a element from the pies.conf file. ///////////////////////////////////////////////////////////////////// - + private static void parse_group(Xml.Node* slice, Pie pie) { string type=""; - + // parse all attributes of this node for (Xml.Attr* attribute = slice->properties; attribute != null; attribute = attribute->next) { string attr_name = attribute->name.down(); @@ -201,7 +201,7 @@ namespace Pies { break; } } - + ActionGroup group = GroupRegistry.create_group(type, pie.id); if (group != null) pie.add_group(group); diff --git a/src/pies/pie.vala b/src/pies/pie.vala index fa205c7..1699ada 100644 --- a/src/pies/pie.vala +++ b/src/pies/pie.vala @@ -1,109 +1,109 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// -/// This class stores information on a pie. A pie consists of a name, an +///////////////////////////////////////////////////////////////////////// +/// This class stores information on a pie. A pie consists of a name, an /// icon name and an unique ID. Furthermore it has an arbitrary amount /// of ActionGroups storing Actions. ///////////////////////////////////////////////////////////////////////// public class Pie : GLib.Object { - + ///////////////////////////////////////////////////////////////////// /// The name of this Pie. It has not to be unique. ///////////////////////////////////////////////////////////////////// - + public string name { get; set; } - + ///////////////////////////////////////////////////////////////////// /// The name of the icon to be used for this Pie. It should exist in /// the users current icon theme, else a standard icon will be used. ///////////////////////////////////////////////////////////////////// - + public string icon { get; set; } - + ///////////////////////////////////////////////////////////////////// /// The ID of this Pie. It has to be unique among all Pies. This ID - /// consists of three digits when the Pie was created by the user, - /// of four digits when it was created dynamically by another class, + /// consists of three digits when the Pie was created by the user, + /// of four digits when it was created dynamically by another class, /// for example by an ActionGroup. ///////////////////////////////////////////////////////////////////// - + public string id { get; construct; } - + ///////////////////////////////////////////////////////////////////// /// Stores all ActionGroups of this Pie. ///////////////////////////////////////////////////////////////////// - + public Gee.ArrayList action_groups { get; private set; } - + ///////////////////////////////////////////////////////////////////// /// C'tor, initializes all given members. ///////////////////////////////////////////////////////////////////// - + public Pie(string id, string name, string icon) { GLib.Object(id: id, name: name, icon:icon); - + this.action_groups = new Gee.ArrayList(); } - + ///////////////////////////////////////////////////////////////////// /// Should be called when this Pie is deleted, in order to clean up /// stuff created by contained ActionGroups. ///////////////////////////////////////////////////////////////////// - + public virtual void on_remove() { foreach (var action_group in action_groups) action_group.on_remove(); } - + ///////////////////////////////////////////////////////////////////// /// Adds an Action to this Pie. ///////////////////////////////////////////////////////////////////// - + public void add_action(Action action, int at_position = -1) { var group = new ActionGroup(this.id); group.add_action(action); this.add_group(group, at_position); } - + ///////////////////////////////////////////////////////////////////// /// Adds an ActionGroup to this Pie. ///////////////////////////////////////////////////////////////////// - - public void add_group(ActionGroup group, int at_position = -1) { + + public void add_group(ActionGroup group, int at_position = -1) { if (group.has_quickaction()) { foreach (var action_group in action_groups) action_group.disable_quickactions(); } - - if (at_position < 0 || at_position >= this.action_groups.size) + + if (at_position < 0 || at_position >= this.action_groups.size) this.action_groups.add(group); else this.action_groups.insert(at_position, group); } - + public void remove_group(int index) { if (this.action_groups.size > index) this.action_groups.remove_at(index); } - + public void move_group(int from, int to) { if (this.action_groups.size > from && this.action_groups.size > to) { var tmp = this.action_groups[from]; @@ -111,7 +111,7 @@ public class Pie : GLib.Object { this.add_group(tmp, to); } } - + public void update_group(ActionGroup group, int index) { if (this.action_groups.size > index) this.action_groups.set(index, group); diff --git a/src/pies/pieManager.vala b/src/pies/pieManager.vala index 83a8309..55cb353 100644 --- a/src/pies/pieManager.vala +++ b/src/pies/pieManager.vala @@ -1,24 +1,24 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// -/// A static class which stores all Pies. It can be used to add, delete +///////////////////////////////////////////////////////////////////////// +/// A static class which stores all Pies. It can be used to add, delete /// and open Pies. ///////////////////////////////////////////////////////////////////////// @@ -30,196 +30,227 @@ public class PieManager : GLib.Object { ///////////////////////////////////////////////////////////////////// public static Gee.HashMap all_pies { get; private set; } - + ///////////////////////////////////////////////////////////////////// /// Stores all PieWindows which are currently opened. Should be /// rarely more than two... ///////////////////////////////////////////////////////////////////// - + public static Gee.HashSet opened_windows { get; private set; } - + ///////////////////////////////////////////////////////////////////// /// Stores all global hotkeys. ///////////////////////////////////////////////////////////////////// - + private static BindingManager bindings; - + ///////////////////////////////////////////////////////////////////// /// True, if any pie has the current focus. If it is closing this /// will be false already. ///////////////////////////////////////////////////////////////////// - + private static bool a_pie_is_active = false; - + ///////////////////////////////////////////////////////////////////// /// Storing the position of the last Pie. Used for subpies, which are /// opened at their parents location. ///////////////////////////////////////////////////////////////////// - + private static int last_x = 0; private static int last_y = 0; - + ///////////////////////////////////////////////////////////////////// /// Initializes all Pies. They are loaded from the pies.conf file. ///////////////////////////////////////////////////////////////////// - + public static void init() { all_pies = new Gee.HashMap(); opened_windows = new Gee.HashSet(); bindings = new BindingManager(); - + // load all Pies from th pies.conf file Pies.load(); - + // open the according pie if it's hotkey is pressed bindings.on_press.connect((id) => { open_pie(id); }); } - + ///////////////////////////////////////////////////////////////////// /// Opens the Pie with the given ID, if it exists. ///////////////////////////////////////////////////////////////////// - + public static void open_pie(string id) { if (!a_pie_is_active) { Pie? pie = all_pies[id]; - + if (pie != null) { - + a_pie_is_active = true; - + + //change WM_CLASS so launchers can track windows properly + Gdk.set_program_class("gnome-pie-" + id); + var window = new PieWindow(); window.load_pie(pie); - + window.open(); - + opened_windows.add(window); - + window.on_closed.connect(() => { opened_windows.remove(window); if (opened_windows.size == 0) { Icon.clear_cache(); } }); - + window.on_closing.connect(() => { window.get_center_pos(out last_x, out last_y); a_pie_is_active = false; }); - - + + + //restore default WM_CLASS after window open + Gdk.set_program_class("gnome-pie"); + } else { warning("Failed to open pie with ID \"" + id + "\": ID does not exist!"); } } } - + ///////////////////////////////////////////////////////////////////// /// Returns the hotkey which the Pie with the given ID is bound to. ///////////////////////////////////////////////////////////////////// - + public static string get_accelerator_of(string id) { return bindings.get_accelerator_of(id); } - + ///////////////////////////////////////////////////////////////////// /// Returns a human-readable version of the hotkey which the Pie /// with the given ID is bound to. ///////////////////////////////////////////////////////////////////// - + public static string get_accelerator_label_of(string id) { return bindings.get_accelerator_label_of(id); } - + ///////////////////////////////////////////////////////////////////// /// Bind the Pie with the given ID to the given trigger. ///////////////////////////////////////////////////////////////////// - + public static void bind_trigger(Trigger trigger, string id) { bindings.unbind(id); bindings.bind(trigger, id); } - + ///////////////////////////////////////////////////////////////////// /// Returns true if the pie with the given id is in turbo mode. ///////////////////////////////////////////////////////////////////// - + public static bool get_is_turbo(string id) { return bindings.get_is_turbo(id); } - + ///////////////////////////////////////////////////////////////////// /// Returns true if the pie with the given id opens in the middle of /// the screen. ///////////////////////////////////////////////////////////////////// - + public static bool get_is_centered(string id) { return bindings.get_is_centered(id); } - + + ///////////////////////////////////////////////////////////////////// + /// Returns true if the mouse pointer will be warped to the center of + /// the pie. + ///////////////////////////////////////////////////////////////////// + + public static bool get_is_warp(string id) { + return bindings.get_is_warp(id); + } + + ///////////////////////////////////////////////////////////////////// + /// Returns true if the pie with the given id is auto shaped + ///////////////////////////////////////////////////////////////////// + + public static bool get_is_auto_shape(string id) { + return bindings.get_is_auto_shape(id); + } + + ///////////////////////////////////////////////////////////////////// + /// Returns the prefered pie shape number + ///////////////////////////////////////////////////////////////////// + + public static int get_shape_number(string id) { + return bindings.get_shape_number(id); + } + ///////////////////////////////////////////////////////////////////// /// Returns the name of the Pie with the given ID. ///////////////////////////////////////////////////////////////////// - + public static string get_name_of(string id) { Pie? pie = all_pies[id]; if (pie == null) return ""; else return pie.name; } - + ///////////////////////////////////////////////////////////////////// /// Returns the name ID of the Pie bound to the given Trigger. /// Returns "" if there is nothing bound to this trigger. ///////////////////////////////////////////////////////////////////// - + public static string get_assigned_id(Trigger trigger) { return bindings.get_assigned_id(trigger); } - + ///////////////////////////////////////////////////////////////////// /// Creates a new Pie which is displayed in the configuration dialog /// and gets saved. ///////////////////////////////////////////////////////////////////// - + public static Pie create_persistent_pie(string name, string icon_name, Trigger? hotkey, string? desired_id = null) { Pie pie = create_pie(name, icon_name, 100, 999, desired_id); if (hotkey != null) bindings.bind(hotkey, pie.id); - + create_launcher(pie.id); - + return pie; } - + ///////////////////////////////////////////////////////////////////// /// Creates a new Pie which is not displayed in the configuration /// dialog and is not saved. ///////////////////////////////////////////////////////////////////// - + public static Pie create_dynamic_pie(string name, string icon_name, string? desired_id = null) { return create_pie(name, icon_name, 1000, 9999, desired_id); } - + ///////////////////////////////////////////////////////////////////// /// Adds a new Pie. Can't be accesd from outer scope. Use /// create_persistent_pie or create_dynamic_pie instead. ///////////////////////////////////////////////////////////////////// - + private static Pie create_pie(string name, string icon_name, int min_id, int max_id, string? desired_id = null) { var random = new GLib.Rand(); - + string final_id; - - if (desired_id == null) + + if (desired_id == null) final_id = random.int_range(min_id, max_id).to_string(); else { final_id = desired_id; final_id.canon("0123456789", '_'); final_id = final_id.replace("_", ""); - + int id = int.parse(final_id); - + if (id < min_id || id > max_id) { final_id = random.int_range(min_id, max_id).to_string(); warning("The ID for pie \"" + name + "\" should be in range %u - %u! Using \"" + final_id + "\" instead of \"" + desired_id + "\"...", min_id, max_id); @@ -237,21 +268,21 @@ public class PieManager : GLib.Object { Pie pie = new Pie(final_id, name, icon_name); all_pies.set(final_id, pie); - + return pie; } - + ///////////////////////////////////////////////////////////////////// /// Removes the Pie with the given ID if it exists. Additionally it /// unbinds it's global hotkey. ///////////////////////////////////////////////////////////////////// - + public static void remove_pie(string id) { if (all_pies.has_key(id)) { all_pies[id].on_remove(); all_pies.unset(id); bindings.unbind(id); - + if (id.length == 3) remove_launcher(id); } @@ -259,27 +290,28 @@ public class PieManager : GLib.Object { warning("Failed to remove pie with ID \"" + id + "\": ID does not exist!"); } } - + ///////////////////////////////////////////////////////////////////// /// Creates a desktop file for which opens the Pie with given ID. ///////////////////////////////////////////////////////////////////// - + public static void create_launcher(string id) { if (all_pies.has_key(id)) { Pie? pie = all_pies[id]; - - string launcher_entry = - "#!/usr/bin/env xdg-open\n" + + + string launcher_entry = + "#!/usr/bin/env xdg-open\n" + "[Desktop Entry]\n" + "Name=%s\n".printf(pie.name) + "Exec=%s -o %s\n".printf(Paths.executable, pie.id) + "Encoding=UTF-8\n" + "Type=Application\n" + - "Icon=%s\n".printf(pie.icon); + "Icon=%s\n".printf(pie.icon) + + "StartupWMClass=gnome-pie-%s\n".printf(pie.id); // create the launcher file string launcher = Paths.launchers + "/%s.desktop".printf(pie.id); - + try { FileUtils.set_contents(launcher, launcher_entry); FileUtils.chmod(launcher, 0755); @@ -288,11 +320,11 @@ public class PieManager : GLib.Object { } } } - + ///////////////////////////////////////////////////////////////////// /// Deletes the desktop file for the Pie with the given ID. ///////////////////////////////////////////////////////////////////// - + private static void remove_launcher(string id) { string launcher = Paths.launchers + "/%s.desktop".printf(id); if (FileUtils.test(launcher, FileTest.EXISTS)) { diff --git a/src/pies/save.vala b/src/pies/save.vala index 60fc0b2..9760cce 100644 --- a/src/pies/save.vala +++ b/src/pies/save.vala @@ -1,25 +1,25 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// using GLib.Math; namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A helper method which saves pies in a configuration file. ///////////////////////////////////////////////////////////////////////// @@ -28,23 +28,23 @@ namespace Pies { ///////////////////////////////////////////////////////////////////// /// Saves all Pies of the PieManager to the pies.conf file. ///////////////////////////////////////////////////////////////////// - + public void save() { message("Saving Pies to \"" + Paths.pie_config + "\"."); - + // initializes the XML-Writer var writer = new Xml.TextWriter.filename(Paths.pie_config); writer.set_indent(true); writer.start_document("1.0"); writer.start_element("pies"); - + // iterate through all Pies foreach (var pie_entry in PieManager.all_pies.entries) { var pie = pie_entry.value; - + // if it's no dynamically created Pie if (pie.id.length == 3) { - int slice_count = 0; + int slice_count = 0; // write all attributes of the Pie writer.start_element("pie"); @@ -52,7 +52,7 @@ namespace Pies { writer.write_attribute("id", pie.id); writer.write_attribute("icon", pie.icon); writer.write_attribute("hotkey", PieManager.get_accelerator_of(pie.id)); - + // and all of it's Actions foreach (var group in pie.action_groups) { // if it's a custom ActionGroup @@ -67,14 +67,14 @@ namespace Pies { writer.write_attribute("command", action.real_command); writer.write_attribute("quickAction", action.is_quickaction ? "true" : "false"); writer.end_element(); - + ++ slice_count; } } else { writer.start_element("group"); writer.write_attribute("type", GroupRegistry.descriptions[group.get_type().name()].id); writer.end_element(); - + slice_count += group.actions.size; } } diff --git a/src/renderers/centerRenderer.vala b/src/renderers/centerRenderer.vala index fab633e..e94714f 100644 --- a/src/renderers/centerRenderer.vala +++ b/src/renderers/centerRenderer.vala @@ -1,25 +1,25 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// using GLib.Math; namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// Renders the center of a Pie. ///////////////////////////////////////////////////////////////////////// @@ -30,26 +30,26 @@ public class CenterRenderer : GLib.Object { ///////////////////////////////////////////////////////////////////// private unowned PieRenderer parent; - + ///////////////////////////////////////////////////////////////////// /// The caption drawn in the center. Changes when the active slice /// changes. ///////////////////////////////////////////////////////////////////// - + private unowned Image? caption; - + ///////////////////////////////////////////////////////////////////// /// The color of the currently active slice. Used to colorize layers. ///////////////////////////////////////////////////////////////////// - + private Color color; - + ///////////////////////////////////////////////////////////////////// /// Two AnimatedValues: alpha is for global transparency (when /// fading in/out), activity is 1.0 if there is an active slice and /// 0.0 if there is no active slice. ///////////////////////////////////////////////////////////////////// - + private AnimatedValue activity; private AnimatedValue alpha; @@ -64,22 +64,22 @@ public class CenterRenderer : GLib.Object { this.color = new Color(); this.caption = null; } - + ///////////////////////////////////////////////////////////////////// /// Initiates the fade-out animation by resetting the targets of the /// AnimatedValues to 0.0. ///////////////////////////////////////////////////////////////////// - + public void fade_out() { this.activity.reset_target(0.0, Config.global.theme.fade_out_time); this.alpha.reset_target(0.0, Config.global.theme.fade_out_time); } - + ///////////////////////////////////////////////////////////////////// /// Should be called if the active slice of the PieRenderer changes. /// The members activity, caption and color are set accordingly. ///////////////////////////////////////////////////////////////////// - + public void set_active_slice(SliceRenderer? active_slice) { if (active_slice == null) { this.activity.reset_target(0.0, Config.global.theme.transition_time); @@ -89,104 +89,136 @@ public class CenterRenderer : GLib.Object { this.color = active_slice.color; } } - + ///////////////////////////////////////////////////////////////////// /// Draws all center layers and the caption. ///////////////////////////////////////////////////////////////////// - - public void draw(double frame_time, Cairo.Context ctx, double angle, double distance) { + + public void draw(double frame_time, Cairo.Context ctx, double angle, int slice_track) { // get all center_layers - var layers = Config.global.theme.center_layers; - + var layers = Config.global.theme.center_layers; + // update the AnimatedValues this.activity.update(frame_time); this.alpha.update(frame_time); - - // draw each layer - foreach (var layer in layers) { - ctx.save(); + + // draw each layer + foreach (var layer in layers) { + ctx.save(); // calculate all values needed for animation/drawing - double active_speed = (layer.active_rotation_mode == CenterLayer.RotationMode.TO_MOUSE) ? + double active_speed = (layer.active_rotation_mode == CenterLayer.RotationMode.TO_MOUSE) ? 0.0 : layer.active_rotation_speed; - double inactive_speed = (layer.inactive_rotation_mode == CenterLayer.RotationMode.TO_MOUSE) ? + double inactive_speed = (layer.inactive_rotation_mode == CenterLayer.RotationMode.TO_MOUSE) ? 0.0 : layer.inactive_rotation_speed; - double max_scale = layer.active_scale*this.activity.val - + layer.inactive_scale*(1.0-this.activity.val); - double max_alpha = layer.active_alpha*this.activity.val + double max_scale = layer.active_scale*this.activity.val + + layer.inactive_scale*(1.0-this.activity.val); + double max_alpha = layer.active_alpha*this.activity.val + layer.inactive_alpha*(1.0-this.activity.val); - double colorize = ((layer.active_colorize == true) ? this.activity.val : 0.0) + double colorize = ((layer.active_colorize == true) ? this.activity.val : 0.0) + ((layer.inactive_colorize == true) ? 1.0 - this.activity.val : 0.0); - double max_rotation_speed = active_speed*this.activity.val + double max_rotation_speed = active_speed*this.activity.val + inactive_speed*(1.0-this.activity.val); - CenterLayer.RotationMode rotation_mode = ((this.activity.val > 0.5) ? + CenterLayer.RotationMode rotation_mode = ((this.activity.val > 0.5) ? layer.active_rotation_mode : layer.inactive_rotation_mode); - - if (rotation_mode == CenterLayer.RotationMode.TO_MOUSE) { - double diff = angle-layer.rotation; - max_rotation_speed = layer.active_rotation_speed*this.activity.val - + layer.inactive_rotation_speed*(1.0-this.activity.val); - double smoothy = fabs(diff) < 0.9 ? fabs(diff) + 0.1 : 1.0; - double step = max_rotation_speed*frame_time*smoothy; - + + if (rotation_mode == CenterLayer.RotationMode.TO_MOUSE) { + double diff = angle-layer.rotation; + max_rotation_speed = layer.active_rotation_speed*this.activity.val + + layer.inactive_rotation_speed*(1.0-this.activity.val); + double smoothy = fabs(diff) < 0.9 ? fabs(diff) + 0.1 : 1.0; + double step = max_rotation_speed*frame_time*smoothy; + if (fabs(diff) <= step || fabs(diff) >= 2.0*PI - step) - layer.rotation = angle; - else { - if ((diff > 0 && diff < PI) || diff < -PI) layer.rotation += step; - else layer.rotation -= step; + layer.rotation = angle; + else { + if ((diff > 0 && diff < PI) || diff < -PI) layer.rotation += step; + else layer.rotation -= step; } - - } else if (rotation_mode == CenterLayer.RotationMode.TO_ACTIVE) { - max_rotation_speed *= this.activity.val; - - double slice_angle = parent.slice_count() > 0 ? 2*PI/parent.slice_count() : 0; - double direction = (int)((angle+0.5*slice_angle) / (slice_angle))*slice_angle; - double diff = direction-layer.rotation; - double step = max_rotation_speed*frame_time; - + + } else if (rotation_mode == CenterLayer.RotationMode.TO_ACTIVE) { + max_rotation_speed *= this.activity.val; + + double slice_angle = parent.total_slice_count > 0 ? 2*PI/parent.total_slice_count : 0; + double direction = (int)((angle+0.5*slice_angle) / (slice_angle))*slice_angle; + double diff = direction-layer.rotation; + double step = max_rotation_speed*frame_time; + if (fabs(diff) <= step || fabs(diff) >= 2.0*PI - step) - layer.rotation = direction; - else { - if ((diff > 0 && diff < PI) || diff < -PI) layer.rotation += step; - else layer.rotation -= step; + layer.rotation = direction; + else { + if ((diff > 0 && diff < PI) || diff < -PI) layer.rotation += step; + else layer.rotation -= step; } - - } else layer.rotation += max_rotation_speed*frame_time; - - layer.rotation = fmod(layer.rotation+2*PI, 2*PI); - - if (colorize > 0.0) ctx.push_group(); - - // transform the context - ctx.rotate(layer.rotation); - ctx.scale(max_scale, max_scale); - - // paint the layer - layer.image.paint_on(ctx, this.alpha.val*max_alpha); - + + } else layer.rotation += max_rotation_speed*frame_time; + + layer.rotation = fmod(layer.rotation+2*PI, 2*PI); + + if (colorize > 0.0) ctx.push_group(); + + // transform the context + ctx.rotate(layer.rotation); + ctx.scale(max_scale, max_scale); + + // paint the layer + layer.image.paint_on(ctx, this.alpha.val*max_alpha); + // colorize it, if necessary if (colorize > 0.0) { ctx.set_operator(Cairo.Operator.ATOP); ctx.set_source_rgb(this.color.r, this.color.g, this.color.b); ctx.paint_with_alpha(colorize); - + ctx.set_operator(Cairo.Operator.OVER); ctx.pop_group_to_source(); - ctx.paint(); - } - + ctx.paint(); + } + ctx.restore(); } - + // draw caption if (Config.global.theme.caption && caption != null && this.activity.val > 0) { - ctx.save(); + ctx.save(); ctx.identity_matrix(); - int pos = this.parent.size/2; - ctx.translate(pos, (int)(Config.global.theme.caption_position) + pos); + ctx.translate(this.parent.center_x, (int)(Config.global.theme.caption_position) + this.parent.center_y); caption.paint_on(ctx, this.activity.val*this.alpha.val); ctx.restore(); } + + //scroll pie + if (this.alpha.val > 0.1 + && this.parent.original_visible_slice_count < this.parent.slice_count() + && this.parent.original_visible_slice_count > 0) { + int np= (this.parent.slice_count()+this.parent.original_visible_slice_count -1)/this.parent.original_visible_slice_count; + int cp= this.parent.first_slice_idx / this.parent.original_visible_slice_count; + int r= 8; //circle radious + int dy= 20; //distance between circles + double a= 0.8 * this.alpha.val; + int dx= (int)Config.global.theme.center_radius + r + 10; + if (this.parent.center_x + dx > this.parent.size_w) + dx= -dx; //no right side, put scroll in the left size + ctx.save(); + ctx.identity_matrix(); + ctx.translate(this.parent.center_x + dx, this.parent.center_y - (np-1)*dy/2); + for (int i=0; i. -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// using GLib.Math; @@ -49,13 +49,89 @@ public class PieRenderer : GLib.Object { /// The width and height of the Pie in pixels. ///////////////////////////////////////////////////////////////////// - public int size { get; private set; } + public int size_w { get; private set; } + public int size_h { get; private set; } + + ///////////////////////////////////////////////////////////////////// + /// Center position relative to window top-left corner + ///////////////////////////////////////////////////////////////////// + + public int center_x { get; private set; } + public int center_y { get; private set; } + + //////////////////////////////////////////////////////////////////// + /// Possible show pie modes. + /// FULL_PIE: Show the pie as a complete circle. + /// HPIE_LEFT: Eat half pie so it can be shown at the left of the screen. + /// HPIE_RIGHT: Eat half pie so it can be shown at the right of the screen. + /// HPIE_TOP: Eat half pie so it can be shown at the top of the screen. + /// HPIE_BOTTOM: Eat half pie so it can be shown at the bottom of the screen. + /// CPIE_TOP_LEFT: Eat 3/4 pie so it can be shown at the top-left corner. + /// CPIE_TOP_RIGHT: Eat 3/4 pie so it can be shown at the top-right corner. + /// CPIE_BOT_LEFT: Eat 3/4 pie so it can be shown at the bottom-left corner. + /// CPIE_BOT_RIGHT: Eat 3/4 pie so it can be shown at the bottom-right corner. ///////////////////////////////////////////////////////////////////// - /// True if the pie should close when it's trigger is released. + + public enum ShowPieMode { + FULL_PIE, + HPIE_LEFT, HPIE_RIGHT, HPIE_TOP, HPIE_BOTTOM, + CPIE_TOP_LEFT, CPIE_TOP_RIGHT, CPIE_BOT_LEFT, CPIE_BOT_RIGHT} + ///////////////////////////////////////////////////////////////////// + /// Show pie mode: full, half-circle, corner + ///////////////////////////////////////////////////////////////////// + + public ShowPieMode pie_show_mode { get; private set; default= ShowPieMode.FULL_PIE; } + + ///////////////////////////////////////////////////////////////////// + /// Number of visible slices + ///////////////////////////////////////////////////////////////////// + + public int visible_slice_count { get; private set; } - public bool turbo_mode { get; private set; default=false; } + public int original_visible_slice_count { get; private set; } + + ///////////////////////////////////////////////////////////////////// + /// Number of slices in full pie (visible or not) + ///////////////////////////////////////////////////////////////////// + + public int total_slice_count { get; private set; } + + ///////////////////////////////////////////////////////////////////// + /// Maximun number of visible slices in a full pie + ///////////////////////////////////////////////////////////////////// + + public int max_visible_slices { get; private set; } + + ///////////////////////////////////////////////////////////////////// + /// The index of the first visible slice + ///////////////////////////////////////////////////////////////////// + + public int first_slice_idx { get; private set; } + + ///////////////////////////////////////////////////////////////////// + /// Angular position of the first visible slice + ///////////////////////////////////////////////////////////////////// + + public double first_slice_angle { get; private set; } + + ///////////////////////////////////////////////////////////////////// + /// Index of the slice where to go when up/down/left/right key is pressed + /// or -1 if that side of the pie was eaten + ///////////////////////////////////////////////////////////////////// + + public int up_slice_idx { get; private set; } + public int down_slice_idx { get; private set; } + public int left_slice_idx { get; private set; } + public int right_slice_idx { get; private set; } + + + ///////////////////////////////////////////////////////////////////// + /// The ID of the currently loaded Pie. + ///////////////////////////////////////////////////////////////////// + + public string id { get; private set; } ///////////////////////////////////////////////////////////////////// /// True if the pie is currently navigated with the keyboard. This is @@ -76,6 +152,11 @@ public class PieRenderer : GLib.Object { private CenterRenderer center; + ///////////////////////////////////////////////////////////////////// + /// Maximum distance from the center that activates the slices + ///////////////////////////////////////////////////////////////////// + private int activation_range; + ///////////////////////////////////////////////////////////////////// /// C'tor, initializes members. ///////////////////////////////////////////////////////////////////// @@ -85,7 +166,35 @@ public class PieRenderer : GLib.Object { this.center = new CenterRenderer(this); this.quickaction = -1; this.active_slice = -2; - this.size = 0; + this.size_w = 0; + this.size_h = 0; + this.activation_range= 300; + + this.max_visible_slices= Config.global.max_visible_slices; + + set_show_mode(ShowPieMode.FULL_PIE); + } + + + private void get_mouse_and_screen(out int mousex, out int mousey, out int screenx, out int screeny) { + // get the mouse position and screen resolution + double x = 0.0; + double y = 0.0; + + var display = Gdk.Display.get_default(); + var manager = display.get_device_manager(); + GLib.List list = manager.list_devices(Gdk.DeviceType.MASTER); + + foreach(var device in list) { + if (device.input_source != Gdk.InputSource.KEYBOARD) { + Gdk.Screen screen; + device.get_position( out screen, out x, out y ); + } + } + mousex= (int) x; + mousey= (int) y; + screenx= Gdk.Screen.width(); + screeny= Gdk.Screen.height(); } ///////////////////////////////////////////////////////////////////// @@ -95,6 +204,8 @@ public class PieRenderer : GLib.Object { public void load_pie(Pie pie) { this.slices.clear(); + this.id = pie.id; + int count = 0; foreach (var group in pie.action_groups) { foreach (var action in group.actions) { @@ -110,18 +221,200 @@ public class PieRenderer : GLib.Object { } } - this.turbo_mode = PieManager.get_is_turbo(pie.id); - this.set_highlighted_slice(this.quickaction); - this.size = (int)fmax(2*Config.global.theme.radius + 2*Config.global.theme.slice_radius*Config.global.theme.max_zoom, - 2*Config.global.theme.center_radius); + ShowPieMode showpie= ShowPieMode.FULL_PIE; + //set full pie to determine the number of visible slices + set_show_mode(showpie); + + int sz0= (int)fmax(2*Config.global.theme.radius + 2*Config.global.theme.visible_slice_radius*Config.global.theme.max_zoom, + 2*Config.global.theme.center_radius); + + int sz= sz0; // increase size if there are many slices - if (slices.size > 0) { - this.size = (int)fmax(this.size, - (((Config.global.theme.slice_radius + Config.global.theme.slice_gap)/tan(PI/slices.size)) - + Config.global.theme.slice_radius)*2*Config.global.theme.max_zoom); + if (this.total_slice_count > 0) { + sz = (int)fmax(sz0, + (((Config.global.theme.slice_radius + Config.global.theme.slice_gap)/tan(PI/this.total_slice_count)) + + Config.global.theme.visible_slice_radius)*2*Config.global.theme.max_zoom); + } + + + + + // get mouse position and screen resolution + int mouse_x, mouse_y, screen_x, screen_y; + get_mouse_and_screen( out mouse_x, out mouse_y, out screen_x, out screen_y ); + + //reduce the window size if needed to get closer to the actual mouse position + int reduce_szx= 1; + int reduce_szy= 1; + + if (PieManager.get_is_auto_shape(pie.id) && !PieManager.get_is_centered(pie.id)) { + //set the best show mode that put the mouse near the center + if (mouse_x < sz/2) { + if (mouse_y < sz/2) + showpie= ShowPieMode.CPIE_TOP_LEFT; //show 1/4 pie + else if (screen_y > 0 && screen_y-mouse_y < sz/2) + showpie= ShowPieMode.CPIE_BOT_LEFT; //show 1/4 pie + else + showpie= ShowPieMode.HPIE_LEFT; //show 1/2 pie + + } else if (mouse_y < sz/2) { + if (screen_x > 0 && screen_x-mouse_x < sz/2) + showpie= ShowPieMode.CPIE_TOP_RIGHT; //show 1/4 pie + else + showpie= ShowPieMode.HPIE_TOP; //show 1/2 pie + + } else if (screen_x > 0 && screen_x-mouse_x < sz/2) { + if (screen_y > 0 && screen_y-mouse_y < sz/2) + showpie= ShowPieMode.CPIE_BOT_RIGHT; //show 1/4 pie + else + showpie= ShowPieMode.HPIE_RIGHT; //show 1/2 pie + + } else if (screen_y > 0 && screen_y-mouse_y < sz/2) + showpie= ShowPieMode.HPIE_BOTTOM; //show 1/2 pie + + + } else { + //if the pie is centered in the screen, don't reduce the size + if (PieManager.get_is_centered(pie.id)) { + reduce_szx= 0; + reduce_szy= 0; + } + + //select the configured shape + //convert from radio-buttum number to ShowPieMode enum + switch( PieManager.get_shape_number(pie.id) ) { + case 1: + showpie= ShowPieMode.CPIE_BOT_RIGHT; + if (screen_x-mouse_x > sz/2) + reduce_szx= 0; //keep full width + if (screen_y-mouse_y > sz/2) + reduce_szy= 0; //keep full height + break; + case 2: + showpie= ShowPieMode.HPIE_RIGHT; + if (screen_x-mouse_x > sz/2) + reduce_szx= 0; //keep full width + break; + case 3: + showpie= ShowPieMode.CPIE_TOP_RIGHT; + if (screen_x-mouse_x > sz/2) + reduce_szx= 0; //keep full width + if (mouse_y > sz/2) + reduce_szy= 0; //keep full height + break; + case 4: + showpie= ShowPieMode.HPIE_BOTTOM; + if (screen_y-mouse_y > sz/2) + reduce_szy= 0; //keep full height + break; + case 6: + showpie= ShowPieMode.HPIE_TOP; + if (mouse_y > sz/2) + reduce_szy= 0; //keep full height + break; + case 7: + showpie= ShowPieMode.CPIE_BOT_LEFT; + if (mouse_x > sz/2) + reduce_szx= 0; //keep full width + if (screen_y-mouse_y > sz/2) + reduce_szy= 0; //keep full height + break; + case 8: + showpie= ShowPieMode.HPIE_LEFT; + if (mouse_x > sz/2) + reduce_szx= 0; //keep full width + break; + case 9: + showpie= ShowPieMode.CPIE_TOP_LEFT; + if (mouse_x > sz/2) + reduce_szx= 0; //keep full width + if (mouse_y > sz/2) + reduce_szy= 0; //keep full height + break; + } + } + //set the new show pie mode + set_show_mode(showpie); + + //recalc size + sz = sz0; + if (this.total_slice_count > 0) { + sz = (int)fmax(sz0, + (((Config.global.theme.slice_radius + Config.global.theme.slice_gap)/tan(PI/this.total_slice_count)) + + Config.global.theme.visible_slice_radius)*2*Config.global.theme.max_zoom); + } + //activation_range = normal pie radius + "outer" activation_range + this.activation_range= (int)((double)Config.global.activation_range + sz/(2*Config.global.theme.max_zoom)); + + int szx = 1; //full width + int szy = 1; //full height + switch(this.pie_show_mode) { + //half pie + case ShowPieMode.HPIE_LEFT: + szx = 0; //half width, center to the left + break; + case ShowPieMode.HPIE_RIGHT: + szx = 2; //half width, center to the right + break; + case ShowPieMode.HPIE_TOP: + szy = 0; //half height, center to the top + break; + case ShowPieMode.HPIE_BOTTOM: + szy = 2; //half height, center to the bottom + break; + + //cuarter pie + case ShowPieMode.CPIE_TOP_LEFT: + szx = 0; //half width, center to the left + szy = 0; //half height, center to the top + break; + case ShowPieMode.CPIE_TOP_RIGHT: + szx = 2; //half width, center to the right + szy = 0; //half height, center to the top + break; + case ShowPieMode.CPIE_BOT_LEFT: + szx = 0; //half width, center to the left + szy = 2; //half height, center to the bottom + break; + case ShowPieMode.CPIE_BOT_RIGHT: + szx = 2; //half width, center to the right + szy = 2; //half height, center to the bottom + break; + } + if (reduce_szx == 0) + szx = 1; //don't reduce width + if (reduce_szy == 0) + szy = 1; //don't reduce height + + int rc = (int)Config.global.theme.center_radius; + if (szx == 1 ) { + //full width + this.size_w = sz; + this.center_x = sz/2; //center position + } else { + //half width + this.size_w = sz/2 + rc; + if (szx == 0) { + this.center_x = rc; //center to the left + } else { + this.center_x = this.size_w-rc; //center to the right + } + } + if (szy == 1) { + //full heigth + this.size_h = sz; + this.center_y = sz/2; //center position + } else { + //half heigth + this.size_h = sz/2 + rc; + if (szy == 0) { + this.center_y = rc; //center to the top + } else { + this.center_y = this.size_h-rc; //center to the bottom + } } } @@ -130,12 +423,16 @@ public class PieRenderer : GLib.Object { ///////////////////////////////////////////////////////////////////// public void activate() { - if (this.active_slice >= 0 && this.active_slice < this.slices.size) { + if (this.active_slice >= this.first_slice_idx + && this.active_slice < this.first_slice_idx+this.visible_slice_count) { slices[active_slice].activate(); } - foreach (var slice in this.slices) - slice.fade_out(); + //foreach (var slice in this.slices) + // slice.fade_out(); + for (int i= 0; i < this.visible_slice_count; ++i) { + this.slices[ i+this.first_slice_idx ].fade_out(); + } center.fade_out(); } @@ -145,29 +442,23 @@ public class PieRenderer : GLib.Object { ///////////////////////////////////////////////////////////////////// public void cancel() { - foreach (var slice in this.slices) - slice.fade_out(); + //foreach (var slice in this.slices) + // slice.fade_out(); + for (int i= 0; i < this.visible_slice_count; ++i) { + this.slices[ i+this.first_slice_idx ].fade_out(); + } center.fade_out(); } + ///////////////////////////////////////////////////////////////////// /// Called when the up-key is pressed. Selects the next slice towards /// the top. ///////////////////////////////////////////////////////////////////// public void select_up() { - int bottom = this.slice_count()/4; - int top = this.slice_count()*3/4; - - if (this.active_slice == -1 || this.active_slice == bottom) - this.set_highlighted_slice(top); - else if (this.active_slice > bottom && this.active_slice < top) - this.set_highlighted_slice(this.active_slice+1); - else if (this.active_slice != top) - this.set_highlighted_slice((this.active_slice-1+this.slice_count())%this.slice_count()); - - this.key_board_control = true; + move_active_slice(this.up_slice_idx, this.down_slice_idx); } ///////////////////////////////////////////////////////////////////// @@ -176,17 +467,7 @@ public class PieRenderer : GLib.Object { ///////////////////////////////////////////////////////////////////// public void select_down() { - int bottom = this.slice_count()/4; - int top = this.slice_count()*3/4; - - if (this.active_slice == -1 || this.active_slice == top) - this.set_highlighted_slice(bottom); - else if (this.active_slice > bottom && this.active_slice < top) - this.set_highlighted_slice(this.active_slice-1); - else if (this.active_slice != bottom) - this.set_highlighted_slice((this.active_slice+1)%this.slice_count()); - - this.key_board_control = true; + move_active_slice(this.down_slice_idx, this.up_slice_idx); } ///////////////////////////////////////////////////////////////////// @@ -195,17 +476,7 @@ public class PieRenderer : GLib.Object { ///////////////////////////////////////////////////////////////////// public void select_left() { - int left = this.slice_count()/2; - int right = 0; - - if (this.active_slice == -1 || this.active_slice == right) - this.set_highlighted_slice(left); - else if (this.active_slice > left) - this.set_highlighted_slice(this.active_slice-1); - else if (this.active_slice < left) - this.set_highlighted_slice(this.active_slice+1); - - this.key_board_control = true; + move_active_slice(this.left_slice_idx, this.right_slice_idx); } ///////////////////////////////////////////////////////////////////// @@ -214,17 +485,79 @@ public class PieRenderer : GLib.Object { ///////////////////////////////////////////////////////////////////// public void select_right() { - int left = this.slice_count()/2; - int right = 0; + move_active_slice(this.right_slice_idx, this.left_slice_idx); + } - if (this.active_slice == -1 || this.active_slice == left) - this.set_highlighted_slice(right); - else if (this.active_slice > left) - this.set_highlighted_slice((this.active_slice+1)%this.slice_count()); - else if (this.active_slice < left && this.active_slice != right) - this.set_highlighted_slice((this.active_slice-1+this.slice_count())%this.slice_count()); + ///////////////////////////////////////////////////////////////////// + /// Called when the page_up-key is pressed. Selects the next + /// group of slices. + ///////////////////////////////////////////////////////////////////// - this.key_board_control = true; + public void select_nextpage() { + if (this.first_slice_idx+this.visible_slice_count < slices.size) { + //advance one page + this.first_slice_idx += this.visible_slice_count; + if (this.first_slice_idx+this.visible_slice_count >= slices.size) { + this.visible_slice_count= slices.size - this.first_slice_idx; + } + this.reset_sclice_anim(); + this.set_highlighted_slice(-1); + calc_key_navigation_pos(); + this.key_board_control = true; + + } else if (this.first_slice_idx > 0) { + //go to first page + this.first_slice_idx= 0; + this.reset_sclice_anim(); + //recover the original value + this.visible_slice_count= this.original_visible_slice_count; + this.reset_sclice_anim(); + this.set_highlighted_slice(-1); + calc_key_navigation_pos(); + this.key_board_control = true; + } + } + + ///////////////////////////////////////////////////////////////////// + /// Called when the page_down-key is pressed. Selects the previous + /// group of slices. + ///////////////////////////////////////////////////////////////////// + + public void select_prevpage() { + if (this.first_slice_idx > 0) { + //go back one page + //recover the original value + this.visible_slice_count= this.original_visible_slice_count; + this.first_slice_idx -= this.visible_slice_count; + if (this.first_slice_idx < 0) { + this.first_slice_idx= 0; + } + this.reset_sclice_anim(); + this.set_highlighted_slice(-1); + calc_key_navigation_pos(); + this.key_board_control = true; + + } else if (this.visible_slice_count < slices.size) { + //go to last page + int n= slices.size % this.original_visible_slice_count; + if (n == 0) + //all pages have the same number of slices + this.visible_slice_count= this.original_visible_slice_count; + else + //last page has less slices than previous + this.visible_slice_count= n; + this.first_slice_idx= slices.size - this.visible_slice_count; + this.reset_sclice_anim(); + this.set_highlighted_slice(-1); + calc_key_navigation_pos(); + this.key_board_control = true; + } + } + + private void reset_sclice_anim() { + //reset animation values in all the new visible slices + for (int i= 0; i < this.visible_slice_count; ++i) + this.slices[ i+this.first_slice_idx ].reset_anim(); } ///////////////////////////////////////////////////////////////////// @@ -240,41 +573,58 @@ public class PieRenderer : GLib.Object { ///////////////////////////////////////////////////////////////////// public void draw(double frame_time, Cairo.Context ctx, int mouse_x, int mouse_y) { - if (this.size > 0) { - double distance = sqrt(mouse_x*mouse_x + mouse_y*mouse_y); - double angle = 0.0; - - if (this.key_board_control) { - angle = 2.0*PI*this.active_slice/(double)slice_count(); - } else { - - if (distance > 0) { - angle = acos(mouse_x/distance); - if (mouse_y < 0) - angle = 2*PI - angle; - } - - int next_active_slice = this.active_slice; - - if (distance < Config.global.theme.active_radius - && this.quickaction >= 0 && this.quickaction < this.slices.size) { + if (this.size_w > 0) { + double distance = sqrt(mouse_x*mouse_x + mouse_y*mouse_y); + double angle = 0.0; + int slice_track= 0; + + if (this.key_board_control) { + int n= this.active_slice - this.first_slice_idx; + angle = 2.0*PI*n/(double)this.total_slice_count + this.first_slice_angle; + slice_track= 1; + } else { + + if (distance > 0) { + angle = acos(mouse_x/distance); + if (mouse_y < 0) + angle = 2*PI - angle; + } - next_active_slice = this.quickaction; - angle = 2.0*PI*quickaction/(double)slice_count(); - } else if (distance > Config.global.theme.active_radius && this.slice_count() > 0 && distance < Config.global.activation_range) { - next_active_slice = (int)(angle*slices.size/(2*PI) + 0.5) % this.slice_count(); - } else { - next_active_slice = -1; - } + int next_active_slice = this.active_slice; + + if (distance < Config.global.theme.active_radius + && this.quickaction >= this.first_slice_idx + && this.quickaction < this.first_slice_idx+this.visible_slice_count) { + + next_active_slice = this.quickaction; + int n= this.quickaction - this.first_slice_idx; + angle = 2.0*PI*n/(double)this.total_slice_count + this.first_slice_angle; + + } else if (distance > Config.global.theme.active_radius && this.total_slice_count > 0 + && distance < this.activation_range) { + double a= angle-this.first_slice_angle; + if (a < 0) + a= a + 2*PI; + next_active_slice = (int)(a*this.total_slice_count/(2*PI) + 0.5) % this.total_slice_count; + if (next_active_slice >= this.visible_slice_count) + next_active_slice = -1; + else { + next_active_slice = next_active_slice + this.first_slice_idx; + slice_track= 1; + } + } else { + next_active_slice = -1; + } - this.set_highlighted_slice(next_active_slice); - } + this.set_highlighted_slice(next_active_slice); + } - center.draw(frame_time, ctx, angle, distance); + center.draw(frame_time, ctx, angle, slice_track); - foreach (var slice in this.slices) - slice.draw(frame_time, ctx, angle, distance); - } + for (int i= 0; i < this.visible_slice_count; ++i) { + this.slices[ i+this.first_slice_idx ].draw(frame_time, ctx, angle, slice_track); + } + } } ///////////////////////////////////////////////////////////////////// @@ -291,21 +641,215 @@ public class PieRenderer : GLib.Object { public void set_highlighted_slice(int index) { if (index != this.active_slice) { - if (index >= 0 && index < this.slice_count()) + if (index >= this.first_slice_idx && index < this.first_slice_idx+this.visible_slice_count) this.active_slice = index; - else if (this.quickaction >= 0) - this.active_slice = this.quickaction; else this.active_slice = -1; - SliceRenderer? active = (this.active_slice >= 0 && this.active_slice < this.slice_count()) ? + SliceRenderer? active = (this.active_slice >= 0 && this.active_slice < slices.size) ? this.slices[this.active_slice] : null; center.set_active_slice(active); - foreach (var slice in this.slices) - slice.set_active_slice(active); + for (int i= 0; i < this.visible_slice_count; ++i) { + this.slices[ i+this.first_slice_idx ].set_active_slice(active); + } + } + } + + private void set_show_mode(ShowPieMode show_mode) { + //The index of the first visible slice + this.first_slice_idx= 0; + //Angular position of the first visible slice + this.first_slice_angle= 0; + + int mult= 1; + switch(show_mode) { + //half pie + case ShowPieMode.HPIE_LEFT: + mult= 2; + this.first_slice_angle= -PI/2; + break; + case ShowPieMode.HPIE_RIGHT: + mult= 2; + this.first_slice_angle= PI/2; + break; + case ShowPieMode.HPIE_TOP: + mult= 2; + break; + case ShowPieMode.HPIE_BOTTOM: + this.first_slice_angle= PI; + mult= 2; + break; + + //cuarter pie + case ShowPieMode.CPIE_TOP_LEFT: + mult= 4; + break; + case ShowPieMode.CPIE_TOP_RIGHT: + this.first_slice_angle= PI/2; + mult= 4; + break; + case ShowPieMode.CPIE_BOT_LEFT: + this.first_slice_angle= -PI/2; + mult= 4; + break; + case ShowPieMode.CPIE_BOT_RIGHT: + this.first_slice_angle= PI; + mult= 4; + break; + + default: //ShowPieMode.FULL_PIE or invalid values + show_mode= ShowPieMode.FULL_PIE; + break; + } + this.pie_show_mode= show_mode; + //limit the number of visible slices + int maxview= this.max_visible_slices / mult; + //Number of visible slices + this.visible_slice_count= (int)fmin(slices.size, maxview); + //Number of slices in full pie (visible or not) + this.total_slice_count= this.visible_slice_count*mult; + if (mult > 1 && slices.size > 1) { + this.total_slice_count -= mult; } + + //keep a copy of the original value since page up/down change it + original_visible_slice_count= visible_slice_count; + + calc_key_navigation_pos(); + } + + private void calc_key_navigation_pos() { + //calc slices index for keyboard navigation + + int a= this.first_slice_idx; + int b= this.first_slice_idx + this.visible_slice_count/4; + int c= this.first_slice_idx + this.visible_slice_count/2; + int d= this.first_slice_idx + (this.visible_slice_count*3)/4; + int e= this.first_slice_idx + this.visible_slice_count -1; + switch(this.pie_show_mode) { + //half pie + case ShowPieMode.HPIE_LEFT: + this.up_slice_idx= a; + this.right_slice_idx= c; + this.down_slice_idx= e; + this.left_slice_idx= -1; //no left slice, go up instead + break; + case ShowPieMode.HPIE_RIGHT: + this.down_slice_idx= a; + this.left_slice_idx= c; + this.up_slice_idx= e; + this.right_slice_idx= -1; //no right slice, go down instead + break; + case ShowPieMode.HPIE_TOP: + this.right_slice_idx= a; + this.down_slice_idx= c; + this.left_slice_idx= e; + this.up_slice_idx= -1; //no up slice, go left instead + break; + case ShowPieMode.HPIE_BOTTOM: + this.left_slice_idx= a; + this.up_slice_idx= c; + this.right_slice_idx= e; + this.down_slice_idx= -1; //no down slice, go right instead + break; + + //cuarter pie + case ShowPieMode.CPIE_TOP_LEFT: + this.right_slice_idx= a; + this.down_slice_idx= e; + this.up_slice_idx= -1; //no up slice, go right instead + this.left_slice_idx= -1; //no left slice, go down instead + break; + case ShowPieMode.CPIE_TOP_RIGHT: + this.down_slice_idx= a; + this.left_slice_idx= e; + this.up_slice_idx= -1; //no up slice, go left instead + this.right_slice_idx= -1; //no righ slice, go down instead + break; + case ShowPieMode.CPIE_BOT_LEFT: + this.up_slice_idx= a; + this.right_slice_idx= e; + this.down_slice_idx= -1; //no down slice, go right instead + this.left_slice_idx= -1; //no left slice, go up instead + break; + case ShowPieMode.CPIE_BOT_RIGHT: + this.left_slice_idx= a; + this.up_slice_idx= e; + this.down_slice_idx= -1; //no down slice, go left instead + this.right_slice_idx= -1; //no right slice, go up instead + break; + + default: //ShowPieMode.FULL_PIE or invalid values + this.right_slice_idx= a; + this.down_slice_idx= b; + this.left_slice_idx= c; + this.up_slice_idx= d; + break; + } + } + + + ///////////////////////////////////////////////////////////////////// + /// keyboard navigation helper + /// move current position one slice towards the given extreme + ///////////////////////////////////////////////////////////////////// + + private void move_active_slice(int extreme, int other_extreme ) { + int pos= this.active_slice; + + if (pos < 0 || pos == extreme) { + //no actual position or allready at the extreme + pos= extreme; //go to the extreme pos + + } else if (extreme == -1) { + //the extreme was eaten, just go away from the other_extreme + if (pos > other_extreme || other_extreme == 0) { + if (pos < this.visible_slice_count+this.first_slice_idx-1) + pos++; + } else if (pos > this.first_slice_idx) + pos--; + + } else if (other_extreme == -1) { + //the other_extreme was eaten, just get closer to the extreme + if (pos < extreme) + pos++; + else if (pos > extreme) + pos--; + + } else if (pos == other_extreme) { + //both extremes are present + //jump quickly form one extreme to the other + pos= extreme; //go to the extreme pos + + } else { + //both extremes are present + //add or substract 1 to position in a circular manner + if (extreme > other_extreme) { + if (pos > other_extreme && pos < extreme) + //other_extreme < pos < extreme + pos= pos+1; + else + pos= pos-1; + } else { + if (pos > extreme && pos < other_extreme) + //extreme < pos < other_extreme + pos= pos-1; + else + pos= pos+1; + } + + if (pos < this.first_slice_idx) + pos= this.visible_slice_count-1+this.first_slice_idx; + + if (pos >= this.visible_slice_count+this.first_slice_idx) + pos= this.first_slice_idx; + } + + this.set_highlighted_slice(pos); + + this.key_board_control = true; } } diff --git a/src/renderers/pieWindow.vala b/src/renderers/pieWindow.vala old mode 100644 new mode 100755 index da346dd..4d5d35a --- a/src/renderers/pieWindow.vala +++ b/src/renderers/pieWindow.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// using GLib.Math; @@ -44,6 +44,31 @@ public class PieWindow : Gtk.Window { public Image background { get; private set; default=null; } + ///////////////////////////////////////////////////////////////////// + /// The background image position and size. + ///////////////////////////////////////////////////////////////////// + + private int back_x; + private int back_y; + private int back_sz_x; + private int back_sz_y; + + ///////////////////////////////////////////////////////////////////// + /// Some panels moves the window after it was realized. + /// This value set the maximum allowed panel height or width. + /// (how many pixels the window could be moved in every direction + /// from the screen borders towards the center) + ///////////////////////////////////////////////////////////////////// + + private int panel_sz = 64; + + ///////////////////////////////////////////////////////////////////// + /// This value set the maximum allowed mouse movement in pixels + /// from the capture to the show point in every direction. + ///////////////////////////////////////////////////////////////////// + + private int mouse_move = 30; + ///////////////////////////////////////////////////////////////////// /// The owned renderer. ///////////////////////////////////////////////////////////////////// @@ -97,11 +122,12 @@ public class PieWindow : Gtk.Window { this.add_events(Gdk.EventMask.BUTTON_RELEASE_MASK | Gdk.EventMask.KEY_RELEASE_MASK | Gdk.EventMask.KEY_PRESS_MASK | - Gdk.EventMask.POINTER_MOTION_MASK); + Gdk.EventMask.POINTER_MOTION_MASK | + Gdk.EventMask.SCROLL_MASK ); // activate on left click this.button_release_event.connect ((e) => { - if (e.button == 1 || this.renderer.turbo_mode) this.activate_slice(); + if (e.button == 1 || PieManager.get_is_turbo(this.renderer.id)) this.activate_slice(); return true; }); @@ -124,7 +150,7 @@ public class PieWindow : Gtk.Window { // activate on key release if turbo_mode is enabled this.key_release_event.connect((e) => { last_key = 0; - if (this.renderer.turbo_mode) + if (PieManager.get_is_turbo(this.renderer.id)) this.activate_slice(); else this.handle_key_release(e.keyval); @@ -142,6 +168,15 @@ public class PieWindow : Gtk.Window { FocusGrabber.grab(this.get_window(), true, true, false); }); + this.scroll_event.connect((e) => { + if (e.direction == Gdk.ScrollDirection.UP) + this.renderer.select_prevpage(); + + else if (e.direction == Gdk.ScrollDirection.DOWN) + this.renderer.select_nextpage(); + return true; + }); + // draw the pie on expose this.draw.connect(this.draw_window); } @@ -153,7 +188,7 @@ public class PieWindow : Gtk.Window { public void load_pie(Pie pie) { this.renderer.load_pie(pie); this.set_window_position(pie); - this.set_size_request(renderer.size, renderer.size); + this.set_size_request(renderer.size_w, renderer.size_h); } ///////////////////////////////////////////////////////////////////// @@ -162,13 +197,56 @@ public class PieWindow : Gtk.Window { public void open() { this.realize(); - // capture the background image if there is no compositing if (!this.has_compositing) { - int x, y, width, height; - this.get_position(out x, out y); - this.get_size(out width, out height); - this.background = new Image.capture_screen(x, y, width+1, height+1); + this.get_position(out this.back_x, out this.back_y); + this.get_size(out this.back_sz_x, out this.back_sz_y); + this.back_sz_x++; + this.back_sz_y++; + + int screenx= Gdk.Screen.width(); + int screeny= Gdk.Screen.height(); + + //allow some window movement from the screen borders + //(some panels moves the window after it was realized) + int dx = this.panel_sz - this.back_x; + if (dx > 0) + this.back_sz_x += dx; + dx = this.panel_sz - (screenx - this.back_x - this.back_sz_x +1); + if (dx > 0) { + this.back_sz_x += dx; + this.back_x -= dx; + } + + int dy = this.panel_sz - this.back_y; + if (dy > 0) + this.back_sz_y += dy; + dy = this.panel_sz - (screeny - this.back_y - this.back_sz_y +1); + if (dy > 0) { + this.back_sz_y += dy; + this.back_y -= dy; + } + + //also tolerate some mouse movement + this.back_x -= this.mouse_move; + this.back_sz_x += this.mouse_move*2; + this.back_y -= this.mouse_move; + this.back_sz_y += this.mouse_move*2; + + //make sure we don't go outside the screen + if (this.back_x < 0) { + this.back_sz_x += this.back_x; + this.back_x = 0; + } + if (this.back_y < 0) { + this.back_sz_y += this.back_y; + this.back_y = 0; + } + if (this.back_x + this.back_sz_x > screenx) + this.back_sz_x = screenx - this.back_x; + if (this.back_y + this.back_sz_y > screeny) + this.back_sz_y = screeny - this.back_y; + this.background = new Image.capture_screen(this.back_x, this.back_y, this.back_sz_x, this.back_sz_y); } // capture the input focus @@ -179,11 +257,20 @@ public class PieWindow : Gtk.Window { this.timer.start(); this.queue_draw(); + bool warp_pointer = PieManager.get_is_warp(this.renderer.id); + // the main draw loop GLib.Timeout.add((uint)(1000.0/Config.global.refresh_rate), () => { if (this.closed) return false; + if (warp_pointer) { + warp_pointer = false; + int x, y; + this.get_center_pos(out x, out y); + this.set_mouse_position(x, y); + } + this.queue_draw(); return this.visible; }); @@ -194,12 +281,46 @@ public class PieWindow : Gtk.Window { ///////////////////////////////////////////////////////////////////// public void get_center_pos(out int out_x, out int out_y) { - int x=0, y=0, width=0, height=0; + int x=0, y=0; //width=0, height=0; this.get_position(out x, out y); - this.get_size(out width, out height); + out_x = x + renderer.center_x; + out_y = y + renderer.center_y; + } - out_x = x + width/2; - out_y = y + height/2; + ///////////////////////////////////////////////////////////////////// + /// Gets the absolute position of the mouse pointer. + ///////////////////////////////////////////////////////////////////// + + private void get_mouse_position(out int mx, out int my) { + // get the mouse position + mx = 0; + my = 0; + Gdk.ModifierType mask; + + var display = Gdk.Display.get_default(); + var manager = display.get_device_manager(); + GLib.List list = manager.list_devices(Gdk.DeviceType.MASTER); + + foreach(var device in list) { + if (device.input_source != Gdk.InputSource.KEYBOARD) { + this.get_window().get_device_position(device, out mx, out my, out mask); + } + } + } + + ///////////////////////////////////////////////////////////////////// + /// Sets the absolute position of the mouse pointer. + ///////////////////////////////////////////////////////////////////// + + private void set_mouse_position(int mx, int my) { + var display = Gdk.Display.get_default(); + var manager = display.get_device_manager(); + GLib.List list = manager.list_devices(Gdk.DeviceType.MASTER); + foreach(var device in list) { + if (device.input_source != Gdk.InputSource.KEYBOARD) { + device.warp(Gdk.Screen.get_default(), mx, my); + } + } } ///////////////////////////////////////////////////////////////////// @@ -213,35 +334,34 @@ public class PieWindow : Gtk.Window { ctx.paint(); ctx.set_operator (Cairo.Operator.OVER); } else { + //correct the background position if the window was moved + //since the background image was captured + int x, y; + this.get_position(out x, out y); + int dx = this.back_x - x; + int dy = this.back_y - y; + ctx.save(); + ctx.translate(dx, dy); ctx.set_operator (Cairo.Operator.OVER); ctx.set_source_surface(background.surface, -1, -1); ctx.paint(); + ctx.restore(); } // align the context to the center of the PieWindow - ctx.translate(this.width_request*0.5, this.height_request*0.5); + ctx.translate(this.renderer.center_x, this.renderer.center_y); // get the mouse position - double mouse_x = 0.0, mouse_y = 0.0; - Gdk.ModifierType mask; - - var display = Gdk.Display.get_default(); - var manager = display.get_device_manager(); - GLib.List list = manager.list_devices(Gdk.DeviceType.MASTER); - - foreach(var device in list) { - if (device.input_source != Gdk.InputSource.KEYBOARD) { - this.get_window().get_device_position_double(device, out mouse_x, out mouse_y, out mask); - } - } + int mouse_x, mouse_y; + get_mouse_position( out mouse_x, out mouse_y ); // store the frame time double frame_time = this.timer.elapsed(); this.timer.reset(); // render the Pie - this.renderer.draw(frame_time, ctx, (int)(mouse_x - this.width_request*0.5), - (int)(mouse_y - this.height_request*0.5)); + this.renderer.draw(frame_time, ctx, mouse_x - (int)this.renderer.center_x, + mouse_y - (int)this.renderer.center_y); return true; } @@ -309,11 +429,15 @@ public class PieWindow : Gtk.Window { private void handle_key_press(uint key) { if (Gdk.keyval_name(key) == "Escape") this.cancel(); else if (Gdk.keyval_name(key) == "Return") this.activate_slice(); - else if (!this.renderer.turbo_mode) { + else if (!PieManager.get_is_turbo(this.renderer.id)) { if (Gdk.keyval_name(key) == "Up") this.renderer.select_up(); else if (Gdk.keyval_name(key) == "Down") this.renderer.select_down(); else if (Gdk.keyval_name(key) == "Left") this.renderer.select_left(); else if (Gdk.keyval_name(key) == "Right") this.renderer.select_right(); + else if (Gdk.keyval_name(key) == "Page_Down") this.renderer.select_nextpage(); + else if (Gdk.keyval_name(key) == "Page_Up") this.renderer.select_prevpage(); + else if (Gdk.keyval_name(key) == "Tab") this.renderer.select_nextpage(); + else if (Gdk.keyval_name(key) == "ISO_Left_Tab") this.renderer.select_prevpage(); else if (Gdk.keyval_name(key) == "Alt_L") this.renderer.show_hotkeys = true; else { int index = -1; @@ -342,7 +466,7 @@ public class PieWindow : Gtk.Window { ///////////////////////////////////////////////////////////////////// private void handle_key_release(uint key) { - if (!this.renderer.turbo_mode) { + if (!PieManager.get_is_turbo(this.renderer.id)) { if (Gdk.keyval_name(key) == "Alt_L") this.renderer.show_hotkeys = false; } } diff --git a/src/renderers/sliceRenderer.vala b/src/renderers/sliceRenderer.vala index 2ecf7c4..862e2a5 100644 --- a/src/renderers/sliceRenderer.vala +++ b/src/renderers/sliceRenderer.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// using GLib.Math; @@ -94,7 +94,14 @@ public class SliceRenderer : GLib.Object { public SliceRenderer(PieRenderer parent) { this.parent = parent; + this.reset_anim(); + } + ///////////////////////////////////////////////////////////////////// + /// Put all AnimatedValues in their initial values + ///////////////////////////////////////////////////////////////////// + + public void reset_anim() { this.fade = new AnimatedValue.linear(0.0, 0.0, Config.global.theme.transition_time); this.wobble = new AnimatedValue.linear(0.0, 0.0, Config.global.theme.transition_time); this.alpha = new AnimatedValue.linear(0.0, 1.0, Config.global.theme.fade_in_time); @@ -147,7 +154,7 @@ public class SliceRenderer : GLib.Object { } ///////////////////////////////////////////////////////////////////// - /// Activaes the Action of this slice. + /// Activates the Action of this slice. ///////////////////////////////////////////////////////////////////// public void activate() { @@ -189,7 +196,7 @@ public class SliceRenderer : GLib.Object { /// Draws all layers of the slice. ///////////////////////////////////////////////////////////////////// - public void draw(double frame_time, Cairo.Context ctx, double angle, double distance) { + public void draw(double frame_time, Cairo.Context ctx, double angle, int slice_track) { // update the AnimatedValues this.scale.update(frame_time); @@ -199,16 +206,23 @@ public class SliceRenderer : GLib.Object { this.fade_rotation.update(frame_time); this.wobble.update(frame_time); - double direction = 2.0 * PI * position/parent.slice_count() + this.fade_rotation.val; - double max_scale = 1.0/Config.global.theme.max_zoom; + double direction = 2.0 * PI * (position-parent.first_slice_idx)/parent.total_slice_count + + parent.first_slice_angle + this.fade_rotation.val; + double max_scale = 1.0/Config.global.theme.max_zoom; double diff = fabs(angle-direction); - if (diff > PI) - diff = 2 * PI - diff; + if (diff > 2 * PI) { + diff = diff - 2 * PI; + } + + if (diff > PI) { + diff = 2 * PI - diff; + } + - active = ((parent.active_slice >= 0) && (diff < PI/parent.slice_count())); + active = ((parent.active_slice >= 0) && (diff < PI/parent.total_slice_count)); - if (parent.active_slice >= 0) { + if (slice_track != 0) { double wobble = Config.global.theme.wobble*diff/PI*(1-diff/PI); if ((direction < angle && direction > angle - PI) || direction > PI+angle) { this.wobble.reset_target(-wobble, Config.global.theme.transition_time*0.5); @@ -228,7 +242,7 @@ public class SliceRenderer : GLib.Object { - max_scale = (parent.active_slice >= 0 ? max_scale : 1.0/Config.global.theme.max_zoom); + max_scale = (slice_track != 0 ? max_scale : 1.0/Config.global.theme.max_zoom); if (fabs(this.scale.end - max_scale) > Config.global.theme.max_zoom*0.005) this.scale.reset_target(max_scale, Config.global.theme.transition_time); @@ -240,9 +254,9 @@ public class SliceRenderer : GLib.Object { // increase radius if there are many slices in a pie if (atan((Config.global.theme.slice_radius+Config.global.theme.slice_gap) - /(radius/Config.global.theme.max_zoom)) > PI/parent.slice_count()) { + /(radius/Config.global.theme.max_zoom)) > PI/parent.total_slice_count) { radius = (Config.global.theme.slice_radius+Config.global.theme.slice_gap) - /tan(PI/parent.slice_count())*Config.global.theme.max_zoom; + /tan(PI/parent.total_slice_count)*Config.global.theme.max_zoom; } // transform the context diff --git a/src/themes/centerLayer.vala b/src/themes/centerLayer.vala index 3469fd0..59f37ed 100644 --- a/src/themes/centerLayer.vala +++ b/src/themes/centerLayer.vala @@ -1,23 +1,23 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// This class representing a layer of the center of a pie. Each theme /// may have plenty of them. ///////////////////////////////////////////////////////////////////////// @@ -32,77 +32,77 @@ public class CenterLayer : GLib.Object { ///////////////////////////////////////////////////////////////////// public enum RotationMode {AUTO, TO_MOUSE, TO_ACTIVE} - + ///////////////////////////////////////////////////////////////////// /// Information on the contained image. ///////////////////////////////////////////////////////////////////// - + public Image image {get; private set;} public string image_file; - + ///////////////////////////////////////////////////////////////////// /// Properties for the active state of this layer. ///////////////////////////////////////////////////////////////////// - + public double active_scale {get; private set;} public double active_rotation_speed {get; private set;} public double active_alpha {get; private set;} public bool active_colorize {get; private set;} public RotationMode active_rotation_mode {get; private set;} - + ///////////////////////////////////////////////////////////////////// /// Properties for the inactive state of this layer. ///////////////////////////////////////////////////////////////////// - + public double inactive_scale {get; private set;} public double inactive_rotation_speed {get; private set;} public double inactive_alpha {get; private set;} public bool inactive_colorize {get; private set;} public RotationMode inactive_rotation_mode {get; private set;} - + ///////////////////////////////////////////////////////////////////// /// The current rotation of this layer. TODO: Remove this. ///////////////////////////////////////////////////////////////////// - + public double rotation {get; set;} - + ///////////////////////////////////////////////////////////////////// /// Helper variable for image loading. ///////////////////////////////////////////////////////////////////// - + private int center_radius; - + ///////////////////////////////////////////////////////////////////// /// C'tor, initializes all members of the layer. ///////////////////////////////////////////////////////////////////// - - public CenterLayer(string image_file, int center_radius, double active_scale, double active_rotation_speed, + + public CenterLayer(string image_file, int center_radius, double active_scale, double active_rotation_speed, double active_alpha, bool active_colorize, RotationMode active_rotation_mode, - double inactive_scale, double inactive_rotation_speed, + double inactive_scale, double inactive_rotation_speed, double inactive_alpha, bool inactive_colorize, RotationMode inactive_rotation_mode) { - + this.image_file = image_file; this.center_radius = center_radius; - + this.active_scale = active_scale; this.active_rotation_speed = active_rotation_speed; this.active_alpha = active_alpha; this.active_colorize = active_colorize; this.active_rotation_mode = active_rotation_mode; - + this.inactive_scale = inactive_scale; this.inactive_rotation_speed = inactive_rotation_speed; this.inactive_alpha = inactive_alpha; this.inactive_colorize = inactive_colorize; this.inactive_rotation_mode = inactive_rotation_mode; - + this.rotation = 0.0; } - + ///////////////////////////////////////////////////////////////////// /// Loads the contained image. ///////////////////////////////////////////////////////////////////// - + public void load_image() { this.image = new Image.from_file_at_size(image_file, 2*center_radius, 2*center_radius); } diff --git a/src/themes/sliceLayer.vala b/src/themes/sliceLayer.vala index 3c650c0..17ac3bb 100644 --- a/src/themes/sliceLayer.vala +++ b/src/themes/sliceLayer.vala @@ -1,23 +1,23 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// This class representing a layer of a slice of a pie. Each theme may /// have plenty of them. ///////////////////////////////////////////////////////////////////////// @@ -26,35 +26,35 @@ public class SliceLayer : GLib.Object { public enum Type { FILE, ICON, CAPTION } public enum Visibility { ANY, WITH_CAPTION, WITHOUT_CAPTION } - + public Type layer_type { get; private set; } public Visibility visibility { get; private set; } - + ///////////////////////////////////////////////////////////////////// /// Information on the contained image. ///////////////////////////////////////////////////////////////////// - + public Image image {get; set;} - - + + ///////////////////////////////////////////////////////////////////// /// Properties of this layer. ///////////////////////////////////////////////////////////////////// - + public string icon_file {get; private set; default="";} public bool colorize {get; private set; default=false;} public int icon_size {get; private set; default=1;} - + public string font {get; private set; default="";} public int width {get; private set; default=0;} public int height {get; private set; default=0;} public int position {get; private set; default=0;} public Color color {get; private set; default=new Color();} - + ///////////////////////////////////////////////////////////////////// /// C'tor, initializes all members of the layer. ///////////////////////////////////////////////////////////////////// - + public SliceLayer.file(string icon_file, int icon_size, bool colorize, Visibility visibility) { this.layer_type = Type.FILE; this.icon_file = icon_file; @@ -62,7 +62,7 @@ public class SliceLayer : GLib.Object { this.icon_size = icon_size; this.visibility = visibility; } - + public SliceLayer.icon(string icon_file, int icon_size, bool colorize, Visibility visibility) { this.layer_type = Type.ICON; this.icon_file = icon_file; @@ -70,7 +70,7 @@ public class SliceLayer : GLib.Object { this.icon_size = icon_size; this.visibility = visibility; } - + public SliceLayer.caption(string font, int width, int height, int position, Color color, bool colorize, Visibility visibility) { this.layer_type = Type.CAPTION; this.font = font; @@ -81,15 +81,15 @@ public class SliceLayer : GLib.Object { this.visibility = visibility; this.colorize = colorize; } - + ///////////////////////////////////////////////////////////////////// /// Loads the contained image. ///////////////////////////////////////////////////////////////////// - + public void load_image() { this.image = null; - - if (this.icon_file == "" && this.layer_type == Type.ICON) + + if (this.icon_file == "" && this.layer_type == Type.ICON) this.image = new Image.empty(this.icon_size, this.icon_size, new Color.from_rgb(1, 1, 1)); else if (this.icon_file != "") this.image = new Image.from_file_at_size(this.icon_file, this.icon_size, this.icon_size); diff --git a/src/themes/theme.vala b/src/themes/theme.vala index 1956046..e068b9e 100644 --- a/src/themes/theme.vala +++ b/src/themes/theme.vala @@ -1,34 +1,34 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// using GLib.Math; namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A theme of Gnome-Pie. Can be loaded from XML-Files. ///////////////////////////////////////////////////////////////////////// public class Theme : GLib.Object { - + ///////////////////////////////////////////////////////////////////// /// Properties of a theme. ///////////////////////////////////////////////////////////////////// - + public string directory {get; private set; default="";} public string name {get; private set; default="";} public string description {get; private set; default="";} @@ -49,6 +49,7 @@ public class Theme : GLib.Object { public double center_radius {get; private set; default=90.0;} public double active_radius {get; private set; default=45.0;} public double slice_radius {get; private set; default=32.0;} + public double visible_slice_radius {get; private set; default=0.0;} public double slice_gap {get; private set; default=14.0;} public bool has_slice_captions {get; private set; default=false;} public bool caption {get; private set; default=false;} @@ -58,39 +59,39 @@ public class Theme : GLib.Object { public double caption_position {get; private set; default=0.0;} public Color caption_color {get; private set; default=new Color();} public Icon preview_icon {get; private set; default=new Icon("gnome-pie", 36);} - + public Gee.ArrayList center_layers {get; private set;} public Gee.ArrayList active_slice_layers {get; private set;} public Gee.ArrayList inactive_slice_layers {get; private set;} - + ///////////////////////////////////////////////////////////////////// /// C'tor, creates a theme object for a given theme directory. This /// directory should contain a theme.xml file. ///////////////////////////////////////////////////////////////////// - + public Theme(string dir) { this.center_layers = new Gee.ArrayList(); this.active_slice_layers = new Gee.ArrayList(); this.inactive_slice_layers = new Gee.ArrayList(); - + this.directory = dir; } - + ///////////////////////////////////////////////////////////////////// - /// Loads the theme from its directory. Images have to be loaded + /// Loads the theme from its directory. Images have to be loaded /// explicitly. ///////////////////////////////////////////////////////////////////// - + public bool load() { this.center_layers.clear(); this.active_slice_layers.clear(); this.inactive_slice_layers.clear(); - + this.preview_icon = new Icon(this.directory + "/preview.png", 36); - + Xml.Parser.init(); string path = this.directory + "/theme.xml"; - + Xml.Doc* themeXML = Xml.Parser.parse_file(path); if (themeXML == null) { warning("Failed to add theme: \"" + path + "\" not found!"); @@ -103,21 +104,21 @@ public class Theme : GLib.Object { warning("Failed to add theme: \"theme.xml\" is empty!"); return false; } - + this.parse_root(root); - + delete themeXML; Xml.Parser.cleanup(); - + this.radius *= max_zoom; - + return true; } - + ///////////////////////////////////////////////////////////////////// /// Loads all images of the theme. ///////////////////////////////////////////////////////////////////// - + public void load_images() { foreach (var layer in this.center_layers) layer.load_image(); @@ -126,17 +127,17 @@ public class Theme : GLib.Object { foreach (var layer in this.inactive_slice_layers) layer.load_image(); } - + ///////////////////////////////////////////////////////////////////// /// The following methods parse specific parts of the theme file. /// Nothing special here, just some boring code. ///////////////////////////////////////////////////////////////////// - + private void parse_root(Xml.Node* root) { for (Xml.Attr* attribute = root->properties; attribute != null; attribute = attribute->next) { string attr_name = attribute->name.down(); string attr_content = attribute->children->content; - + switch (attr_name) { case "name": name = attr_content; @@ -161,16 +162,16 @@ public class Theme : GLib.Object { } } } - + ///////////////////////////////////////////////////////////////////// /// Parses a element from the theme.xml file. ///////////////////////////////////////////////////////////////////// - + private void parse_pie(Xml.Node* pie) { for (Xml.Attr* attribute = pie->properties; attribute != null; attribute = attribute->next) { string attr_name = attribute->name.down(); string attr_content = attribute->children->content; - + switch (attr_name) { case "radius": radius = double.parse(attr_content) * Config.global.global_scale; @@ -234,16 +235,16 @@ public class Theme : GLib.Object { } } } - + ///////////////////////////////////////////////////////////////////// /// Parses a
element from the theme.xml file. ///////////////////////////////////////////////////////////////////// - + private void parse_center(Xml.Node* center) { for (Xml.Attr* attribute = center->properties; attribute != null; attribute = attribute->next) { string attr_name = attribute->name.down(); string attr_content = attribute->children->content; - + switch (attr_name) { case "radius": center_radius = double.parse(attr_content) * Config.global.global_scale; @@ -259,7 +260,7 @@ public class Theme : GLib.Object { for (Xml.Node* node = center->children; node != null; node = node->next) { if (node->type == Xml.ElementType.ELEMENT_NODE) { string element_name = node->name.down(); - + if (element_name == "center_layer") { parse_center_layer(node); } else { @@ -268,19 +269,20 @@ public class Theme : GLib.Object { } } } - + ///////////////////////////////////////////////////////////////////// /// Parses a element from the theme.xml file. ///////////////////////////////////////////////////////////////////// - + private void parse_slices(Xml.Node* slices) { for (Xml.Attr* attribute = slices->properties; attribute != null; attribute = attribute->next) { string attr_name = attribute->name.down(); string attr_content = attribute->children->content; - + switch (attr_name) { case "radius": slice_radius = double.parse(attr_content) * Config.global.global_scale; + visible_slice_radius = double.parse(attr_content) * Config.global.global_scale; break; case "mingap": slice_gap = double.parse(attr_content) * Config.global.global_scale; @@ -293,7 +295,7 @@ public class Theme : GLib.Object { for (Xml.Node* node = slices->children; node != null; node = node->next) { if (node->type == Xml.ElementType.ELEMENT_NODE) { string element_name = node->name.down(); - + if (element_name == "activeslice" || element_name == "inactiveslice") { parse_slice_layers(node); } else { @@ -302,11 +304,11 @@ public class Theme : GLib.Object { } } } - + ///////////////////////////////////////////////////////////////////// /// Parses a element from the theme.xml file. ///////////////////////////////////////////////////////////////////// - + private void parse_center_layer(Xml.Node* layer) { string file = ""; @@ -320,11 +322,11 @@ public class Theme : GLib.Object { bool inactive_colorize = false; CenterLayer.RotationMode active_rotation_mode = CenterLayer.RotationMode.AUTO; CenterLayer.RotationMode inactive_rotation_mode = CenterLayer.RotationMode.AUTO; - + for (Xml.Attr* attribute = layer->properties; attribute != null; attribute = attribute->next) { string attr_name = attribute->name.down(); string attr_content = attribute->children->content; - + switch (attr_name) { case "file": file = attr_content; @@ -342,10 +344,10 @@ public class Theme : GLib.Object { break; case "turn_to_active": active_rotation_mode = CenterLayer.RotationMode.TO_ACTIVE; - break; + break; case "turn_to_mouse": active_rotation_mode = CenterLayer.RotationMode.TO_MOUSE; - break; + break; default: warning("Invalid value \"" + attr_content + "\" for attribute \"" + attr_name + "\" in element!"); break; @@ -370,10 +372,10 @@ public class Theme : GLib.Object { break; case "turn_to_active": inactive_rotation_mode = CenterLayer.RotationMode.TO_ACTIVE; - break; + break; case "turn_to_mouse": inactive_rotation_mode = CenterLayer.RotationMode.TO_MOUSE; - break; + break; default: warning("Invalid value \"" + attr_content + "\" for attribute \"" + attr_name + "\" in element!"); break; @@ -392,19 +394,19 @@ public class Theme : GLib.Object { } double max_scale = GLib.Math.fmax(active_scale, inactive_scale); - center_layers.add(new CenterLayer(directory + "/" + file, (int)(center_radius*max_scale), active_scale/max_scale, active_rotation_speed, active_alpha, active_colorize, active_rotation_mode, + center_layers.add(new CenterLayer(directory + "/" + file, (int)(center_radius*max_scale), active_scale/max_scale, active_rotation_speed, active_alpha, active_colorize, active_rotation_mode, inactive_scale/max_scale, inactive_rotation_speed, inactive_alpha, inactive_colorize, inactive_rotation_mode)); } - + ///////////////////////////////////////////////////////////////////// /// Parses a element from the theme.xml file. ///////////////////////////////////////////////////////////////////// - + private void parse_slice_layers(Xml.Node* slice) { for (Xml.Node* layer = slice->children; layer != null; layer = layer->next) { if (layer->type == Xml.ElementType.ELEMENT_NODE) { string element_name = layer->name.down(); - + if (element_name == "slice_layer") { string file = ""; double scale = 1.0; @@ -417,11 +419,11 @@ public class Theme : GLib.Object { int pos_x = 0; int pos_y = 0; Color slice_caption_color = new Color.from_rgb(1.0f, 1.0f, 1.0f); - + for (Xml.Attr* attribute = layer->properties; attribute != null; attribute = attribute->next) { string attr_name = attribute->name.down(); string attr_content = attribute->children->content; - + switch (attr_name) { case "file": file = attr_content; @@ -476,11 +478,12 @@ public class Theme : GLib.Object { break; } } - + if (file != "") file = directory + "/" + file; - + int size = 2*(int)(slice_radius*scale*max_zoom); + this.visible_slice_radius = Math.fmax(slice_radius*scale, this.visible_slice_radius); if (slice->name.down() == "activeslice") { if (type == SliceLayer.Type.ICON) active_slice_layers.add(new SliceLayer.icon(file, size, colorize, visibility)); @@ -502,16 +505,16 @@ public class Theme : GLib.Object { } } } - + ///////////////////////////////////////////////////////////////////// /// Parses a element from the theme.xml file. ///////////////////////////////////////////////////////////////////// - + private void parse_caption(Xml.Node* caption) { for (Xml.Attr* attribute = caption->properties; attribute != null; attribute = attribute->next) { string attr_name = attribute->name.down(); string attr_content = attribute->children->content; - + switch (attr_name) { case "font": caption_font = attr_content; diff --git a/src/utilities/animatedValue.vala b/src/utilities/animatedValue.vala index 7acc7a7..79be155 100644 --- a/src/utilities/animatedValue.vala +++ b/src/utilities/animatedValue.vala @@ -1,23 +1,23 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// -namespace GnomePie { +namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A class which interpolates smoothly between to given values. /// Duration and interpolation mode can be specified. ///////////////////////////////////////////////////////////////////////// @@ -29,77 +29,77 @@ public class AnimatedValue : GLib.Object { ///////////////////////////////////////////////////////////////////// public enum Direction { IN, OUT, IN_OUT, OUT_IN } - + ///////////////////////////////////////////////////////////////////// /// Type of the interpolation, linear or cubic. ///////////////////////////////////////////////////////////////////// - + private enum Type { LINEAR, CUBIC } - + ///////////////////////////////////////////////////////////////////// /// Current value, interpolated. ///////////////////////////////////////////////////////////////////// - + public double val { get; private set; } - + ///////////////////////////////////////////////////////////////////// /// Starting value of the interpolation. ///////////////////////////////////////////////////////////////////// - + public double start { get; private set; default=0.0; } - + ///////////////////////////////////////////////////////////////////// /// Final value of the interpolation. ///////////////////////////////////////////////////////////////////// - - public double end { get; private set; default=0.0; } - + + public double end { get; private set; default=0.0; } + ///////////////////////////////////////////////////////////////////// /// The current state. In range 0 .. 1 ///////////////////////////////////////////////////////////////////// - + private double state = 0.0; - + ///////////////////////////////////////////////////////////////////// - /// Duration of the interpolation. Should be in the same unit as + /// Duration of the interpolation. Should be in the same unit as /// taken for the update() method. ///////////////////////////////////////////////////////////////////// - + private double duration = 0.0; - + ///////////////////////////////////////////////////////////////////// /// The amount of over-shooting of the cubicly interpolated value. ///////////////////////////////////////////////////////////////////// - + private double multiplier = 0.0; - + ///////////////////////////////////////////////////////////////////// /// Type of the interpolation, linear or cubic. ///////////////////////////////////////////////////////////////////// - + private Type type = Type.LINEAR; - + ///////////////////////////////////////////////////////////////////// /// The direction of the interpolation. ///////////////////////////////////////////////////////////////////// - + private Direction direction = Direction.IN; - + ///////////////////////////////////////////////////////////////////// /// Creates a new linearly interpolated value. ///////////////////////////////////////////////////////////////////// - + public AnimatedValue.linear(double start, double end, double duration) { this.val = start; this.start = start; this.end = end; this.duration = duration; } - + ///////////////////////////////////////////////////////////////////// /// Creates a new cubicly interpolated value. ///////////////////////////////////////////////////////////////////// - + public AnimatedValue.cubic(Direction direction, double start, double end, double duration, double multiplier = 0) { this.val = start; this.start = start; @@ -109,17 +109,17 @@ public class AnimatedValue : GLib.Object { this.type = Type.CUBIC; this.multiplier = multiplier; } - + ///////////////////////////////////////////////////////////////////// /// Resets the final value of the interpolation to a new value. The /// current state is taken for the beginning from now. ///////////////////////////////////////////////////////////////////// - + public void reset_target(double end, double duration) { this.end = end; this.duration = duration; this.start = this.val; - + if (duration == 0.0) { this.val = end; this.state = 1.0; @@ -127,16 +127,16 @@ public class AnimatedValue : GLib.Object { this.state = 0.0; } } - + ///////////////////////////////////////////////////////////////////// /// Updates the interpolated value according to it's type. ///////////////////////////////////////////////////////////////////// - + public void update(double time) { this.state += time/this.duration; - + if (this.state < 1) { - + switch (this.type) { case Type.LINEAR: this.val = update_linear(); @@ -158,36 +158,36 @@ public class AnimatedValue : GLib.Object { } break; } - + } else if (this.val != this.end) { this.val = this.end; - } + } } ///////////////////////////////////////////////////////////////////// - /// The following equations are based on Robert Penner's easing - /// equations. See (http://www.robertpenner.com/easing/) and their + /// The following equations are based on Robert Penner's easing + /// equations. See (http://www.robertpenner.com/easing/) and their /// adaption by Zeh Fernando, Nate Chatellier and Arthur Debert for /// the Tweener class. See (http://code.google.com/p/tweener/). ///////////////////////////////////////////////////////////////////// - + private double update_linear(double t = this.state, double s = this.start, double e = this.end) { return (s + t*(e - s)); } - + private double update_ease_in(double t = this.state, double s = this.start, double e = this.end) { return (s + (t*t*((multiplier+1)*t-multiplier))*(e - s)); } - + private double update_ease_out(double t = this.state, double s = this.start, double e = this.end) { return (s + ((t-1) * (t-1) * ((multiplier+1)*(t-1)+multiplier) + 1) * (e - s)); } - + private double update_ease_in_out(double t = this.state, double s = this.start, double e = this.end) { if (this.state < 0.5) return update_ease_in(t*2, s, e - (e-s)*0.5); else return update_ease_out(t*2-1, s + (e-s)*0.5, e); } - + private double update_ease_out_in(double t = this.state, double s = this.start, double e = this.end) { if (this.state < 0.5) return update_ease_out(t*2, s, e - (e-s)*0.5); else return update_ease_in(t*2-1, s + (e-s)*0.5, e); diff --git a/src/utilities/bindingManager.vala b/src/utilities/bindingManager.vala index 0c74ece..e90fa74 100644 --- a/src/utilities/bindingManager.vala +++ b/src/utilities/bindingManager.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { @@ -98,7 +98,7 @@ public class BindingManager : GLib.Object { ///////////////////////////////////////////////////////////////////// public void bind(Trigger trigger, string id) { - if(trigger.key_code != 0) { + if (trigger.key_code != 0) { X.Display display = Gdk.X11.get_default_xdisplay(); X.ID xid = Gdk.X11.get_default_root_xwindow(); @@ -116,10 +116,13 @@ public class BindingManager : GLib.Object { } Gdk.flush(); - Keybinding binding = new Keybinding(trigger, id); bindings.add(binding); display.flush(); + } else { + //no key_code: just add the bindind to the list to save optional trigger parameters + Keybinding binding = new Keybinding(trigger, id); + bindings.add(binding); } } @@ -128,6 +131,17 @@ public class BindingManager : GLib.Object { ///////////////////////////////////////////////////////////////////// public void unbind(string id) { + foreach (var binding in bindings) { + if (id == binding.id) { + if (binding.trigger.key_code == 0) { + //no key_code: just remove the bindind from the list + bindings.remove(binding); + return; + } + break; + } + } + X.Display display = Gdk.X11.get_default_xdisplay(); X.ID xid = Gdk.X11.get_default_root_xwindow(); @@ -205,6 +219,51 @@ public class BindingManager : GLib.Object { return false; } + ///////////////////////////////////////////////////////////////////// + /// Returns whether the pie with the given ID is in warp mode. + ///////////////////////////////////////////////////////////////////// + + public bool get_is_warp(string id) { + foreach (var binding in bindings) { + if (binding.id == id) { + return binding.trigger.warp; + } + } + + return false; + } + + ///////////////////////////////////////////////////////////////////// + /// Returns whether the pie with the given ID is auto shaped + ///////////////////////////////////////////////////////////////////// + + public bool get_is_auto_shape(string id) { + foreach (var binding in bindings) { + if (binding.id == id) { + return (binding.trigger.shape == 0); + } + } + + return false; + } + + ///////////////////////////////////////////////////////////////////// + /// Returns the prefered pie shape number + ///////////////////////////////////////////////////////////////////// + + public int get_shape_number(string id) { + foreach (var binding in bindings) { + if (binding.id == id) { + if (binding.trigger.shape == 0) + break; //return default if auto-shaped + return binding.trigger.shape; //use selected shape + } + } + + return 5; //default= full pie + } + + ///////////////////////////////////////////////////////////////////// /// Returns the name ID of the Pie bound to the given Trigger. /// Returns "" if there is nothing bound to this trigger. @@ -212,8 +271,8 @@ public class BindingManager : GLib.Object { public string get_assigned_id(Trigger trigger) { foreach (var binding in bindings) { - var first = binding.trigger.name.replace("[turbo]", "").replace("[delayed]", ""); - var second = trigger.name.replace("[turbo]", "").replace("[delayed]", ""); + var first = Trigger.remove_optional(binding.trigger.name); + var second = Trigger.remove_optional(trigger.name); if (first == second) { return binding.id; } @@ -276,48 +335,52 @@ public class BindingManager : GLib.Object { ///////////////////////////////////////////////////////////////////// private void activate_delayed(Keybinding? binding , X.Event event) { - // increase event count, so any waiting event will realize that - // something happened in the meantime + // increase event count, so any waiting event will realize that + // something happened in the meantime var current_count = ++this.delayed_count; if (binding == null && this.delayed_event != null) { - // if the trigger is released and an event is currently waiting - // simulate that the trigger has been pressed without any inter- - // ference of Gnome-Pie - X.Display display = Gdk.X11.get_default_xdisplay(); + // if the trigger is released and an event is currently waiting + // simulate that the trigger has been pressed without any inter- + // ference of Gnome-Pie + X.Display display = Gdk.X11.get_default_xdisplay(); - // unbind the trigger, else we'll capture that event again ;) - unbind(delayed_binding.id); + // unbind the trigger, else we'll capture that event again ;) + unbind(delayed_binding.id); - if (this.delayed_binding.trigger.with_mouse) { - // simulate mouse click - X.Test.fake_button_event(display, this.delayed_event.xbutton.button, true, 0); - display.flush(); + if (this.delayed_binding.trigger.with_mouse) { + // simulate mouse click + X.Test.fake_button_event(display, this.delayed_event.xbutton.button, true, 0); + display.flush(); - X.Test.fake_button_event(display, this.delayed_event.xbutton.button, false, 0); - display.flush(); + X.Test.fake_button_event(display, this.delayed_event.xbutton.button, false, 0); + display.flush(); - } else { - // simulate key press - X.Test.fake_key_event(display, this.delayed_event.xkey.keycode, true, 0); - display.flush(); + } else { + // simulate key press + X.Test.fake_key_event(display, this.delayed_event.xkey.keycode, true, 0); + display.flush(); - X.Test.fake_key_event(display, this.delayed_event.xkey.keycode, false, 0); - display.flush(); - } + X.Test.fake_key_event(display, this.delayed_event.xkey.keycode, false, 0); + display.flush(); + } // bind it again bind(delayed_binding.trigger, delayed_binding.id); + + this.delayed_binding = null; + this.delayed_event = null; + } else if (binding != null) { - // if the trigger has been pressed, store it and wait for any interuption - // within the next 300 milliseconds + // if the trigger has been pressed, store it and wait for any interuption + // within the next 300 milliseconds this.delayed_event = event; this.delayed_binding = binding; Timeout.add(300, () => { - // if nothing has been pressed in the meantime + // if nothing has been pressed in the meantime if (current_count == this.delayed_count) { - this.delayed_binding = null; + this.delayed_binding = null; this.delayed_event = null; on_press(binding.id); } diff --git a/src/utilities/color.vala b/src/utilities/color.vala index bf60e3f..6bb9d06 100644 --- a/src/utilities/color.vala +++ b/src/utilities/color.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// using GLib.Math; @@ -258,10 +258,10 @@ public class Color: GLib.Object { private void setHSV(float hue, float saturation, float val) { if(saturation == 0) { - r = val; - g = val; - b = val; - return; + r = val; + g = val; + b = val; + return; } hue = fmodf(hue, 360); hue /= 60; @@ -269,36 +269,36 @@ public class Color: GLib.Object { float f = hue - i; switch(i) { - case 0: - r = val; - g = val * (1.0f - saturation * (1.0f - f)); - b = val * (1.0f - saturation); - break; - case 1: - r = val * (1.0f - saturation * f); - g = val; - b = val * (1.0f - saturation); - break; - case 2: - r = val * (1.0f - saturation); - g = val; - b = val * (1.0f - saturation * (1.0f - f)); - break; - case 3: - r = val * (1.0f - saturation); - g = val * (1.0f - saturation * f); - b = val; - break; - case 4: - r = val * (1.0f - saturation * (1.0f - f)); - g = val * (1.0f - saturation); - b = val; - break; - default: - r = val; - g = val * (1.0f - saturation); - b = val * (1.0f - saturation * f); - break; + case 0: + r = val; + g = val * (1.0f - saturation * (1.0f - f)); + b = val * (1.0f - saturation); + break; + case 1: + r = val * (1.0f - saturation * f); + g = val; + b = val * (1.0f - saturation); + break; + case 2: + r = val * (1.0f - saturation); + g = val; + b = val * (1.0f - saturation * (1.0f - f)); + break; + case 3: + r = val * (1.0f - saturation); + g = val * (1.0f - saturation * f); + b = val; + break; + case 4: + r = val * (1.0f - saturation * (1.0f - f)); + g = val * (1.0f - saturation); + b = val; + break; + default: + r = val; + g = val * (1.0f - saturation); + b = val * (1.0f - saturation * f); + break; } } } diff --git a/src/utilities/config.vala b/src/utilities/config.vala index 2ec2788..abb8b23 100644 --- a/src/utilities/config.vala +++ b/src/utilities/config.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { @@ -54,7 +54,8 @@ public class Config : GLib.Object { public Theme theme { get; set; } public double refresh_rate { get; set; default = 60.0; } public double global_scale { get; set; default = 1.0; } - public int activation_range { get; set; default = 300; } + public int activation_range { get; set; default = 200; } + public int max_visible_slices { get; set; default = 24; } public bool show_indicator { get; set; default = true; } public bool show_captions { get; set; default = true; } public bool auto_start { get; set; default = false; } @@ -73,6 +74,7 @@ public class Config : GLib.Object { writer.write_attribute("refresh_rate", refresh_rate.to_string()); writer.write_attribute("global_scale", global_scale.to_string()); writer.write_attribute("activation_range", activation_range.to_string()); + writer.write_attribute("max_visible_slices", max_visible_slices.to_string()); writer.write_attribute("show_indicator", show_indicator ? "true" : "false"); writer.write_attribute("show_captions", show_captions ? "true" : "false"); writer.write_attribute("showed_news", showed_news.to_string()); @@ -117,7 +119,11 @@ public class Config : GLib.Object { break; case "activation_range": activation_range = int.parse(attr_content); - activation_range.clamp(100, 2000); + activation_range.clamp(0, 2000); + break; + case "max_visible_slices": + max_visible_slices = int.parse(attr_content); + max_visible_slices.clamp(10, 2000); break; case "show_indicator": show_indicator = bool.parse(attr_content); @@ -166,10 +172,10 @@ public class Config : GLib.Object { // load global themes var d = Dir.open(Paths.global_themes); while ((name = d.read_name()) != null) { - var theme = new Theme(Paths.global_themes + "/" + name); + var theme = new Theme(Paths.global_themes + "/" + name); - if (theme.load()) - themes.add(theme); + if (theme.load()) + themes.add(theme); } // load local themes diff --git a/src/utilities/focusGrabber.vala b/src/utilities/focusGrabber.vala index b551def..baa5fed 100644 --- a/src/utilities/focusGrabber.vala +++ b/src/utilities/focusGrabber.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { diff --git a/src/utilities/key.vala b/src/utilities/key.vala index af6e86a..7cf425f 100644 --- a/src/utilities/key.vala +++ b/src/utilities/key.vala @@ -1,24 +1,24 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// -/// A class which represents a key stroke. It can be used to "press" +///////////////////////////////////////////////////////////////////////// +/// A class which represents a key stroke. It can be used to "press" /// the associated keys. ///////////////////////////////////////////////////////////////////////// @@ -26,7 +26,7 @@ public class Key : GLib.Object { ///////////////////////////////////////////////////////////////////// /// Some static members, which are often used by this class. - ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// private static X.Display display; @@ -40,62 +40,62 @@ public class Key : GLib.Object { ///////////////////////////////////////////////////////////////////// public string label { get; private set; } - + ///////////////////////////////////////////////////////////////////// /// The accelerator of the Key. ///////////////////////////////////////////////////////////////////// - + public string accelerator { get; private set; } - + ///////////////////////////////////////////////////////////////////// /// Keycode and modifiers of this stroke. ///////////////////////////////////////////////////////////////////// - + private int key_code; private Gdk.ModifierType modifiers; - + ///////////////////////////////////////////////////////////////////// /// C'tor, initializes all members to defaults. ///////////////////////////////////////////////////////////////////// - + public Key() { this.accelerator = ""; this.modifiers = 0; this.key_code = 0; this.label = _("Not bound"); } - + ///////////////////////////////////////////////////////////////////// /// C'tor, initializes all members. ///////////////////////////////////////////////////////////////////// - + public Key.from_string(string stroke) { this.accelerator = stroke; - + uint keysym; Gtk.accelerator_parse(stroke, out keysym, out this.modifiers); this.key_code = display.keysym_to_keycode(keysym); this.label = Gtk.accelerator_get_label(keysym, this.modifiers); } - + ///////////////////////////////////////////////////////////////////// /// C'tor, initializes all members. ///////////////////////////////////////////////////////////////////// - + public Key.from_values(uint keysym, Gdk.ModifierType modifiers) { this.accelerator = Gtk.accelerator_name(keysym, modifiers); this.label = Gtk.accelerator_get_label(keysym, modifiers); this.key_code = display.keysym_to_keycode(keysym); this.modifiers = modifiers; } - + ///////////////////////////////////////////////////////////////////// /// Initializes static members. ///////////////////////////////////////////////////////////////////// - + static construct { display = new X.Display(); - + shift_code = display.keysym_to_keycode(Gdk.keyval_from_name("Shift_L")); ctrl_code = display.keysym_to_keycode(Gdk.keyval_from_name("Control_L")); alt_code = display.keysym_to_keycode(Gdk.keyval_from_name("Alt_L")); @@ -113,7 +113,7 @@ public class Key : GLib.Object { // release them and press the desired ones press_modifiers(current_modifiers, false); press_modifiers(this.modifiers, true); - + // send events to X display.flush(); @@ -128,28 +128,28 @@ public class Key : GLib.Object { // send events to X display.flush(); } - + ///////////////////////////////////////////////////////////////////// /// Helper method returning currently hold down modifier keys. ///////////////////////////////////////////////////////////////////// - + private Gdk.ModifierType get_modifiers() { Gdk.ModifierType modifiers; Gtk.get_current_event_state(out modifiers); return modifiers; } - + ///////////////////////////////////////////////////////////////////// /// Helper method which 'presses' the desired modifier keys. ///////////////////////////////////////////////////////////////////// - + private void press_modifiers(Gdk.ModifierType modifiers, bool down) { if ((modifiers & Gdk.ModifierType.CONTROL_MASK) > 0) X.Test.fake_key_event(display, ctrl_code, down, 0); if ((modifiers & Gdk.ModifierType.SHIFT_MASK) > 0) X.Test.fake_key_event(display, shift_code, down, 0); - + if ((modifiers & Gdk.ModifierType.MOD1_MASK) > 0) X.Test.fake_key_event(display, alt_code, down, 0); diff --git a/src/utilities/logger.vala b/src/utilities/logger.vala index 69310fc..7c66615 100644 --- a/src/utilities/logger.vala +++ b/src/utilities/logger.vala @@ -1,26 +1,26 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// A static class which beautifies the messages of the default logger. -/// Some of this code is inspired by plank's written by Robert Dyer. -/// Thanks a lot for this project! +/// Some of this code is inspired by plank's written by Robert Dyer. +/// Thanks a lot for this project! ///////////////////////////////////////////////////////////////////////// public class Logger { @@ -28,53 +28,53 @@ public class Logger { ///////////////////////////////////////////////////////////////////// /// If these are set to false, the according messages are not shown ///////////////////////////////////////////////////////////////////// - - private static const bool display_debug = true; - private static const bool display_warning = true; - private static const bool display_error = true; - private static const bool display_message = true; - + + private static const bool display_debug = true; + private static const bool display_warning = true; + private static const bool display_error = true; + private static const bool display_message = true; + ///////////////////////////////////////////////////////////////////// /// If these are set to false, the according messages are not logged ///////////////////////////////////////////////////////////////////// - - private static const bool log_debug = false; - private static const bool log_warning = true; - private static const bool log_error = true; - private static const bool log_message = true; - + + private static const bool log_debug = false; + private static const bool log_warning = true; + private static const bool log_error = true; + private static const bool log_message = true; + ///////////////////////////////////////////////////////////////////// /// If true, a time stamp is shown in each message. ///////////////////////////////////////////////////////////////////// - - private static const bool display_time = false; - private static const bool log_time = true; - + + private static const bool display_time = false; + private static const bool log_time = true; + ///////////////////////////////////////////////////////////////////// /// If true, the origin of the message is shown. In form file:line ///////////////////////////////////////////////////////////////////// - - private static const bool display_file = false; - private static const bool log_file = false; - + + private static const bool display_file = false; + private static const bool log_file = false; + ///////////////////////////////////////////////////////////////////// /// A regex, used to format the standard message. ///////////////////////////////////////////////////////////////////// - + private static Regex regex = null; - + ///////////////////////////////////////////////////////////////////// /// Limit log and statistics size to roughly 1 MB. ///////////////////////////////////////////////////////////////////// - + private static const int max_log_length = 1000000; - + private static int log_length; - + ///////////////////////////////////////////////////////////////////// /// Possible terminal colors. ///////////////////////////////////////////////////////////////////// - + private enum Color { BLACK, RED, @@ -85,186 +85,186 @@ public class Logger { TURQUOISE, WHITE } - + ///////////////////////////////////////////////////////////////////// /// Creates the regex and binds the handler. ///////////////////////////////////////////////////////////////////// - + public static void init() { log_length = -1; - + try { - regex = new Regex("""(.*)\.vala(:\d+): (.*)"""); - } catch {} - + regex = new Regex("""(.*)\.vala(:\d+): (.*)"""); + } catch {} + GLib.Log.set_handler(null, GLib.LogLevelFlags.LEVEL_MASK, log_func); } - + ///////////////////////////////////////////////////////////////////// /// Appends a line to the log file ///////////////////////////////////////////////////////////////////// - + private static void write_log_line(string line) { var log = GLib.FileStream.open(Paths.log, "a"); - + if (log != null) { - if (log_length == -1) + if (log_length == -1) log_length = (int)log.tell(); - + log.puts(line); log_length += line.length; } - + if (log_length > max_log_length) { string content = ""; - + try { GLib.FileUtils.get_contents(Paths.log, out content); - int split_index = content.index_of_char('\n', log_length - (int)(max_log_length*0.9)); + int split_index = content.index_of_char('\n', log_length - (int)(max_log_length*0.9)); GLib.FileUtils.set_contents(Paths.log, content.substring(split_index+1)); - + log_length -= (split_index+1); } catch (GLib.FileError e) {} } } - + ///////////////////////////////////////////////////////////////////// /// Displays a message. ///////////////////////////////////////////////////////////////////// - + private static void message(string message, string message_log) { if (display_message) { stdout.printf(set_color(Color.GREEN, false) + "[" + (display_time ? get_time() + " " : "") + "MESSAGE]" + message); } - + if (log_message) { write_log_line("[" + (log_time ? get_time() + " " : "") + "MESSAGE]" + message_log); } } - + ///////////////////////////////////////////////////////////////////// /// Displays a Debug message. ///////////////////////////////////////////////////////////////////// - + private static void debug(string message, string message_log) { if (display_debug) { stdout.printf(set_color(Color.BLUE, false) + "[" + (display_time ? get_time() + " " : "") + " DEBUG ]" + message); } - + if (log_debug) { write_log_line("[" + (log_time ? get_time() + " " : "") + " DEBUG ]" + message_log); } } - + ///////////////////////////////////////////////////////////////////// /// Displays a Warning message. ///////////////////////////////////////////////////////////////////// - + private static void warning(string message, string message_log) { if (display_warning) { stdout.printf(set_color(Color.YELLOW, false) + "[" + (display_time ? get_time() + " " : "") + "WARNING]" + message); } - + if (log_warning) { write_log_line("[" + (log_time ? get_time() + " " : "") + "WARNING]" + message_log); } } - + ///////////////////////////////////////////////////////////////////// /// Displays a Error message. ///////////////////////////////////////////////////////////////////// - + private static void error(string message, string message_log) { if (display_error) { stdout.printf(set_color(Color.RED, false) + "[" + (display_time ? get_time() + " " : "") + " ERROR ]" + message); } - + if (log_error) { write_log_line("[" + (log_time ? get_time() + " " : "") + " ERROR ]" + message_log); } } - + ///////////////////////////////////////////////////////////////////// /// Helper method which resets the terminal color. ///////////////////////////////////////////////////////////////////// - + private static string reset_color() { - return "\x001b[0m"; - } - - ///////////////////////////////////////////////////////////////////// - /// Helper method which sets the terminal color. - ///////////////////////////////////////////////////////////////////// - - private static string set_color(Color color, bool bold) { - if (bold) return "\x001b[1;%dm".printf((int)color + 30); - else return "\x001b[0;%dm".printf((int)color + 30); - } - - ///////////////////////////////////////////////////////////////////// - /// Returns the current time in hh:mm:ss:mmmmmm - ///////////////////////////////////////////////////////////////////// - - private static string get_time() { + return "\x001b[0m"; + } + + ///////////////////////////////////////////////////////////////////// + /// Helper method which sets the terminal color. + ///////////////////////////////////////////////////////////////////// + + private static string set_color(Color color, bool bold) { + if (bold) return "\x001b[1;%dm".printf((int)color + 30); + else return "\x001b[0;%dm".printf((int)color + 30); + } + + ///////////////////////////////////////////////////////////////////// + /// Returns the current time in hh:mm:ss:mmmmmm + ///////////////////////////////////////////////////////////////////// + + private static string get_time() { var now = new DateTime.now_local(); - return "%.4d:%.2d:%.2d:%.2d:%.2d:%.2d:%.6d".printf(now.get_year(), now.get_month(), now.get_day_of_month(), now.get_hour(), now.get_minute(), now.get_second(), now.get_microsecond()); - } - - ///////////////////////////////////////////////////////////////////// + return "%.4d:%.2d:%.2d:%.2d:%.2d:%.2d:%.6d".printf(now.get_year(), now.get_month(), now.get_day_of_month(), now.get_hour(), now.get_minute(), now.get_second(), now.get_microsecond()); + } + + ///////////////////////////////////////////////////////////////////// /// Helper method to format the message. ///////////////////////////////////////////////////////////////////// - - private static string create_message(string message) { - if (display_file && regex != null && regex.match(message)) { - var parts = regex.split(message); - return " [%s%s]%s %s\n".printf(parts[1], parts[2], reset_color(), parts[3]); - } else if (regex != null && regex.match(message)) { - var parts = regex.split(message); - return "%s %s\n".printf(reset_color(), parts[3]); - } else { - return reset_color() + " " + message + "\n"; - } - } - - ///////////////////////////////////////////////////////////////////// + + private static string create_message(string message) { + if (display_file && regex != null && regex.match(message)) { + var parts = regex.split(message); + return " [%s%s]%s %s\n".printf(parts[1], parts[2], reset_color(), parts[3]); + } else if (regex != null && regex.match(message)) { + var parts = regex.split(message); + return "%s %s\n".printf(reset_color(), parts[3]); + } else { + return reset_color() + " " + message + "\n"; + } + } + + ///////////////////////////////////////////////////////////////////// /// Helper method to format the message for logging. ///////////////////////////////////////////////////////////////////// - - private static string create_log_message(string message) { - if (log_file && regex != null && regex.match(message)) { - var parts = regex.split(message); - return " [%s%s] %s\n".printf(parts[1], parts[2], parts[3]); - } else if (regex != null && regex.match(message)) { - var parts = regex.split(message); - return " %s\n".printf(parts[3]); - } else { - return " " + message + "\n"; - } - } - - ///////////////////////////////////////////////////////////////////// - /// The handler function. - ///////////////////////////////////////////////////////////////////// - - private static void log_func(string? d, LogLevelFlags flags, string text) { - switch (flags) { - case LogLevelFlags.LEVEL_ERROR: - case LogLevelFlags.LEVEL_CRITICAL: - error(create_message(text), create_log_message(text)); - break; - case LogLevelFlags.LEVEL_INFO: - case LogLevelFlags.LEVEL_MESSAGE: - message(create_message(text), create_log_message(text)); - break; - case LogLevelFlags.LEVEL_DEBUG: - debug(create_message(text), create_log_message(text)); - break; - case LogLevelFlags.LEVEL_WARNING: - default: - warning(create_message(text), create_log_message(text)); - break; - } - } + + private static string create_log_message(string message) { + if (log_file && regex != null && regex.match(message)) { + var parts = regex.split(message); + return " [%s%s] %s\n".printf(parts[1], parts[2], parts[3]); + } else if (regex != null && regex.match(message)) { + var parts = regex.split(message); + return " %s\n".printf(parts[3]); + } else { + return " " + message + "\n"; + } + } + + ///////////////////////////////////////////////////////////////////// + /// The handler function. + ///////////////////////////////////////////////////////////////////// + + private static void log_func(string? d, LogLevelFlags flags, string text) { + switch (flags) { + case LogLevelFlags.LEVEL_ERROR: + case LogLevelFlags.LEVEL_CRITICAL: + error(create_message(text), create_log_message(text)); + break; + case LogLevelFlags.LEVEL_INFO: + case LogLevelFlags.LEVEL_MESSAGE: + message(create_message(text), create_log_message(text)); + break; + case LogLevelFlags.LEVEL_DEBUG: + debug(create_message(text), create_log_message(text)); + break; + case LogLevelFlags.LEVEL_WARNING: + default: + warning(create_message(text), create_log_message(text)); + break; + } + } } } diff --git a/src/utilities/paths.vala b/src/utilities/paths.vala index 5b39c45..61111e3 100644 --- a/src/utilities/paths.vala +++ b/src/utilities/paths.vala @@ -1,19 +1,19 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { diff --git a/src/utilities/trigger.vala b/src/utilities/trigger.vala index 854cbb4..fbd74f8 100644 --- a/src/utilities/trigger.vala +++ b/src/utilities/trigger.vala @@ -1,23 +1,23 @@ -/* -Copyright (c) 2011 by Simon Schneegans - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// namespace GnomePie { -///////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////// /// This class represents a hotkey, used to open pies. It supports any /// combination of modifier keys with keyboard and mouse buttons. ///////////////////////////////////////////////////////////////////////// @@ -29,185 +29,253 @@ public class Trigger : GLib.Object { ///////////////////////////////////////////////////////////////////// public string label { get; private set; default=""; } - + ///////////////////////////////////////////////////////////////////// /// Returns a human-readable version of this Trigger. Small /// identifiers for turbo mode and delayed mode are added. ///////////////////////////////////////////////////////////////////// public string label_with_specials { get; private set; default=""; } - + ///////////////////////////////////////////////////////////////////// /// The Trigger string. Like [delayed]button3 ///////////////////////////////////////////////////////////////////// - + public string name { get; private set; default=""; } - + ///////////////////////////////////////////////////////////////////// /// The key code of the hotkey or the button number of the mouse. ///////////////////////////////////////////////////////////////////// - + public int key_code { get; private set; default=0; } - + ///////////////////////////////////////////////////////////////////// /// The keysym of the hotkey or the button number of the mouse. ///////////////////////////////////////////////////////////////////// - + public uint key_sym { get; private set; default=0; } - + ///////////////////////////////////////////////////////////////////// /// Modifier keys pressed for this hotkey. ///////////////////////////////////////////////////////////////////// - + public Gdk.ModifierType modifiers { get; private set; default=0; } - + ///////////////////////////////////////////////////////////////////// /// True if this hotkey involves the mouse. ///////////////////////////////////////////////////////////////////// - + public bool with_mouse { get; private set; default=false; } - + ///////////////////////////////////////////////////////////////////// /// True if the pie closes when the trigger hotkey is released. ///////////////////////////////////////////////////////////////////// - + public bool turbo { get; private set; default=false; } - + ///////////////////////////////////////////////////////////////////// /// True if the trigger should wait a short delay before being /// triggered. ///////////////////////////////////////////////////////////////////// - + public bool delayed { get; private set; default=false; } - + ///////////////////////////////////////////////////////////////////// /// True if the pie opens in the middle of the screen. ///////////////////////////////////////////////////////////////////// - + public bool centered { get; private set; default=false; } - + + ///////////////////////////////////////////////////////////////////// + /// True if the mouse pointer is warped to the pie's center. + ///////////////////////////////////////////////////////////////////// + + public bool warp { get; private set; default=false; } + + ///////////////////////////////////////////////////////////////////// + /// Returns the current selected "radio-button" shape: 0= automatic + /// 5= full pie; 1,3,7,8= quarters; 2,4,6,8=halves + /// 1 | 4 | 7 + /// 2 | 5 | 8 + /// 3 | 6 | 9 + ///////////////////////////////////////////////////////////////////// + + public int shape { get; private set; default=5; } + ///////////////////////////////////////////////////////////////////// /// C'tor, creates a new, "unbound" Trigger. ///////////////////////////////////////////////////////////////////// - + public Trigger() { this.set_unbound(); } - + ///////////////////////////////////////////////////////////////////// /// C'tor, creates a new Trigger from a given Trigger string. This is /// in this format: "[option(s)]button" where /// "" is something like "" or "", "button" /// something like "s", "F4" or "button0" and "[option]" is either - /// "[turbo]", "[centered]" or "["delayed"]". + /// "[turbo]", "[centered]", "[warp]", "["delayed"]" or "["shape#"]" ///////////////////////////////////////////////////////////////////// - + public Trigger.from_string(string trigger) { this.parse_string(trigger); } - + ///////////////////////////////////////////////////////////////////// /// C'tor, creates a new Trigger from the key values. ///////////////////////////////////////////////////////////////////// - - public Trigger.from_values(uint key_sym, Gdk.ModifierType modifiers, + + public Trigger.from_values(uint key_sym, Gdk.ModifierType modifiers, bool with_mouse, bool turbo, bool delayed, - bool centered ) { - + bool centered, bool warp, int shape ) { + string trigger = (turbo ? "[turbo]" : "") + (delayed ? "[delayed]" : "") - + (centered ? "[centered]" : ""); - + + (centered ? "[centered]" : "") + + (warp ? "[warp]" : "") + + (shape!=5 ? "[shape%d]".printf(shape) : ""); + if (with_mouse) { trigger += Gtk.accelerator_name(0, modifiers) + "button%u".printf(key_sym); } else { trigger += Gtk.accelerator_name(key_sym, modifiers); } - + this.parse_string(trigger); } - + ///////////////////////////////////////////////////////////////////// /// Parses a Trigger string. This is /// in this format: "[option(s)]button" where /// "" is something like "" or "", "button" /// something like "s", "F4" or "button0" and "[option]" is either - /// "[turbo]", "[centered]" or "["delayed"]". + /// "[turbo]", "[centered]", "[warp]", "["delayed"]" or "["shape#"]" ///////////////////////////////////////////////////////////////////// - + public void parse_string(string trigger) { if (this.is_valid(trigger)) { // copy string string check_string = trigger; - + this.name = check_string; - + this.turbo = check_string.contains("[turbo]"); this.delayed = check_string.contains("[delayed]"); this.centered = check_string.contains("[centered]"); - + this.warp = check_string.contains("[warp]"); + + this.shape= parse_shape( check_string ); + // remove optional arguments - check_string = check_string.replace("[turbo]", ""); - check_string = check_string.replace("[delayed]", ""); - check_string = check_string.replace("[centered]", ""); - + check_string = remove_optional(check_string); + int button = this.get_mouse_button(check_string); if (button > 0) { this.with_mouse = true; this.key_code = button; this.key_sym = button; - + Gtk.accelerator_parse(check_string, null, out this._modifiers); this.label = Gtk.accelerator_get_label(0, this.modifiers); - + string button_text = _("Button %i").printf(this.key_code); - + if (this.key_code == 1) button_text = _("LeftButton"); else if (this.key_code == 3) button_text = _("RightButton"); else if (this.key_code == 2) button_text = _("MiddleButton"); - + this.label += button_text; } else { - this.with_mouse = false; - - var display = new X.Display(); - - uint keysym = 0; - Gtk.accelerator_parse(check_string, out keysym, out this._modifiers); - this.key_code = display.keysym_to_keycode(keysym); - this.key_sym = keysym; - this.label = Gtk.accelerator_get_label(keysym, this.modifiers); + //empty triggers are ok now, they carry open options as well + if (check_string == "") { + this.label = _("Not bound"); + this.key_code = 0; + this.key_sym = 0; + this.modifiers = 0; + } else { + this.with_mouse = false; + + var display = new X.Display(); + + uint keysym = 0; + Gtk.accelerator_parse(check_string, out keysym, out this._modifiers); + this.key_code = display.keysym_to_keycode(keysym); + this.key_sym = keysym; + this.label = Gtk.accelerator_get_label(keysym, this.modifiers); + } } - + this.label_with_specials = GLib.Markup.escape_text(this.label); - - if (this.turbo && this.delayed && this.centered) - this.label_with_specials += (" [ " + _("Turbo") + " | " + _("Delayed") + " | " + _("Centered") + " ]"); - else if (this.turbo && this.centered) - this.label_with_specials += (" [ " + _("Turbo") + " | " + _("Centered") + " ]"); - else if (this.turbo && this.delayed) - this.label_with_specials += (" [ " + _("Turbo") + " | " + _("Delayed") + " ]"); - else if (this.centered && this.delayed) - this.label_with_specials += (" [ " + _("Delayed") + " | " + _("Centered") + " ]"); - else if (this.turbo) - this.label_with_specials += (" [ " + _("Turbo") + " ]"); - else if (this.delayed) - this.label_with_specials += (" [ " + _("Delayed") + " ]"); - else if (this.centered) - this.label_with_specials += (" [ " + _("Centered") + " ]"); - + + string msg= ""; + if (this.turbo) { + msg= _("Turbo"); + } + if (this.delayed) { + if (msg == "") + msg= _("Delayed"); + else + msg += " | " + _("Delayed"); + } + if (this.centered) { + if (msg == "") + msg= _("Centered"); + else + msg += " | " + _("Centered"); + } + if (this.warp) { + if (msg == "") + msg= _("Warp"); + else + msg += " | " + _("Warp"); + } + if (this.shape == 0) { + if (msg == "") + msg= _("Auto-shaped"); + else + msg += " | " + _("Auto-shaped"); + } else if (this.shape == 1 || this.shape ==3 || this.shape == 7 || this.shape == 9) { + if (msg == "") + msg= _("Quarter pie"); + else + msg += " | " + _("Quarter pie"); + + } else if (this.shape == 2 || this.shape == 4 || this.shape == 6 || this.shape == 8) { + if (msg == "") + msg= _("Half pie"); + else + msg += " | " + _("Half pie"); + } + if (msg != "") + this.label_with_specials += (" [ " + msg + " ]"); + } else { this.set_unbound(); } } - + + ///////////////////////////////////////////////////////////////////// + /// Extract shape number from trigger string + /// "[0]".."[9]" 0:auto 5:full pie (default) + /// 1,3,7,9=quarters 2,4,6,8= halves + ///////////////////////////////////////////////////////////////////// + + private int parse_shape(string trigger) { + int rs; + for( rs= 0; rs < 10; rs++ ) + if (trigger.contains("[shape%d]".printf(rs) )) + return rs; + return 5; //default= full pie + } + ///////////////////////////////////////////////////////////////////// /// Resets all member variables to their defaults. ///////////////////////////////////////////////////////////////////// - + private void set_unbound() { this.label = _("Not bound"); this.label_with_specials = _("Not bound"); @@ -217,53 +285,71 @@ public class Trigger : GLib.Object { this.modifiers = 0; this.turbo = false; this.delayed = false; + this.centered = false; + this.warp = false; + this.shape = 5; //full pie this.with_mouse = false; } - + + ///////////////////////////////////////////////////////////////////// + /// Remove optional arguments from the given string + /// "[turbo]", "[delayed]", "[warp]" "[centered]" and "[shape#]" + ///////////////////////////////////////////////////////////////////// + + public static string remove_optional(string trigger) { + string trg= trigger; + trg = trg.replace("[turbo]", ""); + trg = trg.replace("[delayed]", ""); + trg = trg.replace("[centered]", ""); + trg = trg.replace("[warp]", ""); + for (int rs= 0; rs < 10; rs++) + trg = trg.replace("[shape%d]".printf(rs), ""); + return trg; + } + ///////////////////////////////////////////////////////////////////// /// Returns true, if the trigger string is in a valid format. ///////////////////////////////////////////////////////////////////// - + private bool is_valid(string trigger) { - // copy string - string check_string = trigger; - // remove optional arguments - check_string = check_string.replace("[turbo]", ""); - check_string = check_string.replace("[delayed]", ""); - check_string = check_string.replace("[centered]", ""); - + string check_string = remove_optional(trigger); + if (this.get_mouse_button(check_string) > 0) { // it seems to be a valid mouse-trigger so replace button part, // with something accepted by gtk, and check it with gtk int button_index = check_string.index_of("button"); check_string = check_string.slice(0, button_index) + "a"; - } - + } + + //empty triggers are ok now, they carry open options as well + if (check_string == "") + return true; + // now it shouls be a normal gtk accelerator uint keysym = 0; Gdk.ModifierType modifiers = 0; Gtk.accelerator_parse(check_string, out keysym, out modifiers); if (keysym == 0) return false; - - return true; + + return true; } - + ///////////////////////////////////////////////////////////////////// - /// Returns the mouse button number of the given trigger string. + /// Returns the mouse button number of the given trigger string. /// Returns -1 if it is not a mouse trigger. ///////////////////////////////////////////////////////////////////// - + private int get_mouse_button(string trigger) { if (trigger.contains("button")) { // it seems to be a mouse-trigger so check the button part. int button_index = trigger.index_of("button"); - int number = int.parse(trigger.slice(button_index + 6, trigger.length)); - if (number > 0) + int number = int.parse(trigger.slice(button_index + 6, trigger.length)); + if (number > 0) return number; } - + return -1; } } diff --git a/update_copy_notice.sh b/update_copy_notice.sh new file mode 100755 index 0000000..6325e37 --- /dev/null +++ b/update_copy_notice.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +shopt -s globstar + +text="///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +/////////////////////////////////////////////////////////////////////////" + +types=( + ".vala" +) + +folders=( + "src" +) + +for folder in "${folders[@]}" +do + for type in "${types[@]}" + do + for file in ${folder}/**/*${type} + do + if [ -f $file ] + then + if grep -q "Simon Schneegans" ${file} + then + echo "Reformatting ${file} ..." + sed -e '1,16d' ${file} > /tmp/copyright_tmp && mv /tmp/copyright_tmp ${file} + echo "${text}" > /tmp/copyright_tmp + cat ${file} >> /tmp/copyright_tmp && mv /tmp/copyright_tmp ${file} + fi + fi + done + done +done + + + -- cgit v1.2.3