change run to use meson/ninja and then exec. - remove libvala code from application...
[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 show ( Gtk.Widget onbtn, bool reset) {
43                 var win = this.window.el;
44             var  w = win.get_width();
45             var h = win.get_height();
46         
47             // left tree = 250, editor area = 500?
48             
49             var new_w = int.min(750, w-100);
50             if (new_w > (w-100)) {
51                 new_w = w-100;
52             }
53             this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
54                 if (this.el.parent == null) {
55                         this.el.set_parent(win);
56                 }
57            // Gtk.Allocation rect;
58                 //onbtn.get_allocation(out rect);
59             //this.el.set_pointing_to(rect);
60         
61             this.el.popup();
62            // not sure why..
63            
64            if (reset) {
65                         var buf = (GtkSource.Buffer)this.sourceview.el.get_buffer();
66                         buf.set_text("",0);
67                 }
68            
69             
70             
71             
72         }
73         public void addLine (string str) {
74                  
75                 
76                 
77                 var buf = (GtkSource.Buffer)this.sourceview.el.get_buffer();
78                 Gtk.TextIter iter;
79                 buf.get_end_iter (out  iter);
80                 buf.insert(ref iter, str, str.length);
81                 /// scroll..
82                 buf.get_end_iter (out  iter);
83                 this.sourceview.el.scroll_to_iter(iter, 0.0f, true, 0.0f, 1.0f);
84          
85         }
86         public class Xcls_compile_view : Object
87         {
88                 public Gtk.Box el;
89                 private Xcls_ValaCompileResults  _this;
90
91
92                         // my vars (def)
93
94                 // ctor
95                 public Xcls_compile_view(Xcls_ValaCompileResults _owner )
96                 {
97                         _this = _owner;
98                         _this.compile_view = this;
99                         this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
100
101                         // my vars (dec)
102
103                         // set gobject values
104                         this.el.homogeneous = false;
105                         this.el.hexpand = true;
106                         this.el.vexpand = true;
107                         var child_1 = new Xcls_ScrolledWindow3( _this );
108                         child_1.ref();
109                         this.el.append( child_1.el );
110                 }
111
112                 // user defined functions
113         }
114         public class Xcls_ScrolledWindow3 : Object
115         {
116                 public Gtk.ScrolledWindow el;
117                 private Xcls_ValaCompileResults  _this;
118
119
120                         // my vars (def)
121
122                 // ctor
123                 public Xcls_ScrolledWindow3(Xcls_ValaCompileResults _owner )
124                 {
125                         _this = _owner;
126                         this.el = new Gtk.ScrolledWindow();
127
128                         // my vars (dec)
129
130                         // set gobject values
131                         this.el.hexpand = true;
132                         this.el.vexpand = true;
133                         new Xcls_sourceview( _this );
134                         this.el.child = _this.sourceview.el;
135
136                         // init method
137
138                         {
139                          this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
140                          
141                         
142                         }
143                 }
144
145                 // user defined functions
146         }
147         public class Xcls_sourceview : Object
148         {
149                 public GtkSource.View el;
150                 private Xcls_ValaCompileResults  _this;
151
152
153                         // my vars (def)
154                 public Gtk.CssProvider css;
155
156                 // ctor
157                 public Xcls_sourceview(Xcls_ValaCompileResults _owner )
158                 {
159                         _this = _owner;
160                         _this.sourceview = this;
161                         this.el = new GtkSource.View();
162
163                         // my vars (dec)
164
165                         // set gobject values
166                         this.el.name = "compile-results-view";
167                         this.el.editable = false;
168                         this.el.show_line_numbers = false;
169                         this.el.hexpand = true;
170                         this.el.vexpand = true;
171
172                         // init method
173
174                         {
175                         
176                                 this.css = new Gtk.CssProvider();
177                                  
178                                 this.css.load_from_string(
179                                         "#compile-results-view { font: 10px monospace ;}"
180                                 );
181                                  
182                                                 Gtk.StyleContext.add_provider_for_display(
183                                         this.el.get_display(),
184                                         this.css,
185                                         Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
186                                 );
187                                         
188                         
189                         }
190                 }
191
192                 // user defined functions
193         }
194
195
196
197 }