예제 #1
0
 /// <summary>
 /// Updates command state for given command. Only called if CanDoCommand is true.</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="state">Command state to update</param>
 public void UpdateCommand(object commandTag, CommandState state)
 {
     var camController = commandTag as CameraController;
     if (camController == null)
         return;            
     var designControl = m_designView.ActiveView;
     state.Check = designControl.CameraController.GetType() == camController.GetType();
 }
예제 #2
0
 public void UpdateCommand(object commandTag, Sce.Atf.Applications.CommandState state)
 {
     // if (commandTag is Command)
     // {
     //     switch ((Command)commandTag)
     //     {
     //     }
     // }
 }
 /// <summary>
 /// Updates command state for given command</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="commandState">Command state to update</param>
 void ICommandClient.UpdateCommand(object commandTag, CommandState commandState)
 {
     var historyContext = m_contextRegistry.GetActiveContext<IHistoryContext>();
     if (historyContext != null)
     {
         if (commandTag.Equals(StandardCommand.EditUndo))
         {
             commandState.Text = string.Format("Undo {0}".Localize("{0} is the name of the command"), historyContext.UndoDescription);
         }
         else if (commandTag.Equals(StandardCommand.EditRedo))
         {
             commandState.Text = string.Format("Redo {0}".Localize("{0} is the name of the command"), historyContext.RedoDescription);
         }
     }
 }
예제 #4
0
        /// <summary>
        /// Updates command state for given command</summary>
        /// <param name="commandTag">Command</param>
        /// <param name="state">Command state to update</param>
        public void UpdateCommand(object commandTag, Sce.Atf.Applications.CommandState state)
        {
            if (commandTag is Command)
            {
                NativeDesignControl control = (NativeDesignControl)m_designView.ActiveView;
                GlobalRenderFlags   flags   = control.RenderState.RenderFlag;
                switch ((Command)commandTag)
                {
                case Command.RenderSmooth:
                    state.Check = (flags & GlobalRenderFlags.Solid) != 0;
                    break;

                case Command.RenderWireFrame:
                    state.Check = (flags & GlobalRenderFlags.WireFrame) != 0;
                    break;

                case Command.RenderOutlined:
                    state.Check = (flags & GlobalRenderFlags.Solid) != 0 &&
                                  (flags & GlobalRenderFlags.WireFrame) != 0;
                    break;

                case Command.RenderTextured:
                    state.Check = (flags & GlobalRenderFlags.Textured) != 0;
                    break;

                case Command.RenderLight:
                    state.Check = ((flags & GlobalRenderFlags.Lit) != 0);
                    break;

                case Command.RenderBackFace:
                    state.Check = (flags & GlobalRenderFlags.RenderBackFace) != 0;
                    break;

                case Command.RenderShadow:
                    state.Check = (flags & GlobalRenderFlags.Shadows) == GlobalRenderFlags.Shadows;
                    break;

                case Command.RenderNormals:
                    state.Check = (flags & GlobalRenderFlags.RenderNormals) == GlobalRenderFlags.RenderNormals;
                    break;
                    // case Command.RealTime:
                    //      state.Check = m_designView.RealTime;
                }
            }
        }
예제 #5
0
파일: CommandService.cs 프로젝트: zparr/ATF
        /// <summary>
        /// Force an update on a particular command</summary>
        /// <param name="info">Command to update</param>
        public void UpdateCommand(CommandInfo info)
        {
            if (m_mainForm.InvokeRequired)
            {
                m_mainForm.BeginInvoke(new Action <CommandInfo>(UpdateCommand), info);
                return;
            }

            ToolStripMenuItem menuItem;
            ToolStripButton   menuButton;

            info.GetMenuItemAndButton(out menuItem, out menuButton);

            CommandState commandState = new CommandState();

            commandState.Text  = info.DisplayedMenuText;
            commandState.Check = menuItem.Checked;

            ICommandClient client = GetClient(info.CommandTag);

            if (client == null)
            {
                client = m_activeClient;
            }

            bool enabled = false;

            if (client != null)
            {
                enabled = client.CanDoCommand(info.CommandTag);
                if (enabled)
                {
                    client.UpdateCommand(info.CommandTag, commandState);
                }
            }

            string menuText = commandState.Text.Trim();

            menuItem.Text    = menuButton.Text = menuText;
            menuItem.Checked = menuButton.Checked = commandState.Check;
            menuItem.Enabled = menuButton.Enabled = enabled;
        }
예제 #6
0
        /// <summary>
        /// Updates command state for given command</summary>
        /// <param name="commandTag">Command</param>
        /// <param name="state">Command state to update</param>
        public void UpdateCommand(object commandTag, Sce.Atf.Applications.CommandState state)
        {
            if (commandTag is Command)
            {
                DesignControl activeControl = m_renderView.ViewControl;
                if (activeControl == null)
                {
                    return;
                }

                switch ((Command)commandTag)
                {
                case Command.RenderSmooth:
                    state.Check = (activeControl.RenderState.RenderMode & RenderMode.Smooth) != 0;
                    break;

                case Command.RenderWireFrame:
                    state.Check = (activeControl.RenderState.RenderMode & RenderMode.Wireframe) != 0;
                    break;

                case Command.RenderOutlined:
                    state.Check = (activeControl.RenderState.RenderMode & RenderMode.Smooth) != 0 &&
                                  (activeControl.RenderState.RenderMode & RenderMode.Wireframe) != 0;
                    break;

                case Command.RenderTextured:
                    state.Check = (activeControl.RenderState.RenderMode & RenderMode.Textured) != 0;
                    break;

                case Command.RenderLight:
                    state.Check = ((activeControl.RenderState.RenderMode & RenderMode.Lit) != 0);
                    break;

                case Command.RenderBackFace:
                    state.Check = ((activeControl.RenderState.RenderMode & RenderMode.CullBackFace) == 0);
                    break;
                }
            }
        }
예제 #7
0
파일: CommandService.cs 프로젝트: zparr/ATF
        private void menuItem_MouseLeave(object sender, EventArgs e)
        {
            // clear status text
            if (m_statusService != null)
            {
                m_statusService.ShowStatus(string.Empty);
            }

            // Clear mouseover status
            m_menuMouseLocation      = Point.Empty;
            m_mouseIsOverCommandIcon = null;

            var menuItem = sender as ToolStripMenuItem;

            if (menuItem != null)
            {
                object tag = menuItem.Tag;
                if ((tag != null) && (tag is IPinnable))
                {
                    CommandState commandState = new CommandState(menuItem.Text, menuItem.Checked);
                    UpdatePinnableCommand(tag, commandState);
                }
            }
        }
예제 #8
0
        /// <summary>
        /// Updates command state for given command</summary>
        /// <param name="commandTag">Command</param>
        /// <param name="state">Command state to update</param>
        public void UpdateCommand(object commandTag, CommandState state)
        {
            if (commandTag is CommandTag)
            {
               
                if (commandTag.Equals(CommandTag.ResetGroupPinNames))
                {
                    if (m_targetRef != null && m_targetRef.Target != null)
                    {
                        object target = m_targetRef.Target;
                        if (target.Is<Group>())
                        {
                            var group = target.Cast<Group>();
                            state.Text = string.Format("Reset Pin Names on \"{0}\"".Localize(), group.Name);
                        }
                    }
                }
                else if (commandTag.Equals(CommandTag.ShowExpandedGroupPins))
                {
                    if (m_targetRef != null && m_targetRef.Target != null)
                    {
                        object target = m_targetRef.Target;
                        if (target.Is<Group>())
                        {
                            var group = target.Cast<Group>();
                            state.Check = group.Info.ShowExpandedGroupPins;
                            state.Text = string.Format("Show Expanded Group Pins on \"{0}\"".Localize(), group.Name);
                        }
                    }
                }
                else if (commandTag.Equals(CommandTag.HideUnconnectedPins))
                {
                    if (m_targetRef != null && m_targetRef.Target != null)
                    {
                        object target = m_targetRef.Target;
                        if (target.Is<Group>())
                        {
                            var group = target.Cast<Group>();
                            var graphContainer = group.ParentGraph.As<ICircuitContainer>();
                            if (graphContainer != null)
                            {
                                // check if all unconnected pins are hidden
                                m_allUnconnectedHidden = true;
                                foreach (var grpPin in group.InputGroupPins)
                                {
                                    bool externalConectd =
                                        graphContainer.Wires.FirstOrDefault(
                                            x => x.InputPinTarget.FullyEquals(grpPin.PinTarget)) != null;
                                    if (!externalConectd && grpPin.Visible)
                                    {
                                        m_allUnconnectedHidden = false;
                                        break;
                                    }
                                }
                                if (m_allUnconnectedHidden)
                                {
                                    foreach (var grpPin in group.OutputGroupPins)
                                    {
                                        bool externalConectd =
                                            graphContainer.Wires.FirstOrDefault(
                                                x => x.OutputPinTarget.FullyEquals(grpPin.PinTarget)) != null;
                                        if (!externalConectd && grpPin.Visible)
                                        {
                                            m_allUnconnectedHidden = false;
                                            break;
                                        }
                                    }
                                }

                                state.Check = m_allUnconnectedHidden;
                                state.Text = string.Format("Hide Unconnected Pins on \"{0}\"".Localize(), group.Name);
                            }
                        }
                    }
                }
            }
        }
예제 #9
0
 /// <summary>
 /// Updates command state for given command</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="commandState">Command info to update</param>
 public virtual void UpdateCommand(object commandTag, CommandState commandState)
 {
     if ((commandTag is Command))
     {
         if ((Command)commandTag == Command.Enabled && SourceControlService != null)
         {
             commandState.Text = SourceControlService.Enabled ? "Disable Source Control".Localize() : "Enable Source Control".Localize();
             m_sourceControlEnableCmd.GetButton().ToolTipText = commandState.Text;
             m_sourceControlEnableCmd.GetButton().Image = SourceControlService.Enabled ? m_sourceControlEnableImage: m_sourceControlDisableImage;
         }
     }
 }
예제 #10
0
        /// <summary>
        /// Updates a command</summary>
        /// <param name="commandTag">Command</param>
        /// <param name="state">Command state</param>
        public override void UpdateCommand(object commandTag, CommandState state)
        {
            if (!(commandTag is WindowLayoutServiceCommand))
                return;

            var cmd = (WindowLayoutServiceCommand)commandTag;
            state.Check = WindowLayoutService.IsCurrent(cmd.LayoutName);
        }
예제 #11
0
        /// <summary>
        /// Updates command state for given command</summary>
        /// <remarks>This is used e.g. to set the check next to a menu command or 
        /// to show a toolbar button as pressed</remarks>
        /// <param name="commandTag">Command</param>
        /// <param name="commandState">Command info to update</param>
        public void UpdateCommand(object commandTag, CommandState commandState)
        {
            //GameDocument document = m_contextRegistry.GetActiveContext<GameDocument>();
            //if (document == null)
            //    return;

            //if (commandTag is Command)
            //{
            //    switch ((Command)commandTag)
            //    {
            //        case Command.ToggleSplitMode:
            //            commandState.Check = document.SplitManipulator.Active;
            //            break;
            //    }
            //}
        }
예제 #12
0
 /// <summary>
 /// Updates command state for given command</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="commandState">Command info to update</param>
 public virtual void UpdateCommand(object commandTag, CommandState commandState)
 {
 }
예제 #13
0
        /// <summary>
        /// Updates the view's commands</summary>
        /// <param name="commandTag">The command tag</param>
        /// <param name="state">State of the command</param>
        public void UpdateCommand(object commandTag, CommandState state)
        {
            
            if (commandTag is Command)
            {
                switch ((Command)commandTag)
                {
                   
                    case Command.SingleView:
                        state.Check = m_designView.ViewMode == ViewModes.Single;
                        break;

                    case Command.QuadView:
                        state.Check = m_designView.ViewMode == ViewModes.Quad;
                        break;

                    case Command.DualHorizontalView:
                        state.Check = m_designView.ViewMode == ViewModes.DualHorizontal;
                        break;

                    case Command.DualVerticalView:
                        state.Check = m_designView.ViewMode == ViewModes.DualVertical;
                        break;
                }
            }
        }
예제 #14
0
 /// <summary>
 /// Updates command state for given command</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="state">Command state to update</param>
 public void UpdateCommand(object commandTag, CommandState state)
 {
     Control control = commandTag as Control;
     if (control != null)
     {
         string menuText = GetControlMenuText(control);
         state.Text = menuText;
         DockContent dockContent = FindContent(control);
         state.Check = dockContent.Visible && !dockContent.IsHidden
             && !IsAutoHideState(dockContent);
     }
     else if (commandTag is StandardCommand)
     {
         if ( (StandardCommand) commandTag == StandardCommand.UILock)
         {
             state.Text = UILocked ? "Unlock UI Layout".Localize() : "Lock UI Layout".Localize();
             var cmdService = m_commandService as CommandServiceBase;
             if (cmdService != null)
             {
                 string lockImgName = UILocked ? Resources.LockUIImage : Resources.UnlockUIImage;
                 if (CommandInfo.UILock.ImageName != lockImgName)
                 {
                     CommandInfo.UILock.ImageName = lockImgName;
                     cmdService.RefreshImage(CommandInfo.UILock);                            
                     CommandInfo.UILock.GetButton().ToolTipText = state.Text;
                 }
             }
         }
     }
 }
예제 #15
0
        /// <summary>
        /// Updates command state for given command</summary>
        /// <param name="commandTag">Command</param>
        /// <param name="state">Command state to update</param>
        public virtual void UpdateCommand(object commandTag, CommandState state)
        {
            bool invertPinImageOnMouseover = false;
            bool useGreenPin = true;
            var  info        = commandTag as RecentDocumentInfo;

            if (info != null)
            {
                // For the document entries in the MRU, the pin color reflects the pinned state of
                // the item. The exception is when the user mouses over the pin icon directly - then
                // we invert the color of the pin to show that it's clickable and will modify the
                // pinned state of the document.
                invertPinImageOnMouseover = true;
                state.Text = info.Uri.LocalPath;
                if (!info.Pinned)
                {
                    useGreenPin = false;
                }
            }
            else if (commandTag is Command)
            {
                var command = (Command)commandTag;
                if (command == Command.Pin)
                {
                    // For the other pin commands, the pin color is the opposite of the active
                    // document's pinned state.
                    var docInfo   = GetActiveRecentDocumentInfo();
                    var stateText = "Pin active document".Localize();
                    if (docInfo != null)
                    {
                        useGreenPin = !docInfo.Pinned;
                        stateText   = string.Format(
                            docInfo.Pinned ?
                            "Unpin {0}".Localize("{0} will be replaced with a file name") :
                            "Pin {0}".Localize("{0} will be replaced with a file name"),
                            docInfo.Uri.AbsolutePath);
                    }
                    state.Text = stateText;
                }
                else if (command == Command.EmptyMru)
                {
                    return;
                }
            }

            var commandServiceBase = CommandService as CommandServiceBase;

            if (commandServiceBase != null)
            {
                var commandInfo = commandServiceBase.GetCommandInfo(commandTag);

                if (commandInfo != null)
                {
                    if (invertPinImageOnMouseover)
                    {
                        // Make sure user is mousing over this command.
                        if (commandServiceBase.MouseIsOverCommandIcon == commandInfo)
                        {
                            useGreenPin = !useGreenPin;
                        }
                    }

                    var imageName = useGreenPin ? Resources.PinGreenImage : Resources.PinGreyImage;
                    if (commandInfo.ImageName != imageName)
                    {
                        commandInfo.ImageName = imageName;
                        commandServiceBase.RefreshImage(commandInfo);
                    }
                }
            }
        }
예제 #16
0
 public virtual void UpdateCommand(object commandTag, CommandState commandState)
 {
     if ((commandTag is Command))
     {
         if ((Command)commandTag == Command.Enabled && SourceControlService != null)
         {
             commandState.Text = SourceControlService.Enabled ? "Disable Source Control".Localize() : "Enable Source Control".Localize();
         }
     }
 }
예제 #17
0
        /// <summary>
        /// Utility function to get the command's client and call UpdateCommand.</summary>
        /// <param name="commandTag">The command to update</param>
        /// <param name="state">Command's state</param>
        private void UpdatePinnableCommand(object commandTag, CommandState state)
        {
            ICommandClient client = GetClient(commandTag);
            if (client == null)
                client = m_activeClient;

            if (client != null && client.CanDoCommand(commandTag))
                client.UpdateCommand(commandTag, state);
        }
예제 #18
0
 /// <summary>
 /// Updates command state for given command</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="state">Command state to update</param>
 void ICommandClient.UpdateCommand(object commandTag, Sce.Atf.Applications.CommandState state)
 {
 }
예제 #19
0
        private void menuItem_MouseLeave(object sender, EventArgs e)
        {
            // clear status text
            if (m_statusService != null)
                m_statusService.ShowStatus(string.Empty);

            // Clear mouseover status
            m_menuMouseLocation = Point.Empty;
            m_mouseIsOverCommandIcon = null;

            var menuItem = sender as ToolStripMenuItem;
            if (menuItem != null)
            {
                object tag = menuItem.Tag;
                if ((tag != null) && (tag is IPinnable))
                {
                    CommandState commandState = new CommandState(menuItem.Text, menuItem.Checked);
                    UpdatePinnableCommand(tag, commandState);
                }
            }
        }
예제 #20
0
        private void menuItem_MouseMove(object sender, MouseEventArgs e)
        {
            m_menuMouseLocation = e.Location;
            
            var menuItem = sender as ToolStripMenuItem;
            if (menuItem != null)
            {
                object tag = menuItem.Tag;
                if ((tag != null) && (tag is IPinnable))
                {
                    if (IsMouseOverIcon(menuItem))
                        m_mouseIsOverCommandIcon = m_commandsById[tag];
                    else
                        m_mouseIsOverCommandIcon = null;

                    CommandState commandState = new CommandState(menuItem.Text, menuItem.Checked);
                    UpdatePinnableCommand(tag, commandState);
                }
            }
        }
예제 #21
0
        /// <summary>
        /// Force an update on a particular command</summary>
        /// <param name="info">Command to update</param>
        public void UpdateCommand(CommandInfo info)
        {
            if (m_mainForm.InvokeRequired)
            {
                m_mainForm.BeginInvoke(new Action<CommandInfo>(UpdateCommand), info);
                return;
            }

            ToolStripMenuItem menuItem;
            ToolStripButton menuButton;
            info.GetMenuItemAndButton(out menuItem, out menuButton);

            CommandState commandState = new CommandState();
            commandState.Text = info.DisplayedMenuText;
            commandState.Check = menuItem.Checked;

            ICommandClient client = GetClient(info.CommandTag);
            if (client == null)
                client = m_activeClient;

            bool enabled = false;
            if (client != null)
            {
                enabled = client.CanDoCommand(info.CommandTag);
                if (enabled)
                    client.UpdateCommand(info.CommandTag, commandState);
            }

            string menuText = commandState.Text.Trim();

            menuItem.Text = menuButton.Text = menuText;
            menuItem.Checked = menuButton.Checked = commandState.Check;
            menuItem.Enabled = menuButton.Enabled = enabled;
        }
예제 #22
0
 /// <summary>
 /// Updates command state for given command</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="state">Command state to update</param>
 public void UpdateCommand(object commandTag, CommandState state)
 {
     Control control = commandTag as Control;
     if (control != null)
     {
         string menuText = GetControlMenuText(control);
         state.Text = menuText;
         DockContent dockContent = FindContent(control);
         state.Check = dockContent.Visible && !dockContent.IsHidden;
     }
     else if (commandTag is StandardCommand)
     {
         if ( (StandardCommand) commandTag == StandardCommand.UILock)
         {
             state.Text = UILocked ? "Unlock UI Layout".Localize() : "Lock UI Layout".Localize();
         }
     }
 }
예제 #23
0
        /// <summary>
        /// Updates command state for given command</summary>
        /// <param name="commandTag">Command</param>
        /// <param name="state">Command state to update</param>
        public virtual void UpdateCommand(object commandTag, CommandState state)
        {
            bool invertPinImageOnMouseover = false;
            bool useGreenPin = true;
            var info = commandTag as RecentDocumentInfo;
            if (info != null)
            {
                // For the document entries in the MRU, the pin color reflects the pinned state of
                // the item. The exception is when the user mouses over the pin icon directly - then 
                // we invert the color of the pin to show that it's clickable and will modify the
                // pinned state of the document.
                invertPinImageOnMouseover = true;
                state.Text = info.Uri.LocalPath;
                if (!info.Pinned)
                {
                    useGreenPin = false;
                }
            }
            else if (commandTag is Command)
            {
                var command = (Command)commandTag;
                if (command == Command.Pin)
                {
                    // For the other pin commands, the pin color is the opposite of the active 
                    // document's pinned state.
                    var docInfo = GetActiveRecentDocumentInfo();
                    var stateText = "Pin active document".Localize();
                    if (docInfo != null)
                    {
                        useGreenPin = !docInfo.Pinned;
                        var docPath = docInfo.Uri.AbsolutePath;
                        if (MaxPathLength > 0 && docPath.Length > MaxPathLength)
                        {
                            docPath = docPath.Substring(docPath.Length - MaxPathLength);
                            while (!docPath.StartsWith("/"))
                                docPath = docPath.Substring(1);
                            docPath = "..." + docPath;
                        }
                        stateText = string.Format(
                            docInfo.Pinned ?
                                "Unpin {0}".Localize("{0} will be replaced with a file name") :
                                "Pin {0}".Localize("{0} will be replaced with a file name"),
                                docPath);
                    }
                    state.Text = stateText;
                }
                else if (command == Command.EmptyMru)
                {
                    return;
                }
            }

            var commandServiceBase = CommandService as CommandServiceBase;
            if (commandServiceBase != null)
            {
                var commandInfo = commandServiceBase.GetCommandInfo(commandTag);

                if (commandInfo != null)
                {
                    if (invertPinImageOnMouseover)
                    {
                        // Make sure user is mousing over this command.
                        if (commandServiceBase.MouseIsOverCommandIcon == commandInfo)
                        {
                            useGreenPin = !useGreenPin;
                        }
                    }

                    var imageName = useGreenPin ? Resources.PinGreenImage : Resources.PinGreyImage;
                    if (commandInfo.ImageName != imageName)
                    {
                        commandInfo.ImageName = imageName;
                        commandServiceBase.RefreshImage(commandInfo);
                    }
                }
            }
        }
 /// <summary>
 /// Updates command state for given command</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="commandState">Command info to update</param>
 void ICommandClient.UpdateCommand(object commandTag, CommandState commandState)
 {
 }
예제 #25
0
        /// <summary>
        /// Updates command state for given command</summary>
        /// <param name="commandTag">Command</param>
        /// <param name="state">Command state to update</param>
        public void UpdateCommand(object commandTag, CommandState state)
        {
            if (commandTag is CommandTag)
            {
               
                if (commandTag.Equals(CommandTag.ResetGroupPinNames))
                {
                    if (m_targetRef != null && m_targetRef.Target != null)
                    {
                        object target = m_targetRef.Target;
                        if (target.Is<Group>() && !CircuitUtil.IsTemplateTargetMissing(target))
                        {
                            if (!target.Is<IReference<DomNode>>())
                            {
                            var group = target.Cast<Group>();
                            state.Text = string.Format("Reset Pin Names on \"{0}\"".Localize(), group.Name);
                        }
                    }
                }
                }
                else if (commandTag.Equals(CommandTag.ShowExpandedGroupPins))
                {
                    if (m_targetRef != null && m_targetRef.Target != null)
                    {
                        object target = m_targetRef.Target;
                        if (target.Is<Group>())
                        {
                            var group = target.Cast<Group>();
                            state.Check = group.Info.ShowExpandedGroupPins;
                            state.Text = string.Format("Show Expanded Group Pins on \"{0}\"".Localize(), group.Name);
                        }
                    }
                }
                //else if (commandTag.Equals(CommandTag.HideUnconnectedPins))
                //{
                //    if (m_targetRef != null && m_targetRef.Target != null)
                //    {
                //        object target = m_targetRef.Target;
                //        if (target.Is<Group>() && !CircuitUtil.IsTemplateTargetMissing(target))
                //        {
                //            var group = target.Cast<Group>();
                //            var graphContainer = group.ParentGraph.As<ICircuitContainer>();
                //            if (graphContainer != null)
                //            {
                //                // check if all unconnected pins are hidden
                //                m_allUnconnectedHidden = true;
                //                foreach (var grpPin in group.InputGroupPins)
                //                {
                //                    bool externalConectd =
                //                        graphContainer.Wires.FirstOrDefault(
                //                            x => x.InputPinTarget.FullyEquals(grpPin.PinTarget)) != null;
                //                    if (!externalConectd && grpPin.Visible)
                //                    {
                //                        m_allUnconnectedHidden = false;
                //                        break;
                //                    }
                //                }
                //                if (m_allUnconnectedHidden)
                //                {
                //                    foreach (var grpPin in group.OutputGroupPins)
                //                    {
                //                        bool externalConectd =
                //                            graphContainer.Wires.FirstOrDefault(
                //                                x => x.OutputPinTarget.FullyEquals(grpPin.PinTarget)) != null;
                //                        if (!externalConectd && grpPin.Visible)
                //                        {
                //                            m_allUnconnectedHidden = false;
                //                            break;
                //                        }
                //                    }
                //                }

                //                state.Check = m_allUnconnectedHidden;
                //                state.Text = string.Format("Hide Unconnected Pins on \"{0}\"".Localize(), group.Name);
                //            }
                //        }
                //    }
                //}
            }
        }
예제 #26
0
 /// <summary>
 /// Update a command</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="state">Command state</param>
 public override void UpdateCommand(object commandTag, CommandState state)
 {
 }
예제 #27
0
        void ICommandClient.UpdateCommand(object commandTag, CommandState state)
        {
            if (!(commandTag is Command))
                return;

            if (SourceControlService == null)
                return;

            switch ((Command)commandTag)
            {
                case Command.Enabled:
                {
                    state.Text =
                        SourceControlService.Enabled
                            ? SourceControlEnabledText
                            : SourceControlDisabledText;

                    state.Check = SourceControlService.Enabled;

                    var image =
                        (SourceControlService.Enabled && SourceControlService.IsConnected)
                            ? m_go
                            : m_stop;

                    if (!ReferenceEquals(m_status.GetButton().Image, image))
                        m_status.GetButton().Image = image;
                }
                break;
            }
        }
예제 #28
0
        /// <summary>
        /// Updates command state for given command</summary>
        /// <param name="commandTag">Command</param>
        /// <param name="commandState">Command info to update</param>
        public void UpdateCommand(object commandTag, CommandState commandState)
        {
            TimelineDocument document = m_contextRegistry.GetActiveContext<TimelineDocument>();
            if (document == null)
                return;

            if (commandTag is Command)
            {
                switch ((Command)commandTag)
                {
                    case Command.ToggleSplitMode:
                        commandState.Check = document.SplitManipulator != null ? document.SplitManipulator.Active : false;
                        break;
                }
            }
        }
예제 #29
0
 /// <summary>
 /// Updates command state for given command</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="state">Command state to update. See <see cref="CommandState"/>.</param>
 public void UpdateCommand(object commandTag, CommandState state)
 {
 }
예제 #30
0
 /// <summary>
 /// Updates command state for given command</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="state">Command state to update</param>
 public void UpdateCommand(object commandTag, CommandState state)
 {
     Control control = commandTag as Control;
     if (control != null)
     {
         string menuText = GetControlMenuText(control);
         state.Text = menuText;
         DockContent dockContent = FindContent(control);
         state.Check = dockContent.Visible;
     }
 }
예제 #31
0
        private void LegacyUpdateCommand(ICommandItem item)
        {
            ICommandClient client = GetClient(item.CommandTag);
            if (client == null)
                client = m_activeClient;

            if (client != null)
            {
                var commandState = new CommandState { Text = item.Text, Check = item.IsChecked };
                client.UpdateCommand(item.CommandTag, commandState);
                item.Text = commandState.Text.Trim();
                item.IsChecked = commandState.Check;
            }
        }
예제 #32
0
        public void UpdateCommand(object commandTag, CommandState state)
        {
            if (!(commandTag is Command))
                return;

            switch ((Command)commandTag)
            {
                case Command.Toggle:
                {
                    state.Check = m_bMemoryTracerRunning;
                }
                    break;
            }
        }
예제 #33
0
        /// <summary>
        /// Updates the view's commands</summary>
        /// <param name="commandTag">The command tag</param>
        /// <param name="state">State of the command</param>
        public void UpdateCommand(object commandTag, CommandState state)
        {
            ISnapSettings snapSettings = (ISnapSettings)m_designView;
            IManipulator manip = commandTag as IManipulator;
            if(manip != null)
            {
                state.Check = manip == m_designView.Manipulator;
            }
            else if (commandTag is Command)
            {
                switch ((Command)commandTag)
                {
                    case Command.Select:
                        state.Check = m_designView.Manipulator == null;
                        break;

                    case Command.SnapToVertex:
                        state.Check = snapSettings.SnapVertex;
                        break;

                    case Command.RotateOnSnap:
                        state.Check = snapSettings.RotateOnSnap;
                        break;

                }
            }
        }
예제 #34
0
 /// <summary>
 /// Updates command state for given command</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="state">Command state to update</param>
 public virtual void UpdateCommand(object commandTag, CommandState state)
 {
     // Is it useful to see the OSC address in the context menu? These addresses can be long
     //  and make the context menu very wide.
     //if ((Command)commandTag == Command.CopyOscAddressOfPropertyDescriptor &&
     //    m_oscAddressOfPropertyDescriptor != null)
     //{
     //    state.Text = s_copyOscAddressText + m_oscAddressOfPropertyDescriptor;
     //}
 }
예제 #35
0
        /// <summary>
        /// Updates command state for given command. Only called if CanDoCommand is true.</summary>
        /// <param name="commandTag">Command</param>
        /// <param name="state">Command state to update</param>
        public void UpdateCommand(object commandTag, CommandState state)
        {
            if (!(commandTag is Command))
                return;

            if (m_designView == null)
                return;

            var designControl = m_designView.ActiveView;

            switch ((Command)commandTag)
            {
                case Command.Arcball:
                    state.Check = (designControl.CameraController is ArcBallCameraController);
                    break;

                case Command.Maya:
                    state.Check = (designControl.CameraController is MayaStyleCameraController);
                    break;

                case Command.Walk:
                    state.Check = (designControl.CameraController is WalkCameraController);
                    break;

                case Command.Fly:
                    state.Check = (designControl.CameraController is FlyCameraController);
                    break;
            }
        }
예제 #36
0
 /// <summary>
 /// Updates command state for given command</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="state">Command state to update</param>
 public virtual void UpdateCommand(object commandTag, CommandState state)
 {
 }
예제 #37
0
파일: Editor.cs 프로젝트: sbambach/ATF
 /// <summary>
 /// Updates command state for given command</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="commandState">Command info to update</param>
 public void UpdateCommand(object commandTag, CommandState commandState)
 {
 }
예제 #38
0
 void ICommandClient.UpdateCommand(object commandTag, CommandState commandState)
 {
     
 }
예제 #39
0
        void ICommandClient.UpdateCommand(object commandTag, CommandState commandState)
        {
            var target = TreeControlAdapter.LastHit;

            if (!(commandTag is Command))
            {
                var targetClient = target.As<ICommandClient>();
                if (targetClient != null)
                    targetClient.UpdateCommand(commandTag, commandState);
                return;
            }
        }
예제 #40
0
 /// <summary>
 /// Updates command state for given command</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="commandState">Command state to update</param>
 public void UpdateCommand(object commandTag, Sce.Atf.Applications.CommandState commandState) { }
예제 #41
0
        public void UpdateCommand(object commandTag, CommandState state)
        {
            if (!(commandTag is MruCommand))
                return;

            var mruCmd = (MruCommand)commandTag;
            var lstMru = GetMruList();
            
            var entry = lstMru[mruCmd.Index];

            state.Text =
                string.IsNullOrEmpty(entry)
                    ? string.Format("{0} ({1})", Localization.SledRecentProject, mruCmd.Index)
                    : entry;
        }