Beispiel #1
0
 public PtxToolButton(PtCommand cmd)
 {
     m_Command = cmd;
     m_Button = new ToolBarButton();
     m_Button.Text = m_Command.DisplayName;
     m_Command.AddObserver(this);
 }
Beispiel #2
0
 public void AddButtonToToolBar(PtCommand cmd)
 {
     if (null == cmd) return;
     PtxToolButton button = new PtxToolButton(cmd);
     m_ToolBar.Buttons.Add(button.Button);
     m_ButtonList.Add(button);
 }
        public CommandResolver()
        {
            m_CommandList = new FRList<PtCommand>();

            m_SelectCmd = PtApp.Get().GetCommand("SelectCmd");
            if (m_SelectCmd != null) m_SelectCmd.OnCommand();
        }
 private void AddCommand(int index, PtCommand cmd)
 {
     if(cmd != null)
     {
         PtxMenuItem item = new PtxMenuItem(cmd);
         m_ContextMenu.MenuItems.Add(item.GetMenuItem());
      }
 }
Beispiel #5
0
        public void AddCommand(PtCommand command)
        {
            if(!m_CommandManager.ExistsCommand(command.GetInternalName()))
            {
                m_CommandManager.AddCommand(command);
            }

            m_Commands.Add(command.GetInternalName());
        }
 public void AddCommand(PtCommand command)
 {
     // We don't want to add two commands with the same internal name.
     bool bExist = m_Commands[command.GetInternalName()] != null;
     Debug.Assert(!bExist
         , "There already exist the command with the same internal name ["
         + command.GetInternalName() + "]");
     if (!bExist)
         m_Commands.Add(command.GetInternalName(), command);
 }
Beispiel #7
0
 public PtxMenuItem(PtCommand cmd)
 {
     m_Command = cmd;
     m_MenuItem = new MenuItem(m_Command.DisplayName);
     m_MenuItem.Click += new System.EventHandler(OnClick);
 }
Beispiel #8
0
 public PtxMenuItem(string DisplayName)
 {
     m_MenuItem = new MenuItem(DisplayName);
     m_Command = null;
 }
        // There are two kinds of command
        // 1.	Database command, It will change the database. Such as create line, circle.
        // 2.	Non-database command, It won¡¯t change the database. Such as view commands.
        //
        // Currently, we only support 2-depth command nested. It means there are
        // two commands in the stack at most. Their combination is [db cmd, non-db cmd].
        //
        // The following work flow is used to process the nested commands.
        // 1.	If the command stack isn¡¯t empty.
        //      A)	If the new command is database command, terminate all the commands,
        //          including all the database command and non-database command,  in the stack.
        //          Such as [Line (, Pan)] ->Circle => [Circle].
        //      B)	If the new command is non-database command, terminate all the
        //          non-database commands in the stack if there is. The database command will be left
        //          if there is. Such as [(Line ,) Pan] ->Zoom =>[(Line,) Zoom].
        //
        // 2.	Active this command and add it to the stack.
        //
        //
        // The entry of all the commands
        public void OnCommand(PtCommand Command)
        {
            if(!m_CommandList.Empty())
            {
                if (Command.IsDatabaseCommand)
                    TerminateAllStackCommands();
                else
                    TerminateNonDatabaseCommands();
            }

            // Start the command
            bool bSuc = Command.OnCommand();
            if (!bSuc)
                Command.Terminate();
            else
                m_CommandList.Add(Command);
        }