Fix #7304 - text align on table cells and file open duplicate code
authorAlan <alan@roojs.com>
Thu, 7 Jul 2022 11:39:24 +0000 (19:39 +0800)
committerAlan <alan@roojs.com>
Thu, 7 Jul 2022 11:39:24 +0000 (19:39 +0800)
13 files changed:
src/Application.vala
src/Builder4/MainWindow.bjs
src/Builder4/MainWindow.vala
src/Builder4/PopoverFileDetails.bjs
src/Builder4/PopoverFileDetails.vala
src/Builder4/PopoverFiles.bjs
src/Builder4/PopoverFiles.vala
src/Builder4/ValaCompileErrors.bjs
src/Builder4/ValaCompileErrors.vala
src/Builder4/WindowState.vala
src/JsRender/NodeToVala.vala
src/Main.vala
src/OpenFilesModel.vala [new file with mode: 0644]

index c002de7..fc463fb 100644 (file)
@@ -14,7 +14,7 @@
                                this.save();
                        });
                }
-
                public static AppSettings factory()
                {
                         
                public BuilderApplication (  string[] args)
                {
                        
+                       
                        _self = FileUtils.read_link("/proc/self/exe");
                        GLib.debug("SELF = %s", _self);
                        
                               application_id: "org.roojs.app-builder",
                                flags: ApplicationFlags.FLAGS_NONE
                        );
-                                        
+                       BuilderApplication.windows = new        Gee.ArrayList<Xcls_MainWindow>();                
                        configDirectory();
                        this.settings = AppSettings.factory();  
                        var opt_context = new OptionContext ("Application Builder");
@@ -416,8 +417,56 @@ flutter-project  - create a flutter project in /tmp/test-flutter
                        GLib.Process.exit(Posix.EXIT_SUCCESS);          
                }
                
+               public static Gee.ArrayList<Xcls_MainWindow> windows;
+               
+               public static void addWindow(Xcls_MainWindow w)
+               {
+                        
+                       BuilderApplication.windows.add(w);
+                       BuilderApplication.updateWindows();
+               }
+               
+               public static void removeWindow(Xcls_MainWindow w)
+               {
+               
+                       BuilderApplication.windows.remove(w);
+                       BuilderApplication.updateWindows();
+               }
+               public static void updateWindows()
+               {
+                       foreach(var ww in BuilderApplication.windows) {
+                               ww.windowbtn.updateMenu();
+                       }
+               }
+               public static Xcls_MainWindow? getWindow(JsRender.JsRender file)
+               {
+                       foreach(var ww in BuilderApplication.windows) {
+                               if (ww.windowstate != null && ww.windowstate.file != null &&  ww.windowstate.file.path == file.path) {
+                                       return ww;
+                               }
+                       }
+                       return null;
+               
+               }
+               
+               public static void newWindow(JsRender.JsRender file, int line)
+               {
+                   var w = new Xcls_MainWindow();
+                       w.ref();
+                       BuilderApplication.addWindow(w);
+                       w.el.show_all();
+                       w.initChildren();
+                       w.windowstate. fileViewOpen(file, false, line);
+                        
+               
+               }
+               
+               
         
-       } 
+       }
+       
+       
+               
 
  
 
index 864b039..cc9a7a6 100644 (file)
@@ -3,8 +3,7 @@
  "items" : [
   {
    "# Project.Project project" : "null",
-   "# WindowState windowstate" : "null",
-   "# int no_windows" : 1,
+   "# WindowState windowstate" : "",
    "# string title" : "\"Roo Application Builder\"",
    "$ type" : "Gtk.WindowType.TOPLEVEL",
    "$ xns" : "Gtk",
        "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
        "items" : [
         {
-         "$ tooltop_text" : [
-          "\"Open a new Window",
-          "\""
-         ],
+         "# Gee.ArrayList<Gtk.MenuItem> mitems" : "",
+         "$ Gtk.Align halign" : "Gtk.Align.START",
+         "$ Gtk.ArrowType direction" : "Gtk.ArrowType.DOWN",
          "$ xns" : "Gtk",
-         "* pack" : "add",
+         "* init" : [
+          "{",
+          "\tthis.mitems = new Gee.ArrayList<Gtk.MenuItem>();",
+          "\t",
+          "}",
+          ""
+         ],
          "bool always_show_image" : true,
-         "id" : "windownew",
+         "bool use_popover" : false,
+         "id" : "windowbtn",
+         "int margin_end" : 4,
          "items" : [
           {
            "$ xns" : "Gtk",
            "* pack" : "set_image",
            "utf8 icon_name" : "window-new",
            "xtype" : "Image"
+          },
+          {
+           "$ xns" : "Gtk",
+           "* init" : [
+            "{",
+            "  this.el.show_all();",
+            "}",
+            ""
+           ],
+           "* prop" : "popup",
+           "items" : [
+            {
+             "$ xns" : "Gtk",
+             "* pack" : "append",
+             "listeners" : {
+              "activate" : [
+               "( ) => {",
+               "",
+               "\t_this.windowstate.showPopoverFiles(_this.windowbtn.el, _this.project, true);",
+               "}",
+               ""
+              ]
+             },
+             "string label" : "New Window",
+             "xtype" : "MenuItem"
+            },
+            {
+             "$ xns" : "Gtk",
+             "* pack" : "append",
+             "xtype" : "SeparatorMenuItem"
+            }
+           ],
+           "xtype" : "Menu"
           }
          ],
-         "listeners" : {
-          "clicked" : [
-           "  ( ) => {",
-           "     _this.openNewWindow();",
-           "      ",
-           "",
-           "}"
-          ]
-         },
-         "string label" : "New Window",
-         "xtype" : "Button"
+         "string label" : "Windows",
+         "xtype" : "MenuButton",
+         "| void updateMenu" : [
+          "() {",
+          "\t foreach(var m in  this.mitems) {",
+          "\t \t this.el.popup.remove(m);",
+          "\t }",
+          "\t this.mitems.clear();",
+          "\t   ",
+          "\t foreach(var w in BuilderApplication.windows) {",
+          "\t \tvar wid = BuilderApplication.windows.index_of(w);",
+          "\t \t// fixme find a better way to display this.",
+          " \t\tif (w.windowstate == null ||",
+          " \t\t\t w.windowstate.file == null || ",
+          " \t\t\t _this.windowstate == null ||",
+          " \t\t\t _this.windowstate.file == null",
+          " \t\t\t ) { ",
+          " \t\t\tcontinue;",
+          "\t\t}",
+          "\t \t",
+          "\t \tif (w.windowstate.file.path == _this.windowstate.file.path) {",
+          "\t \t\tcontinue;",
+          " \t\t}",
+          "",
+          " \t\tGLib.debug(\"add menuitem %s\", w.windowstate.file.path);",
+          "\t \tvar m = new Gtk.MenuItem.with_label(w.windowstate.file.path);",
+          "\t \tm.activate.connect(() => {",
+          "\t \t\t BuilderApplication.windows.get(wid).el.present();",
+          "\t \t});",
+          "\t \tthis.el.popup.append(m);",
+          "\t \tm.show();",
+          "\t \tthis.mitems.add(m);",
+          "\t }",
+          "}"
+         ]
         },
         {
          "$ tooltop_text" : "\"Open File\"",
          "listeners" : {
           "clicked" : [
            "  ( ) => {",
-           "  \t_this.windowstate.showPopoverFiles(this.el, _this.project);",
+           "  \t_this.windowstate.showPopoverFiles(this.el, _this.project, false);",
            "",
            "}"
           ]
            "        return  ;",
            "    }",
            "     _this.windowstate.file_details.show(",
-           "        _this.windowstate.file, this.el",
+           "        _this.windowstate.file, this.el, false",
            "    );",
            "     ",
            "    return  ;    ",
     ],
     "destroy" : [
      "() =>  {",
-     " Xcls_MainWindow.singleton().no_windows--;",
+     " ",
      " ",
      " Resources.singleton().disconnect(_this.statusbar.handler_id);",
      " ",
+     " BuilderApplication.removeWindow(this);",
      " ",
-     " if (Xcls_MainWindow.singleton().no_windows < 1) {",
+     " if (BuilderApplication.windows.size  < 1) {",
      "",
      "     Gtk.main_quit();",
      " }",
    ],
    "| void openNewWindow" : [
     "() {",
-    "\tXcls_MainWindow.singleton().no_windows++;",
+    " ",
     "    var w = new Xcls_MainWindow();",
     "    w.ref();",
-    "",
+    "\tBuilderApplication.addWindow(w);",
     "    w.el.show_all();",
     "    w.initChildren();",
-    "    w.windowstate.showPopoverFiles(w.open_projects_btn.el, _this.project);",
-    "        // should open the file dialog...",
-    "        //w.windowstate.switchState(WindowState.State.FILES);",
+    "    w.windowstate.showPopoverFiles(w.open_projects_btn.el, _this.project, false);",
+    "     ",
     "}",
     ""
    ],
index 5d91d50..0d2e287 100644 (file)
@@ -13,7 +13,7 @@ public class Xcls_MainWindow : Object
         return _MainWindow;
     }
     public Xcls_headerbar headerbar;
-    public Xcls_windownew windownew;
+    public Xcls_windowbtn windowbtn;
     public Xcls_open_projects_btn open_projects_btn;
     public Xcls_vbox vbox;
     public Xcls_mainpane mainpane;
@@ -35,7 +35,6 @@ public class Xcls_MainWindow : Object
     public Xcls_statusbar_compile_spinner statusbar_compile_spinner;
 
         // my vars (def)
-    public int no_windows;
     public WindowState windowstate;
     public string title;
     public Project.Project project;
@@ -47,8 +46,6 @@ public class Xcls_MainWindow : Object
         this.el = new Gtk.Window( Gtk.WindowType.TOPLEVEL );
 
         // my vars (dec)
-        this.no_windows = 1;
-        this.windowstate = null;
         this.title = "Roo Application Builder";
         this.project = null;
 
@@ -72,12 +69,13 @@ public class Xcls_MainWindow : Object
             return false;
         });
         this.el.destroy.connect( () =>  {
-         Xcls_MainWindow.singleton().no_windows--;
+         
          
          Resources.singleton().disconnect(_this.statusbar.handler_id);
          
+         BuilderApplication.removeWindow(this);
          
-         if (Xcls_MainWindow.singleton().no_windows < 1) {
+         if (BuilderApplication.windows.size  < 1) {
         
              Gtk.main_quit();
          }
@@ -147,15 +145,14 @@ public class Xcls_MainWindow : Object
         this.headerbar.el.set_title(this.title + " - " + str);
     }
     public void openNewWindow () {
-       Xcls_MainWindow.singleton().no_windows++;
+     
         var w = new Xcls_MainWindow();
         w.ref();
-    
+       BuilderApplication.addWindow(w);
         w.el.show_all();
         w.initChildren();
-        w.windowstate.showPopoverFiles(w.open_projects_btn.el, _this.project);
-            // should open the file dialog...
-            //w.windowstate.switchState(WindowState.State.FILES);
+        w.windowstate.showPopoverFiles(w.open_projects_btn.el, _this.project, false);
+         
     }
     public class Xcls_headerbar : Object
     {
@@ -201,9 +198,9 @@ public class Xcls_MainWindow : Object
             // my vars (dec)
 
             // set gobject values
-            var child_0 = new Xcls_windownew( _this );
+            var child_0 = new Xcls_windowbtn( _this );
             child_0.ref();
-            this.el.add (  child_0.el  );
+            this.el.add(  child_0.el );
             var child_1 = new Xcls_open_projects_btn( _this );
             child_1.ref();
             this.el.add (  child_1.el  );
@@ -211,39 +208,78 @@ public class Xcls_MainWindow : Object
 
         // user defined functions
     }
-    public class Xcls_windownew : Object
+    public class Xcls_windowbtn : Object
     {
-        public Gtk.Button el;
+        public Gtk.MenuButton el;
         private Xcls_MainWindow  _this;
 
 
             // my vars (def)
+        public Gee.ArrayList<Gtk.MenuItem> mitems;
 
         // ctor
-        public Xcls_windownew(Xcls_MainWindow _owner )
+        public Xcls_windowbtn(Xcls_MainWindow _owner )
         {
             _this = _owner;
-            _this.windownew = this;
-            this.el = new Gtk.Button();
+            _this.windowbtn = this;
+            this.el = new Gtk.MenuButton();
 
             // my vars (dec)
 
             // set gobject values
+            this.el.margin_end = 4;
+            this.el.halign = Gtk.Align.START;
+            this.el.direction = Gtk.ArrowType.DOWN;
+            this.el.use_popover = false;
             this.el.always_show_image = true;
-            this.el.label = "New Window";
+            this.el.label = "Windows";
             var child_0 = new Xcls_Image5( _this );
             child_0.ref();
             this.el.set_image (  child_0.el  );
+            var child_1 = new Xcls_Menu6( _this );
+            child_1.ref();
+            this.el.popup = child_1.el;
 
-            //listeners
-            this.el.clicked.connect( ( ) => {
-                 _this.openNewWindow();
-                  
-            
-            });
+            // init method
+
+            {
+               this.mitems = new Gee.ArrayList<Gtk.MenuItem>();
+               
+            }
         }
 
         // user defined functions
+        public void updateMenu () {
+                foreach(var m in  this.mitems) {
+                        this.el.popup.remove(m);
+                }
+                this.mitems.clear();
+                  
+                foreach(var w in BuilderApplication.windows) {
+                       var wid = BuilderApplication.windows.index_of(w);
+                       // fixme find a better way to display this.
+                       if (w.windowstate == null ||
+                                w.windowstate.file == null || 
+                                _this.windowstate == null ||
+                                _this.windowstate.file == null
+                                ) { 
+                               continue;
+                       }
+                       
+                       if (w.windowstate.file.path == _this.windowstate.file.path) {
+                               continue;
+                       }
+        
+                       GLib.debug("add menuitem %s", w.windowstate.file.path);
+                       var m = new Gtk.MenuItem.with_label(w.windowstate.file.path);
+                       m.activate.connect(() => {
+                                BuilderApplication.windows.get(wid).el.present();
+                       });
+                       this.el.popup.append(m);
+                       m.show();
+                       this.mitems.add(m);
+                }
+        }
     }
     public class Xcls_Image5 : Object
     {
@@ -268,6 +304,91 @@ public class Xcls_MainWindow : Object
         // user defined functions
     }
 
+    public class Xcls_Menu6 : Object
+    {
+        public Gtk.Menu el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_Menu6(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Menu();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_MenuItem7( _this );
+            child_0.ref();
+            this.el.append (  child_0.el  );
+            var child_1 = new Xcls_SeparatorMenuItem8( _this );
+            child_1.ref();
+            this.el.append (  child_1.el  );
+
+            // init method
+
+            {
+              this.el.show_all();
+            }
+        }
+
+        // user defined functions
+    }
+    public class Xcls_MenuItem7 : Object
+    {
+        public Gtk.MenuItem el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_MenuItem7(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "New Window";
+
+            //listeners
+            this.el.activate.connect( ( ) => {
+            
+               _this.windowstate.showPopoverFiles(_this.windowbtn.el, _this.project, true);
+            });
+        }
+
+        // user defined functions
+    }
+
+    public class Xcls_SeparatorMenuItem8 : Object
+    {
+        public Gtk.SeparatorMenuItem el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_SeparatorMenuItem8(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.SeparatorMenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions
+    }
+
+
 
     public class Xcls_open_projects_btn : Object
     {
@@ -289,20 +410,20 @@ public class Xcls_MainWindow : Object
             // set gobject values
             this.el.always_show_image = true;
             this.el.label = "Files / Projects";
-            var child_0 = new Xcls_Image7( _this );
+            var child_0 = new Xcls_Image10( _this );
             child_0.ref();
             this.el.set_image (  child_0.el  );
 
             //listeners
             this.el.clicked.connect( ( ) => {
-               _this.windowstate.showPopoverFiles(this.el, _this.project);
+               _this.windowstate.showPopoverFiles(this.el, _this.project, false);
             
             });
         }
 
         // user defined functions
     }
-    public class Xcls_Image7 : Object
+    public class Xcls_Image10 : Object
     {
         public Gtk.Image el;
         private Xcls_MainWindow  _this;
@@ -311,7 +432,7 @@ public class Xcls_MainWindow : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Image7(Xcls_MainWindow _owner )
+        public Xcls_Image10(Xcls_MainWindow _owner )
         {
             _this = _owner;
             this.el = new Gtk.Image();
@@ -350,7 +471,7 @@ public class Xcls_MainWindow : Object
             var child_0 = new Xcls_mainpane( _this );
             child_0.ref();
             this.el.pack_start (  child_0.el , true,true,0 );
-            var child_1 = new Xcls_Box17( _this );
+            var child_1 = new Xcls_Box20( _this );
             child_1.ref();
             this.el.pack_end (  child_1.el , false,true,0 );
         }
@@ -381,7 +502,7 @@ public class Xcls_MainWindow : Object
             var child_0 = new Xcls_leftpane( _this );
             child_0.ref();
             this.el.add (  child_0.el  );
-            var child_1 = new Xcls_Box14( _this );
+            var child_1 = new Xcls_Box17( _this );
             child_1.ref();
             this.el.add2 (  child_1.el  );
         }
@@ -499,7 +620,7 @@ public class Xcls_MainWindow : Object
 
 
 
-    public class Xcls_Box14 : Object
+    public class Xcls_Box17 : Object
     {
         public Gtk.Box el;
         private Xcls_MainWindow  _this;
@@ -508,7 +629,7 @@ public class Xcls_MainWindow : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Box14(Xcls_MainWindow _owner )
+        public Xcls_Box17(Xcls_MainWindow _owner )
         {
             _this = _owner;
             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
@@ -576,7 +697,7 @@ public class Xcls_MainWindow : Object
 
 
 
-    public class Xcls_Box17 : Object
+    public class Xcls_Box20 : Object
     {
         public Gtk.Box el;
         private Xcls_MainWindow  _this;
@@ -585,7 +706,7 @@ public class Xcls_MainWindow : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Box17(Xcls_MainWindow _owner )
+        public Xcls_Box20(Xcls_MainWindow _owner )
         {
             _this = _owner;
             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
@@ -594,16 +715,16 @@ public class Xcls_MainWindow : Object
 
             // set gobject values
             this.el.homogeneous = false;
-            var child_0 = new Xcls_Button18( _this );
+            var child_0 = new Xcls_Button21( _this );
             child_0.ref();
             this.el.add (  child_0.el  );
-            var child_1 = new Xcls_Button20( _this );
+            var child_1 = new Xcls_Button23( _this );
             child_1.ref();
             this.el.add (  child_1.el  );
-            var child_2 = new Xcls_MenuButton22( _this );
+            var child_2 = new Xcls_MenuButton25( _this );
             child_2.ref();
             this.el.add (  child_2.el  );
-            var child_3 = new Xcls_Label27( _this );
+            var child_3 = new Xcls_Label30( _this );
             child_3.ref();
             this.el.pack_start (  child_3.el , true,true,0 );
             var child_4 = new Xcls_statusbar( _this );
@@ -612,7 +733,7 @@ public class Xcls_MainWindow : Object
             var child_5 = new Xcls_search_entry( _this );
             child_5.ref();
             this.el.pack_start (  child_5.el , false,true,0 );
-            var child_6 = new Xcls_MenuBar30( _this );
+            var child_6 = new Xcls_MenuBar33( _this );
             child_6.ref();
             this.el.add (  child_6.el  );
             var child_7 = new Xcls_statusbar_compile_spinner( _this );
@@ -622,7 +743,7 @@ public class Xcls_MainWindow : Object
 
         // user defined functions
     }
-    public class Xcls_Button18 : Object
+    public class Xcls_Button21 : Object
     {
         public Gtk.Button el;
         private Xcls_MainWindow  _this;
@@ -631,7 +752,7 @@ public class Xcls_MainWindow : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Button18(Xcls_MainWindow _owner )
+        public Xcls_Button21(Xcls_MainWindow _owner )
         {
             _this = _owner;
             this.el = new Gtk.Button();
@@ -642,7 +763,7 @@ public class Xcls_MainWindow : Object
             this.el.always_show_image = true;
             this.el.tooltip_text = "Project Details";
             this.el.label = "Edit Project Settings";
-            var child_0 = new Xcls_Image19( _this );
+            var child_0 = new Xcls_Image22( _this );
             child_0.ref();
             this.el.set_image (  child_0.el  );
 
@@ -657,7 +778,7 @@ public class Xcls_MainWindow : Object
 
         // user defined functions
     }
-    public class Xcls_Image19 : Object
+    public class Xcls_Image22 : Object
     {
         public Gtk.Image el;
         private Xcls_MainWindow  _this;
@@ -666,7 +787,7 @@ public class Xcls_MainWindow : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Image19(Xcls_MainWindow _owner )
+        public Xcls_Image22(Xcls_MainWindow _owner )
         {
             _this = _owner;
             this.el = new Gtk.Image();
@@ -681,7 +802,7 @@ public class Xcls_MainWindow : Object
     }
 
 
-    public class Xcls_Button20 : Object
+    public class Xcls_Button23 : Object
     {
         public Gtk.Button el;
         private Xcls_MainWindow  _this;
@@ -690,7 +811,7 @@ public class Xcls_MainWindow : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Button20(Xcls_MainWindow _owner )
+        public Xcls_Button23(Xcls_MainWindow _owner )
         {
             _this = _owner;
             this.el = new Gtk.Button();
@@ -701,7 +822,7 @@ public class Xcls_MainWindow : Object
             this.el.always_show_image = true;
             this.el.tooltip_text = "File Details";
             this.el.label = "Edit File Properties";
-            var child_0 = new Xcls_Image21( _this );
+            var child_0 = new Xcls_Image24( _this );
             child_0.ref();
             this.el.set_image (  child_0.el  );
 
@@ -713,7 +834,7 @@ public class Xcls_MainWindow : Object
                     return  ;
                 }
                  _this.windowstate.file_details.show(
-                    _this.windowstate.file, this.el
+                    _this.windowstate.file, this.el, false
                 );
                  
                 return  ;    
@@ -724,7 +845,7 @@ public class Xcls_MainWindow : Object
 
         // user defined functions
     }
-    public class Xcls_Image21 : Object
+    public class Xcls_Image24 : Object
     {
         public Gtk.Image el;
         private Xcls_MainWindow  _this;
@@ -733,7 +854,7 @@ public class Xcls_MainWindow : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Image21(Xcls_MainWindow _owner )
+        public Xcls_Image24(Xcls_MainWindow _owner )
         {
             _this = _owner;
             this.el = new Gtk.Image();
@@ -748,7 +869,7 @@ public class Xcls_MainWindow : Object
     }
 
 
-    public class Xcls_MenuButton22 : Object
+    public class Xcls_MenuButton25 : Object
     {
         public Gtk.MenuButton el;
         private Xcls_MainWindow  _this;
@@ -757,7 +878,7 @@ public class Xcls_MainWindow : Object
             // my vars (def)
 
         // ctor
-        public Xcls_MenuButton22(Xcls_MainWindow _owner )
+        public Xcls_MenuButton25(Xcls_MainWindow _owner )
         {
             _this = _owner;
             this.el = new Gtk.MenuButton();
@@ -770,7 +891,7 @@ public class Xcls_MainWindow : Object
             var child_0 = new Xcls_topbarmenu( _this );
             child_0.ref();
             this.el.set_popup (  child_0.el  );
-            var child_1 = new Xcls_Image26( _this );
+            var child_1 = new Xcls_Image29( _this );
             child_1.ref();
             this.el.set_image (  child_1.el  );
         }
@@ -795,10 +916,10 @@ public class Xcls_MainWindow : Object
             // my vars (dec)
 
             // set gobject values
-            var child_0 = new Xcls_MenuItem24( _this );
+            var child_0 = new Xcls_MenuItem27( _this );
             child_0.ref();
             this.el.append (  child_0.el  );
-            var child_1 = new Xcls_MenuItem25( _this );
+            var child_1 = new Xcls_MenuItem28( _this );
             child_1.ref();
             this.el.append (  child_1.el  );
 
@@ -811,7 +932,7 @@ public class Xcls_MainWindow : Object
 
         // user defined functions
     }
-    public class Xcls_MenuItem24 : Object
+    public class Xcls_MenuItem27 : Object
     {
         public Gtk.MenuItem el;
         private Xcls_MainWindow  _this;
@@ -820,7 +941,7 @@ public class Xcls_MainWindow : Object
             // my vars (def)
 
         // ctor
-        public Xcls_MenuItem24(Xcls_MainWindow _owner )
+        public Xcls_MenuItem27(Xcls_MainWindow _owner )
         {
             _this = _owner;
             this.el = new Gtk.MenuItem();
@@ -839,7 +960,7 @@ public class Xcls_MainWindow : Object
         // user defined functions
     }
 
-    public class Xcls_MenuItem25 : Object
+    public class Xcls_MenuItem28 : Object
     {
         public Gtk.MenuItem el;
         private Xcls_MainWindow  _this;
@@ -848,7 +969,7 @@ public class Xcls_MainWindow : Object
             // my vars (def)
 
         // ctor
-        public Xcls_MenuItem25(Xcls_MainWindow _owner )
+        public Xcls_MenuItem28(Xcls_MainWindow _owner )
         {
             _this = _owner;
             this.el = new Gtk.MenuItem();
@@ -868,7 +989,7 @@ public class Xcls_MainWindow : Object
     }
 
 
-    public class Xcls_Image26 : Object
+    public class Xcls_Image29 : Object
     {
         public Gtk.Image el;
         private Xcls_MainWindow  _this;
@@ -877,7 +998,7 @@ public class Xcls_MainWindow : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Image26(Xcls_MainWindow _owner )
+        public Xcls_Image29(Xcls_MainWindow _owner )
         {
             _this = _owner;
             this.el = new Gtk.Image();
@@ -892,7 +1013,7 @@ public class Xcls_MainWindow : Object
     }
 
 
-    public class Xcls_Label27 : Object
+    public class Xcls_Label30 : Object
     {
         public Gtk.Label el;
         private Xcls_MainWindow  _this;
@@ -901,7 +1022,7 @@ public class Xcls_MainWindow : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Label27(Xcls_MainWindow _owner )
+        public Xcls_Label30(Xcls_MainWindow _owner )
         {
             _this = _owner;
             this.el = new Gtk.Label( "   " );
@@ -1054,7 +1175,7 @@ public class Xcls_MainWindow : Object
         }
     }
 
-    public class Xcls_MenuBar30 : Object
+    public class Xcls_MenuBar33 : Object
     {
         public Gtk.MenuBar el;
         private Xcls_MainWindow  _this;
@@ -1063,7 +1184,7 @@ public class Xcls_MainWindow : Object
             // my vars (def)
 
         // ctor
-        public Xcls_MenuBar30(Xcls_MainWindow _owner )
+        public Xcls_MenuBar33(Xcls_MainWindow _owner )
         {
             _this = _owner;
             this.el = new Gtk.MenuBar();
@@ -1115,7 +1236,7 @@ public class Xcls_MainWindow : Object
             // set gobject values
             this.el.always_show_image = true;
             this.el.label = "Matches";
-            var child_0 = new Xcls_Image32( _this );
+            var child_0 = new Xcls_Image35( _this );
             child_0.ref();
             this.el.set_image (  child_0.el  );
 
@@ -1136,7 +1257,7 @@ public class Xcls_MainWindow : Object
 
         // user defined functions
     }
-    public class Xcls_Image32 : Object
+    public class Xcls_Image35 : Object
     {
         public Gtk.Image el;
         private Xcls_MainWindow  _this;
@@ -1145,7 +1266,7 @@ public class Xcls_MainWindow : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Image32(Xcls_MainWindow _owner )
+        public Xcls_Image35(Xcls_MainWindow _owner )
         {
             _this = _owner;
             this.el = new Gtk.Image();
@@ -1208,7 +1329,7 @@ public class Xcls_MainWindow : Object
             // set gobject values
             this.el.always_show_image = true;
             this.el.label = "Errors";
-            var child_0 = new Xcls_Image35( _this );
+            var child_0 = new Xcls_Image38( _this );
             child_0.ref();
             this.el.set_image (  child_0.el  );
 
@@ -1233,7 +1354,7 @@ public class Xcls_MainWindow : Object
         
         }
     }
-    public class Xcls_Image35 : Object
+    public class Xcls_Image38 : Object
     {
         public Gtk.Image el;
         private Xcls_MainWindow  _this;
@@ -1242,7 +1363,7 @@ public class Xcls_MainWindow : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Image35(Xcls_MainWindow _owner )
+        public Xcls_Image38(Xcls_MainWindow _owner )
         {
             _this = _owner;
             this.el = new Gtk.Image();
@@ -1280,7 +1401,7 @@ public class Xcls_MainWindow : Object
             // set gobject values
             this.el.always_show_image = true;
             this.el.label = "Warnings";
-            var child_0 = new Xcls_Image37( _this );
+            var child_0 = new Xcls_Image40( _this );
             child_0.ref();
             this.el.set_image (  child_0.el  );
 
@@ -1304,7 +1425,7 @@ public class Xcls_MainWindow : Object
         
         }
     }
-    public class Xcls_Image37 : Object
+    public class Xcls_Image40 : Object
     {
         public Gtk.Image el;
         private Xcls_MainWindow  _this;
@@ -1313,7 +1434,7 @@ public class Xcls_MainWindow : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Image37(Xcls_MainWindow _owner )
+        public Xcls_Image40(Xcls_MainWindow _owner )
         {
             _this = _owner;
             this.el = new Gtk.Image();
@@ -1351,7 +1472,7 @@ public class Xcls_MainWindow : Object
             // set gobject values
             this.el.always_show_image = true;
             this.el.label = "Depricated";
-            var child_0 = new Xcls_Image39( _this );
+            var child_0 = new Xcls_Image42( _this );
             child_0.ref();
             this.el.set_image (  child_0.el  );
 
@@ -1376,7 +1497,7 @@ public class Xcls_MainWindow : Object
         
         }
     }
-    public class Xcls_Image39 : Object
+    public class Xcls_Image42 : Object
     {
         public Gtk.Image el;
         private Xcls_MainWindow  _this;
@@ -1385,7 +1506,7 @@ public class Xcls_MainWindow : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Image39(Xcls_MainWindow _owner )
+        public Xcls_Image42(Xcls_MainWindow _owner )
         {
             _this = _owner;
             this.el = new Gtk.Image();
@@ -1421,7 +1542,7 @@ public class Xcls_MainWindow : Object
             // set gobject values
             this.el.always_show_image = true;
             this.el.label = "Run";
-            var child_0 = new Xcls_Image41( _this );
+            var child_0 = new Xcls_Image44( _this );
             child_0.ref();
             this.el.set_image (  child_0.el  );
 
@@ -1440,7 +1561,7 @@ public class Xcls_MainWindow : Object
 
         // user defined functions
     }
-    public class Xcls_Image41 : Object
+    public class Xcls_Image44 : Object
     {
         public Gtk.Image el;
         private Xcls_MainWindow  _this;
@@ -1449,7 +1570,7 @@ public class Xcls_MainWindow : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Image41(Xcls_MainWindow _owner )
+        public Xcls_Image44(Xcls_MainWindow _owner )
         {
             _this = _owner;
             this.el = new Gtk.Image();
index 5d260c6..7891cb8 100644 (file)
@@ -4,6 +4,7 @@
   {
    "# JsRender.JsRender file" : "null",
    "# Project.Project project" : "",
+   "# bool new_window" : true,
    "$ xns" : "Gtk",
    "@ void success" : "(Project.Project pr, JsRender.JsRender file)",
    "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
    "uint border_width" : 0,
    "xtype" : "Popover",
    "| void show" : [
-    "(JsRender.JsRender c, Gtk.Widget btn) ",
+    "(JsRender.JsRender c, Gtk.Widget btn, bool new_window) ",
     "{",
     "    this.project = c.project;",
     "    this.done = false;",
-    "    ",
+    "    this.new_window = new_window;",
     "    ",
     "    //if (!this.el) {",
     "        //this.init();",
index 9f01eea..abc6952 100644 (file)
@@ -32,6 +32,7 @@ public class Xcls_PopoverFileDetails : Object
     public Xcls_save_btn save_btn;
 
         // my vars (def)
+    public bool new_window;
     public signal void success (Project.Project pr, JsRender.JsRender file);
     public JsRender.JsRender file;
     public Project.Project project;
@@ -45,6 +46,7 @@ public class Xcls_PopoverFileDetails : Object
         this.el = new Gtk.Popover( null );
 
         // my vars (dec)
+        this.new_window = true;
         this.file = null;
         this.mainwindow = null;
         this.done = false;
@@ -74,11 +76,11 @@ public class Xcls_PopoverFileDetails : Object
     }
 
     // user defined functions
-    public void show (JsRender.JsRender c, Gtk.Widget btn) 
+    public void show (JsRender.JsRender c, Gtk.Widget btn, bool new_window
     {
         this.project = c.project;
         this.done = false;
-        
+        this.new_window = new_window;
         
         //if (!this.el) {
             //this.init();
@@ -457,7 +459,7 @@ public class Xcls_PopoverFileDetails : Object
         {
             _this = _owner;
             _this.ftdbmodel = this;
-            this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
+            this.el = new Gtk.ListStore.newv(  { typeof(string),typeof(string) }  );
 
             // my vars (dec)
 
@@ -902,7 +904,7 @@ public class Xcls_PopoverFileDetails : Object
         {
             _this = _owner;
             _this.dbmodel = this;
-            this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
+            this.el = new Gtk.ListStore.newv(  { typeof(string),typeof(string) }  );
 
             // my vars (dec)
 
@@ -1040,7 +1042,7 @@ public class Xcls_PopoverFileDetails : Object
         {
             _this = _owner;
             _this.dirmodel = this;
-            this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
+            this.el = new Gtk.ListStore.newv(  { typeof(string),typeof(string) }  );
 
             // my vars (dec)
 
index ba121d9..4b5fd0c 100644 (file)
@@ -7,6 +7,7 @@
    "# Xcls_MainWindow win" : "",
    "# bool is_loaded" : false,
    "# bool is_loading" : false,
+   "# bool new_window" : false,
    "$ xns" : "Gtk",
    "Gtk.PositionType position" : "Gtk.PositionType.TOP",
    "bool active" : false,
              "    }",
              "    ",
              "    var f = JsRender.JsRender.factory(_this.selectedProject.xtype,  _this.selectedProject, \"\");",
-             "     _this.win.windowstate.file_details.show( f, this.el );",
+             "     _this.win.windowstate.file_details.show( f, this.el, _this.new_window );",
              "",
              "}"
             ]
              "    var file = (JsRender.JsRender)gval;",
              "    ",
              "    ",
-             "    _this.win.windowstate.fileViewOpen(file);",
+             "    _this.win.windowstate.fileViewOpen(file, _this.new_window);",
              "",
              "    ",
              "    ",
              "    var f = JsRender.JsRender.factory(\"PlainFile\", _this.selectedProject, fn);",
              "   ",
              "   ",
-             "    _this.win.windowstate.fileViewOpen(f);",
+             "    _this.win.windowstate.fileViewOpen(f, _this.new_window);",
              "   ",
              "    ",
              "}"
     ""
    ],
    "| void show" : [
-    "(Gtk.Widget on_el, Project.Project? project ) {",
+    "(Gtk.Widget on_el, Project.Project? project, bool new_window) {",
     "\t//this.editor.show( file, node, ptype, key);",
     "\t",
+    "\tthis.new_window = new_window;",
     "\t\t// save...",
     "\tthis.load();",
     "\tif (project != null) {",
index 9740e0f..318f2f6 100644 (file)
@@ -23,12 +23,13 @@ public class Xcls_PopoverFiles : Object
     public Xcls_filenamecol filenamecol;
 
         // my vars (def)
-    public Project.Project selectedProject;
-    public bool is_loaded;
-    public bool active;
     public Xcls_MainWindow win;
-    public Gdk.Pixbuf missing_thumb_pixbuf;
+    public Project.Project selectedProject;
     public bool is_loading;
+    public bool new_window;
+    public Gdk.Pixbuf missing_thumb_pixbuf;
+    public bool active;
+    public bool is_loaded;
 
     // ctor
     public Xcls_PopoverFiles()
@@ -37,9 +38,10 @@ public class Xcls_PopoverFiles : Object
         this.el = new Gtk.Popover( null );
 
         // my vars (dec)
-        this.is_loaded = false;
-        this.active = false;
         this.is_loading = false;
+        this.new_window = false;
+        this.active = false;
+        this.is_loaded = false;
 
         // set gobject values
         this.el.width_request = 900;
@@ -65,78 +67,6 @@ public class Xcls_PopoverFiles : Object
     }
 
     // user defined functions
-    public void show (Gtk.Widget on_el, Project.Project? project ) {
-       //this.editor.show( file, node, ptype, key);
-       
-               // save...
-       this.load();
-       if (project != null) {
-               this.selectProject(project);
-       }
-       
-       
-        int w,h;
-        this.win.el.get_size(out w, out h);
-        
-        // left tree = 250, editor area = 500?
-        
-        // min 450?
-       // max hieght ...
-       
-       var  ww =  on_el.get_allocated_width();
-       
-       // width = should be max = w-ww , or 600 at best..?
-        
-        this.el.set_size_request( w, h); // same as parent...
-    
-    
-       this.el.set_modal(true);
-       this.el.set_relative_to(on_el);
-    
-       //this.el.set_position(Gtk.PositionType.BOTTOM);
-    
-       // window + header?
-     
-       this.el.show_all();
-        //while(Gtk.events_pending()) { 
-        //        Gtk.main_iteration();   // why?
-        //}  
-    
-    }
-    public void setMainWindow (Xcls_MainWindow win) {
-       this.win = win;
-        
-    }
-    public void load () {
-         // clear list...
-        
-         if (_this.is_loaded) {
-             return;
-         }
-         _this.is_loading = true;
-            
-         _this.is_loaded = true;
-         
-         Project.Project.loadAll();
-         var projects = Project.Project.allProjectsByName();
-         
-         Gtk.TreeIter iter;
-         var m = this.model.el;
-         m.clear();
-              
-         for (var i = 0; i < projects.size; i++) {
-            m.append(out iter);
-            m.set(iter,   0,projects.get(i).name );
-            
-            var o =  GLib.Value(typeof(Object));
-            o.set_object((Object)projects.get(i));
-                       
-            m.set_value(iter, 1, o);
-         
-         }
-         m.set_sort_column_id(0, Gtk.SortType.ASCENDING);
-         _this.is_loading = false;      
-    }
     public void onProjectSelected (Project.Project project) {
        this.selectedProject = project;
        project.scanDirs();
@@ -285,6 +215,79 @@ public class Xcls_PopoverFiles : Object
            print("tried to select %s, could not find it", project.name);
         }
     }
+    public void show (Gtk.Widget on_el, Project.Project? project, bool new_window) {
+       //this.editor.show( file, node, ptype, key);
+       
+       this.new_window = new_window;
+               // save...
+       this.load();
+       if (project != null) {
+               this.selectProject(project);
+       }
+       
+       
+        int w,h;
+        this.win.el.get_size(out w, out h);
+        
+        // left tree = 250, editor area = 500?
+        
+        // min 450?
+       // max hieght ...
+       
+       var  ww =  on_el.get_allocated_width();
+       
+       // width = should be max = w-ww , or 600 at best..?
+        
+        this.el.set_size_request( w, h); // same as parent...
+    
+    
+       this.el.set_modal(true);
+       this.el.set_relative_to(on_el);
+    
+       //this.el.set_position(Gtk.PositionType.BOTTOM);
+    
+       // window + header?
+     
+       this.el.show_all();
+        //while(Gtk.events_pending()) { 
+        //        Gtk.main_iteration();   // why?
+        //}  
+    
+    }
+    public void load () {
+         // clear list...
+        
+         if (_this.is_loaded) {
+             return;
+         }
+         _this.is_loading = true;
+            
+         _this.is_loaded = true;
+         
+         Project.Project.loadAll();
+         var projects = Project.Project.allProjectsByName();
+         
+         Gtk.TreeIter iter;
+         var m = this.model.el;
+         m.clear();
+              
+         for (var i = 0; i < projects.size; i++) {
+            m.append(out iter);
+            m.set(iter,   0,projects.get(i).name );
+            
+            var o =  GLib.Value(typeof(Object));
+            o.set_object((Object)projects.get(i));
+                       
+            m.set_value(iter, 1, o);
+         
+         }
+         m.set_sort_column_id(0, Gtk.SortType.ASCENDING);
+         _this.is_loading = false;      
+    }
+    public void setMainWindow (Xcls_MainWindow win) {
+       this.win = win;
+        
+    }
     public class Xcls_Box2 : Object
     {
         public Gtk.Box el;
@@ -532,7 +535,7 @@ public class Xcls_PopoverFiles : Object
                 }
                 
                 var f = JsRender.JsRender.factory(_this.selectedProject.xtype,  _this.selectedProject, "");
-                 _this.win.windowstate.file_details.show( f, this.el );
+                 _this.win.windowstate.file_details.show( f, this.el, _this.new_window );
             
             });
         }
@@ -679,7 +682,7 @@ public class Xcls_PopoverFiles : Object
         {
             _this = _owner;
             _this.model = this;
-            this.el = new Gtk.ListStore( 2, typeof(string), typeof(Object) );
+            this.el = new Gtk.ListStore.newv(  { typeof(string), typeof(Object) }  );
 
             // my vars (dec)
 
@@ -841,7 +844,7 @@ public class Xcls_PopoverFiles : Object
                 var file = (JsRender.JsRender)gval;
                 
                 
-                _this.win.windowstate.fileViewOpen(file);
+                _this.win.windowstate.fileViewOpen(file, _this.new_window);
             
                 
                 
@@ -863,7 +866,7 @@ public class Xcls_PopoverFiles : Object
         {
             _this = _owner;
             _this.iconmodel = this;
-            this.el = new Gtk.ListStore( 4, typeof(Object), typeof(string), typeof(string), typeof(Gdk.Pixbuf)  );
+            this.el = new Gtk.ListStore.newv(  { typeof(Object), typeof(string), typeof(string), typeof(Gdk.Pixbuf)  }  );
 
             // my vars (dec)
 
@@ -967,7 +970,7 @@ public class Xcls_PopoverFiles : Object
                 var f = JsRender.JsRender.factory("PlainFile", _this.selectedProject, fn);
                
                
-                _this.win.windowstate.fileViewOpen(f);
+                _this.win.windowstate.fileViewOpen(f, _this.new_window);
                
                 
             });
@@ -1010,7 +1013,7 @@ public class Xcls_PopoverFiles : Object
         {
             _this = _owner;
             _this.filemodel = this;
-            this.el = new Gtk.TreeStore( 2, typeof(string), typeof(string) );
+            this.el = new Gtk.TreeStore.newv(  { typeof(string), typeof(string) }  );
 
             // my vars (dec)
 
index 2c68415..db659cd 100644 (file)
            "        ",
            "    var jsr = p.getByPath(bjsf);",
            "    if (jsr != null) {",
-           "        _this.window.windowstate.fileViewOpen(jsr, line);",
+           "        _this.window.windowstate.fileViewOpen(jsr, true, line);",
            "        ",
            "        return false;",
            "    ",
            "    }",
            "    ",
            "    var pf = JsRender.JsRender.factory(\"PlainFile\", p, fname);",
-           "    _this.window.windowstate.fileViewOpen(pf,line);",
+           "    _this.window.windowstate.fileViewOpen(pf, true, line);",
            "    ",
            "    // try hiding the left nav..",
            " ",
index 3abca92..3ec52b4 100644 (file)
@@ -15,13 +15,14 @@ public class Xcls_ValaCompileErrors : Object
     public Xcls_compile_view compile_view;
     public Xcls_compile_tree compile_tree;
     public Xcls_compile_result_store compile_result_store;
+    public Xcls_column column;
     public Xcls_renderer renderer;
 
         // my vars (def)
     public Xcls_MainWindow window;
-    public bool active;
-    public JsRender.JsRender? file;
     public Json.Object notices;
+    public JsRender.JsRender? file;
+    public bool active;
 
     // ctor
     public Xcls_ValaCompileErrors()
@@ -313,14 +314,14 @@ public class Xcls_ValaCompileErrors : Object
                     
                 var jsr = p.getByPath(bjsf);
                 if (jsr != null) {
-                    _this.window.windowstate.fileViewOpen(jsr, line);
+                    _this.window.windowstate.fileViewOpen(jsr, true, line);
                     
                     return false;
                 
                 }
                 
                 var pf = JsRender.JsRender.factory("PlainFile", p, fname);
-                _this.window.windowstate.fileViewOpen(pf,line);
+                _this.window.windowstate.fileViewOpen(pf, true, line);
                 
                 // try hiding the left nav..
              
@@ -344,7 +345,7 @@ public class Xcls_ValaCompileErrors : Object
         {
             _this = _owner;
             _this.compile_result_store = this;
-            this.el = new Gtk.TreeStore( 4,   typeof(string), typeof(int), typeof(string), typeof(string)  );
+            this.el = new Gtk.TreeStore.newv(  {   typeof(string), typeof(int), typeof(string), typeof(string)  }  );
 
             // my vars (dec)
 
@@ -366,6 +367,7 @@ public class Xcls_ValaCompileErrors : Object
         public Xcls_column(Xcls_ValaCompileErrors _owner )
         {
             _this = _owner;
+            _this.column = this;
             this.el = new Gtk.TreeViewColumn();
 
             // my vars (dec)
index 87c617e..79605e4 100644 (file)
@@ -571,38 +571,13 @@ public class WindowState : Object
        
        
        // ----------- file view
-       public void showPopoverFiles(Gtk.Widget btn, Project.Project? project)
+       public void showPopoverFiles(Gtk.Widget btn, Project.Project? project, bool new_window)
        {
-               this.popover_files.show(btn, project);
+               this.popover_files.show(btn, project, new_window);
        
        }
        
        
-/*
-       public void fileViewInit()
-       {
-               var stage = this.win.rooview.el.get_stage(); // seems odd... 
-               this.clutterfiles = new Xcls_ClutterFiles();
-               this.clutterfiles.ref();
-               stage.add_child(this.clutterfiles.el);
-               this.clutterfiles.el.show();
-
-
-               this.clutterfiles.open.connect((file) => { 
-                       this.fileViewOpen(file);
-               });
-               this.clutterfiles.el.transitions_completed.connect(() => {
-                       if (this.state == State.FILES) {
-                               this.win.rooview.el.hide();
-                       } else {
-                               this.clutterfiles.el.hide();
-                       }
-                       
-                       
-               });
-
-       }
-       */
  
        public void fileDetailsInit()
        {
@@ -612,37 +587,70 @@ public class WindowState : Object
                
                this.file_details.success.connect((project,file) =>
                {
-                       this.fileViewOpen(file);
+                       this.fileViewOpen(file, this.file_details.new_window,  -1);
                });
 
        }
        
-       public void fileViewOpen(JsRender.JsRender file, int line = -1)
+       
+       public void gotoLine(int line)
+       {
+       
+               if (file.xtype == "PlainFile") {
+                   this.switchState (State.CODEONLY); 
+                       if (line> -1) {
+                               this.code_editor_tab.scroll_to_line(line);
+                       }
+               } else {
+               
+                       this.switchState (State.PREVIEW); 
+                        
+                       if (file.project.xtype == "Gtk" && line> -1 ) {
+                               // fixme - show the editing tab.
+                               this.window_gladeview.scroll_to_line(line);
+                       } 
+                       // fixme - what about Roo?
+
+               }
+       
+       }
+       
+       public void fileViewOpen(JsRender.JsRender file, bool new_window, int line = -1)
        {
+               var existing = BuilderApplication.getWindow(file);
+               
+               if (existing != null) {
+                       existing.el.present();
+                       existing.windowstate.gotoLine(line);
+                       return;
+               }
+               
+               if (new_window) {
+                       BuilderApplication.newWindow(file, line);
+                       return;
+               }
+               
+               
                this.win.project = file.project;
                this.project = file.project;
                this.file = file;
-               
+               BuilderApplication.updateWindows();
                
                if (file.xtype == "PlainFile") {
                        this.win.codeeditviewbox.el.show();
                        this.switchState (State.CODEONLY); 
                        file.loadItems();
                        this.code_editor_tab.show(file, null, null);
-                       if (line> -1) {
-                               this.code_editor_tab.scroll_to_line(line);
-                       }
+                        
                } else {
                
                        this.switchState (State.PREVIEW); 
                        // this triggers loadItems..
                        this.left_tree.model.loadFile(file);
-                       if (file.project.xtype == "Gtk" && line> -1 ) {
-                               this.window_gladeview.scroll_to_line(line);
-                       }
+                        
 
                }
-       
+               this.gotoLine(line);
        
                var ctr= this.win.rooviewbox.el;
  
@@ -754,12 +762,7 @@ public class WindowState : Object
                        btn
                );
        }
-       public void showFilesPopover(Gtk.Widget btn)
-       {
-               this.popover_files.el.show_all();
-               this.popover_files.show(btn, this.win.project);
-
-       }
+        
                 
        
        public void switchState(State new_state)
index 00a48a8..6178db3 100644 (file)
@@ -925,7 +925,12 @@ public class JsRender.NodeToVala : Object {
                                                // do nothing
                                                return;
                                }
-               
+                               return;
+                               
+                       case "Gtk.Menu":
+                               this.addLine(this.ipad + "this.el.append(  child_" + "%d".printf(i) + ".el );");
+                               return;
+                       
                        default:
                                this.addLine(this.ipad + "this.el.add(  child_" + "%d".printf(i) + ".el );");
                                return;
index 132e0df..3ce631b 100644 (file)
@@ -23,11 +23,12 @@ int main (string[] args) {
         
 
        var w = Xcls_MainWindow.singleton();
-       
+
+       app.addWindow(w);
        w.el.show_all();
        // it looks like showall after children causes segfault on ubuntu 14.4
        w.initChildren();
-       w.windowstate.showPopoverFiles(w.open_projects_btn.el, null);
+       w.windowstate.showPopoverFiles(w.open_projects_btn.el, null, false);
 //     w.windowstate.switchState(WindowState.State.FILES);
        
        Gtk.main();
diff --git a/src/OpenFilesModel.vala b/src/OpenFilesModel.vala
new file mode 100644 (file)
index 0000000..c7dec7f
--- /dev/null
@@ -0,0 +1,2 @@
+
\ No newline at end of file