public PrepareCloseResult PrepareCloseDocument(IPoderosaDocument document) { Debug.Assert(document==_document); //閉じるのをキャンセルするテスト IPoderosaForm f = _host.GetParentFormFor(document); DialogResult r = f.AskUserYesNo("Close?"); return r==DialogResult.Yes? PrepareCloseResult.ContinueSession : PrepareCloseResult.Cancel; //return PrepareCloseResult.TerminateSession; }
//SessionHostから呼ばれる系列 public void RegisterDocument(IPoderosaDocument document, SessionHost sessionHost) { _documentMap.Add(document, new DocumentHost(this, sessionHost, document)); }
public void InternalDetachView(IPoderosaDocument document, IPoderosaView view) { _view = null; }
public void OnDocumentActivated(IPoderosaMainWindow window, IPoderosaDocument document) { //Debug.WriteLine("OnDocumentActivated"); TerminalToolBarInstance tb = FindToolbarInstance(window); if (tb == null) { tb = new TerminalToolBarInstance(this, window.ToolBar); _toolbarInstances[window] = tb; //TODO コレクションの削除がない! } IAbstractTerminalHost session = (IAbstractTerminalHost)document.OwnerSession.GetAdapter(typeof(IAbstractTerminalHost)); if (session != null) tb.Attach(session.TerminalSettings); }
private static TabKey DocumentToKey(IPoderosaDocument doc) { return new InternalTabKey(doc); }
public void Add(IPoderosaDocument document) { _tabBarTable.AddTab(DocumentToKey(document)); }
public static void InvokeClose(IPoderosaDocument document) { MacroPlugin.Instance.WindowManager.ActiveWindow.AsForm().Invoke(new DocDelegate(CloseDoc), document); }
public IPoderosaForm GetParentFormFor(IPoderosaDocument document) { DocumentHost dh = _parent.FindDocumentHost(document); Debug.Assert(dh != null, "document must be alive"); IPoderosaView view = dh.LastAttachedView; if (view != null) return view.ParentForm; //これが存在するならOK else return WindowManagerPlugin.Instance.ActiveWindow; //ちょっと反則気味の取り方だが }
public DocActivationMenuItem(int index, IPoderosaMainWindow window, IPoderosaDocument document) { _mainWindow = window; _index = index; _document = document; }
public void OnDocumentActivated(IPoderosaMainWindow window, IPoderosaDocument document) { this.SetDocument(window, document); this.Update(window); }
public InternalTabKey(IPoderosaDocument doc) : base(doc) { _document = doc; }
private static TabKey DocumentToKey(IPoderosaDocument doc) { return(new InternalTabKey(doc)); }
public void Remove(IPoderosaDocument document) { _tabBarTable.RemoveTab(DocumentToKey(document), false); }
public void Add(IPoderosaDocument document) { _tabBarTable.AddTab(DocumentToKey(document)); }
public int IndexOf(IPoderosaDocument document) { return(_tabBarTable.IndexOf(DocumentToKey(document))); }
private void NotifyActivation(IPoderosaForm form, IPoderosaDocument document, ActivateReason reason) { Debug.Assert(document != null); IPoderosaMainWindow window = (IPoderosaMainWindow)form.GetAdapter(typeof(IPoderosaMainWindow)); if (window != null) { //Tabへの通知。TabClickのときはTabが自前で処理してるのでOK if (reason != ActivateReason.TabClick) window.DocumentTabFeature.Activate(document); //listenerへの通知 foreach (IActiveDocumentChangeListener listener in _activeDocumentChangeListeners) listener.OnDocumentActivated(window, document); } }
private void NotifyRemove(IPoderosaForm form, IPoderosaDocument document) { IPoderosaMainWindow window = (IPoderosaMainWindow)form.GetAdapter(typeof(IPoderosaMainWindow)); if (window != null) { IPoderosaDocument former = window.DocumentTabFeature.ActiveDocument; window.DocumentTabFeature.Remove(document); //TODO アクティブなのを記憶する場所を変えることでタブへの通知を先にする制約から解放される if (former == document) { foreach (IActiveDocumentChangeListener listener in _activeDocumentChangeListeners) listener.OnDocumentDeactivated(window); } } }
public void InternalDetachView(IPoderosaDocument document, IPoderosaView view) { Debug.Assert(document == _document); _view.Attach(this, null); _view = null; }
public DocumentHost(SessionManagerPlugin manager, SessionHost sessionHost, IPoderosaDocument document) { _manager = manager; _sessionHost = sessionHost; _document = document; }
//SessionHostから呼ばれる系列 public void RegisterDocument(IPoderosaDocument document, SessionHost sessionHost) { _documentMap.Add(document, new DocumentHost(this, sessionHost, document)); }
private static void CloseDoc(IPoderosaDocument document) { MacroPlugin.Instance.SessionManager.CloseDocument(document); }
public DocumentHost FindDocumentHost(IPoderosaDocument document) { return(_documentMap[document]); }
public void Remove(IPoderosaDocument document) { _tabBarTable.RemoveTab(DocumentToKey(document), false); }
public void RegisterDocument(IPoderosaDocument document) { _parent.RegisterDocument(document, this); _documents.Add(document); }
public InternalTabKey(IPoderosaDocument doc) : base(doc) { _document = doc; }
public void CloseDocument(IPoderosaDocument document) { Debug.Assert(_documents.Contains(document)); _session.InternalCloseDocument(document); _documents.Remove(document); }
public void ApplySplitInfo(string format) { try { //�����l�� IPoderosaView[] previous_views = GetAllViews(); IPoderosaDocument[] documents = new IPoderosaDocument[previous_views.Length]; //�����K�p��A�N�e�B�u�ɂȂ��� for (int i = 0; i < previous_views.Length; i++) documents[i] = previous_views[i].Document; IPoderosaView[] new_views; SessionManagerPlugin sm = SessionManagerPlugin.Instance; if (format.Length > 0) { Form container = _parent.AsForm(); container.SuspendLayout(); Control old_root = this.RootControl; _paneDivision.ApplySplitInfo(old_root.Parent, old_root, format, delegate(string label) { return CreateNewPane(_defaultViewFactory, DockStyle.Fill); }); //�Ƃ肠�����f�t�H���g�t�@�N�g���ō쐬 container.ResumeLayout(true); _singlePane = null; //�������ɏI������Ƃ��̂� new_views = GetAllViews(); //�V�����̂�擾 } else { IContentReplaceableView view; UnifyAll(out view); new_views = new IPoderosaView[] { view }; } //�����h�L�������g�ɍēK�p foreach (DocumentHost dh in sm.GetAllDocumentHosts()) { int index = CollectionUtil.ArrayIndexOf(previous_views, dh.LastAttachedView); if (index != -1) { IPoderosaView new_view = index < new_views.Length ? new_views[index] : new_views[0]; //������������擪�� dh.AlternateView(new_view); } } //��Ƃ��Active���������ēK�p for (int i = 0; i < documents.Length; i++) { if (documents[i] != null) sm.AttachDocumentAndView(documents[i], sm.FindDocumentHost(documents[i]).LastAttachedView); //LastAttachedView�͂��̏�̃��[�v�œK�p�ς� } } catch (Exception ex) { RuntimeUtil.ReportException(ex); } }
public DocumentHost(SessionManagerPlugin manager, SessionHost sessionHost, IPoderosaDocument document) { _manager = manager; _sessionHost = sessionHost; _document = document; }
/** * Activate処理のルート * NOTE 重複コールはここでブロックするようにする。 * アクティブなドキュメントが変化するのは、 * - Viewをクリックしてフォーカスが変わるとき * - タブをクリックしたとき * - キーボードショートカット等、Poderosaのコードが発動するとき * の3つ。 * そのうちのどれであるかを指定してここを呼ぶ。例えば、Focus移動のときは改めてFocus()を呼ばないなど内部で場合分けがなされる */ public void ActivateDocument(IPoderosaDocument document, ActivateReason reason) { Debug.Assert(document != null); //ネストの防止 Focus系イベントハンドラがあるとどうしても呼ばれてしまうので if (_activateContext != null) return; try { _activateContext = new ActivateContext(document, reason); DocumentHost dh = FindDocumentHost(document); Debug.Assert(dh != null); if (dh.CurrentView != null) { //既に見えている場合 if (reason != ActivateReason.ViewGotFocus) SetFocusToView(dh.CurrentView); //ユーザのフォーカス指定だった場合はそれに任せる } else { //見えてはいなかった場合 IPoderosaView view = dh.LastAttachedView; Debug.Assert(view != null); //これを強制する仕組みをどこかにほしいかも。今はすべてのDocumentが最初にAttachDocumentAndViewされることを想定している AttachDocumentAndView(document, view); Debug.Assert(dh.CurrentView == view); if (!view.AsControl().Focused) view.AsControl().Focus(); } Debug.Assert(dh.CurrentView.Document == document); //通知 NotifyActivation(ViewToForm(dh.CurrentView), document, reason); } finally { _activateContext = null; if (DebugOpt.DumpDocumentRelation) DumpDocumentRelation(); } }
public ActivateContext(IPoderosaDocument document, ActivateReason reason) { _document = document; _reason = reason; }
public DocumentHost FindDocumentHost(IPoderosaDocument document) { return _documentMap[document]; }
public void OnDocumentActivated(IPoderosaMainWindow window, IPoderosaDocument document) { window.ToolBar.RefreshComponent(this); }
private void NotifyAdd(IPoderosaForm form, IPoderosaDocument document) { IPoderosaMainWindow window = (IPoderosaMainWindow)form.GetAdapter(typeof(IPoderosaMainWindow)); if (window != null) window.DocumentTabFeature.Add(document); }
public PrepareCloseResult PrepareCloseDocument(IPoderosaDocument document) { return(PrepareCloseResult.TerminateSession); }
public void RegisterDocument(IPoderosaDocument document) { _parent.RegisterDocument(document, this); _documents.Add(document); }
public void InternalAttachView(IPoderosaDocument document, IPoderosaView view) { _view = (PoderosaLogViewControl)view.GetAdapter(typeof(PoderosaLogViewControl)); Debug.Assert(_view != null); _view.SetParent(this); }
public void CloseDocument(IPoderosaDocument document) { Debug.Assert(_documents.Contains(document)); _session.InternalCloseDocument(document); _documents.Remove(document); }
public void InternalDetachView(IPoderosaDocument document, IPoderosaView view) { Debug.WriteLineIf(DebugOpt.LogViewer, "LogView InternalDetach"); _view = null; }
public ActivateContext(IPoderosaDocument document, ActivateReason reason) { _document = document; _reason = reason; }
public void InternalCloseDocument(IPoderosaDocument document) { }
private static void ActivateDoc(IPoderosaDocument document) { MacroPlugin.Instance.SessionManager.ActivateDocument(document, ActivateReason.InternalAction); }
public PrepareCloseResult PrepareCloseDocument(IPoderosaDocument document) { Debug.Assert(document == _terminal.IDocument); return(PrepareCloseResult.TerminateSession); }
//SessionManager����̂ĂԂ��� public void Activate(IPoderosaDocument document) { #if DEBUG Debug.Assert(document == null || _tabBarTable.ContainsKey(DocumentToKey(document))); #endif if (document == KeyToDocument(_tabBarTable.ActiveTabKey)) return; //do nothing if (document == null) _tabBarTable.Deactivate(false); else _tabBarTable.Activate(DocumentToKey(document), false); }
public void InternalCloseDocument(IPoderosaDocument document) { //do nothing }
public int IndexOf(IPoderosaDocument document) { return _tabBarTable.IndexOf(DocumentToKey(document)); }
private static void CloseDoc(IPoderosaDocument document) { MacroPlugin.Instance.SessionManager.CloseDocument(document); }
public void Update(IPoderosaDocument document) { if (_tabBarTable.InvokeRequired) { _tabBarTable.Invoke(new UpdateDelegate(Update), document); return; } _tabBarTable.UpdateDescription(DocumentToKey(document)); //�C�x���g�����ʒm��������̂ł�����Ɖߏ�ȏ������� if (document == this.ActiveDocument) SessionManagerPlugin.Instance.ActivateDocument(document, ActivateReason.InternalAction); }
private static void ActivateDoc(IPoderosaDocument document) { MacroPlugin.Instance.SessionManager.ActivateDocument(document, ActivateReason.InternalAction); }
private static IPoderosaDocument[] KeysToDocuments(TabKey[] keys) { IPoderosaDocument[] r = new IPoderosaDocument[keys.Length]; for (int i = 0; i < r.Length; i++) r[i] = KeyToDocument(keys[i]); return r; }
public static void InvokeClose(IPoderosaDocument document) { MacroPlugin.Instance.WindowManager.ActiveWindow.AsForm().Invoke(new DocDelegate(CloseDoc), document); }
public void OnDocumentActivated(IPoderosaMainWindow window, IPoderosaDocument document) { window.AsForm().Text = String.Format("{0} - Poderosa", document.Caption); }
public PrepareCloseResult CloseMultipleDocuments(ClosingContext context, IPoderosaDocument[] documents) { List<SessionHost> sessions = CreateSessionHostCollection(); foreach (SessionHost sh in sessions) sh.CMP_ClosingDocumentCount = 0; //カウントリセット foreach (IPoderosaDocument doc in documents) { DocumentHost dh = FindDocumentHost(doc); dh.SessionHost.CMP_ClosingDocumentCount++; } //ここまでで、各SessionHostごとに何個のドキュメントを閉じようとしているかがカウントされた。 //次にそれぞれについて処理をはじめる PrepareCloseResult result = PrepareCloseResult.TerminateSession; foreach (SessionHost sh in sessions) { if (sh.CMP_ClosingDocumentCount == 0) continue; //影響なし if (sh.CMP_ClosingDocumentCount == sh.DocumentCount) { //セッションの全ドキュメントを閉じる場合 PrepareCloseResult r = TerminateSession(sh.Session); sh.CMP_PrepareCloseResult = r; if (r == PrepareCloseResult.TerminateSession) context.AddClosingSession(sh); else if (r == PrepareCloseResult.Cancel) result = PrepareCloseResult.Cancel; //一個でもキャンセルがあれば全体をキャンセルとする } else { //一部のドキュメントを閉じる。これが面倒 //TODO unsupported Debug.Assert(false, "unsupported"); } } //それらについてセッションを閉じる foreach (SessionHost sh in context.ClosingSessions) { CleanupSession(sh); } return result; }
public DocActivationMenuItem(int index, IPoderosaMainWindow window, IPoderosaDocument document) { _mainWindow = window; _index = index; _document = document; }
public void RefreshDocumentStatus(IPoderosaDocument document) { DocumentHost dh = FindDocumentHost(document); Debug.Assert(dh != null); IPoderosaForm f = ViewToForm(dh.LastAttachedView); //ちょっと汚い分岐 IPoderosaMainWindow mw = (IPoderosaMainWindow)f.GetAdapter(typeof(IPoderosaMainWindow)); if (mw != null) mw.DocumentTabFeature.Update(document); else ((IPoderosaPopupWindow)f.GetAdapter(typeof(IPoderosaPopupWindow))).UpdateStatus(); }
public void OnDocumentActivated(IPoderosaMainWindow window, IPoderosaDocument document) { if (window != null && window.ToolBar != null) window.ToolBar.RefreshComponent(this); }
public void OnDocumentActivated(IPoderosaMainWindow window, IPoderosaDocument document) { window.AsForm().Text = String.Format("{0} - Poderosa", document.Caption); }