Rev 75 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 75 | Rev 76 | ||
---|---|---|---|
1 | unit MAIN; |
1 | unit MAIN; |
2 | 2 | ||
3 | // TODO: Wenn man das Hauptfenster schließt, sollen nicht alle Uhren meckern |
3 | // TODO: Wenn man das Hauptfenster schließt, sollen nicht alle Uhren meckern |
4 | // TODO: Uhrzeiten abspeichern? |
4 | // TODO: Uhrzeiten abspeichern? |
5 | // TODO: Uhrzeitenwert manuell änderbar machen? |
5 | // TODO: Uhrzeitenwert manuell änderbar machen? |
6 | // TODO: Automatische Fenster-Anordnung funktioniert nicht korrekt mit poDefaultSizeOnly |
6 | // TODO: Automatische Fenster-Anordnung funktioniert nicht korrekt mit poDefaultSizeOnly |
7 | 7 | ||
8 | interface |
8 | interface |
9 | 9 | ||
10 | uses Windows, SysUtils, Classes, Graphics, Forms, Controls, Menus, |
10 | uses Windows, SysUtils, Classes, Graphics, Forms, Controls, Menus, |
11 | StdCtrls, Dialogs, Buttons, Messages, ExtCtrls, ComCtrls, StdActns, |
11 | StdCtrls, Dialogs, Buttons, Messages, ExtCtrls, ComCtrls, StdActns, |
12 | ActnList, ToolWin, ImgList; |
12 | ActnList, ToolWin, ImgList; |
13 | 13 | ||
14 | type |
14 | type |
15 | TMainForm = class(TForm) |
15 | TMainForm = class(TForm) |
16 | MainMenu1: TMainMenu; |
16 | MainMenu1: TMainMenu; |
17 | File1: TMenuItem; |
17 | File1: TMenuItem; |
18 | FileNewItem: TMenuItem; |
18 | FileNewItem: TMenuItem; |
19 | FileCloseItem: TMenuItem; |
19 | FileCloseItem: TMenuItem; |
20 | Window1: TMenuItem; |
20 | Window1: TMenuItem; |
21 | Help1: TMenuItem; |
21 | Help1: TMenuItem; |
22 | N1: TMenuItem; |
22 | N1: TMenuItem; |
23 | FileExitItem: TMenuItem; |
23 | FileExitItem: TMenuItem; |
24 | WindowCascadeItem: TMenuItem; |
24 | WindowCascadeItem: TMenuItem; |
25 | WindowTileItem: TMenuItem; |
25 | WindowTileItem: TMenuItem; |
26 | WindowArrangeItem: TMenuItem; |
26 | WindowArrangeItem: TMenuItem; |
27 | HelpAboutItem: TMenuItem; |
27 | HelpAboutItem: TMenuItem; |
28 | OpenDialog: TOpenDialog; |
28 | OpenDialog: TOpenDialog; |
29 | WindowMinimizeItem: TMenuItem; |
29 | WindowMinimizeItem: TMenuItem; |
30 | StatusBar: TStatusBar; |
30 | StatusBar: TStatusBar; |
31 | ActionList1: TActionList; |
31 | ActionList1: TActionList; |
32 | FileNew1: TAction; |
32 | FileNew1: TAction; |
33 | FileExit1: TAction; |
33 | FileExit1: TAction; |
34 | WindowCascade1: TWindowCascade; |
34 | WindowCascade1: TWindowCascade; |
35 | WindowTileHorizontal1: TWindowTileHorizontal; |
35 | WindowTileHorizontal1: TWindowTileHorizontal; |
36 | WindowArrangeAll1: TWindowArrange; |
36 | WindowArrangeAll1: TWindowArrange; |
37 | WindowMinimizeAll1: TWindowMinimizeAll; |
37 | WindowMinimizeAll1: TWindowMinimizeAll; |
38 | HelpAbout1: TAction; |
38 | HelpAbout1: TAction; |
39 | FileClose1: TWindowClose; |
39 | FileClose1: TWindowClose; |
40 | WindowTileVertical1: TWindowTileVertical; |
40 | WindowTileVertical1: TWindowTileVertical; |
41 | WindowTileItem2: TMenuItem; |
41 | WindowTileItem2: TMenuItem; |
42 | ToolBar2: TToolBar; |
42 | ToolBar2: TToolBar; |
43 | ToolButton9: TToolButton; |
43 | ToolButton9: TToolButton; |
44 | ToolButton8: TToolButton; |
44 | ToolButton8: TToolButton; |
45 | ToolButton10: TToolButton; |
45 | ToolButton10: TToolButton; |
46 | ToolButton11: TToolButton; |
46 | ToolButton11: TToolButton; |
47 | ImageList1: TImageList; |
47 | ImageList1: TImageList; |
- | 48 | Einstellungen1: TMenuItem; |
|
- | 49 | NureineUhrgleichzeitig1: TMenuItem; |
|
- | 50 | AlleUhrenstoppen1: TMenuItem; |
|
- | 51 | N2: TMenuItem; |
|
48 | procedure FileNew1Execute(Sender: TObject); |
52 | procedure FileNew1Execute(Sender: TObject); |
49 | procedure FileOpen1Execute(Sender: TObject); |
53 | procedure FileOpen1Execute(Sender: TObject); |
50 | procedure HelpAbout1Execute(Sender: TObject); |
54 | procedure HelpAbout1Execute(Sender: TObject); |
51 | procedure FileExit1Execute(Sender: TObject); |
55 | procedure FileExit1Execute(Sender: TObject); |
52 | procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); |
56 | procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); |
- | 57 | procedure NureineUhrgleichzeitig1Click(Sender: TObject); |
|
- | 58 | procedure FormShow(Sender: TObject); |
|
- | 59 | procedure AlleUhrenstoppen1Click(Sender: TObject); |
|
53 | private |
60 | private |
54 | { Private-Deklarationen } |
- | |
55 | procedure CreateMDIChild(const Name: string); |
61 | procedure CreateMDIChild(const Name: string); |
56 | public |
62 | public |
57 | { Public-Deklarationen } |
63 | procedure StopAllTimers; |
58 | end; |
64 | end; |
59 | 65 | ||
60 | var |
66 | var |
61 | MainForm: TMainForm; |
67 | MainForm: TMainForm; |
62 | 68 | ||
63 | implementation |
69 | implementation |
64 | 70 | ||
65 | {$R *.dfm} |
71 | {$R *.dfm} |
66 | 72 | ||
67 | uses CHILDWIN, about; |
73 | uses CHILDWIN, about, IniFiles; |
68 | 74 | ||
69 | var |
75 | var |
70 | StopUhrCount: integer = 1; |
76 | StopUhrCount: integer = 1; |
71 | 77 | ||
- | 78 | procedure TMainForm.AlleUhrenstoppen1Click(Sender: TObject); |
|
- | 79 | begin |
|
- | 80 | StopAllTimers; |
|
- | 81 | end; |
|
- | 82 | ||
72 | procedure TMainForm.CreateMDIChild(const Name: string); |
83 | procedure TMainForm.CreateMDIChild(const Name: string); |
73 | var |
84 | var |
74 | Child: TMDIChild; |
85 | Child: TMDIChild; |
75 | begin |
86 | begin |
76 | Child := TMDIChild.Create(Application); |
87 | Child := TMDIChild.Create(Application); |
77 | Child.Caption := Name; |
88 | Child.Caption := Name; |
78 | Child.Memo1.Lines.Text := Name; |
89 | Child.Memo1.Lines.Text := Name; |
79 | end; |
90 | end; |
80 | 91 | ||
81 | procedure TMainForm.FileNew1Execute(Sender: TObject); |
92 | procedure TMainForm.FileNew1Execute(Sender: TObject); |
82 | begin |
93 | begin |
83 | CreateMDIChild('Stoppuhr #' + IntToStr(StopUhrCount)); |
94 | CreateMDIChild('Stoppuhr #' + IntToStr(StopUhrCount)); |
84 | Inc(StopUhrCount); |
95 | Inc(StopUhrCount); |
85 | end; |
96 | end; |
86 | 97 | ||
87 | procedure TMainForm.FileOpen1Execute(Sender: TObject); |
98 | procedure TMainForm.FileOpen1Execute(Sender: TObject); |
88 | begin |
99 | begin |
89 | if OpenDialog.Execute then |
100 | if OpenDialog.Execute then |
90 | CreateMDIChild(OpenDialog.FileName); |
101 | CreateMDIChild(OpenDialog.FileName); |
91 | end; |
102 | end; |
92 | 103 | ||
93 | procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); |
104 | procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); |
94 | begin |
105 | begin |
95 | // Brauchen wir nicht, da die einzelnen MDI-Fenster ja schon meckern |
106 | // Brauchen wir nicht, da die einzelnen MDI-Fenster ja schon meckern |
96 | //CanClose := MessageDlg('Programm wirklich beenden?', mtConfirmation, mbYesNoCancel, 0) = mrYes; |
107 | //CanClose := MessageDlg('Programm wirklich beenden?', mtConfirmation, mbYesNoCancel, 0) = mrYes; |
97 | end; |
108 | end; |
98 | 109 | ||
- | 110 | procedure TMainForm.FormShow(Sender: TObject); |
|
- | 111 | var |
|
- | 112 | x: TMemIniFile; |
|
- | 113 | begin |
|
- | 114 | x := TMemIniFile.Create('Settings.ini'); |
|
- | 115 | try |
|
- | 116 | NureineUhrgleichzeitig1.Checked := x.ReadBool('Settings', 'SingleClockMode', false); |
|
- | 117 | finally |
|
- | 118 | FreeAndNil(x); |
|
- | 119 | end; |
|
- | 120 | end; |
|
- | 121 | ||
99 | procedure TMainForm.HelpAbout1Execute(Sender: TObject); |
122 | procedure TMainForm.HelpAbout1Execute(Sender: TObject); |
100 | begin |
123 | begin |
101 | AboutBox.ShowModal; |
124 | AboutBox.ShowModal; |
102 | end; |
125 | end; |
- | 126 | ||
- | 127 | procedure TMainForm.NureineUhrgleichzeitig1Click(Sender: TObject); |
|
- | 128 | var |
|
- | 129 | x: TMemIniFile; |
|
- | 130 | begin |
|
- | 131 | x := TMemIniFile.Create('Settings.ini'); |
|
- | 132 | try |
|
- | 133 | x.WriteBool('Settings', 'SingleClockMode', NureineUhrgleichzeitig1.Checked); |
|
- | 134 | x.UpdateFile; |
|
- | 135 | finally |
|
- | 136 | FreeAndNil(x); |
|
- | 137 | end; |
|
- | 138 | end; |
|
- | 139 | ||
- | 140 | procedure TMainForm.StopAllTimers; |
|
- | 141 | var |
|
- | 142 | i: integer; |
|
- | 143 | begin |
|
- | 144 | for i := 0 to MDIChildCount - 1 do |
|
- | 145 | begin |
|
- | 146 | TMdiChild(MDIChildren[i]).StopTimer; |
|
- | 147 | end; |
|
- | 148 | end; |
|
103 | 149 | ||
104 | procedure TMainForm.FileExit1Execute(Sender: TObject); |
150 | procedure TMainForm.FileExit1Execute(Sender: TObject); |
105 | begin |
151 | begin |
106 | Close; |
152 | Close; |
107 | end; |
153 | end; |
108 | 154 | ||
109 | end. |
155 | end. |
110 | 156 |