VERSION 5.00
Begin VB.Form Form1 
   AutoRedraw      =   -1  'True
   Caption         =   "Timekeeper coded by Tad.Nakatsuka"
   ClientHeight    =   5016
   ClientLeft      =   48
   ClientTop       =   336
   ClientWidth     =   7104
   BeginProperty Font 
      Name            =   "Century"
      Size            =   9
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   ForeColor       =   &H80000014&
   LinkTopic       =   "Form1"
   ScaleHeight     =   5016
   ScaleMode       =   0  'User
   ScaleWidth      =   7104
   StartUpPosition =   3  'Windows default
   Begin VB.Frame Frame3 
      Height          =   1080
      Left            =   90
      TabIndex        =   28
      Top             =   5400
      Width           =   4440
      Begin VB.OptionButton RBmode 
         Caption         =   "Mode-B (Disp. Time to 3rd bell)"
         Height          =   240
         Index           =   1
         Left            =   120
         TabIndex        =   30
         Top             =   720
         Width           =   4200
      End
      Begin VB.OptionButton RBmode 
         Caption         =   "Mode-A (Disp. Time to 2nd bell until 2nd bell)"
         Height          =   240
         Index           =   0
         Left            =   120
         TabIndex        =   29
         Top             =   480
         Value           =   -1  'True
         Width           =   4200
      End
      Begin VB.Label Label8 
         Caption         =   "(Applied from Next)"
         Height          =   240
         Left            =   120
         TabIndex        =   31
         Top             =   240
         Width           =   1800
      End
   End
   Begin VB.Frame Frame2 
      Height          =   1080
      Left            =   3810
      TabIndex        =   21
      Top             =   3840
      Width           =   2200
      Begin VB.CommandButton CBpfwd 
         Caption         =   "=> "
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   13.8
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   360
         Left            =   1650
         TabIndex        =   25
         Top             =   540
         Width           =   480
      End
      Begin VB.CommandButton CBpback 
         Caption         =   "<="
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   13.8
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   360
         Left            =   1170
         TabIndex        =   24
         Top             =   540
         Width           =   480
      End
      Begin VB.CommandButton CBpause 
         Caption         =   "Pause"
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Century"
            Size            =   10.2
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   480
         Left            =   60
         TabIndex        =   22
         Top             =   360
         Width           =   1080
      End
      Begin VB.Label Label4 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "correct"
         BeginProperty Font 
            Name            =   "Century"
            Size            =   10.2
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Left            =   1170
         TabIndex        =   23
         Top             =   240
         Visible         =   0   'False
         Width           =   960
      End
   End
   Begin VB.Frame Frame1 
      Height          =   1260
      Left            =   90
      TabIndex        =   7
      Top             =   3840
      Width           =   3720
      Begin VB.CommandButton CBdec5 
         Caption         =   "-5"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   10.2
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Left            =   684
         TabIndex        =   33
         Top             =   960
         Width           =   396
      End
      Begin VB.CommandButton CBdec3 
         Caption         =   "-"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   252
         Left            =   3000
         TabIndex        =   19
         Top             =   720
         Width           =   252
      End
      Begin VB.CommandButton CBinc3 
         Caption         =   "+"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   252
         Left            =   3000
         TabIndex        =   18
         Top             =   480
         Width           =   252
      End
      Begin VB.TextBox TBmint3 
         Alignment       =   1  'Right
         BeginProperty DataFormat 
            Type            =   0
            Format          =   "0"
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1041
            SubFormatType   =   0
         EndProperty
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   10.2
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   264
         Left            =   2640
         Locked          =   -1  'True
         TabIndex        =   17
         TabStop         =   0   'False
         Text            =   "5"
         Top             =   600
         Width           =   372
      End
      Begin VB.CommandButton CBdec2 
         Caption         =   "-"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   252
         Left            =   1920
         TabIndex        =   15
         Top             =   720
         Width           =   252
      End
      Begin VB.CommandButton CBinc2 
         Caption         =   "+"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   252
         Left            =   1920
         TabIndex        =   14
         Top             =   480
         Width           =   252
      End
      Begin VB.TextBox TBmint2 
         Alignment       =   1  'Right
         BeginProperty DataFormat 
            Type            =   0
            Format          =   "0"
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1041
            SubFormatType   =   0
         EndProperty
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   10.2
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   264
         Left            =   1560
         Locked          =   -1  'True
         TabIndex        =   13
         TabStop         =   0   'False
         Text            =   "5"
         Top             =   600
         Width           =   372
      End
      Begin VB.CommandButton CBdec1 
         Caption         =   "-"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   10.2
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Left            =   840
         TabIndex        =   11
         Top             =   720
         Width           =   240
      End
      Begin VB.CommandButton CBinc1 
         Caption         =   "+"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   10.2
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Left            =   840
         TabIndex        =   10
         Top             =   480
         Width           =   240
      End
      Begin VB.TextBox TBmint1 
         Alignment       =   1  'Right
         BeginProperty DataFormat 
            Type            =   0
            Format          =   "0"
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1041
            SubFormatType   =   0
         EndProperty
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   10.2
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   264
         Left            =   480
         Locked          =   -1  'True
         TabIndex        =   9
         TabStop         =   0   'False
         Text            =   "10"
         Top             =   600
         Width           =   372
      End
      Begin VB.CommandButton CBinc5 
         Caption         =   "+5"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   10.2
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Left            =   684
         TabIndex        =   32
         Top             =   240
         Width           =   396
      End
      Begin VB.Line Line8 
         BorderWidth     =   2
         X1              =   3360
         X2              =   3480
         Y1              =   720
         Y2              =   720
      End
      Begin VB.Line Line7 
         BorderWidth     =   2
         X1              =   3480
         X2              =   3480
         Y1              =   360
         Y2              =   720
      End
      Begin VB.Line Line6 
         BorderWidth     =   2
         X1              =   2280
         X2              =   2520
         Y1              =   720
         Y2              =   720
      End
      Begin VB.Line Line4 
         BorderWidth     =   2
         X1              =   1200
         X2              =   1440
         Y1              =   720
         Y2              =   720
      End
      Begin VB.Line Line5 
         BorderWidth     =   2
         X1              =   2400
         X2              =   2400
         Y1              =   360
         Y2              =   720
      End
      Begin VB.Line Line3 
         BorderWidth     =   2
         X1              =   1320
         X2              =   1320
         Y1              =   360
         Y2              =   720
      End
      Begin VB.Line Line2 
         BorderWidth     =   2
         X1              =   240
         X2              =   360
         Y1              =   720
         Y2              =   720
      End
      Begin VB.Line Line1 
         BorderWidth     =   2
         X1              =   240
         X2              =   240
         Y1              =   360
         Y2              =   720
      End
      Begin VB.Label Label3 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "<3>"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   252
         Left            =   3240
         TabIndex        =   20
         Top             =   120
         Width           =   492
      End
      Begin VB.Label Label2 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "<2>"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   252
         Left            =   2160
         TabIndex        =   16
         Top             =   120
         Width           =   492
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "<1>"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   252
         Left            =   1080
         TabIndex        =   12
         Top             =   120
         Width           =   492
      End
      Begin VB.Label Label0 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "<S>"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   252
         Left            =   0
         TabIndex        =   8
         Top             =   120
         Width           =   492
      End
   End
   Begin VB.Timer Timer 
      Interval        =   50
      Left            =   0
      Top             =   0
   End
   Begin VB.CommandButton CBstend 
      Caption         =   "Start"
      BeginProperty Font 
         Name            =   "Century"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   450
      Left            =   6120
      TabIndex        =   2
      Top             =   4230
      Width           =   900
   End
   Begin VB.Label Version 
      Caption         =   "Ver.2006-02"
      BeginProperty Font 
         Name            =   "Century"
         Size            =   10.2
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   5970
      TabIndex        =   35
      Top             =   5040
      Width           =   1212
   End
   Begin VB.Label Label5 
      Alignment       =   2  'Center
      Caption         =   "00:00:00"
      BeginProperty Font 
         Name            =   "Courier New"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   5970
      TabIndex        =   34
      Top             =   4770
      Width           =   1200
   End
   Begin VB.Label LabelOver 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "OVER"
      BeginProperty Font 
         Name            =   "Arial Black"
         Size            =   45
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1530
      Left            =   1620
      TabIndex        =   5
      Top             =   -45
      Width           =   3870
   End
   Begin VB.Shape ProgBar 
      BackColor       =   &H000000FF&
      BackStyle       =   1  'Opaque
      Height          =   900
      Left            =   180
      Top             =   135
      Width           =   1800
   End
   Begin VB.Label LabelPause 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "pause"
      BeginProperty Font 
         Name            =   "Arial Black"
         Size            =   45
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000014&
      Height          =   1350
      Left            =   1800
      TabIndex        =   6
      Top             =   2115
      Visible         =   0   'False
      Width           =   4050
   End
   Begin VB.Label LabelDot 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "."
      BeginProperty Font 
         Name            =   "Century"
         Size            =   150
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   3420
      Left            =   3150
      TabIndex        =   3
      Top             =   720
      Width           =   1440
   End
   Begin VB.Label Dseconds 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "00"
      BeginProperty Font 
         Name            =   "Century Gothic"
         Size            =   120
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2880
      Left            =   4230
      TabIndex        =   1
      Top             =   1305
      Width           =   2610
   End
   Begin VB.Label Dminutes 
      Alignment       =   1  'Right
      BackStyle       =   0  'Transparent
      Caption         =   "00"
      BeginProperty Font 
         Name            =   "Century Gothic"
         Size            =   150
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   3420
      Left            =   90
      TabIndex        =   0
      Top             =   720
      Width           =   3420
   End
   Begin VB.Label Lbackground 
      Appearance      =   0  'Flat
      BackColor       =   &H00FFFF00&
      ForeColor       =   &H80000008&
      Height          =   2880
      Left            =   90
      TabIndex        =   4
      Top             =   1125
      Width           =   6930
   End
   Begin VB.Label ProgBack 
      BackColor       =   &H00FF0000&
      Height          =   900
      Left            =   180
      TabIndex        =   27
      Top             =   135
      Width           =   6750
   End
   Begin VB.Label ProgFrame 
      BackColor       =   &H00006000&
      Height          =   1080
      Left            =   90
      TabIndex        =   26
      Top             =   45
      Width           =   6930
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'
'   Timekeeper coded by Tad.Nakatsuka
'                       Last updated  2006-02-15 (Ver.2006-02)
'
Option Explicit
Private mode   As Integer, nmode  As Integer, ntmin  As Integer
Private mint1  As Integer, mint2  As Integer, mint3  As Integer
Private nsec   As Integer, nmin   As Integer, nmins  As Integer
Private nmin1  As Integer, nmin2  As Integer, nmin3  As Integer
Private kstart As Integer, kpause As Integer, nbeep  As Integer
Private lwide  As Integer, lhigh  As Integer, lsize  As Integer
Private np     As Integer, npb    As Integer
Private stm As String, rtm As String

Private Sub CBdec5_Click()
  mint1 = mint1 - 5
  If mint1 < 5 Then mint1 = 5
  TBmint1.Text = Right(Str(mint1), 2)
  If kstart = 0 Then Call Form_Load
End Sub

Private Sub CBdec1_Click()
  mint1 = mint1 - 1
  If mint1 < 5 Then mint1 = 5
  TBmint1.Text = Right(Str(mint1), 2)
  If kstart = 0 Then Call Form_Load
End Sub

Private Sub CBdec2_Click()
  mint2 = mint2 - 1
  If mint2 < 1 Then mint2 = 1
  TBmint2.Text = Right(Str(mint2), 2)
  If kstart = 0 Then Call Form_Load
End Sub

Private Sub CBdec3_Click()
  mint3 = mint3 - 1
  If mint3 < 1 Then mint3 = 1
  TBmint3.Text = Right(Str(mint3), 2)
  If kstart = 0 Then Call Form_Load
End Sub

Private Sub CBinc5_Click()
  mint1 = mint1 + 5
  If mint1 > 90 Then mint1 = 90
  TBmint1.Text = Right(Str(mint1), 2)
  If kstart = 0 Then Call Form_Load
End Sub

Private Sub CBinc1_Click()
  mint1 = mint1 + 1
  If mint1 > 90 Then mint1 = 90
  TBmint1.Text = Right(Str(mint1), 2)
  If kstart = 0 Then Call Form_Load
End Sub

Private Sub CBinc2_Click()
  mint2 = mint2 + 1
  If mint2 > 30 Then mint2 = 30
  TBmint2.Text = Right(Str(mint2), 2)
  If kstart = 0 Then Call Form_Load
End Sub

Private Sub CBinc3_Click()
  mint3 = mint3 + 1
  If mint3 > 30 Then mint3 = 30
  TBmint3.Text = Right(Str(mint3), 2)
  If kstart = 0 Then Call Form_Load
End Sub

Private Sub CBpause_Click()
  If kstart > 0 Then
    If kpause = 0 Then
      kpause = 1
      CBpause.Caption = "Resume"
      CBpback.Enabled = True
      CBpfwd.Enabled = True
      Label4.Visible = True
      LabelPause.Visible = True
      nbeep = 0
    Else
      kpause = 0
      CBpause.Caption = "Pause"
      CBpback.Enabled = False
      CBpfwd.Enabled = False
      Label4.Visible = False
      LabelPause.Visible = False
    End If
  End If
End Sub

Private Sub CBpback_Click()
  If kpause = 1 Then
    If kstart = 1 Then
      If nsec >= 50 Then
        nmin = nmin + 1: nmins = nmins + 1: nsec = 0
        If nmin = nmin2 Then
          Lbackground.BackColor = RGB(0, 255, 255)       'Aqua'
        ElseIf nmin = nmin3 Then
          Lbackground.BackColor = RGB(127, 255, 127)     'YellowGreen'
          If nmode = 0 Then nmins = 0
        End If
        Dminutes.Caption = Right(Str(nmins), 2)
        Dseconds.Caption = Right(Str(nsec + 100), 2)
      Else
        If nmin < nmin1 Then
          nsec = (nsec \ 10) * 10 + 10
          Dseconds.Caption = Right(Str(nsec + 100), 2)
        End If
      End If
      np = ((ntmin - nmin) * 150 - (nsec * 5 \ 2)) \ ntmin
      If np <> npb Then
        ProgBar.Width = lsize * 3 * np: npb = np
      End If
    ElseIf kstart = 2 Then
      If nsec = 0 Then
        If nmin = 0 Then
          kstart = 1
          ProgBar.Width = lsize * 3 * 150: npb = 150
          ProgFrame.Visible = True
          ProgBack.Visible = True
          ProgBar.Visible = True
          LabelOver.Visible = False
          Lbackground.BackStyle = 1
          Lbackground.BackColor = RGB(255, 255, 0)       'Yellow'
          Form1.BackColor = &H8000000F
        Else
          nmin = nmin - 1: nsec = 50
          Dminutes.Caption = Right(Str(nmin), 2)
          Dseconds.Caption = Right(Str(nsec + 100), 2)
        End If
      Else
        If (nsec Mod 10) = 0 Then
          nsec = nsec - 10
        Else
          nsec = (nsec \ 10) * 10
        End If
        Dseconds.Caption = Right(Str(nsec + 100), 2)
      End If
    End If
  End If
End Sub

Private Sub CBpfwd_Click()
  If kpause = 1 Then
    If kstart = 1 Then
      If nsec = 0 Then
        If nmin = nmin2 Then
          Lbackground.BackColor = RGB(127, 255, 127)     'YellowGreen'
        ElseIf nmin = nmin3 Then
          Lbackground.BackColor = RGB(255, 255, 0)       'Yellow'
          nmins = nmin
        End If
        If nmin = 0 Then
          kstart = 2
          Form1.BackColor = RGB(255, 0, 0)               'Red'
          Lbackground.BackStyle = 0
          LabelOver.Visible = True
          ProgBar.Visible = False
          ProgBack.Visible = False
          ProgFrame.Visible = False
        Else
          nmin = nmin - 1: nmins = nmins - 1: nsec = 50
          Dminutes.Caption = Right(Str(nmins), 2)
          Dseconds.Caption = Right(Str(nsec + 100), 2)
        End If
      Else
        If (nsec Mod 10) = 0 Then
          nsec = nsec - 10
        Else
          nsec = (nsec \ 10) * 10
        End If
        Dseconds.Caption = Right(Str(nsec + 100), 2)
      End If
      np = ((ntmin - nmin) * 150 - (nsec * 5 \ 2)) \ ntmin
      If np <> npb Then
        ProgBar.Width = lsize * 3 * np: npb = np
      End If
    ElseIf kstart = 2 Then
      If nmin < 100 Then
        nsec = (nsec \ 10) * 10 + 10
        If nsec = 60 Then
          nmin = nmin + 1: nsec = 0
          If nmin < 100 Then
            Dminutes.Caption = Right(Str(nmin), 2)
            Dseconds.Caption = "00"
          Else
            Dseconds.Caption = "99"
          End If
        Else
          Dseconds.Caption = Right(Str(nsec + 100), 2)
        End If
      End If
    End If
  End If
End Sub

Private Sub CBstend_Click()
  If kstart = 0 Then
    kstart = 1
    CBstend.Caption = " End "
    CBpause.Enabled = True
    nbeep = 0
  Else
    Call Form_Load
  End If
End Sub

Private Sub Form_Initialize()
  mode = 0: mint1 = 10: mint2 = 5: mint3 = 5: nbeep = 0
  rtm = "00:00:00"
  CBstend.Enabled = True
End Sub

Private Sub Form_Load()
  nmin1 = mint1 + mint2 + mint3: nmin2 = mint2 + mint3: nmin3 = mint3
  ntmin = nmin1: nmin = nmin1: nsec = 0: npb = 0: nmode = mode
  If nmode = 0 Then nmins = mint1 + mint2 Else nmins = nmin
  kstart = 0: kpause = 0
  Dminutes.Caption = Right(Str(nmins), 2)
  Dseconds.Caption = Right(Str(nsec + 100), 2)
  CBstend.Caption = "Start"
  CBpause.Caption = "Pause"
  CBpause.Enabled = False
  CBpback.Enabled = False
  CBpfwd.Enabled = False
  Label4.Visible = False
  Lbackground.BackStyle = 1
  Lbackground.BackColor = RGB(0, 255, 255)               'Aqua'
  LabelPause.Visible = False
  LabelOver.Visible = False
  ProgBar.Width = 0
  ProgFrame.Visible = True
  ProgBack.Visible = True
  ProgBar.Visible = True
  Form1.BackColor = &H8000000F
End Sub

Private Sub Form_Resize()
  lwide = Form1.Width
  lhigh = Form1.Height
  If lwide < 9500 Then
    lsize = 15
  ElseIf lwide < 11900 Then
    lsize = 20
  ElseIf lwide < 15200 Then
    lsize = 25
  ElseIf lwide < 19000 Then
    lsize = 32
  Else
    lsize = 40
  End If
  ProgFrame.Left = lsize * 6: ProgFrame.Width = lsize * 462
  ProgFrame.Top = lsize * 3: ProgFrame.Height = lsize * 72
  ProgBack.Left = lsize * 12: ProgBack.Width = lsize * 450
  ProgBack.Top = lsize * 9: ProgBack.Height = lsize * 60
  ProgBar.Left = lsize * 12: ProgBar.Width = lsize * 3 * npb
  ProgBar.Top = lsize * 9: ProgBar.Height = lsize * 60
  LabelOver.Left = lsize * 108: LabelOver.Width = lsize * 258
  LabelOver.Top = lsize * (-3): LabelOver.Height = lsize * 102
  LabelOver.Font.Size = lsize * 3
  Lbackground.Left = lsize * 6: Lbackground.Width = lsize * 462
  Lbackground.Top = lsize * 75: Lbackground.Height = lsize * 192
  LabelPause.Left = lsize * 120: LabelPause.Width = lsize * 270
  LabelPause.Top = lsize * 141: LabelPause.Height = lsize * 90
  LabelPause.Font.Size = lsize * 3
  LabelDot.Left = lsize * 210: LabelDot.Width = lsize * 96
  LabelDot.Top = lsize * 48: LabelDot.Height = lsize * 228
  LabelDot.Font.Size = lsize * 10
  Dminutes.Left = lsize * 6: Dminutes.Width = lsize * 228
  Dminutes.Top = lsize * 48: Dminutes.Height = lsize * 228
  Dminutes.Font.Size = lsize * 10
  Dseconds.Left = lsize * 282: Dseconds.Width = lsize * 174
  Dseconds.Top = lsize * 87: Dseconds.Height = lsize * 192
  Dseconds.Font.Size = lsize * 8
  Frame1.Left = lsize * 6: Frame1.Top = lsize * 300 - 660
  Frame2.Left = lsize * 254: Frame2.Top = lsize * 300 - 660
  CBstend.Left = lsize * 408: CBstend.Width = lsize * 60
  CBstend.Top = lsize * 282: CBstend.Height = lsize * 30
  Label5.Left = lsize * 438 - 600: Label5.Top = lsize * 318
  Version.Left = lsize * 438 - 600: Version.Top = lsize * 336
  Frame3.Left = lsize * 6: Frame3.Top = lsize * 360
End Sub

Private Sub RBmode_Click(Index As Integer)
  mode = Index
  If kstart = 0 Then Call Form_Load
End Sub

Private Sub Timer_Timer()
  If kpause = 1 Or kstart = 0 Then
    rtm = Time: Label5.Caption = rtm
  Else
    stm = Time
    If stm <> rtm Then
      rtm = stm: Label5.Caption = rtm
      If kstart = 1 Then
        If nsec = 0 Then
          If nmin = 0 Then
            kstart = 2: nbeep = 3
            Form1.BackColor = RGB(255, 0, 0)             'Red'
            Lbackground.BackStyle = 0
            LabelOver.Visible = True
            ProgBar.Visible = False
            ProgBack.Visible = False
            ProgFrame.Visible = False
          Else
            If nmin = nmin2 Then
              nbeep = 1
              Lbackground.BackColor = RGB(127, 255, 127) 'YellowGreen'
            ElseIf nmin = nmin3 Then
              nmins = nmin: nbeep = 2
              Lbackground.BackColor = RGB(255, 255, 0)   'Yellow'
            End If
            nsec = 59: nmin = nmin - 1: nmins = nmins - 1
            Dminutes.Caption = Right(Str(nmins), 2)
            Dseconds.Caption = Right(Str(nsec + 100), 2)
          End If
        Else
          nsec = nsec - 1
          Dseconds.Caption = Right(Str(nsec + 100), 2)
        End If
        np = ((ntmin - nmin) * 150 - (nsec * 5 \ 2)) \ ntmin
        If np <> npb Then
          ProgBar.Width = lsize * 3 * np: npb = np
        End If
      Else
        If nmin < 100 Then
          nsec = nsec + 1
          If nsec = 60 Then
            nmin = nmin + 1: nsec = 0
            If nmin < 100 Then
              Dminutes.Caption = Right(Str(nmin), 2)
              Dseconds.Caption = "00"
            Else
              Dseconds.Caption = "99"
            End If
          Else
            Dseconds.Caption = Right(Str(nsec + 100), 2)
          End If
        End If
      End If
      If nbeep > 0 Then
        nbeep = nbeep - 1: Beep
      End If
    End If
  End If
End Sub