]> O.S.I.I.S - jp/crow.git/commitdiff
undo/redo, hscrollbar
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 9 Mar 2018 22:11:41 +0000 (23:11 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 9 Mar 2018 22:11:41 +0000 (23:11 +0100)
Crow.csproj
Default.style
Templates/HScrollBar.template [new file with mode: 0755]
src/GraphicObjects/FileDialog.cs
src/GraphicObjects/Slider.cs
src/Interface.cs

index 9e474f586f9110b61f3af9d36ca5b8b04a5769ab..f14b185af0869dc9e9ed68a328aa92291f6a2bbb 100644 (file)
     <EmbeddedResource Include="Templates\DockWindow.template">
       <LogicalName>Crow.DockWindow.template</LogicalName>
     </EmbeddedResource>
+    <EmbeddedResource Include="Templates\HScrollBar.template">
+      <LogicalName>Crow.HScrollBar.template</LogicalName>
+    </EmbeddedResource>
   </ItemGroup>
   <ItemGroup>
     <None Include="Crow.dll.config">
index 5cb1aad68a0c766fdbe70379740736e5130d7cdd..0c9fe38f17279cc5c9118b8e76750afb26ab3335 100644 (file)
@@ -148,6 +148,11 @@ ScrollBar {
        Maximum = "0";
        Value = "0";
 }
+HScrollBar {
+       Template = "#Crow.HScrollBar.template";
+       Maximum = "0";
+       Value = "0";
+}
 Scroller {
        CacheEnabled = "false";
 }
@@ -193,4 +198,16 @@ ArrowBut {
        MouseUp="{Background=hgradient|0:Gray|1:Jet}";
        MouseEnter="{Foreground=Black}";
        MouseLeave="{Foreground=Jet}";
+}
+HArrowBut {
+       MouseRepeat="true";
+       Height="Fit";
+       Width="Fit";
+       Focusable="true";
+       Foreground="Jet";
+       Background="vgradient|0:Gray|1:Jet";
+       MouseDown="{Background=vgradient|0:White|0.4:BlueCrayola|1:Jet}";
+       MouseUp="{Background=vgradient|0:Gray|1:Jet}";
+       MouseEnter="{Foreground=Black}";
+       MouseLeave="{Foreground=Jet}";
 }
\ No newline at end of file
diff --git a/Templates/HScrollBar.template b/Templates/HScrollBar.template
new file mode 100755 (executable)
index 0000000..57f575c
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<Border BorderWidth="1" Foreground="Jet">
+       <GenericStack Orientation="{./Orientation}" Spacing="0">
+               <Shape Style="HArrowBut"        MouseDown="./onScrollBack" Path="M 0.5,5.5 L 10.5,0.5 L 10.5,10.5 Z"/>
+               <Slider Name="Slider"                   
+                       Orientation="{./Orientation}"
+                       Value="{²./Value}"
+                       Maximum="{./Maximum}"
+                       CursorSize="{./CursorSize}"
+                       Height="{./HeightPolicy}" Width="{./WidthPolicy}"
+                       LargeIncrement="{./LargeIncrement}"
+                       SmallIncrement="{./SmallIncrement}"
+                       CursorColor="vgradient|0:Gray|1:Jet"
+                       Foreground="Jet"
+                       Background="vgradient|0:DimGray|0.1:Gray|0.95:Gray|1:White"/>
+               <Shape Style="HArrowBut" MouseDown="./onScrollForth" Path="M 0.5,0.5 L 10.5,5.5 L 0.5,10.5 Z"/>
+       </GenericStack>
+</Border>
\ No newline at end of file
index 8f1a0830e675afd5b2e62315a7fa40505eb0fcfb..8069b8a7607acee43dd26591858f9a513dfdb9dc 100644 (file)
@@ -149,6 +149,7 @@ namespace Crow
                void onCancel(object sender, MouseButtonEventArgs e){
                        IFace.DeleteWidget (this);
                }
+
        }
 }
 
index 2e4a5fef73fcc0a2a2ec25c3ebc23faf543a30d2..59eb99ece0b24ae2bd7729c9d0eddf28529768e9 100644 (file)
@@ -68,7 +68,7 @@ namespace Crow
                protected double unity;
 
                #region Public properties
-               [XmlAttributeAttribute()][DefaultValue("vgradient|0:White|0,1:LightGray|0,9:LightGray|1:DimGray")]
+               [DefaultValue("vgradient|0:White|0,1:LightGray|0,9:LightGray|1:DimGray")]
                public virtual Fill CursorColor {
                        get { return _cursorColor; }
                        set {
@@ -79,7 +79,7 @@ namespace Crow
                                NotifyValueChanged ("CursorColor", _cursorColor);
                        }
                }
-               [XmlAttributeAttribute()][DefaultValue(20)]
+               [DefaultValue(20)]
                public virtual int CursorSize {
                        get { return _cursorSize; }
                        set {
@@ -90,7 +90,7 @@ namespace Crow
                                NotifyValueChanged ("CursorSize", _cursorSize);
                        }
                }
-               [XmlAttributeAttribute()][DefaultValue(Orientation.Horizontal)]
+               [DefaultValue(Orientation.Horizontal)]
                public virtual Orientation Orientation
                {
                        get { return _orientation; }
@@ -105,7 +105,7 @@ namespace Crow
                }
                #endregion
 
-               [XmlAttributeAttribute()][DefaultValue(10.0)]
+               [DefaultValue(10.0)]
                public override double Maximum {
                        get { return base.Maximum; }
                        set {                           
index eb4caefaaf5beafc7702515fd9fc53c8b27dd6e2..f17ac89515b54581b08b7eb32b385dd72490b1b2 100644 (file)
@@ -1131,15 +1131,16 @@ namespace Crow
                MenuItem ctxMenuContainer;
                protected void initContextMenus (){
                        ctxMenuContainer = Load  ("#Crow.ContextMenu.template") as MenuItem;
+                       ctxMenuContainer.LayoutChanged += CtxMenuContainer_LayoutChanged;
                }
 
                void CtxMenuContainer_LayoutChanged (object sender, LayoutingEventArgs e)
                {
                        Rectangle r = ctxMenuContainer.ScreenCoordinates (ctxMenuContainer.Slot);
-                       if (e.LayoutType == LayoutingType.Width) {
+                       if (e.LayoutType == LayoutingType.Width || e.LayoutType == LayoutingType.X) {
                                if (r.Right > this.clientRectangle.Right)
                                        ctxMenuContainer.Left = this.clientRectangle.Right - ctxMenuContainer.Slot.Width;
-                       }else if (e.LayoutType == LayoutingType.Width) {
+                       }else if (e.LayoutType == LayoutingType.Width || e.LayoutType == LayoutingType.Y) {
                                if (r.Bottom > this.clientRectangle.Bottom)
                                        ctxMenuContainer.Top = this.clientRectangle.Bottom - ctxMenuContainer.Slot.Height;
                        }