Esempio n. 1
0
        public static void NewFile(ProjectExplorerForm ProjectExplorerWindow)
        {
            NewFileForm frm = new NewFileForm();

            Form1StringResources.SetTextForAllControls(frm);
            frm.FileName = ProjectFactory.Instance.GetUnitFileName();
            frm.SetUnitFilter();
            if (frm.ShowDialog() == DialogResult.OK)
            {
                PascalABCCompiler.IFileInfo fi = ProjectFactory.Instance.AddSourceFile(frm.FileName);
                ProjectExplorerWindow.AddSourceFile(fi, false);
                string       full_file_name = Path.Combine(Path.GetDirectoryName(ProjectFactory.Instance.CurrentProject.Path), frm.FileName);
                StreamWriter sw             = File.CreateText(full_file_name);
                if (frm.GetFileFilter() == FileType.Unit)
                {
                    sw.WriteLine("unit " + Path.GetFileNameWithoutExtension(frm.FileName) + ";");
                    sw.WriteLine();
                    sw.WriteLine("interface");
                    sw.WriteLine();
                    sw.WriteLine("implementation");
                    sw.WriteLine();
                    sw.Write("end.");
                }
                else
                {
                    sw.WriteLine("namespace " + ProjectFactory.Instance.CurrentProject.Name + ";");
                    sw.WriteLine();
                    sw.Write("end.");
                    ProjectFactory.Instance.AddNamespaceFileReference(full_file_name);
                }

                sw.Close();
                WorkbenchServiceFactory.FileService.OpenFile(full_file_name, null);
            }
        }
Esempio n. 2
0
        public static void NewForm(ProjectExplorerForm ProjectExplorerWindow, bool prompt)         //roman//
        {
            NewFileForm frm = new NewFileForm();

            frm.SetWinFormsFilter();
            Form1StringResources.SetTextForAllControls(frm);
            frm.FileName = ProjectFactory.Instance.GetUnitFileName();
            if (prompt && frm.ShowDialog() != DialogResult.OK) //roman//
            {
                return;
            }
            PascalABCCompiler.IFileInfo fi = ProjectFactory.Instance.AddSourceFile(frm.FileName);
            string       full_file_name    = Path.Combine(Path.GetDirectoryName(ProjectFactory.Instance.CurrentProject.Path), frm.FileName);
            StreamWriter sw = File.CreateText(full_file_name);

            sw.Close();

            WorkbenchServiceFactory.FileService.OpenFile(full_file_name, null);
            VisualPABCSingleton.MainForm.CurrentCodeFileDocument.AddDesigner(null);
            ProjectExplorerWindow.AddSourceFile(fi, true);
            VisualPABCSingleton.MainForm.SaveFileAs(VisualPABCSingleton.MainForm.CurrentCodeFileDocument, full_file_name);
        }
Esempio n. 3
0
		public static void NewFile(ProjectExplorerForm ProjectExplorerWindow)
		{
			NewFileForm frm = new NewFileForm();
			Form1StringResources.SetTextForAllControls(frm);
			frm.FileName = ProjectFactory.Instance.GetUnitFileName();
			frm.SetUnitFilter();
			if (frm.ShowDialog() == DialogResult.OK)
			{
				PascalABCCompiler.IFileInfo fi = ProjectFactory.Instance.AddSourceFile(frm.FileName);
				ProjectExplorerWindow.AddSourceFile(fi,false);
				string full_file_name = Path.Combine(Path.GetDirectoryName(ProjectFactory.Instance.CurrentProject.Path),frm.FileName);
				StreamWriter sw = File.CreateText(full_file_name);
				sw.WriteLine("unit "+Path.GetFileNameWithoutExtension(frm.FileName)+";");
				sw.WriteLine();
				sw.WriteLine("interface");
				sw.WriteLine();
				sw.WriteLine("implementation");
				sw.WriteLine();
				sw.WriteLine("end.");
				sw.Close();
                WorkbenchServiceFactory.FileService.OpenFile(full_file_name, null);
			}
		}
Esempio n. 4
0
		public static void NewForm(ProjectExplorerForm ProjectExplorerWindow, bool prompt) //roman//
		{
			NewFileForm frm = new NewFileForm();
			frm.SetWinFormsFilter();
			Form1StringResources.SetTextForAllControls(frm);
			frm.FileName = ProjectFactory.Instance.GetUnitFileName();
            if (prompt && frm.ShowDialog() != DialogResult.OK) //roman//
                return;
            PascalABCCompiler.IFileInfo fi = ProjectFactory.Instance.AddSourceFile(frm.FileName);
            string full_file_name = Path.Combine(Path.GetDirectoryName(ProjectFactory.Instance.CurrentProject.Path), frm.FileName);            
            StreamWriter sw = File.CreateText(full_file_name);
            sw.Close();

            WorkbenchServiceFactory.FileService.OpenFile(full_file_name, null);
            VisualPABCSingleton.MainForm.CurrentCodeFileDocument.AddDesigner(null);
            ProjectExplorerWindow.AddSourceFile(fi, true);
            VisualPABCSingleton.MainForm.SaveFileAs(VisualPABCSingleton.MainForm.CurrentCodeFileDocument, full_file_name);
		}