Beispiel #1
0
        public void Attach(ITerminalControlHost session)
        {
            _session = session;
            SetContent(session.Terminal.GetDocument());

            ITerminalEmulatorOptions opt = TerminalEmulatorPlugin.Instance.TerminalEmulatorOptions;

            _caret.Blink = opt.CaretBlink;
            _caret.Color = opt.CaretColor;
            _caret.Style = opt.CaretType;
            _caret.Reset();

            //KeepAliveタイマ起動は最も遅らせた場合でココ
            TerminalEmulatorPlugin.Instance.KeepAlive.Refresh(opt.KeepAliveInterval);

            //ASCIIWordBreakTable : 今は共有設定だが、Session固有にデータを持つようにするかもしれない含みを持たせて。
            ASCIIWordBreakTable table = ASCIIWordBreakTable.Default;

            table.Reset();
            foreach (char ch in opt.AdditionalWordElement)
            {
                table.Set(ch, ASCIIWordBreakTable.LETTER);
            }

            lock (GetDocument()) {
                _ignoreValueChangeEvent = true;
                _session.Terminal.CommitScrollBar(_VScrollBar, false);
                _ignoreValueChangeEvent = false;

                if (!IsConnectionClosed())
                {
                    Size ts = CalcTerminalSize(GetRenderProfile());

                    //TODO ネゴ開始前はここを抑制したい
                    if (ts.Width != GetDocument().TerminalWidth || ts.Height != GetDocument().TerminalHeight)
                    {
                        ResizeTerminal(ts.Width, ts.Height);
                    }
                }
            }
            Invalidate(true);
        }
        //必ずimportされるという前提なのでちょっと危険
        public void OnPreferenceImport(IPreferenceFolder oldvalues, IPreferenceFolder newvalues)
        {
            ITerminalEmulatorOptions opt = (ITerminalEmulatorOptions)newvalues.QueryAdapter(typeof(ITerminalEmulatorOptions));

            //DefaultRenderProfile
            GEnv.DefaultRenderProfile = opt.CreateRenderProfile();

            //必要なTerminalSessionにApplyTerminalOptions
            ISessionManager sm = TerminalEmulatorPlugin.Instance.GetSessionManager();

            foreach (ISession session in sm.AllSessions)
            {
                IAbstractTerminalHost ts = (IAbstractTerminalHost)session.GetAdapter(typeof(IAbstractTerminalHost));
                if (ts != null)
                {
                    TerminalControl tc = ts.TerminalControl;
                    if (tc != null)
                    {
                        tc.ApplyTerminalOptions(opt);
                    }
                }
            }

            //ASCIIWordBreakTable
            ASCIIWordBreakTable table = ASCIIWordBreakTable.Default;

            table.Reset();
            foreach (char ch in opt.AdditionalWordElement)
            {
                table.Set(ch, ASCIIWordBreakTable.LETTER);
            }

            //キーバインド系をリセット
            TerminalEmulatorPlugin.Instance.CustomKeySettings.Reset(opt);

            //KeepAliveのリフレッシュ
            TerminalEmulatorPlugin.Instance.KeepAlive.Refresh(opt.KeepAliveInterval);

            _originalOptions.ResetParseKeyFlag();
        }