sync
authorAlan <alan@roojs.com>
Tue, 31 May 2022 09:50:04 +0000 (17:50 +0800)
committerAlan <alan@roojs.com>
Tue, 31 May 2022 09:50:04 +0000 (17:50 +0800)
src/Builder4/GtkView.bjs
src/Builder4/GtkView.vala
src/JsRender/NodeToGlade.vala
src/Makefile.am

index 34dc1dc..1b18540 100644 (file)
     "        ",
     "        ",
     "\tvar x = new JsRender.NodeToGtk((Project.Gtk) file.project, file.tree);",
-    "        var obj = x.munge() as Gtk.Widget;",
-    "        this.lastObj = null;",
+    "    var obj = x.munge() as Gtk.Widget;",
+    "    this.lastObj = null;",
     "\tif (obj == null) {",
     "        \treturn;",
     "\t}",
index 7d9ffee..446e6fb 100644 (file)
@@ -21,8 +21,8 @@ public class Xcls_GtkView : Object
 
         // my vars (def)
     public Gtk.Widget lastObj;
-    public int width;
     public int last_search_end;
+    public int width;
     public Gtk.SourceSearchContext searchcontext;
     public JsRender.JsRender file;
     public int height;
@@ -36,8 +36,8 @@ public class Xcls_GtkView : Object
 
         // my vars (dec)
         this.lastObj = null;
-        this.width = 0;
         this.last_search_end = 0;
+        this.width = 0;
         this.file = null;
         this.height = 0;
 
@@ -77,6 +77,23 @@ public class Xcls_GtkView : Object
        });   
     
        
+    }
+    public int search (string txt) {
+       this.notebook.el.page = 1;
+       var s = new Gtk.SourceSearchSettings();
+       var buf = (Gtk.SourceBuffer) this.sourceview.el.get_buffer();
+       this.searchcontext = new Gtk.SourceSearchContext(buf,s);
+       this.searchcontext.set_highlight(true);
+       s.set_search_text(txt);
+       
+       Gtk.TextIter beg, st,en;
+        
+       buf.get_start_iter(out beg);
+       this.searchcontext.forward(beg, out st, out en);
+       this.last_search_end  = 0;
+       return this.searchcontext.get_occurrences_count();
+    
+       
     }
     public void createThumb () {
         
@@ -162,8 +179,8 @@ public class Xcls_GtkView : Object
             
             
        var x = new JsRender.NodeToGtk((Project.Gtk) file.project, file.tree);
-            var obj = x.munge() as Gtk.Widget;
-            this.lastObj = null;
+        var obj = x.munge() as Gtk.Widget;
+        this.lastObj = null;
        if (obj == null) {
                return;
        }
@@ -174,23 +191,6 @@ public class Xcls_GtkView : Object
             
              
             
-    }
-    public int search (string txt) {
-       this.notebook.el.page = 1;
-       var s = new Gtk.SourceSearchSettings();
-       var buf = (Gtk.SourceBuffer) this.sourceview.el.get_buffer();
-       this.searchcontext = new Gtk.SourceSearchContext(buf,s);
-       this.searchcontext.set_highlight(true);
-       s.set_search_text(txt);
-       
-       Gtk.TextIter beg, st,en;
-        
-       buf.get_start_iter(out beg);
-       this.searchcontext.forward(beg, out st, out en);
-       this.last_search_end  = 0;
-       return this.searchcontext.get_occurrences_count();
-    
-       
     }
     public void forwardSearch (bool change_focus) {
     
@@ -524,6 +524,15 @@ public class Xcls_GtkView : Object
         }
 
         // user defined functions
+        public string toString () {
+           Gtk.TextIter s;
+            Gtk.TextIter e;
+            this.el.get_buffer().get_start_iter(out s);
+            this.el.get_buffer().get_end_iter(out e);
+            var ret = this.el.get_buffer().get_text(s,e,true);
+            //print("TO STRING? " + ret);
+            return ret;
+        }
         public void nodeSelected (JsRender.Node? sel) {
           
             
@@ -581,15 +590,6 @@ public class Xcls_GtkView : Object
             }
             
         
-        }
-        public string toString () {
-           Gtk.TextIter s;
-            Gtk.TextIter e;
-            this.el.get_buffer().get_start_iter(out s);
-            this.el.get_buffer().get_end_iter(out e);
-            var ret = this.el.get_buffer().get_text(s,e,true);
-            //print("TO STRING? " + ret);
-            return ret;
         }
         public void loadFile ( ) {
             this.loading = true;
index 6af2225..f42279b 100644 (file)
@@ -1,44 +1,9 @@
 /*
-
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
-<interface>
-  <requires lib="gtk+" version="3.12"/>
-  <object class="GtkBox" id="box1">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="orientation">vertical</property>
-    <child>
-      <object class="GtkButton" id="button1">
-        <property name="label" translatable="yes">button</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <placeholder/>
-    </child>
-    <child>
-      <object class="GtkToggleButton" id="togglebutton1">
-        <property name="label" translatable="yes">togglebutton</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">2</property>
-      </packing>
-    </child>
-  </object>
-</interface>
+ This kind of works - however there are issues with embedding gladeui that do not seem fixable.
+ - rendering is borked for windows - they detach for some reason.
+ - selecting stuff and drag etc. would probably be complicated...
 */
 public class JsRender.NodeToGlade : Object {
 
index 9d46f06..80360a9 100644 (file)
@@ -217,7 +217,7 @@ BUIDERUI =          Builder4/About.vala \
                Builder4/WindowRooView.vala \
                Builder4/WindowLeftProps.vala \
                Builder4/PopoverAddProp.vala \
-               Builder4/GladeuiView.vala \
+               Builder4/GtkView.vala \
                Builder4/ValaProjectSettingsPopover.vala \
                Builder4/MainWindow.vala \
                Builder4/WindowState.vala \