diff --git a/src/dlangide/ui/commands.d b/src/dlangide/ui/commands.d index f1b68ba..72979e1 100644 --- a/src/dlangide/ui/commands.d +++ b/src/dlangide/ui/commands.d @@ -44,6 +44,7 @@ enum IDEActions : int { GoToDefinition, GetCompletionSuggestions, InsertCompletion, + FindText, } __gshared static this() { @@ -101,3 +102,4 @@ const Action ACTION_ADD_TO_CURRENT_WORKSPACE = new Action(IDEActions.AddToCurren const Action ACTION_GO_TO_DEFINITION = (new Action(IDEActions.GoToDefinition, "GO_TO_DEFINITION"c, ""c, KeyCode.KEY_G, KeyFlag.Control)).addAccelerator(KeyCode.F12, 0).disableByDefault(); const Action ACTION_GET_COMPLETIONS = (new Action(IDEActions.GetCompletionSuggestions, "SHOW_COMPLETIONS"c, ""c, KeyCode.KEY_G, KeyFlag.Control|KeyFlag.Shift)).addAccelerator(KeyCode.SPACE, KeyFlag.Control).disableByDefault(); +const Action ACTION_FIND_TEXT = (new Action(IDEActions.FindText, "FIND_TEXT"c, ""c, KeyCode.KEY_F, KeyFlag.Control)); diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index d9ce14c..23a06df 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -367,11 +367,6 @@ class IDEFrame : AppFrame { _logPanel.appendText(null, "cannot start dcd-server: code completion for D code will not work"d); } - import dlangide.ui.searchPanel; - auto searchPanel = new SearchWidget("search", this); - - _logPanel.getTabs.addTab( searchPanel, "Search"d, null, true); - _dockHost.addDockedWindow(_logPanel); return _dockHost; @@ -390,7 +385,7 @@ class IDEFrame : AppFrame { MenuItem editItem = new MenuItem(new Action(2, "MENU_EDIT")); editItem.add(ACTION_EDIT_COPY, ACTION_EDIT_PASTE, - ACTION_EDIT_CUT, ACTION_EDIT_UNDO, ACTION_EDIT_REDO); + ACTION_EDIT_CUT, ACTION_EDIT_UNDO, ACTION_EDIT_REDO, ACTION_FIND_TEXT); MenuItem editItemAdvanced = new MenuItem(new Action(221, "MENU_EDIT_ADVANCED")); editItemAdvanced.add(ACTION_EDIT_INDENT, ACTION_EDIT_UNINDENT, ACTION_EDIT_TOGGLE_LINE_COMMENT, ACTION_EDIT_TOGGLE_BLOCK_COMMENT, ACTION_GO_TO_DEFINITION, ACTION_GET_COMPLETIONS); editItem.add(editItemAdvanced); @@ -631,6 +626,17 @@ class IDEFrame : AppFrame { case IDEActions.EditPreferences: showPreferences(); return true; + case IDEActions.FindText: + Log.d("Opening Search Field"); + import dlangide.ui.searchPanel; + int searchPanelIndex = _logPanel.getTabs.tabIndex("search"); + if(searchPanelIndex == -1) { + SearchWidget searchPanel = new SearchWidget("search", this); + _logPanel.getTabs.addTab( searchPanel, "Search"d, null, true); + } + _logPanel.getTabs.selectTab("search"); + //TODO: Focus search field + return true; default: return super.handleAction(a); } diff --git a/src/dlangide/ui/searchPanel.d b/src/dlangide/ui/searchPanel.d index 15e3026..2b63e22 100644 --- a/src/dlangide/ui/searchPanel.d +++ b/src/dlangide/ui/searchPanel.d @@ -6,6 +6,7 @@ import dlangui.core.editable; import dlangide.ui.frame; import dlangide.ui.wspanel; +import dlangui.widgets.tabs; //TODO: This is required for navigating to decleration of TabWidget / BUG import dlangide.workspace.workspace; import dlangide.workspace.project; diff --git a/views/res/i18n/en.ini b/views/res/i18n/en.ini index 68922e4..59b8987 100644 --- a/views/res/i18n/en.ini +++ b/views/res/i18n/en.ini @@ -56,9 +56,11 @@ MENU_WINDOW_CLOSE_ALL_DOCUMENTS=Close All Documents MENU_HELP=&HELP MENU_HELP_VIEW_HELP=&View help MENU_HELP_ABOUT=&About +MENU_NAVIGATE=NAVIGATE + GO_TO_DEFINITION=Go To Definition SHOW_COMPLETIONS=Get Autocompletions -MENU_NAVIGATE=NAVIGATE +FIND_TEXT=Find text TAB_LONG_LIST=Long list