2019-12-26 15:33:43 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2014-03-14 14:13:41 -04:00
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
# include "TranslationEditorMenu.h"
# include "Widgets/DeclarativeSyntaxSupport.h"
# include "Settings/EditorExperimentalSettings.h"
2014-10-22 00:21:55 -04:00
# include "TranslationPickerWidget.h"
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
# include "Framework/MultiBox/MultiBoxBuilder.h"
# include "TranslationEditor.h"
2014-03-14 14:13:41 -04:00
2014-10-22 00:21:55 -04:00
# define LOCTEXT_NAMESPACE "TranslationEditorToolbar"
2014-03-14 14:13:41 -04:00
void FTranslationEditorMenu : : FillTranslationMenu ( FMenuBuilder & MenuBuilder /*, FTranslationEditor& TranslationEditor*/ )
{
MenuBuilder . BeginSection ( " Font " , LOCTEXT ( " Translation_FontHeading " , " Font " ) ) ;
{
MenuBuilder . AddMenuEntry ( FTranslationEditorCommands : : Get ( ) . ChangeSourceFont ) ;
MenuBuilder . AddMenuEntry ( FTranslationEditorCommands : : Get ( ) . ChangeTranslationTargetFont ) ;
2014-04-23 17:49:26 -04:00
MenuBuilder . AddMenuEntry ( FTranslationEditorCommands : : Get ( ) . PreviewAllTranslationsInEditor ) ;
2015-05-28 21:40:23 -04:00
MenuBuilder . AddMenuEntry ( FTranslationEditorCommands : : Get ( ) . ImportLatestFromLocalizationService ) ;
2014-04-23 18:20:15 -04:00
MenuBuilder . AddMenuEntry ( FTranslationEditorCommands : : Get ( ) . ExportToPortableObjectFormat ) ;
2014-04-23 19:14:07 -04:00
MenuBuilder . AddMenuEntry ( FTranslationEditorCommands : : Get ( ) . ImportFromPortableObjectFormat ) ;
2014-04-23 18:48:34 -04:00
MenuBuilder . AddMenuEntry ( FTranslationEditorCommands : : Get ( ) . OpenSearchTab ) ;
2015-07-01 17:12:23 -04:00
if ( GetDefault < UEditorExperimentalSettings > ( ) - > bEnableTranslationPicker )
{
MenuBuilder . AddMenuEntry ( FTranslationEditorCommands : : Get ( ) . OpenTranslationPicker ) ;
}
2014-03-14 14:13:41 -04:00
}
MenuBuilder . EndSection ( ) ;
}
void FTranslationEditorMenu : : SetupTranslationEditorMenu ( TSharedPtr < FExtender > Extender , FTranslationEditor & TranslationEditor )
{
// Add additional editor menu
{
struct Local
{
static void AddSaveMenuOption ( FMenuBuilder & MenuBuilder )
{
2021-01-12 13:38:00 -04:00
MenuBuilder . AddMenuEntry ( FTranslationEditorCommands : : Get ( ) . SaveTranslations , " SaveTranslations " , TAttribute < FText > ( ) , TAttribute < FText > ( ) , FSlateIcon ( FEditorStyle : : GetStyleSetName ( ) , " AssetEditor.SaveAsset " ) ) ;
2014-03-14 14:13:41 -04:00
}
static void AddTranslationEditorMenu ( FMenuBarBuilder & MenuBarBuilder )
{
// View
MenuBarBuilder . AddPullDownMenu (
LOCTEXT ( " TranslationMenu " , " Translation " ) ,
LOCTEXT ( " TranslationMenu_ToolTip " , " Open the Translation menu " ) ,
FNewMenuDelegate : : CreateStatic ( & FTranslationEditorMenu : : FillTranslationMenu ) ,
" View " ) ;
}
} ;
Extender - > AddMenuExtension (
" FileLoadAndSave " ,
EExtensionHook : : First ,
TranslationEditor . GetToolkitCommands ( ) ,
FMenuExtensionDelegate : : CreateStatic ( & Local : : AddSaveMenuOption ) ) ;
Extender - > AddMenuBarExtension (
" Edit " ,
EExtensionHook : : After ,
TranslationEditor . GetToolkitCommands ( ) ,
FMenuBarExtensionDelegate : : CreateStatic ( & Local : : AddTranslationEditorMenu ) ) ;
}
}
void FTranslationEditorMenu : : SetupTranslationEditorToolbar ( TSharedPtr < FExtender > Extender , FTranslationEditor & TranslationEditor )
{
struct Local
{
static void AddToolbarButtons ( FToolBarBuilder & ToolbarBuilder )
{
ToolbarBuilder . AddToolBarButton (
FTranslationEditorCommands : : Get ( ) . SaveTranslations , " SaveTranslations " , TAttribute < FText > ( ) , TAttribute < FText > ( ) , FSlateIcon ( FEditorStyle : : GetStyleSetName ( ) , " AssetEditor.SaveAsset " ) ) ;
2014-04-23 17:49:26 -04:00
ToolbarBuilder . AddToolBarButton (
2014-10-22 00:21:55 -04:00
FTranslationEditorCommands : : Get ( ) . PreviewAllTranslationsInEditor , " PreviewTranslationsInEditor " , TAttribute < FText > ( ) , TAttribute < FText > ( ) , FSlateIcon ( FEditorStyle : : GetStyleSetName ( ) , " TranslationEditor.PreviewInEditor " ) ) ;
2015-05-28 21:40:23 -04:00
ToolbarBuilder . AddToolBarButton (
FTranslationEditorCommands : : Get ( ) . ImportLatestFromLocalizationService , " ImportLatestFromLocalizationService " , TAttribute < FText > ( ) , TAttribute < FText > ( ) , FSlateIcon ( FEditorStyle : : GetStyleSetName ( ) , " TranslationEditor.ImportLatestFromLocalizationService " ) ) ;
2014-04-23 18:20:15 -04:00
ToolbarBuilder . AddToolBarButton (
2014-08-11 01:13:07 -04:00
FTranslationEditorCommands : : Get ( ) . ExportToPortableObjectFormat , " ExportToPortableObjectFormat " , TAttribute < FText > ( ) , TAttribute < FText > ( ) , FSlateIcon ( FEditorStyle : : GetStyleSetName ( ) , " TranslationEditor.Export " ) ) ;
2014-04-23 19:14:07 -04:00
ToolbarBuilder . AddToolBarButton (
FTranslationEditorCommands : : Get ( ) . ImportFromPortableObjectFormat , " ImportFromPortableObjectFormat " , TAttribute < FText > ( ) , TAttribute < FText > ( ) , FSlateIcon ( FEditorStyle : : GetStyleSetName ( ) , " TranslationEditor.Import " ) ) ;
2014-04-23 18:48:34 -04:00
ToolbarBuilder . AddToolBarButton (
2014-10-22 00:21:55 -04:00
FTranslationEditorCommands : : Get ( ) . OpenSearchTab , " OpenSearchTab " , TAttribute < FText > ( ) , TAttribute < FText > ( ) , FSlateIcon ( FEditorStyle : : GetStyleSetName ( ) , " TranslationEditor.Search " ) ) ;
2015-07-01 17:12:23 -04:00
if ( GetDefault < UEditorExperimentalSettings > ( ) - > bEnableTranslationPicker )
{
ToolbarBuilder . AddWidget ( SNew ( STranslationWidgetPicker ) ) ;
}
2014-03-14 14:13:41 -04:00
}
} ;
Extender - > AddToolBarExtension (
" Asset " ,
EExtensionHook : : First ,
TranslationEditor . GetToolkitCommands ( ) ,
FToolBarExtensionDelegate : : CreateStatic ( & Local : : AddToolbarButtons ) ) ;
}
//////////////////////////////////////////////////////////////////////////
// FTranslationEditorCommands
void FTranslationEditorCommands : : RegisterCommands ( )
{
2015-03-17 11:36:28 -04:00
UI_COMMAND ( ChangeSourceFont , " Change Source Font " , " Change the Font for the Source Lanugage " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
UI_COMMAND ( ChangeTranslationTargetFont , " Change Translation Font " , " Change the Translation Target Language Font " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
UI_COMMAND ( SaveTranslations , " Save " , " Saves the translations to file " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
2015-05-28 21:40:23 -04:00
UI_COMMAND ( PreviewAllTranslationsInEditor , " Preview in Editor " , " Preview All Translations in the Editor UI " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
UI_COMMAND ( ImportLatestFromLocalizationService , " Import from Translation Service " , " Download and Import Latest Translations From Localization Service. (Localization Service settings can be modified in the Localization Dashboard) " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
2015-03-17 11:36:28 -04:00
UI_COMMAND ( ExportToPortableObjectFormat , " Export to .PO " , " Export to Portable Object Format " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
UI_COMMAND ( ImportFromPortableObjectFormat , " Import from .PO " , " Import from Portable Object Format " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
UI_COMMAND ( OpenSearchTab , " Search " , " Search Source and Translation Strings " , EUserInterfaceActionType : : Button , FInputChord ( ) ) ;
UI_COMMAND ( OpenTranslationPicker , " Translation Picker " , " Open the Translation Picker to Modify Editor Translations " , EUserInterfaceActionType : : Button , FInputChord ( ) )
2014-03-14 14:13:41 -04:00
}
# undef LOCTEXT_NAMESPACE