diff --git a/Application.xaml.vb b/Application.xaml.vb
index 9ec6000..3a94af7 100644
--- a/Application.xaml.vb
+++ b/Application.xaml.vb
@@ -113,6 +113,8 @@ Class Application
Friend Const MIRROR As String = "Mirror"
Friend Const SCALE As String = "Scale"
Friend Const OFFSET As String = "Offset"
+ Friend Const GETCURRLAYER As String = "GetCurrLayer"
+ Friend Const SETCURRLAYER As String = "SetCurrLayer"
' Controller messages
Friend Const SETLASTBOOLEAN As String = "SetLastBoolean"
diff --git a/ProjectPage/DrawPanel/DrawPanelViewModel.vb b/ProjectPage/DrawPanel/DrawPanelViewModel.vb
index 66941e5..637e453 100644
--- a/ProjectPage/DrawPanel/DrawPanelViewModel.vb
+++ b/ProjectPage/DrawPanel/DrawPanelViewModel.vb
@@ -5,6 +5,10 @@ Namespace EgtCAM5
Public Class DrawPanelViewModel
Inherits ViewModelBase
+#Region "FIELDS & PROPERTIES"
+
+#Region "ToolTip"
+
'Proprietà ToolTip
Public ReadOnly Property PointToolTip As String
Get
@@ -229,6 +233,22 @@ Namespace EgtCAM5
End Get
End Property
+#End Region ' ToolTip
+
+ ' Definizione layer corrente
+ Private m_CurrentLayer As Integer
+ Public ReadOnly Property bLayerOk As Boolean
+ Get
+ Return m_CurrentLayer <> GDB_ID.NULL
+ End Get
+ End Property
+ ' Definizione layer corrente
+ Private m_bSelOk As Boolean = (EgtGetFirstSelectedObj() <> GDB_ID.NULL)
+ Public ReadOnly Property bSelOk As Boolean
+ Get
+ Return m_bSelOk
+ End Get
+ End Property
' Definizione comandi
Private m_cmdPoint As ICommand
Private m_cmdLine2P As ICommand
@@ -274,11 +294,20 @@ Namespace EgtCAM5
Private m_cmdScale3D As ICommand
Private m_cmdOffset As ICommand
+#End Region ' Fileds & Properties
+
+#Region "CONSTRUCTOR"
Sub New()
-
+ Application.Msn.Register(Application.SETCURRLAYER, Sub(CurrLayer As Integer)
+ m_CurrentLayer = CurrLayer
+ End Sub)
End Sub
+#End Region ' Constructor
+
+#Region "COMMANDS"
+
#Region "PointCommand"
'''
@@ -304,7 +333,8 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanPoint(ByVal param As Object) As Boolean
- Return True
+ Application.Msn.NotifyColleagues(Application.GETCURRLAYER)
+ Return bLayerOk
End Function
#End Region ' PointCommand
@@ -334,7 +364,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanLine2P(ByVal param As Object) As Boolean
- Return True
+ Return bLayerOk
End Function
#End Region ' Line2PCommand
@@ -364,7 +394,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanLinePDL(ByVal param As Object) As Boolean
- Return True
+ Return bLayerOk
End Function
#End Region ' LinePDLCommand
@@ -394,7 +424,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanCircleCP(ByVal param As Object) As Boolean
- Return True
+ Return bLayerOk
End Function
#End Region ' CircleCPCommand
@@ -424,7 +454,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanCircleCD(ByVal param As Object) As Boolean
- Return True
+ Return bLayerOk
End Function
#End Region ' CircleCDCommand
@@ -454,7 +484,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanArcCSE(ByVal param As Object) As Boolean
- Return True
+ Return bLayerOk
End Function
#End Region ' ArcCSECommand
@@ -484,7 +514,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanArc3P(ByVal param As Object) As Boolean
- Return True
+ Return bLayerOk
End Function
#End Region ' Arc3PCommand
@@ -514,7 +544,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanArcPDP(ByVal param As Object) As Boolean
- Return True
+ Return bLayerOk
End Function
#End Region ' ArcPDPCommand
@@ -544,7 +574,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanFillet(ByVal param As Object) As Boolean
- Return True
+ Return bLayerOk
End Function
#End Region ' FilletCommand
@@ -574,7 +604,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanChamfer(ByVal param As Object) As Boolean
- Return True
+ Return bLayerOk
End Function
#End Region ' ChamferCommand
@@ -604,7 +634,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanRectangle2P(ByVal param As Object) As Boolean
- Return True
+ Return bLayerOk
End Function
#End Region ' Rectangle2PCommand
@@ -634,7 +664,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanPolygon(ByVal param As Object) As Boolean
- Return True
+ Return bLayerOk
End Function
#End Region ' PolygonCommand
@@ -664,7 +694,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanPolygonSide(ByVal param As Object) As Boolean
- Return True
+ Return bLayerOk
End Function
#End Region ' PolygonSideCommand
@@ -694,7 +724,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanText(ByVal param As Object) As Boolean
- Return True
+ Return bLayerOk
End Function
#End Region ' TextCommand
@@ -724,7 +754,8 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanPlane(ByVal param As Object) As Boolean
- Return True
+ m_bSelOk = EgtGetFirstSelectedObj() <> GDB_ID.NULL
+ Return bLayerOk And bSelOk
End Function
#End Region ' PlaneCommand
@@ -754,7 +785,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanExtrude(ByVal param As Object) As Boolean
- Return True
+ Return bLayerOk And bSelOk
End Function
#End Region ' ExtrudeCommand
@@ -784,7 +815,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanRevolve(ByVal param As Object) As Boolean
- Return True
+ Return bLayerOk And bSelOk
End Function
#End Region ' RevolveCommand
@@ -814,7 +845,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanScrew(ByVal param As Object) As Boolean
- Return True
+ Return bLayerOk And bSelOk
End Function
#End Region ' ScrewCommand
@@ -844,7 +875,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanRuled(ByVal param As Object) As Boolean
- Return True
+ Return bLayerOk And bSelOk
End Function
#End Region ' RuledCommand
@@ -874,7 +905,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanMergeSurf(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' MergeSurfCommand
@@ -904,7 +935,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanExplodeSurf(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' ExplodeSurfCommand
@@ -934,7 +965,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanInvertSurf(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' InvertSurfCommand
@@ -964,7 +995,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanDelete(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' DeleteCommand
@@ -994,7 +1025,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanChangeLayer(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' ChangeLayerCommand
@@ -1024,7 +1055,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanChangeAlpha(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' ChangeAlphaCommand
@@ -1054,7 +1085,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanResetColor(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' ResetColorCommand
@@ -1084,7 +1115,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanChangeColor(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' ChangeColorCommand
@@ -1114,7 +1145,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanInvertCurve(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' InvertCurveCommand
@@ -1144,7 +1175,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanChangeStartCurve(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' ChangeStartCurveCommand
@@ -1174,7 +1205,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanExtendCurve(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' ExtendCurveCommand
@@ -1204,7 +1235,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanBreakCurve(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' BreakCurveCommand
@@ -1234,7 +1265,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanSplitCurve(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' SplitCurveCommand
@@ -1264,7 +1295,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanJoinCurve(ByVal param As Object) As Boolean
- Return True
+ Return bLayerOk And bSelOk
End Function
#End Region ' JoinCurveCommand
@@ -1294,7 +1325,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanExplodeCurve(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' ExplodeCurveCommand
@@ -1324,7 +1355,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanSetCurveTh(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' SetCurveThCommand
@@ -1354,7 +1385,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanMove(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' MoveCommand
@@ -1384,7 +1415,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanRotate(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' RotateCommand
@@ -1414,7 +1445,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanRotate3D(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' Rotate3DCommand
@@ -1444,7 +1475,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanMirror(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' MirrorCommand
@@ -1474,7 +1505,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanMirror3D(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' Mirror3DCommand
@@ -1504,7 +1535,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanScale(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' ScaleCommand
@@ -1534,7 +1565,7 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanScale3D(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' Scale3DCommand
@@ -1564,11 +1595,13 @@ Namespace EgtCAM5
''' Returns always true.
'''
Private Function CanOffset(ByVal param As Object) As Boolean
- Return True
+ Return bSelOk
End Function
#End Region ' OffsetCommand
+#End Region ' Commands
+
End Class
End Namespace
\ No newline at end of file
diff --git a/ProjectPage/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderView.xaml b/ProjectPage/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderView.xaml
index f369842..2af7fa1 100644
--- a/ProjectPage/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderView.xaml
+++ b/ProjectPage/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderView.xaml
@@ -20,21 +20,22 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProjectPage/ProjectViewModel.vb b/ProjectPage/ProjectViewModel.vb
index dcb2288..463b813 100644
--- a/ProjectPage/ProjectViewModel.vb
+++ b/ProjectPage/ProjectViewModel.vb
@@ -411,6 +411,11 @@ Namespace EgtCAM5
End Sub
Sub RegisterDrawPanelCommands()
+ Application.Msn.Register(Application.GETCURRLAYER, Sub()
+ Dim CurrLayer As Integer = m_Controller.GetCurrLayer()
+ Application.Msn.NotifyColleagues(Application.SETCURRLAYER, CurrLayer)
+ End Sub)
+
Application.Msn.Register(Application.POINT, Sub()
If (Keyboard.Modifiers And ModifierKeys.Control) = ModifierKeys.Control Then
m_Controller.ExecuteCommand(Controller.CMD.FRAME)
@@ -445,7 +450,7 @@ Namespace EgtCAM5
m_Controller.ExecuteCommand(Controller.CMD.ARCPVP)
End If
End Sub)
- Application.Msn.Register(Application.POLYGON, Sub()
+ Application.Msn.Register(Application.POLYGON, Sub()
If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then
m_Controller.ExecuteCommand(Controller.CMD.POLYGON)
Else