mirror of
https://github.com/zodiacon/WFPExplorer
synced 2026-06-08 18:39:31 +00:00
UI improvements
tree hierarchy set as default view
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#include "StringHelper.h"
|
||||
#include <WFPEngine.h>
|
||||
|
||||
CFilterConditionsPage::CFilterConditionsPage(WFPEngine& engine, WFPFilterInfo& filter) : m_Engine(engine), m_Filter(filter) {
|
||||
CFilterConditionsPage::CFilterConditionsPage(WFPEngine& engine, WFPFilterInfo const& filter) : m_Engine(engine), m_Filter(filter) {
|
||||
}
|
||||
|
||||
CString CFilterConditionsPage::GetColumnText(HWND, int row, int col) const {
|
||||
|
||||
@@ -16,7 +16,7 @@ class CFilterConditionsPage :
|
||||
public:
|
||||
enum { IDD = IDD_FILTERCONDITIONS };
|
||||
|
||||
CFilterConditionsPage(WFPEngine& engine, WFPFilterInfo& filter);
|
||||
CFilterConditionsPage(WFPEngine& engine, WFPFilterInfo const& filter);
|
||||
|
||||
CString GetColumnText(HWND, int row, int col) const;
|
||||
void OnStateChanged(HWND, int from, int to, UINT oldState, UINT newState);
|
||||
@@ -37,7 +37,7 @@ private:
|
||||
|
||||
private:
|
||||
WFPEngine& m_Engine;
|
||||
WFPFilterInfo& m_Filter;
|
||||
WFPFilterInfo const& m_Filter;
|
||||
std::vector<WFPFilterCondition> m_Conditions;
|
||||
CListViewCtrl m_List;
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <WFPEngine.h>
|
||||
#include "WFPHelper.h"
|
||||
|
||||
CFilterGeneralPage::CFilterGeneralPage(WFPEngine& engine, WFPFilterInfo& filter) : m_Engine(engine), m_Filter(filter) {
|
||||
CFilterGeneralPage::CFilterGeneralPage(WFPEngine& engine, WFPFilterInfo const& filter) : m_Engine(engine), m_Filter(filter) {
|
||||
}
|
||||
|
||||
LRESULT CFilterGeneralPage::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&) {
|
||||
@@ -46,3 +46,16 @@ LRESULT CFilterGeneralPage::OnShowLayer(WORD, WORD, HWND, BOOL&) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CFilterGeneralPage::OnShowProvider(WORD, WORD, HWND, BOOL&) {
|
||||
auto provider = m_Engine.GetProviderByKey(m_Filter.ProviderKey);
|
||||
if (!provider)
|
||||
AtlMessageBox(m_hWnd, L"Provider not found", IDS_TITLE, MB_ICONERROR);
|
||||
else
|
||||
WFPHelper::ShowProviderProperties(m_Engine, *provider);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CFilterGeneralPage::OnShowSublayer(WORD, WORD, HWND, BOOL&) {
|
||||
return LRESULT();
|
||||
}
|
||||
|
||||
@@ -12,10 +12,12 @@ class CFilterGeneralPage :
|
||||
public:
|
||||
enum { IDD = IDD_FILTERINFO };
|
||||
|
||||
CFilterGeneralPage(WFPEngine& engine, WFPFilterInfo& filter);
|
||||
CFilterGeneralPage(WFPEngine& engine, WFPFilterInfo const& filter);
|
||||
|
||||
BEGIN_MSG_MAP(CFilterGeneralPage)
|
||||
COMMAND_ID_HANDLER(IDC_LAYER_PROP, OnShowLayer)
|
||||
COMMAND_ID_HANDLER(IDC_PROVIDER_PROP, OnShowProvider)
|
||||
COMMAND_ID_HANDLER(IDC_SUBLAYER_PROP, OnShowSublayer)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
END_MSG_MAP()
|
||||
|
||||
@@ -27,8 +29,10 @@ private:
|
||||
|
||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnShowLayer(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnShowProvider(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnShowSublayer(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||
|
||||
private:
|
||||
WFPEngine& m_Engine;
|
||||
WFPFilterInfo& m_Filter;
|
||||
WFPFilterInfo const& m_Filter;
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "FilterConditionsPage.h"
|
||||
#include "WFPHelper.h"
|
||||
#include <ResizablePropertySheet.h>
|
||||
#include "AppSettings.h"
|
||||
|
||||
CFiltersView::CFiltersView(IMainFrame* frame, WFPEngine& engine) : CFrameView(frame), m_Engine(engine) {
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "pch.h"
|
||||
#include "HierarchyView.h"
|
||||
#include "resource.h"
|
||||
#include "WFPHelper.h"
|
||||
#include "StringHelper.h"
|
||||
#include <ranges>
|
||||
@@ -53,6 +52,11 @@ void CHierarchyView::OnTreeSelChanged(HWND tree, HTREEITEM hOld, HTREEITEM hNew)
|
||||
}
|
||||
if (hOldView && hOldView != hNewView)
|
||||
::ShowWindow(hOldView, SW_HIDE);
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
bool CHierarchyView::OnTreeDoubleClick(HWND tree, HTREEITEM hItem) {
|
||||
return ShowProperties(hItem);
|
||||
}
|
||||
|
||||
void CHierarchyView::BuildTree() {
|
||||
@@ -66,6 +70,8 @@ void CHierarchyView::BuildTree() {
|
||||
auto filters = m_Engine.EnumFilters();
|
||||
auto callouts = m_Engine.EnumCallouts();
|
||||
m_LayersMap.clear();
|
||||
m_FiltersMap.clear();
|
||||
m_CalloutsMap.clear();
|
||||
|
||||
for (auto& layer : m_Engine.EnumLayers()) {
|
||||
auto hLayer = InsertTreeItem(m_Tree, WFPHelper::GetLayerName(m_Engine, layer.LayerKey), 1, TreeItemType::Layer, hLayers, TVI_SORT);
|
||||
@@ -79,7 +85,8 @@ void CHierarchyView::BuildTree() {
|
||||
auto name = WFPHelper::GetFilterName(m_Engine, v.FilterKey);
|
||||
if (name[0] != L'{')
|
||||
name += L" " + StringHelper::GuidToString(v.FilterKey);
|
||||
InsertTreeItem(m_Tree, name, 0, TreeItemType::Filter, hFilters, TVI_SORT);
|
||||
auto hFilter = InsertTreeItem(m_Tree, name, 0, TreeItemType::Filter, hFilters, TVI_SORT);
|
||||
m_FiltersMap.insert({ hFilter, v.FilterKey });
|
||||
count++;
|
||||
}
|
||||
m_Tree.SetItemText(hFilters, std::format(L"Filters ({})", count).c_str());
|
||||
@@ -94,7 +101,8 @@ void CHierarchyView::BuildTree() {
|
||||
CString name = v.Name.c_str();
|
||||
if (name[0] != L'{')
|
||||
name += L" " + StringHelper::GuidToString(v.CalloutKey);
|
||||
InsertTreeItem(m_Tree, name, 0, TreeItemType::Callout, hCallouts, TVI_SORT);
|
||||
auto hCallout = InsertTreeItem(m_Tree, name, 2, TreeItemType::Callout, hCallouts, TVI_SORT);
|
||||
m_CalloutsMap.insert({ hCallout, v.CalloutKey });
|
||||
count++;
|
||||
}
|
||||
m_Tree.SetItemText(hCallouts, std::format(L"Callouts ({})", count).c_str());
|
||||
@@ -107,6 +115,32 @@ void CHierarchyView::BuildTree() {
|
||||
m_Tree.SetRedraw();
|
||||
}
|
||||
|
||||
void CHierarchyView::UpdateUI() {
|
||||
auto& ui = Frame()->UI();
|
||||
auto hItem = m_Tree.GetSelectedItem();
|
||||
auto type = hItem ? GetItemData<TreeItemType>(m_Tree, hItem) : TreeItemType::None;
|
||||
ui.UIEnable(ID_EDIT_PROPERTIES, type == TreeItemType::Filter || type == TreeItemType::Layer);
|
||||
ui.UIEnable(ID_EDIT_COPY, type != TreeItemType::None);
|
||||
}
|
||||
|
||||
bool CHierarchyView::ShowProperties(HTREEITEM hItem) {
|
||||
auto type = GetItemData<TreeItemType>(m_Tree, hItem);
|
||||
switch (type) {
|
||||
case TreeItemType::Layer:
|
||||
WFPHelper::ShowLayerProperties(m_Engine, *m_Engine.GetLayerByKey(m_LayersMap[hItem]));
|
||||
return true;
|
||||
|
||||
case TreeItemType::Filter:
|
||||
WFPHelper::ShowFilterProperties(m_Engine, *m_Engine.GetFilterByKey(m_FiltersMap[hItem], false));
|
||||
return true;
|
||||
|
||||
case TreeItemType::Callout:
|
||||
//WFPHelper::ShowCalloutProperties(m_Engine, *m_Engine.GetCalloutByKey(m_CalloutsMap[hItem], false));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
LRESULT CHierarchyView::OnCreate(UINT, WPARAM, LPARAM, BOOL&) {
|
||||
m_hWndClient = m_Splitter.Create(m_hWnd, rcDefault, nullptr, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
|
||||
m_Tree.Create(m_Splitter, rcDefault, nullptr, WS_CHILD | WS_VISIBLE | TVS_SHOWSELALWAYS | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT);
|
||||
@@ -148,3 +182,8 @@ LRESULT CHierarchyView::OnSetFocus(UINT, WPARAM, LPARAM, BOOL&) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CHierarchyView::OnProperties(WORD, WORD, HWND, BOOL&) {
|
||||
ShowProperties(m_Tree.GetSelectedItem());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <VirtualListView.h>
|
||||
#include "Interfaces.h"
|
||||
#include <WFPEngine.h>
|
||||
#include "resource.h"
|
||||
|
||||
class WFPEngine;
|
||||
class CLayersView;
|
||||
@@ -19,13 +20,15 @@ public:
|
||||
|
||||
void Refresh();
|
||||
void OnTreeSelChanged(HWND tree, HTREEITEM hOld, HTREEITEM hNew);
|
||||
bool OnTreeDoubleClick(HWND tree, HTREEITEM hItem);
|
||||
|
||||
BEGIN_MSG_MAP(CHierarchyView)
|
||||
MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
|
||||
MESSAGE_HANDLER(WM_CREATE, OnCreate)
|
||||
CHAIN_MSG_MAP(CTreeViewHelper<CHierarchyView>)
|
||||
CHAIN_MSG_MAP(BaseFrame)
|
||||
ALT_MSG_MAP(1)
|
||||
ALT_MSG_MAP(1)
|
||||
COMMAND_ID_HANDLER(ID_EDIT_PROPERTIES, OnProperties)
|
||||
COMMAND_ID_HANDLER(ID_VIEW_REFRESH, OnRefresh)
|
||||
END_MSG_MAP()
|
||||
|
||||
@@ -40,10 +43,13 @@ private:
|
||||
};
|
||||
|
||||
void BuildTree();
|
||||
void UpdateUI();
|
||||
bool ShowProperties(HTREEITEM hItem);
|
||||
|
||||
LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnRefresh(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnProperties(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||
|
||||
WFPEngine& m_Engine;
|
||||
|
||||
@@ -53,4 +59,6 @@ private:
|
||||
CFiltersView* m_FiltersView;
|
||||
CCalloutsView* m_CalloutsView;
|
||||
std::unordered_map<HTREEITEM, GUID> m_LayersMap;
|
||||
std::unordered_map<HTREEITEM, GUID> m_FiltersMap;
|
||||
std::unordered_map<HTREEITEM, GUID> m_CalloutsMap;
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "StringHelper.h"
|
||||
#include <SortHelper.h>
|
||||
|
||||
CLayerFieldsPage::CLayerFieldsPage(WFPEngine& engine, WFPLayerInfo& layer) : m_Engine(engine), m_Layer(layer) {
|
||||
CLayerFieldsPage::CLayerFieldsPage(WFPEngine& engine, WFPLayerInfo const& layer) : m_Engine(engine), m_Layer(layer) {
|
||||
}
|
||||
|
||||
CString CLayerFieldsPage::GetColumnText(HWND, int row, int col) const {
|
||||
|
||||
@@ -16,7 +16,7 @@ class CLayerFieldsPage :
|
||||
public:
|
||||
enum { IDD = IDD_LAYERFIELDS };
|
||||
|
||||
CLayerFieldsPage(WFPEngine& engine, WFPLayerInfo& layer);
|
||||
CLayerFieldsPage(WFPEngine& engine, WFPLayerInfo const& layer);
|
||||
|
||||
CString GetColumnText(HWND, int row, int col) const;
|
||||
void DoSort(SortInfo const* si);
|
||||
@@ -37,7 +37,7 @@ private:
|
||||
|
||||
private:
|
||||
WFPEngine& m_Engine;
|
||||
WFPLayerInfo& m_Layer;
|
||||
WFPLayerInfo const& m_Layer;
|
||||
std::vector<WFPFieldInfo> m_Fields;
|
||||
CListViewCtrl m_List;
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "StringHelper.h"
|
||||
#include "WFPHelper.h"
|
||||
|
||||
CLayerGeneralPage::CLayerGeneralPage(WFPEngine& engine, WFPLayerInfo& layer) : m_Engine(engine), m_Layer(layer) {
|
||||
CLayerGeneralPage::CLayerGeneralPage(WFPEngine& engine, WFPLayerInfo const& layer) : m_Engine(engine), m_Layer(layer) {
|
||||
}
|
||||
|
||||
LRESULT CLayerGeneralPage::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&) {
|
||||
@@ -20,6 +20,8 @@ LRESULT CLayerGeneralPage::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&) {
|
||||
flags = L"(None)";
|
||||
SetDlgItemText(IDC_FLAGS, flags);
|
||||
SetDlgItemText(IDC_SUBLAYER, WFPHelper::GetSublayerName(m_Engine, m_Layer.DefaultSubLayerKey));
|
||||
SetDlgItemInt(IDC_FILTERS, m_Engine.GetFilterCount(m_Layer.LayerKey), false);
|
||||
SetDlgItemInt(IDC_CALLOUTS, m_Engine.GetCalloutCount(m_Layer.LayerKey), false);
|
||||
|
||||
AddIconToButton(IDC_SUBLAYER_PROP, IDI_SUBLAYER);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class CLayerGeneralPage :
|
||||
public:
|
||||
enum { IDD = IDD_LAYERINFO };
|
||||
|
||||
CLayerGeneralPage(WFPEngine& engine, WFPLayerInfo& layer);
|
||||
CLayerGeneralPage(WFPEngine& engine, WFPLayerInfo const& layer);
|
||||
|
||||
BEGIN_MSG_MAP(CLayerGeneralPage)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
@@ -28,5 +28,5 @@ private:
|
||||
|
||||
private:
|
||||
WFPEngine& m_Engine;
|
||||
WFPLayerInfo& m_Layer;
|
||||
WFPLayerInfo const& m_Layer;
|
||||
};
|
||||
|
||||
@@ -239,6 +239,10 @@ BEGIN
|
||||
LTEXT "Fields:",IDC_STATIC,317,78,22,8
|
||||
EDITTEXT IDC_FIELDS,344,76,42,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE
|
||||
EDITTEXT IDC_SUBLAYER,67,96,274,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE
|
||||
LTEXT "Filters:",IDC_STATIC,7,118,23,8
|
||||
EDITTEXT IDC_FILTERS,43,116,42,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE
|
||||
LTEXT "Callouts:",IDC_STATIC,106,118,29,8
|
||||
EDITTEXT IDC_CALLOUTS,142,116,42,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_STATICEDGE
|
||||
END
|
||||
|
||||
IDD_LAYERFIELDS DIALOGEX 0, 0, 389, 254
|
||||
|
||||
@@ -47,7 +47,7 @@ CString WFPHelper::GetSublayerName(WFPEngine const& engine, GUID const& key) {
|
||||
return L"";
|
||||
}
|
||||
|
||||
int WFPHelper::ShowLayerProperties(WFPEngine& engine, WFPLayerInfo& layer) {
|
||||
int WFPHelper::ShowLayerProperties(WFPEngine& engine, WFPLayerInfo const& layer) {
|
||||
auto name = L"Layer Properties (" + GetLayerName(engine, layer.LayerKey) + L")";
|
||||
CPropertySheet sheet((PCWSTR)name);
|
||||
sheet.m_psh.dwFlags |= PSH_NOAPPLYNOW | PSH_USEICONID | PSH_NOCONTEXTHELP | PSH_RESIZABLE;
|
||||
@@ -66,7 +66,7 @@ int WFPHelper::ShowLayerProperties(WFPEngine& engine, WFPLayerInfo& layer) {
|
||||
return (int)sheet.DoModal();
|
||||
}
|
||||
|
||||
int WFPHelper::ShowFilterProperties(WFPEngine& engine, WFPFilterInfo& filter) {
|
||||
int WFPHelper::ShowFilterProperties(WFPEngine& engine, WFPFilterInfo const& filter) {
|
||||
auto name = L"Filter Properties (" + GetFilterName(engine, filter.FilterKey) + L")";
|
||||
CPropertySheet sheet((PCWSTR)name);
|
||||
sheet.m_psh.dwFlags |= PSH_NOAPPLYNOW | PSH_USEICONID | PSH_NOCONTEXTHELP | PSH_RESIZABLE;
|
||||
@@ -83,3 +83,11 @@ int WFPHelper::ShowFilterProperties(WFPEngine& engine, WFPFilterInfo& filter) {
|
||||
}
|
||||
return (int)sheet.DoModal();
|
||||
}
|
||||
|
||||
int WFPHelper::ShowSublayerProperties(WFPEngine& engine, WFPSubLayerInfo& layer) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int WFPHelper::ShowProviderProperties(WFPEngine& engine, WFPProviderInfo& layer) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3,13 +3,17 @@
|
||||
class WFPEngine;
|
||||
struct WFPLayerInfo;
|
||||
struct WFPFilterInfo;
|
||||
struct WFPProviderInfo;
|
||||
struct WFPSubLayerInfo;
|
||||
|
||||
struct WFPHelper abstract final {
|
||||
static CString GetProviderName(WFPEngine const& engine, GUID const& key);
|
||||
static CString GetFilterName(WFPEngine const& engine, GUID const& key);
|
||||
static CString GetLayerName(WFPEngine const& engine, GUID const& key);
|
||||
static CString GetSublayerName(WFPEngine const& engine, GUID const& key);
|
||||
static int ShowLayerProperties(WFPEngine& engine, WFPLayerInfo& layer);
|
||||
static int ShowFilterProperties(WFPEngine& engine, WFPFilterInfo& layer);
|
||||
static int ShowLayerProperties(WFPEngine& engine, WFPLayerInfo const& layer);
|
||||
static int ShowFilterProperties(WFPEngine& engine, WFPFilterInfo const& layer);
|
||||
static int ShowSublayerProperties(WFPEngine& engine, WFPSubLayerInfo& layer);
|
||||
static int ShowProviderProperties(WFPEngine& engine, WFPProviderInfo& layer);
|
||||
};
|
||||
|
||||
|
||||
@@ -48,8 +48,11 @@
|
||||
#define IDC_FIELDS 1008
|
||||
#define IDC_CALLOUT_OR_FILTER 1009
|
||||
#define IDC_LIST 1009
|
||||
#define IDC_FILTERS 1009
|
||||
#define IDC_ID 1010
|
||||
#define IDC_WEIGHT 1011
|
||||
#define IDC_FILTERS2 1011
|
||||
#define IDC_CALLOUTS 1011
|
||||
#define IDC_EFFECTIVEWEIGHT 1012
|
||||
#define IDC_SUBLAYER 1013
|
||||
#define IDC_SUBLAYER_PROP 1014
|
||||
@@ -61,6 +64,7 @@
|
||||
#define ID_OPTIONS_ALWAYSONTOP 32775
|
||||
#define ID_OPTIONS_DARKMODE 32776
|
||||
#define ID_OPTIONS_FONT 32777
|
||||
#define ID_VIEW_HIERARCHY 32778
|
||||
#define ID_VIEW_SESSIONS 32779
|
||||
#define ID_VIEW_FILTERS 32780
|
||||
#define ID_VIEW_LAYERS 32781
|
||||
@@ -69,7 +73,6 @@
|
||||
#define ID_VIEW_PROVIDERS 32784
|
||||
#define ID_VIEW_PROVIDERCONTEXTS 32785
|
||||
#define ID_EDIT_PROPERTIES 32786
|
||||
#define ID_VIEW_HIERARCHY 32778
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user