示例#1
0
        public void Load(ConfigNode parent)
        {
            InitCommands();
            InitFixedCommands();

            ConfigNode node = parent.FindChildConfigNode("key-definition");

            if (node != null)
            {
                IDictionaryEnumerator ie = node.GetPairEnumerator();
                while (ie.MoveNext())
                {
                    CID id = (CID)GUtil.ParseEnum(typeof(CID), (string)ie.Key, CID.NOP);
                    if (id == CID.NOP)
                    {
                        continue;
                    }
                    string value = (string)ie.Value;
                    Entry  e     = FindEntry(id);
                    Keys   t     = GUtil.ParseKey(value.Split(','));
                    e.Modifiers = t & Keys.Modifiers;
                    e.Key       = t & Keys.KeyCode;
                }
            }
        }
        private void ImportKeySettings(Hashtable values)
        {
            IDictionaryEnumerator ie = values.GetEnumerator();

            while (ie.MoveNext())
            {
                string name = (string)ie.Key;
                CID    cid  = (CID)GUtil.ParseEnum(typeof(CID), name, CID.NOP);
                if (cid != CID.NOP)
                {
                    Keys k = GUtil.ParseKey(((string)ie.Value).Split(','));
                    GApp.Options.Commands.ModifyKey(cid, k & Keys.Modifiers, k & Keys.KeyCode);
                }
            }
        }
        private void ImportTerminalSettings(Hashtable values)
        {
            ContainerOptions opt = GApp.Options;

            opt.LeftAltKey           = (AltKeyAction)GUtil.ParseEnum(typeof(AltKeyAction), (string)values["left-alt"], opt.LeftAltKey);
            opt.RightAltKey          = (AltKeyAction)GUtil.ParseEnum(typeof(AltKeyAction), (string)values["right-alt"], opt.RightAltKey);
            opt.AutoCopyByLeftButton = GUtil.ParseBool((string)values["auto-copy-by-left-button"], opt.AutoCopyByLeftButton);
            opt.RightButtonAction    = (RightButtonAction)GUtil.ParseEnum(typeof(RightButtonAction), (string)values["right-button"], opt.RightButtonAction);
            opt.TerminalBufferSize   = GUtil.ParseInt((string)values["buffer-size"], opt.TerminalBufferSize);
            string fontname    = (string)values["font-family"];
            string ja_fontname = (string)values["japanese-font-family"];
            float  size        = GUtil.ParseFloat((string)values["font-size"], opt.FontSize);

            opt.Font         = new Font(fontname, size);
            opt.JapaneseFont = new Font(ja_fontname, size);
            opt.UseClearType = GUtil.ParseBool((string)values["cleartype"], opt.UseClearType);
            opt.BGColor      = GUtil.ParseColor((string)values["bg-color"], opt.BGColor);
            opt.TextColor    = GUtil.ParseColor((string)values["text-color"], opt.TextColor);
            opt.ESColorSet.Load((string)values["escapesequence-color"]);
            opt.BackgroundImageFileName = (string)values["bg-image"];
            opt.ImageStyle          = (ImageStyle)GUtil.ParseEnum(typeof(ImageStyle), (string)values["bg-style"], opt.ImageStyle);
            opt.DefaultLogType      = (LogType)GUtil.ParseEnum(typeof(LogType), (string)values["default-log-type"], opt.DefaultLogType);
            opt.DefaultLogDirectory = (string)values["default-log-directory"];
        }