Exemple #1
0
        private void ShowProp(int index)
        {
            MacroModule           mod = GApp.MacroManager.GetModule(index);
            Keys                  key = Keys.None;
            IDictionaryEnumerator ie  = _keyToModule.GetEnumerator();

            while (ie.MoveNext())
            {
                if (ie.Value == mod)
                {
                    key = (Keys)(ie.Key);
                    break;
                }
            }

            ModuleProperty dlg = new ModuleProperty(this, mod, key);

            if (GCUtil.ShowModalDialog(this, dlg) == DialogResult.OK)
            {
                GApp.MacroManager.ReplaceModule(GApp.MacroManager.GetModule(index), dlg.Module);
                GApp.Options.Commands.ModifyMacroKey(dlg.Module.Index, dlg.ShortCut & Keys.Modifiers, dlg.ShortCut & Keys.KeyCode);
                ListViewItem li = _list.Items[index];
                li.Text             = dlg.Module.Title;
                li.SubItems[1].Text = dlg.Module.Path;
                li.SubItems[2].Text = UILibUtil.KeyString(dlg.ShortCut);
                li.SubItems[3].Text = GetInfoString(dlg.Module);
                _keyToModule.Remove(key);
                if (dlg.ShortCut != Keys.None)
                {
                    _keyToModule.Add(dlg.ShortCut, dlg.Module);
                }

                AdjustUI();
            }
        }
        public ModuleProperty(MacroList p, MacroModule mod, Keys shortcut)
        {
            _parent       = p;
            _prevShortCut = shortcut;
            _module       = mod == null? new MacroModule(0) : (MacroModule)mod.Clone();
            //
            // Windows フォーム デザイナ サポートに必要です。
            //
            InitializeComponent();

            this._titleLabel.Text = GApp.Strings.GetString("Form.ModuleProperty._titleLabel");
            this._pathLabel.Text  = GApp.Strings.GetString("Form.ModuleProperty._pathLabel");
            this._additionalAssemblyLabel.Text = GApp.Strings.GetString("Form.ModuleProperty._additionalAssemblyLabel");
            this._shortcutLabel.Text           = GApp.Strings.GetString("Form.ModuleProperty._shortcutLabel");
            this._debugOption.Text             = GApp.Strings.GetString("Form.ModuleProperty._debugOption");
            this._okButton.Text     = GApp.Strings.GetString("Common.OK");
            this._cancelButton.Text = GApp.Strings.GetString("Common.Cancel");
            this.Text = GApp.Strings.GetString("Form.ModuleProperty.Text");

            if (mod != null)
            {
                _title.Text = _module.Title;
                _path.Text  = _module.Path;
                _additionalAssembly.Text = Concat(_module.AdditionalAssemblies);
                _debugOption.Checked     = _module.DebugMode;
                _shortcut.Key            = shortcut;
            }
        }
Exemple #3
0
        private void AddListItem(MacroModule mod, Keys shortcut)
        {
            ListViewItem li = new ListViewItem(mod.Title);

            li = _list.Items.Add(li);
            li.SubItems.Add(mod.Path);
            li.SubItems.Add(UILibUtil.KeyString(shortcut & Keys.Modifiers, shortcut & Keys.KeyCode, '+'));
            li.SubItems.Add(GetInfoString(mod));
        }
Exemple #4
0
        private void OnUpButtonClicked(object sender, EventArgs args)
        {
            int n = _list.SelectedItems[0].Index;

            if (n == 0)
            {
                return;
            }

            ListViewItem li = _list.Items[n];

            _list.Items.RemoveAt(n);
            _list.Items.Insert(n - 1, li);
            MacroModule mod = GApp.MacroManager.GetModule(n);

            GApp.MacroManager.RemoveAt(n);
            GApp.MacroManager.InsertModule(n - 1, mod);
            _macroOrderUpdated = true;
        }
Exemple #5
0
        private void OnDeleteButtonClicked(object sender, EventArgs args)
        {
            MacroModule mod = GApp.MacroManager.GetModule(_list.SelectedItems[0].Index);

            GApp.MacroManager.RemoveModule(mod);
            IDictionaryEnumerator ie = _keyToModule.GetEnumerator();

            while (ie.MoveNext())
            {
                if (ie.Value == mod)
                {
                    _keyToModule.Remove(ie.Key);
                    break;
                }
            }
            _list.Items.Remove(_list.SelectedItems[0]);
            _macroOrderUpdated = true;
            AdjustUI();
        }
Exemple #6
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);
                }
            }
        }
Exemple #7
0
 private string GetInfoString(MacroModule mod)
 {
     return(mod.DebugMode? GApp.Strings.GetString("Caption.MacroList.Trace") : "");            //とりあえずはデバッグかどうかだけ
 }