From 1a34b2fef93bee05a74ce8820767cce5bab202a3 Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Fri, 17 Feb 2023 09:55:16 +0100 Subject: [PATCH] - Posizionamento corretto contextMenu in TreeView - introduzione iconcine per parametri lavorazione in TopBar - Miglioramento ControllerInput --- .../AttachedProperties/TreeViewItemHelper.vb | 69 +++++++++--------- .../ControllerInputPanelV.xaml | 59 ++++++++++----- Icarus/Icarus.vbproj | 8 +- Icarus/ManagePartPanel/ManagePartPanelV.xaml | 47 +++++------- Icarus/Project/ProjectV.xaml | 3 +- Icarus/Resources/TopPanel/Offset.png | Bin 0 -> 850 bytes .../Resources/TopPanel/SlicingDirection.png | Bin 0 -> 966 bytes Icarus/Resources/TopPanel/StrandCount.png | Bin 0 -> 357 bytes Icarus/Resources/TopPanel/StrandH.png | Bin 0 -> 396 bytes Icarus/Resources/TopPanel/StrandW.png | Bin 0 -> 408 bytes Icarus/TopPanel/TopPanelV.xaml | 39 +++++++--- Icarus/Utility/Dictionary.xaml | 56 ++++++-------- 12 files changed, 155 insertions(+), 126 deletions(-) create mode 100644 Icarus/Resources/TopPanel/Offset.png create mode 100644 Icarus/Resources/TopPanel/SlicingDirection.png create mode 100644 Icarus/Resources/TopPanel/StrandCount.png create mode 100644 Icarus/Resources/TopPanel/StrandH.png create mode 100644 Icarus/Resources/TopPanel/StrandW.png diff --git a/Icarus/AttachedProperties/TreeViewItemHelper.vb b/Icarus/AttachedProperties/TreeViewItemHelper.vb index f7e46dc..d058a2b 100644 --- a/Icarus/AttachedProperties/TreeViewItemHelper.vb +++ b/Icarus/AttachedProperties/TreeViewItemHelper.vb @@ -1,4 +1,5 @@ Imports System.Globalization +Imports System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox Imports System.Windows.Media.Media3D Public Module TreeViewItemHelper @@ -69,9 +70,16 @@ Public Module TreeViewItemHelper Private Sub OnPreviewMouseRightButtonDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs) Dim treeViewItem As TreeViewItem = VisualUpwardSearch(Of TreeViewItem)(TryCast(e.OriginalSource, DependencyObject)) - If treeViewItem IsNot Nothing Then treeViewItem.IsSelected = True + Dim Tree As TreeView = VisualUpwardSearch(Of TreeView)(TryCast(treeViewItem, DependencyObject)) + If Not IsNothing(Tree) Then + Dim myTransform As GeneralTransform = treeViewItem.TransformToAncestor(Tree) + + Dim myOffset As Point = myTransform.Transform(New Point(0, 0)) + treeViewItem.ContextMenu.HorizontalOffset = -treeViewItem.ActualWidth + (-myOffset.X) + Tree.ActualWidth - 3 + treeViewItem.ContextMenu.VerticalOffset = -3 + End If e.Handled = True End If End Sub @@ -97,7 +105,7 @@ Public Module TreeViewItemHelper End Function ' Gestione indentazione sottoelementi - Public Function GetDepth(ByVal item As TreeViewItem) As Integer + Public Function GetDepth(item As TreeViewItem) As Integer Dim parent As TreeViewItem = GetParent(item) If Not IsNothing(parent) Then Return GetDepth(parent) + 1 @@ -105,7 +113,7 @@ Public Module TreeViewItemHelper Return 0 End Function - Private Function GetParent(ByVal item As TreeViewItem) As TreeViewItem + Private Function GetParent(item As TreeViewItem) As TreeViewItem Dim parent As DependencyObject = If(Not IsNothing(item), VisualTreeHelper.GetParent(item), Nothing) While Not IsNothing(parent) AndAlso Not (TypeOf parent Is TreeViewItem OrElse TypeOf parent Is TreeView) @@ -115,6 +123,29 @@ Public Module TreeViewItemHelper Return TryCast(parent, TreeViewItem) End Function + Private Function GetTreeParent(item As TreeViewItem) As TreeViewItem + Dim parent As DependencyObject = If(Not IsNothing(item), VisualTreeHelper.GetParent(item), Nothing) + + While Not IsNothing(parent) AndAlso Not (TypeOf parent Is TreeViewItem OrElse TypeOf parent Is TreeView) + parent = VisualTreeHelper.GetParent(parent) + End While + + Return TryCast(parent, TreeViewItem) + End Function + + ' Gestione indentazione sottoelementi + Public Function GetHeight(Item As TreeViewItem, SearchedItem As TreeViewItem, ByRef nHeight As Integer) As Boolean + Dim Index As Integer = 0 + While Index <= Item.Items.Count - 1 + If GetHeight(Item.Items(Index), SearchedItem, nHeight) Then + nHeight += 1 + Return True + End If + Index += 1 + End While + Return False + End Function + End Module Public Class LeftMarginMultiplierConverter @@ -132,35 +163,3 @@ Public Class LeftMarginMultiplierConverter Throw New System.NotImplementedException() End Function End Class - -Public Class Treeview_MenuContext_VerticalOffset_Converter - Implements IValueConverter - - Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert - If TypeOf value Is Double Then - Return -CDbl(value) - End If - Return 0 - End Function - - Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack - Throw New NotImplementedException() - End Function - -End Class - -Public Class Treeview_MenuContext_HorizontalOffset_Converter - Implements IValueConverter - - Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert - If TypeOf value Is Double Then - Return CDbl(value) - 5 - End If - Return 0 - End Function - - Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack - Throw New NotImplementedException() - End Function - -End Class \ No newline at end of file diff --git a/Icarus/ControllerInputPanel/ControllerInputPanelV.xaml b/Icarus/ControllerInputPanel/ControllerInputPanelV.xaml index ca0d06f..e3297ce 100644 --- a/Icarus/ControllerInputPanel/ControllerInputPanelV.xaml +++ b/Icarus/ControllerInputPanel/ControllerInputPanelV.xaml @@ -1,10 +1,16 @@ - + - + @@ -133,6 +125,7 @@ + diff --git a/Icarus/Project/ProjectV.xaml b/Icarus/Project/ProjectV.xaml index f8a3797..b272969 100644 --- a/Icarus/Project/ProjectV.xaml +++ b/Icarus/Project/ProjectV.xaml @@ -29,8 +29,7 @@ + DataContext="{StaticResource ControllerInputPanelVM}"/> diff --git a/Icarus/Resources/TopPanel/Offset.png b/Icarus/Resources/TopPanel/Offset.png new file mode 100644 index 0000000000000000000000000000000000000000..998f1b04e4d5469652ed9ee7db98e5d9032ad614 GIT binary patch literal 850 zcmV-Y1FigtP)vJFDlhta4 zV?*oc7#%CAyE=m~@C*PlIvjZ<0G1q6%XX4oNfl};47?!#HDr@%YGc7u0AKmL5bbij z0Pq=r4Le8&C?wV8>cak@z zQP~1+{1d=yjh(>*%CkpRwt3un^zi-&zMuU>x;m)Z6D zgR5SD5H04jF96;y<}+h4pMC1}2fuZsB>IHZbIW$dI%C4f{j7v#J2AZ_n1+E@6f7Ck zPM*}A$w=GuAZl$y%^8;Ml)n)nRd-B$cf8Fyu8k(Xdo}UhcA1UVQ>lnD3i6an7t_j< z7kjL0*-p1;zLXTBNAz|E;DbtzIkOJQs(e-%xw+@7WINK5qGx<=v~iwE<+y}7tkQE7 z{5J+!#x|ck#ho#|Vs4X>!@v__Z*+MqWh_iARxoJtQ`K+U5b_pet(UodlA{J18S3)^rqO*vHE`#iOmQJdzRBLi8 z3K}35D@jz?B#iF0M_Y`TQ4@Vo3FNTnn(`8-%GWiiZk-BV7i@1XG;d;=C)N0CD?r8* zc~E~3l=fQt^pXO#^-Lr9OVv#r^5SrrYGEqz|BAIK{&`Xzb`WLw8wA^SkTtu__QZEr z8k_aJ_J-ULhAbsg{MX&8>R4IozN@Vc^3{cx*N*`1vDZpNvi%PLk1gAg0=|Du(F>BF z-mxu`d=&tAY1z&RiJUU)-{1gxT26d-R59P3_->N^-(Ee%TMIOO+9>0tO+E$fK**%P zOG^venR5V7_D(7cJfB^sQS{X&1+feAHjR?vg+X;4(x;UYV((sb!EM}As@LD-@*xMf ceT@U~2VSUx+#2kpu>b%707*qoM6N<$g3Nt}3;+NC literal 0 HcmV?d00001 diff --git a/Icarus/Resources/TopPanel/SlicingDirection.png b/Icarus/Resources/TopPanel/SlicingDirection.png new file mode 100644 index 0000000000000000000000000000000000000000..d7ab36b957dc74828bd92f6121558d88ace77157 GIT binary patch literal 966 zcmV;%13CPOP)J;!>A0$1Ng)ErMMfD(K*390j2*h=U+z7Kb|dXNkPwIsAILyIj&Vb?}AI^5t^h z^F8nLKJWV-=yW>#YjJQ?c;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