//位置情報の保存と復元 //この正規表現で示される値で。例 (Max,0,0,1024,768) 位置に負の値を許すことに注意。 public static MainWindowArgument[] Parse(IWindowPreference pref) { int count = pref.WindowCount; //マッチしないときはデフォルト if (count == 0) { //初期状態で最小化は許さず MainWindowArgument arg = new MainWindowArgument(GetInitialLocation(), FormWindowState.Normal, "", "", 1); return(new MainWindowArgument[] { arg }); } else { //正規表現内のコメント: ソースを表示するフォント次第ではおかしいかも // (<FormWindowState>, left, , top, , width , height ) Regex re = new Regex("\\((Max,|Min,)?\\s*(-?[\\d]+)\\s*,\\s*(-?[\\d]+)\\s*,\\s*([\\d]+)\\s*,\\s*([\\d]+)\\)"); MainWindowArgument[] result = new MainWindowArgument[count]; for (int i = 0; i < count; i++) { string positions = pref.WindowPositionAt(i); Match m = re.Match(positions); GroupCollection gc = m.Groups; Debug.Assert(gc.Count == 6); //自身と子要素5つ //なお、最小化したまま終了しても次回起動時はノーマルサイズで。 result[i] = new MainWindowArgument( ParseRectangle(gc[2].Value, gc[3].Value, gc[4].Value, gc[5].Value), gc[1].Value == "Max," ? FormWindowState.Maximized : FormWindowState.Normal, //カンマつきに注意 pref.WindowSplitFormatAt(i), pref.ToolBarFormatAt(i), pref.TabRowCountAt(i)); } return(result); } }
private MainWindow CreateMainWindow(MainWindowArgument arg) { if (InvisibleMode) { arg = new MainWindowArgument(arg.Location, FormWindowState.Minimized, arg.SplitInfo, arg.ToolBarInfo, arg.TabRowCount); } MainWindow w = new MainWindow(arg, _menu); w.Text = "Poderosa"; w.FormClosed += new FormClosedEventHandler(WindowClosedHandler); w.Activated += delegate(object sender, EventArgs args) { _activeWindow = (MainWindow)sender; //最後にアクティブになったものを指定する }; if (InvisibleMode) { w.WindowState = FormWindowState.Minimized; w.ShowInTaskbar = false; } w.Show(); return(w); }
public IPoderosaMainWindow CreateNewWindow(MainWindowArgument arg) { MainWindow newWindow = CreateMainWindow(arg); _windows.Add(newWindow); return(newWindow); }
private MainWindow CreateMainWindow(MainWindowArgument arg) { MainWindow w = new MainWindow(arg, _menu); w.Text = "Poderosa"; w.FormClosed += new FormClosedEventHandler(WindowClosedHandler); w.Activated += delegate(object sender, EventArgs args) { _activeWindow = (MainWindow)sender; //最後にアクティブになったものを指定する }; w.Show(); return(w); }
public MainWindow(MainWindowArgument arg, MainWindowMenu menu) { _argument = arg; Debug.Assert(_argument != null); _commandKeyHandler.AddLastHandler(new FixedShortcutKeyHandler(this)); this.ImeMode = ImeMode.NoControl; this.AllowDrop = true; InitContent(); ReloadMenu(menu, true); }
public MainWindow(MainWindowArgument arg, MainWindowMenu menu) { _argument = arg; Debug.Assert(_argument != null); _commandKeyHandler.AddLastHandler(new FixedShortcutKeyHandler(this)); this.ImeMode = ImeMode.NoControl; this.AllowDrop = true; arg.ApplyToUnloadedWindow(this); InitContent(); ReloadMenu(menu, true); }
public MainWindow CreateLibraryMainWindow() { MainWindowArgument arg = MainWindowArgument.Parse(_preferences)[0]; MainWindow w = new MainWindow(arg, _menu); w.Text = "Poderosa"; w.FormClosed += new FormClosedEventHandler(WindowClosedHandler); w.Activated += delegate(object sender, EventArgs args) { _activeWindow = (MainWindow)sender; //最後にアクティブになったものを指定する }; _windows.Add(w); //w.Show(); return(w); }
public MainWindow(MainWindowArgument arg, MainWindowMenu menu) { _argument = arg; Debug.Assert(_argument != null); _commandKeyHandler.AddLastHandler(new FixedShortcutKeyHandler(this)); this.ImeMode = ImeMode.NoControl; #if MONOLITHICLIBRARY this.AllowDrop = false; #else this.AllowDrop = true; #endif arg.ApplyToUnloadedWindow(this); InitContent(); ReloadMenu(menu, true); }
public void RunExtension() { try { _poderosaWorld.Culture.SetCulture(CoreServicePreferenceAdapter.LangToCulture(_preferences.OriginalPreference.Language)); MainWindowArgument[] args = MainWindowArgument.Parse(_preferences); foreach (MainWindowArgument arg in args) { _windows.Add(CreateMainWindow(arg)); } if (GetStartMode() == StartMode.StandAlone) { Application.Run(_appContext); IPoderosaApplication app = (IPoderosaApplication)_poderosaWorld.GetAdapter(typeof(IPoderosaApplication)); app.Shutdown(); } } catch (Exception ex) { RuntimeUtil.ReportException(ex); } }
private MainWindow CreateMainWindow(MainWindowArgument arg) { MainWindow w = new MainWindow(arg, _menu); w.Text = "Poderosa"; w.FormClosed += new FormClosedEventHandler(WindowClosedHandler); w.Activated += delegate(object sender, EventArgs args) { _activeWindow = (MainWindow)sender; //最後にアクティブになったものを指定する }; w.Show(); return w; }
public void CreateNewWindow(MainWindowArgument arg) { _windows.Add(CreateMainWindow(arg)); }
//位置情報の保存と復元 //この正規表現で示される値で。例 (Max,0,0,1024,768) 位置に負の値を許すことに注意。 public static MainWindowArgument[] Parse(IWindowPreference pref) { int count = pref.WindowCount; //マッチしないときはデフォルト if (count == 0) { //初期状態で最小化は許さず MainWindowArgument arg = new MainWindowArgument(GetInitialLocation(), FormWindowState.Normal, "", "", 1); return new MainWindowArgument[] { arg }; } else { //正規表現内のコメント: ソースを表示するフォント次第ではおかしいかも // (<FormWindowState>, left, , top, , width , height ) Regex re = new Regex("\\((Max,|Min,)?\\s*(-?[\\d]+)\\s*,\\s*(-?[\\d]+)\\s*,\\s*([\\d]+)\\s*,\\s*([\\d]+)\\)"); MainWindowArgument[] result = new MainWindowArgument[count]; for (int i = 0; i < count; i++) { string positions = pref.WindowPositionAt(i); Match m = re.Match(positions); GroupCollection gc = m.Groups; Debug.Assert(gc.Count == 6); //自身と子要素5つ //なお、最小化したまま終了しても次回起動時はノーマルサイズで。 result[i] = new MainWindowArgument( ParseRectangle(gc[2].Value, gc[3].Value, gc[4].Value, gc[5].Value), gc[1].Value == "Max," ? FormWindowState.Maximized : FormWindowState.Normal, //カンマつきに注意 pref.WindowSplitFormatAt(i), pref.ToolBarFormatAt(i), pref.TabRowCountAt(i)); } return result; } }
private MainWindow CreateMainWindow(MainWindowArgument arg) { if (InvisibleMode) { arg = new MainWindowArgument(arg.Location, FormWindowState.Minimized, arg.SplitInfo, arg.ToolBarInfo, arg.TabRowCount); } MainWindow w = new MainWindow(arg, _menu); w.Text = "Poderosa"; w.FormClosed += new FormClosedEventHandler(WindowClosedHandler); w.Activated += delegate(object sender, EventArgs args) { _activeWindow = (MainWindow)sender; //�Ō�ɃA�N�e�B�u�ɂȂ�����̂�w�肷�� }; if (InvisibleMode) { #if TERMCONTROL w.Opacity = 0; #endif w.WindowState = FormWindowState.Minimized; w.ShowInTaskbar = false; } w.Show(); return w; }
public void ApplyArgumentToLoadedWindow(MainWindowArgument arg) { const int MARGIN = 3; Rectangle titlebarRect = new Rectangle(arg.Location.X + MARGIN, arg.Location.Y + MARGIN, Math.Max(arg.Location.Width - MARGIN * 2, 1), Math.Max(SystemInformation.CaptionHeight - MARGIN * 2, 1)); bool visible = false; foreach (Screen s in Screen.AllScreens) { if (s.WorkingArea.IntersectsWith(titlebarRect)) { visible = true; } } Rectangle location = new Rectangle(arg.Location.Location, arg.Location.Size); if (!visible) { Screen baseScreen = null; foreach (Screen s in Screen.AllScreens) { if (s.Bounds.IntersectsWith(arg.Location)) { baseScreen = s; break; } } if (baseScreen == null) { baseScreen = Screen.PrimaryScreen; } Rectangle sb = baseScreen.WorkingArea; if (location.Width > sb.Width) { location.Width = sb.Width; } if (location.Height > sb.Height) { location.Height = sb.Height; } location.X = sb.X + (sb.Width - arg.Location.Width) / 2; location.Y = sb.Y + (sb.Height - arg.Location.Height) / 2; } //DesktopBoundsの設定はOnLoadの中じゃないといかんらしい DesktopBounds = location; WindowState = arg.WindowState; //頑張ればOnLoad以前にSplitInfoを適用できるかも if (arg.SplitInfo.Length > 0) { ISplittableViewManager vm = (ISplittableViewManager)ViewManager.GetAdapter(typeof(ISplittableViewManager)); if (vm != null) { vm.ApplySplitInfo(arg.SplitInfo); } } //ToolBarのコンポーネント位置調整 ToolBarInternal.RestoreLayout(); }
public void ApplyArgumentToLoadedWindow(MainWindowArgument arg) { const int MARGIN = 3; Rectangle titlebarRect = new Rectangle(arg.Location.X + MARGIN, arg.Location.Y + MARGIN, Math.Max(arg.Location.Width - MARGIN * 2, 1), Math.Max(SystemInformation.CaptionHeight - MARGIN * 2, 1)); bool visible = false; foreach (Screen s in Screen.AllScreens) { if (s.WorkingArea.IntersectsWith(titlebarRect)) visible = true; } Rectangle location = new Rectangle(arg.Location.Location, arg.Location.Size); if (!visible) { Screen baseScreen = null; foreach (Screen s in Screen.AllScreens) { if (s.Bounds.IntersectsWith(arg.Location)) { baseScreen = s; break; } } if (baseScreen == null) baseScreen = Screen.PrimaryScreen; Rectangle sb = baseScreen.WorkingArea; if (location.Width > sb.Width) location.Width = sb.Width; if (location.Height > sb.Height) location.Height = sb.Height; location.X = sb.X + (sb.Width - arg.Location.Width) / 2; location.Y = sb.Y + (sb.Height - arg.Location.Height) / 2; } //DesktopBounds�̐ݒ��OnLoad�̒�����Ȃ��Ƃ�����炵�� DesktopBounds = location; WindowState = arg.WindowState; //�撣���OnLoad�ȑO��SplitInfo��K�p�ł��邩�� if (arg.SplitInfo.Length > 0) { ISplittableViewManager vm = (ISplittableViewManager)ViewManager.GetAdapter(typeof(ISplittableViewManager)); if (vm != null) vm.ApplySplitInfo(arg.SplitInfo); } //ToolBar�̃R���|�[�l���g�ʒu���� ToolBarInternal.RestoreLayout(); }
//�ʒu���̕ۑ��ƕ��� //���̐��K�\���Ŏ������l�ŁB�� (Max,0,0,1024,768) �ʒu�ɕ��̒l��������Ƃɒ��ӁB public static MainWindowArgument[] Parse(IWindowPreference pref) { int count = pref.WindowCount; //�}�b�`���Ȃ��Ƃ��̓f�t�H���g if (count == 0) { //������Ԃōŏ����͋����� MainWindowArgument arg = new MainWindowArgument(GetInitialLocation(), FormWindowState.Normal, "", "", 1); return new MainWindowArgument[] { arg }; } else { //���K�\����̃R�����g: �\�[�X��\������t�H���g����ł͂����������� // (<FormWindowState>, left, , top, , width , height ) Regex re = new Regex("\\((Max,|Min,)?\\s*(-?[\\d]+)\\s*,\\s*(-?[\\d]+)\\s*,\\s*([\\d]+)\\s*,\\s*([\\d]+)\\)"); MainWindowArgument[] result = new MainWindowArgument[count]; for (int i = 0; i < count; i++) { string positions = pref.WindowPositionAt(i); Match m = re.Match(positions); GroupCollection gc = m.Groups; Debug.Assert(gc.Count == 6); //���g�Ǝq�v�f�T�� //�Ȃ��A�ŏ��������܂I�����Ă����N�����̓m�[�}���T�C�Y�ŁB result[i] = new MainWindowArgument( ParseRectangle(gc[2].Value, gc[3].Value, gc[4].Value, gc[5].Value), gc[1].Value == "Max," ? FormWindowState.Maximized : FormWindowState.Normal, //�J���}���ɒ��� pref.WindowSplitFormatAt(i), pref.ToolBarFormatAt(i), pref.TabRowCountAt(i)); } return result; } }
public IPoderosaMainWindow CreateNewWindow(MainWindowArgument arg) { MainWindow newWindow = CreateMainWindow(arg); _windows.Add(newWindow); return newWindow; }
private MainWindow CreateMainWindow(MainWindowArgument arg) { MainWindow w = new MainWindow(arg, _menu); w.Text = "Poderosa"; w.FormClosed += new FormClosedEventHandler(WindowClosedHandler); w.Activated += delegate(object sender, EventArgs args) { _activeWindow = (MainWindow)sender; //�Ō�ɃA�N�e�B�u�ɂȂ�����̂�w�肷�� }; w.Show(); return w; }
private static CommandResult CmdNewWindow(ICommandTarget target) { IPoderosaMainWindow window = CommandTargetUtil.AsWindow(target); Form f = window.AsForm(); Rectangle location = f.WindowState == FormWindowState.Normal ? f.DesktopBounds : f.RestoreBounds; location.X += 20; location.Y += 20; //少し右下に表示 MainWindowArgument arg = new MainWindowArgument(location, FormWindowState.Normal, "", "", 1); WindowManagerPlugin.Instance.CreateNewWindow(arg); return CommandResult.Succeeded; }