~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric-updates

« back to all changes in this revision

Viewing changes to src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/OutputOptionsPanel.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2009-02-18 08:40:51 UTC
  • mfrom: (1.2.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090218084051-gh8m6ukvokbwj7cf
Tags: 1.9.2+dfsg-1ubuntu1
* Merge from Debian Experimental (LP: #330519), remaining Ubuntu changes:
  + debian/control:
    - Update for Gnome# 2.24
    - Add libmono-cairo1.0-cil to build-deps to fool pkg-config check

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
using System.IO;
23
23
 
24
24
using MonoDevelop.Projects;
 
25
using MonoDevelop.Core.Gui;
25
26
using MonoDevelop.Core.Gui.Dialogs;
26
27
using MonoDevelop.Components;
27
28
using MonoDevelop.Core;
30
31
 
31
32
namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels
32
33
{
33
 
        internal class OutputOptionsPanel : AbstractOptionPanel
 
34
        internal class OutputOptionsPanel : MultiConfigItemOptionsPanel
34
35
        {
35
36
                OutputOptionsPanelWidget  widget;
36
 
                public override void LoadPanelContents()
37
 
                {
38
 
                        Add (widget = new  OutputOptionsPanelWidget ((Properties) CustomizationObject));
39
 
                }
40
 
                
41
 
                public override bool StorePanelContents()
42
 
                {
43
 
                        bool result = true;
44
 
                        result = widget.Store ();
45
 
                        return result;
 
37
                
 
38
                public override bool IsVisible ()
 
39
                {
 
40
                        return ConfiguredProject is DotNetProject;
 
41
                }
 
42
 
 
43
                public override Widget CreatePanelWidget()
 
44
                {
 
45
                        return (widget = new OutputOptionsPanelWidget ());
 
46
                }
 
47
                
 
48
                public override bool ValidateChanges ()
 
49
                {
 
50
                        return widget.ValidateChanges ();
 
51
                }
 
52
                
 
53
                public override void LoadConfigData ()
 
54
                {
 
55
                        widget.Load (ConfiguredProject, (DotNetProjectConfiguration) CurrentConfiguration);
 
56
                }
 
57
 
 
58
                
 
59
                public override void ApplyChanges()
 
60
                {
 
61
                        widget.Store ();
46
62
                }
47
63
        }
48
64
 
50
66
        partial class OutputOptionsPanelWidget : Gtk.Bin 
51
67
        {
52
68
                DotNetProjectConfiguration configuration;
53
 
                Project project;
54
69
 
55
 
                public  OutputOptionsPanelWidget(Properties CustomizationObject)
56
 
                {       
 
70
                public OutputOptionsPanelWidget ()
 
71
                {
57
72
                        Build ();
58
 
                        configuration = ((Properties)CustomizationObject).Get<DotNetProjectConfiguration>("Config");
59
 
                        project = ((Properties)CustomizationObject).Get<Project>("Project");
60
 
                        externalConsoleCheckButton.Toggled += new EventHandler (ExternalConsoleToggle);
61
 
                        
 
73
                }
 
74
                
 
75
                public void Load (Project project, DotNetProjectConfiguration config)
 
76
                {       
 
77
                        this.configuration = config;
62
78
                        assemblyNameEntry.Text = configuration.OutputAssembly;
63
 
                        parametersEntry.Text = configuration.CommandLineParameters;
64
79
                        
65
80
                        outputPathEntry.DefaultPath = project.BaseDirectory;
66
81
                        outputPathEntry.Path = configuration.OutputDirectory;
67
 
                        
68
 
                        externalConsoleCheckButton.Active = configuration.ExternalConsole;
69
 
                        pauseConsoleOutputCheckButton.Active = configuration.PauseConsoleOutput;
70
 
                        
71
 
                        if (!externalConsoleCheckButton.Active)
72
 
                                pauseConsoleOutputCheckButton.Sensitive = false;
73
82
                }
74
83
 
75
 
                public bool Store ()
76
 
                {       
 
84
                public bool ValidateChanges ()
 
85
                {
77
86
                        if (configuration == null) {
78
87
                                return true;
79
88
                        }
80
89
                        
81
90
                        if (!FileService.IsValidFileName (assemblyNameEntry.Text)) {
82
 
                                Services.MessageService.ShowError (null, GettextCatalog.GetString ("Invalid assembly name specified"), (Gtk.Window) Toplevel, true);
 
91
                                MessageService.ShowError (GettextCatalog.GetString ("Invalid assembly name specified"));
83
92
                                return false;
84
93
                        }
85
94
 
86
 
                        if (!FileService.IsValidFileName (outputPathEntry.Path)) {
87
 
                                Services.MessageService.ShowError (null, GettextCatalog.GetString ("Invalid output directory specified"), (Gtk.Window) Toplevel, true);
 
95
                        if (!FileService.IsValidPath (outputPathEntry.Path)) {
 
96
                                MessageService.ShowError (GettextCatalog.GetString ("Invalid output directory specified"));
88
97
                                return false;
89
98
                        }
90
99
                        
 
100
                        return true;
 
101
                }
 
102
                
 
103
                public void Store ()
 
104
                {       
 
105
                        if (configuration == null)
 
106
                                return;
 
107
                        
91
108
                        configuration.OutputAssembly = assemblyNameEntry.Text;
92
109
                        configuration.OutputDirectory = outputPathEntry.Path;
93
 
                        configuration.CommandLineParameters = parametersEntry.Text;
94
 
                                configuration.ExternalConsole = externalConsoleCheckButton.Active;
95
 
                        configuration.PauseConsoleOutput = pauseConsoleOutputCheckButton.Active;
96
 
                        return true;
97
 
                }
98
 
                
99
 
                void ExternalConsoleToggle (object sender, EventArgs e)
100
 
                {
101
 
                        if (externalConsoleCheckButton.Active) {
102
 
                                pauseConsoleOutputCheckButton.Sensitive = true;
103
 
                                pauseConsoleOutputCheckButton.Active = true;
104
 
                        } else {
105
 
                                pauseConsoleOutputCheckButton.Sensitive = false;
106
 
                                pauseConsoleOutputCheckButton.Active = false;
107
 
                        }
108
110
                }
109
111
        }
110
112
}