~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
        class GuiBuilderService
50
50
        {
51
51
                static string GuiBuilderLayout = "Visual Design";
 
52
                static int loadedGuiProjects;
52
53
                
53
54
#if DUMMY_STRINGS_FOR_TRANSLATION_DO_NOT_COMPILE
54
55
                private void DoNotCompile ()
71
72
                {
72
73
                        if (IdeApp.Workbench == null)
73
74
                                return;
74
 
                        IdeApp.Workbench.ActiveDocumentChanged += new EventHandler (OnActiveDocumentChanged);
75
 
                        IdeApp.ProjectOperations.EndBuild += OnProjectCompiled;
76
75
//                      IdeApp.Workspace.ParserDatabase.AssemblyInformationChanged += (AssemblyInformationEventHandler) DispatchService.GuiDispatch (new AssemblyInformationEventHandler (OnAssemblyInfoChanged));
77
76
                        
78
77
                        IdeApp.Exited += delegate {
82
81
                                }
83
82
                        };
84
83
                }
85
 
                
 
84
 
 
85
                static void InitializeService ()
 
86
                {
 
87
                        IdeApp.ProjectOperations.EndBuild += OnProjectCompiled;
 
88
                        IdeApp.Workbench.ActiveDocumentChanged += OnActiveDocumentChanged;
 
89
                }
 
90
 
 
91
                static void ShutdownService ()
 
92
                {
 
93
                        IdeApp.ProjectOperations.EndBuild -= OnProjectCompiled;
 
94
                        IdeApp.Workbench.ActiveDocumentChanged -= OnActiveDocumentChanged;
 
95
                        if (steticApp != null) {
 
96
                                StoreConfiguration ();
 
97
                                steticApp.Dispose ();
 
98
                                steticApp = null;
 
99
                        }
 
100
                }
 
101
 
 
102
                public static GuiBuilderProject CreateBuilderProject (DotNetProject project, string fileName)
 
103
                {
 
104
                        return new GuiBuilderProject (project, fileName);
 
105
                }
 
106
 
86
107
                public static Stetic.Application SteticApp {
87
108
                        get {
88
109
                                // Stetic is not thread safe, so all has to be done in the gui thread
98
119
                                return steticApp;
99
120
                        }
100
121
                }
 
122
 
 
123
                internal static void NotifyGuiProjectLoaded ()
 
124
                {
 
125
                        if (++loadedGuiProjects == 1)
 
126
                                InitializeService ();
 
127
                }
 
128
 
 
129
                internal static void NotifyGuiProjectUnloaded ()
 
130
                {
 
131
                        if (--loadedGuiProjects == 0)
 
132
                                ShutdownService ();
 
133
                }
101
134
                
102
135
                static string OnAssemblyResolve (string assemblyName)
103
136
                {
200
233
                                // being used by the IDE. This will avoid unnecessary updates.
201
234
                                if (IdeApp.Workspace.IsOpen) {
202
235
                                        foreach (Project prj in IdeApp.Workspace.GetAllProjects ()) {
203
 
                                                if (!HasOpenDesigners (prj, false)) {
 
236
                                                if (!HasOpenDesigners (prj, false) && GtkDesignInfo.HasDesignedObjects (prj)) {
204
237
                                                        GtkDesignInfo info = GtkDesignInfo.FromProject (prj);
205
238
                                                        info.ReloadGuiBuilderProject ();
206
239
                                                }
207
240
                                        }
208
241
                                }
209
 
                                
 
242
 
210
243
                                SteticApp.UpdateWidgetLibraries (false);
211
244
                        }
212
245
                }
361
394
                                DateTime last_gen_time = File.Exists (info.SteticGeneratedFile) ? File.GetLastWriteTime (info.SteticGeneratedFile) : DateTime.MinValue;
362
395
                                
363
396
                                bool ref_changed = false;
364
 
                                foreach (ProjectReference pref in project.References) {
 
397
 
 
398
                                // Disabled check for changes in referenced assemblies, since it cause too much
 
399
                                // regeneration of code. If a component has changed in a referenced project, this
 
400
                                // project may not build, but this can be solved by editing some file in the
 
401
                                // designer and saving.
 
402
 
 
403
/*                              foreach (ProjectReference pref in project.References) {
365
404
                                        if (!pref.IsValid)
366
405
                                                continue;
367
406
                                        foreach (string filename in pref.GetReferencedFileNames (configuration)) {
372
411
                                        }
373
412
                                        if (ref_changed)
374
413
                                                break;
375
 
                                }
 
414
                                }*/
376
415
        
377
416
                                // Check if generated code is already up to date.
378
417
                                if (!ref_changed && last_gen_time >= File.GetLastWriteTime (info.SteticFile))
440
479
                                                options.GettextClass = info.GettextClass;
441
480
                                                options.UsePartialClasses = project.UsePartialTypes;
442
481
                                                options.GenerateSingleFile = false;
 
482
                                                options.GenerateModifiedOnly = true;
443
483
                                                generationResult = SteticApp.GenerateProjectCode (options, info.GuiBuilderProject.SteticProject);
 
484
                                                info.GuiBuilderProject.SteticProject.ResetModifiedWidgetFlags ();
444
485
                                        } catch (Exception ex) {
445
486
                                                generatedException = ex;
446
487
                                        }