BDG Scenario 3

Settings (Form7.frm)

VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form Settings 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Conversion Options"
   ClientHeight    =   5055
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4695
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5339.157
   ScaleMode       =   0  'User
   ScaleWidth      =   4695
   StartUpPosition =   3  'Windows Default
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   600
      Top             =   4560
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   16711680
      UseMaskColor    =   0   'False
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   4
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form7.frx":0000
            Key             =   "econvert"
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form7.frx":0452
            Key             =   "dconvert"
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form7.frx":08A4
            Key             =   "ebuild"
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form7.frx":0CF6
            Key             =   "dbuild"
         EndProperty
      EndProperty
   End
   Begin VB.Frame Frame1 
      BorderStyle     =   0  'None
      Caption         =   "Frame1"
      Height          =   3855
      Index           =   4
      Left            =   240
      TabIndex        =   30
      Top             =   480
      Visible         =   0   'False
      Width           =   4215
      Begin VB.CheckBox Check5 
         Caption         =   "Enabled"
         Height          =   255
         Left            =   120
         TabIndex        =   48
         Top             =   3480
         Value           =   1  'Checked
         Width           =   1695
      End
      Begin VB.CommandButton Command11 
         Caption         =   "Browse..."
         Height          =   255
         Left            =   3240
         TabIndex        =   34
         Top             =   1920
         Width           =   855
      End
      Begin VB.TextBox Text8 
         Height          =   285
         Left            =   120
         TabIndex        =   33
         Top             =   1920
         Width           =   3015
      End
      Begin MSComctlLib.ListView ListView4 
         Height          =   855
         Left            =   120
         TabIndex        =   43
         TabStop         =   0   'False
         Top             =   120
         Width           =   3975
         _ExtentX        =   7011
         _ExtentY        =   1508
         View            =   3
         LabelEdit       =   1
         Sorted          =   -1  'True
         MultiSelect     =   -1  'True
         LabelWrap       =   -1  'True
         HideSelection   =   -1  'True
         FullRowSelect   =   -1  'True
         _Version        =   393217
         SmallIcons      =   "ImageList1"
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   1
         NumItems        =   4
         BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
            Text            =   "Project Name"
            Object.Width           =   2540
         EndProperty
         BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
            SubItemIndex    =   1
            Text            =   "Source Directory"
            Object.Width           =   2540
         EndProperty
         BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
            SubItemIndex    =   2
            Text            =   "Destination Directory"
            Object.Width           =   2540
         EndProperty
         BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
            SubItemIndex    =   3
            Text            =   "Path to Lingo File"
            Object.Width           =   2540
         EndProperty
      End
      Begin VB.TextBox Text6 
         Height          =   285
         Left            =   120
         TabIndex        =   35
         Top             =   2520
         Width           =   3015
      End
      Begin VB.CommandButton Command8 
         Caption         =   "Browse..."
         Height          =   255
         Left            =   3240
         TabIndex        =   36
         Top             =   2520
         Width           =   855
      End
      Begin VB.TextBox Text7 
         Height          =   285
         Left            =   120
         TabIndex        =   32
         Top             =   1320
         Width           =   2775
      End
      Begin VB.TextBox Text5 
         Height          =   285
         Left            =   120
         TabIndex        =   37
         Top             =   3120
         Width           =   3015
      End
      Begin VB.CommandButton Command10 
         Caption         =   "&Add Project"
         Height          =   255
         Left            =   3000
         TabIndex        =   41
         Top             =   1320
         Width           =   1095
      End
      Begin VB.CommandButton Command9 
         Caption         =   "Browse..."
         Height          =   255
         Left            =   3240
         TabIndex        =   39
         Top             =   3120
         Width           =   855
      End
      Begin VB.CommandButton Command7 
         Caption         =   "&Build Selected Projects"
         Height          =   375
         Left            =   2160
         TabIndex        =   31
         Top             =   3480
         Width           =   2055
      End
      Begin VB.Label Label9 
         Caption         =   "&Source Directory"
         Height          =   255
         Left            =   120
         TabIndex        =   44
         Top             =   1680
         Width           =   3975
      End
      Begin VB.Label Label8 
         Caption         =   "Project &Name"
         Height          =   255
         Left            =   120
         TabIndex        =   42
         Top             =   1080
         Width           =   3975
      End
      Begin VB.Label Label7 
         Caption         =   "&Path to Lingo File"
         Height          =   255
         Left            =   120
         TabIndex        =   40
         Top             =   2880
         Width           =   3975
      End
      Begin VB.Label Label6 
         Caption         =   "&Destination Directory"
         Height          =   255
         Left            =   120
         TabIndex        =   38
         Top             =   2280
         Width           =   3975
      End
   End
   Begin MSComDlg.CommonDialog Dialogs1 
      Left            =   120
      Top             =   4560
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.Frame Frame1 
      BorderStyle     =   0  'None
      Caption         =   "Frame1"
      Height          =   3855
      Index           =   3
      Left            =   240
      TabIndex        =   19
      Top             =   480
      Visible         =   0   'False
      Width           =   4215
      Begin VB.CheckBox Check6 
         Caption         =   "A&ssign random ID value to localizable tags"
         Height          =   255
         Left            =   120
         TabIndex        =   45
         Top             =   3120
         Width           =   3975
      End
      Begin VB.CheckBox Check4 
         Caption         =   "&Strip lingo text and attributes from HTML/XML"
         Height          =   255
         Left            =   120
         TabIndex        =   29
         Top             =   3360
         Width           =   3975
      End
      Begin VB.CommandButton Command6 
         Caption         =   "Browse..."
         Height          =   255
         Left            =   3240
         TabIndex        =   23
         Top             =   2640
         Width           =   855
      End
      Begin VB.TextBox Text4 
         Height          =   285
         Left            =   960
         TabIndex        =   22
         Top             =   2640
         Width           =   2175
      End
      Begin VB.TextBox Text3 
         Height          =   285
         Left            =   840
         TabIndex        =   20
         Top             =   2160
         Width           =   1695
      End
      Begin VB.CommandButton Command5 
         Caption         =   "&Add Attribute"
         Height          =   255
         Left            =   2640
         TabIndex        =   21
         Top             =   2160
         Width           =   1455
      End
      Begin VB.CheckBox Check3 
         Caption         =   "Sa&ve localizable text to Lingo file"
         Height          =   255
         Left            =   120
         TabIndex        =   24
         Top             =   3600
         Value           =   1  'Checked
         Width           =   3975
      End
      Begin MSComctlLib.ListView ListView3 
         Height          =   1935
         Left            =   120
         TabIndex        =   26
         Top             =   120
         Width           =   3975
         _ExtentX        =   7011
         _ExtentY        =   3413
         View            =   2
         Sorted          =   -1  'True
         LabelWrap       =   -1  'True
         HideSelection   =   -1  'True
         _Version        =   393217
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   1
         NumItems        =   1
         BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
            Text            =   "Custom Attribute"
            Object.Width           =   2540
         EndProperty
      End
      Begin VB.Label Label4 
         Caption         =   "&Lingo File:"
         Height          =   255
         Left            =   120
         TabIndex        =   27
         Top             =   2640
         Width           =   855
      End
      Begin VB.Label Label3 
         Caption         =   "A&ttribute:"
         Height          =   255
         Left            =   120
         TabIndex        =   25
         Top             =   2160
         Width           =   615
      End
   End
   Begin VB.Frame Frame1 
      BorderStyle     =   0  'None
      Caption         =   "Frame1"
      Height          =   3855
      Index           =   2
      Left            =   240
      TabIndex        =   13
      Top             =   480
      Visible         =   0   'False
      Width           =   4215
      Begin VB.CheckBox Check2 
         Caption         =   "Always &close these tags when converting to XML"
         Height          =   375
         Left            =   120
         TabIndex        =   18
         Top             =   3480
         Value           =   1  'Checked
         Width           =   3855
      End
      Begin VB.CommandButton Command4 
         Caption         =   "&Add Tag"
         Height          =   255
         Left            =   2640
         TabIndex        =   15
         Top             =   3120
         Width           =   1455
      End
      Begin VB.TextBox Text2 
         Height          =   285
         Left            =   600
         TabIndex        =   14
         Top             =   3120
         Width           =   1815
      End
      Begin MSComctlLib.ListView ListView2 
         Height          =   2895
         Left            =   120
         TabIndex        =   16
         Top             =   120
         Width           =   3975
         _ExtentX        =   7011
         _ExtentY        =   5106
         View            =   2
         Sorted          =   -1  'True
         LabelWrap       =   -1  'True
         HideSelection   =   -1  'True
         _Version        =   393217
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   1
         NumItems        =   1
         BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
            Text            =   "Custom Attribute"
            Object.Width           =   2540
         EndProperty
      End
      Begin VB.Label Label1 
         Caption         =   "&Tag:"
         Height          =   255
         Left            =   120
         TabIndex        =   17
         Top             =   3120
         Width           =   615
      End
   End
   Begin VB.Frame Frame1 
      BorderStyle     =   0  'None
      Caption         =   "Frame1"
      Height          =   3855
      Index           =   1
      Left            =   240
      TabIndex        =   4
      Top             =   480
      Visible         =   0   'False
      Width           =   4215
      Begin VB.TextBox Text1 
         Height          =   285
         Left            =   840
         TabIndex        =   6
         Top             =   3240
         Width           =   1695
      End
      Begin VB.CommandButton Command1 
         Caption         =   "&Add Attribute"
         Height          =   255
         Left            =   2640
         TabIndex        =   7
         Top             =   3240
         Width           =   1455
      End
      Begin MSComctlLib.ListView ListView1 
         Height          =   3015
         Left            =   120
         TabIndex        =   5
         Top             =   120
         Width           =   3975
         _ExtentX        =   7011
         _ExtentY        =   5318
         View            =   2
         Sorted          =   -1  'True
         LabelWrap       =   -1  'True
         HideSelection   =   -1  'True
         _Version        =   393217
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   1
         NumItems        =   1
         BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
            Text            =   "Custom Attribute"
            Object.Width           =   2540
         EndProperty
      End
      Begin VB.Label Label5 
         Caption         =   "Note: Custom attributes are case-sensitive"
         Height          =   255
         Left            =   480
         TabIndex        =   28
         Top             =   3600
         Width           =   3135
      End
      Begin VB.Label Label2 
         Caption         =   "A&ttribute:"
         Height          =   255
         Left            =   120
         TabIndex        =   8
         Top             =   3240
         Width           =   735
      End
   End
   Begin VB.Frame Frame1 
      BorderStyle     =   0  'None
      Caption         =   "Frame1"
      Height          =   3855
      Index           =   0
      Left            =   240
      TabIndex        =   3
      Top             =   480
      Width           =   4215
      Begin VB.TextBox Text9 
         Height          =   285
         Left            =   2160
         TabIndex        =   47
         Text            =   "LID"
         Top             =   1920
         Width           =   975
      End
      Begin VB.CheckBox Check1 
         Caption         =   "Auto-&Complete URLs"
         Height          =   255
         Left            =   480
         TabIndex        =   12
         Top             =   1200
         Width           =   2175
      End
      Begin VB.Frame Frame4 
         Caption         =   "Convert to:"
         Height          =   615
         Left            =   240
         TabIndex        =   9
         Top             =   360
         Width           =   2415
         Begin VB.OptionButton Option1 
            Caption         =   "&HTML"
            Height          =   315
            Left            =   240
            TabIndex        =   11
            Top             =   240
            Value           =   -1  'True
            Width           =   975
         End
         Begin VB.OptionButton Option2 
            Caption         =   "&XML"
            Height          =   315
            Left            =   1320
            TabIndex        =   10
            Top             =   240
            Width           =   855
         End
      End
      Begin VB.Label Label10 
         Caption         =   "Localization ID attribute:"
         Height          =   255
         Left            =   240
         TabIndex        =   46
         Top             =   1920
         Width           =   1815
      End
   End
   Begin VB.CommandButton Command3 
      Caption         =   "OK"
      Default         =   -1  'True
      Height          =   375
      Left            =   2040
      TabIndex        =   0
      Top             =   4560
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Cancel"
      Height          =   375
      Left            =   3360
      TabIndex        =   1
      Top             =   4560
      Width           =   1215
   End
   Begin MSComctlLib.TabStrip TabStrip1 
      Height          =   4335
      Left            =   120
      TabIndex        =   2
      Top             =   120
      Width           =   4455
      _ExtentX        =   7858
      _ExtentY        =   7646
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   5
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "General"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab2 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "Custom Attributes"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab3 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "Always Close"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab4 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "Lingo"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab5 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "Build"
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin VB.Menu mnuProjPop 
      Caption         =   "ProjectPopup"
      Visible         =   0   'False
      Begin VB.Menu mnuProjPopEnable 
         Caption         =   "Enable"
      End
      Begin VB.Menu mnuProjPopDisable 
         Caption         =   "Disable"
      End
      Begin VB.Menu mnuProjPopDelete 
         Caption         =   "&Delete"
      End
   End
End
Attribute VB_Name = "Settings"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private m_lastSel As Integer

Private Sub Form_Load()
   Dim i As Long, item As MSComctlLib.ListItem, buildItem As BuildListItem
   
   m_lastSel = 0
   ListView4.SmallIcons = ImageList1
   
   Frame1(0).Visible = True
   Frame1(1).Visible = False
   Frame1(2).Visible = False
   Frame1(3).Visible = False
   Frame1(4).Visible = False

   For i = 1 To g_Options.CustomAttributeCount
      Set item = ListView1.ListItems.Add(, , g_Options.GetCustomAttribute(i))
   Next
   
   For i = 1 To g_Options.AlwaysCloseTagCount
      Set item = ListView2.ListItems.Add(, , g_Options.GetAlwaysCloseTag(i))
   Next
   
   For i = 1 To g_Options.LingoTagCount
      Set item = ListView3.ListItems.Add(, , g_Options.GetLingoTag(i))
   Next
   
   For i = 1 To g_Options.ProjectCount
      Set buildItem = g_Options.GetProject(i)
      Set item = ListView4.ListItems.Add(, , buildItem.name)
      item.SubItems(1) = buildItem.SourceDir
      item.SubItems(2) = buildItem.DestinationDir
      item.SubItems(3) = buildItem.LingoFile
      item.SmallIcon = buildItem.SmallIcon
      Set item.tag = buildItem
   Next
   
   Check1.value = IIf(g_Options.CompleteURL, vbChecked, vbUnchecked)
   Check2.value = IIf(g_Options.UseAlwaysTags, vbChecked, vbUnchecked)
   Check3.value = IIf(g_Options.UseLingoFile, vbChecked, vbUnchecked)
   Check4.value = IIf(g_Options.StripLingoText, vbChecked, vbUnchecked)
   Check6.value = IIf(g_Options.AssignLIDs, vbChecked, vbUnchecked)
   
   Text4.text = g_Options.LingoFilePath
   Text9.text = g_Options.LingoIDAttrib
   
   If g_Options.ConvertToXML Then
      Option2.value = True
   Else
      Option1.value = True
   End If
End Sub

Private Sub ListView4_Click()
   Dim item As MSComctlLib.ListItem, buildItem As BuildListItem
   Set item = ListView4.SelectedItem
   If Not item Is Nothing Then
      Set buildItem = item.tag
      Text7.text = buildItem.name
      Text8.text = buildItem.SourceDir
      Text6.text = buildItem.DestinationDir
      Text5.text = buildItem.LingoFile
      Check5.value = IIf(buildItem.Enabled, vbChecked, vbUnchecked)
   End If
End Sub

Private Sub ListView4_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
   Dim item As MSComctlLib.ListItem
   Dim mnuBold As Menu
   If Button = vbRightButton Then
      Set item = ListView4.SelectedItem
      If item.SmallIcon = "dbuild" Or item.SmallIcon = "dconvert" Then
         mnuProjPopEnable.Visible = True
         mnuProjPopDisable.Visible = False
         Set mnuBold = mnuProjPopEnable
      Else
         mnuProjPopEnable.Visible = False
         mnuProjPopDisable.Visible = True
         Set mnuBold = mnuProjPopDisable
      End If
      PopupMenu mnuProjPop, , , , mnuBold
   End If
End Sub

Private Sub ListView4_DblClick()
   Dim item As MSComctlLib.ListItem, buildItem As BuildListItem
   Set item = ListView4.SelectedItem
   If item.SmallIcon = "ebuild" Or item.SmallIcon = "econvert" Then
      Call mnuProjPopDisable_Click
      Check5.value = vbUnchecked
   Else
      Call mnuProjPopEnable_Click
      Check5.value = vbChecked
   End If
End Sub

Private Sub mnuProjPopDelete_Click()
   Dim item As MSComctlLib.ListItem
   Dim buildItem As BuildListItem
   Set item = ListView4.SelectedItem
   Set buildItem = item.tag
   If buildItem.ProjectType <> prjConvert Then
      If vbYes = MsgBox("Permanently delete this project?", vbQuestion + vbYesNo, "Confirm Delete") Then
         ListView4.ListItems.Remove item.Index
      End If
   Else
      MsgBox "You cannot delete the conversion project. It has been disabled."
      mnuProjPopDisable_Click
   End If
End Sub

Private Sub mnuProjPopDisable_Click()
   Dim item As MSComctlLib.ListItem, buildItem As BuildListItem
   Set item = ListView4.SelectedItem
   Set buildItem = item.tag
   buildItem.Enabled = False
   item.SmallIcon = buildItem.SmallIcon
End Sub

Private Sub mnuProjPopEnable_Click()
   Dim item As MSComctlLib.ListItem, buildItem As BuildListItem
   Set item = ListView4.SelectedItem
   Set buildItem = item.tag
   buildItem.Enabled = True
   item.SmallIcon = buildItem.SmallIcon
End Sub

Private Sub TabStrip1_Click()
   Dim idx&
   idx& = TabStrip1.SelectedItem.Index - 1
   If idx <> m_lastSel Then
       Frame1(m_lastSel).Visible = False
       Frame1(idx).Visible = True
       m_lastSel = idx
   End If
End Sub

Private Sub TabStrip1_KeyPress(KeyAscii As Integer)
   If KeyAscii = 27 Then Call Command2_Click   ' ESC closes
End Sub

' Add Custom Attribute (any combination of upper/lower case)
Private Sub Command1_Click()
   Dim item As MSComctlLib.ListItem, bFound As Boolean
   
   Text1.text = Trim(Text1.text)
   If Text1.text <> "" Then
      Set item = ListView1.FindItem(Text1.text)
      Do Until item Is Nothing
         ' look for exact match (including case)
         If item.text = Text1.text Then
            bFound = True
            Exit Do
         End If
         ' look again until list is exhausted
         If item.Index < ListView1.ListItems.Count Then
            Set item = ListView1.FindItem(Text1.text, , item.Index + 1)
         Else
            Set item = Nothing
         End If
      Loop
      If Not bFound Then Call ListView1.ListItems.Add(, , Text1.text)
      Text1.SetFocus
      Text1.SelStart = 0
      Text1.SelLength = Len(Text1.text)
   End If
End Sub

' Cancel
Private Sub Command2_Click()
   Unload Me
End Sub

' OK -- save settings to g_Options
Private Sub Command3_Click()
   Dim item As MSComctlLib.ListItem
   
   g_Options.RemoveCustomAttributes
   For Each item In ListView1.ListItems
      g_Options.AddCustomAttribute item.text
   Next
   
   g_Options.RemoveAlwaysCloseTags
   For Each item In ListView2.ListItems
      g_Options.AddAlwaysCloseTag item.text
   Next
   
   g_Options.RemoveLingoTags
   For Each item In ListView3.ListItems
      g_Options.AddLingoTag item.text
   Next
   
   g_Options.RemoveProjects
   For Each item In ListView4.ListItems
      g_Options.AddProject item.tag
   Next
   
   g_Options.ConvertToXML = Option2.value
   
   g_Options.CompleteURL = (Check1.value = vbChecked)
   g_Options.UseAlwaysTags = (Check2.value = vbChecked)
   g_Options.StripLingoText = (Check4.value = vbChecked)
   g_Options.AssignLIDs = (Check6.value = vbChecked)
   
   g_Options.LingoFilePath = Trim(Text4.text)
   g_Options.LingoIDAttrib = Trim(Text9.text)
   
   If g_Options.LingoFilePath <> "" Then
      g_Options.UseLingoFile = (Check3.value = vbChecked)
   Else
      g_Options.UseLingoFile = False
   End If
   
   g_Options.SaveDefaults

   Unload Me
End Sub

' Add "Always Close" Tag
Private Sub Command4_Click()
   Text2.text = Trim(Text2.text)
   If Text2.text <> "" Then
      If ListView2.FindItem(Text2.text) Is Nothing Then
         Call ListView2.ListItems.Add(, , Text2.text)
      End If
      Text2.SetFocus
      Text2.SelStart = 0
      Text2.SelLength = Len(Text2.text)
   End If
End Sub

' Add "Lingo-izeable" Tag
Private Sub Command5_Click()
   Text3.text = Trim(Text3.text)
   If Text3.text <> "" Then
      If ListView3.FindItem(Text3.text) Is Nothing Then
         Call ListView3.ListItems.Add(, , Text3.text)
      End If
      Text3.SetFocus
      Text3.SelStart = 0
      Text3.SelLength = Len(Text3.text)
   End If
End Sub

' Browse for Lingo File (for Lingo page)
Private Sub Command6_Click()
   On Error GoTo ErrHandler
   Text4.text = BrowseForXML()
   Exit Sub
ErrHandler:
   Err.Clear
End Sub

' Build Selected Projects
Private Sub Command7_Click()
   Dim item As MSComctlLib.ListItem
   Dim buildItem As BuildListItem
   For Each item In ListView4.ListItems
      If item.Selected Then
         Set buildItem = item.tag
         If Not buildItem.Process Then Exit For
      End If
   Next item
End Sub

' Browse for Lingo File (for Build page)
Private Sub Command9_Click()
   On Error GoTo ErrHandler
   Text5.text = BrowseForXML()
   Exit Sub
ErrHandler:
   Err.Clear
End Sub

' Add BuildListItem structure to collection
Private Sub Command10_Click()
   Dim item As MSComctlLib.ListItem
   Dim buildItem As BuildListItem
   
   ' Search for existing BuildListItem with the same Project Name
   For Each item In ListView4.ListItems
      If item.tag.name = Text7.text Then
         Set buildItem = item.tag
         Exit For
      End If
   Next item
   
   ' If not found, add project listbox (copied later to g_Options)
   If buildItem Is Nothing Then
      Set buildItem = New BuildListItem
      Set item = ListView4.ListItems.Add(, , Text7.text)
      Set item.tag = buildItem
   End If
   
   ' Copy info to BuildListItem (will copy later to g_Options)
   buildItem.name = Text7.text
   buildItem.SourceDir = Text8.text
   buildItem.DestinationDir = Text6.text
   buildItem.LingoFile = Text5.text
   buildItem.Enabled = (Check5.value = vbChecked)

   item.SubItems(1) = buildItem.SourceDir
   item.SubItems(2) = buildItem.DestinationDir
   item.SubItems(3) = buildItem.LingoFile
   item.SmallIcon = buildItem.SmallIcon
End Sub

' Invoke FileOpen dialog. Return filename, if successful.
' NOTE: Will cause error if dialog is canceled.
Private Function BrowseForXML()
   Dialogs1.CancelError = True
   Dialogs1.DialogTitle = "Open XML Document"
   Dialogs1.Filename = ""
   Dialogs1.Filter = "XML Files (*.xml)|*.xml"
   Dialogs1.Flags = cdlOFNCreatePrompt
   Dialogs1.ShowOpen
   BrowseForXML = Dialogs1.Filename
End Function

' Double-click these list items to remove them
Private Sub ListView1_DblClick()
   Dim item As MSComctlLib.ListItem
   Set item = ListView1.SelectedItem
   ListView1.ListItems.Remove item.Index
End Sub
Private Sub ListView2_DblClick()
   Dim item As MSComctlLib.ListItem
   Set item = ListView2.SelectedItem
   ListView2.ListItems.Remove item.Index
End Sub
Private Sub ListView3_DblClick()
   Dim item As MSComctlLib.ListItem
   Set item = ListView3.SelectedItem
   ListView3.ListItems.Remove item.Index
End Sub

' Allow only UPPERCASE in these text boxes
Private Sub Text2_KeyPress(KeyAscii As Integer)
   KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
   KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub