Subversion Repositories ExamClock

Rev

Rev 9 | Rev 12 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9 Rev 10
Line 94... Line 94...
94
 
94
 
95
procedure TMainForm.FormCreate(Sender: TObject);
95
procedure TMainForm.FormCreate(Sender: TObject);
96
begin
96
begin
97
  // Initalise variables
97
  // Initalise variables
-
 
98
  ClockRunning := False;
-
 
99
  { Values for testing }
-
 
100
{  FoundationDuration := StrToTime('00:01:00');
-
 
101
  FoundationHalfTime := StrToTime('00:00:30');
-
 
102
  IntermediateDuration := StrToTime('00:02:00');
-
 
103
  IntermediateHalfTime := StrToTime('00:01:00');
-
 
104
  AdvancedDuration := StrToTime('00:03:00');
-
 
105
  AdvancedHalfTime := StrToTime('00:01:30');
-
 
106
  TenMins := StrToTime('00:00:10');}
98
  ClockRunning := False;
107
  { Live values }
99
  FoundationDuration := StrToTime('00:55:00');
108
  FoundationDuration := StrToTime('00:55:00');
100
  FoundationHalfTime := StrToTime('00:27:30');
109
  FoundationHalfTime := StrToTime('00:30:00');
101
  IntermediateDuration := StrToTime('01:25:00');
110
  IntermediateDuration := StrToTime('01:25:00');
102
  IntermediateHalfTime := StrToTime('00:42:30');
111
  IntermediateHalfTime := StrToTime('00:42:30');
103
  AdvancedDuration := StrToTime('02:00:00');
112
  AdvancedDuration := StrToTime('02:00:00');
104
  AdvancedHalfTime := StrToTime('01:00:00');
-
 
105
  Sec := StrToTime('00:00:01');
113
  AdvancedHalfTime := StrToTime('01:00:00');
-
 
114
  TenMins := StrToTime('00:10:00');
106
  TenMins := StrToTime('00:10:00');
115
  Sec := StrToTime('00:00:01');
107
  ZeroHour := StrToTime('00:00:00');
116
  ZeroHour := StrToTime('00:00:00');
Line 108... Line 117...
108
end;
117
end;
109
 
118
 
Line 204... Line 213...
204
begin
213
begin
205
  CurrentTimeLabel.Caption := TimeToStr(Time);
214
  CurrentTimeLabel.Caption := TimeToStr(Time);
206
  StatusBar.Panels[0].Text := DateToStr(Date);
215
  StatusBar.Panels[0].Text := DateToStr(Date);
207
  if ClockRunning then
216
  if ClockRunning then
208
  begin
217
  begin
209
    // update the display
218
    { update the display
-
 
219
      first the Foundation display }
210
    if FoundationPanel.Enabled then
220
    if FoundationDuration > ZeroHour then
211
    begin
221
    begin
212
      FoundationDuration := FoundationDuration - Sec;
222
      FoundationDuration := FoundationDuration - Sec;
213
      if FoundationDuration = ZeroHour then
223
      if FoundationDuration <= TenMins then
214
      begin
-
 
215
        FoundationTimeLabel.Color := clRed;
224
         FoundationTimeLabel.Color := clFuchsia
216
        FoundationPanel.Enabled := False;
-
 
217
      end
-
 
218
      else
225
      else
219
      begin
226
      begin
220
        if FoundationDuration <= TenMins then
-
 
221
           FoundationTimeLabel.Color := clFuchsia
-
 
222
        else
-
 
223
        begin
-
 
224
          if FoundationDuration <= FoundationHalfTime then
227
        if FoundationDuration <= FoundationHalfTime then
225
            FoundationTimeLabel.Color := clYellow;
228
        FoundationTimeLabel.Color := clYellow;
226
        end;
-
 
227
      end;
229
      end;
-
 
230
    end
-
 
231
    else
-
 
232
    begin
-
 
233
      FoundationDuration := ZeroHour;
228
      FoundationTimeLabel.Caption := TimeToStr(FoundationDuration);
234
      FoundationTimeLabel.Color := clRed;
-
 
235
      FoundationPanel.Enabled := False;
229
    end;
236
    end;
-
 
237
    FoundationTimeLabel.Caption := TimeToStr(FoundationDuration);
-
 
238
    { update the Intermediate display }
230
    if IntermediatePanel.Enabled then
239
    if IntermediateDuration > ZeroHour then
231
    begin
240
    begin
232
      IntermediateDuration := IntermediateDuration - Sec;
241
      IntermediateDuration := IntermediateDuration - Sec;
233
      if IntermediateDuration = ZeroHour then
242
      if IntermediateDuration <= TenMins then
234
      begin
-
 
235
        IntermediateTimeLabel.Color := clRed;
243
         IntermediateTimeLabel.Color := clFuchsia
236
        IntermediatePanel.Enabled := False;
-
 
237
      end
-
 
238
      else
244
      else
239
      begin
245
      begin
240
        if IntermediateDuration <= TenMins then
-
 
241
           IntermediateTimeLabel.Color := clFuchsia
-
 
242
        else
-
 
243
        begin
-
 
244
          if IntermediateDuration <= IntermediateHalfTime then
246
        if IntermediateDuration <= IntermediateHalfTime then
245
            IntermediateTimeLabel.Color := clYellow;
247
        IntermediateTimeLabel.Color := clYellow;
246
        end;
-
 
247
      end;
248
      end;
-
 
249
    end
-
 
250
    else
-
 
251
    begin
-
 
252
      IntermediateDuration := ZeroHour;
248
      IntermediateTimeLabel.Caption := TimeToStr(IntermediateDuration);
253
      IntermediateTimeLabel.Color := clRed;
-
 
254
      IntermediatePanel.Enabled := False;
249
    end;
255
    end;
-
 
256
    IntermediateTimeLabel.Caption := TimeToStr(IntermediateDuration);
-
 
257
    { update the Advanced display }
250
    if AdvancedPanel.Enabled then
258
    if AdvancedDuration > ZeroHour then
251
    begin
259
    begin
252
      AdvancedDuration := AdvancedDuration -Sec;
260
      AdvancedDuration := AdvancedDuration - Sec;
253
      if AdvancedDuration = ZeroHour then
261
      if AdvancedDuration <= TenMins then
254
      begin
-
 
255
        AdvancedTimeLabel.Color := clRed;
262
         AdvancedTimeLabel.Color := clFuchsia
256
        AdvancedPanel.Enabled := False;
-
 
257
      end
-
 
258
      else
263
      else
259
      begin
264
      begin
260
        if AdvancedDuration <= TenMins then
-
 
261
           AdvancedTimeLabel.Color := clFuchsia
-
 
262
        else
-
 
263
        begin
-
 
264
          if AdvancedDuration <= AdvancedHalfTime then
265
        if AdvancedDuration <= AdvancedHalfTime then
265
            AdvancedTimeLabel.Color := clYellow;
266
        AdvancedTimeLabel.Color := clYellow;
266
        end;
-
 
267
      end;
267
      end;
-
 
268
    end
-
 
269
    else
-
 
270
    begin
-
 
271
      AdvancedDuration := ZeroHour;
268
      AdvancedTimeLabel.Caption := TimeToStr(AdvancedDuration);
272
      AdvancedTimeLabel.Color := clRed;
-
 
273
      AdvancedPanel.Enabled := False;
269
    end;
274
    end;
-
 
275
    AdvancedTimeLabel.Caption := TimeToStr(AdvancedDuration);
270
  end;
276
  end;
271
  Label1.Caption := 'Time Now:';
277
  Label1.Caption := 'Time Now:';
272
  FoundationLabel.Caption := FoundationCaption;
278
  FoundationLabel.Caption := FoundationCaption;
273
  IntermediateLabel.Caption := IntermediateCaption;
279
  IntermediateLabel.Caption := IntermediateCaption;
274
  AdvancedLabel.Caption := AdvancedCaption;
280
  AdvancedLabel.Caption := AdvancedCaption;