Ejemplo n.º 1
0
        public void Save(ConfigNode parent)
        {
            ConfigNode node = new ConfigNode("module");

            node["path"]  = _path;
            node["title"] = _title;
            node["debug"] = _debugMode.ToString();
            Commands.Entry e = GApp.Options.Commands.FindMacroEntry(this.Index);
            if (e != null)
            {
                node["shortcut"] = UILibUtil.KeyString(e.Modifiers, e.Key, ',');
            }
            node["additional-assemblies"] = Concat(_additionalAssemblies);
            parent.AddChild(node);
        }
Ejemplo n.º 2
0
        private void OnKeyMapItemActivated(object sender, EventArgs args)
        {
            if (_keyConfigList.SelectedItems.Count == 0)
            {
                return;
            }

            CID id = (CID)_keyConfigList.SelectedItems[0].Tag;

            Commands.Entry e = _commands.FindEntry(id);
            Debug.Assert(e != null);
            _hotKey.Key = e.Modifiers | e.Key;

            _commandName.Text          = String.Format("{0} - {1}", EnumDescAttribute.For(typeof(Commands.Category)).GetDescription(e.Category), e.Description);
            _currentCommand.Text       = e.KeyDisplayString;
            _allocateKeyButton.Enabled = true;
        }
Ejemplo n.º 3
0
        private void InitKeyConfigUI()
        {
            _keyConfigList.Items.Clear();
            IEnumerator ie = _commands.EnumEntries();

            while (ie.MoveNext())
            {
                Commands.Entry e = (Commands.Entry)ie.Current;
                if (e.Category == Commands.Category.Fixed)
                {
                    continue;
                }
                ListViewItem li = new ListViewItem(EnumDescAttribute.For(typeof(Commands.Category)).GetDescription(e.Category));
                li = _keyConfigList.Items.Add(li);
                li.SubItems.Add(e.Description);
                li.SubItems.Add(e.KeyDisplayString);
                li.Tag = e.CID;
            }
        }
Ejemplo n.º 4
0
        //マクロ編集フォームから呼ばれる。keyに割り当て済みのコマンド名があるならそれを返し、なければnullを返す。
        public string FindCommandDescription(Keys key)
        {
            MacroModule mod = (MacroModule)_keyToModule[key];

            if (mod != null)
            {
                return(mod.Title);
            }
            else
            {
                Commands.Entry e = GApp.Options.Commands.FindEntry(key);
                if (e != null && e.Category != Commands.Category.Macro)
                {
                    return(e.Description);
                }
                else
                {
                    return(null);
                }
            }
        }
Ejemplo n.º 5
0
        private void OnAllocateKey(object sender, EventArgs args)
        {
            if (_keyConfigList.SelectedItems.Count == 0)
            {
                return;
            }

            CID  id   = (CID)_keyConfigList.SelectedItems[0].Tag;
            Keys key  = _hotKey.Key;
            int  code = GUtil.KeyToControlCode(key);

            if (code != -1)
            {
                if (GUtil.AskUserYesNo(this, String.Format(GApp.Strings.GetString("Message.OptionDialog.AskOverwriteToASCIIInput"), _hotKey.Text, code)) == DialogResult.No)
                {
                    return;
                }
            }

            Commands.Entry existing = _commands.FindEntry(key);
            if (existing != null && existing.CID != id)
            {
                if (GUtil.AskUserYesNo(this, String.Format(GApp.Strings.GetString("Message.OptionDialog.AskOverwriteCommand"), existing.Description)) == DialogResult.No)
                {
                    return;
                }

                existing.Key       = Keys.None;
                existing.Modifiers = Keys.None;
                FindListViewItem(existing.CID).SubItems[2].Text = "";
            }

            //設定を書き換え
            Commands.Entry e = _commands.FindEntry(id);
            Debug.Assert(e != null);
            _commands.ModifyKey(e.CID, key & Keys.Modifiers, key & Keys.KeyCode);
            _keyConfigList.SelectedItems[0].SubItems[2].Text = e.KeyDisplayString;
        }
 public CommandResult Exec(Commands.Entry ent)
 {
     if (ent.Category == Commands.Category.Fixed)
     {
         int n = (int)(ent.CID - CID.ActivateConnection0);
         if (n < GEnv.Connections.Count)
         {
             return(ActivateConnection2(GEnv.Connections.TagAt(n)));
         }
         else
         {
             return(CommandResult.Ignored);
         }
     }
     else if (ent.Category == Commands.Category.Macro)
     {
         return(ExecMacro(((Commands.MacroEntry)ent).Index));
     }
     else
     {
         return(Exec(ent.CID));
     }
 }