示例#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;
        }
示例#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();
        }
示例#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();
        }
示例#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;
            }
        }
示例#5
0
        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);
                }
            }
        }
示例#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();
     }
 }
示例#7
0
 public static PropertySheetForm Show(IUIObjectBasic Object)
 {
     return PropertySheetForm.Show(Object, UI.State.Appwindow);
 }