V0.2.3.0: Added StstusBar and hints for all GUI controls

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5621 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
gbamber 2017-01-10 12:01:31 +00:00
parent 3106f1eb0c
commit aeb0a0850e
5 changed files with 170 additions and 86 deletions

View File

@ -23,7 +23,7 @@
<VersionInfo>
<UseVersionInfo Value="True"/>
<MinorVersionNr Value="2"/>
<RevisionNr Value="2"/>
<RevisionNr Value="3"/>
<StringTable Comments="Uses Foobot public API to query Foobots" FileDescription="Monitor for Foobot" InternalName="foobotmonitor" LegalCopyright="(c)2016 minesadorada@charcodelvalle.com" LegalTrademarks="Foobot" ProductName="Foobot" ProductVersion="0.0.0.0"/>
</VersionInfo>
<BuildModes Count="6">

View File

@ -3,14 +3,14 @@
<ProjectSession>
<PathDelim Value="\"/>
<Version Value="10"/>
<BuildModes Active="win32GTK2"/>
<BuildModes Active="win64"/>
<Units Count="34">
<Unit0>
<Filename Value="foobotmonitor.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="12"/>
<CursorPos Y="35"/>
<UsageCount Value="153"/>
<UsageCount Value="155"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
@ -19,9 +19,10 @@
<ComponentName Value="mainform"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<TopLine Value="199"/>
<CursorPos X="47" Y="22"/>
<UsageCount Value="153"/>
<IsVisibleTab Value="True"/>
<TopLine Value="241"/>
<CursorPos X="37" Y="252"/>
<UsageCount Value="155"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
@ -34,7 +35,7 @@
<EditorIndex Value="7"/>
<TopLine Value="33"/>
<CursorPos X="41" Y="45"/>
<UsageCount Value="143"/>
<UsageCount Value="145"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit2>
@ -44,7 +45,7 @@
<EditorIndex Value="1"/>
<TopLine Value="13"/>
<CursorPos X="49" Y="20"/>
<UsageCount Value="135"/>
<UsageCount Value="137"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
@ -54,16 +55,15 @@
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="135"/>
<UsageCount Value="137"/>
</Unit4>
<Unit5>
<Filename Value="..\foobot_utility.pas"/>
<IsPartOfProject Value="True"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="9"/>
<TopLine Value="199"/>
<CursorPos X="56" Y="232"/>
<UsageCount Value="153"/>
<CursorPos X="30" Y="215"/>
<UsageCount Value="155"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
@ -73,7 +73,7 @@
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="135"/>
<UsageCount Value="137"/>
</Unit6>
<Unit7>
<Filename Value="foobot_sensors.pas"/>
@ -81,7 +81,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="299"/>
<CursorPos X="14" Y="321"/>
<UsageCount Value="87"/>
<UsageCount Value="89"/>
</Unit7>
<Unit8>
<Filename Value="usplash.pas"/>
@ -91,7 +91,7 @@
<ResourceBaseClass Value="Form"/>
<EditorIndex Value="3"/>
<CursorPos X="48" Y="37"/>
<UsageCount Value="82"/>
<UsageCount Value="84"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit8>
@ -104,7 +104,7 @@
<EditorIndex Value="2"/>
<TopLine Value="382"/>
<CursorPos X="26" Y="21"/>
<UsageCount Value="73"/>
<UsageCount Value="75"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit9>
@ -113,7 +113,7 @@
<EditorIndex Value="8"/>
<TopLine Value="43"/>
<CursorPos X="47" Y="13"/>
<UsageCount Value="91"/>
<UsageCount Value="92"/>
<Loaded Value="True"/>
</Unit10>
<Unit11>
@ -121,7 +121,7 @@
<EditorIndex Value="11"/>
<TopLine Value="141"/>
<CursorPos X="31" Y="148"/>
<UsageCount Value="91"/>
<UsageCount Value="92"/>
<Loaded Value="True"/>
</Unit11>
<Unit12>
@ -192,7 +192,7 @@
<EditorIndex Value="5"/>
<TopLine Value="101"/>
<CursorPos Y="154"/>
<UsageCount Value="42"/>
<UsageCount Value="43"/>
<Loaded Value="True"/>
</Unit21>
<Unit22>
@ -221,14 +221,14 @@
<EditorIndex Value="10"/>
<TopLine Value="381"/>
<CursorPos X="13" Y="384"/>
<UsageCount Value="60"/>
<UsageCount Value="61"/>
<Loaded Value="True"/>
</Unit25>
<Unit26>
<Filename Value="..\latest_stable\udataform.pas"/>
<EditorIndex Value="6"/>
<TopLine Value="70"/>
<UsageCount Value="60"/>
<UsageCount Value="61"/>
<Loaded Value="True"/>
</Unit26>
<Unit27>
@ -272,7 +272,7 @@
<EditorIndex Value="4"/>
<TopLine Value="1811"/>
<CursorPos X="13" Y="1834"/>
<UsageCount Value="38"/>
<UsageCount Value="39"/>
<Loaded Value="True"/>
</Unit32>
<Unit33>
@ -286,124 +286,124 @@
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="utriggersform.pas"/>
<Caret Line="153" Column="43" TopLine="134"/>
<Filename Value="umainform.pas"/>
<Caret Line="3" Column="7"/>
</Position1>
<Position2>
<Filename Value="umainform.pas"/>
<Caret Line="78" Column="9" TopLine="45"/>
<Caret Line="30" Column="20" TopLine="28"/>
</Position2>
<Position3>
<Filename Value="umainform.pas"/>
<Caret Line="417" Column="39" TopLine="370"/>
<Caret Line="883" Column="65" TopLine="852"/>
</Position3>
<Position4>
<Filename Value="umainform.pas"/>
<Caret Line="419" Column="39" TopLine="372"/>
<Caret Line="1080" Column="61" TopLine="1036"/>
</Position4>
<Position5>
<Filename Value="umainform.pas"/>
<Caret Line="884" Column="32" TopLine="837"/>
<Filename Value="..\foobot_utility.pas"/>
<Caret Line="277" TopLine="241"/>
</Position5>
<Position6>
<Filename Value="umainform.pas"/>
<Caret Line="1062" Column="28" TopLine="1015"/>
<Caret Line="476" Column="65" TopLine="457"/>
</Position6>
<Position7>
<Filename Value="umainform.pas"/>
<Caret Line="77" TopLine="51"/>
<Caret Line="448" Column="8" TopLine="445"/>
</Position7>
<Position8>
<Filename Value="umainform.pas"/>
<Caret Line="3" Column="7"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="171" Column="16" TopLine="135"/>
</Position8>
<Position9>
<Filename Value="umainform.pas"/>
<Caret Line="30" Column="20" TopLine="28"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="285" Column="79" TopLine="244"/>
</Position9>
<Position10>
<Filename Value="umainform.pas"/>
<Caret Line="883" Column="65" TopLine="852"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="287" Column="88" TopLine="245"/>
</Position10>
<Position11>
<Filename Value="umainform.pas"/>
<Caret Line="1080" Column="61" TopLine="1036"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="275" Column="17" TopLine="260"/>
</Position11>
<Position12>
<Filename Value="..\foobot_utility.pas"/>
<Caret Line="277" TopLine="241"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="161" Column="22" TopLine="150"/>
</Position12>
<Position13>
<Filename Value="umainform.pas"/>
<Caret Line="476" Column="65" TopLine="457"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="162" Column="16" TopLine="130"/>
</Position13>
<Position14>
<Filename Value="umainform.pas"/>
<Caret Line="448" Column="8" TopLine="445"/>
<Caret Line="318" Column="46" TopLine="313"/>
</Position14>
<Position15>
<Filename Value="utriggersform.pas"/>
<Caret Line="171" Column="16" TopLine="135"/>
<Filename Value="umainform.pas"/>
<Caret Line="779" Column="58" TopLine="769"/>
</Position15>
<Position16>
<Filename Value="utriggersform.pas"/>
<Caret Line="285" Column="79" TopLine="244"/>
<Filename Value="umainform.pas"/>
<Caret Line="786" TopLine="769"/>
</Position16>
<Position17>
<Filename Value="utriggersform.pas"/>
<Caret Line="287" Column="88" TopLine="245"/>
<Filename Value="umainform.pas"/>
<Caret Line="1194" Column="27" TopLine="1184"/>
</Position17>
<Position18>
<Filename Value="utriggersform.pas"/>
<Caret Line="275" Column="17" TopLine="260"/>
<Filename Value="umainform.pas"/>
<Caret Line="400" Column="3" TopLine="392"/>
</Position18>
<Position19>
<Filename Value="utriggersform.pas"/>
<Caret Line="161" Column="22" TopLine="150"/>
<Filename Value="umainform.pas"/>
<Caret Line="449" Column="27" TopLine="391"/>
</Position19>
<Position20>
<Filename Value="utriggersform.pas"/>
<Caret Line="162" Column="16" TopLine="130"/>
<Filename Value="umainform.pas"/>
<Caret Line="742" Column="13" TopLine="738"/>
</Position20>
<Position21>
<Filename Value="umainform.pas"/>
<Caret Line="318" Column="46" TopLine="313"/>
<Caret Line="400" Column="3" TopLine="395"/>
</Position21>
<Position22>
<Filename Value="umainform.pas"/>
<Caret Line="779" Column="58" TopLine="769"/>
<Caret Line="777" Column="42" TopLine="770"/>
</Position22>
<Position23>
<Filename Value="umainform.pas"/>
<Caret Line="786" TopLine="769"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="188" Column="46" TopLine="144"/>
</Position23>
<Position24>
<Filename Value="umainform.pas"/>
<Caret Line="1194" Column="27" TopLine="1184"/>
<Caret Line="212" Column="26" TopLine="200"/>
</Position24>
<Position25>
<Filename Value="umainform.pas"/>
<Caret Line="400" Column="3" TopLine="392"/>
<Caret Line="213" Column="26" TopLine="201"/>
</Position25>
<Position26>
<Filename Value="umainform.pas"/>
<Caret Line="449" Column="27" TopLine="391"/>
<Caret Line="253" Column="3" TopLine="251"/>
</Position26>
<Position27>
<Filename Value="umainform.pas"/>
<Caret Line="742" Column="13" TopLine="738"/>
<Caret Line="251" Column="21" TopLine="224"/>
</Position27>
<Position28>
<Filename Value="umainform.pas"/>
<Caret Line="400" Column="3" TopLine="395"/>
<Caret Line="301" Column="32" TopLine="275"/>
</Position28>
<Position29>
<Filename Value="umainform.pas"/>
<Caret Line="777" Column="42" TopLine="770"/>
<Caret Line="235" Column="50" TopLine="221"/>
</Position29>
<Position30>
<Filename Value="utriggersform.pas"/>
<Caret Line="188" Column="46" TopLine="144"/>
<Filename Value="umainform.pas"/>
<Caret Line="213" TopLine="204"/>
</Position30>
</JumpHistory>
</ProjectSession>

View File

@ -1,12 +1,12 @@
object mainform: Tmainform
Left = 589
Height = 500
Height = 504
Top = 145
Width = 784
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'mainform'
ClientHeight = 480
ClientHeight = 484
ClientWidth = 784
DefaultMonitor = dmDesktop
Font.Height = -12
@ -17,6 +17,7 @@ object mainform: Tmainform
OnDestroy = FormDestroy
OnWindowStateChange = FormWindowStateChange
Position = poWorkAreaCenter
ShowHint = True
ShowInTaskBar = stNever
LCLVersion = '1.7'
Scaled = True
@ -507,7 +508,7 @@ object mainform: Tmainform
object lbl_pmhigh: TLabel
Left = 8
Height = 15
Top = 8
Top = 2
Width = 43
Caption = 'No stats'
ParentColor = False
@ -515,7 +516,7 @@ object mainform: Tmainform
object lbl_pmlow: TLabel
Left = 8
Height = 15
Top = 40
Top = 34
Width = 44
Caption = 'No Stats'
ParentColor = False
@ -534,7 +535,7 @@ object mainform: Tmainform
object lbl_tmphigh: TLabel
Left = 8
Height = 15
Top = 8
Top = 2
Width = 44
Caption = 'No Stats'
ParentColor = False
@ -542,7 +543,7 @@ object mainform: Tmainform
object lbl_tmplow: TLabel
Left = 8
Height = 15
Top = 40
Top = 34
Width = 44
Caption = 'No Stats'
ParentColor = False
@ -561,7 +562,7 @@ object mainform: Tmainform
object lbl_humhigh: TLabel
Left = 8
Height = 15
Top = 8
Top = 2
Width = 44
Caption = 'No Stats'
ParentColor = False
@ -569,7 +570,7 @@ object mainform: Tmainform
object lbl_humlow: TLabel
Left = 8
Height = 15
Top = 40
Top = 34
Width = 44
Caption = 'No Stats'
ParentColor = False
@ -588,7 +589,7 @@ object mainform: Tmainform
object lbl_co2high: TLabel
Left = 8
Height = 15
Top = 8
Top = 2
Width = 44
Caption = 'No Stats'
ParentColor = False
@ -596,7 +597,7 @@ object mainform: Tmainform
object lbl_co2low: TLabel
Left = 8
Height = 15
Top = 40
Top = 34
Width = 44
Caption = 'No Stats'
ParentColor = False
@ -615,7 +616,7 @@ object mainform: Tmainform
object lbl_vochigh: TLabel
Left = 8
Height = 15
Top = 8
Top = 2
Width = 44
Caption = 'No Stats'
ParentColor = False
@ -623,7 +624,7 @@ object mainform: Tmainform
object lbl_voclow: TLabel
Left = 8
Height = 15
Top = 40
Top = 34
Width = 44
Caption = 'No Stats'
ParentColor = False
@ -642,7 +643,7 @@ object mainform: Tmainform
object lbl_allpolluhigh: TLabel
Left = 8
Height = 15
Top = 8
Top = 2
Width = 44
Caption = 'No Stats'
ParentColor = False
@ -650,7 +651,7 @@ object mainform: Tmainform
object lbl_allpollulow: TLabel
Left = 8
Height = 15
Top = 40
Top = 34
Width = 44
Caption = 'No Stats'
ParentColor = False
@ -669,7 +670,7 @@ object mainform: Tmainform
TabOrder = 2
object Chart1: TChart
Left = 0
Height = 159
Height = 136
Top = 0
Width = 780
AxisList = <
@ -728,6 +729,14 @@ object mainform: Tmainform
LinePen.Width = 2
end
end
object sts: TStatusBar
Left = 0
Height = 23
Top = 136
Width = 780
Panels = <>
SizeGrip = False
end
end
object tmr_foobot: TTimer
Enabled = False

View File

@ -40,9 +40,9 @@ V0.2.3.0: ??
interface
uses // If Lazarus auto-inserts 'sensors' in the clause then delete it
SysUtils, TAGraph, TAIntervalSources, TASeries,
foobot_sensors, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, Menus,
lclIntf, foobot_utility, uCryptIni, dateutils, uconfigform, utriggersform;
SysUtils, TAGraph, TAIntervalSources, TASeries, foobot_sensors,
Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, Menus, lclIntf,
ComCtrls, foobot_utility, uCryptIni, dateutils, uconfigform, utriggersform;
const
// Timer milliseconds
@ -178,6 +178,7 @@ type
sls_co2: TStopLightSensor;
sls_hum: TStopLightSensor;
sls_tmp: TStopLightSensor;
sts: TStatusBar;
traypopup: TPopupMenu;
tmr_foobot: TTimer;
TrayIcon1: TTrayIcon;
@ -208,12 +209,14 @@ type
procedure mnu_SampleEveryHalfHourClick(Sender: TObject);
procedure tmr_foobotTimer(Sender: TObject);
procedure TrayIcon1Click(Sender: TObject);
procedure ShowHintInStatusBar(Sender:TObject);
private
sSecretKey, sFoobotUserName, sUUID: string;
bDisplayGuagesOnly, bDisplayYellowLines, bDisplayRedLines: boolean;
iFudgeFactor: integer;
HighTriggerColor, LowTriggerColor: TColor;
foobotmenuarray: array of TMenuItem;
sStandardHintText:String;
procedure DisplayReadings;
procedure UpdateGuage(Sender: TAnalogSensor; SensorNumber: integer);
procedure UpdateHighLow(SensorNumber: integer);
@ -231,6 +234,7 @@ type
procedure DoHighTriggerAlert(const iSensorNum: integer; const aValue: variant);
procedure DoLowTriggerAlert(const iSensorNum: integer; const aValue: variant);
procedure RestoreNormalColour(const iSensorNum: integer);
procedure PopulateHints; // for i8n use later
public
iCurrentFoobot: integer;
INI: TCryptINIfile;
@ -246,6 +250,68 @@ uses uSplash;
{$R *.lfm}
{ Tmainform }
procedure Tmainform.PopulateHints;
// ToDo: i8n
begin
// Traffic light controls
sls_pm.Hint:='|Shows health of Particulates';
sls_tmp.Hint:='|Shows health of Temperature';
sls_hum.Hint:='|Shows health of Humidity';
sls_co2.Hint:='|Shows health of Carbon Dioxide';
sls_voc.Hint:='|Shows health of Volatile Organics';
sls_allpollu.Hint:='|Shows health of All Pollution';
// Traffic light labels
lbl_greenlightpm.Hint:='|Shows green when below recommended value';
lbl_greenlighttmp.Hint:='|Shows green when below recommended value';
lbl_greenlighthum.Hint:='|Shows green when below recommended value';
lbl_greenlightco2.Hint:='|Shows green when below recommended value';
lbl_greenlightvoc.Hint:='|Shows green when below recommended value';
lbl_greenlightallpollu.Hint:='|Shows green wne below recommended value';
lbl_redlightpm.Hint:='|Shows red if High or Low value is triggered';
lbl_redlighttmp.Hint:='|Shows red if High or Low value is triggered';
lbl_redlighthum.Hint:='|Shows red if High or Low value is triggered';
lbl_redlightco2.Hint:='|Shows red if High or Low value is triggered';
lbl_redlightvoc.Hint:='|Shows red if High or Low value is triggered';
lbl_redlightallpollu.Hint:='|Shows red if High or Low value is triggered';
lbl_yellowlightpm.Hint:='|Shows yellow when above recommended value';
lbl_yellowlighttmp.Hint:='|Shows yellow when above recommended value';
lbl_yellowlighthum.Hint:='|Shows yellow when above recommended value';
lbl_yellowlightco2.Hint:='|Shows yellow when above recommended value';
lbl_yellowlightvoc.Hint:='|Shows yellow when above recommended value';
lbl_yellowlightallpollu.Hint:='|Shows yellow when above recommended value';
// All-time highs and lows
lbl_pmhigh.Hint:='|All-time highest value recorded';
lbl_tmphigh.Hint:='|All-time highest value recorded';
lbl_humhigh.Hint:='|All-time highest value recorded';
lbl_co2high.Hint:='|All-time highest value recorded';
lbl_vochigh.Hint:='|All-time highest value recorded';
lbl_allpolluhigh.Hint:='|All-time highest value recorded';
lbl_pmlow.Hint:='|All-time lowest value recorded';
lbl_tmplow.Hint:='|All-time lowest value recorded';
lbl_humlow.Hint:='|All-time lowest value recorded';
lbl_co2low.Hint:='|All-time lowest value recorded';
lbl_voclow.Hint:='|All-time lowest value recorded';
lbl_allpollulow.Hint:='|All-time lowest value recorded';
// GroupBoxes
grp_chart.Hint:='|' + sStandardHintText;
grp_pm.Hint:='|' + sStandardHintText;
grp_tmp.Hint:='|' + sStandardHintText;
grp_hum.Hint:='|' + sStandardHintText;
grp_co2.Hint:='|' + sStandardHintText;
grp_voc.Hint:='|' + sStandardHintText;
grp_allpollu.Hint:='|' + sStandardHintText;
grp_highlow.Hint:='|' + sStandardHintText;
grp_sensorDisplay.Hint:='|' + sStandardHintText;
grp_health.Hint:='|' + sStandardHintText;
// Sensors
as_pm.Hint:='|Particulates level';
as_tmp.Hint:='|Temperature';
as_hum.Hint:='|Humidity';
as_co2.Hint:='|Co2 level';
as_voc.Hint:='|Volatile organics level';
as_allpollu.Hint:='|All pollution level';
Chart1.Hint:='|Rolling chart showing levels of all sensors';
end;
procedure Tmainform.FormCreate(Sender: TObject);
begin
@ -291,6 +357,10 @@ begin
mnu_options_triggersActivateTriggers.Checked := True;
mnu_options_triggersActivateTriggers.Caption := 'Set Triggers Off';
end;
sStandardHintText:='Welcome to ' + Application.Title;
PopulateHints;
sts.SimpleText:=sStandardHintText;
Application.OnHint := @ShowHintInStatusBar;
end;
procedure Tmainform.FormActivate(Sender: TObject);
@ -1239,4 +1309,9 @@ begin
end;
end;
procedure Tmainform.ShowHintInStatusBar(Sender:TObject);
begin
sts.SimpleText := GetLongHint(Application.Hint);
end;
end.