public void FormKeyAction(ScriptWindowActionId id) { if (InvokeRequired) { Invoke((FormKeyActionHandler)FormKeyAction, id); return; } switch (id) { case ScriptWindowActionId.FormExit: Hide(); FormUiManager.MainFrameMenuBarUpdate(); break; case ScriptWindowActionId.OpenScriptDirectory: System.Diagnostics.Process.Start(GetScriptRootPath()); break; } if (DockPanel_Main.GetActiveDocumentControl() is ScriptWindow_CodeEditor editor) { editor.FormKeyAction(id); } }
private void UpdateCurrentEditorStatus() { var editor = DockPanel_Main.GetActiveDocumentControl() as ScriptWindow_CodeEditor; UpdateEditorCursorStatus(editor); UpdateEditorScriptStatus(editor); }
private void MenuBar_Script_Stop_Click(object sender, EventArgs e) { if (DockPanel_Main.GetActiveDocumentControl() is ScriptWindow_CodeEditor editor) { editor.ScriptStop(); } }
private void LoadFileExplorerConfig() { DC_FileExplorer = new FileExplorerEx(); DC_FileExplorer.FileDoubleClick += OnFileDoubleClick; var root_path = GetScriptRootPath(); /* スクリプトディレクトリが存在しない場合はテンプレートを出力 */ if (!Directory.Exists(root_path)) { Directory.CreateDirectory(root_path); File.WriteAllText(GetScriptFilePath("SampleScript.gds"), Ratatoskr.Properties.Resources.Sample); } DC_FileExplorer.RootUrl = root_path; DockPanel_Main.AddDockContent( "DC_FileExplorer", "File Explorer", 0, Icon.FromHandle(Ratatoskr.Resource.Images.memo_32x32.GetHicon()), DockAreas.DockLeft | DockAreas.DockRight | DockAreas.DockBottom | DockAreas.Float, DockState.DockLeft, false, DC_FileExplorer); }
private void OpenScriptFile(string path) { var editor = GetOpenedScriptEditor(path); if (editor != null) { DockPanel_Main.SetActiveDocumentControl(editor); return; } editor = new ScriptWindow_CodeEditor(); editor.BorderStyle = BorderStyle.None; editor.Tag = path; editor.ScriptPath = path; editor.EditorStatusUpdated += OnEditorStatusUpdated; editor.ScriptMessageAppended += OnScriptMessageOutput; editor.ScriptStatusChanged += OnScriptStatusChanged; /* 新しいタブでテキストを開く */ DockPanel_Main.AddDockContent( "DC_CodeEditor", (path != null) ? (Path.GetFileName(path)) : ("(Temp)"), 0, Icon.FromHandle(Ratatoskr.Resource.Images.memo_32x32.GetHicon()), DockAreas.Document, DockState.Document, true, editor); }
private void BackupDockConfig() { var config_dock = ConfigManager.GetCurrentProfileFilePath(CONFIG_FILE_NAME); if (config_dock != null) { Directory.CreateDirectory(Path.GetDirectoryName(config_dock)); DockPanel_Main.SaveAsXml(config_dock); } }
private string GetCurrentScript() { if (DockPanel_Main.GetActiveDocumentControl() is CodeEditorEx dock) { return(dock.Text); } else { return(null); } }
private ScriptWindow_CodeEditor GetOpenedScriptEditor(string path) { foreach (ScriptWindow_CodeEditor editor in DockPanel_Main.GetDocumentControls()) { if (editor.ScriptPath == path) { return(editor); } } return(null); }
private void BackupConfig_OpenText() { ConfigManager.User.Script_OpenFileList.Value.Clear(); foreach (ScriptWindow_CodeEditor editor in DockPanel_Main.GetDocumentControls()) { /* 現在の状態を保存 */ editor.SaveScriptFile(); /* 開いているスクリプトを保存 */ ConfigManager.User.Script_OpenFileList.Value.Add(editor.ScriptPath); } }
public void LoadConfig() { LoadMenuBarConfig(); LoadFileExplorerConfig(); LoadScriptListConfig(); LoadConsoleConfig(); LoadConfig_OpenText(); UpdateCurrentEditorStatus(); DockPanel_Main.ShowContents(); }
private void OnScriptMessageClear(object sender, EventArgs e) { if (InvokeRequired) { Invoke((EventHandler)OnScriptMessageClear, sender, e); return; } if (sender == (DockPanel_Main.GetActiveDocumentControl() as CodeEditorEx)) { DC_Console.ClearMessage(); } }
private void OnScriptMessageOutput(object sender, ScriptMessageData msg) { if (InvokeRequired) { Invoke((ScriptMessageAppendedHandler)OnScriptMessageOutput, sender, msg); return; } if (sender == (DockPanel_Main.GetActiveDocumentControl() as CodeEditorEx)) { DC_Console.AddMessage(msg); } }
private void LoadConsoleConfig() { DC_Console = new ScriptWindow_Console(); DockPanel_Main.AddDockContent( "DC_Console", "Output", 0, Icon.FromHandle(Ratatoskr.Resource.Images.program_16x16.GetHicon()), DockAreas.DockLeft | DockAreas.DockRight | DockAreas.DockBottom | DockAreas.Float, DockState.DockBottom, false, DC_Console); }
private void LoadScriptListConfig() { DC_ScriptList = new ScriptWindow_ScriptList(); DC_ScriptList.LoadConfig(); DockPanel_Main.AddDockContent( "DC_ScriptList", "Running Script List", 0, Icon.FromHandle(Ratatoskr.Resource.Images.memo_32x32.GetHicon()), DockAreas.DockLeft | DockAreas.DockRight | DockAreas.DockBottom | DockAreas.Float, DockState.DockBottom, false, DC_ScriptList); }
public void LoadDockPanelConfig() { DockPanel_Main.ClearDockContents(); DockPanel_Main.AddDockContent( "MFDC_SendDataListPanel_Control", ConfigManager.Language.MainUI.MCmdPanel_Title.Value, (uint)DockContentsGroup.Fixed, Icon.FromHandle(Ratatoskr.Resource.Images.memo_32x32.GetHicon()), DockAreas.Document | DockAreas.DockLeft | DockAreas.DockRight | DockAreas.DockBottom | DockAreas.Float, DockState.DockBottomAutoHide, false, MFDC_SendDataListPanel_Control = new MainWindow_SendDataListPanel()); #if false //#if DEBUG DockPanel_Main.AddDockContent( "MFDC_SendTrafficPanel_Control", ConfigManager.Language.MainUI.STPanel_Title.Value, (uint)DockContentsGroup.Fixed, Icon.FromHandle(Ratatoskr.Resource.Images.memo_32x32.GetHicon()), DockAreas.Document | DockAreas.DockLeft | DockAreas.DockRight | DockAreas.DockBottom | DockAreas.Float, DockState.Document, false, MFDC_SendTrafficPanel_Control = new MainWindow_SendTrafficPanel()); #endif DockPanel_Main.AddDockContent( "MFDC_WatchListPanel", ConfigManager.Language.MainUI.WLPanel_Title.Value, (uint)DockContentsGroup.Fixed, Icon.FromHandle(Ratatoskr.Resource.Images.watch_32x32.GetHicon()), DockAreas.Document | DockAreas.DockLeft | DockAreas.DockRight | DockAreas.DockBottom | DockAreas.Float, DockState.DockBottomAutoHide, false, MFDC_WatchListPanel_Control = new MainWindow_WatchListPanel()); MFDC_SendDataListPanel_Control.LoadConfig(); #if false //#if DEBUG MFDC_SendTrafficPanel_Control.LoadConfig(); #endif MFDC_WatchListPanel_Control.LoadConfig(); }
public void LoadConfig() { LoadMenuBarConfig(); LoadFileExplorerConfig(); LoadScriptListConfig(); LoadConsoleConfig(); LoadConfig_OpenText(); UpdateCurrentEditorStatus(); Location = ConfigManager.System.ScriptWindow.Position.Value; Size = ConfigManager.System.ScriptWindow.Size.Value; if (ConfigManager.System.ScriptWindow.Maximize.Value) { WindowState = FormWindowState.Maximized; } DockPanel_Main.ShowContents(); }
private void LoadDockConfig() { /* 設定ファイルから復元 */ try { DockPanel_Main.ShowContents(ConfigManager.GetCurrentProfileFilePath(CONFIG_FILE_NAME, true)); } catch (Exception) { } /* 設定ファイルから復元できなかったものはデフォルト値で初期化 */ // foreach (var content in DockPanel_Main.GetDockContents()) { // if (content.DockState == DockState.Unknown) { // content.Show(DockPanel_Main, content.DefaultDockState); // } // } /* --- 自前で初期化 --- */ // MFDC_CmdListPanel.Show(DockPanel_Main, DockState.DockBottomAutoHide); // MFDC_RedirectListPanel.Show(DockPanel_Main, DockState.DockBottomAutoHide); // MFDC_DataListPanel.Show(DockPanel_Main, DockState.DockBottomAutoHide); }
public void AddPacketView(Guid class_id, Guid obj_id, PacketViewProperty viewp, bool init) { var viewc = FormTaskManager.CreatePacketView(class_id, obj_id, viewp); if (viewc == null) { return; } /* Graphオブジェクトのレイアウトが何故か復元できないので、とりあえずパケットビューだけ復元対象から外す */ DockPanel_Main.AddDockContent( viewc.Instance.ID.ToString(), // viewc.Instance.ID.ToString() + (new Random()).Next(0, 99999).ToString(), viewc.Instance.Class.Name, (uint)DockContentsGroup.PacketView, Icon.FromHandle(Ratatoskr.Resource.Images.packet_view_16x16.GetHicon()), DockAreas.Document, DockState.Document, true, viewc); }
public void ClearPacketView() { DockPanel_Main.RemoveDockContents((uint)DockContentsGroup.PacketView); }