static SphereCameraController( ) { Commands = new CommandGroup( "sphereCameraCommands", "Spherical Camera Commands", CommandRegistry.Instance ); Rotate = Commands.NewCommand( "rotate", "Rotate", "Rotates the camera" ); Pan = Commands.NewCommand( "pan", "Pan", "Pans the camera" ); Zoom = Commands.NewCommand( "zoom", "Zoom", "Zooms the camera in and out" ); }
/// <summary> /// Removes a group of commands from the UI /// </summary> /// <param name="group">Group of commands to remove</param> public void RemoveCommands( CommandGroup group ) { foreach ( CommandGroup subGroup in group.SubGroups ) { RemoveCommands( subGroup ); } RemoveCommands( group.Commands ); }
/// <summary> /// Initializes test data /// </summary> public TestCommandTriggerDataSerialization( ) { m_Formatter = new BinaryFormatter( null, CommandSerializationContext.ToStreamingContext( m_UserRegistry, m_CommandRegistry ) ); m_Commands = new CommandGroup( "testCommands", "", m_CommandRegistry ); m_Command0 = m_Commands.NewCommand( "cmd0", "", "" ); m_UserRegistry.Register( m_User ); }
/// <summary> /// Adds a group of commands to the UI /// </summary> /// <param name="group">Group of commands to add</param> public void AddCommands( CommandGroup group ) { Arguments.CheckNotNull( group, "group" ); foreach ( CommandGroup subGroup in group.SubGroups ) { AddCommands( subGroup ); } AddCommands( group.Commands ); }
static TrackingCameraCommands( ) { Commands = new CommandGroup( "trackingCamera", "Tracking Camera Commands", CommandRegistry.Instance ); Zoom = Commands.NewCommand( "zoom", "Zoom", "Zooms the camera in and out" ); ZoomIn = Commands.NewCommand( "zoomIn", "Zoom In", "Zooms the camera in" ); ZoomOut = Commands.NewCommand( "zoomOut", "Zoom Out", "Zooms the camera out" ); Pan = Commands.NewCommand( "pan", "Pan", "Pans the camera" ); Rotate = Commands.NewCommand( "rotate", "Rotate", "Rotates the camera" ); }
/// <summary> /// Setup constructor. Group is a child of a parent group /// </summary> /// <param name="parentGroup">Parent group. Can't be null</param> /// <param name="commandGroupName">Command group name</param> /// <param name="commandGroupLocName">Command group localised name</param> public CommandGroup( CommandGroup parentGroup, string commandGroupName, string commandGroupLocName ) { Arguments.CheckNotNull( parentGroup, "parentGroup" ); Arguments.CheckNotNullOrEmpty( commandGroupName, "commandGroupName" ); m_Name = commandGroupName; m_LocName = commandGroupLocName; m_Registry = parentGroup.m_Registry; m_ParentGroup = parentGroup; m_ParentGroup.m_SubGroups.Add( this ); }
/// <summary> /// Setup constructor /// </summary> public ControlViewInfo( string name, CreateViewDelegate createView, CommandGroup showCommandGroup ) { Arguments.CheckNotNull( createView, "createView" ); m_Name = name; m_CreateView = createView; if ( showCommandGroup != null ) { m_ShowCommand = showCommandGroup.NewCommand( name, name, name ); } }
static DefaultCommands( ) { s_FileCommands = new WorkspaceCommandGroup( 0, "file", "&File", CommandRegistry.Instance ); s_ViewCommands = new WorkspaceCommandGroup( "view", "&View", CommandRegistry.Instance ); s_ViewRenderingCommands = new CommandGroup( s_ViewCommands, "rendering", "&Rendering" ); s_HelpCommands = new WorkspaceCommandGroup( "help", "&Help", CommandRegistry.Instance ); s_FileExit = WorkspaceCommand.NewCommand( s_FileCommands, "exit", "E&xit", "Exits this application" ); s_ViewOutput = WorkspaceCommand.NewCommand( s_ViewCommands, "output", "&Output", "Output view" ); s_HelpAbout = WorkspaceCommand.NewCommand( s_HelpCommands, "about", "&About", "Information about this application" ); s_ViewRenderingRenderTargets = WorkspaceCommand.NewCommand( s_ViewRenderingCommands, "renderTargets", "&Render Targets", "Shows render targets" ); }
static FirstPersonCameraCommands( ) { Commands = new CommandGroup( "fpCamCommands", "First Person Camera Commands", CommandRegistry.Instance ); Forwards = Commands.NewCommand( "forwards", "Forwards", "Moves forwards" ); Backwards = Commands.NewCommand( "backwards", "Backwards", "Moves backwards" ); PitchUp = Commands.NewCommand( "pitchUp", "Pitch up", "Pitches the camera up" ); PitchDown = Commands.NewCommand( "pitchDown", "Pitch down", "Pitches the camera down" ); RollClockwise = Commands.NewCommand( "rollClockwise", "Roll clockwise", "Rolls the camera clockwise" ); RollAnticlockwise = Commands.NewCommand( "rollAnticlockwise", "Roll anticlockwise", "Rolls the camera anti-clockwise" ); ; YawLeft = Commands.NewCommand( "yawLeft", "Yaw left", "Yaws the camera left" ); YawRight = Commands.NewCommand( "yawRight", "Yaw right", "Yaws the camera right" ); SlipLeft = Commands.NewCommand( "slipLeft", "Slip left", "Slips the camera left" ); SlipRight = Commands.NewCommand( "slipRight", "Slip right", "Slips the camera right" ); Turn = Commands.NewCommand( "turn", "Turn", "Turns the camera" ); }
/// <summary> /// Adds a command to the menu /// </summary> private void AddCommand( CommandGroup[] groups, Command command ) { if ( m_CommandMenuMap.ContainsKey( command ) ) { return; } ToolStripItemCollection menuItems = m_Menu.Items; for ( int groupIndex = 0; groupIndex < groups.Length; ++groupIndex ) { ToolStripMenuItem subMenu = null; foreach ( ToolStripItem item in menuItems ) { if ( item.Tag == groups[ groupIndex ] ) { subMenu = ( ToolStripMenuItem )item; break; } } if ( subMenu == null ) { subMenu = new ToolStripMenuItem( groups[ groupIndex ].NameUi ); subMenu.Tag = groups[ groupIndex ]; menuItems.Insert( GetCommandGroupInsertPosition( groups[ groupIndex ], menuItems ), subMenu ); } menuItems = subMenu.DropDownItems; } ToolStripItem commandItem = new ToolStripMenuItem( command.NameUi ); commandItem.Tag = command; commandItem.Click += OnCommandItemClicked; menuItems.Insert( 0, commandItem ); m_CommandMenuMap.Add( command, commandItem ); }
/// <summary> /// Returns the sortable value of a command group /// </summary> private static int GetCommandGroupOrdinal( CommandGroup group ) { WorkspaceCommandGroup workspaceGroup = group as WorkspaceCommandGroup; return workspaceGroup == null ? WorkspaceCommandGroup.LastOrdinal : workspaceGroup.Ordinal; }
/// <summary> /// Returns the position in a menu item set that a command group should be inserted at /// </summary> private static int GetCommandGroupInsertPosition( CommandGroup group, ToolStripItemCollection menuItems ) { int ordinal = GetCommandGroupOrdinal( group ); int index = 0; foreach ( ToolStripMenuItem menuItem in menuItems ) { if ( !( menuItem.Tag is CommandGroup ) ) { // TODO: AP: Commands should have ordinals too return index; } if ( GetCommandGroupOrdinal( ( CommandGroup )menuItem.Tag ) >= ordinal ) { return index; } ++index; } return index; }
/// <summary> /// Setup constructor with explicit dock state and a show command created in the specified command group /// </summary> public DockingViewInfo( string name, CreateViewDelegate createView, CommandGroup showCommandGroup, DockState defaultDockState ) : base(name, createView, showCommandGroup) { m_DefaultDockState = defaultDockState; }
/// <summary> /// Setup constructor with show command created in the specified group /// </summary> public DockingViewInfo( string name, CreateViewDelegate createView, CommandGroup showCommandGroup ) : this(name, createView, showCommandGroup, DockState.Float) { }
/// <summary> /// Setup constructor /// </summary> public HostedViewInfo( string name, CreateViewDelegate createView, CommandGroup showCommandGroup ) : base(name, createView, showCommandGroup) { }
private static CommandGroup Create( CommandGroup parentList, string name, string locName ) { return new CommandGroup( parentList, name, locName ); }