2510146af80f374933dac6fe2b9b8dc99cb2c1e2
[roobuilder] / src / Builder4 / ValaCompileResults.vala
1     static Xcls_ValaCompileResults  _ValaCompileResults;
2
3     public class Xcls_ValaCompileResults : Object
4     {
5         public Gtk.Popover el;
6         private Xcls_ValaCompileResults  _this;
7
8         public static Xcls_ValaCompileResults singleton()
9         {
10             if (_ValaCompileResults == null) {
11                 _ValaCompileResults= new Xcls_ValaCompileResults();
12             }
13             return _ValaCompileResults;
14         }
15         public Xcls_compile_view compile_view;
16         public Xcls_sourceview sourceview;
17
18             // my vars (def)
19         public bool modal;
20         public Xcls_MainWindow window;
21         public bool active;
22
23         // ctor
24         public Xcls_ValaCompileResults()
25         {
26             _this = this;
27             this.el = new Gtk.Popover();
28
29             // my vars (dec)
30             this.modal = true;
31             this.active = true;
32
33             // set gobject values
34             this.el.width_request = 600;
35             this.el.height_request = 400;
36             this.el.position = Gtk.PositionType.TOP;
37             new Xcls_compile_view( _this );
38             this.el.set_child ( _this.compile_view.el  );
39         }
40
41         // user defined functions
42         public void xaddLine (string str) {
43                 /*
44                 if (this.window.windowstate.project.path != BuilderApplication.valasource.file.project.path) {
45                         // not our project.
46                         return;
47                 }
48                 
49                 
50                 var buf = (GtkSource.Buffer)this.sourceview.el.get_buffer();
51                 Gtk.TextIter iter;
52                 buf.get_end_iter (out  iter);
53                 buf.insert(ref iter, str, str.length);
54                 /// scroll..
55                 buf.get_end_iter (out  iter);
56                 this.sourceview.el.scroll_to_iter(iter, 0.0f, true, 0.0f, 1.0f);
57          */
58         }
59         public void show ( Gtk.Widget onbtn, bool reset) {
60                 var win = this.window.el;
61             var  w = win.get_width();
62             var h = win.get_height();
63         
64             // left tree = 250, editor area = 500?
65             
66             var new_w = int.min(750, w-100);
67             if (new_w > (w-100)) {
68                 new_w = w-100;
69             }
70             this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
71                 if (this.el.parent == null) {
72                         this.el.set_parent(win);
73                 }
74            // Gtk.Allocation rect;
75                 //onbtn.get_allocation(out rect);
76             //this.el.set_pointing_to(rect);
77         
78             this.el.popup();
79            // not sure why..
80            
81            if (reset) {
82                         var buf = (GtkSource.Buffer)this.sourceview.el.get_buffer();
83                         buf.set_text("",0);
84                 }
85            
86             
87             
88             
89         }
90         public class Xcls_compile_view : Object
91         {
92             public Gtk.Box el;
93             private Xcls_ValaCompileResults  _this;
94
95
96                 // my vars (def)
97
98             // ctor
99             public Xcls_compile_view(Xcls_ValaCompileResults _owner )
100             {
101                 _this = _owner;
102                 _this.compile_view = this;
103                 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
104
105                 // my vars (dec)
106
107                 // set gobject values
108                 this.el.homogeneous = false;
109                 this.el.hexpand = true;
110                 this.el.vexpand = true;
111                 var child_1 = new Xcls_ScrolledWindow3( _this );
112                 child_1.ref();
113                 this.el.append( child_1.el );
114             }
115
116             // user defined functions
117         }
118         public class Xcls_ScrolledWindow3 : Object
119         {
120             public Gtk.ScrolledWindow el;
121             private Xcls_ValaCompileResults  _this;
122
123
124                 // my vars (def)
125
126             // ctor
127             public Xcls_ScrolledWindow3(Xcls_ValaCompileResults _owner )
128             {
129                 _this = _owner;
130                 this.el = new Gtk.ScrolledWindow();
131
132                 // my vars (dec)
133
134                 // set gobject values
135                 this.el.hexpand = true;
136                 this.el.vexpand = true;
137                 new Xcls_sourceview( _this );
138                 this.el.child = _this.sourceview.el;
139
140                 // init method
141
142                 {
143                  this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
144                  
145                 
146                 }
147             }
148
149             // user defined functions
150         }
151         public class Xcls_sourceview : Object
152         {
153             public GtkSource.View el;
154             private Xcls_ValaCompileResults  _this;
155
156
157                 // my vars (def)
158             public Gtk.CssProvider css;
159
160             // ctor
161             public Xcls_sourceview(Xcls_ValaCompileResults _owner )
162             {
163                 _this = _owner;
164                 _this.sourceview = this;
165                 this.el = new GtkSource.View();
166
167                 // my vars (dec)
168
169                 // set gobject values
170                 this.el.name = "compile-results-view";
171                 this.el.editable = false;
172                 this.el.show_line_numbers = false;
173                 this.el.hexpand = true;
174                 this.el.vexpand = true;
175
176                 // init method
177
178                 {
179                 
180                         this.css = new Gtk.CssProvider();
181                          
182                         this.css.load_from_string(
183                                 "#compile-results-view { font: 10px monospace ;}"
184                         );
185                          
186                                         Gtk.StyleContext.add_provider_for_display(
187                                 this.el.get_display(),
188                                 this.css,
189                                 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
190                         );
191                                 
192                 
193                 }
194             }
195
196             // user defined functions
197         }
198
199
200
201     }