Fix #8033 - text size zoom
[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_Box11( _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_EventControllerScroll63( _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                         //this.el.completion.unblock_interactive();
659                         this.el.completion.select_on_show = true; // select
660                         //this.el.completion.remember_info_visibility    = true;
661                         
662                         
663                         var attrs = new GtkSource.MarkAttributes();
664                         
665                         attrs.set_icon_name ( "process-stop");    
666                         attrs.query_tooltip_text.connect(( mark) => {
667                              GLib.debug("tooltip query? %s", mark.name);
668                             return strdup( mark.name);
669                         });
670                          attrs.query_tooltip_markup.connect(( mark) => {
671                              GLib.debug("tooltip query? %s", mark.name);
672                             return strdup( mark.name);
673                         });
674                         this.el.set_mark_attributes ("ERR", attrs, 1);
675                         attrs.ref();
676                         
677                         
678                         var wattrs = new GtkSource.MarkAttributes();
679                         wattrs.set_icon_name ( "process-stop");    
680                         wattrs.query_tooltip_text.connect(( mark) => {
681                              GLib.debug("tooltip query? %s", mark.name);
682                             return strdup(mark.name);
683                         });
684                         wattrs.query_tooltip_markup.connect(( mark) => {
685                              GLib.debug("tooltip query? %s", mark.name);
686                             return strdup(mark.name);
687                         });
688                         this.el.set_mark_attributes ("WARN", wattrs, 1);
689                         wattrs.ref();
690                         
691                          
692                         var dattrs = new GtkSource.MarkAttributes();
693                          
694                         dattrs.set_icon_name ( "process-stop"); 
695                         
696                         dattrs.query_tooltip_text.connect(( mark) => {
697                                 GLib.debug("tooltip query? %s", mark.name);
698                             return strdup(mark.name);
699                         });
700                         //dattrs.query_tooltip_markup.connect(( mark) => {
701                         //      GLib.debug("tooltip query? %s", mark.name);
702                          //   return strdup(mark.name);
703                         //});
704                         this.el.set_mark_attributes ("DEPR", dattrs, 1);
705                         dattrs.ref();    
706                         
707                          this.el.get_space_drawer().set_matrix(null);
708                          this.el.get_space_drawer().set_types_for_locations( 
709                                 GtkSource.SpaceLocationFlags.ALL,
710                                 GtkSource.SpaceTypeFlags.ALL
711                         );
712                         this.el.get_space_drawer().set_enable_matrix(true);
713
714                         //listeners
715                         this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
716                                 
717                                 //GLib.debug("query tooltip");
718                                 Gtk.TextIter iter;
719                                 int trailing;
720                                 
721                                 var yoff = (int) _this.RightEditor.el.vadjustment.value;
722                                 
723                                 // I think this is problematic - if it's compliing  / updating at same time as query.
724                                 
725                                 //if (_this.window.statusbar_compile_spinner.el.spinning) {
726                                 //      return false;
727                                 //}
728                                 
729                                 this.el.get_iter_at_position (out iter, out trailing,  x,  y + yoff);
730                                  
731                                 var l = iter.get_line();
732                         
733                                 
734                                  
735                                 // GLib.debug("query tooltip line %d", (int) l);
736                                 if (l < 0) {
737                         
738                                         return false;
739                                 }
740                                 /*
741                                 if (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {
742                                         GLib.debug("line %d setting tip to %s", l,  _this.buffer.marks.get(l));
743                                         tooltip.set_text(_this.buffer.marks.get(l).dup());
744                                         return true;
745                                 }
746                          
747                                 return false;
748                                 */
749                                 
750                                   
751                                 // this crashes?? - not sure why.
752                                 var marks = _this.buffer.el.get_source_marks_at_line(l, "ERR");
753                                 if (marks.is_empty()) {
754                                         marks = _this.buffer.el.get_source_marks_at_line(l, "WARN");
755                                 }
756                                 if (marks.is_empty()) {
757                                         marks = _this.buffer.el.get_source_marks_at_line(l, "DEPR");
758                                 }
759                                 
760                                 // GLib.debug("query tooltip line %d marks %d", (int)l, (int) marks.length());
761                                 var str = "";
762                                 marks.@foreach((m) => { 
763                                         //GLib.debug("got mark %s", m.name);
764                                         str += (str.length > 0 ? "\n" : "") + m.category + ": " + m.name;
765                                 });
766                                 // true if there is a mark..
767                                 if (str.length > 0 ) {
768                                         tooltip.set_text( str );
769                                 }
770                                 return str.length > 0 ? true : false;
771                                  
772                         });
773                 }
774
775                 // user defined functions
776                 public void load (string str) {
777                 
778                 // show the help page for the active node..
779                    //this.get('/Help').show();
780                  
781                   // this.get('/BottomPane').el.set_current_page(0);
782                         GLib.debug("load called - Reset undo buffer");
783                         
784                     var buf = (GtkSource.Buffer)this.el.get_buffer();
785                     buf.begin_irreversible_action();
786                     buf.set_text(str, str.length);
787                     buf.end_irreversible_action();
788                     
789                     var lm = GtkSource.LanguageManager.get_default();
790                     var lang = "vala";
791                     if (_this.file != null) {
792                          lang = _this.file.language;
793                     }
794                     print("lang=%s, content_type = %s\n", lang, _this.file.content_type);
795                     var lg = _this.file.content_type.length > 0  ?
796                             lm.guess_language(_this.file.path, _this.file.content_type) :
797                             lm.get_language(lang);
798                      
799                    
800                     ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); 
801                 
802                     this.el.insert_spaces_instead_of_tabs = true;
803                     if (lg != null) {
804                                 print("sourcelanguage  = %s\n", lg.name);
805                                 if (lg.name == "Vala") {
806                                     this.el.insert_spaces_instead_of_tabs = false;
807                                 }
808                      }
809                     _this.dirty = false;
810                     this.el.grab_focus();
811                     _this.save_button.el.sensitive = false;
812                     _this.last_error_counter = -1;
813                 }
814         }
815         public class Xcls_buffer : Object
816         {
817                 public GtkSource.Buffer el;
818                 private Editor  _this;
819
820
821                         // my vars (def)
822                 public int error_line;
823                 public Gee.HashMap<int,string>? xmarks;
824                 public bool check_queued;
825
826                 // ctor
827                 public Xcls_buffer(Editor _owner )
828                 {
829                         _this = _owner;
830                         _this.buffer = this;
831                         this.el = new GtkSource.Buffer( null );
832
833                         // my vars (dec)
834                         this.error_line = -1;
835                         this.xmarks = null;
836                         this.check_queued = false;
837
838                         // set gobject values
839                         this.el.highlight_syntax = true;
840                         this.el.highlight_matching_brackets = true;
841                         this.el.enable_undo = true;
842
843                         // init method
844
845                         var buf = this.el;
846                         buf.create_tag ("bold", "weight", Pango.Weight.BOLD);
847                         buf.create_tag ("type", "weight", Pango.Weight.BOLD, "foreground", "#204a87");
848                         buf.create_tag ("keyword", "weight", Pango.Weight.BOLD, "foreground", "#a40000");
849                         buf.create_tag ("text", "weight", Pango.Weight.NORMAL, "foreground", "#729fcf");
850                         buf.create_tag ("number", "weight", Pango.Weight.BOLD, "foreground", "#ad7fa8");
851                         buf.create_tag ("method", "weight", Pango.Weight.BOLD, "foreground", "#729fcf");
852                         buf.create_tag ("property", "weight", Pango.Weight.BOLD, "foreground", "#BC1F51");
853                         buf.create_tag ("variable", "weight", Pango.Weight.BOLD, "foreground", "#A518B5");
854                         
855                         
856                         buf.create_tag ("ERR", "weight", Pango.Weight.BOLD, "background", "pink");
857                         buf.create_tag ("WARN", "weight", Pango.Weight.BOLD, "background", "#ABF4EB");
858                         buf.create_tag ("DEPR", "weight", Pango.Weight.BOLD, "background", "#EEA9FF");
859
860                         //listeners
861                         this.el.changed.connect( () => {
862                             // check syntax??
863                             // ??needed..??
864                             _this.save_button.el.sensitive = true;
865                             print("EDITOR CHANGED");
866                             this.checkSyntax();
867                            
868                             _this.dirty = true;
869                         
870                             // this.get('/LeftPanel.model').changed(  str , false);
871                             return ;
872                         });
873                 }
874
875                 // user defined functions
876                 public bool OLDhighlightErrorsJson (string type, Json.Object obj) {
877                         Gtk.TextIter start;
878                         Gtk.TextIter end;     
879                         this.el.get_bounds (out start, out end);
880                 
881                         this.el.remove_source_marks (start, end, type);
882                         GLib.debug("highlight errors");          
883                 
884                          // we should highlight other types of errors..
885                 
886                         if (!obj.has_member(type)) {
887                                 GLib.debug("Return has no errors\n");
888                                 return true;
889                         }
890                 
891                         if (_this.window.windowstate.state != WindowState.State.CODEONLY 
892                                 &&
893                                 _this.window.windowstate.state != WindowState.State.CODE
894                                 ) {
895                                 GLib.debug("windowstate != CODEONLY?");
896                                 
897                                 return true;
898                         } 
899                 
900                         //this.marks = new Gee.HashMap<int,string>();
901                         var err = obj.get_object_member(type);
902                  
903                         if (_this.file == null) {
904                                 GLib.debug("file is null?");
905                                 return true;
906                 
907                         }
908                         var valafn = _this.file.path;
909                 
910                         if (_this.file.xtype != "PlainFile") {
911                 
912                                 valafn = "";
913                                 try {             
914                                         var  regex = new Regex("\\.bjs$");
915                                         // should not happen
916                                         valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
917                                 } catch (GLib.RegexError e) {
918                                         return true;
919                                 }   
920                 
921                 
922                 
923                         }
924                         if (!err.has_member(valafn)) {
925                                 GLib.debug("File path has no errors");
926                                 return  true;
927                         }
928                 
929                         var lines = err.get_object_member(valafn);
930                         
931                         var offset = 1;
932                         if (obj.has_member("line_offset")) { // ?? why??
933                                 offset = (int)obj.get_int_member("line_offset") + 1;
934                         }
935                 
936                 
937                         var tlines = this.el.get_line_count () +1;
938                         
939                         if (_this.prop != null) {
940                         
941                                 tlines = _this.prop.end_line + 1;
942                                 offset = _this.prop.start_line + 1;
943                         
944                         }
945                         
946                 
947                 
948                         lines.foreach_member((obj, line, node) => {
949                                 
950                              Gtk.TextIter iter;
951                 //        print("get inter\n");
952                             var eline = int.parse(line) - offset;
953                             GLib.debug("GOT ERROR on line %s -- converted to %d  (offset = %d)\n", line,eline, offset);
954                             
955                             
956                             if (eline > tlines || eline < 0) {
957                                 return;
958                             }
959                            
960                             
961                             this.el.get_iter_at_line( out iter, eline);
962                             //print("mark line\n");
963                             var msg  = "";
964                             var ar = lines.get_array_member(line);
965                             for (var i = 0 ; i < ar.get_length(); i++) {
966                                 if (ar.get_string_element(i) == "Success") {
967                                         continue;
968                                 }
969                                         msg += (msg.length > 0) ? "\n" : "";
970                                         msg += ar.get_string_element(i);
971                                 }
972                                 if (msg == "") {
973                                         return;
974                                 }
975                                 msg = "Line: %d".printf(eline+1) +  " " + msg;
976                             this.el.create_source_mark(msg, type, iter);
977                             GLib.debug("set line %d to %m", eline, msg);
978                            // this.marks.set(eline, msg);
979                         } );
980                         return false;
981                 
982                 
983                 
984                 
985                 
986                         }
987                 public bool checkSyntax () {
988                  
989                     
990                     var str = this.toString();
991                     
992                     // needed???
993                     if (this.error_line > 0) {
994                          Gtk.TextIter start;
995                          Gtk.TextIter end;     
996                         this.el.get_bounds (out start, out end);
997                 
998                         this.el.remove_source_marks (start, end, null);
999                     }
1000                     if (str.length < 1) {
1001                         print("checkSyntax - empty string?\n");
1002                         return true;
1003                     }
1004                     
1005                     // bit presumptiona
1006                     if (_this.file.xtype == "PlainFile") {
1007                     
1008                         // assume it's gtk...
1009                          var  oldcode =_this.file.toSource();
1010                         _this.file.setSource(str);
1011                             BuilderApplication.showSpinner("appointment soon","document change pending");
1012                         _this.file.getLanguageServer().document_change(_this.file);
1013                 
1014                         _this.file.setSource(oldcode);
1015                         
1016                                  
1017                         return true;
1018                     
1019                     }
1020                    if (_this.file == null) {
1021                        return true;
1022                    }
1023                  
1024                     
1025                 
1026                       
1027                      
1028                     GLib.debug("calling validate");    
1029                     // clear the buttons.
1030                         if (_this.prop.name == "xns" || _this.prop.name == "xtype") {
1031                                 return true ;
1032                         }
1033                         var oldcode  = _this.prop.val;
1034                         
1035                         _this.prop.val = str;
1036                         _this.node.updated_count++;
1037                     _this.file.getLanguageServer().document_change(_this.file);
1038                     _this.node.updated_count++;
1039                     _this.prop.val = oldcode;
1040                     
1041                     
1042                     //print("done mark line\n");
1043                      
1044                     return true; // at present allow saving - even if it's invalid..
1045                 }
1046                 public bool highlightErrors ( Gee.HashMap<int,string> validate_res) {
1047                          
1048                         this.error_line = validate_res.size;
1049                 
1050                         if (this.error_line < 1) {
1051                                 return true;
1052                         }
1053                         var tlines = this.el.get_line_count ();
1054                         Gtk.TextIter iter;
1055                         var valiter = validate_res.map_iterator();
1056                         while (valiter.next()) {
1057                 
1058                         //        print("get inter\n");
1059                                 var eline = valiter.get_key();
1060                                 if (eline > tlines) {
1061                                         continue;
1062                                 }
1063                                 this.el.get_iter_at_line( out iter, eline);
1064                                 //print("mark line\n");
1065                                 this.el.create_source_mark(valiter.get_value(), "ERR", iter);
1066                         }   
1067                         return false;
1068                 }
1069                 public string toString () {
1070                     
1071                     Gtk.TextIter s;
1072                     Gtk.TextIter e;
1073                     this.el.get_start_iter(out s);
1074                     this.el.get_end_iter(out e);
1075                     var ret = this.el.get_text(s,e,true);
1076                     //print("TO STRING? " + ret);
1077                     return ret;
1078                 }
1079         }
1080
1081         public class Xcls_keystate : Object
1082         {
1083                 public Gtk.EventControllerKey el;
1084                 private Editor  _this;
1085
1086
1087                         // my vars (def)
1088                 public bool is_control;
1089
1090                 // ctor
1091                 public Xcls_keystate(Editor _owner )
1092                 {
1093                         _this = _owner;
1094                         _this.keystate = this;
1095                         this.el = new Gtk.EventControllerKey();
1096
1097                         // my vars (dec)
1098                         this.is_control = false;
1099
1100                         // set gobject values
1101
1102                         //listeners
1103                         this.el.key_released.connect( (keyval, keycode, state) => {
1104                         
1105                                  if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {
1106                                         this.is_control = false;
1107                                 }
1108                             if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1109                                 GLib.debug("SAVE: ctrl-S  pressed");
1110                                 _this.saveContents();
1111                                 return;
1112                             }
1113                             
1114                             if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1115                                     GLib.debug("SAVE: ctrl-g  pressed");
1116                                         _this.forwardSearch(true);
1117                                     return;
1118                                 }
1119                                 if (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1120                                     GLib.debug("SAVE: ctrl-f  pressed");
1121                                         _this.search_entry.el.grab_focus();
1122                                         _this.search_entry.el.select_region(0,-1);
1123                                     return;
1124                                 }
1125                                 if (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1126                                         _this.view.el.show_completion();
1127                                 }
1128                                 
1129                                 Gtk.TextIter iter;
1130                                 _this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position);  
1131                                 var line  = iter.get_line();
1132                                 var offset = iter.get_line_offset();
1133                                 GLib.debug("line  %d  off %d", line ,offset);
1134                                 if (_this.prop != null) {
1135                                         line += _this.prop.start_line + 1; // i think..
1136                                         offset += 12; // should probably be 8 without namespaced 
1137                                         GLib.debug("guess line  %d  off %d", line ,offset);
1138                                 } 
1139                             //_this.view.el.show_completion();
1140                            // print(event.key.keyval)
1141                            
1142                            
1143                            
1144                             
1145                             return;
1146                          
1147                          
1148                         });
1149                         this.el.key_pressed.connect( (keyval, keycode, state) => {
1150                         
1151                                 if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {
1152                                         this.is_control = true;
1153                                 }
1154                                 return false;
1155                         });
1156                 }
1157
1158                 // user defined functions
1159         }
1160
1161         public class Xcls_EventControllerScroll63 : Object
1162         {
1163                 public Gtk.EventControllerScroll el;
1164                 private Editor  _this;
1165
1166
1167                         // my vars (def)
1168                 public double distance;
1169
1170                 // ctor
1171                 public Xcls_EventControllerScroll63(Editor _owner )
1172                 {
1173                         _this = _owner;
1174                         this.el = new Gtk.EventControllerScroll( Gtk.EventControllerScrollFlags.VERTICAL );
1175
1176                         // my vars (dec)
1177                         this.distance = 0.0f;
1178
1179                         // set gobject values
1180
1181                         //listeners
1182                         this.el.scroll.connect( (dx, dy) => {
1183                                 if (!_this.keystate.is_control) {
1184                                         return false;
1185                                 }
1186                                 //GLib.debug("scroll %f",  dy);
1187                                 
1188                                 this.distance += dy;
1189                                 if (this.distance < 1) {
1190                                         BuilderApplication.settings.editor_font_size ++;
1191                                         this.distance = 0;
1192                                 }
1193                                 if (this.distance > -1) {
1194                                         BuilderApplication.settings.editor_font_size --;
1195                                         this.distance = 0;
1196                                 }
1197                         
1198                                 return true;
1199                         });
1200                 }
1201
1202                 // user defined functions
1203         }
1204
1205
1206
1207         public class Xcls_Box11 : Object
1208         {
1209                 public Gtk.Box el;
1210                 private Editor  _this;
1211
1212
1213                         // my vars (def)
1214
1215                 // ctor
1216                 public Xcls_Box11(Editor _owner )
1217                 {
1218                         _this = _owner;
1219                         this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1220
1221                         // my vars (dec)
1222
1223                         // set gobject values
1224                         this.el.homogeneous = false;
1225                         this.el.vexpand = false;
1226                         new Xcls_search_entry( _this );
1227                         this.el.append( _this.search_entry.el );
1228                         new Xcls_search_results( _this );
1229                         this.el.append( _this.search_results.el );
1230                         new Xcls_nextBtn( _this );
1231                         this.el.append( _this.nextBtn.el );
1232                         new Xcls_backBtn( _this );
1233                         this.el.append( _this.backBtn.el );
1234                         var child_5 = new Xcls_MenuButton17( _this );
1235                         child_5.ref();
1236                         this.el.append( child_5.el );
1237                 }
1238
1239                 // user defined functions
1240         }
1241         public class Xcls_search_entry : Object
1242         {
1243                 public Gtk.SearchEntry el;
1244                 private Editor  _this;
1245
1246
1247                         // my vars (def)
1248                 public Gtk.CssProvider css;
1249
1250                 // ctor
1251                 public Xcls_search_entry(Editor _owner )
1252                 {
1253                         _this = _owner;
1254                         _this.search_entry = this;
1255                         this.el = new Gtk.SearchEntry();
1256
1257                         // my vars (dec)
1258
1259                         // set gobject values
1260                         this.el.name = "editor-search-entry";
1261                         this.el.hexpand = true;
1262                         this.el.placeholder_text = "Press enter to search";
1263                         this.el.search_delay = 3;
1264                         var child_1 = new Xcls_EventControllerKey13( _this );
1265                         child_1.ref();
1266                         this.el.add_controller(  child_1.el );
1267
1268                         //listeners
1269                         this.el.search_changed.connect( ( ) => {
1270                         
1271                         _this.search(_this.search_entry.el.text);
1272                                  _this.search_results.updateResults();
1273                         
1274                                 GLib.Timeout.add_seconds(1,() => {
1275                                          _this.search_results.updateResults();
1276                                          return false;
1277                                  });
1278                         });
1279                 }
1280
1281                 // user defined functions
1282                 public void forwardSearch (bool change_focus) {
1283                 
1284                 
1285                         _this.forwardSearch(change_focus);
1286                 
1287                 /*
1288                 
1289                         switch(_this.windowstate.state) {
1290                                 case WindowState.State.CODEONLY:
1291                                 //case WindowState.State.CODE:
1292                                         // search the code being edited..
1293                                         _this.windowstate.code_editor_tab.forwardSearch(change_focus);
1294                                          
1295                                         break;
1296                                 case WindowState.State.PREVIEW:
1297                                         if (_this.windowstate.file.xtype == "Gtk") {
1298                                                 _this.windowstate.window_gladeview.forwardSearch(change_focus);
1299                                         } else { 
1300                                                  _this.windowstate.window_rooview.forwardSearch(change_focus);
1301                                         }
1302                                 
1303                                         break;
1304                         }
1305                         */
1306                         
1307                 }
1308         }
1309         public class Xcls_EventControllerKey13 : Object
1310         {
1311                 public Gtk.EventControllerKey el;
1312                 private Editor  _this;
1313
1314
1315                         // my vars (def)
1316
1317                 // ctor
1318                 public Xcls_EventControllerKey13(Editor _owner )
1319                 {
1320                         _this = _owner;
1321                         this.el = new Gtk.EventControllerKey();
1322
1323                         // my vars (dec)
1324
1325                         // set gobject values
1326
1327                         //listeners
1328                         this.el.key_pressed.connect( (keyval, keycode, state) => {
1329                         
1330                                 if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
1331                                     GLib.debug("SAVE: ctrl-g  pressed");
1332                                         _this.forwardSearch(true);
1333                                     return true;
1334                                 }
1335                             
1336                           
1337                                 if (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {
1338                                         _this.forwardSearch(true);
1339                                         
1340                                         
1341                                     return true;
1342                         
1343                                 }    
1344                            // print(event.key.keyval)
1345                            
1346                             return false;
1347                         });
1348                 }
1349
1350                 // user defined functions
1351         }
1352
1353
1354         public class Xcls_search_results : Object
1355         {
1356                 public Gtk.Label el;
1357                 private Editor  _this;
1358
1359
1360                         // my vars (def)
1361
1362                 // ctor
1363                 public Xcls_search_results(Editor _owner )
1364                 {
1365                         _this = _owner;
1366                         _this.search_results = this;
1367                         this.el = new Gtk.Label( "No Results" );
1368
1369                         // my vars (dec)
1370
1371                         // set gobject values
1372                         this.el.margin_end = 4;
1373                         this.el.margin_start = 4;
1374                 }
1375
1376                 // user defined functions
1377                 public void updateResults () {
1378                         this.el.visible = true;
1379                         
1380                         var res = _this.searchcontext.get_occurrences_count();
1381                         if (res < 0) {
1382                                 _this.search_results.el.label = "??? Matches";          
1383                                 return;
1384                         }
1385                 
1386                         _this.nextBtn.el.sensitive = false;
1387                         _this.backBtn.el.sensitive = false;     
1388                 
1389                         if (res > 0) {
1390                                 _this.search_results.el.label = "%d Matches".printf(res);
1391                                 _this.nextBtn.el.sensitive = true;
1392                                 _this.backBtn.el.sensitive = true;
1393                                 return;
1394                         } 
1395                         _this.search_results.el.label = "No Matches";
1396                         
1397                 }
1398         }
1399
1400         public class Xcls_nextBtn : Object
1401         {
1402                 public Gtk.Button el;
1403                 private Editor  _this;
1404
1405
1406                         // my vars (def)
1407                 public bool always_show_image;
1408
1409                 // ctor
1410                 public Xcls_nextBtn(Editor _owner )
1411                 {
1412                         _this = _owner;
1413                         _this.nextBtn = this;
1414                         this.el = new Gtk.Button();
1415
1416                         // my vars (dec)
1417                         this.always_show_image = true;
1418
1419                         // set gobject values
1420                         this.el.icon_name = "go-down";
1421                         this.el.sensitive = false;
1422
1423                         //listeners
1424                         this.el.clicked.connect( (event) => {
1425                         
1426                                 _this.forwardSearch(true);
1427                                 
1428                                  
1429                         });
1430                 }
1431
1432                 // user defined functions
1433         }
1434
1435         public class Xcls_backBtn : Object
1436         {
1437                 public Gtk.Button el;
1438                 private Editor  _this;
1439
1440
1441                         // my vars (def)
1442                 public bool always_show_image;
1443
1444                 // ctor
1445                 public Xcls_backBtn(Editor _owner )
1446                 {
1447                         _this = _owner;
1448                         _this.backBtn = this;
1449                         this.el = new Gtk.Button();
1450
1451                         // my vars (dec)
1452                         this.always_show_image = true;
1453
1454                         // set gobject values
1455                         this.el.icon_name = "go-up";
1456                         this.el.sensitive = false;
1457
1458                         //listeners
1459                         this.el.clicked.connect( (event) => {
1460                         
1461                                 _this.backSearch(true);
1462                                  
1463                         });
1464                 }
1465
1466                 // user defined functions
1467         }
1468
1469         public class Xcls_MenuButton17 : Object
1470         {
1471                 public Gtk.MenuButton el;
1472                 private Editor  _this;
1473
1474
1475                         // my vars (def)
1476                 public bool always_show_image;
1477
1478                 // ctor
1479                 public Xcls_MenuButton17(Editor _owner )
1480                 {
1481                         _this = _owner;
1482                         this.el = new Gtk.MenuButton();
1483
1484                         // my vars (dec)
1485                         this.always_show_image = true;
1486
1487                         // set gobject values
1488                         this.el.icon_name = "emblem-system";
1489                         this.el.always_show_arrow = true;
1490                         new Xcls_search_settings( _this );
1491                         this.el.popover = _this.search_settings.el;
1492                 }
1493
1494                 // user defined functions
1495         }
1496         public class Xcls_search_settings : Object
1497         {
1498                 public Gtk.Popover el;
1499                 private Editor  _this;
1500
1501
1502                         // my vars (def)
1503
1504                 // ctor
1505                 public Xcls_search_settings(Editor _owner )
1506                 {
1507                         _this = _owner;
1508                         _this.search_settings = this;
1509                         this.el = new Gtk.Popover();
1510
1511                         // my vars (dec)
1512
1513                         // set gobject values
1514                         var child_1 = new Xcls_Box19( _this );
1515                         child_1.ref();
1516                         this.el.child = child_1.el;
1517                 }
1518
1519                 // user defined functions
1520         }
1521         public class Xcls_Box19 : Object
1522         {
1523                 public Gtk.Box el;
1524                 private Editor  _this;
1525
1526
1527                         // my vars (def)
1528
1529                 // ctor
1530                 public Xcls_Box19(Editor _owner )
1531                 {
1532                         _this = _owner;
1533                         this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1534
1535                         // my vars (dec)
1536
1537                         // set gobject values
1538                         new Xcls_case_sensitive( _this );
1539                         this.el.append( _this.case_sensitive.el );
1540                         new Xcls_regex( _this );
1541                         this.el.append( _this.regex.el );
1542                         new Xcls_multiline( _this );
1543                         this.el.append( _this.multiline.el );
1544                 }
1545
1546                 // user defined functions
1547         }
1548         public class Xcls_case_sensitive : Object
1549         {
1550                 public Gtk.CheckButton el;
1551                 private Editor  _this;
1552
1553
1554                         // my vars (def)
1555
1556                 // ctor
1557                 public Xcls_case_sensitive(Editor _owner )
1558                 {
1559                         _this = _owner;
1560                         _this.case_sensitive = this;
1561                         this.el = new Gtk.CheckButton();
1562
1563                         // my vars (dec)
1564
1565                         // set gobject values
1566                         this.el.label = "Case Sensitive";
1567
1568                         // init method
1569
1570                         {
1571                                 this.el.show();
1572                         }
1573                 }
1574
1575                 // user defined functions
1576         }
1577
1578         public class Xcls_regex : Object
1579         {
1580                 public Gtk.CheckButton el;
1581                 private Editor  _this;
1582
1583
1584                         // my vars (def)
1585
1586                 // ctor
1587                 public Xcls_regex(Editor _owner )
1588                 {
1589                         _this = _owner;
1590                         _this.regex = this;
1591                         this.el = new Gtk.CheckButton();
1592
1593                         // my vars (dec)
1594
1595                         // set gobject values
1596                         this.el.label = "Regex";
1597
1598                         // init method
1599
1600                         {
1601                                 this.el.show();
1602                         }
1603                 }
1604
1605                 // user defined functions
1606         }
1607
1608         public class Xcls_multiline : Object
1609         {
1610                 public Gtk.CheckButton el;
1611                 private Editor  _this;
1612
1613
1614                         // my vars (def)
1615
1616                 // ctor
1617                 public Xcls_multiline(Editor _owner )
1618                 {
1619                         _this = _owner;
1620                         _this.multiline = this;
1621                         this.el = new Gtk.CheckButton();
1622
1623                         // my vars (dec)
1624
1625                         // set gobject values
1626                         this.el.label = "Multi-line (add \\n)";
1627                 }
1628
1629                 // user defined functions
1630         }
1631
1632
1633
1634
1635
1636 }