Files
UnrealEngineUWP/Engine/Source/Editor/EditorStyle/Private/SlateEditorStyle.h
Andrew Brown 97baebcdae Asset View now supports secondary sorting
#UDN: Feature suggestion; Content browser can sort by a second column

#branch UE4

#change
Added two new images for secondary sort ascending and descending.
(Updated styles where needed).

Added new enum EColumnSortPriority: currently only lists Primary and Secondary, but can easily accommodate more*.
(FOnSortModeChanged was modified to also have the priority as a param, fixedup existing usage).

SHeaderRow now also has a SortPriority attribute to specify the SortMode order
(Defaults to Primary if unused).

Modified TUniquePtr so that assigning one from another worked correctly.
(Reviewed by Steve Robb).

SAssetView is the only table that has been modified, so far, to take advantage of the secondary sort. SetMajorityAssetType has been updated to correctly filter out all those sorts which are no longer relevant and bump the priority of the remaining sorts to fill in the ægapsÆ made by non-longer-relevant ones.

FAssetViewSortManager has been overhauled to take SortPriority into consideration when sortingà
Firstly, duplicate comparison structs were removed in favour of single structs which have æascendingÆ as a paramà any remaining duplicate code was removed in favour of an inherited usage. The base struct has an array of æfurther methodsÆ to employ in the result of a tie. Should a tie occur the ænextÆ comparison is done, and so on until itÆs not a tie or we run out of comparisons to perform.*
The manager defaults to having no secondary sort, so it relies on the interface thatÆs using it to provide it.
Whenever a column is assign the code makes sure that itÆs not already assigned to another column and corrects the order to take this into account.

Fixed a bug in FCompareFAssetItemByTagNumericalAscending comparing A with A (instead of B).
Various optimizations to the sort to descrease times

*The only places æSecondaryÆ is referred to in code is in GetSortingBrush (so it can display the correct icon for the sort), and OnTitleClicked (so it can set to correct sort based on input). The sorting code itself has no concept as to a secondary sort, it can support any number of sorting levels so if in future a tertiary (or more) is added, it is only these two function which should need updating as the sort will automatically accommodate it.

reviewed by Thomas.Sarkanen, Bob.Tellez

[CL 2119201 by Andrew Brown in Main branch]
2014-06-27 04:30:08 -04:00

144 lines
4.2 KiB
C++

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#pragma once
/**
* Declares the Editor's visual style.
*/
class FSlateEditorStyle
: public FEditorStyle
{
public:
static void Initialize()
{
Settings = NULL;
#if WITH_EDITOR
Settings = GetMutableDefault<UEditorStyleSettings>();
ISettingsModule* SettingsModule = ISettingsModule::Get();
if (SettingsModule != nullptr)
{
SettingsModule->RegisterSettings( "Editor", "General", "Appearance",
NSLOCTEXT("EditorStyle", "Appearance_UserSettingsName", "Appearance"),
NSLOCTEXT("EditorStyle", "Appearance_UserSettingsDescription", "Customize the look of the editor."),
Settings
);
}
#endif
StyleInstance = Create( Settings );
SetStyle( StyleInstance.ToSharedRef() );
}
static void Shutdown()
{
ISettingsModule* SettingsModule = ISettingsModule::Get();
if (SettingsModule != nullptr)
{
SettingsModule->UnregisterSettings( "Editor", "General", "Appearance");
}
ResetToDefault();
ensure( StyleInstance.IsUnique() );
StyleInstance.Reset();
}
static void SyncCustomizations()
{
FSlateEditorStyle::StyleInstance->SyncSettings();
}
class FStyle : public FSlateStyleSet
{
public:
FStyle( const TWeakObjectPtr< UEditorStyleSettings >& InSettings );
void Initialize();
void SetupGeneralStyles();
void SetupWindowStyles();
void SetupDockingStyles();
void SetupTutorialStyles();
void SetupTranslationEditorStyles();
void SetupPropertyEditorStyles();
void SetupProfilerStyle();
void SetupGraphEditorStyles();
void SetupLevelEditorStyle();
void SetupPersonaStyle();
void SetupClassIconsAndThumbnails();
void SetupContentBrowserStyle();
void SetupLandscapeEditorStyle();
void SetupToolkitStyles();
void SetupMatineeStyle();
void SetupSourceControlStyles();
void SetupAutomationStyles();
void SetupUMGEditorStyles();
void SettingsChanged( UObject* ChangedObject, FPropertyChangedEvent& PropertyChangedEvent );
void SyncSettings();
const FVector2D Icon7x16;
const FVector2D Icon8x4;
const FVector2D Icon16x4;
const FVector2D Icon8x8;
const FVector2D Icon10x10;
const FVector2D Icon12x12;
const FVector2D Icon12x16;
const FVector2D Icon14x14;
const FVector2D Icon16x16;
const FVector2D Icon16x20;
const FVector2D Icon20x20;
const FVector2D Icon22x22;
const FVector2D Icon24x24;
const FVector2D Icon25x25;
const FVector2D Icon32x32;
const FVector2D Icon40x40;
const FVector2D Icon48x48;
const FVector2D Icon64x64;
const FVector2D Icon36x24;
const FVector2D Icon128x128;
// These are the colors that are updated by the user style customizations
const TSharedRef< FLinearColor > DefaultForeground_LinearRef;
const TSharedRef< FLinearColor > InvertedForeground_LinearRef;
const TSharedRef< FLinearColor > SelectorColor_LinearRef;
const TSharedRef< FLinearColor > SelectionColor_LinearRef;
const TSharedRef< FLinearColor > SelectionColor_Subdued_LinearRef;
const TSharedRef< FLinearColor > SelectionColor_Inactive_LinearRef;
const TSharedRef< FLinearColor > SelectionColor_Pressed_LinearRef;
// These are the Slate colors which reference those above; these are the colors to put into the style
const FSlateColor DefaultForeground;
const FSlateColor InvertedForeground;
const FSlateColor SelectorColor;
const FSlateColor SelectionColor;
const FSlateColor SelectionColor_Subdued;
const FSlateColor SelectionColor_Inactive;
const FSlateColor SelectionColor_Pressed;
FTextBlockStyle NormalText;
FEditableTextBoxStyle NormalEditableTextBoxStyle;
FTableRowStyle NormalTableRowStyle;
FButtonStyle Button;
FButtonStyle HoverHintOnly;
TWeakObjectPtr< UEditorStyleSettings > Settings;
};
static TSharedRef< class FSlateEditorStyle::FStyle > Create( const TWeakObjectPtr< UEditorStyleSettings >& InCustomization )
{
TSharedRef< class FSlateEditorStyle::FStyle > NewStyle = MakeShareable( new FSlateEditorStyle::FStyle( InCustomization ) );
NewStyle->Initialize();
FCoreDelegates::OnObjectPropertyChanged.AddSP( NewStyle, &FSlateEditorStyle::FStyle::SettingsChanged );
return NewStyle;
}
static TSharedPtr< FSlateEditorStyle::FStyle > StyleInstance;
static TWeakObjectPtr< UEditorStyleSettings > Settings;
};