public ManagerContextMenu() { // Add Undo, Redo, Paste and select all menu items this.MenuItems.Add(new ObjectMenuItem(UndoId, StringManager.GetString(StringManager.Id.UndoContextMenu))); this.MenuItems.Add(new ObjectMenuItem(RedoId, StringManager.GetString(StringManager.Id.RedoContextMenu))); this.MenuItems.Add(new ObjectMenuItem(Separator1Id, Tools.SeparatorMenuItem)); this.MenuItems.Add(new ObjectMenuItem(PasteId, StringManager.GetString(StringManager.Id.PasteContextMenu))); this.MenuItems.Add(new ObjectMenuItem(Separator2Id, Tools.SeparatorMenuItem)); this.MenuItems.Add(new ObjectMenuItem(SelectAllId, StringManager.GetString(StringManager.Id.SelectAllContextMenu))); this.MenuItems.Add(new ObjectMenuItem(Separator3Id, Tools.SeparatorMenuItem)); this.MenuItems.Add(new ObjectMenuItem(ShowGridId, StringManager.GetString(StringManager.Id.ShowGridContextMenu))); this.MenuItems.Add(new ObjectMenuItem(SnapToGridId, StringManager.GetString(StringManager.Id.SnapToGridContextMenu))); this.MenuItems.Add(new ObjectMenuItem(SnapToGridPropertiesId, StringManager.GetString(StringManager.Id.SnapToGridPropertiesContextMenu))); this.MenuItems.Add(new ObjectMenuItem(Separator4Id, Tools.SeparatorMenuItem)); this.MenuItems.Add(new ObjectMenuItem(EnableObjectsAlignmentId, StringManager.GetString(StringManager.Id.EnableObjectsAlignmentContextMenu))); // Add click event handler to each menu item except the seperators foreach (MenuItem item in MenuItems) { if (string.Compare(item.Text, Tools.SeparatorMenuItem) != 0) { item.Click += new EventHandler(menuItem_Click); } } }
public TextRollupContextMenu() : base() { ObjectMenuItem objectMenu; var index = -1; for (var i = 0; i < this.MenuItems.Count && index == -1; i++) { objectMenu = MenuItems[i] as ObjectMenuItem; if (objectMenu != null && objectMenu.Id == ObjectContextMenu.Separator4Id) { index = i; } } if (index == -1) { index = this.MenuItems.Count; } objectMenu = new ObjectMenuItem(_mySep, Tools.SeparatorMenuItem); objectMenu.Click += new EventHandler(menuItem_Click); MenuItems.Add(index++, objectMenu); objectMenu = new ObjectMenuItem(ExpandedId, StringManager.GetString(StringManager.Id.ExpandedContextMenu)); objectMenu.Click += new EventHandler(menuItem_Click); MenuItems.Add(index++, objectMenu); }
private void Localize() { _btnOk.Text = StringManager.GetString(StringManager.Id.OK); _btnCancel.Text = StringManager.GetString(StringManager.Id.Cancel); Text = Lock ? StringManager.GetString(StringManager.Id.PasswordDialogLockCaption) : StringManager.GetString(StringManager.Id.PasswordDialogUnlockCaption); _gbPassword.Text = StringManager.GetString(StringManager.Id.PasswordDialogPasswordLabel); }
public static string GetRubberStampName(AnnRubberStampType rubberStampType) { switch (rubberStampType) { case AnnRubberStampType.StampApproved: return(StringManager.GetString(StringManager.Id.ApprovedRubberStamp)); case AnnRubberStampType.StampAssigned: return(StringManager.GetString(StringManager.Id.AssignedRubberStamp)); case AnnRubberStampType.StampChecked: return(StringManager.GetString(StringManager.Id.CheckedRubberStamp)); case AnnRubberStampType.StampClient: return(StringManager.GetString(StringManager.Id.ClientRubberStamp)); case AnnRubberStampType.StampCopy: return(StringManager.GetString(StringManager.Id.CopyRubberStamp)); case AnnRubberStampType.StampDraft: return(StringManager.GetString(StringManager.Id.DraftRubberStamp)); case AnnRubberStampType.StampExtended: return(StringManager.GetString(StringManager.Id.ExtendedRubberStamp)); case AnnRubberStampType.StampFax: return(StringManager.GetString(StringManager.Id.FaxRubberStamp)); case AnnRubberStampType.StampFaxed: return(StringManager.GetString(StringManager.Id.FaxedRubberStamp)); case AnnRubberStampType.StampImportant: return(StringManager.GetString(StringManager.Id.ImportantRubberStamp)); case AnnRubberStampType.StampInvoice: return(StringManager.GetString(StringManager.Id.InvoiceRubberStamp)); case AnnRubberStampType.StampNotice: return(StringManager.GetString(StringManager.Id.NoticeRubberStamp)); case AnnRubberStampType.StampOfficial: return(StringManager.GetString(StringManager.Id.OfficialRubberStamp)); case AnnRubberStampType.StampOnFile: return(StringManager.GetString(StringManager.Id.OnFileRubberStamp)); case AnnRubberStampType.StampPaid: return(StringManager.GetString(StringManager.Id.PaidRubberStamp)); case AnnRubberStampType.StampPassed: return(StringManager.GetString(StringManager.Id.PassedRubberStamp)); case AnnRubberStampType.StampPending: return(StringManager.GetString(StringManager.Id.PendingRubberStamp)); case AnnRubberStampType.StampProcessed: return(StringManager.GetString(StringManager.Id.ProcessedRubberStamp)); case AnnRubberStampType.StampReceived: return(StringManager.GetString(StringManager.Id.ReceivedRubberStamp)); case AnnRubberStampType.StampRejected: return(StringManager.GetString(StringManager.Id.RejectedRubberStamp)); case AnnRubberStampType.StampRelease: return(StringManager.GetString(StringManager.Id.ReleaseRubberStamp)); case AnnRubberStampType.StampSent: return(StringManager.GetString(StringManager.Id.SentRubberStamp)); case AnnRubberStampType.StampShipped: return(StringManager.GetString(StringManager.Id.ShippedRubberStamp)); case AnnRubberStampType.StampTopSecret: return(StringManager.GetString(StringManager.Id.TopSecretRubberStamp)); case AnnRubberStampType.StampUrgent: return(StringManager.GetString(StringManager.Id.UrgentRubberStamp)); case AnnRubberStampType.StampVoid: return(StringManager.GetString(StringManager.Id.VoidRubberStamp)); default: return("RubberStamp"); } }
private void SnapToGridPropertiesDialog_Load(object sender, EventArgs e) { _snapToGridTabPage.Text = StringManager.GetString(StringManager.Id.SnapToGridCaption); _showGridCheckBox.Text = StringManager.GetString(StringManager.Id.SnapToGridShowGridCheckBox); _gridColorLabel.Text = StringManager.GetString(StringManager.Id.SnapToGridGridColorLabel); _gridLengthLabel.Text = StringManager.GetString(StringManager.Id.SnapToGridGridLengthLabel); _lineSpacingLabel.Text = StringManager.GetString(StringManager.Id.SnapToGridLineSpacingLabel); _behaviorGroupBox.Text = StringManager.GetString(StringManager.Id.SnapToGridBehaviorGroupBox); _enableSnapCheckBox.Text = StringManager.GetString(StringManager.Id.SnapToGridEnableSnapCheckBox); _dashStyleLabel.Text = StringManager.GetString(StringManager.Id.SnapToGridLineStyleLabel); _snapToGridOptions = _automation.Manager.SnapToGridOptions.Clone() as AnnSnapToGridOptions; _showGridCheckBox.Checked = _snapToGridOptions.ShowGrid; _lineSpacingTextBox.Text = _snapToGridOptions.LineSpacing.ToString(); _gridLengthTextBox.Text = _snapToGridOptions.GridLength.ToString(); _gridColorColorPicker.Color = ColorTranslator.FromHtml((_snapToGridOptions.GridStroke.Stroke as AnnSolidColorBrush).Color); _lineStyleComboBox.SelectedIndex = GetLineStyleFromStrok(_snapToGridOptions.GridStroke); _enableSnapCheckBox.Checked = _snapToGridOptions.EnableSnap; }
public ObjectContextMenu() { // Add Cut/Copy and delete menu items this.MenuItems.Add(new ObjectMenuItem(CutId, StringManager.GetString(StringManager.Id.CutContextMenu))); this.MenuItems.Add(new ObjectMenuItem(CopyId, StringManager.GetString(StringManager.Id.CopyContextMenu))); this.MenuItems.Add(new ObjectMenuItem(DeleteId, StringManager.GetString(StringManager.Id.DeleteContextMenu))); this.MenuItems.Add(new ObjectMenuItem(Separator1Id, Tools.SeparatorMenuItem)); // add Z-order menu items(BringToFront, SendToBack, BringToFirst, SendToLast) this.MenuItems.Add(new ObjectMenuItem(BringToFrontId, StringManager.GetString(StringManager.Id.BringToFrontContextMenu))); this.MenuItems.Add(new ObjectMenuItem(SendToBackId, StringManager.GetString(StringManager.Id.SendToBackContextMenu))); this.MenuItems.Add(new ObjectMenuItem(BringToFirstId, StringManager.GetString(StringManager.Id.BringToFirstContextMenu))); this.MenuItems.Add(new ObjectMenuItem(SendToLastId, StringManager.GetString(StringManager.Id.SendToLastContextMenu))); // add Objects Alignmen menu items ObjectMenuItem ObjectsAlignmenMenuItem = new ObjectMenuItem(ObjectsAlignmentId, StringManager.GetString(StringManager.Id.ObjectsAlignmentContextMenu)); ObjectsAlignmenMenuItem.MenuItems.Add(new ObjectMenuItem(ObjectsAlignmentLeftsId, StringManager.GetString(StringManager.Id.ObjectsAlignmentLeftsContextMenu))); ObjectsAlignmenMenuItem.MenuItems.Add(new ObjectMenuItem(ObjectsAlignmentCentersId, StringManager.GetString(StringManager.Id.ObjectsAlignmentCentersContextMenu))); ObjectsAlignmenMenuItem.MenuItems.Add(new ObjectMenuItem(ObjectsAlignmentRightsId, StringManager.GetString(StringManager.Id.ObjectsAlignmentRightsContextMenu))); ObjectsAlignmenMenuItem.MenuItems.Add(new ObjectMenuItem(Separator7Id, Tools.SeparatorMenuItem)); ObjectsAlignmenMenuItem.MenuItems.Add(new ObjectMenuItem(ObjectsAlignmentTopsId, StringManager.GetString(StringManager.Id.ObjectsAlignmentTopsContextMenu))); ObjectsAlignmenMenuItem.MenuItems.Add(new ObjectMenuItem(ObjectsAlignmentMiddlesId, StringManager.GetString(StringManager.Id.ObjectsAlignmentMiddlesContextMenu))); ObjectsAlignmenMenuItem.MenuItems.Add(new ObjectMenuItem(ObjectsAlignmentBottomsId, StringManager.GetString(StringManager.Id.ObjectsAlignmentBottomsContextMenu))); ObjectsAlignmenMenuItem.MenuItems.Add(new ObjectMenuItem(Separator8Id, Tools.SeparatorMenuItem)); ObjectsAlignmenMenuItem.MenuItems.Add(new ObjectMenuItem(ObjectsAlignmentSameWidthId, StringManager.GetString(StringManager.Id.ObjectsAlignmentSameWidthContextMenu))); ObjectsAlignmenMenuItem.MenuItems.Add(new ObjectMenuItem(ObjectsAlignmentSameHeightId, StringManager.GetString(StringManager.Id.ObjectsAlignmentSameHeightContextMenu))); ObjectsAlignmenMenuItem.MenuItems.Add(new ObjectMenuItem(ObjectsAlignmentSameSizeId, StringManager.GetString(StringManager.Id.ObjectsAlignmentSameSizeContextMenu))); this.MenuItems.Add(ObjectsAlignmenMenuItem); this.MenuItems.Add(new ObjectMenuItem(Separator2Id, Tools.SeparatorMenuItem)); // Add flip and reverse menu items this.MenuItems.Add(new ObjectMenuItem(FlipId, StringManager.GetString(StringManager.Id.FlipContextMenu))); this.MenuItems.Add(new ObjectMenuItem(ReverseId, StringManager.GetString(StringManager.Id.ReverseContextMenu))); this.MenuItems.Add(new ObjectMenuItem(Separator3Id, Tools.SeparatorMenuItem)); // Add lock and unlock menu items this.MenuItems.Add(new ObjectMenuItem(LockId, StringManager.GetString(StringManager.Id.LockContextMenu))); this.MenuItems.Add(new ObjectMenuItem(UnlockId, StringManager.GetString(StringManager.Id.UnlockContextMenu))); this.MenuItems.Add(new ObjectMenuItem(Separator4Id, Tools.SeparatorMenuItem)); // Add reset rotate points menu item this.MenuItems.Add(new ObjectMenuItem(ResetRotatePointsId, StringManager.GetString(StringManager.Id.ResetRotatePointsContextMenu))); this.MenuItems.Add(new ObjectMenuItem(Separator5Id, Tools.SeparatorMenuItem)); // Add properties menu item this.MenuItems.Add(new ObjectMenuItem(PropertiesId, StringManager.GetString(StringManager.Id.PropertiesContextMenu))); // Add click event handler to each menu item except the seperators foreach (MenuItem item in MenuItems) { if (string.Compare(item.Text, Tools.SeparatorMenuItem) != 0) { item.Click += new EventHandler(menuItem_Click); } } foreach (MenuItem item in ObjectsAlignmenMenuItem.MenuItems) { if (string.Compare(item.Text, Tools.SeparatorMenuItem) != 0) { item.Click += new EventHandler(menuItem_Click); } } }
// Disable or enable the menu items when the context menu is about to pop up protected override void OnPopup(EventArgs e) { var automation = this.Automation; if (automation != null) { EnableMenuItem(GetMenuItem(CutId), automation.CanCopy, false); EnableMenuItem(GetMenuItem(CopyId), automation.CanCopy, false); EnableMenuItem(GetMenuItem(DeleteId), automation.CanDeleteObjects, false); EnableMenuItem(GetMenuItem(BringToFrontId), automation.CanBringToFront, false); EnableMenuItem(GetMenuItem(SendToBackId), automation.CanSendToBack, false); EnableMenuItem(GetMenuItem(BringToFirstId), automation.CanBringToFirst, false); EnableMenuItem(GetMenuItem(SendToLastId), automation.CanSendToLast, false); EnableMenuItem(GetMenuItem(FlipId), automation.CanFlip && (automation.CurrentEditObject.Id != AnnObject.RichTextObjectId), false); EnableMenuItem(GetMenuItem(ReverseId), automation.CanFlip && (automation.CurrentEditObject.Id != AnnObject.RichTextObjectId), false); EnableMenuItem(GetMenuItem(FlipId), automation.CanFlip && (automation.CurrentEditObject.Id != AnnObject.StickyNoteObjectId), false); EnableMenuItem(GetMenuItem(ReverseId), automation.CanFlip && (automation.CurrentEditObject.Id != AnnObject.StickyNoteObjectId), false); EnableMenuItem(GetMenuItem(ObjectsAlignmentId), automation.CanAlign, true); if (automation.CurrentEditObject is AnnTextReviewObject || SelectionContainsTextReviewObject(automation.CurrentEditObject as AnnSelectionObject)) { EnableMenuItem(GetMenuItem(FlipId), false, false); EnableMenuItem(GetMenuItem(ReverseId), false, false); EnableMenuItem(GetMenuItem(CutId), false, false); EnableMenuItem(GetMenuItem(CopyId), false, false); } EnableMenuItem(GetMenuItem(LockId), automation.CanLock, false); EnableMenuItem(GetMenuItem(UnlockId), automation.CanUnlock, false); EnableMenuItem(GetMenuItem(Separator4Id), automation.CanResetRotatePoints, false); EnableMenuItem(GetMenuItem(ResetRotatePointsId), automation.CanResetRotatePoints, false); // Change the text from "PolyLine Properties" or "PolyRuler Properties" to "Line Properties" or "Ruler Properties" // depending on how many points it has var objectMenu = GetMenuItem(PropertiesId); if (objectMenu != null) { var props = StringManager.GetString(StringManager.Id.PropertiesContextMenu); if (automation.CurrentEditObject != null) { var automationObject = automation.Manager.FindObject(automation.CurrentEditObject); var name = automationObject.Name; var currentObject = automation.CurrentEditObject; if (currentObject.Points.Count == 2) { if (currentObject.Id == AnnObject.PolyRulerObjectId) { name = "&Ruler"; } else if (currentObject.Id == AnnObject.PolylineObjectId) { name = "&Line"; } } objectMenu.Text = string.Format("{0} {1}", name, props); } else { objectMenu.Text = props; } objectMenu.Enabled = automation.CanShowObjectProperties; } } base.OnPopup(e); }