Exemple #1
0
        void SetDocumentMenus(IDocumentForm document)
        {
            bool isDocument = document != null;
            bool isVisible;
            bool isEnabled;

            if (isDocument && _systemEditor != null)
            {
                _systemEditor.DataPath = document.DataPath;
            }

            SetMenuVisible(mnuSave, isDocument);
            SetMenuVisible(mnuSaveAs, isDocument);
            SetMenuVisible(mnuSaveAll, isDocument);
            SetMenuVisible(mnuSaveSeperator, isDocument);

            SetMenuVisible(mnuWindowsSeperator, isDocument);

            SetMenuVisible(mnuClose, isDocument);
            mnuCloseAllDocuments.Enabled = isDocument;

            isVisible = isDocument && document.CanSave();
            SetMenuVisible(mnuSave, isVisible);
            SetMenuVisible(mnuSaveAs, isVisible);

            if (isVisible)
            {
                string title = document.GetTitle();
                mnuSave.Text   = string.Format(Strings.FileEditorSave, title);
                mnuSaveAs.Text = string.Format(Strings.FileEditorSaveAs, title);
            }

            mnuUndo.Enabled      = isDocument && document.CanUndo();
            mnuRedo.Enabled      = isDocument && document.CanRedo();
            mnuCopy.Enabled      = isDocument && document.CanCopy();
            mnuCut.Enabled       = isDocument && document.CanCut();
            mnuPaste.Enabled     = isDocument && document.CanPaste();
            mnuAdd.Enabled       = isDocument && document.CanAdd();
            mnuAdd.DropDown      = isDocument ? document.MultipleAddDropDown() : null;
            mnuSelectAll.Enabled = isDocument && document.CanSelectAll();

            mnu3dEditor.Enabled = isDocument && document.CanDisplay3DViewer();

            isVisible = isDocument && document.CanFocusSelected(false);
            isEnabled = isVisible && document.CanFocusSelected(true);
            SetMenuVisible(mnuFocusSelected, isVisible, isEnabled);
            SetMenuVisible(mnuLookAtSelected, isVisible, isEnabled);
            SetMenuVisible(mnuFocusSelectedSeperator, isVisible);

            isVisible = isDocument && document.CanTrackSelected(false);
            isEnabled = isVisible && document.CanTrackSelected(true);
            SetMenuVisible(mnuTrackSelected, isVisible, isEnabled);

            isVisible = isDocument && document.CanManipulatePosition();
            isEnabled = isVisible && document.CanManipulateRotationScale();
            SetMenuVisible(mnuManipulationNone, isVisible);
            SetMenuVisible(mnuManipulationTranslate, isVisible);
            SetMenuVisible(mnuManipulationRotate, isVisible, isEnabled);
            SetMenuVisible(mnuManipulationScale, isVisible, isEnabled);
            SetMenuVisible(mnuManipulationSeperator, isVisible);

            isVisible = isDocument && document.CanChangeVisibility(false);
            isEnabled = isVisible && document.CanChangeVisibility(true);
            SetMenuVisible(mnuChangeVisibility, isVisible, isEnabled);
            SetMenuVisible(mnuShowModels, isVisible);
            SetMenuVisible(mnuShowModelsSeperator, isVisible);
        }