1
0
mirror of synced 2024-11-22 10:03:51 +00:00

Added Tail wheel lock, Water rudder and Float functions

Improved search functionality
This commit is contained in:
Mark van Renswoude 2016-03-20 10:58:29 +00:00
parent 57037928ca
commit 06faf2aa88
8 changed files with 347 additions and 42 deletions

View File

@ -13,10 +13,14 @@ object ButtonFunctionForm: TButtonFunctionForm
Font.Height = -11 Font.Height = -11
Font.Name = 'Tahoma' Font.Name = 'Tahoma'
Font.Style = [] Font.Style = []
KeyPreview = True
OldCreateOrder = False OldCreateOrder = False
Position = poMainFormCenter Position = poMainFormCenter
OnCreate = FormCreate OnCreate = FormCreate
OnDestroy = FormDestroy OnDestroy = FormDestroy
OnKeyDown = FormKeyDown
OnKeyPress = FormKeyPress
OnShow = FormShow
PixelsPerInch = 96 PixelsPerInch = 96
TextHeight = 13 TextHeight = 13
object bvlHeader: TBevel object bvlHeader: TBevel
@ -69,7 +73,6 @@ object ButtonFunctionForm: TButtonFunctionForm
Width = 75 Width = 75
Height = 25 Height = 25
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
Cancel = True
Caption = 'Cancel' Caption = 'Cancel'
ModalResult = 2 ModalResult = 2
TabOrder = 1 TabOrder = 1
@ -240,9 +243,6 @@ object ButtonFunctionForm: TButtonFunctionForm
Align = alLeft Align = alLeft
BevelOuter = bvNone BevelOuter = bvNone
TabOrder = 3 TabOrder = 3
ExplicitLeft = 265
ExplicitTop = 52
ExplicitHeight = 458
object vstFunctions: TVirtualStringTree object vstFunctions: TVirtualStringTree
Left = 0 Left = 0
Top = 29 Top = 29
@ -266,8 +266,6 @@ object ButtonFunctionForm: TButtonFunctionForm
OnGetText = vstFunctionsGetText OnGetText = vstFunctionsGetText
OnPaintText = vstFunctionsPaintText OnPaintText = vstFunctionsPaintText
OnIncrementalSearch = vstFunctionsIncrementalSearch OnIncrementalSearch = vstFunctionsIncrementalSearch
ExplicitTop = 8
ExplicitHeight = 450
Columns = < Columns = <
item item
Position = 0 Position = 0
@ -294,13 +292,21 @@ object ButtonFunctionForm: TButtonFunctionForm
Font.Style = [] Font.Style = []
ParentFont = False ParentFont = False
TabOrder = 0 TabOrder = 0
Text = 'Search...' Text = 'Search (Ctrl+F)...'
OnChange = edtSearchChange OnChange = edtSearchChange
OnEnter = edtSearchEnter OnEnter = edtSearchEnter
OnExit = edtSearchExit OnExit = edtSearchExit
ExplicitLeft = 72 OnKeyDown = edtSearchKeyDown
ExplicitTop = 216 OnKeyUp = edtSearchKeyUp
ExplicitWidth = 121 end
end
object ActionList: TActionList
Left = 40
Top = 136
object actSearch: TAction
Caption = 'actSearch'
ShortCut = 16454
OnExecute = actSearchExecute
end end
end end
end end

View File

@ -16,7 +16,7 @@ uses
LEDColorIntf, LEDColorIntf,
LEDFunctionIntf, LEDFunctionIntf,
LEDStateIntf, LEDStateIntf,
Profile; Profile, Vcl.ActnList;
type type
@ -45,17 +45,25 @@ type
bvlFooter: TBevel; bvlFooter: TBevel;
pnlFunctions: TPanel; pnlFunctions: TPanel;
edtSearch: TEdit; edtSearch: TEdit;
ActionList: TActionList;
actSearch: TAction;
procedure FormCreate(Sender: TObject); procedure actSearchExecute(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure vstFunctionsGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; var CellText: string);
procedure vstFunctionsPaintText(Sender: TBaseVirtualTree; const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType);
procedure vstFunctionsFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex);
procedure vstFunctionsIncrementalSearch(Sender: TBaseVirtualTree; Node: PVirtualNode; const SearchText: string; var Result: Integer);
procedure btnOKClick(Sender: TObject); procedure btnOKClick(Sender: TObject);
procedure edtSearchChange(Sender: TObject); procedure edtSearchChange(Sender: TObject);
procedure edtSearchEnter(Sender: TObject); procedure edtSearchEnter(Sender: TObject);
procedure edtSearchExit(Sender: TObject); procedure edtSearchExit(Sender: TObject);
procedure edtSearchKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure edtSearchKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormShow(Sender: TObject);
procedure vstFunctionsFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex);
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 vstFunctionsPaintText(Sender: TBaseVirtualTree; const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType);
private private
FProfile: TProfile; FProfile: TProfile;
FButtonIndex: Integer; FButtonIndex: Integer;
@ -70,6 +78,7 @@ type
procedure LoadFunctions; procedure LoadFunctions;
procedure ApplyFilter(const AFilter: string); procedure ApplyFilter(const AFilter: string);
procedure EnsureSelection;
procedure SetFunction(AProvider: ILEDFunctionProvider; AFunction: ILEDFunction); procedure SetFunction(AProvider: ILEDFunctionProvider; AFunction: ILEDFunction);
procedure LoadStates(AProvider: ILEDFunctionProvider; AFunction: ILEDMultiStateFunction); procedure LoadStates(AProvider: ILEDFunctionProvider; AFunction: ILEDMultiStateFunction);
@ -172,6 +181,31 @@ begin
end; end;
procedure TButtonFunctionForm.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_ESCAPE then
begin
if (ActiveControl = edtSearch) and (Length(Trim(edtSearch.Text)) > 0) then
edtSearch.Text := ''
else
ModalResult := mrCancel;
end;
end;
procedure TButtonFunctionForm.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = Chr(VK_ESCAPE) then
Key := #0;
end;
procedure TButtonFunctionForm.FormShow(Sender: TObject);
begin
ActiveControl := vstFunctions;
end;
procedure TButtonFunctionForm.LoadFunctions; procedure TButtonFunctionForm.LoadFunctions;
var var
categoryNodes: TDictionary<string,PVirtualNode>; categoryNodes: TDictionary<string,PVirtualNode>;
@ -227,12 +261,17 @@ begin
nodeData^.LEDFunction := ledFunction; nodeData^.LEDFunction := ledFunction;
if isCurrentProvider and Assigned(CurrentFunction) and (ledFunction.GetUID = CurrentFunction.GetUID) then if isCurrentProvider and Assigned(CurrentFunction) and (ledFunction.GetUID = CurrentFunction.GetUID) then
begin
vstFunctions.FocusedNode := node;
vstFunctions.Selected[node] := True; vstFunctions.Selected[node] := True;
end; end;
end; end;
end;
finally finally
FreeAndNil(categoryNodes); FreeAndNil(categoryNodes);
end; end;
EnsureSelection;
finally finally
vstFunctions.EndUpdate; vstFunctions.EndUpdate;
end; end;
@ -262,32 +301,47 @@ begin
begin begin
nodeData := vstFunctions.GetNodeData(functionNode); nodeData := vstFunctions.GetNodeData(functionNode);
if nodeData^.NodeType = ntFunction then if nodeData^.NodeType = ntFunction then
begin vstFunctions.IsVisible[functionNode] := (not hasFilter) or ContainsText(nodeData^.LEDFunction.GetDisplayName, AFilter);
if hasFilter and (not ContainsText(nodeData^.LEDFunction.GetDisplayName, AFilter)) then
Exclude(functionNode^.States, vsVisible)
else
Include(functionNode^.States, vsVisible);
end;
if vsVisible in functionNode^.States then if vstFunctions.IsVisible[functionNode] then
hasVisibleChildren := True; hasVisibleChildren := True;
functionNode := vstFunctions.GetNextSibling(functionNode); functionNode := vstFunctions.GetNextSibling(functionNode);
end; end;
if hasVisibleChildren then vstFunctions.IsVisible[categoryNode] := hasVisibleChildren;
Include(categoryNode^.States, vsVisible)
else
Exclude(categoryNode^.States, vsVisible);
categoryNode := vstFunctions.GetNextSibling(categoryNode); categoryNode := vstFunctions.GetNextSibling(categoryNode);
end; end;
EnsureSelection;
finally finally
vstFunctions.EndUpdate; vstFunctions.EndUpdate;
end; end;
end; end;
procedure TButtonFunctionForm.EnsureSelection;
begin
if (not Assigned(vstFunctions.FocusedNode)) or
(not vstFunctions.IsVisible[vstFunctions.FocusedNode]) then
begin
vstFunctions.FocusedNode := vstFunctions.IterateSubtree(nil,
procedure(Sender: TBaseVirtualTree; Node: PVirtualNode; Data: Pointer; var Abort: Boolean)
begin
Abort := (PFunctionNodeData(Sender.GetNodeData(Node))^.NodeType = ntFunction);
end,
nil,
[vsVisible]);
if Assigned(vstFunctions.FocusedNode) then
vstFunctions.Selected[vstFunctions.FocusedNode] := True;
end;
if Assigned(vstFunctions.FocusedNode) then
vstFunctions.ScrollIntoView(vstFunctions.FocusedNode, False);
end;
procedure TButtonFunctionForm.SetFunction(AProvider: ILEDFunctionProvider; AFunction: ILEDFunction); procedure TButtonFunctionForm.SetFunction(AProvider: ILEDFunctionProvider; AFunction: ILEDFunction);
var var
multiStateFunction: ILEDMultiStateFunction; multiStateFunction: ILEDMultiStateFunction;
@ -427,6 +481,12 @@ begin
end; end;
procedure TButtonFunctionForm.actSearchExecute(Sender: TObject);
begin
ActiveControl := edtSearch;
end;
procedure TButtonFunctionForm.btnOKClick(Sender: TObject); procedure TButtonFunctionForm.btnOKClick(Sender: TObject);
var var
multiStateFunction: ILEDMultiStateFunction; multiStateFunction: ILEDMultiStateFunction;
@ -557,13 +617,25 @@ begin
if Length(Trim(edtSearch.Text)) = 0 then if Length(Trim(edtSearch.Text)) = 0 then
begin begin
edtSearch.Tag := 1; edtSearch.Tag := 1;
edtSearch.Text := 'Search...'; edtSearch.Text := 'Search (Ctrl+F)...';
edtSearch.Font.Color := clGrayText; edtSearch.Font.Color := clGrayText;
end else end else
edtSearch.Tag := 0; edtSearch.Tag := 0;
end; end;
procedure TButtonFunctionForm.edtSearchKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if (Key in [VK_UP, VK_DOWN]) and (Shift = []) then
SendMessage(vstFunctions.Handle, WM_KEYDOWN, Key, 0);
end;
procedure TButtonFunctionForm.edtSearchKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if (Key in [VK_UP, VK_DOWN]) and (Shift = []) then
SendMessage(vstFunctions.Handle, WM_KEYUP, Key, 0);
end;
{ TStateControlInfo } { TStateControlInfo }
constructor TStateControlInfo.Create(AState: ILEDState; AStateLabel: TLabel; AComboBox: TComboBox); constructor TStateControlInfo.Create(AState: ILEDState; AStateLabel: TLabel; AComboBox: TComboBox);

View File

@ -8,7 +8,7 @@
<FrameworkType>VCL</FrameworkType> <FrameworkType>VCL</FrameworkType>
<ProjectVersion>13.4</ProjectVersion> <ProjectVersion>13.4</ProjectVersion>
<Base>True</Base> <Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config> <Config Condition="'$(Config)'==''">Release</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform> <Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms> <TargetedPlatforms>1</TargetedPlatforms>
<AppType>Application</AppType> <AppType>Application</AppType>
@ -49,7 +49,8 @@
<Base>true</Base> <Base>true</Base>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''"> <PropertyGroup Condition="'$(Base)'!=''">
<VerInfo_Release>4</VerInfo_Release> <VerInfo_Build>1</VerInfo_Build>
<VerInfo_Release>5</VerInfo_Release>
<VerInfo_MinorVer>1</VerInfo_MinorVer> <VerInfo_MinorVer>1</VerInfo_MinorVer>
<DCC_UsePackage>rtl;dbrtl;$(DCC_UsePackage)</DCC_UsePackage> <DCC_UsePackage>rtl;dbrtl;$(DCC_UsePackage)</DCC_UsePackage>
<DCC_DcuOutput>Lib</DCC_DcuOutput> <DCC_DcuOutput>Lib</DCC_DcuOutput>
@ -59,7 +60,7 @@
<Manifest_File>None</Manifest_File> <Manifest_File>None</Manifest_File>
<Icon_MainIcon>G940LEDControl_Icon.ico</Icon_MainIcon> <Icon_MainIcon>G940LEDControl_Icon.ico</Icon_MainIcon>
<DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;$(DCC_Namespace)</DCC_Namespace> <DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Keys>CompanyName=X²Software;FileDescription=G940 LED Control;FileVersion=1.1.4.0;InternalName=;LegalCopyright=© 2011 - 2015 X²Software;LegalTrademarks=;OriginalFilename=G940LEDControl.exe;ProductName=G940 LED Control;ProductVersion=1.1;Comments=</VerInfo_Keys> <VerInfo_Keys>CompanyName=X²Software;FileDescription=G940 LED Control;FileVersion=1.1.5.1;InternalName=;LegalCopyright=© 2011 - 2015 X²Software;LegalTrademarks=;OriginalFilename=G940LEDControl.exe;ProductName=G940 LED Control;ProductVersion=1.1;Comments=</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale> <VerInfo_Locale>1033</VerInfo_Locale>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''"> <PropertyGroup Condition="'$(Base_Win64)'!=''">
@ -67,6 +68,7 @@
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File> <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''"> <PropertyGroup Condition="'$(Base_Win32)'!=''">
<VerInfo_Keys>CompanyName=X²Software;FileDescription=G940 LED Control;FileVersion=1.1.5.1;InternalName=;LegalCopyright=© 2011 - 2016 X²Software;LegalTrademarks=;OriginalFilename=G940LEDControl.exe;ProductName=G940 LED Control;ProductVersion=1.1;Comments=</VerInfo_Keys>
<DCC_PACKAGE_NO_LINK>false</DCC_PACKAGE_NO_LINK> <DCC_PACKAGE_NO_LINK>false</DCC_PACKAGE_NO_LINK>
<DCC_UNIT_PLATFORM>false</DCC_UNIT_PLATFORM> <DCC_UNIT_PLATFORM>false</DCC_UNIT_PLATFORM>
<DCC_SYMBOL_PLATFORM>false</DCC_SYMBOL_PLATFORM> <DCC_SYMBOL_PLATFORM>false</DCC_SYMBOL_PLATFORM>
@ -81,6 +83,7 @@
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define> <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''"> <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<VerInfo_Keys>CompanyName=X²Software;FileDescription=G940 LED Control;FileVersion=1.1.5.1;InternalName=;LegalCopyright=© 2011 - 2016 X²Software;LegalTrademarks=;OriginalFilename=G940LEDControl.exe;ProductName=G940 LED Control;ProductVersion=1.1;Comments=</VerInfo_Keys>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File> <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''"> <PropertyGroup Condition="'$(Cfg_2)'!=''">

Binary file not shown.

View File

@ -107,6 +107,27 @@ type
function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override; function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override;
end; end;
TFSXTailWheelLockFunction = class(TCustomFSXSystemsFunction)
protected
procedure RegisterStates; override;
function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override;
end;
TFSXCustomFloatFunction = class(TCustomFSXSystemsFunction)
protected
procedure RegisterStates; override;
end;
TFSXFloatLeftFunction = class(TFSXCustomFloatFunction)
protected
function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override;
end;
TFSXFloatRightFunction = class(TFSXCustomFloatFunction)
protected
function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override;
end;
{ Instruments } { Instruments }
TFSXPitotOnOffFunction = class(TCustomFSXOnOffFunction) TFSXPitotOnOffFunction = class(TCustomFSXOnOffFunction)
@ -183,6 +204,13 @@ type
function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override; function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override;
end; end;
TFSXWaterRudderFunction = class(TCustomFSXFunction)
protected
function GetCategoryName: string; override;
procedure RegisterStates; override;
function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override;
end;
{ Lights } { Lights }
TCustomFSXLightFunction = class(TCustomFSXOnOffFunction) TCustomFSXLightFunction = class(TCustomFSXOnOffFunction)
@ -535,6 +563,43 @@ begin
end; end;
{ TFSXTailWheelLockFunction }
procedure TFSXTailWheelLockFunction.RegisterStates;
begin
RegisterState(TLEDState.Create(FSXStateUIDTailWheelLocked, FSXStateDisplayNameTailWheelLocked, lcGreen));
RegisterState(TLEDState.Create(FSXStateUIDTailWheelUnlocked, FSXStateDisplayNameTailWheelUnlocked, lcRed));
end;
function TFSXTailWheelLockFunction.GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass;
begin
Result := TFSXTailWheelLockFunctionWorker;
end;
{ TFSXCustomFloatFunction }
procedure TFSXCustomFloatFunction.RegisterStates;
begin
RegisterState(TLEDState.Create(FSXStateUIDFloatRetracted, FSXStateDisplayNameFloatRetracted, lcRed));
RegisterState(TLEDState.Create(FSXStateUIDFloatBetween, FSXStateDisplayNameFloatBetween, lcAmber));
RegisterState(TLEDState.Create(FSXStateUIDFloatExtended, FSXStateDisplayNameFloatExtended, lcGreen));
end;
{ TFSXFloatLeftFunction }
function TFSXFloatLeftFunction.GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass;
begin
Result := TFSXFloatLeftFunctionWorker;
end;
{ TFSXFloatRightFunction }
function TFSXFloatRightFunction.GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass;
begin
Result := TFSXFloatRightFunctionWorker;
end;
{ TFSXPitotOnOffFunction } { TFSXPitotOnOffFunction }
function TFSXPitotOnOffFunction.GetCategoryName: string; function TFSXPitotOnOffFunction.GetCategoryName: string;
begin begin
@ -769,6 +834,27 @@ begin
end; end;
{ TFSXWaterRudderFunction }
function TFSXWaterRudderFunction.GetCategoryName: string;
begin
Result := FSXCategoryControlSurfaces;
end;
procedure TFSXWaterRudderFunction.RegisterStates;
begin
RegisterState(TLEDState.Create(FSXStateUIDWaterRudderRetracted, FSXStateDisplayNameWaterRudderRetracted, lcGreen));
RegisterState(TLEDState.Create(FSXStateUIDWaterRudderBetween, FSXStateDisplayNameWaterRudderBetween, lcAmber));
RegisterState(TLEDState.Create(FSXStateUIDWaterRudderExtended, FSXStateDisplayNameWaterRudderExtended, lcRed));
end;
function TFSXWaterRudderFunction.GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass;
begin
Result := TFSXWaterRudderFunctionWorker;
end;
{ TFSXLightFunction } { TFSXLightFunction }
function TCustomFSXLightFunction.GetCategoryName: string; function TCustomFSXLightFunction.GetCategoryName: string;
begin begin

View File

@ -144,6 +144,9 @@ begin
RegisterFunction(TFSXAutoBrakeFunction.Create( Self, FSXFunctionDisplayNameAutoBrake, FSXFunctionUIDAutoBrake)); RegisterFunction(TFSXAutoBrakeFunction.Create( Self, FSXFunctionDisplayNameAutoBrake, FSXFunctionUIDAutoBrake));
RegisterFunction(TFSXPressDumpSwitchFunction.Create( Self, FSXFunctionDisplayNamePressDumpSwitch, FSXFunctionUIDPressDumpSwitch)); RegisterFunction(TFSXPressDumpSwitchFunction.Create( Self, FSXFunctionDisplayNamePressDumpSwitch, FSXFunctionUIDPressDumpSwitch));
RegisterFunction(TFSXTailHookFunction.Create( Self, FSXFunctionDisplayNameTailHook, FSXFunctionUIDTailHook)); RegisterFunction(TFSXTailHookFunction.Create( Self, FSXFunctionDisplayNameTailHook, FSXFunctionUIDTailHook));
RegisterFunction(TFSXTailWheelLockFunction.Create( Self, FSXFunctionDisplayNameTailWheelLock, FSXFunctionUIDTailWheelLock));
RegisterFunction(TFSXFloatLeftFunction.Create( Self, FSXFunctionDisplayNameFloatLeft, FSXFunctionUIDFloatLeft));
RegisterFunction(TFSXFloatRightFunction.Create( Self, FSXFunctionDisplayNameFloatRight, FSXFunctionUIDFloatRight));
{ Instruments } { Instruments }
RegisterFunction(TFSXPitotOnOffFunction.Create( Self, FSXFunctionDisplayNamePitotOnOff, FSXFunctionUIDPitotOnOff)); RegisterFunction(TFSXPitotOnOffFunction.Create( Self, FSXFunctionDisplayNamePitotOnOff, FSXFunctionUIDPitotOnOff));
@ -160,6 +163,7 @@ begin
RegisterFunction(TFSXFlapsHandlePercentageFunction.Create(Self, FSXFunctionDisplayNameFlapsHandlePercentage, FSXFunctionUIDFlapsHandlePercentage)); RegisterFunction(TFSXFlapsHandlePercentageFunction.Create(Self, FSXFunctionDisplayNameFlapsHandlePercentage, FSXFunctionUIDFlapsHandlePercentage));
RegisterFunction(TFSXSpoilersFunction.Create( Self, FSXFunctionDisplayNameSpoilers, FSXFunctionUIDSpoilers)); RegisterFunction(TFSXSpoilersFunction.Create( Self, FSXFunctionDisplayNameSpoilers, FSXFunctionUIDSpoilers));
RegisterFunction(TFSXSpoilersArmedFunction.Create( Self, FSXFunctionDisplayNameSpoilersArmed, FSXFunctionUIDSpoilersArmed)); RegisterFunction(TFSXSpoilersArmedFunction.Create( Self, FSXFunctionDisplayNameSpoilersArmed, FSXFunctionUIDSpoilersArmed));
RegisterFunction(TFSXWaterRudderFunction.Create( Self, FSXFunctionDisplayNameWaterRudder, FSXFunctionUIDWaterRudder));
{ Lights } { Lights }
RegisterFunction(TFSXBeaconLightsFunction.Create( Self, FSXFunctionDisplayNameBeaconLights, FSXFunctionUIDBeaconLights)); RegisterFunction(TFSXBeaconLightsFunction.Create( Self, FSXFunctionDisplayNameBeaconLights, FSXFunctionUIDBeaconLights));

View File

@ -68,6 +68,26 @@ type
procedure HandleData(AData: Pointer); override; procedure HandleData(AData: Pointer); override;
end; end;
TFSXTailWheelLockFunctionWorker = class(TCustomFSXOnOffFunctionWorker)
protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
end;
TFSXCustomFloatFunctionWorker = class(TCustomFSXFunctionWorker)
protected
procedure HandleData(AData: Pointer); override;
end;
TFSXFloatLeftFunctionWorker = class(TFSXCustomFloatFunctionWorker)
protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
end;
TFSXFloatRightFunctionWorker = class(TFSXCustomFloatFunctionWorker)
protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
end;
{ Instruments } { Instruments }
TFSXPitotOnOffFunctionWorker = class(TCustomFSXOnOffFunctionWorker) TFSXPitotOnOffFunctionWorker = class(TCustomFSXOnOffFunctionWorker)
@ -133,6 +153,12 @@ type
procedure HandleData(AData: Pointer); override; procedure HandleData(AData: Pointer); override;
end; end;
TFSXWaterRudderFunctionWorker = class(TCustomFSXFunctionWorker)
protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
procedure HandleData(AData: Pointer); override;
end;
{ Lights } { Lights }
TFSXLightStatesFunctionWorker = class(TCustomFSXFunctionWorker) TFSXLightStatesFunctionWorker = class(TCustomFSXFunctionWorker)
@ -342,6 +368,42 @@ begin
end; end;
{ TFSXCustomFloatFunctionWorker }
procedure TFSXCustomFloatFunctionWorker.HandleData(AData: Pointer);
type
PFloatData = ^TFloatData;
TFloatData = packed record
PercentageExtended: Double;
end;
var
floatData: PFloatData;
begin
floatData := AData;
case Trunc(floatData^.PercentageExtended) of
0: SetCurrentState(FSXStateUIDFloatRetracted);
95..100: SetCurrentState(FSXStateUIDFloatExtended);
else SetCurrentState(FSXStateUIDFloatBetween);
end;
end;
{ TFSXFloatLeftFunctionWorker }
procedure TFSXFloatLeftFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin
ADefinition.AddVariable('RETRACT LEFT FLOAT EXTENDED', FSX_UNIT_PERCENT, SIMCONNECT_DATAType_FLOAT64);
end;
{ TFSXFloatRightFunctionWorker }
procedure TFSXFloatRightFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin
ADefinition.AddVariable('RETRACT RIGHT FLOAT EXTENDED', FSX_UNIT_PERCENT, SIMCONNECT_DATAType_FLOAT64);
end;
{ TFSXParkingBrakeFunctionWorker } { TFSXParkingBrakeFunctionWorker }
procedure TFSXParkingBrakeFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition); procedure TFSXParkingBrakeFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin begin
@ -403,6 +465,13 @@ begin
end; end;
{ TFSXTailWheelLockFunctionWorker }
procedure TFSXTailWheelLockFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin
ADefinition.AddVariable('TAILWHEEL LOCK ON', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
end;
{ TFSXPitotOnOffFunctionWorker } { TFSXPitotOnOffFunctionWorker }
procedure TFSXPitotOnOffFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition); procedure TFSXPitotOnOffFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin begin
@ -826,6 +895,33 @@ begin
end; end;
{ TFSXWaterRudderFunctionWorker }
procedure TFSXWaterRudderFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin
ADefinition.AddVariable('WATER RUDDER HANDLE POSITION', FSX_UNIT_PERCENT, SIMCONNECT_DATAType_FLOAT64);
end;
procedure TFSXWaterRudderFunctionWorker.HandleData(AData: Pointer);
type
PWaterRudderData = ^TWaterRudderData;
TWaterRudderData = packed record
WaterRudderHandlePercent: Double;
end;
var
waterRudderData: PWaterRudderData;
begin
waterRudderData := AData;
case Trunc(WaterRudderData^.WaterRudderHandlePercent) of
0..5: SetCurrentState(FSXStateUIDWaterRudderRetracted);
95..100: SetCurrentState(FSXStateUIDWaterRudderExtended);
else SetCurrentState(FSXStateUIDWaterRudderBetween);
end;
end;
{ TFSXLightStatesFunctionWorker } { TFSXLightStatesFunctionWorker }
procedure TFSXLightStatesFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition); procedure TFSXLightStatesFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);

View File

@ -75,6 +75,22 @@ const
FSXStateDisplayNameGearSpeedExceeded = 'Speed exceeded'; FSXStateDisplayNameGearSpeedExceeded = 'Speed exceeded';
FSXStateDisplayNameGearDamageBySpeed = 'Damage by speed'; FSXStateDisplayNameGearDamageBySpeed = 'Damage by speed';
FSXFunctionUIDFloatLeft = 'floatLeft';
FSXFunctionDisplayNameFloatLeft = 'Float (left)';
FSXStateUIDFloatRetracted = 'retracted';
FSXStateUIDFloatBetween = 'between';
FSXStateUIDFloatExtended = 'extended';
FSXStateDisplayNameFloatRetracted = 'Retracted';
FSXStateDisplayNameFloatBetween = 'Extending / retracting';
FSXStateDisplayNameFloatExtended = 'Extended';
FSXFunctionUIDFloatRight = 'floatRight';
FSXFunctionDisplayNameFloatRight = 'Float (right)';
FSXFunctionUIDLeftGear = 'leftGear'; FSXFunctionUIDLeftGear = 'leftGear';
FSXFunctionDisplayNameLeftGear = 'Left main landing gear'; FSXFunctionDisplayNameLeftGear = 'Left main landing gear';
@ -141,6 +157,16 @@ const
FSXStateDisplayNameTailHookExtended = 'Extended'; FSXStateDisplayNameTailHookExtended = 'Extended';
FSXFunctionUIDTailWheelLock = 'tailWheelLock';
FSXFunctionDisplayNameTailWheelLock = 'Tail wheel lock';
FSXStateUIDTailWheelUnlocked = FSXStateUIDOff;
FSXStateUIDTailWheelLocked = FSXStateUIDOn;
FSXStateDisplayNameTailWheelUnlocked = 'Unlocked';
FSXStateDisplayNameTailWheelLocked = 'Locked';
FSXFunctionUIDFlaps = 'flaps'; FSXFunctionUIDFlaps = 'flaps';
FSXFunctionDisplayNameFlaps = 'Flaps'; FSXFunctionDisplayNameFlaps = 'Flaps';
@ -225,6 +251,18 @@ const
FSXStateDisplayNameSpoilersExtended = 'Extended'; FSXStateDisplayNameSpoilersExtended = 'Extended';
FSXFunctionUIDWaterRudder = 'waterRudder';
FSXFunctionDisplayNameWaterRudder = 'Water rudder';
FSXStateUIDWaterRudderRetracted = 'retracted';
FSXStateUIDWaterRudderBetween = 'between';
FSXStateUIDWaterRudderExtended = 'extended';
FSXStateDisplayNameWaterRudderRetracted = 'Retracted';
FSXStateDisplayNameWaterRudderBetween = 'Extending / retracting';
FSXStateDisplayNameWaterRudderExtended = 'Extended';
FSXFunctionUIDBatteryMaster = 'batteryMaster'; FSXFunctionUIDBatteryMaster = 'batteryMaster';
FSXFunctionDisplayNameBatteryMaster = 'Battery master'; FSXFunctionDisplayNameBatteryMaster = 'Battery master';