public void Load (DotNetProjectConfiguration configuration)
		{
			this.configuration = configuration;
			compilerParameters = (PlayScriptCompilerParameters) configuration.CompilationParameters;
			
			symbolsEntry.Text                          = compilerParameters.DefineSymbols;
			generateXmlOutputCheckButton.Active        = compilerParameters.GenerateXmlDocumentation;
			enableOptimizationCheckButton.Active       = compilerParameters.Optimize;
			generateOverflowChecksCheckButton.Active   = compilerParameters.GenerateOverflowChecks;
			warningsAsErrorsCheckButton.Active         = compilerParameters.TreatWarningsAsErrors;
			warningLevelSpinButton.Value               = compilerParameters.WarningLevel;
			additionalArgsEntry.Text                   = compilerParameters.AdditionalArguments;
			ignoreWarningsEntry.Text                   = compilerParameters.NoWarnings;
			
			int i = PlayScriptLanguageBinding.SupportedPlatforms.IndexOf (compilerParameters.PlatformTarget);
			comboPlatforms.Active = i != -1 ? i : 0;

			if (!configuration.DebugMode || string.Equals ("none", compilerParameters.DebugType, StringComparison.OrdinalIgnoreCase)) {
				comboDebug.Active = DEBUG_NONE;
			} else if (string.Equals ("pdbonly", compilerParameters.DebugType, StringComparison.OrdinalIgnoreCase)) {
				comboDebug.Active = DEBUG_PDB_ONLY;
			} else {
				comboDebug.Active = DEBUG_FULL;
			}
		}
Exemple #2
0
        public CompilerOptionsPanelWidget(DotNetProject project)
        {
            this.Build();
            this.project = project;
            DotNetProjectConfiguration   configuration      = (DotNetProjectConfiguration)project.GetConfiguration(IdeApp.Workspace.ActiveConfiguration);
            PlayScriptCompilerParameters compilerParameters = (PlayScriptCompilerParameters)configuration.CompilationParameters;
            PlayScriptProjectParameters  projectParameters  = (PlayScriptProjectParameters)configuration.ProjectParameters;

            ListStore store = new ListStore(typeof(string));

            store.AppendValues(GettextCatalog.GetString("Executable"));
            store.AppendValues(GettextCatalog.GetString("Library"));
            store.AppendValues(GettextCatalog.GetString("Executable with GUI"));
            store.AppendValues(GettextCatalog.GetString("Module"));
            compileTargetCombo.Model = store;
            CellRendererText cr = new CellRendererText();

            compileTargetCombo.PackStart(cr, true);
            compileTargetCombo.AddAttribute(cr, "text", 0);
            compileTargetCombo.Active   = (int)configuration.CompileTarget;
            compileTargetCombo.Changed += new EventHandler(OnTargetChanged);

            if (project.IsLibraryBasedProjectType)
            {
                //fixme: should we totally hide these?
                compileTargetCombo.Sensitive = false;
                mainClassEntry.Sensitive     = false;
            }
            else
            {
                classListStore                     = new ListStore(typeof(string));
                mainClassEntry.Model               = classListStore;
                mainClassEntry.TextColumn          = 0;
                ((Entry)mainClassEntry.Child).Text = projectParameters.MainClass ?? string.Empty;

                UpdateTarget();
            }

            // Load the codepage. If it matches any of the supported encodigs, use the encoding name
            string foundEncoding = null;

            foreach (TextEncoding e in TextEncoding.SupportedEncodings)
            {
                if (e.CodePage == -1)
                {
                    continue;
                }
                if (e.CodePage == projectParameters.CodePage)
                {
                    foundEncoding = e.Id;
                }
                codepageEntry.AppendText(e.Id);
            }
            if (foundEncoding != null)
            {
                codepageEntry.Entry.Text = foundEncoding;
            }
            else if (projectParameters.CodePage != 0)
            {
                codepageEntry.Entry.Text = projectParameters.CodePage.ToString();
            }

            iconEntry.Path                    = projectParameters.Win32Icon;
            iconEntry.DefaultPath             = project.BaseDirectory;
            allowUnsafeCodeCheckButton.Active = compilerParameters.UnsafeCode;
            noStdLibCheckButton.Active        = compilerParameters.NoStdLib;

            ListStore langVerStore = new ListStore(typeof(string));

            langVerStore.AppendValues(GettextCatalog.GetString("Default"));
            langVerStore.AppendValues("ISO-1");
            langVerStore.AppendValues("ISO-2");
            langVerStore.AppendValues("Version 3");
            langVerStore.AppendValues("Version 4");
            langVerStore.AppendValues("Version 5");
            langVerCombo.Model  = langVerStore;
            langVerCombo.Active = (int)compilerParameters.LangVersion;
        }
Exemple #3
0
        public void Store(ItemConfigurationCollection <ItemConfiguration> configs)
        {
            int           codePage;
            CompileTarget compileTarget = (CompileTarget)compileTargetCombo.Active;
            LangVersion   langVersion   = (LangVersion)langVerCombo.Active;


            if (codepageEntry.Entry.Text.Length > 0)
            {
                // Get the codepage. If the user specified an encoding name, find it.
                int trialCodePage = -1;
                foreach (TextEncoding e in TextEncoding.SupportedEncodings)
                {
                    if (e.Id == codepageEntry.Entry.Text)
                    {
                        trialCodePage = e.CodePage;
                        break;
                    }
                }

                if (trialCodePage != -1)
                {
                    codePage = trialCodePage;
                }
                else
                {
                    if (!int.TryParse(codepageEntry.Entry.Text, out trialCodePage))
                    {
                        return;
                    }
                    codePage = trialCodePage;
                }
            }
            else
            {
                codePage = 0;
            }

            project.CompileTarget = compileTarget;

            PlayScriptProjectParameters projectParameters = (PlayScriptProjectParameters)project.LanguageParameters;

            projectParameters.CodePage = codePage;

            if (iconEntry.Sensitive)
            {
                projectParameters.Win32Icon = iconEntry.Path;
            }

            if (mainClassEntry.Sensitive)
            {
                projectParameters.MainClass = mainClassEntry.Entry.Text;
            }

            foreach (DotNetProjectConfiguration configuration in configs)
            {
                PlayScriptCompilerParameters compilerParameters = (PlayScriptCompilerParameters)configuration.CompilationParameters;
                compilerParameters.UnsafeCode  = allowUnsafeCodeCheckButton.Active;
                compilerParameters.NoStdLib    = noStdLibCheckButton.Active;
                compilerParameters.LangVersion = langVersion;
            }
        }