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; }
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); }
/// <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); } } }
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); }
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); } } }
public void AddSubEntry(IPropertyEntry ToAdd) { ArrayList al = new ArrayList(subEntries); al.Add(ToAdd); subEntries = (IPropertyEntry[])al.ToArray(typeof(IPropertyEntry)); }
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(); }
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(); }
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(); } }
public override void UnSelected(IPropertyEntry nowSelected) { if (needsUpdate && Settings.GlobalSettings.GetBoolValue("HatchStyle.AutoUpdate", true)) { OnUpdateAllHatchs(); } needsUpdate = false; }
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); }
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); }
public override void Selected(IPropertyEntry previousSelected) { if (previousSelected is GeoPointProperty gp) { SelectionChangedEvent?.Invoke(gp, false); } SelectionChangedEvent?.Invoke(this, true); base.Selected(previousSelected); }
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); }
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; }
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); }
public void Add(IPropertyEntry toAdd, bool showOpen) { rootProperties.Add(toAdd); RefreshEntries(-1, 0); if (showOpen) { OpenSubEntries(toAdd, true); } (this as IPropertyPage).Selected = toAdd; }
public void MakeVisible(IPropertyEntry toShow) { if (toShow != null) { int ind = FindEntry(toShow); if (ind >= 0) { VerticalScroll.Value = ind * lineHeight; // not testes yet } } }
public bool ContainsEntry(IPropertyEntry toTest) { for (int i = 0; i < entries.Length; i++) { if (entries[i] == toTest) { return(true); } } return(false); }
private void OpenOrCloseSubEntries(int index) { IPropertyEntry selectedEntry = entries[index]; int added = selectedEntry.OpenOrCloseSubEntries(); if (added != 0) { RefreshEntries(selected, added); } (this as IPropertyPage).Selected = selectedEntry; }
public DataTemplate GetEditorTemplate(IPropertyEntry entry) { ResourceDictionary dict = new ResourceDictionary() { Source = new Uri("ApressExtensionCS.Design;component/EditorTemplates.xaml", UriKind.Relative) }; return((DataTemplate)dict["MaxIntegerEditorTemplate"]); }
private int FindEntry(IPropertyEntry toFind) { for (int i = 0; i < entries.Length; i++) { if (entries[i] == toFind) { return(i); } } return(-1); }
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); }
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); }
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); } } }