-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.pas
2570 lines (2228 loc) · 81.1 KB
/
Main.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
unit Main;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, OGame_Types, Prog_Unit, Inifiles, Galaxy_Explorer, Grids, ExtCtrls,
Bericht_Frame, ComCtrls, Menus, Suche, shellapi, Buttons,
AppEvnts, jpeg, Math, ImgList, VirtualTrees, cS_DB_solsysFile, cS_DB_reportFile,
clipbrd, ClipboardViewerForm, EditScan, stringlistedit, xmldom,
XMLIntf, msxmldom, XMLDoc, cs_XML, oFight, clipbrdfunctions, UniTree,
frm_pos_size_ini, MusiPlayer, TIReadPlugin, PlanetListInterface,
TrayIcon, PostErrorReport, quickupdate, Stats_Einlesen;
const
Transporter_space = 25000;
Transporter_oil = 50;
Schlachtschiff_space = 1500;
Schlachtschiff_oil = 500;
WM_MOUSESpezialKeyDown = $020B;
WM_MOUSESpezialKeyUp = $020C;
svk_back = $00010000;
svk_forward = $00020000;
type
TSuchInetTyp = (sitPlayer, sitAllanz);
TSuchInetVorlage = record
Allianz, Spieler, Name: String;
end;
TAngriffsLogig = (al_Drago,al_PlanDB);
TPlayerOptions = Record
Transporter: TShip;
Schlachtschiff: TShip;
StartPlanet: TPlanetPosition;
Flugzeit_u: Int64;
AngriffsLogig: TAngriffsLogig;
SuchInet: TSuchInetVorlage;
ServerPort: Word;
phpPost: String;
StartSystray: Boolean;
// Scan/Systeme
noMoonQuestion: boolean;
//BeepSound
Beep_SoundFile: String;
//Fleets:
Fleet_ShowArivalMessage: boolean;
Fleet_AMSG_Time_s: Integer;
Fleet_alert: Boolean;
Fleet_close_msg_window_when_arrived: Boolean;
Fleet_Soundfile: String;
Fleet_auto_time_sync: Boolean;
// Websim
websim_techs: array[0..2] of integer;
websim_engines: array[0..2] of integer;
// cshelper_listener
cshl_active: boolean;
cshl_port: integer;
end;
TFRM_Main = class(TClipboardViewer)
MainMenu1: TMainMenu;
Datenbank1: TMenuItem;
NeuerGalaxyExplorer1: TMenuItem;
StatusBar1: TStatusBar;
Info1: TMenuItem;
TrayIconPopup: TPopupMenu;
MainWindow1: TMenuItem;
N1: TMenuItem;
Close1: TMenuItem;
Beenden1: TMenuItem;
NetConnections1: TMenuItem;
Fenster1: TMenuItem;
Dir: TMenuItem;
Import2: TMenuItem;
Export1: TMenuItem;
N5: TMenuItem;
P_ExplorerDock: TPanel;
OpenDialog1: TOpenDialog;
alsandererBenutzerneustarten1: TMenuItem;
Einstellungen1: TMenuItem;
P_Scan: TPanel;
Frame_Bericht2: TFrame_Bericht;
Info2: TMenuItem;
TIM_Start: TTimer;
il_trayicon: TImageList;
Zwischenablageberwachen1: TMenuItem;
Splitter1: TSplitter;
Panel2: TPanel;
Test1: TMenuItem;
Languagefile1: TMenuItem;
N3: TMenuItem;
Funktionen1: TMenuItem;
Scanslschen1: TMenuItem;
Statistiken1: TMenuItem;
Einlesen1: TMenuItem;
ApplicationEvents1: TApplicationEvents;
TIM_afterClipboardchange: TTimer;
NewScan1: TMenuItem;
N2: TMenuItem;
VergelicheSysDateimitDB1: TMenuItem;
N4: TMenuItem;
writeunitsinconstsxml1: TMenuItem;
VergleicheScanDateimitDB1: TMenuItem;
N6: TMenuItem;
SaveClipboardtoFile1: TMenuItem;
SaveDialog1: TSaveDialog;
POST1: TMenuItem;
TIM_FakeCV: TTimer;
N7: TMenuItem;
exportxml1: TMenuItem;
Timer1: TTimer;
selectkoordranges1: TMenuItem;
ScansDatumLschen1: TMenuItem;
Frame_Bericht1: TFrame_Bericht;
N8: TMenuItem;
Flottenbersicht1: TMenuItem;
Notizen1: TMenuItem;
neueSuche1: TMenuItem;
Universumsbersicht1: TMenuItem;
Listenansicht1: TMenuItem;
IL_ScanSize: TImageList;
N9: TMenuItem;
frmevents1: TMenuItem;
PopupMenu1: TPopupMenu;
Lschen1: TMenuItem;
Galaxie1: TMenuItem;
popup_auftrag: TPopupMenu;
Angriff1: TMenuItem;
Spionage1: TMenuItem;
N10: TMenuItem;
Raideintragen1: TMenuItem;
p_startscreen: TPanel;
lbl_title: TLabel;
Label1: TLabel;
lbl_wiki_link: TLabel;
Label3: TLabel;
lbl_forum_link: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
phpSync1: TMenuItem;
Panel1: TPanel;
lst_others: TListView;
BTN_Paste: TButton;
BTN_Copy: TButton;
BTN_Liste: TButton;
BTN_Suche: TButton;
BTN_Universum: TButton;
btn_last: TButton;
btn_next: TButton;
Scan1: TMenuItem;
nchstenAuswhlen1: TMenuItem;
vorherigenauswhlen1: TMenuItem;
sb_start_bg: TShape;
Forum1: TMenuItem;
Wiki1: TMenuItem;
ico_active: TImage;
ico_inactive: TImage;
N11: TMenuItem;
PostErrorReport1: TMenuItem;
Update1: TMenuItem;
Softupdate1: TMenuItem;
updatecheck2: TMenuItem;
ZwischenablagefrMondScans1: TMenuItem;
lbl_dbl_click: TLabel;
Button1: TButton;
Spionage2: TMenuItem;
Expedition1: TMenuItem;
stresstestforaddsolsys1: TMenuItem;
closeFreeAudioFiles1: TMenuItem;
P_WF: TPanel;
LBL_WF_1: TLabel;
LBL_WF_0_1: TLabel;
LBL_WF_2: TLabel;
LBL_WF_3: TLabel;
LBL_WF_0_2: TLabel;
LBL_WF_0_3: TLabel;
btn_fight_start: TButton;
spiodirekt1: TMenuItem;
commander1: TMenuItem;
N12: TMenuItem;
testShowReadSource1: TMenuItem;
procedure btn_lastClick(Sender: TObject);
procedure btn_nextClick(Sender: TObject);
procedure LblWikiLinkClick(Sender: TObject);
procedure Raideintragen1Click(Sender: TObject);
procedure Spionage1Click(Sender: TObject);
procedure Angriff1Click(Sender: TObject);
procedure btn_fight_startClick(Sender: TObject);
procedure BTN_PasteClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure BTN_CopyClick(Sender: TObject);
procedure lst_othersSelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean);
procedure FormCreate(Sender: TObject);
procedure lst_othersCompare(Sender: TObject; Item1, Item2: TListItem;
Data: Integer; var Compare: Integer);
procedure BTN_DeleteClick(Sender: TObject);
procedure NeuerGalaxyExplorer1Click(Sender: TObject);
procedure Info1Click(Sender: TObject);
procedure MainWindow1Click(Sender: TObject);
procedure Beenden1Click(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure StatusBar1DrawPanel(StatusBar: TStatusBar;
Panel: TStatusPanel; const Rect: TRect);
procedure DirClick(Sender: TObject);
procedure Export1Click(Sender: TObject);
procedure BTN_GalaxieClick(Sender: TObject);
procedure P_ExplorerDockResize(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Import2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure lst_othersColumnClick(Sender: TObject; Column: TListColumn);
procedure alsandererBenutzerneustarten1Click(Sender: TObject);
procedure Einstellungen1Click(Sender: TObject);
procedure Frame_Bericht1Copy1Click(Sender: TObject);
procedure Frame_Bericht1KopiereinTabellenform1Click(Sender: TObject);
procedure P_WFResize(Sender: TObject);
procedure BTN_UniversumClick(Sender: TObject);
procedure BTN_SucheClick(Sender: TObject);
procedure BTN_ListeClick(Sender: TObject);
procedure BTN_TopmostClick(Sender: TObject);
procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
procedure updatecheck1Click(Sender: TObject);
procedure TIM_StartTimer(Sender: TObject);
procedure Zwischenablageberwachen1Click(Sender: TObject);
procedure SuchenErsetzen1Click(Sender: TObject);
procedure Languagefile1Click(Sender: TObject);
procedure Scanslschen1Click(Sender: TObject);
procedure Einlesen1Click(Sender: TObject);
procedure NetConnections1Click(Sender: TObject);
procedure ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
procedure TIM_afterClipboardchangeTimer(Sender: TObject);
procedure TrayIconPopupPopup(Sender: TObject);
procedure lst_othersKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure NewScan1Click(Sender: TObject);
procedure VergelicheSysDateimitDB1Click(Sender: TObject);
procedure writeunitsinconstsxml1Click(Sender: TObject);
procedure VergleicheScanDateimitDB1Click(Sender: TObject);
procedure SaveClipboardtoFile1Click(Sender: TObject);
procedure POST1Click(Sender: TObject);
procedure TIM_FakeCVTimer(Sender: TObject);
procedure Frame_Bericht1Timer1Timer(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure ScansDatumLschen1Click(Sender: TObject);
procedure Frame_Bericht1Timer2Timer(Sender: TObject);
procedure Flottenbersicht1Click(Sender: TObject);
procedure Notizen1Click(Sender: TObject);
procedure neueSuche1Click(Sender: TObject);
procedure Universumsbersicht1Click(Sender: TObject);
procedure Listenansicht1Click(Sender: TObject);
procedure Frame_Bericht1PB_BDblClick(Sender: TObject);
procedure Frame_Bericht1PB_BPaint(Sender: TObject);
procedure StatusBar1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure phpSync1Click(Sender: TObject);
procedure Forum1Click(Sender: TObject);
procedure Wiki1Click(Sender: TObject);
procedure PostErrorReport1Click(Sender: TObject);
procedure Softupdate1Click(Sender: TObject);
procedure ZwischenablagefrMondScans1Click(Sender: TObject);
procedure PopupMenu1Popup(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Spionage2Click(Sender: TObject);
procedure Expedition1Click(Sender: TObject);
procedure frmevents1Click(Sender: TObject);
procedure stresstestforaddsolsys1Click(Sender: TObject);
procedure closeFreeAudioFiles1Click(Sender: TObject);
procedure spiodirekt1Click(Sender: TObject);
procedure commander1Click(Sender: TObject);
procedure testShowReadSource1Click(Sender: TObject);
published
procedure FormClipboardContentChanged(Sender: TObject);
private
fLatestPlanetListSource: TPlanetListInterface;
beenden: boolean;
eee: integer;
IniFile: String;
CloseToSystray: Boolean;
FakeCVClipbrdSequenceNumber: DWORD;
_____time: TDateTime;
_____mittelwehrt: Integer;
topmost: boolean;
procedure setPlanetListSource(list: TPlanetListInterface);
property mLatestPlanetListSource: TPlanetListInterface
read fLatestPlanetListSource write setPlanetListSource;
procedure simplyShowScan(Pos: TPlanetPosition);
procedure SearchList(nr: integer; pos: TPlanetPosition);
procedure PaintScan(scan: TScanBericht; save: TScanGroup = sg_Forschung);
procedure Wellenangriff(Scan: TScanbericht);
procedure LoadOptions;
procedure SaveOptions;
procedure ODB_UniTree_ReportChanged(Sender: TObject; Pos: TPlanetPosition);
procedure ODB_UniTree_SolSysChanged(Sender: TObject; Pos: TPlanetPosition);
procedure SaveLoad_SimpleOptions(ini: TIniFile; save: boolean);
procedure ShowExplorerPanel;
procedure ShowScanPanel;
procedure LangPluginOnAskMoon(Sender: TOgameDataBase;
const Report: TScanBericht; var isMoon, Handled: Boolean);
private
fSearchWindows: TList;
function getSearchWindow(index: integer): TFRM_Suche;
protected
property SearchWindows[index: integer]: TFRM_Suche read getSearchWindow;
procedure SetCVActive(B: Boolean); override;
procedure Notification(AComponent: TComponent; Operation: TOperation);
override;
public
frm_statistics: TFRM_Stats_Einlesen;
frm_quickupdate: Tfrm_quickupdate;
TrayIco: TTrayIcon;
DockExplorer: TExplorer;
PlayerOptions: TPlayerOptions;
Einstellungen: set of (soAddNewScanToList,
soShowScanCountMessage,
soBeepByWatchClipboard,
soUniCheck,
soAutoUpdateCheck,
soStartupServer
);
LastClipBoard: String; //LastClipboard wird nurnoch gesetzt, wenn das programm selber in die Zwischenablage setzt, die nicht verarbeitet werden sollen! (z.b. Copy_button)
SoundModul: TMusiPlayer;
procedure intelligentReadData(const text, html: string);
procedure ShowScan(NR: integer); overload;
procedure ShowScan(Pos: TPlanetPosition; list: TPlanetListInterface = nil); overload;
function NewExplorer: TExplorer;
procedure RightClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure Play_Alert_Sound(filename: string);
procedure RefreshDBListSize(Sender: TObject);
procedure RefreshExplorers(P: TPlanetPosition);
function NewSearch: TFRM_Suche;
procedure ShowGalaxie(Pos: TPlanetPosition; toFront: Boolean = true);
procedure ShowSmallScan(P: TPlanetPosition);
procedure OpenInBrowser(url: String);
procedure SetTrayIcon_;
procedure RaidDialog(Position: TPlanetPosition); overload;
function RaidDialog(var Fleet: TFleetEvent): boolean; overload;
procedure SucheImInet(Typ: TSuchInetTyp; Allianz, Player: String;
Uni: String);
procedure ClipbrdReadScan;
procedure ClipbrdReadSys;
procedure ShowSearchPlayer(name: string);
procedure ShowSearchPlayerID(id: TNameID);
procedure ShowSearchAlly(ally: string);
procedure Show;
{ Public-Deklarationen }
end;
const
GeneralSection = 'UserOptions';
var
FRM_Main: TFRM_Main;
explorer : array of TExplorer;
procedure callLink(url: string);
implementation
uses Notizen, Favoriten, Info,
Uebersicht, Connections, Export, Einstellungen, Suchen_Ersetzen,
KB_List, Add_KB, Languages, Delete_Scans,
DateUtils, _test_POST, ComConst, StrUtils, sync_cS_db_engine,
SDBFile, Mond_Abfrage, moon_or_not, chelper_server, global_options;
{$R *.DFM}
procedure TFRM_Main.RightClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
end;
procedure TFRM_Main.BTN_PasteClick(Sender: TObject);
begin
ClipbrdReadScan;
end;
procedure TFRM_Main.FormDestroy(Sender: TObject);
begin
frm_statistics.Free;
mLatestPlanetListSource := nil; // remove free notification
ODataBase.OnAskMoon := nil;
frm_cshelper_ctrl.Free;
SaveOptions;
Stopp; // Clipboard Viewer
Beenden := True;
SoundModul.Free;
TrayIco.free;
while fSearchWindows.Count > 0 do
begin
SearchWindows[0].Free;
// The object is removed from the list
// by the public function "notification"
end;
fSearchWindows.Free;
frm_quickupdate.Free;
end;
procedure TFRM_Main.BTN_CopyClick(Sender: TObject);
var s: string;
begin
s := ODataBase.LanguagePlugIn.ScanToStr(Frame_Bericht1.Bericht,False);
LastClipBoard := s;
Clipboard.AsText := s;
end;
procedure TFRM_Main.ShowScan(Pos: TPlanetPosition; list: TPlanetListInterface = nil);
begin
mLatestPlanetListSource := list;
simplyShowScan(Pos);
end;
procedure TFRM_Main.simplyShowScan(Pos: TPlanetPosition);
var scan_gen: TScanBericht;
info: TSystemPlanet;
snr: Integer;
begin
//ACHTUNG: Überladene Funktionen rufen sich nicht gegenseitig auf!
// Ändere Titel
Application.Title := 'cS [' + PositionToStrMond(Pos) + ']';
// Zeigt Generic Scan:
scan_gen := TScanBericht.Create;
try
ODataBase.UniTree.genericReport(Pos, scan_gen);
if scan_gen.Head.Time_u >= 0 then
begin
// Suche Liste
SearchList(-1,scan_gen.Head.Position);
end
else
begin
lst_others.Clear; //Wenn nicht, zeige Sonnensystem-Informationen:
snr := ODataBase.UniTree.UniSys(Pos.P[0],Pos.P[1]);
if snr >= 0 then
begin
info := ODataBase.Systeme[snr].Planeten[Pos.P[2]];
Frame_Bericht1.ShowPlanetInfo(Pos,info);
p_startscreen.Visible := false;
ShowScanPanel();
end
else
begin
ShowScan(-1); //Wenn keine Sonnensystem vorhanden, Zeige NIX!
end;
end;
finally
scan_gen.Free;
end;
end;
procedure TFRM_Main.ShowScan(NR: integer);
var scan: TScanBericht;
begin
//ACHTUNG: Überladene Funktionen rufen sich nicht gegenseitig auf!
if ((NR >= 0)and(NR < ODataBase.Berichte.Count)) then
begin
scan := ODataBase.berichte[nr];
SearchList(nr,scan.Head.Position);
Application.Title := 'cS [' + PositionToStrMond(scan.Head.Position) + ']';
PaintScan(scan);
end
else
begin
Frame_Bericht1.Clear;
lst_others.Clear;
end;
end;
procedure TFRM_Main.lst_othersSelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean);
var Scan: TScanBericht;
nr: integer;
save: TScanGroup;
begin
scan := TScanBericht.Create();
try
if Selected then
begin
nr := StrToInt(item.SubItems[0]);
if nr >= 0 then
begin
Scan.copyFrom(ODataBase.Berichte[nr]);
save := sg_Forschung;
end
else
begin
save := ODataBase.UniTree.genericReport(Frame_Bericht1.Bericht.Head.Position,
Scan);
end;
PaintScan(Scan, Save);
end;
finally
Scan.Free;
end;
end;
procedure TFRM_Main.FormCreate(Sender: TObject);
begin
fSearchWindows := TList.Create;
fLatestPlanetListSource := nil; // initialise
mLatestPlanetListSource := nil; // set buttons enabled
frm_quickupdate := Tfrm_quickupdate.Create(Self, ODataBase, true);
frm_cshelper_ctrl := Tfrm_cshelper_ctrl.Create(Self);
frm_cshelper_ctrl.OnTriggerRead := intelligentReadData;
lbl_title.Caption := lbl_title.Caption + VNumber;
topmost := false;
StatusBar1.Panels[0].Text := STR_normal;
{
TrayIco := TTrayIcon.Create(Self);
TrayIco.Icons := il_trayicon;
TrayIco.IconIndex := -1;
Caption := Caption + ' Uni: ' +
ODataBase.UniDomain + '.' + ODataBase.game_domain +
' User: ' + ODataBase.Username;
TrayIco.Hint := FRM_Main.Caption;
TrayIco.PopupMenu := TrayIconPopup;
TrayIco.OnDblClick := MainWindow1Click;
TrayIco.Visible := true;
}
TrayIco := TTrayIcon.Create(Self);
TrayIco.Icon := ico_active.Picture.Icon;
Caption := Caption + ' Uni: ' +
ODataBase.UniDomain + '.' + ODataBase.game_domain +
' User: ' + ODataBase.Username;
TrayIco.ToolTip := FRM_Main.Caption;
TrayIco.PopupMenu := TrayIconPopup;
TrayIco.OnDblClick := MainWindow1Click;
TrayIco.Active := true;
SoundModul := TMusiPlayer.Create(Self);
if SaveCaptions then SaveAllCaptions(Self,LangFile);
if LoadCaptions then LoadAllCaptions(Self,LangFile);
LastClipBoard := '<<<<<NEU>>>>>'; //clipboard.AsText;
OnClipboardContentChanged := FormClipboardContentChanged;
beenden := false;
eee := 0;
ODataBase.UniTree.OnSolSysChanged := ODB_UniTree_SolSysChanged;
ODataBase.UniTree.OnReportChanged := ODB_UniTree_ReportChanged;
IniFile := ODataBase.PlayerInf;
Frame_Bericht2.Style := 2;
LoadOptions;
if PlayerOptions.StartSystray then
Visible := False;
DockExplorer := TExplorer.Create(self, 1, 'Explorer_Main');
DockExplorer.dock(P_ExplorerDock,rect(0,0,P_ExplorerDock.ClientWidth,P_ExplorerDock.ClientHeight));
DockExplorer.Initialise(ODataBase.UserPosition);
DockExplorer.show;
LoadFormSizePos(IniFile,self);
RefreshDBListSize(Self);
ODataBase.OnAskMoon := LangPluginOnAskMoon;
StatusBar1.DoubleBuffered := True;
frm_statistics := TFRM_Stats_Einlesen.Create(Self);
end;
procedure TFRM_Main.lst_othersCompare(Sender: TObject; Item1,
Item2: TListItem; Data: Integer; var Compare: Integer);
begin
if StrToDateTime(Item1.SubItems[1]) > StrToDateTime(Item2.SubItems[1]) then
begin
Compare := -1;
end
else
begin
Compare := 1;
end;
end;
procedure TFRM_Main.BTN_DeleteClick(Sender: TObject);
var p: TPlanetPosition;
item: TListItem;
list: TStringList;
i, ID: integer;
begin
if lst_others.Selected = nil then
Exit;
ID := strtoint(lst_others.Selected.SubItems[0]);
if ID < 0 then
Exit;
if Application.MessageBox(
PChar(STR_Scans_Loeschen_text),
PChar(STR_Scans_Loeschen_title),
MB_OKCANCEL)
<> ID_OK then Exit;
//wichtig: der löschvorgang muss von hohem index zu niedrigen gehen!
if lst_others.SelCount > 0 then
begin
list := TStringList.Create;
p := ODataBase.Berichte[ID].Head.Position;
item := lst_others.Items[0];
while item <> nil do
begin
if item.Selected then
begin
list.Add(item.SubItems[0]);
item.Delete;
end;
if lst_others.Items.Count > 0 then
begin
if lst_others.Items[0].Selected then
item := lst_others.Items[0]
else
item := lst_others.GetNextItem(lst_others.Items[0],sdAll,[isSelected]);
end
else
item := nil;
end;
list.Sort;
for i := list.Count-1 downto 0 do //rückwärts, weil, wenn du einen niederen index löscht, es sein kann, das die höheren nichtmehr stimmen, wohl aber die drunnter!
ODataBase.UniTree.DeleteReport(StrToIntDef(list[i], -1));
list.Free;
lst_others.Items.Clear;
if (ODataBase.Uni[p.P[0],p.P[1]].Planeten[p.P[2],p.Mond].ScanBericht >= 0) then
ShowScan(ODataBase.Uni[p.P[0],p.P[1]].Planeten[p.P[2],p.Mond].ScanBericht);
end;
end;
function TFRM_Main.NewExplorer: TExplorer;
var i : integer;
begin
i := 0;
while (i < length(Explorer))and(Explorer[i].Visible) do
begin
inc(i);
end;
if i + 1 >= length(Explorer) then
begin
setlength(explorer,i+1);
end;
if explorer[i] = nil then explorer[i] := TExplorer.Create(Self,0,'Explorer_Extra_' + IntToStr(i));
explorer[i].Initialise(ODataBase.UserPosition);
explorer[i].show;
Result := explorer[i];
end;
procedure TFRM_Main.NeuerGalaxyExplorer1Click(Sender: TObject);
begin
NewExplorer;
end;
procedure TFRM_Main.Info1Click(Sender: TObject);
begin
FRM_Info.ShowModal;
end;
procedure TFRM_Main.MainWindow1Click(Sender: TObject);
begin
Show;
SetFocus;
BringToFront;
end;
procedure TFRM_Main.SearchList(nr: integer; pos: TPlanetPosition);
var i: integer; //nr -> damit ich weis welchen zum selektieren
item, gitem: TListItem;
list: TReportTimeList;
stime: TDateTime;
begin
lst_others.Items.BeginUpdate;
// this is necessary couse we save our MainPosition in the FRAME!
Frame_Bericht1.Bericht.Head.Position := pos;
try
lst_others.Items.Clear;
// Füge generic hinzu:
item := lst_others.Items.Add;
item.Caption := 'generic';
item.SubItems.Add('-1'); // SCAN ID
item.SubItems.Add(DateTimeToStr(now()+99999)); // Date
gitem := item;
list := ODataBase.UniTree.GetPlanetReportList(pos);
for i := 0 to length(list)-1 do
begin
item := lst_others.Items.Add;
stime := UnixToDateTime(list[i].Time_u);
if trunc(stime) = trunc(now) then //wenn Gleicher Tag
item.Caption := TimeToStr(stime)
else
item.Caption := DateTimeToStr(stime);
item.SubItems.add(inttostr(list[i].ID));
if (list[i].ID = nr) then
item.Selected := true;
item.SubItems.Add(DateTimeToStr(stime));
//Zähle vorhandene Scangruppen:
item.ImageIndex := GetScanGrpCount(ODataBase.Berichte[list[i].ID]);
end;
// Wenn NR nicht gefunden, generic markieren
if lst_others.Selected = nil then
gitem.Selected := true;
finally
lst_others.Items.EndUpdate;
end;
end;
procedure TFRM_Main.Beenden1Click(Sender: TObject);
begin
Beenden := true;
Close;
end;
procedure TFRM_Main.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose := (not CloseToSystray) or beenden or
not((Mouse.CursorPos.x > Left + Width - 50)and
(Mouse.CursorPos.x < Left + Width + 50)and
(Mouse.CursorPos.y > Top - 50)and
(Mouse.CursorPos.y < Top + 50)
);
if CanClose and ( frm_report_basket.vst_reports.RootNodeCount > 0 ) then
begin
if Application.MessageBox('Die Zwischenablage für Mond?Scans enthält noch '#13#10 +
'ungespeicherte Scanberichte, wirklich beenden?',
'Ungespeicherte Scans in der TmpReportBox',
MB_YESNO or MB_ICONQUESTION) = IDNO then
begin
frm_report_basket.Show;
CanClose := False;
beenden := false;
exit;
end;
end;
Beenden := CanClose;
if not CanClose then
begin
DockExplorer.Hide;
Hide;
end
else
begin
inc(eee);
if eee = 1 then
begin
TrayIco.Active := false;
DockExplorer.Release;
//Close;
end;
end;
end;
procedure TFRM_Main.StatusBar1DrawPanel(StatusBar: TStatusBar;
Panel: TStatusPanel; const Rect: TRect);
//var re : TRect;
var c: TColor;
begin
with StatusBar.Canvas do
begin
{re := Rect;
re.Right := trunc((Rect.Right-Rect.Left) * (StrToInt(Panel.Text) / 100)) + Rect.Left;
Brush.Color := StatusBar.Color;
FillRect(Rect);
Brush.Color := clBlue;
FillRect(re);}
case StrToInt(Panel.Text) of
0..70: c := clLime;
71..200: c := clYellow;
else c := clRed;
end;
Brush.Color := c;
FillRect(Rect);
TextOut(Rect.Left,Rect.Top,Panel.Text);
end;
end;
procedure TFRM_Main.RefreshDBListSize(Sender: TObject);
begin
StatusBar1.Panels[2].Text := STR_Scanberichte + ': ' + IntToStr(ODataBase.Berichte.Count);
StatusBar1.Panels[3].Text := STR_Systeme + ': ' + IntToStr(ODataBase.Systeme.Count);
end;
procedure TFRM_Main.DirClick(Sender: TObject);
begin
WinExec(PChar('"explorer" "' + ExtractFileDir(application.exename)), SW_SHOWNORMAL);
end;
procedure TFRM_Main.Export1Click(Sender: TObject);
begin
FRM_Export.Show;
end;
procedure TFRM_Main.BTN_GalaxieClick(Sender: TObject);
begin
if P_Scan.Visible then
begin
if ValidPosition(Frame_Bericht1.Bericht.Head.Position) then
ShowGalaxie(Frame_Bericht1.Bericht.Head.Position)
else
ShowGalaxie(ODataBase.UserPosition);
end
else
begin
ShowScanPanel;
end;
end;
procedure TFRM_Main.btn_lastClick(Sender: TObject);
var pos: TPlanetPosition;
begin
if mLatestPlanetListSource <> nil then
begin
if mLatestPlanetListSource.selectPreviousPlanet(pos) then
simplyShowScan(pos);
end;
end;
procedure TFRM_Main.P_ExplorerDockResize(Sender: TObject);
begin
if DockExplorer <> nil then
begin
DockExplorer.Width := P_ExplorerDock.ClientWidth;
Frame_Bericht2.Height := P_ExplorerDock.ClientHeight - DockExplorer.Height;
end;
end;
procedure TFRM_Main.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
case key of
integer('W'):
BTN_GalaxieClick(Sender);
VK_LEFT:
btn_lastClick(Sender);
VK_RIGHT:
btn_nextClick(Sender);
end;
end;
procedure TFRM_Main.Import2Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
ODataBase.ImportFile(OpenDialog1.FileName);
end;
end;
procedure TFRM_Main.FormShow(Sender: TObject);
begin
if DockExplorer <> nil then
DockExplorer.Show;
end;
procedure TFRM_Main.lst_othersColumnClick(Sender: TObject;
Column: TListColumn);
var i : integer;
begin
for i := 0 to lst_others.Items.Count-1 do
lst_others.Items[i].Selected := true;
end;
procedure TFRM_Main.alsandererBenutzerneustarten1Click(Sender: TObject);
begin
login := true;
Beenden1Click(self);
end;
procedure TFRM_Main.Einstellungen1Click(Sender: TObject);
var i: integer;
form: TFRM_Einstellungen;
begin
Form := TFRM_Einstellungen.Create(self);
for i := 0 to length(FRM_Favoriten.FleetDefRessValues)-1 do
Form.FDRessValues[i] := FRM_Favoriten.FleetDefRessValues[i];
for i := 0 to length(FRM_Favoriten.FleetDefValues)-1 do
Form.FDValues[i] := FRM_Favoriten.FleetDefValues[i];
form.CH_AddNewScan.Checked := soAddNewScanToList in Einstellungen;
form.CH_ShowCountScan.Checked := soShowScanCountMessage in Einstellungen;
form.CH_Clipboard.Checked := CVActive;
form.txt_beep_sound_file.Text := PlayerOptions.Beep_SoundFile;
form.CH_Unicheck.Checked := soUniCheck in Einstellungen;
form.txt_UniCheckName.Text := ODataBase.UniCheckName;
form.CH_Beep.Checked := soBeepByWatchClipboard in Einstellungen;
form.CH_AutoDelete.Checked := ODataBase.DeleteScansWhenAddSys;
form.ch_startupServer.Checked := soStartupServer in Einstellungen;
form.TXT_ServerStartPort.Text := IntToStr(PlayerOptions.ServerPort);
form.cb_no_moon.Checked := PlayerOptions.noMoonQuestion;
form.cb_check_solsys_data_for_moon.Checked := ODataBase.check_solsys_data_before_askMoon;
form.TXT_SS.Text := LBL_WF_0_2.Caption;
form.TXT_gT.Text := LBL_WF_0_3.Caption;
form.TXT_Schlachter_Laderaum.Text := IntToStr(PlayerOptions.Schlachtschiff.space);
form.TXT_Transporter_Laderaum.Text := IntToStr(PlayerOptions.Transporter.space);
form.TXT_Schlachter_Treibstoff.Text := IntToStr(PlayerOptions.Schlachtschiff.oil);
form.TXT_Transporter_Treibstoff.Text := IntToStr(PlayerOptions.Transporter.oil);
form.TXT_RaidStart.Text := PositionToStrMond(PlayerOptions.StartPlanet);
form.TXT_Flugzeit.Text := TimeToStr(UnixToDateTime(PlayerOptions.Flugzeit_u));
form.redHours := ODataBase.redHours;
form.TXT_maxhourstoadd.Text := IntToStr(trunc(ODataBase.MaxTimeToAdd*24));
if PlayerOptions.AngriffsLogig = al_Drago then form.RB_Dragologic.Checked := True
else form.RB_PlanDBlogic.Checked := True;
form.CH_AutoUpdate.Checked := soAutoUpdateCheck in Einstellungen;
form.CH_MiniSysTray.Checked := CloseToSystray;
//Flotteneinstellugen (Raid-List)
form.cb_fleet_popup_enabled.Checked := PlayerOptions.Fleet_ShowArivalMessage;
form.txts_fleet_popup_time_s.Value := PlayerOptions.Fleet_AMSG_Time_s;
form.txt_fleet_alert_sound.Text := PlayerOptions.Fleet_Soundfile;
form.cb_fleet_alert_sound.Checked := PlayerOptions.Fleet_alert;
form.cb_auto_serverzeit.Checked := PlayerOptions.Fleet_auto_time_sync;
form.cb_fleet_msg_auto_close.Checked := PlayerOptions.Fleet_close_msg_window_when_arrived;
// websim
form.se_tech_0.Value := PlayerOptions.websim_techs[0];
form.se_tech_1.Value := PlayerOptions.websim_techs[1];
form.se_tech_2.Value := PlayerOptions.websim_techs[2];
form.se_engine_0.Value := PlayerOptions.websim_engines[0];
form.se_engine_1.Value := PlayerOptions.websim_engines[1];
form.se_engine_2.Value := PlayerOptions.websim_engines[2];
with cSServer.Users do
begin
LockUsers;
try
if (UserCount > 0) then
begin
form.ClientGroup := Users[0];
setlength(form.Groups,UserCount-1);
for i := 1 to UserCount-1 do
form.Groups[i-1] := Users[i];
end
else
begin
setlength(form.Groups,0);
end;
finally
UnlockUsers;
end;
end;
form.TXT_Allysuche.Text := PlayerOptions.SuchInet.Allianz;
form.TXT_Spielersuche.Text := PlayerOptions.SuchInet.Spieler;
form.TXT_SuchenName.Text := PlayerOptions.SuchInet.Name;
form.RB_Explorer_nurDatum.Checked := explorer_Zeitformat = ezf_Datum;
form.RB_Explorer_genaueZeitangabe.Checked := explorer_Zeitformat = ezf_DatumUhrzeit;
form.CH_explorer_MouseOver.Checked := explorer_mouseover;
form.TXT_TF_markierung_groesse.Text := IntToStr(explorer_TF_Size);
form.sh_lbl_vacation.Brush.Color := explorer_bgcolor_vaction;
form.sh_lbl_noob.Brush.Color := explorer_bgcolor_noob;
form.sh_lbl_inactive.Brush.Color := explorer_bgcolor_inactive;
//Fake ClipboadViewer (für Linux/Wine)
form.CB_FakeClipbrdViewer.Checked := TIM_FakeCV.Enabled;
form.TXT_FakeCVIntervall.Text := IntToStr(TIM_FakeCV.Interval);