Ejemplo n.º 1
0
        public Form1()
        {
            PascalABCCompiler.StringResourcesLanguage.LoadDefaultConfig();
            if (PascalABCCompiler.StringResourcesLanguage.AccessibleLanguages.Count > 0)
                PascalABCCompiler.StringResourcesLanguage.CurrentLanguageName = PascalABCCompiler.StringResourcesLanguage.AccessibleLanguages[0];
           
            InitializeComponent();
            InitForm();
            AddOwnedForm(CompileOptionsForm1 = new CompileOptionsForm());
            AddOwnedForm(UserOptionsForm1 = new UserOptionsForm());
            AddOwnedForm(CompilerForm1 = new CompilerForm());
            AddOwnedForm(AboutBox1 = new AboutBox());
            AddOwnedForm(FindForm = new FindReplaceForm(FindReplaceForm.FormType.Find));
            AddOwnedForm(ReplaceForm = new FindReplaceForm(FindReplaceForm.FormType.Replace));
            CompilerOptions1 = new PascalABCCompiler.CompilerOptions();
            CompilerOptions1.Debug = true;
            LastOpenFiles = new List<string>();

            RunProcessOptions1 = new RunProcessOptions();
            

            CompilerOptions1.OutputFileType = PascalABCCompiler.CompilerOptions.OutputType.ConsoleApplicaton;


            Form1StringResources.SetTextForAllControls(this);
            Form1StringResources.SetTextForAllControls(this.contextMenuStrip1);
            Form1StringResources.SetTextForAllControls(this.cmEditor);
            PascalABCCompiler.StringResources.SetTextForAllObjects(UserOptionsForm1, "VP_OPTFORM_");
            PascalABCCompiler.StringResources.SetTextForAllObjects(CompileOptionsForm1, "VP_COMPOPTFORM_");
            PascalABCCompiler.StringResources.SetTextForAllObjects(AboutBox1, "VP_ABOUTBOXFORM_");
            PascalABCCompiler.StringResources.SetTextForAllObjects(FindForm, "VP_FINDFORM_");
            PascalABCCompiler.StringResources.SetTextForAllObjects(ReplaceForm, "VP_REPLACEFORM_");

            tsatConsoleApplication.Tag = PascalABCCompiler.CompilerOptions.OutputType.ConsoleApplicaton;
            tsatWindowsApplication.Tag = PascalABCCompiler.CompilerOptions.OutputType.WindowsApplication;
            tsatDll.Tag = PascalABCCompiler.CompilerOptions.OutputType.ClassLibrary;

            SelectAppType(CompilerOptions1.OutputFileType);

            //ivan
            dbgHelper = new DebugHelper(this);
            //\ivan
            //this.dataGridView1.MinimumSize = new Size(0, Screen.PrimaryScreen.WorkingArea.Height);

        }
Ejemplo n.º 2
0
        public Form1()
        {
            if (Tools.IsUnix())
            {
                ProjectsUseable = false;
                DesignerUseable = false;
                //DebuggerVisible = false;
            }
        	PascalABCCompiler.StringResourcesLanguage.LoadDefaultConfig();
            //if (PascalABCCompiler.StringResourcesLanguage.AccessibleLanguages.Count > 0)
            //    PascalABCCompiler.StringResourcesLanguage.CurrentLanguageName = PascalABCCompiler.StringResourcesLanguage.AccessibleLanguages[0];
           
            InitializeComponent();
           
            VisualPABCSingleton.MainForm = this;
            WorkbenchStorage.MainProgramThread = System.Threading.Thread.CurrentThread;
            //images init
            this.miNewProject.Image = new System.Drawing.Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("VisualPascalABC.Resources.Icons.16x16.NewProjectIcon.png"));
            this.mADDFILEToolStripMenuItem.Image = miNew.Image;
            this.mADDEXISTFILEToolStripMenuItem.Image = miOpen.Image;
            this.mADDFORMToolStripMenuItem.Image = new System.Drawing.Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("VisualPascalABC.Resources.Icons.16x16.Form.png"));
            toolStripPanel.Size = new Size(toolStripPanel.Size.Width, toolStrip1.Height);
            var gr = Graphics.FromHwnd(Handle);
            if (gr.DpiX >= 96*2)
            {
                toolStrip1.ImageScalingSize = new Size(32, 32);
                menuStrip1.ImageScalingSize = new Size(32, 32);
                toolStripPanel.Size = new Size(toolStripPanel.Size.Width, 38);
            }
            serviceContainer = new WorkbenchServiceContainer();

            if (DebuggerVisible)
            {
            	InitForm();
                this.StepOutButton.Visible = false;
                PlayPauseButtonsVisibleInPanel = PlayPauseButtonsVisibleInPanel;
                SetDebugButtonsEnabled(false);
            }
            
            AddOwnedForm(CompilerForm1 = new CompilerForm());
            AddOwnedForm(AboutBox1 = new AboutBox());
            AddOwnedForm(FindForm = new FindReplaceForm(FindReplaceForm.FormType.Find));
            AddOwnedForm(ReplaceForm = new FindReplaceForm(FindReplaceForm.FormType.Replace));
            AddOwnedForm(GotoLineForm = new GotoLineForm());
           
            LastOpenFiles = new List<string>();
            LastOpenProjects = new List<string>();

            WorkbenchServiceFactory.BuildService.CompilerOptions.Debug = true;
            WorkbenchServiceFactory.BuildService.CompilerOptions.OutputFileType = PascalABCCompiler.CompilerOptions.OutputType.ConsoleApplicaton;

            LocalizeControls();

            tsatConsoleApplication.Tag = PascalABCCompiler.CompilerOptions.OutputType.ConsoleApplicaton;
            tsatWindowsApplication.Tag = PascalABCCompiler.CompilerOptions.OutputType.WindowsApplication;
            tsatDll.Tag = PascalABCCompiler.CompilerOptions.OutputType.ClassLibrary;

            SelectAppType(WorkbenchServiceFactory.BuildService.CompilerOptions.OutputFileType);

            //this.Width = 800;
            //this.Height = 600;
            UserOptions = new UserOptions();

            visualStates = new VisualStates();

            SetFiltersAndHighlighting();
            
            FormLeft = this.Left; FormTop = this.Top; FormWidth = this.Width; FormHeight = this.Height;
			MainDockPanel.DockRightPortion = 0.22;
            MainDockPanel.DockLeftPortion = 0.22;
                
            //UserOptions.OutputDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName)+"\\Output";
            UserOptions.OutputDirectory = Constants.DefaultOutputDirectory;

            PlayPauseButtonsVisibleInPanel = false;

            WorkbenchStorage.StandartDirectories = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
            WorkbenchStorage.StandartDirectories.Add(Constants.SystemDirectoryIdent, System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName));

            RestoreDesktop();

            LoadOptions();

            HelpExamplesDirectory = PascalABCCompiler.Tools.ReplaceAllKeys(Constants.HelpExamplesDirectory, WorkbenchStorage.StandartDirectories);
            HelpTutorialExamplesDirectory = PascalABCCompiler.Tools.ReplaceAllKeys(Constants.HelpTutorialExamplesDirectory, WorkbenchStorage.StandartDirectories);

            UpdateUserOptions();
            ErrorsListWindow.Resized();
            FindSymbolsResultWindow.Resized();

            UpdateOutputWindowVisibleButtons();

            if (WorkbenchStorage.WorkingDirectory == null || true)
            {
                WorkbenchStorage.WorkingDirectoryInOptionsFile = Constants.DefaultWorkingDirectory;
                WorkbenchStorage.WorkingDirectory = PascalABCCompiler.Tools.ReplaceAllKeys(Constants.DefaultWorkingDirectory, WorkbenchStorage.StandartDirectories);
            }
            if (Path.GetDirectoryName(Application.ExecutablePath).ToLower() != Environment.CurrentDirectory.ToLower())
                WorkbenchStorage.WorkingDirectory = Environment.CurrentDirectory;
            WorkbenchStorage.StandartDirectories.Add(Constants.WorkingDirectoryIdent, WorkbenchStorage.WorkingDirectory);
            openFileDialog1.InitialDirectory = WorkbenchStorage.WorkingDirectory;

            if (WorkbenchStorage.LibSourceDirectory == null)
                WorkbenchStorage.LibSourceDirectory = PascalABCCompiler.Tools.ReplaceAllKeys(Constants.DefaultLibSourceDirectory, WorkbenchStorage.StandartDirectories);
            WorkbenchStorage.StandartDirectories.Add(Constants.LibSourceDirectoryIdent, WorkbenchStorage.LibSourceDirectory);
            AddSearchDebugPath(WorkbenchStorage.LibSourceDirectory);

            if (UserOptions.UseOutputDirectory)
                WorkbenchStorage.StandartDirectories.Add(Constants.OutputDirectoryIdent, UserOptions.OutputDirectory);
            else
                WorkbenchStorage.StandartDirectories.Add(Constants.OutputDirectoryIdent, null);

            RunManager RunnerManager = (WorkbenchServiceFactory.RunService as WorkbenchRunService).RunnerManager;
            VisualEnvironmentCompiler = new VisualEnvironmentCompiler(
                this.BeginInvoke, SetCompilingButtonsEnabled, SetDedugButtonsEnabled, SetStateText,
                AddTextToCompilerMessagesSync, miPlugins, toolStrip1,
                ExecuteSourceLocationAction, ExecuteVisualEnvironmentCompilerAction, ErrorsManager, RunnerManager,
                WorkbenchServiceFactory.DebuggerManager, UserOptions, WorkbenchStorage.StandartDirectories, OpenDocuments, this);
            if (OnEnvorimentEvent != null)
                OnEnvorimentEvent(EnvorimentEvent.VisualEnvironmentCompilerCreated);

            NavigationManager = new NavigationManager(ExecuteSourceLocationAction);
            NavigationManager.StateChanged += new NavigationManager.NavigationManagerStateChanged(NavigationManager_StateChanged);

            AddNewProgramToTab(MainDockPanel, InstNameNewProgramm(MainDockPanel));

            AddOptionsContent();
            Application.AddMessageFilter(this);

            if (DesignerUseable)
            {
                //miProperties.Visible = true;
                //miToolBox.Visible = true;
                //miNewAdv.Visible = true;
                miUndo.Visible = true;
            }
			this.mRPROJECTToolStripMenuItem.Visible = false;
            if (ProjectsUseable)
            {
            	miNewProject.Visible = true;
            	miRecentProjects.Visible = true;
            	//miCloseProject.Visible = true;
            	miOpenProject.Visible = true;
            }
            if (!UseImmediate)
            {
            	tsImmediateWindow.Visible = false;
            }
            this.mNEWASPToolStripMenuItem.Visible = DebugModus;
            if (!Tools.IsUnix())
                AddDesignerSidebars();

        }