VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmResources 
   Appearance      =   0  'Flat
   BackColor       =   &H00404040&
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "  :: Resource Manager ::"
   ClientHeight    =   7110
   ClientLeft      =   45
   ClientTop       =   315
   ClientWidth     =   5790
   ControlBox      =   0   'False
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "frmResources.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   7110
   ScaleWidth      =   5790
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton optCustom2 
      Appearance      =   0  'Flat
      BackColor       =   &H00404040&
      Caption         =   "Custom (from file)"
      Height          =   255
      Left            =   3330
      TabIndex        =   23
      Top             =   1320
      Visible         =   0   'False
      Width           =   1485
   End
   Begin VB.CommandButton cmdOK 
      Appearance      =   0  'Flat
      BackColor       =   &H00404040&
      Caption         =   "OK"
      Height          =   255
      Left            =   3900
      TabIndex        =   21
      Top             =   2040
      Width           =   1485
   End
   Begin VB.OptionButton optCustom 
      Appearance      =   0  'Flat
      BackColor       =   &H00404040&
      Caption         =   "Custom (from file)"
      ForeColor       =   &H00FFFFFF&
      Height          =   255
      Left            =   3240
      TabIndex        =   18
      Top             =   630
      Width           =   1755
   End
   Begin VB.Frame Frame3 
      Appearance      =   0  'Flat
      BackColor       =   &H00404040&
      Caption         =   "CURRENT RESOURCES"
      BeginProperty Font 
         Name            =   "Arial Black"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   2055
      Left            =   240
      TabIndex        =   11
      Top             =   240
      Width           =   2655
      Begin VB.ListBox lstRes 
         Appearance      =   0  'Flat
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1395
         ItemData        =   "frmResources.frx":038A
         Left            =   240
         List            =   "frmResources.frx":038C
         TabIndex        =   12
         Top             =   360
         Width           =   2175
      End
   End
   Begin MSComDlg.CommonDialog dialog 
      Left            =   4920
      Top             =   5160
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
      CancelError     =   -1  'True
      Filter          =   "Pics and Vids (*.bmp/*.png/*.jpg/*.wmv)|*.jpg;*.png;*.bmp;*.wmv"
   End
   Begin VB.Frame fraImg 
      BorderStyle     =   0  'None
      Caption         =   "Frame4"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1095
      Left            =   1350
      TabIndex        =   14
      Top             =   5430
      Visible         =   0   'False
      Width           =   1455
      Begin VB.Image imgDefault 
         Height          =   1095
         Left            =   300
         Top             =   -450
         Width           =   1455
      End
   End
   Begin VB.CommandButton optPreset2 
      Appearance      =   0  'Flat
      BackColor       =   &H00404040&
      Caption         =   "Preset (in MXM)"
      Height          =   255
      Left            =   3300
      TabIndex        =   17
      Top             =   1560
      Visible         =   0   'False
      Width           =   1485
   End
   Begin VB.OptionButton optPreset 
      Appearance      =   0  'Flat
      BackColor       =   &H00404040&
      Caption         =   "Preset (in MXM)"
      ForeColor       =   &H00FFFFFF&
      Height          =   225
      Left            =   3240
      TabIndex        =   19
      Top             =   900
      Width           =   1755
   End
   Begin VB.Frame fraCustom 
      Appearance      =   0  'Flat
      BackColor       =   &H00404040&
      Caption         =   "ADD RESOURCE"
      BeginProperty Font 
         Name            =   "Arial Black"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   2175
      Left            =   240
      TabIndex        =   2
      Top             =   2520
      Visible         =   0   'False
      Width           =   5295
      Begin VB.CommandButton cmdAdd 
         Appearance      =   0  'Flat
         BackColor       =   &H00404040&
         Caption         =   "Add"
         Default         =   -1  'True
         Height          =   285
         Left            =   3630
         TabIndex        =   22
         Top             =   1800
         Width           =   1485
      End
      Begin VB.TextBox txtRes 
         Appearance      =   0  'Flat
         BackColor       =   &H00FFFFFF&
         ForeColor       =   &H00000000&
         Height          =   285
         Left            =   1590
         TabIndex        =   0
         Top             =   360
         Width           =   1905
      End
      Begin VB.CommandButton cmdBrowse 
         Appearance      =   0  'Flat
         BackColor       =   &H00404040&
         Caption         =   "Browse"
         Height          =   285
         Left            =   3630
         TabIndex        =   1
         Top             =   360
         Width           =   1485
      End
      Begin VB.Label Label4 
         Appearance      =   0  'Flat
         BackColor       =   &H00404040&
         Caption         =   "*The resource can either be a video or a picture.  Both are referred to as ""images""."
         ForeColor       =   &H00FFFFFF&
         Height          =   435
         Left            =   150
         TabIndex        =   6
         Top             =   1320
         Width           =   4995
      End
      Begin VB.Label lblFile 
         Appearance      =   0  'Flat
         BackColor       =   &H00404040&
         ForeColor       =   &H00FFFFFF&
         Height          =   435
         Left            =   600
         TabIndex        =   4
         Top             =   780
         Width           =   4515
      End
      Begin VB.Label Label3 
         Appearance      =   0  'Flat
         BackColor       =   &H00404040&
         Caption         =   "Resource Name:"
         ForeColor       =   &H00FFFFFF&
         Height          =   255
         Left            =   180
         TabIndex        =   5
         Top             =   360
         Width           =   1215
      End
      Begin VB.Label Label1 
         Appearance      =   0  'Flat
         BackColor       =   &H00404040&
         Caption         =   "File:"
         ForeColor       =   &H00FFFFFF&
         Height          =   285
         Left            =   180
         TabIndex        =   3
         Top             =   810
         Width           =   615
      End
   End
   Begin VB.Frame fraPreset 
      Appearance      =   0  'Flat
      BackColor       =   &H00404040&
      Caption         =   "ADD PRESET RESOURCE"
      BeginProperty Font 
         Name            =   "Arial Black"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   2175
      Left            =   240
      TabIndex        =   7
      Top             =   2520
      Visible         =   0   'False
      Width           =   5295
      Begin VB.TextBox txtResDef 
         Appearance      =   0  'Flat
         BackColor       =   &H00FFFFFF&
         ForeColor       =   &H00000000&
         Height          =   285
         Left            =   1380
         TabIndex        =   15
         Top             =   1680
         Width           =   1665
      End
      Begin VB.ListBox lstResDef 
         Appearance      =   0  'Flat
         BackColor       =   &H00404040&
         ForeColor       =   &H00FFFFFF&
         Height          =   1200
         ItemData        =   "frmResources.frx":038E
         Left            =   150
         List            =   "frmResources.frx":03C8
         TabIndex        =   9
         Top             =   390
         Width           =   2895
      End
      Begin VB.CommandButton cmdAddDef 
         BackColor       =   &H00404040&
         Caption         =   "Add Resource"
         Height          =   255
         Left            =   3420
         TabIndex        =   8
         Top             =   1710
         Width           =   1605
      End
      Begin VB.Label Label2 
         BackColor       =   &H00404040&
         Caption         =   "Resource name"
         ForeColor       =   &H00FFFFFF&
         Height          =   255
         Left            =   180
         TabIndex        =   16
         Top             =   1680
         Width           =   1215
      End
      Begin VB.Label Label5 
         BackColor       =   &H00404040&
         Caption         =   "Description:"
         ForeColor       =   &H00FFFFFF&
         Height          =   255
         Left            =   3450
         TabIndex        =   13
         Top             =   360
         Width           =   1215
      End
      Begin VB.Label lblDesc 
         BackColor       =   &H00404040&
         ForeColor       =   &H00FFFFFF&
         Height          =   945
         Left            =   3420
         TabIndex        =   10
         Top             =   630
         Width           =   1575
      End
   End
   Begin VB.Label Label6 
      BackColor       =   &H00404040&
      Caption         =   "ADD RESOURCE:"
      BeginProperty Font 
         Name            =   "Arial Black"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   285
      Left            =   3240
      TabIndex        =   20
      Top             =   240
      Width           =   1965
   End
   Begin VB.Image imgPreview 
      Height          =   1095
      Left            =   660
      Stretch         =   -1  'True
      Top             =   6840
      Visible         =   0   'False
      Width           =   1455
   End
End
Attribute VB_Name = "frmResources"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Dim res() As String
Dim nam As String

Private Sub cmdAddDef_Click()
    Dim k As Integer
    
    For k = 0 To lstRes.ListCount - 1
        If txtResDef = lstRes.List(k) Then
            Exit Sub
        End If
    Next k
    
    If lstResDef.ListIndex = -1 Then Exit Sub
    
    Select Case Left(lstResDef.List(lstResDef.ListIndex), 2)
        Case "Ga"
            Call addcRes(makeTag("Entry", "default.xbe"), txtResDef)
        Case "Pr"
            Call addcRes(makeTag("EntryNamed", "Media"), txtResDef)
        Case Else
            Call addcRes(makeTag("File", lstResDef.List(lstResDef.ListIndex)), txtResDef)
    End Select
    
    lstRes.ListIndex = lstRes.ListCount - 1
    cmdOK.Default = True
    
    optCustom.Value = False
    optPreset.Value = False
    
    Call resizeForm(2895)
End Sub

Private Sub cmdBrowse_Click()
On Error GoTo hekk
    dialog.ShowOpen
    lblFile = dialog.FileName
    If txtRes = "" Then txtRes = getName(lblFile)
    
    cmdAdd.Default = True
    cmdAdd.SetFocus
    
    Exit Sub
hekk:
    If Err <> 32755 Then MsgBox Err.Description
End Sub

'Private Sub cmdFont_Click()
'On Error GoTo blah
    'dialog.ShowFont
    'lstRes.AddItem "Font: " & dialog.FontName
    'frmmain.lstR.AddItem "Font: " & dialog.FontName
'blah:
    'Exit Sub
'End Sub

Private Sub cmdOK_Click()
    'vidPreview(1).Stop
    Me.Hide
    
    If frmMain.optImg.Value = True Then
        frmMain.lstR.ListIndex = lstRes.ListIndex
    End If
End Sub

Private Sub cmdAdd_Click()
    'If txtRes = "" Then
        'MsgBox "Enter a resource name"
        'Exit Sub
    'End If
    
    'If lblFile = "" Then
        'MsgBox "Select a resource file"
        'Exit Sub
    'End If
    
    If txtRes = "bground" Then
        MsgBox "Use a different resource name"
        Exit Sub
    End If
    
    Dim k As Integer
    
    For k = 0 To lstRes.ListCount - 1
        If txtRes = lstRes.List(k) Then
            MsgBox "Enter a unique resource name"
            txtRes.SetFocus
            Exit Sub
        End If
    Next k
    
    If lblFile.Caption = "" Or txtRes.Text = "" Then Exit Sub
    
    Call addRes(txtRes, lblFile)
        
    lblFile.Caption = ""
    txtRes.Text = ""
    
    cmdOK.Default = True
    optCustom.Value = False
    optPreset.Value = False
    
    lstRes.ListIndex = lstRes.ListCount - 1
        
    Call resizeForm(2895)
End Sub

Private Sub Form_Deactivate()
    Me.height = 2895
    'vidPreview(1).Stop
End Sub

Private Sub Form_LostFocus()
    'vidPreview(1).Stop
End Sub

Private Sub lstRes_Click()
'On Error Resume Next
    'If lstRes.ListIndex > -1 Then
        'imgDefault.Visible = resCustom(lstRes.ListIndex)
        
        'If resCustom(lstRes.ListIndex) Then
            'vidPreview(1).Visible = Not isPic(res(lstRes.ListIndex))
            'fraImg.Visible = isPicres((lstRes.ListIndex))
        
            'If isPic (res(lstRes.ListIndex)) Then
                'Unload vidPreview(1)
                'imgPreview.Picture = LoadPicture(res(lstRes.ListIndex))
                'fraImg.Refresh
                'Me.Refresh
                
            'Else
                'Load vidPreview(1)
                'vidPreview(1).FileName = res(lstRes.ListIndex)
            'End If
        'End If
        
        'cmdOK.Default = True
    'End If
End Sub

Private Sub lstResDef_Click()
    cmdAddDef.Default = True
    
    Select Case lstResDef.ListIndex
        Case 0
            lblDesc = "This shows each game's preview video or screenshot"
        Case 1
            lblDesc = "This shows each game's icon"
        Case Else
            lblDesc = "---"
    End Select
    
    If lstResDef.ListIndex <> -1 Then
        txtResDef = Replace(lstResDef.List(lstResDef.ListIndex), "::", "")
    End If
End Sub

Private Sub optCustom_Click()
    fraCustom.Visible = True
    fraPreset.Visible = False
    txtRes.SetFocus
    cmdBrowse.Default = True
    Call resizeForm(5355)
End Sub

Private Sub optPreset_Click()
    fraCustom.Visible = False
    fraPreset.Visible = True
    lstResDef.SetFocus
    cmdAddDef.Default = True
    Call resizeForm(5355)
End Sub

Private Sub txtRes_GotFocus()
    cmdBrowse.Default = True
End Sub

Sub addRes(txtRes1 As String, lblFile1 As String)
    lstRes.AddItem txtRes1
    frmMain.lstR.AddItem txtRes1
    ReDim Preserve res(lstRes.ListCount - 1) As String
    ReDim Preserve resCustom(lstRes.ListCount - 1) As Boolean
    resCustom(lstRes.ListCount - 1) = True
    res(lstRes.ListCount - 1) = lblFile1
End Sub

Sub addcRes(resNam As String, nam As String)
    lstRes.AddItem nam 'lstResDef.List(lstResDef.ListIndex)
    frmMain.lstR.AddItem nam 'lstResDef.List(lstResDef.ListIndex)
    
    ReDim Preserve res(lstRes.ListCount - 1) As String
    ReDim Preserve resCustom(lstRes.ListCount - 1) As Boolean
    resCustom(lstRes.ListCount - 1) = False
    res(lstRes.ListCount - 1) = resNam
    'restext(
End Sub

Sub resizeForm(height As Single)
    'frmresources.Height = height
    
    Do While Abs(Me.height - height) > 25
        Me.height = Me.height + (height - Me.height) / 9
        Me.Refresh
        frmMain.Refresh
    Loop
    
    Me.height = height
End Sub
