Beispiel #1
0
        protected override void OnEndLoad()
        {
            base.OnEndLoad();

            // Backwards compatibility. Move parameters to the project parameters object
            if (ParentConfiguration != null && ParentConfiguration.ProjectParameters != null)
            {
                CSharpProjectParameters cparams = (CSharpProjectParameters)ParentConfiguration.ProjectParameters;
                if (win32Icon != null)
                {
                    cparams.Win32Icon = win32Icon;
                    win32Icon         = null;
                }
                if (win32Resource != null)
                {
                    cparams.Win32Resource = win32Resource;
                    win32Resource         = null;
                }
                if (mainclass != null)
                {
                    cparams.MainClass = mainclass;
                    mainclass         = null;
                }
                if (!string.IsNullOrEmpty(codePage))
                {
                    cparams.CodePage = int.Parse(codePage);
                    codePage         = null;
                }
            }
        }
        protected override void OnEndLoad()
        {
            base.OnEndLoad();

            // Backwards compatibility. Move parameters to the project parameters object
            if (ParentConfiguration != null && ParentConfiguration.ProjectParameters != null)
            {
                CSharpProjectParameters cparams = (CSharpProjectParameters)ParentConfiguration.ProjectParameters;
                if (win32Icon != null)
                {
                    cparams.Win32Icon = win32Icon;
                    win32Icon         = null;
                }
                if (win32Resource != null)
                {
                    cparams.Win32Resource = win32Resource;
                    win32Resource         = null;
                }
                if (mainclass != null)
                {
                    cparams.MainClass = mainclass;
                    mainclass         = null;
                }
                if (!string.IsNullOrEmpty(codePage))
                {
                    cparams.CodePage = int.Parse(codePage);
                    codePage         = null;
                }
            }

            if (generateXmlDocumentation.HasValue && ParentConfiguration != null)
            {
                if (generateXmlDocumentation.Value)
                {
                    documentationFile = ParentConfiguration.CompiledOutputName.ChangeExtension(".xml");
                }
                else
                {
                    documentationFile = null;
                }
                generateXmlDocumentation = null;
            }
        }
Beispiel #3
0
        public CompilerOptionsPanelWidget(DotNetProject project)
        {
            this.Build();
            this.project = project;
            DotNetProjectConfiguration configuration      = (DotNetProjectConfiguration)project.GetConfiguration(IdeApp.Workspace.ActiveConfiguration);
            CSharpCompilerParameters   compilerParameters = (CSharpCompilerParameters)configuration.CompilationParameters;
            CSharpProjectParameters    projectParameters  = (CSharpProjectParameters)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;

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

            langVerStore.AppendValues(GettextCatalog.GetString("Default"));
            langVerStore.AppendValues("ISO-1");
            langVerStore.AppendValues("ISO-2");
            langVerCombo.Model  = langVerStore;
            langVerCombo.Active = (int)compilerParameters.LangVersion;
        }
Beispiel #4
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;

            CSharpProjectParameters projectParameters = (CSharpProjectParameters)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)
            {
                CSharpCompilerParameters compilerParameters = (CSharpCompilerParameters)configuration.CompilationParameters;
                compilerParameters.UnsafeCode  = allowUnsafeCodeCheckButton.Active;
                compilerParameters.LangVersion = langVersion;
            }
        }