Exemple #1
0
        public static PropertySheetForm Show(IUIObjectBasic Object, System.Windows.Forms.Form ParentForm)
        {
            PropertySheetForm PropertyForm;

            Debug.Assert(Object != null, "Cannot display properties for null object");
            if (Object == null)
                return null;

            //return PropertySheetForm.Show(Object.Row, ParentForm);
            if (ShownProperties.ContainsKey(Object))
            {
                PropertyForm = ShownProperties[Object] as PropertySheetForm;
                PropertyForm.Focus();
                return PropertyForm;
            }

            //If we aren't showing those properties, create a new property sheet and show it.
            PropertyForm = new PropertySheetForm(Object);

            ShownProperties.Add(Object, PropertyForm);

            PropertyForm.Show();

            return PropertyForm;
        }
Exemple #2
0
        protected PropertySheetForm(IUIObjectBasic Object)
        {
            this.Object = Object;
            this.Text = Object.ToString() + " Properties";

            //BUG: This was preventing the form from displaying, so I removed it temporarily.  Will prevent property pages from closing on app exit
            //            this.MdiParent = UI.State.Appwindow;

            InitializeComponent();
        }
Exemple #3
0
        public static PropertySheetForm[] Show(IUIObjectBasic[] Objects, System.Windows.Forms.Form ParentForm)
        {
            List<PropertySheetForm> Forms = new List<PropertySheetForm>(Objects.Length);
            foreach (IUIObject Obj in Objects)
            {
                PropertySheetForm Form = Show(Obj, ParentForm);
                Forms.Add(Form);
            }

            return Forms.ToArray();
        }
Exemple #4
0
        protected void OnMouseMove(object sender, MouseEventArgs e)
        {
            if (_Parent.CurrentCommand == null)
                return;

            //Check if there is a non-default command. we don't want to mess with another active command
            if (_Parent.CurrentCommand.GetType() != typeof(Viking.UI.Commands.DefaultCommand) ||
             Viking.UI.Commands.Command.QueueDepth > 0)
                return;

            //Buttons being pushed means we are in the middle of a default command, probably scrolling, which won't affect the selection
            if (e.Button != MouseButtons.None)
                return;

            //If locations aren't visible they can't be selected
            if (!_Parent.ShowOverlays)
            {
                _Parent.Cursor = Cursors.Default;
                return;
            }

            double distance;
            GridVector2 WorldPosition = _Parent.ScreenToWorld(e.X, e.Y);

            IUIObjectBasic NextMouseOverObject = GetNearestDrawnAnnotation(WorldPosition, out distance);
            if (NextMouseOverObject != LastMouseOverObject)
                Parent.Invalidate();

            LastMouseOverObject = NextMouseOverObject;

            /*Check to see if we are over a location*/

            Location_CanvasViewModel loc = LastMouseOverObject as Location_CanvasViewModel; // GetNearestLocation(WorldPosition, out distance);
            if (loc != null)
            {
                //If the loc is on this section we check if we are close to the edge and we are resizing.  Everyone else gets move cursor
                if (loc.TypeCode == LocationType.CIRCLE)
                {
                    OverlappedLocation overlapLoc = LastMouseOverObject as OverlappedLocation;
                    if (overlapLoc != null)
                    {
                        _Parent.Cursor = Cursors.Cross;
                        return;
                    }
                    else
                        _Parent.Cursor = Cursors.Default;

                    GridVector2 locPosition = loc.VolumePosition;

                    distance = GridVector2.Distance(locPosition, WorldPosition);
                    if (loc.Section == _Parent.Section.Number)
                    {
                        if (distance <= loc.Radius)
                        {
                            if (distance >= (loc.Radius * RadiusToResizeCircle))
                            {
                                _Parent.Cursor = Cursors.SizeAll;
                            }
                            else if (distance >= (loc.Radius * RadiusToLinkCircle))
                            {
                                _Parent.Cursor = Cursors.Arrow;
                            }
                            else
                            {
                                _Parent.Cursor = Cursors.Hand;
                            }
                        }
                    }
                    else
                    {
                        if (distance <= loc.OffSectionRadius)
                        {
                            LastMouseOverObject = loc;
                            _Parent.Cursor = Cursors.Cross;
                        }
                    }
                }
            }
            else
            {
                _Parent.Cursor = Cursors.Default;
            }
        }
        public void ShowObject(IUIObjectBasic Obj)
        {
            ShownObject = Obj;

            //Ensure our property pages are showing the correct type
            if (Obj != null)
            {
                this.DisplayType = Obj.GetType();
            }

            foreach (IPropertyPage IPage in this.IPropertyPages)
            {
                if (Obj == null)
                {
                    IPage.Enable(false);
                }
                else
                {

                    IPage.ShowObject(Obj);
                    IPage.Enable(true);
                }
            }
        }
Exemple #6
0
 public static System.Windows.Forms.DialogResult ShowDialog(IUIObjectBasic Object, System.Windows.Forms.Form ParentForm)
 {
     //If we aren't showing those properties, create a new property sheet and show it.
     using (PropertySheetForm PropertyForm = new PropertySheetForm(Object))
     {
         PropertyForm.Owner = ParentForm;
         return PropertyForm.ShowDialog();
     }
 }
Exemple #7
0
 public static PropertySheetForm Show(IUIObjectBasic Object)
 {
     return PropertySheetForm.Show(Object, UI.State.Appwindow);
 }