VERSION 5.00 Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX" Begin VB.Form frmNueva BorderStyle = 3 'Fixed Dialog Caption = "Nueva aventura" ClientHeight = 2385 ClientLeft = 45 ClientTop = 330 ClientWidth = 5250 Icon = "Nueva.frx":0000 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2385 ScaleWidth = 5250 ShowInTaskbar = 0 'False StartUpPosition = 1 'CenterOwner Begin MSComDlg.CommonDialog CommonDialog1 Left = 120 Top = 1920 _ExtentX = 847 _ExtentY = 847 _Version = 393216 End Begin VB.Frame Frame1 Height = 1815 Left = 120 TabIndex = 1 Top = 0 Width = 5055 Begin VB.CommandButton cmdExistente Caption = "&Usar una aventura existente como inicial" Height = 495 Left = 1080 TabIndex = 3 Top = 1080 Width = 3615 End Begin VB.CommandButton cmdNueva Caption = "&Nueva aventura" Height = 495 Left = 1080 TabIndex = 2 Top = 360 Width = 3615 End Begin VB.Image Image2 Height = 720 Left = 120 Picture = "Nueva.frx":058A Top = 960 Width = 720 End Begin VB.Image Image1 Height = 720 Left = 120 Picture = "Nueva.frx":146C Top = 240 Width = 720 End End Begin VB.CommandButton cmdCancelar Caption = "&Cancelar" Height = 375 Left = 3960 TabIndex = 0 Top = 1920 Width = 1215 End End Attribute VB_Name = "frmNueva" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private Sub cmdCancelar_Click() Unload Me End Sub Private Sub cmdExistente_Click() Dim frm As Form Dim sFich As String, sFichNueva As String, sFichMod As String Dim i As Integer, iOpc As Integer On Error GoTo Error_Nuevo frmPrincipal.GuardarCambios ' pedimos nombre de aventura existente CommonDialog1.DialogTitle = "Selecciona aventura a usar como modelo" CommonDialog1.Filter = "Archivos de Visual SINTAC|*" & EXT_PROC CommonDialog1.InitDir = App.Path CommonDialog1.Flags = cdlOFNPathMustExist Or cdlOFNHideReadOnly CommonDialog1.CancelError = True CommonDialog1.FileName = "" CommonDialog1.ShowOpen sFich = CommonDialog1.FileName If Not ExisteFichero(sFich) Then Exit Sub End If ' elimina la extensión del nombre del fichero (si la tiene) i = InStr(sFich, ".") If i > 0 Then sFich = Left(sFich, i - 1) End If ' pedimos nombre de aventura nueva CommonDialog1.DialogTitle = "Nueva aventura" CommonDialog1.Filter = "Archivos de Visual SINTAC|*" & EXT_PROC & "|Todos los archivos|*.*" CommonDialog1.InitDir = App.Path CommonDialog1.Flags = cdlOFNPathMustExist Or cdlOFNHideReadOnly CommonDialog1.CancelError = True CommonDialog1.FileName = "" CommonDialog1.ShowOpen sFichNueva = CommonDialog1.FileName ' elimina la extensión del nombre del fichero (si la tiene) i = InStr(sFichNueva, ".") If i > 0 Then sFichNueva = Left(sFichNueva, i - 1) End If If ExisteFichero(sFichNueva & EXT_PROC) Then iOpc = MsgBox("Ya existe una aventura con ese nombre. ¿Quieres sobreescribirla?", _ vbYesNo + vbExclamation, "Nueva aventura") If iOpc <> vbYes Then Exit Sub Else On Error Resume Next ' cargamos la lista de módulos para poder borrarlos ' al llamar, más adelante, a 'InicializaDatosAventura', esta ' lista se borrará CargarModulos sFichNueva & EXT_PROC Kill sFichNueva & EXT_VOC Kill sFichNueva & EXT_LOC Kill sFichNueva & EXT_OBJ Kill sFichNueva & EXT_PSI Kill sFichNueva & EXT_PROC If bHayModulos Then For i = 0 To UBound(ListaMod) Kill ListaMod(i).Fichero Next End If Kill sFichNueva & EXT_RES Kill sFichNueva & EXT_DLL End If End If Screen.MousePointer = vbHourglass ' copiamos los ficheros de la aventura modelo On Error Resume Next ' cargamos la lista de módulos para poder borrarlos ' al llamar, más adelante, a 'InicializaDatosAventura', esta ' lista se borrará CargarModulos sFich & EXT_PROC FileCopy sFich & EXT_VOC, sFichNueva & EXT_VOC FileCopy sFich & EXT_LOC, sFichNueva & EXT_LOC FileCopy sFich & EXT_OBJ, sFichNueva & EXT_OBJ FileCopy sFich & EXT_PSI, sFichNueva & EXT_PSI ' copiamos los módulos, cambiándoles el nombre según los copiamos If bHayModulos Then For i = 0 To UBound(ListaMod) sFichMod = sFichNueva & Format(i, "0000") & EXT_SCR FileCopy RutaFich(sFich) & "\" & ListaMod(i).Fichero, sFichMod ListaMod(i).Fichero = NombreFich(sFichMod) Next End If ' guardamos la nueva lista de módulos GuardarModulos sFichNueva & EXT_PROC FileCopy sFich & EXT_RES, sFichNueva & EXT_RES ' cerramos los formularios abiertos For Each frm In Forms If frm.name <> Me.name And frm.name <> frmPrincipal.name Then Unload frm End If Next InicializaDatosAventura sFichAventura = sFichNueva frmPrincipal.AbrirUltimo frmPrincipal.Titulo frmPrincipal.ActivarMenuAventura Screen.MousePointer = vbDefault Unload Me Exit Sub Error_Nuevo: Screen.MousePointer = vbDefault Exit Sub End Sub Private Sub cmdNueva_Click() Dim frm As Form Dim sFich As String Dim i As Integer, iOpc As Integer On Error GoTo Error_Nuevo frmPrincipal.GuardarCambios CommonDialog1.DialogTitle = "Nueva aventura" CommonDialog1.Filter = "Archivos de Visual SINTAC|*" & EXT_PROC & "|Todos los archivos|*.*" CommonDialog1.InitDir = App.Path CommonDialog1.Flags = cdlOFNPathMustExist Or cdlOFNHideReadOnly CommonDialog1.CancelError = True CommonDialog1.FileName = "" CommonDialog1.ShowOpen sFich = CommonDialog1.FileName ' cerramos los formularios abiertos For Each frm In Forms If frm.name <> Me.name And frm.name <> frmPrincipal.name Then Unload frm End If Next ' elimina la extensión del nombre del fichero (si la tiene) i = InStr(sFich, ".") If i > 0 Then sFich = Left(sFich, i - 1) End If If ExisteFichero(sFich & EXT_PROC) Then Screen.MousePointer = vbDefault iOpc = MsgBox("Ya existe una aventura con ese nombre. ¿Quieres sobreescribirla?", _ vbYesNo + vbExclamation, "Nueva aventura") If iOpc <> vbYes Then Exit Sub Else On Error Resume Next ' cargamos la lista de módulos para poder borrarlos ' al llamar, más adelante, a 'InicializaDatosAventura', esta ' lista se borrará CargarModulos sFich & EXT_PROC Kill sFich & EXT_VOC Kill sFich & EXT_LOC Kill sFich & EXT_OBJ Kill sFich & EXT_PSI Kill sFich & EXT_PROC If bHayModulos Then For i = 0 To UBound(ListaMod) Kill ListaMod(i).Fichero Next End If Kill sFich & EXT_RES Kill sFich & EXT_DLL End If End If Screen.MousePointer = vbHourglass InicializaDatosAventura sFichAventura = sFich frmPrincipal.Titulo frmPrincipal.ActivarMenuAventura frmPrincipal.Guardar Screen.MousePointer = vbDefault Unload Me Exit Sub Error_Nuevo: Screen.MousePointer = vbDefault Exit Sub End Sub