Exemple #1
0
        private void ModifyDimLineRef(IPropertyEntry sender, bool StartModifying)
        {
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(dimension.DimLineRef, dimension);

            gpa.GeoPointProperty = sender as GeoPointProperty;
            Frame.SetAction(gpa);
        }
 virtual public bool OnCommand(string MenuId)
 {
     switch (MenuId)
     {
         case "MenuId.NamedValues.NewGeoPoint":
             InsertGeoPoint();
             return true;
         case "MenuId.NamedValues.NewGeoVector":
             InsertGeoVector();
             return true;
         case "MenuId.NamedValues.NewDouble":
             InsertDouble();
             return true;
         default:
             if (MenuId.StartsWith("MenuId.NamedValue.Remove"))
             {
                 string name = MenuId.Remove(0, "MenuId.NamedValue.Remove.".Length);
                 Remove(name);
                 return true;
             }
             if (MenuId.StartsWith("MenuId.NamedValue.EditName"))
             {
                 string name = MenuId.Remove(0, "MenuId.NamedValue.EditName.".Length);
                 IPropertyEntry sp = FindEntry(name);
                 if (sp != null && propertyTreeView != null)
                 {
                     propertyTreeView.StartEditLabel(sp);
                 }
                 return true;
             }
             break;
     }
     return false;
 }
Exemple #3
0
 private void OnPointsStateChanged(IPropertyEntry sender, StateChangedArgs args)
 {
     if (HotspotChangedEvent != null)
     {
         if (args.EventState == StateChangedArgs.State.OpenSubEntries)
         {
             for (int i = 0; i < points.SubEntriesCount; ++i)
             {
                 IHotSpot hsp = points.SubEntries[i] as IHotSpot;
                 if (hsp != null)
                 {
                     HotspotChangedEvent(hsp, HotspotChangeMode.Visible);
                 }
             }
         }
         else if (args.EventState == StateChangedArgs.State.CollapseSubEntries)
         {
             for (int i = 0; i < points.SubEntriesCount; ++i)
             {
                 IHotSpot hsp = points.SubEntries[i] as IHotSpot;
                 if (hsp != null)
                 {
                     HotspotChangedEvent(hsp, HotspotChangeMode.Invisible);
                 }
             }
         }
     }
 }
        private void ModifyMinorAxisWithMouse(IPropertyEntry sender, bool StartModifying)
        {
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(ellipse.Center, ellipse);

            gpa.SetGeoPointEvent += new CADability.Actions.GeneralGeoPointAction.SetGeoPointDelegate(OnSetMinorAxis);
            Frame.SetAction(gpa);
        }
Exemple #5
0
 /// <summary>
 /// Will be called when the state of an entry in the ControlCenter changes. this implementation must be called by a class overriding this method.
 /// </summary>
 /// <param name="sender">The ShowProperty that changed its state</param>
 /// <param name="args">The new state</param>
 protected void OnShowPropertyStateChanged(IPropertyEntry sender, StateChangedArgs args)
 {
     if (sender is IGeoObjectShowProperty)
     {
         if (args.EventState == StateChangedArgs.State.Selected)
         {
             focusedSelectedObject = (sender as IGeoObjectShowProperty).GetGeoObject();
             if (FocusedObjectChangedEvent != null)
             {
                 FocusedObjectChangedEvent(this, focusedSelectedObject);
             }
         }
         else if (args.EventState == StateChangedArgs.State.UnSelected)
         {
             if (focusedSelectedObject == (sender as IGeoObjectShowProperty).GetGeoObject())
             {
                 focusedSelectedObject = null;
             }
             if (FocusedObjectChangedEvent != null)
             {
                 FocusedObjectChangedEvent(this, focusedSelectedObject);
             }
         }
         else
         {
             return;
         }
         foreach (IView vw in base.Frame.AllViews)
         {
             vw.Invalidate(PaintBuffer.DrawingAspect.Select, vw.DisplayRectangle);
         }
     }
 }
Exemple #6
0
 private void OnVertexPropertyStateChanged(IPropertyEntry sender, StateChangedArgs args)
 {
     if (args.EventState == StateChangedArgs.State.OpenSubEntries)
     {
         if (rectangleProperty != null && propertyPage != null)
         {
             propertyPage.OpenSubEntries(rectangleProperty as IPropertyEntry, false);
         }
         if (parallelProperty != null && propertyPage != null)
         {
             propertyPage.OpenSubEntries(parallelProperty as IPropertyEntry, false);
         }
     }
     if (HotspotChangedEvent != null)
     {
         if (args.EventState == StateChangedArgs.State.OpenSubEntries)
         {
             for (int i = 0; i < vertexProperty.SubEntries.Length; ++i)
             {
                 HotspotChangedEvent(vertexProperty.SubEntries[i] as IHotSpot, HotspotChangeMode.Visible);
             }
         }
         else if (args.EventState == StateChangedArgs.State.CollapseSubEntries)
         {
             for (int i = 0; i < vertexProperty.SubEntries.Length; ++i)
             {
                 HotspotChangedEvent(vertexProperty.SubEntries[i] as IHotSpot, HotspotChangeMode.Invisible);
             }
         }
     }
 }
        private void ModifyEndAngleWithMouse(IPropertyEntry sender, bool StartModifying)
        {
            GeneralAngleAction gaa = new GeneralAngleAction(endAngleProperty, ellipse.Center);

            gaa.CalculateAngleEvent += new CADability.Actions.GeneralAngleAction.CalculateAngleDelegate(OnCalculateEllipseParameter);
            Frame.SetAction(gaa);
        }
Exemple #8
0
 private void OnParallelPropertyStateChanged(IPropertyEntry sender, StateChangedArgs args)
 {       // hier erfahren wir, ob die Rechteckeigenschaften aufgeklappt
     // oder zugeklappt werden
     if (args.EventState == StateChangedArgs.State.OpenSubEntries)
     {
         vertexProperty.ShowOpen(false);
         if (HotspotChangedEvent != null)
         {
             HotspotChangedEvent(locationParallelProperty, HotspotChangeMode.Visible);
             HotspotChangedEvent(directionXParallelHotSpot, HotspotChangeMode.Visible);
             HotspotChangedEvent(directionYParallelHotSpot, HotspotChangeMode.Visible);
             HotspotChangedEvent(sizeHotSpot, HotspotChangeMode.Visible);
         }
     }
     else if (args.EventState == StateChangedArgs.State.CollapseSubEntries)
     {
         if (HotspotChangedEvent != null)
         {
             HotspotChangedEvent(locationParallelProperty, HotspotChangeMode.Invisible);
             HotspotChangedEvent(directionXParallelHotSpot, HotspotChangeMode.Invisible);
             HotspotChangedEvent(directionYParallelHotSpot, HotspotChangeMode.Invisible);
             HotspotChangedEvent(sizeHotSpot, HotspotChangeMode.Invisible);
         }
     }
 }
Exemple #9
0
        public void AddSubEntry(IPropertyEntry ToAdd)
        {
            ArrayList al = new ArrayList(subEntries);

            al.Add(ToAdd);
            subEntries = (IPropertyEntry[])al.ToArray(typeof(IPropertyEntry));
        }
Exemple #10
0
        public void ShowTextBox(Rectangle screenLocation, string initialText, IPropertyEntry sender, Point screenClickPos)
        {
            if (EntryWithTextBox != null)
            {
                EntryWithTextBox.EndEdit(true, textBox.Modified, textBox.Text);
            }
            EntryWithTextBox = sender;
            textBox.Text     = initialText;
            textBox.Modified = false;
            textBox.Visible  = true;
            textBox.Bounds   = RectangleToClient(screenLocation);
            textBox.BringToFront();
            int   lastInd     = Math.Max(initialText.Length - 1, 0);
            Point lastCharPos = textBox.GetPositionFromCharIndex(initialText.Length - 1);
            int   charWidth   = textBox.Font.Height * 5 / 7; // some guess

            if (initialText.Length > 0)
            {
                charWidth = lastCharPos.X / initialText.Length;
            }
            Point clickPos  = textBox.PointToClient(screenClickPos);
            int   charindex = textBox.GetCharIndexFromPosition(new Point(clickPos.X + charWidth / 2, clickPos.Y));

            if (clickPos.X > lastCharPos.X + charWidth)
            {   // clicked behind the last character: select all
                textBox.SelectAll();
            }
            else
            {   // clicked somewhere inside the text
                textBox.Select(charindex, 0);
            }
            textBox.Show();
            textBox.Focus();
        }
Exemple #11
0
        ListBox listBox; // the only listbox, which is hidden and, when needed, moved and filled before it is shown
        public void ShowListBox(Rectangle screenLocation, string[] items, int selected, IPropertyEntry sender)
        {
            if (EntryWithListBox == sender)
            {
                return;
            }
            EntryWithListBox = sender;
            int       height    = items.Length * screenLocation.Height + 2 * SystemInformation.BorderSize.Height + listBox.Margin.Top + listBox.Margin.Bottom;
            Rectangle entryRect = RectangleToClient(screenLocation);
            Rectangle bounds;

            if (entryRect.Top > ClientRectangle.Height - entryRect.Bottom)
            {
                // place the list box above the entry
                height = Math.Min(height, entryRect.Top);
                bounds = new Rectangle(entryRect.Left, entryRect.Top - height, entryRect.Width, height);
            }
            else
            {
                // place the list box below the entry
                height = Math.Min(height, ClientRectangle.Height - entryRect.Bottom);
                bounds = new Rectangle(entryRect.Left, entryRect.Bottom, entryRect.Width, height);
            }
            listBox.Items.AddRange(items);
            listBox.Visible = true;
            listBox.BringToFront();
            listBox.ItemHeight    = screenLocation.Height;
            listBox.SelectedIndex = selected;
            listBox.Bounds        = bounds;
            listBox.Show();
            listBox.Focus();
        }
Exemple #12
0
 void OnDistanceKey(IPropertyEntry sender, char KeyPressed)
 {   // das Enter auf einem Abstand beendet immer die Aktion, sonst muss man halt mit TAB durch
     // man könnte überprüfen obs der letzte ist, macht aber m.E. keinen Sinn
     if (KeyPressed == 13)
     {
         base.Finish();
     }
 }
Exemple #13
0
 public override void UnSelected(IPropertyEntry nowSelected)
 {
     if (needsUpdate && Settings.GlobalSettings.GetBoolValue("HatchStyle.AutoUpdate", true))
     {
         OnUpdateAllHatchs();
     }
     needsUpdate = false;
 }
Exemple #14
0
        private void ModifyEndAngleWithMouse(IPropertyEntry sender, bool StartModifying)
        {
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(dimension.GetPoint(2), dimension);

            gpa.GeoPointProperty  = sender as GeoPointProperty;
            gpa.SetGeoPointEvent += new CADability.Actions.GeneralGeoPointAction.SetGeoPointDelegate(OnSetEndAnglePoint);
            Frame.SetAction(gpa);
        }
Exemple #15
0
        private void ModifyDirectionWithMouse(IPropertyEntry sender, bool StartModifying)
        {   // wird entweder durch Menueauswahl in der GeoVectorProperty oder durch ziehen am HotSpot
            // (läuft auch über die GeoVectorProperty) ausgelöst. Die GeneralGeoVectorAction arbeitet
            // direkt über die GeoVectorProperty, so dass keine weiteren Events nötig sind.
            GeneralGeoVectorAction gva = new GeneralGeoVectorAction(sender as GeoVectorProperty, line.StartPoint, line);

            Frame.SetAction(gva);
        }
Exemple #16
0
 public override void Selected(IPropertyEntry previousSelected)
 {
     if (previousSelected is GeoPointProperty gp)
     {
         SelectionChangedEvent?.Invoke(gp, false);
     }
     SelectionChangedEvent?.Invoke(this, true);
     base.Selected(previousSelected);
 }
Exemple #17
0
        bool ICommandHandler.OnCommand(string MenuId)
        {
            switch (MenuId)
            {
            case "MenuId.Length.ModifyWithMouse":
                ModifyWithMouse?.Invoke(this, false);
                return(true);

            case "MenuId.Length.DistanceOfCurve":
                Frame.SetAction(new CADability.Actions.ConstructDistanceOfCurve(this));
                return(true);

            case "MenuId.Length.DistanceTwoPoints":
                Frame.SetAction(new CADability.Actions.ConstructDistanceTwoPoints(this));
                return(true);

            case "MenuId.Length.DistancePointCurve":
                Frame.SetAction(new CADability.Actions.ConstructDistancePointCurve(this));
                return(true);

            case "MenuId.Length.DistanceTwoCurves":
                Frame.SetAction(new CADability.Actions.ConstructDistanceTwoCurves(this));
                return(true);

            case "MenuId.Length.DoubleValue":
                this.SetLength(this.GetLength() * 2.0);
                return(true);

            case "MenuId.Length.HalfValue":
                this.SetLength(this.GetLength() * 0.5);
                return(true);

            case "MenuId.Length.NameVariable":
                Frame.Project.SetNamedValue(null, GetLength());
                return(true);

            case "MenuId.Length.FormatSettings":
            {
                Frame.ShowPropertyDisplay("Global");
                IPropertyPage  pd = Frame.GetPropertyDisplay("Global");
                IPropertyEntry sp = pd.FindFromHelpLink("Setting.Formatting");
                if (sp != null)
                {
                    pd.OpenSubEntries(sp, true);
                    sp = pd.FindFromHelpLink("Setting.Formatting.GeneralDouble");
                    if (sp != null)
                    {
                        pd.OpenSubEntries(sp, true);
                        pd.SelectEntry(sp);
                    }
                }
            }
                return(true);
                // return false;
            }
            return(false);
        }
Exemple #18
0
 public void SelectEntry(IPropertyEntry toSelect)
 {
     if (toSelect == null)
     {
         return;
     }
     // propertiesExplorer.ShowPropertyPage(this.TitleId);
     // do not switch the top property page here
     (this as IPropertyPage).Selected = toSelect;
 }
Exemple #19
0
        private void ModifyTextPosWithMouse(IPropertyEntry sender, bool StartModifying)
        {
            int      ind = (int)(sender as DoubleProperty).UserData.GetData("Index");
            GeoPoint p   = dimension.GetTextPosCoordinate(ind, Frame.ActiveView.Projection);
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(p, dimension);

            gpa.UserData.Add("Index", ind);
            gpa.SetGeoPointEvent += new GeneralGeoPointAction.SetGeoPointDelegate(OnSetTextPos);
            Frame.SetAction(gpa);
        }
Exemple #20
0
 public void Add(IPropertyEntry toAdd, bool showOpen)
 {
     rootProperties.Add(toAdd);
     RefreshEntries(-1, 0);
     if (showOpen)
     {
         OpenSubEntries(toAdd, true);
     }
     (this as IPropertyPage).Selected = toAdd;
 }
Exemple #21
0
 public void MakeVisible(IPropertyEntry toShow)
 {
     if (toShow != null)
     {
         int ind = FindEntry(toShow);
         if (ind >= 0)
         {
             VerticalScroll.Value = ind * lineHeight;           // not testes yet
         }
     }
 }
Exemple #22
0
 public bool ContainsEntry(IPropertyEntry toTest)
 {
     for (int i = 0; i < entries.Length; i++)
     {
         if (entries[i] == toTest)
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #23
0
        private void OpenOrCloseSubEntries(int index)
        {
            IPropertyEntry selectedEntry = entries[index];
            int            added         = selectedEntry.OpenOrCloseSubEntries();

            if (added != 0)
            {
                RefreshEntries(selected, added);
            }
            (this as IPropertyPage).Selected = selectedEntry;
        }
Exemple #24
0
        public DataTemplate GetEditorTemplate(IPropertyEntry entry)
        {
            ResourceDictionary dict = new ResourceDictionary()
            {
                Source = new
                         Uri("ApressExtensionCS.Design;component/EditorTemplates.xaml",
                             UriKind.Relative)
            };

            return((DataTemplate)dict["MaxIntegerEditorTemplate"]);
        }
Exemple #25
0
 private int FindEntry(IPropertyEntry toFind)
 {
     for (int i = 0; i < entries.Length; i++)
     {
         if (entries[i] == toFind)
         {
             return(i);
         }
     }
     return(-1);
 }
Exemple #26
0
 public void Selected(IPropertyEntry selectedEntry)
 {
     if (EntryWithTextBox != null && EntryWithTextBox != selectedEntry)
     {
         HideTextBox();
     }
     if (EntryWithListBox != null && EntryWithListBox != selectedEntry)
     {
         HideListBox();
     }
 }
        private bool OnModifyThroughPointsWithMouse(IPropertyEntry sender, int index)
        {
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(bSpline.GetThroughPoint(index), bSpline);

            gpa.UserData.Add("Mode", "ThroughPoint");
            gpa.UserData.Add("Index", index);
            gpa.GeoPointProperty  = sender as GeoPointProperty;
            gpa.SetGeoPointEvent += new CADability.Actions.GeneralGeoPointAction.SetGeoPointDelegate(OnSetThroughPoint);
            Frame.SetAction(gpa);
            return(false);
        }
Exemple #28
0
 private IPropertyEntry Search(string helpResourceID)
 {
     for (int i = 0; i < rootProperties.Count; i++)
     {
         IPropertyEntry found = rootProperties[i].FindSubItem(helpResourceID);
         if (found != null)
         {
             return(found);
         }
     }
     return(null);
 }
Exemple #29
0
        private bool OnModifyPointWithMouse(IPropertyEntry sender, int index)
        {
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(dimension.GetPoint(index), dimension);

            gpa.UserData.Add("Mode", "Point");
            gpa.UserData.Add("Index", index);
            gpa.GeoPointProperty  = sender as GeoPointProperty;
            gpa.SetGeoPointEvent += new CADability.Actions.GeneralGeoPointAction.SetGeoPointDelegate(OnSetPoint);
            gpa.ActionDoneEvent  += new CADability.Actions.GeneralGeoPointAction.ActionDoneDelegate(OnSetPointDone);
            Frame.SetAction(gpa);
            return(false);
        }
 private void ModifyWithMouse(IPropertyEntry sender, bool StartModifying)
 {
     if (ModifyWithMouseEvent != null)
     {
         GeoPointProperty gpp = sender as GeoPointProperty;
         int index            = (int)gpp.UserData["Index"];
         if (!ModifyWithMouseEvent(sender, index))
         {       // der Anwender will es nicht
             //gpp.SetMouseButton(MouseButtonMode.MouseInactive);
         }
     }
 }