コード例 #1
0
        public CompilerOptionsPanelWidget(DotNetProject project)
        {
            this.Build();
            this.project = project;
            DotNetProjectConfiguration configuration = (DotNetProjectConfiguration) project.GetActiveConfiguration (IdeApp.Workspace.ActiveConfiguration);
            FSharpCompilerParameters compilerParameters = (FSharpCompilerParameters) configuration.CompilationParameters;

            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);

            // 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 == compilerParameters.CodePage)
                    foundEncoding = e.Id;
                codepageEntry.AppendText (e.Id);
            }
            if (foundEncoding != null)
                codepageEntry.Entry.Text = foundEncoding;
            else if (compilerParameters.CodePage != 0)
                codepageEntry.Entry.Text = compilerParameters.CodePage.ToString ();
        }