Ignore:
Timestamp:
Nov 9, 2010, 2:21:21 AM (11 years ago)
Author:
matkovic
Message:

-Major Style changes
-Fit to Screen added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/WorkspaceManager/View/Container/WorkSpaceEditorView.xaml.cs

    r2007 r2067  
    3333    public partial class WorkSpaceEditorView : UserControl
    3434    {
     35        private double prevX = 0, prevY = 0;
     36        private bool IsDragStarted;
    3537        private Point previousDragPoint = new Point();
    3638        private ConnectorView selectedConnector;
     
    4042        private PluginContainerView currentFullViewContainer;
    4143        private Panel root { get { return (this.ViewBox.Content as Panel); } }
     44        private BottomBox bottomBox { get { return (BottomBoxParent.Child as BottomBox); } }
    4245
    4346        public UserContentWrapper UserContentWrapper { get; set; }
     
    6265            setBaseControl(WorkspaceModel);                       
    6366            InitializeComponent();
    64             this.UserContentWrapper = new UserContentWrapper(WorkspaceModel, (BottomBoxParent.Child as BottomBox));
    65             this.UserControlWrapperParent.Children.Add(UserContentWrapper);
     67            ViewBox.DataContext = root;
     68            this.bottomBox.FitToScreen += new EventHandler<FitToScreenEventArgs>(bottomBox_FitToScreen);
     69            this.UserContentWrapper = new UserContentWrapper(WorkspaceModel, bottomBox);
     70            this.UserControlWrapperParent.Children.Clear();
     71            this.UserControlWrapperParent.Children.Add(UserContentWrapper);       
     72        }
     73
     74        void bottomBox_FitToScreen(object sender, FitToScreenEventArgs e)
     75        {
     76
     77            if (root.DesiredSize.Height < ViewBoxParent.ActualHeight)
     78                Properties.Settings.Default.EditScale = ViewBoxParent.ActualHeight / root.DesiredSize.Height;
     79
     80            if (root.DesiredSize.Width < ViewBoxParent.ActualWidth)
     81                Properties.Settings.Default.EditScale = ViewBoxParent.ActualWidth / root.DesiredSize.Width;
     82            this.UpdateLayout();
     83            if (root.ActualWidth > root.ActualHeight)
     84            {
     85                this.UpdateLayout();
     86                Properties.Settings.Default.EditScale = ViewBoxParent.ActualWidth / root.ActualWidth;
     87                return;
     88            }
     89            else if (root.ActualWidth < root.ActualHeight)
     90            {
     91
     92                this.UpdateLayout();
     93                Properties.Settings.Default.EditScale = ViewBoxParent.ActualHeight / root.ActualHeight ;
     94                return;
     95            }
    6696        }
    6797
     
    99129                newPluginContainerView.Delete += new EventHandler<PluginContainerViewDeleteViewEventArgs>(PluginDelete);
    100130                newPluginContainerView.FullScreen += new EventHandler<PluginContainerViewFullScreenViewEventArgs>(shape_FullScreen);
    101                 newPluginContainerView.ConnectorMouseLeftButtonDown += new EventHandler<ConnectorViewEventArgs>(shape_OnConnectorMouseLeftButtonDown);
    102131                newPluginContainerView.MouseLeftButtonDown += new MouseButtonEventHandler(shape_MouseLeftButtonDown);
    103132                newPluginContainerView.MouseLeftButtonUp += new MouseButtonEventHandler(shape_MouseLeftButtonUp);
     133                newPluginContainerView.ConnectorMouseLeftButtonDown += new EventHandler<ConnectorViewEventArgs>(shape_OnConnectorMouseLeftButtonDown);
    104134                newPluginContainerView.SetPosition(new Point((Math.Round((position.X) / Properties.Settings.Default.GridScale)) * Properties.Settings.Default.GridScale,
    105135                                                            (Math.Round((position.Y) / Properties.Settings.Default.GridScale)) * Properties.Settings.Default.GridScale));
     
    110140            }
    111141        }
     142
    112143
    113144        void shape_FullScreen(object sender, PluginContainerViewFullScreenViewEventArgs e)
     
    256287            Canvas.SetZIndex(sender as PluginContainerView, 100);
    257288            this.selectedPluginContainer = null;
    258         }
    259 
    260         private void Button_Click(object sender, RoutedEventArgs e)
    261         {
    262             SliderEditorSize.Value += 0.3;
    263         }
    264 
    265         private void Button_Click_1(object sender, RoutedEventArgs e)
    266         {
    267             SliderEditorSize.Value -= 0.3;
    268289        }
    269290
     
    335356        internal void Load(WorkspaceModel WorkspaceModel)
    336357        {
    337             this.Model = WorkspaceModel;
    338             this.UserContentWrapper = new UserContentWrapper(WorkspaceModel, (BottomBoxParent.Child as BottomBox));
    339             this.UserControlWrapperParent.Children.Clear();
    340             this.UserControlWrapperParent.Children.Add(UserContentWrapper);           
     358            this.Model = WorkspaceModel;   
    341359
    342360            foreach (PluginModel model in this.Model.AllPluginModels)
     
    408426        }
    409427
    410         private void Button_Click_Full_inc(object sender, RoutedEventArgs e)
    411         {
    412             FullScreenScaleSlider.Value += 0.3;
    413         }
    414 
    415         private void Button_Click_Full_dec(object sender, RoutedEventArgs e)
    416         {
    417             FullScreenScaleSlider.Value -= 0.3;
     428        private void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
     429        {
     430            double y = e.VerticalChange, x = e.HorizontalChange;
     431
     432            ViewBox.ScrollToHorizontalOffset(x);
     433            ViewBox.ScrollToVerticalOffset(y);
     434        }
     435
     436        private void Thumb_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e)
     437        {
    418438        }
    419439    }
Note: See TracChangeset for help on using the changeset viewer.