5#include "Widgets/Views/STableRow.h"
6#include "Widgets/Input/SSearchBox.h"
7#include "Widgets/Input/SComboButton.h"
8#include "Widgets/Input/SButton.h"
9#include "Widgets/Input/SCheckBox.h"
10#include "Framework/MultiBox/MultiBoxBuilder.h"
11#include "Framework/Application/SlateApplication.h"
12#include "Framework/Commands/GenericCommands.h"
19#define LOCTEXT_NAMESPACE "SFindInDialogues"
26 HostTab = InArgs._ContainingTab;
33 if (InArgs._bIsSearchWindow)
41 constexpr bool bHostFindInDialoguesInGlobalTab =
true;
53 +SHorizontalBox::Slot()
57 .HintText(LOCTEXT(
"DialogueSearchHint",
"Enter function or event name to find references..."))
60 .Visibility(InArgs._bHideSearchBar? EVisibility::Collapsed : EVisibility::Visible)
64 +SHorizontalBox::Slot()
69 .ComboButtonStyle(FEditorStyle::Get(),
"GenericFilters.ComboButtonStyle")
70 .ForegroundColor(FLinearColor::White)
72 .ToolTipText(LOCTEXT(
"Filters_Tooltip",
"Filter options for the Dialogue Search."))
75 .ContentPadding(FMargin(1, 0))
79 + SHorizontalBox::Slot()
83 .TextStyle(FEditorStyle::Get(),
"GenericFilters.TextStyle")
84 .Font(FEditorStyle::Get().GetFontStyle(
"FontAwesome.9"))
85 .Text(FText::FromString(FString(TEXT(
"\xf0b0"))) )
87 +SHorizontalBox::Slot()
92 .TextStyle(FEditorStyle::Get(),
"GenericFilters.TextStyle")
93 .Text(LOCTEXT(
"Filters",
"Filters"))
99 +SHorizontalBox::Slot()
100 .Padding(4.f, 0.f, 2.f, 0.f)
106 .Visibility(
DialogueEditorPtr.IsValid() && bHostFindInDialoguesInGlobalTab ? EVisibility::Visible : EVisibility::Collapsed)
107 .ToolTipText(LOCTEXT(
"OpenInGlobalFindResultsButtonTooltip",
"Find in all Dialogues"))
110 .TextStyle(FEditorStyle::Get(),
"FindResults.FindInBlueprints")
111 .Text(FText::FromString(FString(TEXT(
"\xf1e5"))) )
116 +SHorizontalBox::Slot()
123 .Visibility(InArgs._bHideSearchBar || bHostFindInDialoguesInGlobalTab ? EVisibility::Collapsed : EVisibility::Visible)
126 .Text(LOCTEXT(
"BlueprintSearchModeChange",
"Find In Current Blueprint Only"))
132 +SVerticalBox::Slot()
134 .Padding(0.f, 4.f, 0.f, 0.f)
137 .BorderImage(FEditorStyle::GetBrush(
"Menu.Background"))
139 SAssignNew(
TreeView, STreeView<TSharedPtr<FDialogueSearchResult>>)
145 .SelectionMode(ESelectionMode::Multi)
160 FWidgetPath FilterTextBoxWidgetPath;
161 FSlateApplication::Get().GeneratePathToWidgetUnchecked(
SearchTextBoxWidget.ToSharedRef(), FilterTextBoxWidgetPath);
164 FSlateApplication::Get().SetKeyboardFocus(FilterTextBoxWidgetPath, EFocusCause::SetDirectly);
181 while (ItemToFocusOn->HasChildren())
183 ItemToFocusOn = ItemToFocusOn->GetChildren()[0];
185 TreeView->SetSelection(ItemToFocusOn);
186 ItemToFocusOn->OnClick();
212 if (bInIsFindWithinDialogue)
221 const TArray<TSharedPtr<FDialogueSearchResult>>& Children =
RootSearchResult->GetChildren();
222 if (Children.Num() == 1 && Children[0].IsValid())
226 TSharedPtr<FDialogueSearchResult> TempChild = Children[0];
257 TSharedPtr<SDockTab> HostTabPtr =
HostTab.Pin();
258 if (HostTabPtr.IsValid())
260 return HostTabPtr->GetLayoutIdentifier().TabType;
268 TSharedPtr<SDockTab> HostTabPtr =
HostTab.Pin();
269 if (HostTabPtr.IsValid())
271 HostTabPtr->RequestCloseTab();
287 if (CommitType == ETextCommit::OnEnter)
297 if (GlobalFindResults.IsValid())
302 return FReply::Handled();
307 OutChildren += InItem->GetChildren();
323 (!InItem->GetParent().IsValid() || (InItem->GetParent().IsValid() && InItem->GetParent().Pin()->IsRoot()));
326 if (bIsCategoryWidget)
328 return SNew(
STableRow<TSharedPtr<FDialogueSearchResult>>, OwnerTable)
331 .VAlign(VAlign_Center)
332 .BorderImage(FEditorStyle::GetBrush(
"PropertyWindow.CategoryBackground"))
333 .Padding(FMargin(2.0f))
334 .ForegroundColor(FEditorStyle::GetColor(
"PropertyWindow.CategoryForeground"))
339 +SHorizontalBox::Slot()
340 .VAlign(VAlign_Center)
347 +SHorizontalBox::Slot()
349 .VAlign(VAlign_Center)
354 .ToolTipText(LOCTEXT(
"DialogueCatSearchToolTip",
"Dialogue"))
361 FText CommentText = FText::GetEmpty();
362 if (!InItem->GetCommentString().IsEmpty())
364 FFormatNamedArguments Args;
365 Args.Add(TEXT(
"Comment"), FText::FromString(InItem->GetCommentString()));
366 CommentText = FText::Format(LOCTEXT(
"NodeComment",
"{Comment}"), Args);
369 FFormatNamedArguments Args;
370 Args.Add(TEXT(
"Category"), InItem->GetCategory());
371 Args.Add(TEXT(
"DisplayTitle"), InItem->GetDisplayText());
372 FText Tooltip = FText::Format(LOCTEXT(
"DialogueResultSearchToolTip",
"{Category} : {DisplayTitle}"), Args);
374 return SNew(
STableRow<TSharedPtr<FDialogueSearchResult>>, OwnerTable)
379 +SHorizontalBox::Slot()
380 .VAlign(VAlign_Center)
387 +SHorizontalBox::Slot()
389 .VAlign(VAlign_Center)
395 .ToolTipText(Tooltip)
399 +SHorizontalBox::Slot()
401 .HAlign(HAlign_Right)
402 .VAlign(VAlign_Center)
407 .ColorAndOpacity(FLinearColor::Yellow)
414 const bool bShouldCloseWindowAfterMenuSelection =
true;
415 FMenuBuilder MenuBuilder(bShouldCloseWindowAfterMenuSelection,
CommandList);
417 MenuBuilder.BeginSection(
"BasicOperations");
419 MenuBuilder.AddMenuEntry(FGenericCommands::Get().SelectAll);
420 MenuBuilder.AddMenuEntry(FGenericCommands::Get().Copy);
423 return MenuBuilder.MakeWidget();
428 FMenuBuilder MenuBuilder(
true,
nullptr);
429 MenuBuilder.AddMenuEntry(
430 LOCTEXT(
"IncludeIndices",
"Include Indices"),
431 LOCTEXT(
"IncludeIndices_ToolTip",
"Include indices of nodes/edges in the search result"),
434 FExecuteAction::CreateLambda([
this]()
440 FIsActionChecked::CreateLambda([
this]() ->
bool
446 EUserInterfaceActionType::ToggleButton
448 MenuBuilder.AddMenuEntry(
449 LOCTEXT(
"IncludeDialogueGUID",
"Include Dialogue GUIDs"),
450 LOCTEXT(
"IncludeDialogueGUID_ToolTip",
"Include Dialogue GUIDs in search in the search result"),
453 FExecuteAction::CreateLambda([
this]()
459 FIsActionChecked::CreateLambda([
this]() ->
bool
465 EUserInterfaceActionType::ToggleButton
467 MenuBuilder.AddMenuEntry(
468 LOCTEXT(
"IncludeNodeGUID",
"Include Node GUIDs"),
469 LOCTEXT(
"IncludeNodeGUID_ToolTip",
"Include Node GUIDs in search in the search result"),
472 FExecuteAction::CreateLambda([
this]()
478 FIsActionChecked::CreateLambda([
this]() ->
bool
484 EUserInterfaceActionType::ToggleButton
486 MenuBuilder.AddMenuEntry(
487 LOCTEXT(
"IncludeComments",
"Include Comments"),
488 LOCTEXT(
"IncludeComments_ToolTip",
"Include Comments from nodes and comments on nodes in the search result"),
491 FExecuteAction::CreateLambda([
this]()
497 FIsActionChecked::CreateLambda([
this]() ->
bool
503 EUserInterfaceActionType::ToggleButton
505 MenuBuilder.AddMenuEntry(
506 LOCTEXT(
"IncludeNumericalTypes",
"Include Integers & Floats"),
507 LOCTEXT(
"IncludeNumericalTypes_ToolTip",
"Include int32/floats in search result"),
510 FExecuteAction::CreateLambda([
this]()
516 FIsActionChecked::CreateLambda([
this]() ->
bool
522 EUserInterfaceActionType::ToggleButton
524 MenuBuilder.AddMenuEntry(
525 LOCTEXT(
"IncludeTextLocalizationData",
"Include Text Localization Data"),
526 LOCTEXT(
"IncludeTextLocalizationData_ToolTip",
"Include text localization data in search (key/namespace)"),
529 FExecuteAction::CreateLambda([
this]()
535 FIsActionChecked::CreateLambda([
this]() ->
bool
541 EUserInterfaceActionType::ToggleButton
543 MenuBuilder.AddMenuEntry(
544 LOCTEXT(
"IncludeCustomObjectNames",
"Include Custom Object Names"),
545 LOCTEXT(
"IncludeCustomObjectNames_ToolTip",
"Include the Custom Text Argument/Condition/Event/Node Data object names"),
548 FExecuteAction::CreateLambda([
this]()
554 FIsActionChecked::CreateLambda([
this]() ->
bool
560 EUserInterfaceActionType::ToggleButton
563 return MenuBuilder.MakeWidget();
566#undef LOCTEXT_NAMESPACE
FText GetDisplayText() const
TSharedRef< SWidget > FillFilterEntries()
void HandleGetChildren(TSharedPtr< FDialogueSearchResult > InItem, TArray< TSharedPtr< FDialogueSearchResult > > &OutChildren)
FName GetHostTabId() const
void FocusForUse(bool bSetFindWithinDialogue, const FDialogueSearchFilter &SearchFilter=FDialogueSearchFilter(), bool bSelectFirstResult=false)
TSharedPtr< SWidget > HandleContextMenuOpening()
bool bIsInFindWithinDialogueMode
void HandleTreeSelectionDoubleClicked(TSharedPtr< FDialogueSearchResult > Item)
TSharedRef< ITableRow > HandleGenerateRow(TSharedPtr< FDialogueSearchResult > InItem, const TSharedRef< STableViewBase > &OwnerTable)
void HandleHostTabClosed(TSharedRef< SDockTab > DockTab)
TWeakPtr< SDockTab > HostTab
TSharedPtr< SSearchBox > SearchTextBoxWidget
TSharedPtr< STreeView< TSharedPtr< FDialogueSearchResult > > > TreeView
TSharedPtr< FUICommandList > CommandList
void HandleFindModeChanged(ECheckBoxState CheckState)
FReply HandleOpenGlobalFindResults()
TWeakPtr< FDialogueEditor > DialogueEditorPtr
void HandleSearchTextCommitted(const FText &Text, ETextCommit::Type CommitType)
TWeakPtr< SVerticalBox > MainVerticalBoxWidget
void HandleSearchTextChanged(const FText &Text)
void MakeSearchQuery(const FDialogueSearchFilter &SearchFilter, bool bInIsFindWithinDialogue)
FDialogueSearchFilter CurrentFilter
TArray< TSharedPtr< FDialogueSearchResult > > ItemsFound
ECheckBoxState HandleGetFindModeChecked() const
TSharedPtr< FDialogueSearchResult > RootSearchResult
void Construct(const FArguments &InArgs, const TSharedPtr< FDialogueEditor > &InDialogueEditor=nullptr)
bool bIncludeCustomObjectNames
bool bIncludeTextLocalizationData
bool bIncludeDialogueGUID
bool bIncludeNumericalTypes