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

View File

@ -16,7 +16,7 @@ uses
LEDColorIntf,
LEDFunctionIntf,
LEDStateIntf,
Profile;
Profile, Vcl.ActnList;
type
@ -45,17 +45,25 @@ type
bvlFooter: TBevel;
pnlFunctions: TPanel;
edtSearch: TEdit;
ActionList: TActionList;
actSearch: TAction;
procedure FormCreate(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 actSearchExecute(Sender: TObject);
procedure btnOKClick(Sender: TObject);
procedure edtSearchChange(Sender: TObject);
procedure edtSearchEnter(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
FProfile: TProfile;
FButtonIndex: Integer;
@ -70,6 +78,7 @@ type
procedure LoadFunctions;
procedure ApplyFilter(const AFilter: string);
procedure EnsureSelection;
procedure SetFunction(AProvider: ILEDFunctionProvider; AFunction: ILEDFunction);
procedure LoadStates(AProvider: ILEDFunctionProvider; AFunction: ILEDMultiStateFunction);
@ -172,6 +181,31 @@ begin
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;
var
categoryNodes: TDictionary<string,PVirtualNode>;
@ -227,12 +261,17 @@ begin
nodeData^.LEDFunction := ledFunction;
if isCurrentProvider and Assigned(CurrentFunction) and (ledFunction.GetUID = CurrentFunction.GetUID) then
begin
vstFunctions.FocusedNode := node;
vstFunctions.Selected[node] := True;
end;
end;
end;
finally
FreeAndNil(categoryNodes);
end;
EnsureSelection;
finally
vstFunctions.EndUpdate;
end;
@ -262,32 +301,47 @@ begin
begin
nodeData := vstFunctions.GetNodeData(functionNode);
if nodeData^.NodeType = ntFunction then
begin
if hasFilter and (not ContainsText(nodeData^.LEDFunction.GetDisplayName, AFilter)) then
Exclude(functionNode^.States, vsVisible)
else
Include(functionNode^.States, vsVisible);
end;
vstFunctions.IsVisible[functionNode] := (not hasFilter) or ContainsText(nodeData^.LEDFunction.GetDisplayName, AFilter);
if vsVisible in functionNode^.States then
if vstFunctions.IsVisible[functionNode] then
hasVisibleChildren := True;
functionNode := vstFunctions.GetNextSibling(functionNode);
end;
if hasVisibleChildren then
Include(categoryNode^.States, vsVisible)
else
Exclude(categoryNode^.States, vsVisible);
vstFunctions.IsVisible[categoryNode] := hasVisibleChildren;
categoryNode := vstFunctions.GetNextSibling(categoryNode);
end;
EnsureSelection;
finally
vstFunctions.EndUpdate;
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);
var
multiStateFunction: ILEDMultiStateFunction;
@ -427,6 +481,12 @@ begin
end;
procedure TButtonFunctionForm.actSearchExecute(Sender: TObject);
begin
ActiveControl := edtSearch;
end;
procedure TButtonFunctionForm.btnOKClick(Sender: TObject);
var
multiStateFunction: ILEDMultiStateFunction;
@ -557,13 +617,25 @@ begin
if Length(Trim(edtSearch.Text)) = 0 then
begin
edtSearch.Tag := 1;
edtSearch.Text := 'Search...';
edtSearch.Text := 'Search (Ctrl+F)...';
edtSearch.Font.Color := clGrayText;
end else
edtSearch.Tag := 0;
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 }
constructor TStateControlInfo.Create(AState: ILEDState; AStateLabel: TLabel; AComboBox: TComboBox);

View File

@ -8,7 +8,7 @@
<FrameworkType>VCL</FrameworkType>
<ProjectVersion>13.4</ProjectVersion>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<Config Condition="'$(Config)'==''">Release</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms>
<AppType>Application</AppType>
@ -49,7 +49,8 @@
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<VerInfo_Release>4</VerInfo_Release>
<VerInfo_Build>1</VerInfo_Build>
<VerInfo_Release>5</VerInfo_Release>
<VerInfo_MinorVer>1</VerInfo_MinorVer>
<DCC_UsePackage>rtl;dbrtl;$(DCC_UsePackage)</DCC_UsePackage>
<DCC_DcuOutput>Lib</DCC_DcuOutput>
@ -59,7 +60,7 @@
<Manifest_File>None</Manifest_File>
<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>
<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>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''">
@ -67,6 +68,7 @@
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
</PropertyGroup>
<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_UNIT_PLATFORM>false</DCC_UNIT_PLATFORM>
<DCC_SYMBOL_PLATFORM>false</DCC_SYMBOL_PLATFORM>
@ -81,6 +83,7 @@
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
</PropertyGroup>
<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>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">

Binary file not shown.

View File

@ -107,6 +107,27 @@ type
function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override;
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 }
TFSXPitotOnOffFunction = class(TCustomFSXOnOffFunction)
@ -183,6 +204,13 @@ type
function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override;
end;
TFSXWaterRudderFunction = class(TCustomFSXFunction)
protected
function GetCategoryName: string; override;
procedure RegisterStates; override;
function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override;
end;
{ Lights }
TCustomFSXLightFunction = class(TCustomFSXOnOffFunction)
@ -535,6 +563,43 @@ begin
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 }
function TFSXPitotOnOffFunction.GetCategoryName: string;
begin
@ -557,17 +622,17 @@ end;
procedure TFSXPitotWarningFunction.RegisterStates;
begin
RegisterState(TLEDState.Create(FSXStateUIDPitotOffIceNone, FSXStateDisplayNamePitotOffIceNone, lcRed));
RegisterState(TLEDState.Create(FSXStateUIDPitotOffIce25to50, FSXStateDisplayNamePitotOffIce25to50, lcFlashingAmberNormal));
RegisterState(TLEDState.Create(FSXStateUIDPitotOffIce50to75, FSXStateDisplayNamePitotOffIce50to75, lcFlashingAmberFast));
RegisterState(TLEDState.Create(FSXStateUIDPitotOffIceNone, FSXStateDisplayNamePitotOffIceNone, lcRed));
RegisterState(TLEDState.Create(FSXStateUIDPitotOffIce25to50, FSXStateDisplayNamePitotOffIce25to50, lcFlashingAmberNormal));
RegisterState(TLEDState.Create(FSXStateUIDPitotOffIce50to75, FSXStateDisplayNamePitotOffIce50to75, lcFlashingAmberFast));
RegisterState(TLEDState.Create(FSXStateUIDPitotOffIce75to100, FSXStateDisplayNamePitotOffIce75to100, lcFlashingAmberFast));
RegisterState(TLEDState.Create(FSXStateUIDPitotOffIceFull, FSXStateDisplayNamePitotOffIceFull, lcFlashingRedFast));
RegisterState(TLEDState.Create(FSXStateUIDPitotOffIceFull, FSXStateDisplayNamePitotOffIceFull, lcFlashingRedFast));
RegisterState(TLEDState.Create(FSXStateUIDPitotOnIceFull, FSXStateDisplayNamePitotOnIceFull, lcFlashingRedNormal));
RegisterState(TLEDState.Create(FSXStateUIDPitotOnIce75to100, FSXStateDisplayNamePitotOnIce75to100, lcAmber));
RegisterState(TLEDState.Create(FSXStateUIDPitotOnIce50to75, FSXStateDisplayNamePitotOnIce50to75, lcAmber));
RegisterState(TLEDState.Create(FSXStateUIDPitotOnIce25to50, FSXStateDisplayNamePitotOnIce25to50, lcAmber));
RegisterState(TLEDState.Create(FSXStateUIDPitotOnIceNone, FSXStateDisplayNamePitotOnIceNone, lcGreen));
RegisterState(TLEDState.Create(FSXStateUIDPitotOnIceFull, FSXStateDisplayNamePitotOnIceFull, lcFlashingRedNormal));
RegisterState(TLEDState.Create(FSXStateUIDPitotOnIce75to100, FSXStateDisplayNamePitotOnIce75to100, lcAmber));
RegisterState(TLEDState.Create(FSXStateUIDPitotOnIce50to75, FSXStateDisplayNamePitotOnIce50to75, lcAmber));
RegisterState(TLEDState.Create(FSXStateUIDPitotOnIce25to50, FSXStateDisplayNamePitotOnIce25to50, lcAmber));
RegisterState(TLEDState.Create(FSXStateUIDPitotOnIceNone, FSXStateDisplayNamePitotOnIceNone, lcGreen));
end;
@ -769,6 +834,27 @@ begin
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 }
function TCustomFSXLightFunction.GetCategoryName: string;
begin

View File

@ -144,6 +144,9 @@ begin
RegisterFunction(TFSXAutoBrakeFunction.Create( Self, FSXFunctionDisplayNameAutoBrake, FSXFunctionUIDAutoBrake));
RegisterFunction(TFSXPressDumpSwitchFunction.Create( Self, FSXFunctionDisplayNamePressDumpSwitch, FSXFunctionUIDPressDumpSwitch));
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 }
RegisterFunction(TFSXPitotOnOffFunction.Create( Self, FSXFunctionDisplayNamePitotOnOff, FSXFunctionUIDPitotOnOff));
@ -160,6 +163,7 @@ begin
RegisterFunction(TFSXFlapsHandlePercentageFunction.Create(Self, FSXFunctionDisplayNameFlapsHandlePercentage, FSXFunctionUIDFlapsHandlePercentage));
RegisterFunction(TFSXSpoilersFunction.Create( Self, FSXFunctionDisplayNameSpoilers, FSXFunctionUIDSpoilers));
RegisterFunction(TFSXSpoilersArmedFunction.Create( Self, FSXFunctionDisplayNameSpoilersArmed, FSXFunctionUIDSpoilersArmed));
RegisterFunction(TFSXWaterRudderFunction.Create( Self, FSXFunctionDisplayNameWaterRudder, FSXFunctionUIDWaterRudder));
{ Lights }
RegisterFunction(TFSXBeaconLightsFunction.Create( Self, FSXFunctionDisplayNameBeaconLights, FSXFunctionUIDBeaconLights));

View File

@ -68,6 +68,26 @@ type
procedure HandleData(AData: Pointer); override;
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 }
TFSXPitotOnOffFunctionWorker = class(TCustomFSXOnOffFunctionWorker)
@ -133,6 +153,12 @@ type
procedure HandleData(AData: Pointer); override;
end;
TFSXWaterRudderFunctionWorker = class(TCustomFSXFunctionWorker)
protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
procedure HandleData(AData: Pointer); override;
end;
{ Lights }
TFSXLightStatesFunctionWorker = class(TCustomFSXFunctionWorker)
@ -342,6 +368,42 @@ begin
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 }
procedure TFSXParkingBrakeFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin
@ -403,6 +465,13 @@ begin
end;
{ TFSXTailWheelLockFunctionWorker }
procedure TFSXTailWheelLockFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin
ADefinition.AddVariable('TAILWHEEL LOCK ON', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
end;
{ TFSXPitotOnOffFunctionWorker }
procedure TFSXPitotOnOffFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin
@ -826,6 +895,33 @@ begin
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 }
procedure TFSXLightStatesFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);

View File

@ -75,6 +75,22 @@ const
FSXStateDisplayNameGearSpeedExceeded = 'Speed exceeded';
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';
FSXFunctionDisplayNameLeftGear = 'Left main landing gear';
@ -141,6 +157,16 @@ const
FSXStateDisplayNameTailHookExtended = 'Extended';
FSXFunctionUIDTailWheelLock = 'tailWheelLock';
FSXFunctionDisplayNameTailWheelLock = 'Tail wheel lock';
FSXStateUIDTailWheelUnlocked = FSXStateUIDOff;
FSXStateUIDTailWheelLocked = FSXStateUIDOn;
FSXStateDisplayNameTailWheelUnlocked = 'Unlocked';
FSXStateDisplayNameTailWheelLocked = 'Locked';
FSXFunctionUIDFlaps = 'flaps';
FSXFunctionDisplayNameFlaps = 'Flaps';
@ -225,6 +251,18 @@ const
FSXStateDisplayNameSpoilersExtended = 'Extended';
FSXFunctionUIDWaterRudder = 'waterRudder';
FSXFunctionDisplayNameWaterRudder = 'Water rudder';
FSXStateUIDWaterRudderRetracted = 'retracted';
FSXStateUIDWaterRudderBetween = 'between';
FSXStateUIDWaterRudderExtended = 'extended';
FSXStateDisplayNameWaterRudderRetracted = 'Retracted';
FSXStateDisplayNameWaterRudderBetween = 'Extending / retracting';
FSXStateDisplayNameWaterRudderExtended = 'Extended';
FSXFunctionUIDBatteryMaster = 'batteryMaster';
FSXFunctionDisplayNameBatteryMaster = 'Battery master';