src/Builder4/ValaCompileResults.bjs
[app.Builder.js] / 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 Xcls_MainWindow window;
20     public bool active;
21
22     // ctor
23     public Xcls_ValaCompileResults()
24     {
25         _this = this;
26         this.el = new Gtk.Popover( null );
27
28         // my vars (dec)
29         this.active = true;
30
31         // set gobject values
32         this.el.width_request = 600;
33         this.el.height_request = 400;
34         this.el.modal = true;
35         this.el.position = Gtk.PositionType.TOP;
36         var child_0 = new Xcls_compile_view( _this );
37         child_0.ref();
38         this.el.add (  child_0.el  );
39     }
40
41     // user defined functions
42     public void show ( Gtk.Widget onbtn, bool reset) {
43         this.window.el.get_size(out w, out h);
44         
45         // left tree = 250, editor area = 500?
46         
47         var new_w = int.min(500, w-100);
48         if (new_w > (w-100)) {
49             new_w = w-100;
50         }
51         this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
52      
53     
54         if (this.el.relative_to == null) {
55             this.el.set_relative_to(onbtn);
56         }
57         this.el.show_all();
58        // not sure why..
59        
60        if (reset) {
61                 var buf = (Gtk.SourceBuffer)this.sourceview.el.get_buffer();
62                 buf.set_text("",0);
63         }
64        
65         while(Gtk.events_pending()) { 
66                 Gtk.main_iteration();
67         }
68         
69         
70         
71     }
72     public void addLine (string str) {
73         var buf = (Gtk.SourceBuffer)this.sourceview.get_buffer();
74         Gtk.TextIter iter;
75         buf.get_end_iter (out  iter);
76         buf.insert(ref iter, str, str.length);
77         /// scroll..
78         buf.get_end_iter (out  iter);
79         this.sourceview.el.scroll_to_iter(iter, 0.0f, true, 0.0f, 1.0f);
80         
81     
82     }
83     public class Xcls_compile_view : Object
84     {
85         public Gtk.Box el;
86         private Xcls_ValaCompileResults  _this;
87
88
89             // my vars (def)
90
91         // ctor
92         public Xcls_compile_view(Xcls_ValaCompileResults _owner )
93         {
94             _this = _owner;
95             _this.compile_view = this;
96             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
97
98             // my vars (dec)
99
100             // set gobject values
101             this.el.homogeneous = false;
102             var child_0 = new Xcls_ScrolledWindow3( _this );
103             child_0.ref();
104             this.el.pack_end (  child_0.el , true,true,0 );
105         }
106
107         // user defined functions
108     }
109     public class Xcls_ScrolledWindow3 : Object
110     {
111         public Gtk.ScrolledWindow el;
112         private Xcls_ValaCompileResults  _this;
113
114
115             // my vars (def)
116
117         // ctor
118         public Xcls_ScrolledWindow3(Xcls_ValaCompileResults _owner )
119         {
120             _this = _owner;
121             this.el = new Gtk.ScrolledWindow( null, null );
122
123             // my vars (dec)
124
125             // set gobject values
126             this.el.hexpand = true;
127             var child_0 = new Xcls_sourceview( _this );
128             child_0.ref();
129             this.el.add (  child_0.el  );
130
131             // init method
132
133             {
134              this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
135              
136             
137             }
138         }
139
140         // user defined functions
141     }
142     public class Xcls_sourceview : Object
143     {
144         public Gtk.SourceView el;
145         private Xcls_ValaCompileResults  _this;
146
147
148             // my vars (def)
149
150         // ctor
151         public Xcls_sourceview(Xcls_ValaCompileResults _owner )
152         {
153             _this = _owner;
154             _this.sourceview = this;
155             this.el = new Gtk.SourceView();
156
157             // my vars (dec)
158
159             // set gobject values
160             this.el.editable = false;
161             this.el.show_line_numbers = true;
162
163             // init method
164
165             {
166             
167                 var description =   Pango.FontDescription.from_string("monospace");
168                 description.set_size(8000);
169                 this.el.override_font(description);
170             
171             
172             }
173         }
174
175         // user defined functions
176     }
177
178
179
180 }