-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunit1.pas
executable file
·2179 lines (1725 loc) · 55.9 KB
/
unit1.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{-----------------------------------------------------------------------------
Author: Alexander Roth
Date: 04-Nov-2006
Dieses Programm ist freie Software. Sie können es unter den Bedingungen
der GNU General Public License, wie von der Free Software Foundation
veröffentlicht, weitergeben und/oder modifizieren, gemäß Version 2 der Lizenz.
Description:
-----------------------------------------------------------------------------}
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Uanderes,UChart, StdCtrls,
ExtCtrls, Menus, ActnList,ExpandPanels, Spin, ComCtrls, Buttons, USimpleWebViewer,
UGroupHeader, StdActns,UColoredBox, math;
type
{ TForm1 }
TForm1 = class(TForm)
ActionDelLastLambda: TAction;
ActionAddLambda: TAction;
ActionESC: TAction;
ActionFullscreen: TAction;
ActionResetView: TAction;
ActionUpdate: TAction;
ActionMaximize: TAction;
ActionResetSettings: TAction;
ActionExportAllValues: TAction;
ActionHelp: TAction;
ActionAbout: TAction;
ActionChartSettings: TAction;
ActionVersion: TAction;
ActionSaveSettings: TAction;
ActionCalcAndDraw: TAction;
ActionOpenSettings: TAction;
ActionShowProgrammerInfo: TAction;
ActionList1: TActionList;
BAddLambda: TButton;
BDelLambda: TButton;
BHelpRotate: TSpeedButton;
BOK: TButton;
BSlitWidth: TSpeedButton;
CheckAskConfirmationreflection: TCheckBox;
CheckDrawChart: TCheckBox;
CheckShowLSGitternetz: TCheckBox;
CheckShowXGitternetz: TCheckBox;
CheckViewLittleHelp: TCheckBox;
CheckExImageIntensity: TCheckBox;
CheckExMaximaDraw: TCheckBox;
CheckPixelexpandedImageIntesity: TCheckBox;
CheckPixelExtendedImageIntesity: TCheckBox;
CheckViewLittleHelp2: TCheckBox;
ComboSource: TColoredListBox;
EditDistScreenSlit: TEdit;
EditHorizontalAngle: TEdit;
EditSlitCount: TEdit;
EditSlitDistance: TEdit;
EditSlitWidth: TEdit;
EditAngle2: TEdit;
EditVerticalAngle: TEdit;
GroupBox2: TGroupBox;
GroupBoxIntensityFactor: TGroupBox;
GroupBoxQuality: TGroupBox;
GroupColors: TGroupBox;
GroupHorizontalAngle: TGroupBox;
GroupLaserHeight: TGroupBox;
GroupShowMaxMin: TGroupBox;
GroupBox10: TGroupBox;
GroupVerticalAngle: TGroupBox;
Label1: TLabel;
Label10: TLabel;
Label14: TLabel;
Label15: TLabel;
Label20: TLabel;
Label21: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
LabelMaxCount: TLabel;
GroupHeader1: TGroupHeader;
GroupHeader2: TGroupHeader;
GroupMultiSource: TGroupBox;
GroupShowChart: TGroupBox;
LabelPos: TLabel;
ListCountPoints: TColoredListBox;
ListLog: TColoredListBox;
LMinus: TLabel;
LPlus: TLabel;
LSlitWidth: TLabel;
Memo1: TMemo;
MenuItem1: TMenuItem;
MenuItem10: TMenuItem;
MenuItem14: TMenuItem;
MenuItem15: TMenuItem;
MenuItem16: TMenuItem;
MenuItem17: TMenuItem;
MenuHelpLittle: TMenuItem;
ShowProgrammerInfo: TMenuItem;
MenuItem8: TMenuItem;
MyRollOutCountPoints: TPanel;
MyRollOutHelpLittle: TMyRollOut;
MyRollOutLog: TPanel;
OptioAperture: TMyRollOut;
OptioExtended: TMyRollOut;
OptioRotate: TMyRollOut;
OptioChart: TMyRollOut;
OptioScreen: TMyRollOut;
Panel1: TPanel;
PanelOGLBox: TPanel;
PBOK: TPanel;
PanelLambda: TPanel;
RadioGroupFormel: TRadioGroup;
RadioImageAxis: TRadioGroup;
RadioLSAxis: TRadioGroup;
RadioReflection: TRadioGroup;
RadioXAxis: TRadioGroup;
SimpleWebViewerHelpLittle: TSimpleWebViewer;
PProgrammerInfo: TMyRollOut;
ProgressDraw: TProgressBar;
PHelpRotateExpand: TPanel;
PScrollBox1: TScrollBox;
OptioScrollBox: TScrollBox;
ScrollBox1: TScrollBox;
SpinEditIntensityFactor: TSpinEdit;
Timer1: TTimer;
TrackBarCountSlit: TTrackBar;
TrackBarDistScreenSlit: TTrackBar;
TrackBarIntensityFactor: TTrackBar;
TrackHorizontalAngle: TTrackBar;
TrackLaserHeight: TTrackBar;
TrackQuality: TTrackBar;
HelpAction: THelpAction;
PopupMenuOGLBox: TPopupMenu;
ExpandPanelsMainOption: TExpandPanels;
Label8: TLabel;
MainMenu1: TMainMenu;
ResetSettings: TMenuItem;
MenuItem11: TMenuItem;
MenuItem12: TMenuItem;
MenuItem13: TMenuItem;
MenuItem2: TMenuItem;
MenuItem3: TMenuItem;
MenuItem4: TMenuItem;
MenuItem5: TMenuItem;
MenuItem6: TMenuItem;
MenuItem7: TMenuItem;
MenuIChartSettings: TMenuItem;
MenuItem9: TMenuItem;
OpenDialog1: TOpenDialog;
PSlitWidthExpand: TPanel;
SaveDialog1: TSaveDialog;
DialogExportAllValues: TSaveDialog;
Splitter1: TSplitter;
TrackSlitDistance: TTrackBar;
TrackSlitWidth: TTrackBar;
TrackVerticalAngle: TTrackBar;
XAxisPosGroup: TRadioGroup;
YAxisPosGroup: TRadioGroup;
procedure ActionAboutExecute(Sender: TObject);
procedure ActionAddLambdaExecute(Sender: TObject);
procedure ActionCalcAndDrawExecute(Sender: TObject);
procedure ActionChartSettingsExecute(Sender: TObject);
procedure ActionDelLastLambdaExecute(Sender: TObject);
procedure ActionESCExecute(Sender: TObject);
procedure ActionExportAllValuesExecute(Sender: TObject);
procedure ActionFullscreenExecute(Sender: TObject);
procedure ActionHelpExecute(Sender: TObject);
procedure ActionMaximizeExecute(Sender: TObject);
procedure ActionOpenSettingsExecute(Sender: TObject);
procedure ActionResetSettingsExecute(Sender: TObject);
procedure ActionResetViewExecute(Sender: TObject);
procedure ActionSaveSettingsExecute(Sender: TObject);
procedure ActionShowProgrammerInfoExecute(Sender: TObject);
procedure ActionUpdateExecute(Sender: TObject);
procedure ActionVersionExecute(Sender: TObject);
procedure BAddLambdaClick(Sender: TObject);
procedure BDelLambdaClick(Sender: TObject);
procedure BOKClick(Sender: TObject);
procedure BHelpRotateClick(Sender: TObject);
procedure BSlitWidthClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure CheckDrawChartChange(Sender: TObject);
procedure CheckShowXGitternetzChange(Sender: TObject);
procedure CheckShowLSGitternetzChange(Sender: TObject);
procedure CheckViewLittleHelp2Change(Sender: TObject);
procedure CheckViewLittleHelpChange(Sender: TObject);
procedure ComboSourceChange(Sender: TObject);
procedure EditDistScreenSlitKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure EditHorizontalAngleKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure EditSlitCountChange(Sender: TObject);
procedure EditSlitCountKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure EditSlitDistanceKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure AllEditChange(Sender: TObject);
procedure EditSlitWidthKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure EditVerticalAngleKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure ExpandPanelsMainOptionArrangePanels(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormWindowStateChange(Sender: TObject);
procedure IdleFunc(Sender: TObject; var Done: Boolean);
procedure Label10Click(Sender: TObject);
procedure Label5Click(Sender: TObject);
procedure MenuHelpLittleClick(Sender: TObject);
procedure MenuItem17Click(Sender: TObject);
procedure OptioScreenClick(Sender: TObject);
procedure ShowProgrammerInfoClick(Sender: TObject);
procedure MenuItem1Click(Sender: TObject);
procedure OptioApertureCollapse(Sender: TObject);
procedure OptioChartCollapse(Sender: TObject);
procedure OptioChartExpand(Sender: TObject);
procedure OptioChartPreExpand(Sender: TObject);
procedure OptioChartResize(Sender: TObject);
procedure OptioRotateCollapse(Sender: TObject);
procedure OptioRotatePreCollapse(Sender: TObject);
procedure PanelOGLBoxClick(Sender: TObject);
procedure PanelOGLBoxEnter(Sender: TObject);
procedure PanelOGLBoxExit(Sender: TObject);
procedure PanelOptioApertureResize(Sender: TObject);
procedure PProgrammerInfoResize(Sender: TObject);
procedure RadioReflectionClick(Sender: TObject);
procedure RadioGroupFormelClick(Sender: TObject);
procedure RadioImageAxisClick(Sender: TObject);
procedure RadioXAxisClick(Sender: TObject);
procedure RadioLSAxisClick(Sender: TObject);
procedure RadioXAxisMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ScrollBox1Click(Sender: TObject);
procedure SpinEditIntensityFactorChange(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure AllTrackChange(Sender: TObject);
procedure TrackSlitWidthMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure TrackSlitWidthMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure XAxisPosGroupClick(Sender: TObject);
procedure YAxisPosGroupClick(Sender: TObject);
private
AreaInitialized: boolean;
FProgrammerInfo:boolean;
FFullScreen:boolean;
WasPan,
WasZoom:boolean;
procedure setProgrammerInfo(value:boolean);
procedure setFullScreen(value:boolean);
public
{ Public-Deklarationen }
PanelVisible:boolean;
ScaleAxis:record
ScalingY:boolean;
DeltaY:integer;
end;
RegisterInfo:record
Activated,WasStarted:boolean;
Starts:byte;
end;
EnableIdleDraw:boolean;
MouseOverBox:boolean;
RatioSlitWidthDist:real;
procedure OGLBoxMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure OGLBoxMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure OGLBoxMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
procedure SetDefaultKoors;
procedure LabelGroupHeader;
procedure ChangeItem(idx:byte);
procedure AddItem(lambda:real=0);
procedure AddItemSilent(lambda:real=0);
procedure DelLastItem;
procedure DelLastItemSilent;
procedure CalcAndDrawOGL;
procedure writeHints;
procedure RelistSources;
procedure PExpandVisible(sender:TObject;b:boolean);
function OnChangeMakeAll(comp:TComponent; key:word=0):word;
procedure AddLog(s:string; acolor:Tcolor); overload;
procedure AddLog(s:string); overload;
procedure CheckLog;
property ProgrammerInfo:boolean read FProgrammerInfo write setProgrammerInfo;
property FullScreen:boolean read FFullScreen write setFullScreen;
end;
{ TALED }
TALED = class(TShape)
private
FStatus:boolean;
FColorOn,
FColorOff:TColor;
FOnColorChange:TNotifyEvent;
procedure WriteFColorOn(ColorOn:TColor);
procedure WriteFColorOff(ColorOff:TColor);
procedure WriteFStatus(Status:boolean);
public
property Status:boolean read FStatus write WriteFStatus;
property ColorOn:TColor read FColorOn write WriteFColorOn;
property ColorOff:TColor read FColorOff write WriteFColorOff;
property OnColorChange:TNotifyEvent read FOnColorChange write FOnColorChange;
constructor Create(TheOwner: TComponent); override;
end;
procedure ShowOKButton(edit:TCustomEdit);
procedure AceptValues;
function BeginInputChange:boolean;
procedure EndInputChange(BCalc:boolean=true);
function BeginEditKeyDown(sender: TCustomEdit; var key:word):boolean;
function StandartIniFile:string;
var Form1:TForm1;
tick: longint;
i: integer;
stop:boolean;
SelectedEdit:TCustomEdit;
IsChangingInput:boolean;
ReadTxtInputMode:boolean;
version:string;
NowVisible:boolean;
MustIdleReCalc:boolean;
implementation
uses unit2,uapparatus, utxt, unit4, unit3, umathe;
procedure OGLKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
end;
procedure OGLMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
end;
{==============================================================================
Procedure: ShowOKButton
Belongs to: None
Result: None
Parameters:
edit : TCustomEdit =
Description:
==============================================================================}
procedure ShowOKButton(edit:TCustomEdit);
var p,endP:TPoint;
begin
SelectedEdit:=edit;
p:=AbsolutePosition(edit);
with form1.PBOK do
begin
endP.x:=p.X+edit.Width+25;
endP.y:=p.Y;
if endP.x+Form1.PBOK.Width >Form1.Width then
begin
endP.x:=p.X-Form1.PBOK.Width-25;
end;
if endP.y+Form1.PBOK.Height >Form1.Height then
begin
endP.y:=Form1.Height-Form1.PBOK.Height;
end;
Left:=endP.x;
Top:=endP.y;
Show;
BringToFront;
end;
end;
{==============================================================================
Procedure: AceptValues
Belongs to: None
Result: None
Parameters:
Description:
==============================================================================}
procedure AceptValues;
var w:word;
begin
form1.PBOK.Hide;
OGLBox.DrawOGL;
w:=13;
if SelectedEdit is TEdit then
TCustomEdit(SelectedEdit).OnKeyDown(SelectedEdit, w ,[])
//if SelectedEdit.ClassName='TJvValidateEdit' then
//TJvValidateEdit(SelectedEdit).OnKeyDown(SelectedEdit, w ,[])
else if SelectedEdit is TSpinEdit then
TSpinEdit(SelectedEdit).OnKeyDown(SelectedEdit, w ,[]);
end;
function BeginInputChange: boolean;
begin
Result:=IsChangingInput;
if not Result then
IsChangingInput:=true;
end;
procedure EndInputChange(BCalc:boolean);
var i,
max:integer;
begin
IsChangingInput:=false;
getAllspecifications;
if NowVisible then
if BCalc then
SaS.CalcAndDrawBox
else
OGLBox.DrawOGL;
max:=0;
for i:=0 to SaS.count-1 do
begin
if SaS.Screen[i].SingleSlit.Values.count>max then
max:=SaS.Screen[i].SingleSlit.Values.count;
if SaS.Screen[i].NSlit.Values.count>max then
max:=SaS.Screen[i].NSlit.Values.count;
if SaS.Screen[i].CombiSlit.Values.count>max then
max:=SaS.Screen[i].CombiSlit.Values.count;
if SaS.Screen[i].ImageIntensity.Values.count>max then
max:=SaS.Screen[i].ImageIntensity.Values.count;
end;
form1.LabelMaxCount.Caption:='Punktzahl pro Graph: '+IntToStr(max);
end;
{//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TForm1 TForm1 TForm1 TForm1 TForm1 TForm1 TForm1 TForm1 TForm1 TForm1 TForm1
TForm1 TForm1 TForm1 TForm1 TForm1 TForm1 TForm1 TForm1 TForm1 TForm1 TForm1
TForm1 TForm1 TForm1 TForm1 TForm1 TForm1 TForm1 TForm1 TForm1 TForm1 TForm1
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////}
{-----------------------------------------------------------------------------
Description:
Procedure: ChangeItem
Arguments: idx:byte
Result: None
Detailed description:
-----------------------------------------------------------------------------}
procedure TForm1.ChangeItem(idx:byte);
begin
self.ComboSource.ItemIndex:=idx;
SaS.ActiveNumber:=idx;
self.GroupMultiSource.Caption:='Mehrere Wellenlängen Aktuelle Anzahl: '+inttostr(SaS.count);
LabelGroupHeader;
end;
{-----------------------------------------------------------------------------
Description:
Procedure: AddItem
Arguments: None
Result: None
Detailed description:
-----------------------------------------------------------------------------}
procedure TForm1.AddItem(lambda:real=0);
begin
self.AddItemSilent(lambda);
self.ChangeItem(SaS.count-1);
if (SaS.count>1) and (self.RadioXAxis.ItemIndex=2) then
self.RadioXAxis.ItemIndex:=1;
if NowVisible then
CalcAndDrawOGL;
RelistSources;
end;
{==============================================================================
Procedure: RelistSources
Belongs to: TForm1
Result: None
Parameters:
Description:
==============================================================================}
procedure TForm1.RelistSources;
var I:integer;
begin
if ComboSource.Items.Count > SaS.Count then
for i:= 0 to ComboSource.Items.Count -SaS.Count -1 do
ComboSource.Items.Delete(ComboSource.Items.Count -1-i) ;
for I := 0 to SaS.Count - 1 do
begin
if ComboSource.Items.Count<= i then
ComboSource.AddItem('tmp');
self.ComboSource.Items.Strings[i]:='Wellenlänge '+inttostr(i)+' ('+inttostr(round(SaS.Source[i].lambda*1E9))+'nm) ';
self.ComboSource.ItemColors.Strings[i]:=ColorToString(clWindowText);//+' ('+inttostr(round(SaS.Source[i].lambda*1E9))+'nm) ');
self.ComboSource.ItemBackgroundColors.Strings[i]:=ColorToString(SaS.Screen[i].color);//+' ('+inttostr(round(SaS.Source[i].lambda*1E9))+'nm) ');
end;
ComboSource.ItemIndex:=SaS.ActiveNumber;
ComboSource.Update;
LabelGroupHeader;
end;
{==============================================================================
Procedure: PSlitWithVisible
Belongs to: TForm1
==============================================================================}
procedure TForm1.PExpandVisible(sender:TObject; b:boolean);
var p:Tpoint;
speed:TSpeedButton;
panel:TPanel;
begin
if Sender=nil then exit;
speed:=TSpeedButton(sender);
if speed.Name='BSlitWidth' then
panel:=PSlitWidthExpand
else if speed.Name='BHelpRotate' then
panel:=PHelpRotateExpand;
p:=AbsolutePosition(speed);
panel.Top:=p.Y;
panel.Left:=p.x+speed.Width;
panel.Visible:=b;
if panel.Visible then
begin
speed.Glyph.LoadFromLazarusResource('PfeilEin');
panel.BringToFront;
end
else
speed.Glyph.LoadFromLazarusResource('PfeilAus');
end;
function TForm1.OnChangeMakeAll(comp: TComponent; key: word):word;
procedure writeLSlitWidth;
begin
try
RatioSlitWidthDist:=aperture.slit.width/aperture.slit.distance;
LSlitWidth.Caption:=Formatfloat('0.##', (RatioSlitWidthDist))+' * g';
except
end;
end;
procedure correctTrackSlitWidth;
begin
exit;
if (self.TrackSlitWidth.Position<self.TrackSlitDistance.Position)
and(self.TrackSlitWidth.Position>round(self.TrackSlitDistance.Position/100)) then
begin
self.TrackSlitWidth.Min:=round(self.TrackSlitDistance.Position/100);
self.TrackSlitWidth.Max:=self.TrackSlitDistance.Position;
TrackSlitWidth.Update;
end;
end;
var strl, sep:TStringList;
bcalc:boolean;
begin
if not( (comp is TCustomEdit) or (comp is TCustomTrackBar) ) then
exit;
if BeginInputChange then
exit;
bcalc:=true;
//edit
if (comp is TCustomEdit) and (BeginEditKeyDown(TCustomEdit(comp), Key) or ReadTxtInputMode) then
begin
Result:=key;
if (key = 13) and (TCustomEdit(comp).Text<>'') or ReadTxtInputMode then
begin
//s:=TCustomEdit(comp).Text;
//korrigiere(s, ['0'..'9','-','+',',','.','E','e']);
//if TCustomEdit(comp).Text <> s then
//TCustomEdit(comp).Text := s;
PBOK.Hide;
if comp.Name = 'EditSlitCount' then
begin
if ( self.EditSlitCount.Text='') or ( self.EditSlitCount.Text='0') then
self.EditSlitCount.Text := '1';
aperture.slit.count:= abs(round(strtofloat(self.EditSlitCount.Text)));
if not ReadTxtInputMode then
self.TrackBarCountSlit.Position:=round(sqrt(aperture.slit.count)*10);
if NowVisible then
if not SaS.MinOneChecked(MyCombi) and not SaS.MinOneChecked(MyImage)and not SaS.MinOneChecked(MyN) then
ShowMessage('Sie haben nur den '+SaS.Screen[0].SingleSlit.check.Caption+' ausgewählt.'+#13+#13+
'Bitte wähle den "'+SaS.Screen[0].CombiSlit.check.Caption+'" links unten aus,'+#13+
'damit das ändern von der Spaltanzahl eine Wirkung zeigt');
end
else if comp.Name = 'EditSlitDistance' then
begin
RatioSlitWidthDist:=aperture.slit.width/aperture.slit.distance;
aperture.slit.distance:=strtofloat(self.EditSlitDistance.Text)*1E-6;
if aperture.slit.distance > 1000e-6 then
; // here you can disable the min max chart.. its getting slow
if not ReadTxtInputMode then
begin
self.TrackSlitDistance.Position:=round(aperture.slit.distance *1E7 {für track});
aperture.slit.width:=RatioSlitWidthDist*aperture.slit.distance;
self.EditSlitWidth.Text := Formatfloat('0.##', (aperture.slit.width*1E6));
self.TrackSlitWidth.Position:=round(RatioSlitWidthDist *100);
end;
writeLSlitWidth;
end
else if comp.Name = 'EditSlitWidth' then
begin
aperture.slit.width:=strtofloat(self.EditSlitWidth.Text)*1E-6;
RatioSlitWidthDist:=aperture.slit.width/aperture.slit.distance;
if not ReadTxtInputMode then
self.TrackSlitWidth.Position:=round(RatioSlitWidthDist *100);
if not ReadTxtInputMode then
bcalc:=true;
writeLSlitWidth;
end
else if comp.Name = 'EditHorizontalAngle' then
begin
aperture.slit.beta:=radtoBog(strtofloat(EditHorizontalAngle.Text));
if not ReadTxtInputMode then
self.TrackHorizontalAngle.Position:=round(StrToFloat(EditHorizontalAngle.Text));
OGLBox.MiniSlit.beta:=aperture.slit.beta;
end
else if comp.Name = 'EditVerticalAngle' then
begin
aperture.slit.theta:=radtoBog(strtofloat(EditVerticalAngle.Text));
if not ReadTxtInputMode then
self.TrackVerticalAngle.Position:=round(StrToFloat(EditVerticalAngle.Text));
OGLBox.ImageAxis.Visible:= aperture.slit.theta<>0;
//if (aperture.LaserHeight >60) and (aperture.slit.theta<>0) then
//begin
//aperture.LaserHeight:=30;
//if not ReadTxtInputMode then
//TrackLaserHeight.Position:=round(aperture.LaserHeight);
////if NowVisible then
////if not SaS.MinOneChecked(MyImage) then
////ShowMessage('Einen Effekt können Sie hier nur sehen wenn Sie das'+#13+
////'"'+SaS.Screen[0].ImageIntensity.check.Caption+'" links unten auswählen');
//end;
OGLBox.MiniSlit.theta:=aperture.slit.theta;
end
else if comp.Name = 'EditDistScreenSlit' then
begin
aperture.ScreenDistance:=StrToFloat(EditDistScreenSlit.Text);
if not ReadTxtInputMode then
self.TrackBarDistScreenSlit.Position:=round(power(StrToFloat(EditDistScreenSlit.Text),1/7)*100000);
end
else if pos('EditLambda_',comp.Name)>0 then
begin
sep:=TStringList.Create;
strl:=TStringList.Create;
sep.Add('_');
DivideString(comp.Name, sep, strl);
if strl.Count=2 then
with SaS.Source[StrToInt(strl[1])] do
begin
lambda:=strtofloat(EditLambda.Text)*1E-9;
if not ReadTxtInputMode then
SaS.Screen[StrToInt(strl[1])].CalcOnlyVisible;
end;
sep.Free;
strl.Free;
bcalc:=false;
end
else if pos('EditFrequency_',comp.Name)>0 then
begin
sep:=TStringList.Create;
strl:=TStringList.Create;
sep.Add('_');
DivideString(comp.Name, sep, strl);
if strl.Count=2 then
with SaS.Source[StrToInt(strl[1])] do
begin
frequency:=strtofloat(EditFrequency.Text);
if not ReadTxtInputMode then
SaS.Screen[StrToInt(strl[1])].CalcOnlyVisible;
end;
sep.Free;
strl.Free;
bcalc:=false;
end
else if comp.Name = 'SpinEditIntensityFactor' then
begin
if not ReadTxtInputMode then
TrackBarIntensityFactor.Position:=round(SpinEditIntensityFactor.Value);
SaS.IntensityColorFactor:=SpinEditIntensityFactor.Value;
bcalc:=false;
end;
EndInputChange(bcalc);
end;
end;
//track
if (comp is TCustomTrackBar) and (not ReadTxtInputMode) or (comp.Name = 'TrackLaserHeight') then
begin
if comp.Name = 'TrackBarCountSlit' then
begin
aperture.slit.count:=round(sqr(TrackBarCountSlit.Position/10));
if not ReadTxtInputMode then
EditSlitCount.Text:=IntToStr(aperture.slit.count);
if NowVisible then
if not SaS.MinOneChecked(MyCombi) and not SaS.MinOneChecked(MyImage)and not SaS.MinOneChecked(MyN) then
ShowMessage('Sie haben nur den '+SaS.Screen[0].SingleSlit.check.Caption+' ausgewählt.'+#13+#13+
'Bitte wähle den "'+SaS.Screen[0].CombiSlit.check.Caption+'" links unten aus,'+#13+
'damit das ändern von der Spaltanzahl eine Wirkung zeigt');
end
else if comp.Name = 'TrackSlitDistance' then
begin
RatioSlitWidthDist:=aperture.slit.width/aperture.slit.distance;
aperture.slit.distance:=self.TrackSlitDistance.Position*1E-7 {für track};
if not ReadTxtInputMode then
begin
self.EditSlitDistance.Text:=PrettyFormatFloat(aperture.slit.distance *1E6 , 3);
aperture.slit.width:=RatioSlitWidthDist*aperture.slit.distance;
self.EditSlitWidth.Text := Formatfloat('0.##', (aperture.slit.width*1E6));
self.TrackSlitWidth.Position:=round(RatioSlitWidthDist *100);
end;
writeLSlitWidth;
end
else if comp.Name = 'TrackSlitWidth' then
begin
aperture.slit.width:=self.TrackSlitWidth.Position/100 *aperture.slit.distance;
if not ReadTxtInputMode then
self.EditSlitWidth.Text := Formatfloat('0.##', (aperture.slit.width*1E6));
writeLSlitWidth;
end
else if comp.Name = 'TrackHorizontalAngle' then
begin
aperture.slit.beta:=radtoBog(self.TrackHorizontalAngle.Position);
if not ReadTxtInputMode then
EditHorizontalAngle.Text:=inttostr(self.TrackHorizontalAngle.Position);
OGLBox.MiniSlit.beta:=aperture.slit.beta;
end
else if comp.Name = 'TrackVerticalAngle' then
begin
aperture.slit.theta:=radtoBog(self.TrackVerticalAngle.Position);
if not ReadTxtInputMode then
EditVerticalAngle.Text:=inttostr(self.TrackVerticalAngle.Position);
// OGLBox.ImageAxis.Visible:= aperture.slit.theta<>0;
//if not ReadTxtInputMode then
//if (aperture.LaserHeight >60) and (aperture.slit.theta<>0) then
//begin
//aperture.LaserHeight:=30;
//TrackLaserHeight.Position:=round(aperture.LaserHeight);
//end;
OGLBox.MiniSlit.theta:=aperture.slit.theta;
//if NowVisible then
//if not SaS.MinOneChecked(MyImage) then
//ShowMessage('Einen Effekt können Sie hier nur sehen wenn Sie das'+#13+
//'"'+SaS.Screen[0].ImageIntensity.check.Caption+'" links unten auswählen');
end
else if comp.Name = 'TrackBarDistScreenSlit' then
begin
aperture.ScreenDistance:=power(TrackBarDistScreenSlit.Position/100000,7);
if not ReadTxtInputMode then
EditDistScreenSlit.Text:=PrettyFormatFloat(aperture.ScreenDistance, 2);
end
else if pos('TrackBar_',comp.Name)>0 then
begin
sep:=TStringList.Create;
strl:=TStringList.Create;
sep.Add('_');
DivideString(comp.Name, sep, strl);
if strl.Count=2 then
with SaS.Source[StrToInt(strl[1])] do
begin
lambda:=TrackBar.position*1E-9;
SaS.Screen[StrToInt(strl[1])].CalcOnlyVisible;
end;
sep.Free;
strl.Free;
bcalc:=false;
end
else if comp.Name = 'TrackBarIntensityFactor' then
begin
SpinEditIntensityFactor.Value:=TrackBarIntensityFactor.Position;
SaS.IntensityColorFactor:=TrackBarIntensityFactor.Position;
bcalc:=false;
end
else if comp.Name = 'TrackLaserHeight' then
begin
aperture.LaserHeight:=TrackLaserHeight.Position;
bcalc:=false;
end
else if comp.Name = 'TrackQuality' then
begin
SaS.Quality:=TrackQuality.Position;
end;
// EndInputChange(bcalc);
EndInputChange(false);
MustIdleReCalc:=true;
end;
Result:=key;
IsChangingInput:=false;
if not ReadTxtInputMode and NowVisible then
if (comp is TCustomEdit) then
TCustomEdit(comp).SetFocus
else if (comp is TCustomTrackBar) then
TCustomTrackBar(comp).SetFocus
end;
{==============================================================================
Procedure: AddLog
Belongs to: TForm1
Result: None
Parameters:
s : string =
acolor : Tcolor =
Description:
==============================================================================}
procedure TForm1.AddLog(s:string; acolor:Tcolor);
const max=500;
begin
if not ProgrammerInfo then
exit;
if ListLog.Count>max then
ListLog.Items.Delete(0);
ListLog.AddItem(s,aColor);
// ListLog.ItemIndex:=ListLog.Count-1;
ListLog.Selected[ListLog.Count-1]:=true;
end;
{==============================================================================
Procedure: AddLog
Belongs to: TForm1
Result: None
Parameters:
s : string =
Description:
==============================================================================}
procedure TForm1.AddLog(s:string);
begin
AddLog(s, clWindowText);
end;
{==============================================================================
Procedure: CheckLog
Belongs to: TForm1
Result: None
Parameters:
Description:
==============================================================================}
procedure TForm1.CheckLog;
const max=500;
var i:integer;
begin
if ListLog.Count>max then
for I := 0 to ListLog.Count - max-1 do
ListLog.Items.Delete(0);
end;
procedure TForm1.OGLBoxMouseWheel(Sender: TObject; Shift: TShiftState;
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
begin
if ssShift in Shift then
begin
if WheelDelta>0 then
SpinEditIntensityFactor.Value:=SpinEditIntensityFactor.Value +3
else
SpinEditIntensityFactor.Value:=SpinEditIntensityFactor.Value -3;
OnChangeMakeAll(SpinEditIntensityFactor, 13);
end;
end;
procedure TForm1.SetDefaultKoors;
begin
with OGLBox.xAxis do
begin
case RadioXAxis.ItemIndex of
0:
begin
DefaultKoor.Min:=-2;
DefaultKoor.Max:=2;