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

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.GtkCore/libsteticui/CodeGeneratorPartialClass.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:
18
18
                        
19
19
                                // Generate top levels
20
20
                                foreach (Gtk.Widget w in gp.Toplevels)
21
 
                                        GenerateWidgetCode (globalUnit, globalNs, options, units, w, warnings);
 
21
                                        GenerateWidgetCode (globalUnit, globalNs, options, units, w, warnings, !options.GenerateModifiedOnly || gp.IsWidgetModified (w.Name));
22
22
                                        
23
23
                                // Generate global action groups
24
24
                                foreach (Wrapper.ActionGroup agroup in gp.ActionGroups)
34
34
                                unit = globalUnit;
35
35
                        else {
36
36
                                unit = new SteticCompilationUnit (name);
37
 
                                units.Add (unit);
 
37
                                if (units != null)
 
38
                                        units.Add (unit);
38
39
                        }
39
40
                        
40
41
                        string ns = "";
56
57
                }
57
58
                
58
59
                
59
 
                static void GenerateWidgetCode (SteticCompilationUnit globalUnit, CodeNamespace globalNs, GenerationOptions options, List<SteticCompilationUnit> units, Gtk.Widget w, ArrayList warnings)
 
60
                static void GenerateWidgetCode (SteticCompilationUnit globalUnit, CodeNamespace globalNs, GenerationOptions options, List<SteticCompilationUnit> units, Gtk.Widget w, ArrayList warnings, bool regenerateWidgetClass)
60
61
                {
61
 
                        // Generate the build method
62
 
                        
 
62
                        if (options.GenerateSingleFile)
 
63
                                regenerateWidgetClass = true;
 
64
 
 
65
                        // Don't register this unit if the class doesn't need to be regenerated
 
66
                        if (!regenerateWidgetClass)
 
67
                                units = null;
 
68
 
63
69
                        CodeTypeDeclaration type = CreatePartialClass (globalUnit, units, options, w.Name);
 
70
 
 
71
                        // Generate the build method
64
72
                        CodeMemberMethod met = new CodeMemberMethod ();
65
73
                        met.Name = "Build";
66
74
                        type.Members.Add (met);
67
75
                        met.ReturnType = new CodeTypeReference (typeof(void));
68
76
                        met.Attributes = MemberAttributes.Family;
69
 
                        
 
77
                                
70
78
                        Stetic.Wrapper.Widget wwidget = Stetic.Wrapper.Widget.Lookup (w);
71
79
 
72
 
                        if (options.GenerateEmptyBuildMethod) {
73
 
                                GenerateWrapperFields (type, wwidget);
74
 
                                return;
 
80
                        if (regenerateWidgetClass) {
 
81
 
 
82
                                if (options.GenerateEmptyBuildMethod) {
 
83
                                        GenerateWrapperFields (type, wwidget);
 
84
                                        return;
 
85
                                }
 
86
 
 
87
                                met.Statements.Add (
 
88
                                                new CodeMethodInvokeExpression (
 
89
                                                        new CodeTypeReferenceExpression (new CodeTypeReference (globalNs.Name + ".Gui", CodeTypeReferenceOptions.GlobalReference)),
 
90
                                                        "Initialize",
 
91
                                            new CodeThisReferenceExpression ()
 
92
                                                )
 
93
                                );
 
94
 
 
95
                                if (wwidget.GeneratePublic)
 
96
                                        type.TypeAttributes = TypeAttributes.Public;
 
97
                                else
 
98
                                        type.TypeAttributes = TypeAttributes.NotPublic;
 
99
                                
 
100
                                if (!String.IsNullOrEmpty (wwidget.UIManagerName))
 
101
                                        type.Members.Add (new CodeMemberField (new CodeTypeReference ("Gtk.UIManager", CodeTypeReferenceOptions.GlobalReference), wwidget.UIManagerName));
75
102
                        }
76
103
 
77
 
                        met.Statements.Add (
78
 
                                        new CodeMethodInvokeExpression (
79
 
                                                new CodeTypeReferenceExpression (new CodeTypeReference (globalNs.Name + ".Gui", CodeTypeReferenceOptions.GlobalReference)),
80
 
                                                "Initialize",
81
 
                                    new CodeThisReferenceExpression ()
82
 
                                        )
83
 
                        );
84
 
 
85
 
                        if (wwidget.GeneratePublic)
86
 
                                type.TypeAttributes = TypeAttributes.Public;
87
 
                        else
88
 
                                type.TypeAttributes = TypeAttributes.NotPublic;
89
 
                        
90
 
                        if (!String.IsNullOrEmpty (wwidget.UIManagerName))
91
 
                                type.Members.Add (new CodeMemberField (new CodeTypeReference ("Gtk.UIManager", CodeTypeReferenceOptions.GlobalReference), wwidget.UIManagerName));
 
104
                        // We need to generate the creation code even if regenerateWidgetClass is false because GenerateCreationCode
 
105
                        // may inject support classes or methods into the global namespace, which is always generated
92
106
 
93
107
                        Stetic.WidgetMap map = Stetic.CodeGenerator.GenerateCreationCode (globalNs, type, w, new CodeThisReferenceExpression (), met.Statements, options, warnings);
94
 
                        CodeGenerator.BindSignalHandlers (new CodeThisReferenceExpression (), wwidget, map, met.Statements, options);
 
108
 
 
109
                        if (regenerateWidgetClass)
 
110
                                CodeGenerator.BindSignalHandlers (new CodeThisReferenceExpression (), wwidget, map, met.Statements, options);
95
111
                }
96
112
                
97
113
                static void GenerateWrapperFields (CodeTypeDeclaration type, ObjectWrapper wrapper)