Beispiel #1
0
        public static string GetString(Id id)
        {
            if (_instance == null)
            {
                _instance = new StringManager();
            }

            if (_dictionary.ContainsKey(id))
            {
                return(_dictionary[id]);
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
        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;
        }
Beispiel #3
0
        public static string SetString(Id id, string newValue)
        {
            if (_instance == null)
            {
                _instance = new StringManager();
            }

            string oldValue = null;

            if (_dictionary.ContainsKey(id))
            {
                oldValue        = _dictionary[id];
                _dictionary[id] = newValue;
            }
            else
            {
                _dictionary.Add(id, newValue);
            }

            return(oldValue);
        }
Beispiel #4
0
        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);
                }
            }
        }
Beispiel #5
0
        // 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);
        }
Beispiel #6
0
 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);
 }
Beispiel #7
0
 public static void Reload()
 {
     _instance = null;
 }