public TargetInfo(ICommandTarget cmd, Vector3 fstOffset, float standoffDistance) { Target = cmd; //Destination = cmd.Position + fstOffset; _fstOffset = fstOffset; CloseEnoughDistance = cmd.Radius + standoffDistance; CloseEnoughDistanceSqrd = CloseEnoughDistance * CloseEnoughDistance; }
public RPlotHistoryVisualComponent(IRPlotManager plotManager, ICommandTarget controller, IVisualComponentContainer<IRPlotHistoryVisualComponent> container, ICoreShell coreShell) { if (plotManager == null) { throw new ArgumentNullException(nameof(plotManager)); } if (container == null) { throw new ArgumentNullException(nameof(container)); } if (coreShell == null) { throw new ArgumentNullException(nameof(coreShell)); } _plotManager = plotManager; _viewModel = new RPlotHistoryViewModel(plotManager, coreShell); _shell = coreShell; var control = new RPlotHistoryControl { DataContext = _viewModel }; _disposableBag = DisposableBag.Create<RPlotDeviceVisualComponent>() .Add(() => control.ContextMenuRequested -= Control_ContextMenuRequested); control.ContextMenuRequested += Control_ContextMenuRequested; Control = control; Controller = controller; Container = container; }
//コンテキストメニュー表示 public void ShowContextMenu(IPoderosaMenuGroup[] menus, ICommandTarget target, Point point_screen, ContextMenuFlags flags) { //まずソート ICollection sorted = PositionDesignationSorter.SortItems(menus); ContextMenuStrip cm = new ContextMenuStrip(); MenuUtil.BuildContextMenu(cm, new ConvertingEnumerable<IPoderosaMenuGroup>(sorted), target); if (cm.Items.Count == 0) { cm.Dispose(); return; } //キーボード操作をトリガにメニューを出すときは、選択があったほうが何かと操作しやすい。 if ((flags & ContextMenuFlags.SelectFirstItem) != ContextMenuFlags.None) cm.Items[0].Select(); // ContextMenuStrip is not disposed automatically and // its instance sits in memory till application end. // To release a document object related with some menu items, // we need to dispose ContextMenuStrip explicitly soon after it disappeared. cm.VisibleChanged += new EventHandler(ContextMenuStripVisibleChanged); try { cm.Show(this, this.PointToClient(point_screen)); } catch (Exception ex) { RuntimeUtil.ReportException(ex); } }
public static void SetCommandTarget(ITextView textView, ICommandTarget target) { var proxy = ServiceManager.GetService<CommandTargetProxy>(textView); if (proxy != null) { proxy._commandTarget = target; ServiceManager.RemoveService<CommandTargetProxy>(textView); } }
/// <summary> /// Constructor /// </summary> /// <param name="target">target object</param> /// <param name="data">data to send to the terminal</param> /// <param name="repeat">repeat count to send data</param> public DataLoadBenchmark(ICommandTarget target, byte[] data, int repeat) : base(target) { _data = data; _repeat = repeat; _socket = new MockSocket(); _connection = new MockTerminalConnection("xterm", _socket); }
private static int BuildMenuContentsForGroup(int index, ICommandTarget target, ToolStripItemCollection children, IPoderosaMenuGroup grp) { int count = 0; foreach (IPoderosaMenu m in grp.ChildMenus) { ToolStripMenuItem mi = new ToolStripMenuItem(); children.Insert(index++, mi); //途中挿入のことも mi.DropDownOpening += new EventHandler(OnPopupMenu); mi.Enabled = m.IsEnabled(target); mi.Checked = mi.Enabled ? m.IsChecked(target) : false; mi.Text = m.Text; //Enabledを先に mi.Tag = new MenuItemTag(grp, m, target); IPoderosaMenuFolder folder; IPoderosaMenuItem leaf; if ((folder = m as IPoderosaMenuFolder) != null) { BuildMenuContents(mi, folder); } else if ((leaf = m as IPoderosaMenuItem) != null) { mi.Click += new EventHandler(OnClickMenu); IGeneralCommand gc = leaf.AssociatedCommand as IGeneralCommand; if (gc != null) mi.ShortcutKeyDisplayString = WinFormsUtil.FormatShortcut(CommandManagerPlugin.Instance.CurrentKeyBinds.GetKey(gc)); } count++; } return count; }
public static TerminalControl AsTerminalControl(ICommandTarget target) { IPoderosaView view = AsViewOrLastActivatedView(target); if (view == null) return null; else return (TerminalControl)view.GetAdapter(typeof(TerminalControl)); }
//ちょっと恣意的だが、ビュー直接またはLastActivatedViewで public static IPoderosaView AsViewOrLastActivatedView(ICommandTarget target) { IPoderosaView view = (IPoderosaView)target.GetAdapter(typeof(IPoderosaView)); if (view != null) return view; //成功 else return AsLastActivatedView(target); }
public static CharacterDocumentViewer AsCharacterDocumentViewer(ICommandTarget target) { IPoderosaView view = AsViewOrLastActivatedView(target); if (view == null) return null; else return (CharacterDocumentViewer)view.GetAdapter(typeof(CharacterDocumentViewer)); }
/// <summary> /// Constructor /// </summary> /// <param name="commandTarget">Command target</param> /// <param name="group">Command group, eg. <see cref="CommandConstants.StandardGroup"/></param> /// <param name="cmdId">Command ID</param> public CommandTargetCommand(ICommandTarget commandTarget, Guid group, int cmdId) { if (commandTarget == null) throw new ArgumentNullException(nameof(commandTarget)); this.commandTarget = commandTarget; this.group = group; this.cmdId = cmdId; }
public CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args) { if (!CanExecute(target)) return CommandResult.Ignored; TerminalTransmission output = GetSession().TerminalTransmission; string data = Clipboard.GetDataObject().GetData("Text") as string; if (data == null) return CommandResult.Ignored; ITerminalEmulatorOptions options = TerminalSessionsPlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions; if (options.AlertOnPasteNewLineChar) { // Data will be split by CR, LF, CRLF or Environment.NewLine by TextReader.ReadLine, // So we check the data about CR, LF and Environment.NewLine. if (data.IndexOfAny(new char[] { '\r', '\n' }) >= 0 || data.Contains(Environment.NewLine)) { IPoderosaView view = (IPoderosaView)_control.GetAdapter(typeof(IPoderosaView)); IPoderosaForm form = view.ParentForm; if (form != null) { DialogResult res = form.AskUserYesNo(TEnv.Strings.GetString("Message.AskPasteNewLineChar")); if (res != DialogResult.Yes) { return CommandResult.Ignored; } } } } //TODO 長文のときにダイアログを出して中途キャンセル可能に StringReader reader = new StringReader(data); output.SendTextStream(reader, data[data.Length - 1] == '\n'); return CommandResult.Succeeded; }
public CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args) { IPoderosaView view; ITerminalSession session; if (!GetViewAndSession(target, out view, out session)) return CommandResult.Ignored; string data = GetClipboardText(); if (data == null) return CommandResult.Ignored; ITerminalEmulatorOptions options = TerminalSessionsPlugin.Instance.TerminalEmulatorService.TerminalEmulatorOptions; if (options.AlertOnPasteNewLineChar) { // Data will be split by CR, LF, CRLF or Environment.NewLine by TextReader.ReadLine, // So we check the data about CR, LF and Environment.NewLine. if (data.IndexOfAny(new char[] { '\r', '\n' }) >= 0 || data.Contains(Environment.NewLine)) { IPoderosaForm form = view.ParentForm; if (form != null) { DialogResult res = form.AskUserYesNo(TEnv.Strings.GetString("Message.AskPasteNewLineChar")); if (res != DialogResult.Yes) { return CommandResult.Ignored; } } } } StringReader reader = new StringReader(data); TerminalTransmission output = session.TerminalTransmission; output.SendTextStream(reader, data.Length > 0 && data[data.Length - 1] == '\n'); return CommandResult.Succeeded; }
public override CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args) { IPoderosaMainWindow window = CommandTargetUtil.AsWindow(target); MacroList dlg = new MacroList(); dlg.ShowDialog(window.AsForm()); return CommandResult.Succeeded; }
/// <summary> /// Gets System.Windows.Forms.Form of the target. /// </summary> /// <param name="target">Target object which has been passed to the IPoderosaCommand's method.</param> /// <returns>Form object if it is available. Otherwise null.</returns> protected Form GetForm(ICommandTarget target) { IPoderosaMainWindow window = (IPoderosaMainWindow)target.GetAdapter(typeof(IPoderosaMainWindow)); if (window != null) return window.AsForm(); else return null; }
public CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args) { IPoderosaDocument doc = (IPoderosaDocument)args[0].GetAdapter(typeof(IPoderosaDocument)); if (doc == null) return CommandResult.Failed; SessionManagerPlugin.Instance.ActivateDocument(doc, ActivateReason.InternalAction); return CommandResult.Succeeded; }
public RecentRecipesCommand(ICommandTarget commandTarget, CsUnitControl csUnitCtrl) : base(commandTarget, csUnitCtrl, "&File", "Recent Recipes", RequestedMenuPosition, true) { _onRecipeLoaded = OnRecipeLoaded; _onRecipeSaved = OnRecipeSaved; _recentRecipies = new RecentRecipies(commandTarget); _recentRecipies.AddRecipe(RecipeFactory.Current.PathName); RecipeFactory.Loaded += _onRecipeLoaded; RecipeFactory.Current.Saved += _onRecipeSaved; }
public TestAbortCommand(ICommandTarget commandTarget, CsUnitControl csUnitCtrl) : base(commandTarget, csUnitCtrl, "&Test", "&Abort", _menuPosition, true) { _onRecipeStarted = OnRecipeStarted; _onRecipeFinishedOrAborted = OnRecipeFinishedOrAborted; RecipeFactory.Loaded += this.OnRecipeLoaded; RecipeFactory.Closing += OnRecipeClosing; HookupRecipe(); Enabled = false; }
public TestRunFailedCommand(ICommandTarget commandTarget) : base(commandTarget, "&Test", "Run &Failed", _menuPosition, true) { Enabled = ! _testSpec.Empty; _onRecipeLoaded = new RecipeEventHandler(OnRecipeLoaded); _onRecipeClosing = new RecipeEventHandler(OnRecipeClosing); _onTestErrorOrFail = new TestEventHandler(OnTestErrorOrFail); Recipe.Loaded += _onRecipeLoaded; Recipe.Closing += _onRecipeClosing; }
public static CommandResult OpenOptionDialog(ICommandTarget target) { IPoderosaMainWindow window = CommandTargetUtil.AsWindow(target); OptionDialog dlg = new OptionDialog(); if (dlg.ShowDialog(window.AsForm()) == DialogResult.OK) { return CommandResult.Succeeded; } else return CommandResult.Cancelled; }
//コンテキストメニューの構築 public static void BuildContextMenu(ContextMenuStrip cm, IEnumerable<IPoderosaMenuGroup> groups, ICommandTarget target) { cm.Tag = new MenuItemTag(null, null, target); int count = 0; foreach (IPoderosaMenuGroup grp in groups) { if (count > 0 && grp.ShowSeparator) cm.Items.Add(CreateBar()); //直前のグループに要素があるならデリミタを入れる count = BuildMenuContentsForGroup(cm.Items.Count, target, cm.Items, grp); } }
public TestAbortCommand(ICommandTarget commandTarget) : base(commandTarget, "&Test", "&Abort", _menuPosition, true) { _onRecipeStarted = new RecipeEventHandler(OnRecipeStarted); _onRecipeFinishedOrAborted = new RecipeEventHandler(OnRecipeFinishedOrAborted); Recipe.Loaded += new RecipeEventHandler(this.OnRecipeLoaded); Recipe.Closing += new RecipeEventHandler(OnRecipeClosing); HookupRecipe(); Enabled = false; }
private static CommandResult ToggleIntelliSense(ICommandTarget target) { ITerminalControlHost ts = TerminalCommandTarget.AsOpenTerminal(target); if (ts == null) return CommandResult.Failed; ITerminalSettings settings = ts.TerminalSettings; settings.BeginUpdate(); settings.EnabledCharTriggerIntelliSense = !settings.EnabledCharTriggerIntelliSense; settings.EndUpdate(); return CommandResult.Succeeded; }
private static CommandResult CmdChangeLog(ICommandTarget target) { ITerminalSession s = AsTerminalSession(target); if (s == null) return CommandResult.Ignored; ChangeLog dlg = new ChangeLog(s); if (dlg.ShowDialog(s.OwnerWindow.AsForm()) == DialogResult.OK) { return CommandResult.Succeeded; } else return CommandResult.Cancelled; }
//CommandTargetからTerminalSessionを得る public static ITerminalControlHost AsTerminal(ICommandTarget target) { IPoderosaView view = AsViewOrLastActivatedView(target); if (view == null) return null; else { IPoderosaDocument doc = view.Document; if (doc == null) return null; return (ITerminalControlHost)doc.OwnerSession.GetAdapter(typeof(ITerminalControlHost)); } }
public bool CanExecute(ICommandTarget target) { IPoderosaView view; ITerminalSession session; if (!GetViewAndSession(target, out view, out session)) return false; var clipboardData = Clipboard.GetDataObject(); if (!clipboardData.GetDataPresent("Text")) return false; return true; }
public CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args) { ITerminalSession ts = AsTerminalSession(target); if (ts == null) return CommandResult.Failed; //閉じてるかどうかで再接続か複製 if (ts.TerminalTransmission.Connection.IsClosed) return ConnectAgain(ts); else return Reproduce(ts); }
public TestRunAllCommand(ICommandTarget commandTarget, CsUnitControl csUnitCtrl) : base(commandTarget, csUnitCtrl, "&Test", "&Run All", MenuPosition, true) { _onRecipeLoaded = OnRecipeLoaded; _onRecipeClosing = OnRecipeClosing; _onOtherRecipeEvent = OnOtherRecipeEvent; _onAssemblyEvent = OnAssemblyEvent; RecipeFactory.Loaded += _onRecipeLoaded; RecipeFactory.Closing += _onRecipeClosing; HookupRecipe(); UpdateEnabledStatus(); }
public static IPoderosaView AsLastActivatedView(ICommandTarget target) { IPoderosaMainWindow window = AsWindow(target); if (window != null) return window.LastActivatedView; else { IPoderosaPopupWindow popup = (IPoderosaPopupWindow)target.GetAdapter(typeof(IPoderosaPopupWindow)); if (popup != null) return popup.InternalView; else return null; } }
public RecentAssembliesCommand(ICommandTarget commandTarget, CsUnitControl csUnitCtrl) : base(commandTarget, csUnitCtrl, "&Assembly", "Recent Assemblies", DesiredMenuPosition) { _onRecipeLoaded = OnRecipeLoaded; _onRecipeClosing = OnRecipeClosing; _onAssemblyAdded = OnAssemblyAdded; _recentAssemblies = new RecentAssemblies(); RecipeFactory.Loaded += _onRecipeLoaded; RecipeFactory.Closing += _onRecipeClosing; RecipeFactory.Current.AssemblyAdded += _onAssemblyAdded; }
public TestRunCheckedCommand(ICommandTarget commandTarget, CsUnitControl csUnitCtrl) : base(commandTarget, csUnitCtrl, "&Test", "Run Checked", MenuPosition) { Enabled = false; _onRecipeLoaded += OnRecipeLoaded; _onRecipeClosing += OnRecipeClosing; _onRecipeStartedOrFinished += OnRecipeStartedOrFinished; CsUnitControl.CheckedItems.CollectionChanged += OnCheckedItemsChanged; RecipeFactory.Loaded += _onRecipeLoaded; RecipeFactory.Closing += _onRecipeClosing; HookupRecipe(); }
public override bool IsChecked(ICommandTarget target) { ITerminalControlHost session = TerminalCommandTarget.AsOpenTerminal(target); return(session.TerminalSettings.EnabledCharTriggerIntelliSense); }
public AssemblyRemoveCommand(ICommandTarget commandTarget, CsUnitControl csUnitCtrl) : base(commandTarget, csUnitCtrl, "&Assembly", "&Remove", MenuPosition, true) { Enabled = false; CsUnitControl.SelectedItems.CollectionChanged += SelectedItemsCollectionChanged; }
public override bool IsEnabled(ICommandTarget target) { ITerminalControlHost session = TerminalCommandTarget.AsOpenTerminal(target); return(session != null); }
public void OpenShortcutFile(ICommandTarget target, string filename) { ShortcutFileCommands.OpenShortcutFile(target, filename); }
//IPoderosaCommand public bool CanExecute(ICommandTarget target) { //targetの型チェックくらいはしたほうがいいか? return(true); }
public bool CanExecute(ICommandTarget target) { return(IsAcceptable(target, false, true)); }
public override bool IsChecked(ICommandTarget target) { ITerminalControlHost session = TerminalCommandTarget.AsTerminal(target); return(session.TerminalSettings.LocalEcho); }
private static CommandResult CmdQuit(ICommandTarget target) { WindowManagerPlugin p = WindowManagerPlugin.Instance; return(p.CloseAllWindows()); }
/// <exclude/> public static IContentReplaceableView AsContentReplaceableViewOrLastActivatedView(ICommandTarget target) { if (target == null) { return(null); } IContentReplaceableViewSite view = (IContentReplaceableViewSite)target.GetAdapter(typeof(IContentReplaceableViewSite)); if (view != null) { return(view.CurrentContentReplaceableView); //成功 } else { IContentReplaceableView view2 = (IContentReplaceableView)target.GetAdapter(typeof(IContentReplaceableView)); if (view2 != null) { return(view2); } else { IPoderosaMainWindow window = AsWindow(target); if (window != null) { return(window.LastActivatedView); } else { return(null); } } } }
public bool IsChecked(ICommandTarget target) { return(false); }
public bool IsEnabled(ICommandTarget target) { return(CanExecute(target)); }
public override int GetSelectedIndex(ICommandTarget target) { ITerminalControlHost session = TerminalCommandTarget.AsOpenTerminal(target); return(TerminalEmulatorPlugin.Instance.ShellSchemeCollection.IndexOf(session.TerminalSettings.ShellScheme)); }
//コンテキストメニューの構築 public static void BuildContextMenu(ContextMenuStrip cm, IEnumerable <IPoderosaMenuGroup> groups, ICommandTarget target) { cm.Tag = new MenuItemTag(null, null, target); int count = 0; foreach (IPoderosaMenuGroup grp in groups) { if (count > 0 && grp.ShowSeparator) { cm.Items.Add(CreateBar()); //直前のグループに要素があるならデリミタを入れる } count = BuildMenuContentsForGroup(cm.Items.Count, target, cm.Items, grp); } }
public bool IsEnabled(ICommandTarget target) { return(true); }
public override int GetSelectedIndex(ICommandTarget target) { ITerminalControlHost session = TerminalCommandTarget.AsTerminal(target); return((int)session.TerminalSettings.Encoding); }
public bool CanExecute(ICommandTarget target) { return(GetSession() != null && Clipboard.GetDataObject().GetDataPresent("Text")); }
public MenuItemTag(IPoderosaMenuGroup grp, IPoderosaMenu menu, ICommandTarget target) { _group = grp; _menu = menu; _commandTarget = target; }
public bool IsChecked(ICommandTarget target) { return(_mainWindow.DocumentTabFeature.ActiveDocument == _document); }
public bool IsChecked(ICommandTarget target) { return(_window != null && _count == _window.DocumentTabFeature.TabRowCount); }
public override int GetSelectedIndex(ICommandTarget target) { ITerminalControlHost session = TerminalCommandTarget.AsTerminal(target); return((int)session.TerminalSettings.TransmitNL); //TODO intへのキャストは乱暴だな }
public DecompilerMenus(ICommandTarget target) : base(target) { SortedList slMainMenu = CreatePriorityList(); SortedList slFileMenu = CreatePriorityList(); SortedList slEditMenu = CreatePriorityList(); SortedList slViewMenu = CreatePriorityList(); SortedList slActionMenu = CreatePriorityList(); SortedList slToolsMenu = CreatePriorityList(); SortedList slWindowsMenu = CreatePriorityList(); SortedList slHelpMenu = CreatePriorityList(); SortedList slTextEncodingMenu = CreatePriorityList(); SortedList slCtxMemoryControl = CreatePriorityList(); SortedList slCtxDisassembler = CreatePriorityList(); SortedList slCtxBrowser = CreatePriorityList(); SortedList slCtxProcedure = CreatePriorityList(); SortedList slCtxAddressSearch = CreatePriorityList(); SortedList slCtxCodeView = CreatePriorityList(); SortedList slMainToolbar = CreatePriorityList(); SortedList slProjectBrowserToolbar = CreatePriorityList(); // Create groups SortedList slGrpMain = CreatePriorityList(); slMainMenu.Add(0, slGrpMain); SortedList slGrpFile = CreatePriorityList(); slFileMenu.Add(0, slGrpFile); SortedList slGrpFileMru = CreatePriorityList(); slFileMenu.Add(0, slGrpFileMru); SortedList slGrpFileEnd = CreatePriorityList(); slFileMenu.Add(1000, slGrpFileEnd); SortedList slGrpEdit = CreatePriorityList(); slEditMenu.Add(0, slGrpEdit); SortedList slGrpLowLevel = CreatePriorityList(); slViewMenu.Add(0, slGrpLowLevel); SortedList slGrpViewScanned = CreatePriorityList(); slViewMenu.Add(0, slGrpViewScanned); SortedList slGrpTextEncoding = CreatePriorityList(); slTextEncodingMenu.Add(0, slGrpTextEncoding); SortedList slGrpActions = CreatePriorityList(); slActionMenu.Add(0, slGrpActions); SortedList slGrpActionsScanned = CreatePriorityList(); slActionMenu.Add(0, slGrpActionsScanned); SortedList slGrpActionsRewritten = CreatePriorityList(); slActionMenu.Add(0, slGrpActionsRewritten); SortedList slGrpTools = CreatePriorityList(); slToolsMenu.Add(0, slGrpTools); SortedList slGrpWindows = CreatePriorityList(); slWindowsMenu.Add(0, slGrpWindows); SortedList slGrpHelp = CreatePriorityList(); slHelpMenu.Add(0, slGrpHelp); SortedList slGrpMemoryControl = CreatePriorityList(); slCtxMemoryControl.Add(0, slGrpMemoryControl); SortedList slGrpDisassemblerNav = CreatePriorityList(); slCtxDisassembler.Add(0, slGrpDisassemblerNav); SortedList slGrpDisassemblerShow = CreatePriorityList(); slCtxDisassembler.Add(0, slGrpDisassemblerShow); SortedList slGrpDisassemblerEdit = CreatePriorityList(); slCtxDisassembler.Add(0, slGrpDisassemblerEdit); SortedList slGrpCodeView = CreatePriorityList(); slCtxCodeView.Add(0, slGrpCodeView); SortedList slGrpCodeViewMode = CreatePriorityList(); slCtxCodeView.Add(0, slGrpCodeViewMode); SortedList slGrpBrowser = CreatePriorityList(); slCtxBrowser.Add(0, slGrpBrowser); SortedList slGrpBrowserProc = CreatePriorityList(); slCtxBrowser.Add(0, slGrpBrowserProc); SortedList slGrpToolbarFileOps = CreatePriorityList(); slMainToolbar.Add(0, slGrpToolbarFileOps); SortedList slGrpToolbarActions = CreatePriorityList(); slMainToolbar.Add(0, slGrpToolbarActions); SortedList slGrpBrowserToolbar = CreatePriorityList(); slProjectBrowserToolbar.Add(0, slGrpBrowserToolbar); SortedList slGrpProcedure = CreatePriorityList(); slCtxProcedure.Add(0, slGrpProcedure); SortedList slGrpAddressSearchView = CreatePriorityList(); slCtxAddressSearch.Add(0, slGrpAddressSearchView); SortedList slGrpAddressSearch = CreatePriorityList(); slCtxAddressSearch.Add(0, slGrpAddressSearch); // Create commands in containers. CommandMenuItem slFileOpen = new CommandMenuItem("_Open...", new Guid(CmdSets.Reko), CmdIds.FileOpen); slFileOpen.IsDynamic = false; slFileOpen.ImageIndex = 0; CommandMenuItem slFileOpenAs = new CommandMenuItem("Op_en As...", new Guid(CmdSets.Reko), CmdIds.FileOpenAs); slFileOpenAs.IsDynamic = false; CommandMenuItem slFileSave = new CommandMenuItem("_Save", new Guid(CmdSets.Reko), CmdIds.FileSave); slFileSave.IsDynamic = false; slFileSave.ImageIndex = 1; CommandMenuItem slFileAddBinary = new CommandMenuItem("Add _binary file...", new Guid(CmdSets.Reko), CmdIds.FileAddBinary); slFileAddBinary.IsDynamic = false; CommandMenuItem slFileAddMetadata = new CommandMenuItem("Add _metadata file...", new Guid(CmdSets.Reko), CmdIds.FileAddMetadata); slFileAddMetadata.IsDynamic = false; CommandMenuItem slFileAssemble = new CommandMenuItem("Add asse_mbler file...", new Guid(CmdSets.Reko), CmdIds.FileAssemble); slFileAssemble.IsDynamic = false; CommandMenuItem slFileCloseProject = new CommandMenuItem("Close projec_t", new Guid(CmdSets.Reko), CmdIds.FileCloseProject); slFileCloseProject.IsDynamic = false; CommandMenuItem slFileMru = new CommandMenuItem("", new Guid(CmdSets.Reko), CmdIds.FileMru); slFileMru.IsDynamic = true; slGrpFileMru.Add(0, slFileMru); CommandMenuItem slFileExit = new CommandMenuItem("E_xit", new Guid(CmdSets.Reko), CmdIds.FileExit); slFileExit.IsDynamic = false; slGrpFileEnd.Add(0, slFileExit); CommandMenuItem slEditFind = new CommandMenuItem("_Find...", new Guid(CmdSets.Reko), CmdIds.EditFind); slEditFind.IsDynamic = false; slGrpEdit.Add(0, slEditFind); CommandMenuItem slEditCopy = new CommandMenuItem("_Copy", new Guid(CmdSets.Reko), CmdIds.EditCopy); slEditCopy.IsDynamic = false; CommandMenuItem slEditCopyAll = new CommandMenuItem("_Copy All", new Guid(CmdSets.Reko), CmdIds.EditCopyAll); slEditCopyAll.IsDynamic = false; CommandMenuItem slEditRename = new CommandMenuItem("_Rename", new Guid(CmdSets.Reko), CmdIds.EditRename); slEditRename.IsDynamic = false; slGrpEdit.Add(0, slEditRename); CommandMenuItem slEditAnnotation = new CommandMenuItem("Co_mment", new Guid(CmdSets.Reko), CmdIds.EditAnnotation); slEditAnnotation.IsDynamic = false; slGrpEdit.Add(0, slEditAnnotation); CommandMenuItem slEditSelectAll = new CommandMenuItem("Select _all", new Guid(CmdSets.Reko), CmdIds.EditSelectAll); slEditSelectAll.IsDynamic = false; slGrpEdit.Add(0, slEditSelectAll); CommandMenuItem slEditProperties = new CommandMenuItem("P_roperties", new Guid(CmdSets.Reko), CmdIds.EditProperties); slEditProperties.IsDynamic = false; CommandMenuItem slViewMemory = new CommandMenuItem("_Memory", new Guid(CmdSets.Reko), CmdIds.ViewMemory); slViewMemory.IsDynamic = false; slGrpLowLevel.Add(0, slViewMemory); CommandMenuItem slViewDisassembly = new CommandMenuItem("_Disassembly", new Guid(CmdSets.Reko), CmdIds.ViewDisassembly); slViewDisassembly.IsDynamic = false; slGrpLowLevel.Add(0, slViewDisassembly); CommandMenuItem slTextEncodingChoose = new CommandMenuItem("_Choose...", new Guid(CmdSets.Reko), CmdIds.TextEncodingChoose); slTextEncodingChoose.IsDynamic = false; slGrpTextEncoding.Add(0, slTextEncodingChoose); CommandMenuItem slViewCallGraph = new CommandMenuItem("_Call graph", new Guid(CmdSets.Reko), CmdIds.ViewCallGraph); slViewCallGraph.IsDynamic = false; slGrpLowLevel.Add(0, slViewCallGraph); CommandMenuItem slOpenLink = new CommandMenuItem("_Open", new Guid(CmdSets.Reko), CmdIds.OpenLink); slOpenLink.IsDynamic = false; CommandMenuItem slOpenLinkInNewWindow = new CommandMenuItem("Open in ne_w window", new Guid(CmdSets.Reko), CmdIds.OpenLinkInNewWindow); slOpenLinkInNewWindow.IsDynamic = false; CommandMenuItem slViewGoToAddress = new CommandMenuItem("_Go to Address...", new Guid(CmdSets.Reko), CmdIds.ViewGoToAddress); slViewGoToAddress.IsDynamic = false; slGrpViewScanned.Add(0, slViewGoToAddress); CommandMenuItem slViewFindAllProcedures = new CommandMenuItem("Find all _procedures", new Guid(CmdSets.Reko), CmdIds.ViewFindAllProcedures); slViewFindAllProcedures.IsDynamic = false; slGrpViewScanned.Add(0, slViewFindAllProcedures); CommandMenuItem slViewShowAllFragments = new CommandMenuItem("Show _all fragments", new Guid(CmdSets.Reko), CmdIds.ViewShowAllFragments); slViewShowAllFragments.IsDynamic = false; slGrpViewScanned.Add(0, slViewShowAllFragments); CommandMenuItem slViewShowUnscanned = new CommandMenuItem("Show _unscanned fragments", new Guid(CmdSets.Reko), CmdIds.ViewShowUnscanned); slViewShowUnscanned.IsDynamic = false; slGrpViewScanned.Add(0, slViewShowUnscanned); CommandMenuItem slViewFindPattern = new CommandMenuItem("Find selected _pattern...", new Guid(CmdSets.Reko), CmdIds.ViewFindPattern); slViewFindPattern.IsDynamic = false; slGrpViewScanned.Add(0, slViewFindPattern); CommandMenuItem slViewFindStrings = new CommandMenuItem("Find _strings...", new Guid(CmdSets.Reko), CmdIds.ViewFindStrings); slViewFindStrings.IsDynamic = false; slGrpViewScanned.Add(0, slViewFindStrings); CommandMenuItem slViewFindWhatPointsHere = new CommandMenuItem("Find _what points here", new Guid(CmdSets.Reko), CmdIds.ViewFindWhatPointsHere); slViewFindWhatPointsHere.IsDynamic = false; slGrpViewScanned.Add(0, slViewFindWhatPointsHere); CommandMenuItem slViewAsCode = new CommandMenuItem("View as _code", new Guid(CmdSets.Reko), CmdIds.ViewAsCode); slViewAsCode.IsDynamic = false; slGrpAddressSearchView.Add(0, slViewAsCode); CommandMenuItem slViewAsStrings = new CommandMenuItem("View as _strings", new Guid(CmdSets.Reko), CmdIds.ViewAsStrings); slViewAsStrings.IsDynamic = false; slGrpAddressSearchView.Add(0, slViewAsStrings); CommandMenuItem slViewAsData = new CommandMenuItem("View as _data", new Guid(CmdSets.Reko), CmdIds.ViewAsData); slViewAsData.IsDynamic = false; slGrpAddressSearchView.Add(0, slViewAsData); CommandMenuItem slViewCfgCode = new CommandMenuItem("View _code", new Guid(CmdSets.Reko), CmdIds.ViewCfgCode); slViewCfgCode.IsDynamic = false; slGrpCodeViewMode.Add(1, slViewCfgCode); CommandMenuItem slViewCfgGraph = new CommandMenuItem("View control _graph", new Guid(CmdSets.Reko), CmdIds.ViewCfgGraph); slViewCfgGraph.IsDynamic = false; slGrpCodeViewMode.Add(2, slViewCfgGraph); CommandMenuItem slViewPcRelative = new CommandMenuItem("Show _PC relative addresses", new Guid(CmdSets.Reko), CmdIds.ViewPcRelative); slViewPcRelative.IsDynamic = false; slGrpLowLevel.Add(0, slViewPcRelative); CommandMenuItem slEditDeclaration = new CommandMenuItem("Edit declaration", new Guid(CmdSets.Reko), CmdIds.EditDeclaration); slEditDeclaration.IsDynamic = false; slGrpCodeView.Add(1, slEditDeclaration); CommandMenuItem slEditComment = new CommandMenuItem("Edit comment", new Guid(CmdSets.Reko), CmdIds.EditComment); slEditComment.IsDynamic = false; slGrpCodeView.Add(2, slEditComment); CommandMenuItem slActionRestartDecompilation = new CommandMenuItem("_Restart", new Guid(CmdSets.Reko), CmdIds.ActionRestartDecompilation); slActionRestartDecompilation.IsDynamic = false; slActionRestartDecompilation.ImageIndex = 2; slGrpActions.Add(0, slActionRestartDecompilation); CommandMenuItem slActionNextPhase = new CommandMenuItem("_Next Phase", new Guid(CmdSets.Reko), CmdIds.ActionNextPhase); slActionNextPhase.IsDynamic = false; slActionNextPhase.ImageIndex = 3; slGrpActions.Add(0, slActionNextPhase); CommandMenuItem slActionFinishDecompilation = new CommandMenuItem("Finish _Decompilation", new Guid(CmdSets.Reko), CmdIds.ActionFinishDecompilation); slActionFinishDecompilation.IsDynamic = false; slActionFinishDecompilation.ImageIndex = 4; slGrpActions.Add(0, slActionFinishDecompilation); CommandMenuItem slActionMarkProcedure = new CommandMenuItem("Mark _Procedure Entry", new Guid(CmdSets.Reko), CmdIds.ActionMarkProcedure); slActionMarkProcedure.IsDynamic = false; CommandMenuItem slActionCallTerminates = new CommandMenuItem("Mark call as _terminating", new Guid(CmdSets.Reko), CmdIds.ActionCallTerminates); slActionCallTerminates.IsDynamic = false; slGrpDisassemblerEdit.Add(0, slActionCallTerminates); CommandMenuItem slActionScanHeuristically = new CommandMenuItem("Scan _heuristically", new Guid(CmdSets.Reko), CmdIds.ActionScanHeuristically); slActionScanHeuristically.IsDynamic = false; CommandMenuItem slActionEditSignature = new CommandMenuItem("Edit _Signature...", new Guid(CmdSets.Reko), CmdIds.ActionEditSignature); slActionEditSignature.IsDynamic = false; CommandMenuItem slActionMarkType = new CommandMenuItem("Mark _Type", new Guid(CmdSets.Reko), CmdIds.ActionMarkType); slActionMarkType.IsDynamic = false; CommandMenuItem slActionAssumeRegisterValues = new CommandMenuItem("_Register values...", new Guid(CmdSets.Reko), CmdIds.ActionAssumeRegisterValues); slActionAssumeRegisterValues.IsDynamic = false; CommandMenuItem slToolsOptions = new CommandMenuItem("_Options...", new Guid(CmdSets.Reko), CmdIds.ToolsOptions); slToolsOptions.IsDynamic = false; slGrpTools.Add(0, slToolsOptions); CommandMenuItem slToolsKeyBindings = new CommandMenuItem("_Key bindings...", new Guid(CmdSets.Reko), CmdIds.ToolsKeyBindings); slToolsKeyBindings.IsDynamic = false; slGrpTools.Add(0, slToolsKeyBindings); CommandMenuItem slWindowsCascade = new CommandMenuItem("_Cacade", new Guid(CmdSets.Reko), CmdIds.WindowsCascade); slWindowsCascade.IsDynamic = false; slGrpWindows.Add(0, slWindowsCascade); CommandMenuItem slWindowsTileVertical = new CommandMenuItem("Tile _Vertically", new Guid(CmdSets.Reko), CmdIds.WindowsTileVertical); slWindowsTileVertical.IsDynamic = false; slGrpWindows.Add(0, slWindowsTileVertical); CommandMenuItem slWindowsTileHorizontal = new CommandMenuItem("Tile _Horizontally", new Guid(CmdSets.Reko), CmdIds.WindowsTileHorizontal); slWindowsTileHorizontal.IsDynamic = false; slGrpWindows.Add(0, slWindowsTileHorizontal); CommandMenuItem slWindowsCloseAll = new CommandMenuItem("C_lose All Windows", new Guid(CmdSets.Reko), CmdIds.WindowsCloseAll); slWindowsCloseAll.IsDynamic = false; slGrpWindows.Add(0, slWindowsCloseAll); CommandMenuItem slHelpAbout = new CommandMenuItem("_About Decompiler...", new Guid(CmdSets.Reko), CmdIds.HelpAbout); slHelpAbout.IsDynamic = false; slGrpHelp.Add(0, slHelpAbout); CommandMenuItem slShowProcedureCallHierarchy = new CommandMenuItem("Call graph", new Guid(CmdSets.Reko), CmdIds.ShowProcedureCallHierarchy); slShowProcedureCallHierarchy.IsDynamic = false; slGrpProcedure.Add(0, slShowProcedureCallHierarchy); CommandMenuItem slCollapseAllNodes = new CommandMenuItem("", new Guid(CmdSets.Reko), CmdIds.CollapseAllNodes); slCollapseAllNodes.IsDynamic = false; slCollapseAllNodes.ImageKey = "Collapse.ico"; slCollapseAllNodes.ToolTipText = "Collapse All"; slGrpBrowserToolbar.Add(0, slCollapseAllNodes); CommandMenuItem slLoadSymbols = new CommandMenuItem("Load Symbols...", new Guid(CmdSets.Reko), CmdIds.LoadSymbols); slLoadSymbols.IsDynamic = false; slGrpBrowser.Add(0, slLoadSymbols); // Create submenus CommandMenuItem miFileMenu = new CommandMenuItem("_File"); slGrpMain.Add(0, miFileMenu); CommandMenuItem miEditMenu = new CommandMenuItem("_Edit"); slGrpMain.Add(0, miEditMenu); CommandMenuItem miViewMenu = new CommandMenuItem("_View"); slGrpMain.Add(0, miViewMenu); CommandMenuItem miActionMenu = new CommandMenuItem("_Actions"); slGrpMain.Add(0, miActionMenu); CommandMenuItem miToolsMenu = new CommandMenuItem("_Tools"); slGrpMain.Add(0, miToolsMenu); CommandMenuItem miWindowsMenu = new CommandMenuItem("_Windows"); slGrpMain.Add(0, miWindowsMenu); CommandMenuItem miHelpMenu = new CommandMenuItem("_Help"); slGrpMain.Add(0, miHelpMenu); CommandMenuItem miTextEncodingMenu = new CommandMenuItem("_Text Encoding"); slGrpLowLevel.Add(0, miTextEncodingMenu); // Place commands. slGrpFile.Add(0, slFileOpen); slGrpFile.Add(0, slFileOpenAs); slGrpFile.Add(0, slFileSave); slGrpFile.Add(0, slFileCloseProject); slGrpFile.Add(0, slFileAddBinary); slGrpFile.Add(0, slFileAddMetadata); slGrpFile.Add(0, slFileAssemble); slGrpToolbarFileOps.Add(0, slFileOpen); slGrpToolbarFileOps.Add(0, slFileSave); slGrpEdit.Add(0, slEditCopy); slGrpEdit.Add(0, slEditProperties); slGrpToolbarActions.Add(0, slActionRestartDecompilation); slGrpToolbarActions.Add(0, slActionNextPhase); slGrpToolbarActions.Add(0, slActionFinishDecompilation); slGrpActionsScanned.Add(0, slActionMarkProcedure); slGrpActionsScanned.Add(0, slActionScanHeuristically); slGrpActionsScanned.Add(0, slActionMarkType); slGrpMemoryControl.Add(0, slEditCopy); slGrpCodeView.Add(2, slEditCopy); slGrpMemoryControl.Add(0, slViewGoToAddress); slGrpMemoryControl.Add(0, slActionMarkProcedure); slGrpMemoryControl.Add(0, slActionMarkType); slGrpMemoryControl.Add(0, slViewFindPattern); slGrpMemoryControl.Add(0, slViewFindWhatPointsHere); slGrpDisassemblerNav.Add(0, slOpenLink); slGrpDisassemblerNav.Add(0, slOpenLinkInNewWindow); slGrpDisassemblerShow.Add(0, slViewPcRelative); slGrpDisassemblerEdit.Add(0, slEditCopy); slGrpDisassemblerEdit.Add(0, slEditRename); slGrpDisassemblerEdit.Add(0, slEditAnnotation); slGrpProcedure.Add(0, slActionEditSignature); slGrpProcedure.Add(0, slViewGoToAddress); slGrpActionsRewritten.Add(0, slActionEditSignature); slGrpBrowser.Add(0, slEditProperties); slGrpBrowserProc.Add(0, slViewGoToAddress); slGrpBrowserProc.Add(0, slViewFindWhatPointsHere); slGrpBrowserProc.Add(0, slActionEditSignature); slGrpBrowserProc.Add(0, slActionAssumeRegisterValues); slGrpAddressSearch.Add(0, slViewFindWhatPointsHere); slGrpAddressSearch.Add(0, slActionMarkProcedure); slGrpAddressSearch.Add(0, slActionMarkType); slGrpAddressSearch.Add(0, slActionScanHeuristically); // Build accelerators. AddBinding( "", new Guid(CmdSets.Reko), CmdIds.ActionMarkType, (int)(Keys.T) , (int)(Keys.Control) ); AddBinding( "Reko.Gui.Windows.CombinedCodeViewInteractor", new Guid(CmdSets.Reko), CmdIds.EditDeclaration, (int)(Keys.D) , (int)(Keys.Control) ); AddBinding( "Reko.Gui.Windows.CombinedCodeViewInteractor", new Guid(CmdSets.Reko), CmdIds.EditComment, (int)(Keys.OemSemicolon) ); AddBinding( "", new Guid(CmdSets.Reko), CmdIds.ActionNextSearchHit, (int)(Keys.F8) ); AddBinding( "", new Guid(CmdSets.Reko), CmdIds.ActionPrevSearchHit, (int)(Keys.F8) , (int)(Keys.Shift) ); AddBinding( "", new Guid(CmdSets.Reko), CmdIds.EditCopy, (int)(Keys.C) , (int)(Keys.Control) ); AddBinding( "Reko.Gui.Windows.CodeViewerPane", new Guid(CmdSets.Reko), CmdIds.EditCopyAll, (int)(Keys.C) , (int)(Keys.Control) ); AddBinding( "", new Guid(CmdSets.Reko), CmdIds.EditSelectAll, (int)(Keys.A) , (int)(Keys.Control) ); this.MainMenu = new System.Windows.Forms.MainMenu(); BuildMenu(slMainMenu, MainMenu.MenuItems); BuildMenu(slFileMenu, miFileMenu.MenuItems); BuildMenu(slEditMenu, miEditMenu.MenuItems); BuildMenu(slViewMenu, miViewMenu.MenuItems); BuildMenu(slActionMenu, miActionMenu.MenuItems); BuildMenu(slToolsMenu, miToolsMenu.MenuItems); BuildMenu(slWindowsMenu, miWindowsMenu.MenuItems); BuildMenu(slHelpMenu, miHelpMenu.MenuItems); BuildMenu(slTextEncodingMenu, miTextEncodingMenu.MenuItems); this.CtxMemoryControl = new System.Windows.Forms.ContextMenu(); BuildMenu(slCtxMemoryControl, CtxMemoryControl.MenuItems); this.CtxMemoryControl.Popup += subMenu_Popup; this.CtxDisassembler = new System.Windows.Forms.ContextMenu(); BuildMenu(slCtxDisassembler, CtxDisassembler.MenuItems); this.CtxDisassembler.Popup += subMenu_Popup; this.CtxBrowser = new System.Windows.Forms.ContextMenu(); BuildMenu(slCtxBrowser, CtxBrowser.MenuItems); this.CtxBrowser.Popup += subMenu_Popup; this.CtxProcedure = new System.Windows.Forms.ContextMenu(); BuildMenu(slCtxProcedure, CtxProcedure.MenuItems); this.CtxProcedure.Popup += subMenu_Popup; this.CtxAddressSearch = new System.Windows.Forms.ContextMenu(); BuildMenu(slCtxAddressSearch, CtxAddressSearch.MenuItems); this.CtxAddressSearch.Popup += subMenu_Popup; this.CtxCodeView = new System.Windows.Forms.ContextMenu(); BuildMenu(slCtxCodeView, CtxCodeView.MenuItems); this.CtxCodeView.Popup += subMenu_Popup; this.MainToolbar = new System.Windows.Forms.ToolStrip(); BuildMenu(slMainToolbar, MainToolbar.Items); this.ProjectBrowserToolbar = new System.Windows.Forms.ToolStrip(); BuildMenu(slProjectBrowserToolbar, ProjectBrowserToolbar.Items); }
public static IPoderosaMainWindow AsWindow(ICommandTarget target) { IPoderosaMainWindow window = (IPoderosaMainWindow)target.GetAdapter(typeof(IPoderosaMainWindow)); return(window); }
public abstract CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args);
public void SetNextCommandTarget(ICommandTarget commandTarget) => nextCommandTarget = commandTarget;
public bool CanExecute(ICommandTarget target) { CharacterDocumentViewer control = (CharacterDocumentViewer)target.GetAdapter(typeof(CharacterDocumentViewer)); return(control.EnabledEx && !control.ITextSelection.IsEmpty); }
public CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args) { _window.DocumentTabFeature.SetTabRowCount(_count); return(CommandResult.Succeeded); }
public bool CanExecute(ICommandTarget target) { return(true); }
public void SetNextCommandTarget(ICommandTarget commandTarget) { }
public bool CanExecute(ICommandTarget target) { // Note: Currently, SCPClient supports only SSH2. return(IsAcceptable(target, false, true)); }
public override bool IsEnabled(ICommandTarget target) { return(TerminalCommandTarget.AsOpenTerminal(target) != null); }