Exemple #1
0
        public void Import(ConfigNode data)
        {
            CommonOptions opt = GEnv.Options;

            _fontName = data["font-name"];
            if (_fontName == null)
            {
                _fontName = opt.FontName;
            }
            _japaneseFontName = data["japanese-font-name"];
            if (_japaneseFontName == null)
            {
                _japaneseFontName = opt.JapaneseFontName;
            }
            _fontSize     = (float)GUtil.ParseInt(data["font-size"], 10);
            _useClearType = GUtil.ParseBool(data["clear-type"], false);
            ClearFont();

            unchecked {
                _forecolor = Color.FromArgb(GUtil.ParseHexInt(data["fore-color"], (int)0xFF000000));
                _bgcolor   = Color.FromArgb(GUtil.ParseHexInt(data["back-color"], (int)0xFFFFFFFF));
            }
            if (_esColorSet == null)
            {
                _esColorSet = (EscapesequenceColorSet)opt.ESColorSet.Clone();
            }
            _esColorSet.Load(data["color-sequence"]);
            ClearBrush();

            _backgroundImageFileName = data["image-file"];
            _imageLoadIsAttempted    = false;
            _imageStyle = (ImageStyle)EnumDescAttribute.For(typeof(ImageStyle)).FromName(data["bg-style"], ImageStyle.Center);
        }
        public override sealed void Load(ConfigNode parent)
        {
            ConfigNode node = parent.FindChildConfigNode("poderosa-container");

            if (node != null)
            {
                //基本のアトリビュート
                foreach (ConfigElementAttribute attr in _configAttributes)
                {
                    attr.ImportFrom(this, node);
                }
            }

            //frame stateは別の扱い
            string frame_pos    = node == null? null : node.GetValue("framePosition", null);
            bool   frame_filled = false;

            if (_frameState == FormWindowState.Normal && frame_pos != null)
            {
                string[] t = frame_pos.Split(',');
                if (t.Length == 4)
                {
                    _framePosition.X      = GUtil.ParseInt(t[0], 0);
                    _framePosition.Y      = GUtil.ParseInt(t[1], 0);
                    _framePosition.Width  = GUtil.ParseInt(t[2], 640);
                    _framePosition.Height = GUtil.ParseInt(t[3], 480);

                    frame_filled = true;
                }
            }

            if (!frame_filled)
            {
                if (_frameState == FormWindowState.Minimized)
                {
                    _frameState = FormWindowState.Normal;                                                        //最小化で起動しても仕方ないのでノーマルにする
                }
                Rectangle r = Screen.PrimaryScreen.Bounds;
                _framePosition.X      = r.Width / 6;
                _framePosition.Y      = r.Height / 6;
                _framePosition.Width  = r.Width * 2 / 3;
                _framePosition.Height = r.Height * 2 / 3;
            }

            _commands = new Commands();
            _commands.Load(parent);

            base.Load(parent);
        }
        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"];
        }