Added: throttle state function
Added: experimental ATC visibility function
This commit is contained in:
parent
388d5ddfaf
commit
22facfa9ba
@ -1,7 +1,7 @@
|
|||||||
object MainForm: TMainForm
|
object MainForm: TMainForm
|
||||||
Left = 0
|
Left = 0
|
||||||
Top = 0
|
Top = 0
|
||||||
ActiveControl = cbProfileMenu
|
ActiveControl = cmbProfiles
|
||||||
BorderIcons = [biSystemMenu, biMinimize]
|
BorderIcons = [biSystemMenu, biMinimize]
|
||||||
BorderStyle = bsSingle
|
BorderStyle = bsSingle
|
||||||
Caption = 'G940 LED Control'
|
Caption = 'G940 LED Control'
|
||||||
@ -29,15 +29,11 @@ object MainForm: TMainForm
|
|||||||
Margins.Top = 8
|
Margins.Top = 8
|
||||||
Margins.Right = 8
|
Margins.Right = 8
|
||||||
Margins.Bottom = 8
|
Margins.Bottom = 8
|
||||||
ActivePage = tsConfiguration
|
ActivePage = tsButtons
|
||||||
Align = alClient
|
Align = alClient
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object tsButtons: TTabSheet
|
object tsButtons: TTabSheet
|
||||||
Caption = ' Button assignment '
|
Caption = ' Button assignment '
|
||||||
ExplicitLeft = 0
|
|
||||||
ExplicitTop = 0
|
|
||||||
ExplicitWidth = 0
|
|
||||||
ExplicitHeight = 0
|
|
||||||
DesignSize = (
|
DesignSize = (
|
||||||
442
|
442
|
||||||
452)
|
452)
|
||||||
|
@ -49,18 +49,17 @@
|
|||||||
<Base>true</Base>
|
<Base>true</Base>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Base)'!=''">
|
<PropertyGroup Condition="'$(Base)'!=''">
|
||||||
|
<VerInfo_Release>7</VerInfo_Release>
|
||||||
<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>
|
||||||
<VerInfo_MajorVer>0</VerInfo_MajorVer>
|
|
||||||
<DCC_ExeOutput>Bin</DCC_ExeOutput>
|
<DCC_ExeOutput>Bin</DCC_ExeOutput>
|
||||||
<DCC_UnitSearchPath>..\Shared;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
<DCC_UnitSearchPath>..\Shared;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
||||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||||
<VerInfo_MinorVer>2</VerInfo_MinorVer>
|
|
||||||
<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=0.2.0.0;InternalName=;LegalCopyright=© 2011 X²Software;LegalTrademarks=;OriginalFilename=G940LEDControl.exe;ProductName=G940 LED Control;ProductVersion=0.2;Comments=</VerInfo_Keys>
|
<VerInfo_Keys>CompanyName=X²Software;FileDescription=G940 LED Control;FileVersion=1.0.7.0;InternalName=;LegalCopyright=© 2011 - 2015 X²Software;LegalTrademarks=;OriginalFilename=G940LEDControl.exe;ProductName=G940 LED Control;ProductVersion=1.0;Comments=</VerInfo_Keys>
|
||||||
<VerInfo_Locale>1043</VerInfo_Locale>
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Base_Win64)'!=''">
|
<PropertyGroup Condition="'$(Base_Win64)'!=''">
|
||||||
<Icon_MainIcon>G940LEDControl_Icon.ico</Icon_MainIcon>
|
<Icon_MainIcon>G940LEDControl_Icon.ico</Icon_MainIcon>
|
||||||
@ -71,7 +70,6 @@
|
|||||||
<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>
|
||||||
<DCC_Namespace>Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
|
<DCC_Namespace>Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
|
||||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
|
||||||
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
|
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
||||||
@ -82,12 +80,6 @@
|
|||||||
<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_Build>1</VerInfo_Build>
|
|
||||||
<VerInfo_Release>6</VerInfo_Release>
|
|
||||||
<VerInfo_MajorVer>1</VerInfo_MajorVer>
|
|
||||||
<VerInfo_MinorVer>0</VerInfo_MinorVer>
|
|
||||||
<VerInfo_Keys>CompanyName=X²Software;FileDescription=G940 LED Control;FileVersion=1.0.6.1;InternalName=;LegalCopyright=© 2011 X²Software;LegalTrademarks=;OriginalFilename=G940LEDControl.exe;ProductName=G940 LED Control;ProductVersion=1.0;Comments=</VerInfo_Keys>
|
|
||||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
|
||||||
<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)'!=''">
|
||||||
@ -105,7 +97,6 @@
|
|||||||
<VerInfo_IncludeVerInfo>false</VerInfo_IncludeVerInfo>
|
<VerInfo_IncludeVerInfo>false</VerInfo_IncludeVerInfo>
|
||||||
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=0.2.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=0.2;Comments=</VerInfo_Keys>
|
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=0.2.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=0.2;Comments=</VerInfo_Keys>
|
||||||
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
|
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
|
||||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<DelphiCompile Include="$(MainSource)">
|
<DelphiCompile Include="$(MainSource)">
|
||||||
@ -201,7 +192,9 @@
|
|||||||
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
||||||
<VersionInfoKeys Name="Comments"/>
|
<VersionInfoKeys Name="Comments"/>
|
||||||
</VersionInfoKeys>
|
</VersionInfoKeys>
|
||||||
<Excluded_Packages/>
|
<Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="F:\Components\bin\DXE2\win32\JvBDEDesign160.bpl">JVCL BDE Components</Excluded_Packages>
|
||||||
|
</Excluded_Packages>
|
||||||
</Delphi.Personality>
|
</Delphi.Personality>
|
||||||
<Platforms>
|
<Platforms>
|
||||||
<Platform value="Win64">False</Platform>
|
<Platform value="Win64">False</Platform>
|
||||||
|
Binary file not shown.
@ -82,6 +82,13 @@ type
|
|||||||
function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override;
|
function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TFSXThrottleFunction = class(TCustomFSXFunction)
|
||||||
|
protected
|
||||||
|
function GetCategoryName: string; override;
|
||||||
|
procedure RegisterStates; override;
|
||||||
|
function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ Control surfaces }
|
{ Control surfaces }
|
||||||
TFSXFlapsFunction = class(TCustomFSXFunction)
|
TFSXFlapsFunction = class(TCustomFSXFunction)
|
||||||
@ -208,6 +215,19 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ ATC }
|
||||||
|
TFSXATCVisibilityFunction = class(TCustomMultiStateLEDFunction)
|
||||||
|
protected
|
||||||
|
procedure RegisterStates; override;
|
||||||
|
|
||||||
|
function GetCategoryName: string; override;
|
||||||
|
function GetDisplayName: string; override;
|
||||||
|
function GetUID: string; override;
|
||||||
|
|
||||||
|
function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
uses
|
uses
|
||||||
FSXLEDFunctionWorker,
|
FSXLEDFunctionWorker,
|
||||||
@ -384,6 +404,29 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TFSXThrottleFunction }
|
||||||
|
function TFSXThrottleFunction.GetCategoryName: string;
|
||||||
|
begin
|
||||||
|
Result := FSXCategoryEngines;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TFSXThrottleFunction.RegisterStates;
|
||||||
|
begin
|
||||||
|
RegisterState(TLEDState.Create(FSXStateUIDThrottleNoEngines, FSXStateDisplayNameThrottleNoThrottles, lcOff));
|
||||||
|
RegisterState(TLEDState.Create(FSXStateUIDThrottleOff, FSXStateDisplayNameThrottleOff, lcGreen));
|
||||||
|
RegisterState(TLEDState.Create(FSXStateUIDThrottlePartial, FSXStateDisplayNameThrottlePartial, lcAmber));
|
||||||
|
RegisterState(TLEDState.Create(FSXStateUIDThrottleFull, FSXStateDisplayNameThrottleFull, lcRed));
|
||||||
|
RegisterState(TLEDState.Create(FSXStateUIDThrottleReverse, FSXStateDisplayNameThrottleReverse, lcFlashingAmberNormal));
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TFSXThrottleFunction.GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass;
|
||||||
|
begin
|
||||||
|
Result := TFSXThrottleFunctionWorker;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TFSXFlapsFunction }
|
{ TFSXFlapsFunction }
|
||||||
function TFSXFlapsFunction.GetCategoryName: string;
|
function TFSXFlapsFunction.GetCategoryName: string;
|
||||||
begin
|
begin
|
||||||
@ -617,4 +660,36 @@ begin
|
|||||||
Result := TFSXFuelFunctionWorker;
|
Result := TFSXFuelFunctionWorker;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TFSXATCFunction }
|
||||||
|
procedure TFSXATCVisibilityFunction.RegisterStates;
|
||||||
|
begin
|
||||||
|
RegisterState(TLEDState.Create(FSXStateUIDATCHidden, FSXStateDisplayNameATCHidden, lcGreen));
|
||||||
|
RegisterState(TLEDState.Create(FSXStateUIDATCVisible, FSXStateDisplayNameATCVisible, lcFlashingAmberNormal));
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TFSXATCVisibilityFunction.GetCategoryName: string;
|
||||||
|
begin
|
||||||
|
Result := FSXCategoryATC;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TFSXATCVisibilityFunction.GetDisplayName: string;
|
||||||
|
begin
|
||||||
|
Result := FSXFunctionDisplayNameATCVisibility;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TFSXATCVisibilityFunction.GetUID: string;
|
||||||
|
begin
|
||||||
|
Result := FSXFunctionUIDATCVisibility;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TFSXATCVisibilityFunction.GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass;
|
||||||
|
begin
|
||||||
|
Result := TFSXATCVisibilityFunctionWorker;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -139,6 +139,7 @@ begin
|
|||||||
{ Engines }
|
{ Engines }
|
||||||
RegisterFunction(TFSXEngineAntiIceFunction.Create( Self, FSXFunctionDisplayNameEngineAntiIce, FSXFunctionUIDEngineAntiIce));
|
RegisterFunction(TFSXEngineAntiIceFunction.Create( Self, FSXFunctionDisplayNameEngineAntiIce, FSXFunctionUIDEngineAntiIce));
|
||||||
RegisterFunction(TFSXEngineFunction.Create( Self, FSXFunctionDisplayNameEngine, FSXFunctionUIDEngine));
|
RegisterFunction(TFSXEngineFunction.Create( Self, FSXFunctionDisplayNameEngine, FSXFunctionUIDEngine));
|
||||||
|
RegisterFunction(TFSXThrottleFunction.Create( Self, FSXFunctionDisplayNameThrottle, FSXFunctionUIDThrottle));
|
||||||
|
|
||||||
{ Control surfaces }
|
{ Control surfaces }
|
||||||
RegisterFunction(TFSXFlapsFunction.Create( Self, FSXFunctionDisplayNameFlaps, FSXFunctionUIDFlaps));
|
RegisterFunction(TFSXFlapsFunction.Create( Self, FSXFunctionDisplayNameFlaps, FSXFunctionUIDFlaps));
|
||||||
@ -167,6 +168,9 @@ begin
|
|||||||
|
|
||||||
{ Fuel }
|
{ Fuel }
|
||||||
RegisterFunction(TFSXFuelFunction.Create( Self, FSXFunctionDisplayNameFuel, FSXFunctionUIDFuel));
|
RegisterFunction(TFSXFuelFunction.Create( Self, FSXFunctionDisplayNameFuel, FSXFunctionUIDFuel));
|
||||||
|
|
||||||
|
{ ATC }
|
||||||
|
RegisterFunction(TFSXATCVisibilityFunction.Create(FSXProviderUID));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,8 +2,12 @@ unit FSXLEDFunctionWorker;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
uses
|
uses
|
||||||
|
OtlTaskControl,
|
||||||
|
|
||||||
FSXLEDFunctionProvider,
|
FSXLEDFunctionProvider,
|
||||||
FSXSimConnectIntf;
|
FSXSimConnectIntf,
|
||||||
|
LEDFunction,
|
||||||
|
LEDFunctionIntf;
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -64,6 +68,12 @@ type
|
|||||||
procedure HandleData(AData: Pointer); override;
|
procedure HandleData(AData: Pointer); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TFSXThrottleFunctionWorker = class(TCustomFSXFunctionWorker)
|
||||||
|
protected
|
||||||
|
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
|
||||||
|
procedure HandleData(AData: Pointer); override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ Control surfaces }
|
{ Control surfaces }
|
||||||
TFSXFlapsFunctionWorker = class(TCustomFSXFunctionWorker)
|
TFSXFlapsFunctionWorker = class(TCustomFSXFunctionWorker)
|
||||||
@ -173,10 +183,23 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ ATC }
|
||||||
|
TFSXATCVisibilityFunctionWorker = class(TCustomLEDMultiStateFunctionWorker)
|
||||||
|
private
|
||||||
|
FMonitorTask: IOmniTaskControl;
|
||||||
|
public
|
||||||
|
constructor Create(const AProviderUID: string; const AFunctionUID: string; AStates: ILEDMultiStateFunction; ASettings: ILEDFunctionWorkerSettings; const APreviousState: string = ''); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
uses
|
uses
|
||||||
System.Math,
|
System.Math,
|
||||||
System.SysUtils,
|
System.SysUtils,
|
||||||
|
Winapi.Windows,
|
||||||
|
|
||||||
|
OtlTask,
|
||||||
|
|
||||||
FSXResources,
|
FSXResources,
|
||||||
LEDStateIntf,
|
LEDStateIntf,
|
||||||
@ -455,6 +478,64 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TFSXThrottleFunctionWorker }
|
||||||
|
procedure TFSXThrottleFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
|
||||||
|
var
|
||||||
|
engineIndex: Integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
ADefinition.AddVariable('NUMBER OF ENGINES', FSX_UNIT_NUMBER, SIMCONNECT_DATAType_INT32);
|
||||||
|
|
||||||
|
for engineIndex := 1 to FSX_MAX_ENGINES do
|
||||||
|
ADefinition.AddVariable(Format('GENERAL ENG THROTTLE LEVER POSITION:%d', [engineIndex]), FSX_UNIT_PERCENT, SIMCONNECT_DATAType_FLOAT64);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TFSXThrottleFunctionWorker.HandleData(AData: Pointer);
|
||||||
|
type
|
||||||
|
PThrottleData = ^TThrottleData;
|
||||||
|
TThrottleData = packed record
|
||||||
|
NumberOfEngines: Integer;
|
||||||
|
Position: array[1..FSX_MAX_ENGINES] of Double;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
throttleData: PThrottleData;
|
||||||
|
reverse: Boolean;
|
||||||
|
totalPosition: Double;
|
||||||
|
engineIndex: Integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
throttleData := AData;
|
||||||
|
|
||||||
|
if throttleData^.NumberOfEngines > 0 then
|
||||||
|
begin
|
||||||
|
reverse := False;
|
||||||
|
totalPosition := 0;
|
||||||
|
|
||||||
|
for engineIndex := 1 to throttleData^.NumberOfEngines do
|
||||||
|
begin
|
||||||
|
if throttleData^.Position[engineIndex] < 0 then
|
||||||
|
begin
|
||||||
|
reverse := True;
|
||||||
|
break;
|
||||||
|
end else
|
||||||
|
totalPosition := totalPosition + throttleData^.Position[engineIndex];
|
||||||
|
end;
|
||||||
|
|
||||||
|
if reverse then
|
||||||
|
SetCurrentState(FSXStateUIDThrottleReverse)
|
||||||
|
else
|
||||||
|
case Trunc(totalPosition / throttleData^.NumberOfEngines) of
|
||||||
|
0..5: SetCurrentState(FSXStateUIDThrottleOff);
|
||||||
|
95..100: SetCurrentState(FSXStateUIDThrottleFull);
|
||||||
|
else SetCurrentState(FSXStateUIDThrottlePartial);
|
||||||
|
end;
|
||||||
|
end else
|
||||||
|
SetCurrentState(FSXStateUIDThrottleNoEngines);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TFSXFlapsFunctionWorker }
|
{ TFSXFlapsFunctionWorker }
|
||||||
procedure TFSXFlapsFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
|
procedure TFSXFlapsFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
|
||||||
begin
|
begin
|
||||||
@ -702,4 +783,88 @@ begin
|
|||||||
SetCurrentState(FSXStateUIDFuelNotAvailable);
|
SetCurrentState(FSXStateUIDFuelNotAvailable);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
type
|
||||||
|
TFSXATCVisibilityStateChanged = reference to procedure(AVisible: Boolean);
|
||||||
|
|
||||||
|
TFSXATCVisibilityTask = class(TOmniWorker)
|
||||||
|
private
|
||||||
|
FOnStateChanged: TFSXATCVisibilityStateChanged;
|
||||||
|
FVisible: Boolean;
|
||||||
|
public
|
||||||
|
constructor Create(AOnStateChanged: TFSXATCVisibilityStateChanged);
|
||||||
|
procedure Run;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TFSXATCVisibilityFunctionWorker }
|
||||||
|
constructor TFSXATCVisibilityFunctionWorker.Create(const AProviderUID, AFunctionUID: string; AStates: ILEDMultiStateFunction; ASettings: ILEDFunctionWorkerSettings; const APreviousState: string);
|
||||||
|
begin
|
||||||
|
inherited Create(AProviderUID, AFunctionUID, AStates, ASettings, APreviousState);
|
||||||
|
|
||||||
|
FMonitorTask := CreateTask(TFSXATCVisibilityTask.Create(
|
||||||
|
procedure(AVisible: Boolean)
|
||||||
|
begin
|
||||||
|
if AVisible then
|
||||||
|
SetCurrentState(FSXStateUIDATCVisible)
|
||||||
|
else
|
||||||
|
SetCurrentState(FSXStateUIDATCHidden);
|
||||||
|
end))
|
||||||
|
.SetTimer(1, MSecsPerSec, @TFSXATCVisibilityTask.Run)
|
||||||
|
.Run;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
destructor TFSXATCVisibilityFunctionWorker.Destroy;
|
||||||
|
begin
|
||||||
|
FMonitorTask.Terminate;
|
||||||
|
FMonitorTask := nil;
|
||||||
|
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TFSXATCVisibilityTask }
|
||||||
|
constructor TFSXATCVisibilityTask.Create(AOnStateChanged: TFSXATCVisibilityStateChanged);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
|
||||||
|
FOnStateChanged := AOnStateChanged;
|
||||||
|
FVisible := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TFSXATCVisibilityTask.Run;
|
||||||
|
const
|
||||||
|
ClassNameMainWindow = 'FS98MAIN';
|
||||||
|
ClassNameChildWindow = 'FS98CHILD';
|
||||||
|
ClassNameFloatWindow = 'FS98FLOAT';
|
||||||
|
WindowTitleATC = 'ATC Menu';
|
||||||
|
|
||||||
|
var
|
||||||
|
visible: Boolean;
|
||||||
|
mainWindow: THandle;
|
||||||
|
atcWindow: THandle;
|
||||||
|
|
||||||
|
begin
|
||||||
|
{ Docked }
|
||||||
|
atcWindow := 0;
|
||||||
|
mainWindow := FindWindow(ClassNameMainWindow, nil);
|
||||||
|
if mainWindow <> 0 then
|
||||||
|
atcWindow := FindWindowEx(mainWindow, 0, ClassNameChildWindow, WindowTitleATC);
|
||||||
|
|
||||||
|
{ Undocked }
|
||||||
|
if atcWindow = 0 then
|
||||||
|
atcWindow := FindWindow(ClassNameFloatWindow, WindowTitleATC);
|
||||||
|
|
||||||
|
|
||||||
|
visible := (atcWindow <> 0) and IsWindowVisible(atcWindow);
|
||||||
|
|
||||||
|
if visible <> FVisible then
|
||||||
|
begin
|
||||||
|
FVisible := visible;
|
||||||
|
FOnStateChanged(visible);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -12,6 +12,7 @@ const
|
|||||||
FSXCategoryLights = FSXCategory + ' - Lights';
|
FSXCategoryLights = FSXCategory + ' - Lights';
|
||||||
FSXCategoryAutoPilot = FSXCategory + ' - Autopilot';
|
FSXCategoryAutoPilot = FSXCategory + ' - Autopilot';
|
||||||
FSXCategoryRadios = FSXCategory + ' - Radios';
|
FSXCategoryRadios = FSXCategory + ' - Radios';
|
||||||
|
FSXCategoryATC = FSXCategory + ' - ATC';
|
||||||
|
|
||||||
FSXStateUIDOn = 'on';
|
FSXStateUIDOn = 'on';
|
||||||
FSXStateUIDOff = 'off';
|
FSXStateUIDOff = 'off';
|
||||||
@ -40,6 +41,22 @@ const
|
|||||||
FSXStateDisplayNameEngineOnFire = 'On fire';
|
FSXStateDisplayNameEngineOnFire = 'On fire';
|
||||||
|
|
||||||
|
|
||||||
|
FSXFunctionUIDThrottle = 'throttle';
|
||||||
|
FSXFunctionDisplayNameThrottle = 'Throttle';
|
||||||
|
|
||||||
|
FSXStateUIDThrottleNoEngines = 'noEngines';
|
||||||
|
FSXStateUIDThrottleOff = 'off';
|
||||||
|
FSXStateUIDThrottlePartial = 'partial';
|
||||||
|
FSXStateUIDThrottleFull = 'full';
|
||||||
|
FSXStateUIDThrottleReverse = 'reverse';
|
||||||
|
|
||||||
|
FSXStateDisplayNameThrottleNoThrottles = 'No engines';
|
||||||
|
FSXStateDisplayNameThrottleOff = 'Off';
|
||||||
|
FSXStateDisplayNameThrottlePartial = 'Partial';
|
||||||
|
FSXStateDisplayNameThrottleFull = 'Full';
|
||||||
|
FSXStateDisplayNameThrottleReverse = 'Reversed';
|
||||||
|
|
||||||
|
|
||||||
FSXFunctionUIDGear = 'gear';
|
FSXFunctionUIDGear = 'gear';
|
||||||
FSXFunctionDisplayNameGear = 'Landing gear';
|
FSXFunctionDisplayNameGear = 'Landing gear';
|
||||||
|
|
||||||
@ -220,6 +237,16 @@ const
|
|||||||
FSXStateDisplayNameFuel75to100 = '75% - Full';
|
FSXStateDisplayNameFuel75to100 = '75% - Full';
|
||||||
|
|
||||||
|
|
||||||
|
FSXFunctionUIDATCVisibility = 'atcVisiblity';
|
||||||
|
FSXFunctionDisplayNameATCVisibility = 'ATC Visibility (experimental)';
|
||||||
|
|
||||||
|
FSXStateUIDATCHidden = 'hidden';
|
||||||
|
FSXStateUIDATCVisible = 'visible';
|
||||||
|
|
||||||
|
FSXStateDisplayNameATCHidden = 'Hidden';
|
||||||
|
FSXStateDisplayNameATCVisible = 'Visible';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FSXMenuProfiles = 'G940 Profile';
|
FSXMenuProfiles = 'G940 Profile';
|
||||||
FSXMenuProfileFormat = 'G940: %s';
|
FSXMenuProfileFormat = 'G940: %s';
|
||||||
|
Loading…
Reference in New Issue
Block a user