chore: checkpoint current workspace changes
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
#include "ProductProjectPanel.h"
|
||||
|
||||
#include "Icons/ProductBuiltInIcons.h"
|
||||
#include "Panels/ProductTreeViewStyle.h"
|
||||
|
||||
#include <XCEditor/Collections/UIEditorTreeView.h>
|
||||
#include <XCEditor/Foundation/UIEditorTheme.h>
|
||||
|
||||
@@ -27,14 +30,12 @@ using ::XCEngine::UI::UIPoint;
|
||||
using ::XCEngine::UI::UIRect;
|
||||
using Widgets::AppendUIEditorTreeViewBackground;
|
||||
using Widgets::AppendUIEditorTreeViewForeground;
|
||||
using Widgets::UIEditorTreeViewMetrics;
|
||||
using Widgets::UIEditorTreeViewPalette;
|
||||
|
||||
constexpr std::string_view kProjectPanelId = "project";
|
||||
constexpr std::string_view kAssetsRootId = "Assets";
|
||||
constexpr std::size_t kInvalidLayoutIndex = static_cast<std::size_t>(-1);
|
||||
|
||||
constexpr float kBrowserHeaderHeight = 28.0f;
|
||||
constexpr float kBrowserHeaderHeight = 24.0f;
|
||||
constexpr float kNavigationMinWidth = 180.0f;
|
||||
constexpr float kBrowserMinWidth = 260.0f;
|
||||
constexpr float kHeaderHorizontalPadding = 10.0f;
|
||||
@@ -288,32 +289,10 @@ std::vector<UIInputEvent> FilterTreeInputEvents(
|
||||
return filteredEvents;
|
||||
}
|
||||
|
||||
UIEditorTreeViewMetrics BuildTreeMetrics() {
|
||||
UIEditorTreeViewMetrics metrics = {};
|
||||
metrics.rowHeight = 20.0f;
|
||||
metrics.rowGap = 0.0f;
|
||||
metrics.horizontalPadding = 6.0f;
|
||||
metrics.indentWidth = 14.0f;
|
||||
metrics.disclosureExtent = 10.0f;
|
||||
metrics.disclosureLabelGap = 4.0f;
|
||||
metrics.labelInsetY = 0.0f;
|
||||
metrics.cornerRounding = 0.0f;
|
||||
metrics.borderThickness = 0.0f;
|
||||
metrics.focusedBorderThickness = 0.0f;
|
||||
return metrics;
|
||||
}
|
||||
|
||||
UIEditorTreeViewPalette BuildTreePalette() {
|
||||
UIEditorTreeViewPalette palette = {};
|
||||
palette.surfaceColor = kPaneColor;
|
||||
palette.borderColor = kPaneColor;
|
||||
palette.focusedBorderColor = kPaneColor;
|
||||
palette.rowHoverColor = kTileHoverColor;
|
||||
palette.rowSelectedColor = kTileSelectedColor;
|
||||
palette.rowSelectedFocusedColor = kTileSelectedColor;
|
||||
palette.disclosureColor = kTextMuted;
|
||||
palette.textColor = kTextPrimary;
|
||||
return palette;
|
||||
::XCEngine::UI::UITextureHandle ResolveFolderIcon(const ProductBuiltInIcons* icons) {
|
||||
return icons != nullptr
|
||||
? icons->Resolve(ProductBuiltInIconKind::Folder)
|
||||
: ::XCEngine::UI::UITextureHandle {};
|
||||
}
|
||||
|
||||
float ClampNavigationWidth(float value, float totalWidth) {
|
||||
@@ -398,6 +377,14 @@ void ProductProjectPanel::Initialize(const std::filesystem::path& repoRoot) {
|
||||
RefreshAssetList();
|
||||
}
|
||||
|
||||
void ProductProjectPanel::SetBuiltInIcons(const ProductBuiltInIcons* icons) {
|
||||
m_icons = icons;
|
||||
if (!m_assetsRootPath.empty()) {
|
||||
RefreshFolderTree();
|
||||
SyncCurrentFolderSelection();
|
||||
}
|
||||
}
|
||||
|
||||
void ProductProjectPanel::SetTextMeasurer(const UIEditorTextMeasurer* textMeasurer) {
|
||||
m_textMeasurer = textMeasurer;
|
||||
}
|
||||
@@ -624,6 +611,7 @@ void ProductProjectPanel::RefreshFolderTree() {
|
||||
item.label = PathToUtf8String(folderPath.filename());
|
||||
item.depth = depth;
|
||||
item.forceLeaf = !HasChildDirectories(folderPath);
|
||||
item.leadingIcon = ResolveFolderIcon(m_icons);
|
||||
m_treeItems.push_back(std::move(item));
|
||||
|
||||
const std::vector<std::filesystem::path> childFolders =
|
||||
@@ -776,7 +764,7 @@ void ProductProjectPanel::Update(
|
||||
|
||||
m_navigationWidth = ClampNavigationWidth(m_navigationWidth, panelState->bounds.width);
|
||||
m_layout = BuildLayout(panelState->bounds);
|
||||
const UIEditorTreeViewMetrics treeMetrics = BuildTreeMetrics();
|
||||
const Widgets::UIEditorTreeViewMetrics treeMetrics = BuildProductTreeViewMetrics();
|
||||
const std::vector<UIInputEvent> treeEvents =
|
||||
FilterTreeInputEvents(filteredEvents, m_splitterDragging);
|
||||
m_treeFrame = UpdateUIEditorTreeViewInteraction(
|
||||
@@ -947,8 +935,8 @@ void ProductProjectPanel::Append(UIDrawList& drawList) const {
|
||||
kHeaderBottomBorderThickness),
|
||||
ResolveUIEditorDockHostPalette().splitterColor);
|
||||
|
||||
const UIEditorTreeViewPalette treePalette = BuildTreePalette();
|
||||
const UIEditorTreeViewMetrics treeMetrics = BuildTreeMetrics();
|
||||
const Widgets::UIEditorTreeViewPalette treePalette = BuildProductTreeViewPalette();
|
||||
const Widgets::UIEditorTreeViewMetrics treeMetrics = BuildProductTreeViewMetrics();
|
||||
AppendUIEditorTreeViewBackground(
|
||||
drawList,
|
||||
m_treeFrame.layout,
|
||||
|
||||
Reference in New Issue
Block a user