a893ee6810c74dfb35d8881051b8e12a740785e3
[roobuilder] / src / Builder4 / Editor.vala
1 static Editor  _Editor;
2
3 public class Editor : Object
4 {
5         public Gtk.Box el;
6         private Editor  _this;
7
8         public static Editor singleton()
9         {
10                 if (_Editor == null) {
11                     _Editor= new Editor();
12                 }
13                 return _Editor;
14         }
15         public Xcls_save_button save_button;
16         public Xcls_close_btn close_btn;
17         public Xcls_RightEditor RightEditor;
18         public Xcls_view view;
19         public Xcls_buffer buffer;
20         public Xcls_keystate keystate;
21         public Xcls_search_entry search_entry;
22         public Xcls_search_results search_results;
23         public Xcls_nextBtn nextBtn;
24         public Xcls_backBtn backBtn;
25         public Xcls_search_settings search_settings;
26         public Xcls_case_sensitive case_sensitive;
27         public Xcls_regex regex;
28         public Xcls_multiline multiline;
29
30                 // my vars (def)
31         public int pos_root_x;
32         public Xcls_MainWindow window;
33         public bool dirty;
34         public int pos_root_y;
35         public bool pos;
36         public int last_error_counter;
37         public GtkSource.SearchContext searchcontext;
38         public int last_search_end;
39         public signal void save ();
40         public JsRender.JsRender? file;
41         public JsRender.Node node;
42         public JsRender.NodeProp? prop;
43         public string activeEditor;
44
45         // ctor
46         public Editor()
47         {
48                 _this = this;
49                 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
50
51                 // my vars (dec)
52                 this.window = null;
53                 this.dirty = false;
54                 this.pos = false;
55                 this.last_error_counter = 0;
56                 this.searchcontext = null;
57                 this.last_search_end = 0;
58                 this.file = null;
59                 this.node = null;
60                 this.prop = null;
61                 this.activeEditor = "";
62
63                 // set gobject values
64                 this.el.homogeneous = false;
65                 this.el.hexpand = true;
66                 this.el.vexpand = true;
67                 var child_1 = new Xcls_Box1( _this );
68                 child_1.ref();
69                 this.el.append( child_1.el );
70                 new Xcls_RightEditor( _this );
71                 this.el.append( _this.RightEditor.el );
72                 var child_3 = new Xcls_Box12( _this );
73                 child_3.ref();
74                 this.el.append ( child_3.el  );
75         }
76
77         // user defined functions
78         public bool saveContents ()  {
79             
80             
81             if (_this.file == null) {
82                 return true;
83             }
84             
85              
86              
87              var str = _this.buffer.toString();
88              
89              _this.buffer.checkSyntax();
90              
91              
92              
93              // LeftPanel.model.changed(  str , false);
94              _this.dirty = false;
95              _this.save_button.el.sensitive = false;
96              
97             // find the text for the node..
98             if (_this.file.xtype != "PlainFile") {
99                // in theory these properties have to exist!?!
100                 this.prop.val = str;
101                 //this.window.windowstate.left_props.reload();
102             } else {
103                 _this.file.setSource(  str );
104              }
105             
106             // call the signal..
107             this.save();
108             
109             return true;
110         
111         }
112         public void forwardSearch (bool change_focus) {
113         
114                 if (this.searchcontext == null) {
115                         return;
116                 } 
117         
118                 Gtk.TextIter beg, st,en;
119                  bool has_wrapped_around;
120                 this.buffer.el.get_iter_at_offset(out beg, this.last_search_end);
121                 if (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {
122                 
123                         this.last_search_end = 0; // not sure if this should happen
124                 } else {
125                         if (has_wrapped_around) {
126                                 return;
127                         }
128                 
129                         this.last_search_end = en.get_offset();
130                         if (change_focus) {
131                                 this.view.el.grab_focus();
132                         }
133                         this.buffer.el.place_cursor(st);
134                         this.view.el.scroll_to_iter(st,  0.1f, true, 0.0f, 0.5f);
135                 }
136          
137         }
138         public void show (JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)
139         {
140             this.reset();
141             this.file = file;    
142             
143             if (file.xtype != "PlainFile") {
144                 this.prop = prop;
145                 this.node = node;
146         
147                 // find the text for the node..
148                 this.view.load( prop.val );
149                 this.updateErrorMarks();
150                 
151                 this.close_btn.el.show();       
152             
153             } else {
154                 this.view.load(        file.toSource() );
155                  this.updateErrorMarks();
156                 this.close_btn.el.hide();
157                 
158             }
159          
160         }
161         public void backSearch (bool change_focus) {
162         
163                 if (this.searchcontext == null) {
164                         return;
165                 }
166                 
167                 Gtk.TextIter beg, st,en;
168                 bool has_wrapped_around;
169                 this.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );
170                 
171                 if (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {
172                         this.last_search_end = 0;
173                 } else {
174                         this.last_search_end = en.get_offset();
175                         if (change_focus) {
176                                 this.view.el.grab_focus();
177                         }
178                         this.buffer.el.place_cursor(st);
179                         this.view.el.scroll_to_iter(st,  0.1f, true, 0.0f, 0.5f);
180                 }
181         
182         }
183         public string tempFileContents () {
184            
185            
186            if (_this.file == null) {
187                return "";
188            }
189                 var str= this.buffer.toString();
190                 if (_this.file.xtype == "PlainFile") {
191             
192                 return str;
193             
194             }
195           
196               
197              
198             GLib.debug("calling validate");    
199             // clear the buttons.
200                 if (_this.prop.name == "xns" || _this.prop.name == "xtype") {
201                         return this.file.toSource(); ;
202                 }
203                 
204                 var oldcode  = _this.prop.val;
205                 _this.prop.val = str;
206             var ret = _this.file.toSource();
207             _this.prop.val = oldcode;
208             return ret;
209             
210         }
211         public void reset () {
212                  this.file = null;    
213              
214             this.node = null;
215             this.prop = null;
216                 this.searchcontext = null;
217           
218         }
219         public int search (string in_txt) {
220         
221                 var s = new GtkSource.SearchSettings();
222                 s.case_sensitive = _this.case_sensitive.el.active;
223                 s.regex_enabled = _this.regex.el.active;        
224                 s.wrap_around = false;
225                 
226                 this.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);
227                 this.searchcontext.set_highlight(true);
228                 var txt = in_txt;
229                 
230                 if (_this.multiline.el.active) {
231                         txt = in_txt.replace("\\n", "\n");
232                 }
233                 
234                 s.set_search_text(txt);
235                 Gtk.TextIter beg, st,en;
236                  
237                 this.buffer.el.get_start_iter(out beg);
238                 bool has_wrapped_around;
239                 this.searchcontext.forward(beg, out st, out en, out has_wrapped_around);
240                 this.last_search_end = 0;
241                 
242                 return this.searchcontext.get_occurrences_count();
243         
244          
245            
246         
247         }
248         public void updateErrorMarks () {
249                 
250          
251         
252                 var buf = _this.buffer.el;
253                 Gtk.TextIter start;
254                 Gtk.TextIter end;     
255                 buf.get_bounds (out start, out end);
256         
257                 
258         
259          
260                 //GLib.debug("highlight errors");                
261         
262                  // we should highlight other types of errors..
263         
264                 if (_this.window.windowstate.state != WindowState.State.CODEONLY 
265                         &&
266                         _this.window.windowstate.state != WindowState.State.CODE
267                         ) {
268                         //GLib.debug("windowstate != CODEONLY?");
269                         
270                         return;
271                 } 
272         
273                  
274                 if (_this.file == null) {
275                         GLib.debug("file is null?");
276                         return;
277         
278                 }
279                 var ar = this.file.getErrors();
280                 if (ar.size < 1) {
281                         buf.remove_source_marks (start, end, "ERR");
282                         buf.remove_source_marks (start, end, "WARN");
283                         buf.remove_source_marks (start, end, "DEPR");
284                         buf.remove_tag_by_name ("ERR", start, end);
285                         buf.remove_tag_by_name ("WARN", start, end);
286                         buf.remove_tag_by_name ("DEPR", start, end);
287                         this.last_error_counter = file.error_counter ;
288                         //GLib.debug("highlight %s :  %s has no errors", this.file.relpath, category);
289                         return;
290                 }
291                 
292         
293          // basicaly check if there is no change, then we do not do any update..
294          // we can do this by just using an error counter?
295          // if that's changed then we will do an update, otherwise dont bother.
296                   
297                 
298                 var offset = 0;
299                 var hoffset = 0;
300         
301                 var tlines = buf.get_line_count () +1;
302                 
303                 if (_this.prop != null) {
304                         // this still seems flaky...
305         
306                         tlines = _this.prop.end_line;
307                         offset = _this.prop.start_line;
308                         hoffset = _this.node.node_pad.length + 2; //shift it left  by 2 ? ..
309                         
310                          
311                 } else {
312                         // no update...
313                         if (this.last_error_counter == file.error_counter) {
314                         
315                                 return;
316                         }
317                 
318                 }
319                 buf.remove_source_marks (start, end, "ERR");
320                 buf.remove_source_marks (start, end, "WARN");
321                 buf.remove_source_marks (start, end, "DEPR");
322                 buf.remove_tag_by_name ("ERR", start, end);
323                 buf.remove_tag_by_name ("WARN", start, end);
324                 buf.remove_tag_by_name ("DEPR", start, end);
325                 
326                 foreach(var diag in ar) { 
327                      Gtk.TextIter iter;
328         //        print("get inter\n");
329                     var eline = (int)diag.range.start.line - offset;
330                     var eline_to = (int)diag.range.end.line - offset;
331                     //var eline =  diag.range.end_line - offset;
332                     //GLib.debug("GOT ERROR on line %d -- converted to %d  (offset = %d)",
333                     //  err.line ,eline, offset);
334                     
335                     
336                     if (eline > tlines || eline < 0) {
337                         continue;
338                     }
339                     
340                     buf.get_iter_at_line( out iter, eline);
341                         var msg = "Line: %d %s : %s".printf(eline+1, diag.category, diag.message);
342                     buf.create_source_mark( msg, diag.category, iter);
343                     
344                     var spos = (int)diag.range.start.character - hoffset;
345                     if (spos < 0) { spos =0 ; }
346                     if (spos > iter.get_chars_in_line()) {
347                         spos = iter.get_chars_in_line();
348                 }
349                         buf.get_iter_at_line( out iter, eline_to);
350                         var epos = (int)diag.range.end.character - hoffset;
351                     if (epos < 0) { epos =0 ; }
352                     if (epos > iter.get_chars_in_line()) {
353                         epos = iter.get_chars_in_line();
354                 }
355                      
356                     
357                     buf.get_iter_at_line_offset( out start, eline, spos); 
358                    
359                     buf.get_iter_at_line_offset( out end, eline_to,epos); 
360                         
361                     buf.apply_tag_by_name(diag.category, start, end);
362                     
363                    // GLib.debug("set line %d to %s", eline, msg);
364                     //this.marks.set(eline, msg);
365                 }
366                 this.last_error_counter = file.error_counter ;
367         
368         
369         
370          
371         
372         }
373         public void scroll_to_line (int line) {
374         
375                 GLib.Timeout.add(500, () => {
376            
377                         var buf = this.view.el.get_buffer();
378         
379                         var sbuf = (GtkSource.Buffer) buf;
380         
381         
382                         Gtk.TextIter iter;   
383                         sbuf.get_iter_at_line(out iter,  line);
384                         this.view.el.scroll_to_iter(iter,  0.1f, true, 0.0f, 0.5f);
385                         return false;
386                 });   
387         }
388         public class Xcls_Box1 : Object
389         {
390                 public Gtk.Box el;
391                 private Editor  _this;
392
393
394                         // my vars (def)
395
396                 // ctor
397                 public Xcls_Box1(Editor _owner )
398                 {
399                         _this = _owner;
400                         this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
401
402                         // my vars (dec)
403
404                         // set gobject values
405                         this.el.homogeneous = false;
406                         this.el.hexpand = true;
407                         new Xcls_save_button( _this );
408                         this.el.append( _this.save_button.el );
409                         var child_2 = new Xcls_Label3( _this );
410                         child_2.ref();
411                         this.el.append( child_2.el );
412                         var child_3 = new Xcls_Scale4( _this );
413                         child_3.ref();
414                         this.el.append( child_3.el );
415                         new Xcls_close_btn( _this );
416                         this.el.append( _this.close_btn.el );
417                 }
418
419                 // user defined functions
420         }
421         public class Xcls_save_button : Object
422         {
423                 public Gtk.Button el;
424                 private Editor  _this;
425
426
427                         // my vars (def)
428
429                 // ctor
430                 public Xcls_save_button(Editor _owner )
431                 {
432                         _this = _owner;
433                         _this.save_button = this;
434                         this.el = new Gtk.Button();
435
436                         // my vars (dec)
437
438                         // set gobject values
439                         this.el.label = "Save";
440
441                         //listeners
442                         this.el.clicked.connect( () => { 
443                             _this.saveContents();
444                         });
445                 }
446
447                 // user defined functions
448         }
449
450         public class Xcls_Label3 : Object
451         {
452                 public Gtk.Label el;
453                 private Editor  _this;
454
455
456                         // my vars (def)
457
458                 // ctor
459                 public Xcls_Label3(Editor _owner )
460                 {
461                         _this = _owner;
462                         this.el = new Gtk.Label( null );
463
464                         // my vars (dec)
465
466                         // set gobject values
467                         this.el.hexpand = true;
468                 }
469
470                 // user defined functions
471         }
472
473         public class Xcls_Scale4 : Object
474         {
475                 public Gtk.Scale el;
476                 private Editor  _this;
477
478
479                         // my vars (def)
480
481                 // ctor
482                 public Xcls_Scale4(Editor _owner )
483                 {
484                         _this = _owner;
485                         this.el = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1);
486
487                         // my vars (dec)
488
489                         // set gobject values
490                         this.el.width_request = 200;
491                         this.el.has_origin = true;
492                         this.el.draw_value = false;
493                         this.el.digits = 0;
494                         this.el.sensitive = true;
495
496                         // init method
497
498                         {
499                                 //this.el.set_range(6,30);
500                                 this.el.set_value ( BuilderApplication.settings.editor_font_size);
501                                 BuilderApplication.settings.editor_font_size_updated.connect(
502                                         () => {
503                                                 BuilderApplication.settings.editor_font_size_inchange = true;
504                                         //      GLib.debug("update range");
505                                                 this.el.set_value (BuilderApplication.settings.editor_font_size);
506                                                 BuilderApplication.settings.editor_font_size_inchange = false;
507                                         }
508                                 );
509                                 
510                          
511                         }
512
513                         //listeners
514                         this.el.change_value.connect( (st, val ) => {
515                                 if (BuilderApplication.settings.editor_font_size_inchange) {
516                                         return false;
517                                 }
518                                 BuilderApplication.settings.editor_font_size = val;
519                                 return false;
520                         });
521                 }
522
523                 // user defined functions
524         }
525
526         public class Xcls_close_btn : Object
527         {
528                 public Gtk.Button el;
529                 private Editor  _this;
530
531
532                         // my vars (def)
533
534                 // ctor
535                 public Xcls_close_btn(Editor _owner )
536                 {
537                         _this = _owner;
538                         _this.close_btn = this;
539                         this.el = new Gtk.Button();
540
541                         // my vars (dec)
542
543                         // set gobject values
544                         this.el.icon_name = "window-close";
545                         var child_1 = new Xcls_Image6( _this );
546                         child_1.ref();
547                         this.el.child = child_1.el;
548
549                         //listeners
550                         this.el.clicked.connect( () => { 
551                             _this.saveContents();
552                             _this.window.windowstate.switchState(WindowState.State.PREVIEW);
553                         });
554                 }
555
556                 // user defined functions
557         }
558         public class Xcls_Image6 : Object
559         {
560                 public Gtk.Image el;
561                 private Editor  _this;
562
563
564                         // my vars (def)
565
566                 // ctor
567                 public Xcls_Image6(Editor _owner )
568                 {
569                         _this = _owner;
570                         this.el = new Gtk.Image();
571
572                         // my vars (dec)
573
574                         // set gobject values
575                         this.el.icon_name = "window-close";
576                         this.el.icon_size = Gtk.IconSize.NORMAL;
577                 }
578
579                 // user defined functions
580         }
581
582
583
584         public class Xcls_RightEditor : Object
585         {
586                 public Gtk.ScrolledWindow el;
587                 private Editor  _this;
588
589
590                         // my vars (def)
591
592                 // ctor
593                 public Xcls_RightEditor(Editor _owner )
594                 {
595                         _this = _owner;
596                         _this.RightEditor = this;
597                         this.el = new Gtk.ScrolledWindow();
598
599                         // my vars (dec)
600
601                         // set gobject values
602                         this.el.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
603                         this.el.vexpand = true;
604                         this.el.overlay_scrolling = false;
605                         this.el.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
606                         new Xcls_view( _this );
607                         this.el.child = _this.view.el;
608                 }
609
610                 // user defined functions
611         }
612         public class Xcls_view : Object
613         {
614                 public GtkSource.View el;
615                 private Editor  _this;
616
617
618                         // my vars (def)
619                 public Gtk.CssProvider css;
620
621                 // ctor
622                 public Xcls_view(Editor _owner )
623                 {
624                         _this = _owner;
625                         _this.view = this;
626                         this.el = new GtkSource.View();
627
628                         // my vars (dec)
629                         this.css = null;
630
631                         // set gobject values
632                         this.el.auto_indent = true;
633                         this.el.indent_width = 4;
634                         this.el.name = "editor-view";
635                         this.el.show_line_marks = true;
636                         this.el.insert_spaces_instead_of_tabs = true;
637                         this.el.show_line_numbers = true;
638                         this.el.hexpand = true;
639                         this.el.vexpand = true;
640                         this.el.has_tooltip = true;
641                         this.el.css_classes = { "code-editor" };
642                         this.el.tab_width = 4;
643                         this.el.highlight_current_line = true;
644                         new Xcls_buffer( _this );
645                         this.el.buffer = _this.buffer.el;
646                         new Xcls_keystate( _this );
647                         this.el.add_controller(  _this.keystate.el );
648                         var child_3 = new Xcls_EventControllerScroll11( _this );
649                         child_3.ref();
650                         this.el.add_controller(  child_3.el );
651
652                         // init method
653
654                         this.el.completion.add_provider(
655                                 new Palete.CompletionProvider(_this)
656                         );
657                          
658                         var hover = this.el.get_hover();
659                         hover.add_provider(new Palete.HoverProvider());
660                         
661                         //this.el.completion.unblock_interactive();
662                         this.el.completion.select_on_show = true; // select
663                         //this.el.completion.remember_info_visibility    = true;
664                         
665                         
666                         var attrs = new GtkSource.MarkAttributes();
667                         
668                         attrs.set_icon_name ( "process-stop");    
669                         attrs.query_tooltip_text.connect(( mark) => {
670                              GLib.debug("tooltip query? %s", mark.name);
671                             return strdup( mark.name);
672                         });
673                          attrs.query_tooltip_markup.connect(( mark) => {
674                              GLib.debug("tooltip query? %s", mark.name);
675                             return strdup( mark.name);
676                         });
677                         this.el.set_mark_attributes ("ERR", attrs, 1);
678                         attrs.ref();
679                         
680                         
681                         var wattrs = new GtkSource.MarkAttributes();
682                         wattrs.set_icon_name ( "process-stop");    
683                         wattrs.query_tooltip_text.connect(( mark) => {
684                              GLib.debug("tooltip query? %s", mark.name);
685                             return strdup(mark.name);
686                         });
687                         wattrs.query_tooltip_markup.connect(( mark) => {
688                              GLib.debug("tooltip query? %s", mark.name);
689                             return strdup(mark.name);
690                         });
691                         this.el.set_mark_attributes ("WARN", wattrs, 1);
692                         wattrs.ref();
693                         
694                          
695                         var dattrs = new GtkSource.MarkAttributes();
696                          
697                         dattrs.set_icon_name ( "process-stop"); 
698                         
699                         dattrs.query_tooltip_text.connect(( mark) => {
700                                 GLib.debug("tooltip query? %s", mark.name);
701                             return strdup(mark.name);
702                         });
703                         //dattrs.query_tooltip_markup.connect(( mark) => {
704                         //      GLib.debug("tooltip query? %s", mark.name);
705                          //   return strdup(mark.name);
706                         //});
707                         this.el.set_mark_attributes ("DEPR", dattrs, 1);
708                         dattrs.ref();    
709                         
710                          this.el.get_space_drawer().set_matrix(null);
711                          this.el.get_space_drawer().set_types_for_locations( 
712                                 GtkSource.SpaceLocationFlags.ALL,
713                                 GtkSource.SpaceTypeFlags.ALL
714                         );
715                         this.el.get_space_drawer().set_enable_matrix(true);
716
717                         //listeners
718                         this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
719                                 
720                                 //GLib.debug("query tooltip");
721                                 Gtk.TextIter iter;
722                                 int trailing;
723                                 
724                                 var yoff = (int) _this.RightEditor.el.vadjustment.value;
725                                 
726                                 // I think this is problematic - if it's compliing  / updating at same time as query.
727                                 
728                                 //if (_this.window.statusbar_compile_spinner.el.spinning) {
729                                 //      return false;
730                                 //}
731                                 
732                                 this.el.get_iter_at_position (out iter, out trailing,  x,  y + yoff);
733                                  
734                                 var l = iter.get_line();
735                         
736                                 
737                                  
738                                 // GLib.debug("query tooltip line %d", (int) l);
739                                 if (l < 0) {
740                         
741                                         return false;
742                                 }
743                                 /*
744                                 if (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {
745                                         GLib.debug("line %d setting tip to %s", l,  _this.buffer.marks.get(l));
746                                         tooltip.set_text(_this.buffer.marks.get(l).dup());
747                                         return true;
748                                 }
749                          
750                                 return false;
751                                 */
752                                 
753                                   
754                                 // this crashes?? - not sure why.
755                                 var marks = _this.buffer.el.get_source_marks_at_line(l, "ERR");
756                                 if (marks.is_empty()) {
757                                         marks = _this.buffer.el.get_source_marks_at_line(l, "WARN");
758                                 }
759                                 if (marks.is_empty()) {
760                                         marks = _this.buffer.el.get_source_marks_at_line(l, "DEPR");
761                                 }
762                                 
763                                 // GLib.debug("query tooltip line %d marks %d", (int)l, (int) marks.length());
764                                 var str = "";
765                                 marks.@foreach((m) => { 
766                                         //GLib.debug("got mark %s", m.name);
767                                         str += (str.length > 0 ? "\n" : "") + m.category + ": " + m.name;
768                                 });
769                                 // true if there is a mark..
770                                 if (str.length > 0 ) {
771                                         tooltip.set_text( str );
772                                 }
773                                 return str.length > 0 ? true : false;
774                                  
775                         });
776                 }
777
778                 // user defined functions
779                 public void load (string str) {
780                 
781                 // show the help page for the active node..
782                    //this.get('/Help').show();
783                  
784                   // this.get('/BottomPane').el.set_current_page(0);
785                         GLib.debug("load called - Reset undo buffer");
786                         
787                     var buf = (GtkSource.Buffer)this.el.get_buffer();
788                     buf.begin_irreversible_action();
789                     buf.set_text(str, str.length);
790                     buf.end_irreversible_action();
791                     
792                     var lm = GtkSource.LanguageManager.get_default();
793                     var lang = "vala";
794                     if (_this.file != null) {
795                          lang = _this.file.language;
796                     }
797                     print("lang=%s, content_type = %s\n", lang, _this.file.content_type);
798                     var lg = _this.file.content_type.length > 0  ?
799                             lm.guess_language(_this.file.path, _this.file.content_type) :
800                             lm.get_language(lang);
801                      
802                    
803                     ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); 
804                 
805                     this.el.insert_spaces_instead_of_tabs = true;
806                     if (lg != null) {
807                                 print("sourcelanguage  = %s\n", lg.name);
808                                 if (lg.name == "Vala") {
809                                     this.el.insert_spaces_instead_of_tabs = false;
810                                 }
811                      }
812                     _this.dirty = false;
813                     this.el.grab_focus();
814                     _this.save_button.el.sensitive = false;
815                     _this.last_error_counter = -1;
816                 }
817         }
818         public class Xcls_buffer : Object
819         {
820                 public GtkSource.Buffer el;
821                 private Editor  _this;
822
823
824                         // my vars (def)
825                 public int error_line;
826                 public Gee.HashMap<int,string>? xmarks;
827                 public bool check_queued;
828
829                 // ctor
830                 public Xcls_buffer(Editor _owner )
831                 {
832                         _this = _owner;
833                         _this.buffer = this;
834                         this.el = new GtkSource.Buffer( null );
835
836                         // my vars (dec)
837                         this.error_line = -1;
838                         this.xmarks = null;
839                         this.check_queued = false;
840
841                         // set gobject values
842                         this.el.highlight_syntax = true;
843                         this.el.highlight_matching_brackets = true;
844                         this.el.enable_undo = true;
845
846                         // init method
847
848                         var buf = this.el;
849                         buf.create_tag ("bold", "weight", Pango.Weight.BOLD);
850                         buf.create_tag ("type", "weight", Pango.Weight.BOLD, "foreground", "#204a87");
851                         buf.create_tag ("keyword", "weight", Pango.Weight.BOLD, "foreground", "#a40000");
852                         buf.create_tag ("text", "weight", Pango.Weight.NORMAL, "foreground", "#729fcf");
853                         buf.create_tag ("number", "weight", Pango.Weight.BOLD, "foreground", "#ad7fa8");
854                         buf.create_tag ("method", "weight", Pango.Weight.BOLD, "foreground", "#729fcf");
855                         buf.create_tag ("property", "weight", Pango.Weight.BOLD, "foreground", "#BC1F51");
856                         buf.create_tag ("variable", "weight", Pango.Weight.BOLD, "foreground", "#A518B5");
857                         
858                         
859                         buf.create_tag ("ERR", "weight", Pango.Weight.BOLD, "background", "pink");
860                         buf.create_tag ("WARN", "weight", Pango.Weight.BOLD, "background", "#ABF4EB");
861                         buf.create_tag ("DEPR", "weight", Pango.Weight.BOLD, "background", "#EEA9FF");
862
863                         //listeners
864                         this.el.changed.connect( () => {
865                             // check syntax??
866                             // ??needed..??
867                             _this.save_button.el.sensitive = true;
868                             print("EDITOR CHANGED");
869                             this.checkSyntax();
870                            
871                             _this.dirty = true;
872                         
873                             // this.get('/LeftPanel.model').changed(  str , false);
874                             return ;
875                         });
876                 }
877
878                 // user defined functions
879                 public bool OLDhighlightErrorsJson (string type, Json.Object obj) {
880                         Gtk.TextIter start;
881                         Gtk.TextIter end;     
882                         this.el.get_bounds (out start, out end);
883                 
884                         this.el.remove_source_marks (start, end, type);
885                         GLib.debug("highlight errors");          
886                 
887                          // we should highlight other types of errors..
888                 
889                         if (!obj.has_member(type)) {
890                                 GLib.debug("Return has no errors\n");
891                                 return true;
892                         }
893                 
894                         if (_this.window.windowstate.state != WindowState.State.CODEONLY 
895                                 &&
896                                 _this.window.windowstate.state != WindowState.State.CODE
897                                 ) {
898                                 GLib.debug("windowstate != CODEONLY?");
899                                 
900                                 return true;
901                         } 
902                 
903                         //this.marks = new Gee.HashMap<int,string>();
904                         var err = obj.get_object_member(type);
905                  
906                         if (_this.file == null) {
907                                 GLib.debug("file is null?");
908                                 return true;
909                 
910                         }
911                         var valafn = _this.file.path;
912                 
913                         if (_this.file.xtype != "PlainFile") {
914                 
915                                 valafn = "";
916                                 try {             
917                                         var  regex = new Regex("\\.bjs$");
918                                         // should not happen
919                                         valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
920                                 } catch (GLib.RegexError e) {
921                                         return true;
922                                 }   
923                 
924                 
925                 
926                         }
927                         if (!err.has_member(valafn)) {
928                                 GLib.debug("File path has no errors");
929                                 return  true;
930                         }
931                 
932                         var lines = err.get_object_member(valafn);
933                         
934                         var offset = 1;
935                         if (obj.has_member("line_offset")) { // ?? why??
936                                 offset = (int)obj.get_int_member("line_offset") + 1;
937                         }
938                 
939                 
940                         var tlines = this.el.get_line_count () +1;
941                         
942                         if (_this.prop != null) {
943                         
944                                 tlines = _this.prop.end_line + 1;
945                                 offset = _this.prop.start_line + 1;
946                         
947                         }
948                         
949                 
950                 
951                         lines.foreach_member((obj, line, node) => {
952                                 
953                              Gtk.TextIter iter;
954                 //        print("get inter\n");
955                             var eline = int.parse(line) - offset;
956                             GLib.debug("GOT ERROR on line %s -- converted to %d  (offset = %d)\n", line,eline, offset);
957                             
958                             
959                             if (eline > tlines || eline < 0) {
960                                 return;
961                             }
962                            
963                             
964                             this.el.get_iter_at_line( out iter, eline);
965                             //print("mark line\n");
966                             var msg  = "";
967                             var ar = lines.get_array_member(line);
968                             for (var i = 0 ; i < ar.get_length(); i++) {
969                                 if (ar.get_string_element(i) == "Success") {
970                                         continue;
971                                 }
972                                         msg += (msg.length > 0) ? "\n" : "";
973                                         msg += ar.get_string_element(i);
974                                 }
975                                 if (msg == "") {
976                                         return;
977                                 }
978                                 msg = "Line: %d".printf(eline+1) +  " " + msg;
979                             this.el.create_source_mark(msg, type, iter);
980                             GLib.debug("set line %d to %m", eline, msg);
981                            // this.marks.set(eline, msg);
982                         } );
983                         return false;
984                 
985                 
986                 
987                 
988                 
989                         }
990                 public bool checkSyntax () {
991                  
992                     
993                     var str = this.toString();
994                     
995                     // needed???
996                     if (this.error_line > 0) {
997                          Gtk.TextIter start;
998                          Gtk.TextIter end;     
999                         this.el.get_bounds (out start, out end);
1000                 
1001                         this.el.remove_source_marks (start, end, null);
1002                     }
1003                     if (str.length < 1) {
1004                         print("checkSyntax - empty string?\n");
1005                         return true;
1006                     }
1007                     
1008                     // bit presumptiona
1009                     if (_this.file.xtype == "PlainFile") {
1010                     
1011                         // assume it's gtk...
1012                          var  oldcode =_this.file.toSource();
1013                         _this.file.setSource(str);
1014                             BuilderApplication.showSpinner("appointment soon","document change pending");
1015                         _this.file.getLanguageServer().document_change(_this.file);
1016                 
1017                         _this.file.setSource(oldcode);
1018                         
1019                                  
1020                         return true;
1021                     
1022                     }
1023                    if (_this.file == null) {
1024                        return true;
1025                    }
1026                  
1027                     
1028                 
1029                       
1030                      
1031                     GLib.debug("calling validate");    
1032                     // clear the buttons.
1033                         if (_this.prop.name == "xns" || _this.prop.name == "xtype") {
1034                                 return true ;
1035                         }
1036                         var oldcode  = _this.prop.val;
1037                         
1038                         _this.prop.val = str;
1039                         _this.node.updated_count++;
1040                     _this.file.getLanguageServer().document_change(_this.file);
1041                     _this.node.updated_count++;
1042                     _this.prop.val = oldcode;
1043                     
1044                     
1045                     //print("done mark line\n");
1046                      
1047                     return true; // at present allow saving - even if it's invalid..
1048                 }
1049                 public bool highlightErrors ( Gee.HashMap<int,string> validate_res) {
1050                          
1051                         this.error_line = validate_res.size;
1052                 
1053                         if (this.error_line < 1) {
1054                                 return true;
1055                         }
1056                         var tlines = this.el.get_line_count ();
1057                         Gtk.TextIter iter;
1058                         var valiter = validate_res.map_iterator();
1059                         while (valiter.next()) {
1060                 
1061                         //        print("get inter\n");
1062                                 var eline = valiter.get_key();
1063                                 if (eline > tlines) {
1064                                         continue;
1065                                 }
1066                                 this.el.get_iter_at_line( out iter, eline);
1067                                 //print("mark line\n");
1068                                 this.el.create_source_mark(valiter.get_value(), "ERR", iter);
1069                         }   
1070                         return false;
1071                 }
1072                 public string toString () {
1073                     
1074                     Gtk.TextIter s;
1075                     Gtk.TextIter e;
1076                     this.el.get_start_iter(out s);
1077                     this.el.get_end_iter(out e);
1078                     var ret = this.el.get_text(s,e,true);
1079                     //print("TO STRING? " + ret);
1080                     return ret;
1081                 }
1082         }
1083
1084         public class Xcls_keystate : Object
1085         {
1086                 public Gtk.EventControllerKey el;
1087                 private Editor  _this;
1088
1089
1090                         // my vars (def)
1091                 public bool is_control;
1092
1093                 // ctor
1094                 public Xcls_keystate(Editor _owner )
1095                 {
1096                         _this = _owner;
1097                         _this.keystate = this;
1098                         this.el = new Gtk.EventControllerKey();
1099
1100                         // my vars (dec)
1101                         this.is_control = false;
1102
1103                         // set gobject values
1104
1105                         //listeners
1106                         this.el.key_released.connect( (keyval, keycode, state) => {
1107                         
1108                                  if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {
1109                                         this.is_control = false;
1110                                 }
1111                             if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1112                                 GLib.debug("SAVE: ctrl-S  pressed");
1113                                 _this.saveContents();
1114                                 return;
1115                             }
1116                             
1117                             if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1118                                     GLib.debug("SAVE: ctrl-g  pressed");
1119                                         _this.forwardSearch(true);
1120                                     return;
1121                                 }
1122                                 if (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1123                                     GLib.debug("SAVE: ctrl-f  pressed");
1124                                         _this.search_entry.el.grab_focus();
1125                                         _this.search_entry.el.select_region(0,-1);
1126                                     return;
1127                                 }
1128                                 if (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1129                                         _this.view.el.show_completion();
1130                                 }
1131                                 
1132                                 Gtk.TextIter iter;
1133                                 _this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position);  
1134                                 var line  = iter.get_line();
1135                                 var offset = iter.get_line_offset();
1136                                 GLib.debug("line  %d  off %d", line ,offset);
1137                                 if (_this.prop != null) {
1138                                         line += _this.prop.start_line + 1; // i think..
1139                                         offset += 12; // should probably be 8 without namespaced 
1140                                         GLib.debug("guess line  %d  off %d", line ,offset);
1141                                 } 
1142                             //_this.view.el.show_completion();
1143                            // print(event.key.keyval)
1144                            
1145                            
1146                            
1147                             
1148                             return;
1149                          
1150                          
1151                         });
1152                         this.el.key_pressed.connect( (keyval, keycode, state) => {
1153                         
1154                                 if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {
1155                                         this.is_control = true;
1156                                 }
1157                                 return false;
1158                         });
1159                 }
1160
1161                 // user defined functions
1162         }
1163
1164         public class Xcls_EventControllerScroll11 : Object
1165         {
1166                 public Gtk.EventControllerScroll el;
1167                 private Editor  _this;
1168
1169
1170                         // my vars (def)
1171                 public double distance;
1172
1173                 // ctor
1174                 public Xcls_EventControllerScroll11(Editor _owner )
1175                 {
1176                         _this = _owner;
1177                         this.el = new Gtk.EventControllerScroll( Gtk.EventControllerScrollFlags.VERTICAL );
1178
1179                         // my vars (dec)
1180                         this.distance = 0.0f;
1181
1182                         // set gobject values
1183
1184                         //listeners
1185                         this.el.scroll.connect( (dx, dy) => {
1186                                 if (!_this.keystate.is_control) {
1187                                         return false;
1188                                 }
1189                                  //GLib.debug("scroll %f",  dy);
1190                                 
1191                                 this.distance += dy;
1192                                 
1193                                 //GLib.debug("scroll %f / %f",  dy, this.distance);
1194                          
1195                                  if (this.distance < -1) {
1196                          
1197                                         BuilderApplication.settings.editor_font_size ++;
1198                                         this.distance = 0;
1199                                 }
1200                                 if (this.distance > 1) {
1201                                         BuilderApplication.settings.editor_font_size --;
1202                                         this.distance = 0;
1203                                 }
1204                                  
1205                                 return true;
1206                         });
1207                 }
1208
1209                 // user defined functions
1210         }
1211
1212
1213
1214         public class Xcls_Box12 : Object
1215         {
1216                 public Gtk.Box el;
1217                 private Editor  _this;
1218
1219
1220                         // my vars (def)
1221
1222                 // ctor
1223                 public Xcls_Box12(Editor _owner )
1224                 {
1225                         _this = _owner;
1226                         this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1227
1228                         // my vars (dec)
1229
1230                         // set gobject values
1231                         this.el.homogeneous = false;
1232                         this.el.vexpand = false;
1233                         new Xcls_search_entry( _this );
1234                         this.el.append( _this.search_entry.el );
1235                         new Xcls_search_results( _this );
1236                         this.el.append( _this.search_results.el );
1237                         new Xcls_nextBtn( _this );
1238                         this.el.append( _this.nextBtn.el );
1239                         new Xcls_backBtn( _this );
1240                         this.el.append( _this.backBtn.el );
1241                         var child_5 = new Xcls_MenuButton18( _this );
1242                         child_5.ref();
1243                         this.el.append( child_5.el );
1244                 }
1245
1246                 // user defined functions
1247         }
1248         public class Xcls_search_entry : Object
1249         {
1250                 public Gtk.SearchEntry el;
1251                 private Editor  _this;
1252
1253
1254                         // my vars (def)
1255                 public Gtk.CssProvider css;
1256
1257                 // ctor
1258                 public Xcls_search_entry(Editor _owner )
1259                 {
1260                         _this = _owner;
1261                         _this.search_entry = this;
1262                         this.el = new Gtk.SearchEntry();
1263
1264                         // my vars (dec)
1265
1266                         // set gobject values
1267                         this.el.name = "editor-search-entry";
1268                         this.el.hexpand = true;
1269                         this.el.placeholder_text = "Press enter to search";
1270                         this.el.search_delay = 3;
1271                         var child_1 = new Xcls_EventControllerKey14( _this );
1272                         child_1.ref();
1273                         this.el.add_controller(  child_1.el );
1274
1275                         //listeners
1276                         this.el.search_changed.connect( ( ) => {
1277                         
1278                         _this.search(_this.search_entry.el.text);
1279                                  _this.search_results.updateResults();
1280                         
1281                                 GLib.Timeout.add_seconds(1,() => {
1282                                          _this.search_results.updateResults();
1283                                          return false;
1284                                  });
1285                         });
1286                 }
1287
1288                 // user defined functions
1289                 public void forwardSearch (bool change_focus) {
1290                 
1291                 
1292                         _this.forwardSearch(change_focus);
1293                 
1294                 /*
1295                 
1296                         switch(_this.windowstate.state) {
1297                                 case WindowState.State.CODEONLY:
1298                                 //case WindowState.State.CODE:
1299                                         // search the code being edited..
1300                                         _this.windowstate.code_editor_tab.forwardSearch(change_focus);
1301                                          
1302                                         break;
1303                                 case WindowState.State.PREVIEW:
1304                                         if (_this.windowstate.file.xtype == "Gtk") {
1305                                                 _this.windowstate.window_gladeview.forwardSearch(change_focus);
1306                                         } else { 
1307                                                  _this.windowstate.window_rooview.forwardSearch(change_focus);
1308                                         }
1309                                 
1310                                         break;
1311                         }
1312                         */
1313                         
1314                 }
1315         }
1316         public class Xcls_EventControllerKey14 : Object
1317         {
1318                 public Gtk.EventControllerKey el;
1319                 private Editor  _this;
1320
1321
1322                         // my vars (def)
1323
1324                 // ctor
1325                 public Xcls_EventControllerKey14(Editor _owner )
1326                 {
1327                         _this = _owner;
1328                         this.el = new Gtk.EventControllerKey();
1329
1330                         // my vars (dec)
1331
1332                         // set gobject values
1333
1334                         //listeners
1335                         this.el.key_pressed.connect( (keyval, keycode, state) => {
1336                         
1337                                 if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1338                                     GLib.debug("SAVE: ctrl-g  pressed");
1339                                         _this.forwardSearch(true);
1340                                     return true;
1341                                 }
1342                             
1343                           
1344                                 if (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {
1345                                         _this.forwardSearch(true);
1346                                         
1347                                         
1348                                     return true;
1349                         
1350                                 }    
1351                            // print(event.key.keyval)
1352                            
1353                             return false;
1354                         });
1355                 }
1356
1357                 // user defined functions
1358         }
1359
1360
1361         public class Xcls_search_results : Object
1362         {
1363                 public Gtk.Label el;
1364                 private Editor  _this;
1365
1366
1367                         // my vars (def)
1368
1369                 // ctor
1370                 public Xcls_search_results(Editor _owner )
1371                 {
1372                         _this = _owner;
1373                         _this.search_results = this;
1374                         this.el = new Gtk.Label( "No Results" );
1375
1376                         // my vars (dec)
1377
1378                         // set gobject values
1379                         this.el.margin_end = 4;
1380                         this.el.margin_start = 4;
1381                 }
1382
1383                 // user defined functions
1384                 public void updateResults () {
1385                         this.el.visible = true;
1386                         
1387                         var res = _this.searchcontext.get_occurrences_count();
1388                         if (res < 0) {
1389                                 _this.search_results.el.label = "??? Matches";          
1390                                 return;
1391                         }
1392                 
1393                         _this.nextBtn.el.sensitive = false;
1394                         _this.backBtn.el.sensitive = false;     
1395                 
1396                         if (res > 0) {
1397                                 _this.search_results.el.label = "%d Matches".printf(res);
1398                                 _this.nextBtn.el.sensitive = true;
1399                                 _this.backBtn.el.sensitive = true;
1400                                 return;
1401                         } 
1402                         _this.search_results.el.label = "No Matches";
1403                         
1404                 }
1405         }
1406
1407         public class Xcls_nextBtn : Object
1408         {
1409                 public Gtk.Button el;
1410                 private Editor  _this;
1411
1412
1413                         // my vars (def)
1414                 public bool always_show_image;
1415
1416                 // ctor
1417                 public Xcls_nextBtn(Editor _owner )
1418                 {
1419                         _this = _owner;
1420                         _this.nextBtn = this;
1421                         this.el = new Gtk.Button();
1422
1423                         // my vars (dec)
1424                         this.always_show_image = true;
1425
1426                         // set gobject values
1427                         this.el.icon_name = "go-down";
1428                         this.el.sensitive = false;
1429
1430                         //listeners
1431                         this.el.clicked.connect( (event) => {
1432                         
1433                                 _this.forwardSearch(true);
1434                                 
1435                                  
1436                         });
1437                 }
1438
1439                 // user defined functions
1440         }
1441
1442         public class Xcls_backBtn : Object
1443         {
1444                 public Gtk.Button el;
1445                 private Editor  _this;
1446
1447
1448                         // my vars (def)
1449                 public bool always_show_image;
1450
1451                 // ctor
1452                 public Xcls_backBtn(Editor _owner )
1453                 {
1454                         _this = _owner;
1455                         _this.backBtn = this;
1456                         this.el = new Gtk.Button();
1457
1458                         // my vars (dec)
1459                         this.always_show_image = true;
1460
1461                         // set gobject values
1462                         this.el.icon_name = "go-up";
1463                         this.el.sensitive = false;
1464
1465                         //listeners
1466                         this.el.clicked.connect( (event) => {
1467                         
1468                                 _this.backSearch(true);
1469                                  
1470                         });
1471                 }
1472
1473                 // user defined functions
1474         }
1475
1476         public class Xcls_MenuButton18 : Object
1477         {
1478                 public Gtk.MenuButton el;
1479                 private Editor  _this;
1480
1481
1482                         // my vars (def)
1483                 public bool always_show_image;
1484
1485                 // ctor
1486                 public Xcls_MenuButton18(Editor _owner )
1487                 {
1488                         _this = _owner;
1489                         this.el = new Gtk.MenuButton();
1490
1491                         // my vars (dec)
1492                         this.always_show_image = true;
1493
1494                         // set gobject values
1495                         this.el.icon_name = "emblem-system";
1496                         this.el.always_show_arrow = true;
1497                         new Xcls_search_settings( _this );
1498                         this.el.popover = _this.search_settings.el;
1499                 }
1500
1501                 // user defined functions
1502         }
1503         public class Xcls_search_settings : Object
1504         {
1505                 public Gtk.Popover el;
1506                 private Editor  _this;
1507
1508
1509                         // my vars (def)
1510
1511                 // ctor
1512                 public Xcls_search_settings(Editor _owner )
1513                 {
1514                         _this = _owner;
1515                         _this.search_settings = this;
1516                         this.el = new Gtk.Popover();
1517
1518                         // my vars (dec)
1519
1520                         // set gobject values
1521                         var child_1 = new Xcls_Box20( _this );
1522                         child_1.ref();
1523                         this.el.child = child_1.el;
1524                 }
1525
1526                 // user defined functions
1527         }
1528         public class Xcls_Box20 : Object
1529         {
1530                 public Gtk.Box el;
1531                 private Editor  _this;
1532
1533
1534                         // my vars (def)
1535
1536                 // ctor
1537                 public Xcls_Box20(Editor _owner )
1538                 {
1539                         _this = _owner;
1540                         this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1541
1542                         // my vars (dec)
1543
1544                         // set gobject values
1545                         new Xcls_case_sensitive( _this );
1546                         this.el.append( _this.case_sensitive.el );
1547                         new Xcls_regex( _this );
1548                         this.el.append( _this.regex.el );
1549                         new Xcls_multiline( _this );
1550                         this.el.append( _this.multiline.el );
1551                 }
1552
1553                 // user defined functions
1554         }
1555         public class Xcls_case_sensitive : Object
1556         {
1557                 public Gtk.CheckButton el;
1558                 private Editor  _this;
1559
1560
1561                         // my vars (def)
1562
1563                 // ctor
1564                 public Xcls_case_sensitive(Editor _owner )
1565                 {
1566                         _this = _owner;
1567                         _this.case_sensitive = this;
1568                         this.el = new Gtk.CheckButton();
1569
1570                         // my vars (dec)
1571
1572                         // set gobject values
1573                         this.el.label = "Case Sensitive";
1574
1575                         // init method
1576
1577                         {
1578                                 this.el.show();
1579                         }
1580                 }
1581
1582                 // user defined functions
1583         }
1584
1585         public class Xcls_regex : Object
1586         {
1587                 public Gtk.CheckButton el;
1588                 private Editor  _this;
1589
1590
1591                         // my vars (def)
1592
1593                 // ctor
1594                 public Xcls_regex(Editor _owner )
1595                 {
1596                         _this = _owner;
1597                         _this.regex = this;
1598                         this.el = new Gtk.CheckButton();
1599
1600                         // my vars (dec)
1601
1602                         // set gobject values
1603                         this.el.label = "Regex";
1604
1605                         // init method
1606
1607                         {
1608                                 this.el.show();
1609                         }
1610                 }
1611
1612                 // user defined functions
1613         }
1614
1615         public class Xcls_multiline : Object
1616         {
1617                 public Gtk.CheckButton el;
1618                 private Editor  _this;
1619
1620
1621                         // my vars (def)
1622
1623                 // ctor
1624                 public Xcls_multiline(Editor _owner )
1625                 {
1626                         _this = _owner;
1627                         _this.multiline = this;
1628                         this.el = new Gtk.CheckButton();
1629
1630                         // my vars (dec)
1631
1632                         // set gobject values
1633                         this.el.label = "Multi-line (add \\n)";
1634                 }
1635
1636                 // user defined functions
1637         }
1638
1639
1640
1641
1642
1643 }