Use public vars for toolbox delete strings so that they can be translated
[potlatch2.git] / net / systemeD / potlatch2 / Toolbox.mxml
index 5b90b3b..14c7a12 100644 (file)
 
         <mx:HBox width="28" height="28" y="4" x="36" borderStyle="solid" cornerRadius="4" click="reverseClicked();" horizontalAlign="center" verticalAlign="middle">
             <mx:ViewStack id="rotateButtonStack">
-                <!-- I can totally recommend adding borderStyle="solid" to arrowBox when debugging -->
-                <mx:HBox id="arrowBox" horizontalAlign="center" verticalAlign="middle" width="24" height="24">
-                    <mx:Image id="arrow" source="@Embed('../../../embedded/arrow.svg')"
-                        alpha="{getAlpha('reverseDirection')}"
-                        toolTip="Reverse direction (V)"
-                        width="22" height="22"/>
+                <mx:HBox id="arrowBoxWrapper"><!-- changing the viewstack back onto a rotated hbox causes positioning glitches, hence this wrapper -->
+                    <!-- I can totally recommend adding borderStyle="solid" to arrowBox when debugging -->
+                    <mx:HBox id="arrowBox" horizontalAlign="center" verticalAlign="middle" width="24" height="24">
+                        <mx:Image id="arrow" source="@Embed('../../../embedded/arrow.svg')"
+                            alpha="{getAlpha('reverseDirection')}"
+                            toolTip="Reverse direction (V)"
+                            width="22" height="22"/>
+                    </mx:HBox>
                 </mx:HBox>
                 <mx:HBox id="clockwiseBox" horizontalAlign="center" verticalAlign="middle">
                     <mx:Image id="clockwise" source="@Embed('../../../embedded/clockwise.svg')"
         [Bindable]
         public var angle:int=0;
 
+        public var deleteNode:String = "Delete Node (Delete)";
+        public var deleteArea:String = "Delete Area (Shift+Delete)";
+        public var deleteWay:String = "Delete Way (Shift+Delete)";
+        public var deleteItem:String = "Delete Item"; // When nothing is selected
+
                public function init(controller:EditController):void {
                        this.controller=controller;
                        /* check if the toolbox was explictly turned off in a previous session */
                [Bindable(event="updateSkin")]
                private function deleteToolTipText():String {
                        var entity:Entity=controller.state.firstSelected;
-                       if (entity is Node) { return "Delete Node (Delete)"; }
-                       if (entity is Way && Way(entity).isArea()) { return "Delete Area (Shift+Delete)"; }
-                       if (entity is Way) { return "Delete Way (Shift+Delete)"; }
-                       return "Delete Item"; // When nothing is selected
+                       if (entity is Node) { return deleteNode; }
+                       if (entity is Way && Way(entity).isArea()) { return deleteArea; }
+                       if (entity is Way) { return deleteWay; }
+                       return deleteItem; // When nothing is selected
                }
 
         private function updateDirectionArrow():void {
                 var w:Way = Way(controller.state.firstSelected);
                 if (w) { // not entirely sure why this protection is necessary, but it appears so
                     if (w.isArea()) {
-                        trace("clockwise?: "+w.clockwise);
-                        w.clockwise? rotateButtonStack.selectedChild = clockwiseBox : rotateButtonStack.selectedChild = antiClockwiseBox;
+                        // so Way.clockwise appears to give wrong results. Patches welcome, I guess, but for now...
+                        w.clockwise? rotateButtonStack.selectedChild = antiClockwiseBox : rotateButtonStack.selectedChild = clockwiseBox;
                     } else {
-                        rotateButtonStack.selectedChild = arrowBox;
+                        rotateButtonStack.selectedChild = arrowBoxWrapper;
                         // reset and reposition back to the starting point relative to its parent
                         rotate.end();
                         angle = 0;
                         arrowBox.y = 0;
 
                         // move
-                        trace("angle: " + w.angle);
                         rotate.end();
                         angle = w.angle;
                         rotate.play();