1
0
mirror of synced 2024-11-05 02:59:16 +00:00

Fixed #3: Sort the function list in the button selection screen

This commit is contained in:
Mark van Renswoude 2017-06-11 08:53:14 +02:00
parent 71a65c91c9
commit c79e1d75ba
2 changed files with 27 additions and 2 deletions

View File

@ -255,13 +255,15 @@ object ButtonFunctionForm: TButtonFunctionForm
Header.Font.Height = -11 Header.Font.Height = -11
Header.Font.Name = 'Tahoma' Header.Font.Name = 'Tahoma'
Header.Font.Style = [] Header.Font.Style = []
Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoShowSortGlyphs, hoVisible] Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoShowSortGlyphs, hoVisible, hoHeaderClickAutoSort]
Header.SortColumn = 0
IncrementalSearch = isAll IncrementalSearch = isAll
TabOrder = 1 TabOrder = 1
TreeOptions.AutoOptions = [toAutoDropExpand, toAutoScrollOnExpand, toAutoSort, toAutoTristateTracking, toAutoDeleteMovedNodes] TreeOptions.AutoOptions = [toAutoDropExpand, toAutoScrollOnExpand, toAutoSort, toAutoTristateTracking, toAutoDeleteMovedNodes]
TreeOptions.MiscOptions = [toAcceptOLEDrop, toFullRepaintOnResize, toInitOnSave, toWheelPanning, toEditOnClick] TreeOptions.MiscOptions = [toAcceptOLEDrop, toFullRepaintOnResize, toInitOnSave, toWheelPanning, toEditOnClick]
TreeOptions.PaintOptions = [toShowButtons, toShowDropmark, toShowTreeLines, toThemeAware, toUseBlendedImages] TreeOptions.PaintOptions = [toShowButtons, toShowDropmark, toShowTreeLines, toThemeAware, toUseBlendedImages]
TreeOptions.SelectionOptions = [toFullRowSelect] TreeOptions.SelectionOptions = [toFullRowSelect]
OnCompareNodes = vstFunctionsCompareNodes
OnFocusChanged = vstFunctionsFocusChanged OnFocusChanged = vstFunctionsFocusChanged
OnFreeNode = vstFunctionsFreeNode OnFreeNode = vstFunctionsFreeNode
OnGetText = vstFunctionsGetText OnGetText = vstFunctionsGetText
@ -270,7 +272,7 @@ object ButtonFunctionForm: TButtonFunctionForm
Columns = < Columns = <
item item
Position = 0 Position = 0
Width = 257 Width = 253
WideText = 'Available functions' WideText = 'Available functions'
end> end>
end end

View File

@ -66,6 +66,7 @@ type
procedure vstFunctionsGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; var CellText: string); procedure vstFunctionsGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; var CellText: string);
procedure vstFunctionsIncrementalSearch(Sender: TBaseVirtualTree; Node: PVirtualNode; const SearchText: string; var Result: Integer); procedure vstFunctionsIncrementalSearch(Sender: TBaseVirtualTree; Node: PVirtualNode; const SearchText: string; var Result: Integer);
procedure vstFunctionsPaintText(Sender: TBaseVirtualTree; const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType); procedure vstFunctionsPaintText(Sender: TBaseVirtualTree; const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType);
procedure vstFunctionsCompareNodes(Sender: TBaseVirtualTree; Node1, Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);
private private
FProfile: TProfile; FProfile: TProfile;
FButtonIndex: Integer; FButtonIndex: Integer;
@ -533,6 +534,28 @@ begin
end; end;
procedure TButtonFunctionForm.vstFunctionsCompareNodes(Sender: TBaseVirtualTree; Node1, Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);
var
nodeData1: PFunctionNodeData;
nodeData2: PFunctionNodeData;
begin
nodeData1 := Sender.GetNodeData(Node1);
nodeData2 := Sender.GetNodeData(Node2);
if nodeData1^.NodeType <> nodeData2^.NodeType then
exit;
case nodeData1^.NodeType of
ntCategory:
Result := CompareText(nodeData1^.LEDFunction.GetCategoryName, nodeData2^.LEDFunction.GetCategoryName);
ntFunction:
Result := CompareText(nodeData1^.LEDFunction.GetDisplayName, nodeData2^.LEDFunction.GetDisplayName);
end;
end;
procedure TButtonFunctionForm.vstFunctionsFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex); procedure TButtonFunctionForm.vstFunctionsFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex);
var var
nodeData: PFunctionNodeData; nodeData: PFunctionNodeData;