Imports EgtUILib

Public Class SceneButtonsUC

   'Riferimento alla MainWindow
   Dim m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)

   Private Sub MeasureBtn_Checked(sender As Object, e As RoutedEventArgs) Handles MeasureBtn.Checked
      GetCurrScene.SetStatusGetDistance()
      Dim ptRef1 As Point3d
      If EgtGetTableRef(1, ptRef1) Then
         EgtSetGridFrame(New Frame3d(ptRef1))
         GetCurrScene.SetGridCursorPos(True)
      End If
   End Sub

   Private Sub MeasureBtn_Unchecked(sender As Object, e As RoutedEventArgs) Handles MeasureBtn.Unchecked
      GetCurrScene.ResetStatusGetDistance()
      GetCurrScene.SetStatusNull()
      Select Case m_MainWindow.m_ActivePage
      Case MainWindow.Pages.Open
         m_MainWindow.m_OpenPage.MessageTxBx.Text = ""
         m_MainWindow.m_OpenPage.MessageBrd.Background = Brushes.Transparent
      Case MainWindow.Pages.Draw
         m_MainWindow.m_DrawPageUC.MessageTxBx.Text = ""
         m_MainWindow.m_DrawPageUC.MessageBrd.Background = Brushes.Transparent
      Case MainWindow.Pages.Import
         m_MainWindow.m_ImportPageUC.MessageTxBx.Text = ""
         m_MainWindow.m_ImportPageUC.MessageBrd.Background = Brushes.Transparent
      Case Else
         m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
      End Select
   End Sub

   Private Sub ZoomAllBtn_Click(sender As Object, e As RoutedEventArgs) Handles ZoomAllBtn.Click
      EgtZoom(ZM.ALL)
   End Sub

   Private Sub ZoomInBtn_Click(sender As Object, e As RoutedEventArgs) Handles ZoomInBtn.Click
      EgtZoom(ZM.IN_)
   End Sub

   Private Sub ZoomOutBtn_Click(sender As Object, e As RoutedEventArgs) Handles ZoomOutBtn.Click
      EgtZoom(ZM.OUT)
   End Sub

   'Private Sub ZoomWinBtn_Click(sender As Object, e As RoutedEventArgs) Handles ZoomWinBtn.Click
   '   GetCurrScene.SetStatusZoomWin()
   'End Sub

   Private Sub PanBtn_Click(sender As Object, e As RoutedEventArgs) Handles PanBtn.Click
      GetCurrScene.SetStatusPan()
   End Sub

   Private Sub GenericViewBtn_Click(sender As Object, e As RoutedEventArgs) Handles GenericViewBtn.Click
      If Keyboard.IsKeyDown(Key.T) Then
         EgtSetView(VT.TOP)
      ElseIf Keyboard.IsKeyDown(Key.F) Then
         EgtSetView(VT.FRONT)
      ElseIf Keyboard.IsKeyDown(Key.B) Then
         EgtSetView(VT.BACK)
      ElseIf Keyboard.IsKeyDown(Key.L) Then
         EgtSetView(VT.LEFT)
      ElseIf Keyboard.IsKeyDown(Key.R) Then
         EgtSetView(VT.RIGHT)
      Else
         GetCurrScene.SetStatusRot()
      End If
   End Sub

   Private Sub TopViewBtn_Click(sender As Object, e As RoutedEventArgs) Handles TopViewBtn.Click
      EgtSetView(VT.TOP)
   End Sub

   Private Function GetCurrScene() As EgtUILib.Scene
   Select Case m_MainWindow.m_ActivePage
      Case MainWindow.Pages.WorkInProgress
         Return m_MainWindow.m_WorkInProgressPageUC.WorkInProgressScene
      Case MainWindow.Pages.DirectCut
         Return m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene
      Case MainWindow.Pages.CadCut
         Return m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene
      Case MainWindow.Pages.Open
         Return m_MainWindow.m_OpenPage.OpenScene
      Case MainWindow.Pages.FrameCut
         Return m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene
      Case MainWindow.Pages.Draw
         Return m_MainWindow.m_DrawPageUC.DrawScene
      Case MainWindow.Pages.Import
         Return m_MainWindow.m_ImportPageUC.ImportScene
      Case Else
         Return m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene
   End Select
   End Function

End Class
