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");
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);
+
+
+ }
+
+
- }
+ }
+
+
+
"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);",
+ " ",
"}",
""
],
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;
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;
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;
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();
}
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
{
// 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 );
// 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
{
// 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
{
// 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;
// my vars (def)
// ctor
- public Xcls_Image7(Xcls_MainWindow _owner )
+ public Xcls_Image10(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Image();
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 );
}
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 );
}
- public class Xcls_Box14 : Object
+ public class Xcls_Box17 : Object
{
public Gtk.Box el;
private Xcls_MainWindow _this;
// 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 );
- public class Xcls_Box17 : Object
+ public class Xcls_Box20 : Object
{
public Gtk.Box el;
private Xcls_MainWindow _this;
// 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 );
// 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 );
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 );
// user defined functions
}
- public class Xcls_Button18 : Object
+ public class Xcls_Button21 : Object
{
public Gtk.Button el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Button18(Xcls_MainWindow _owner )
+ public Xcls_Button21(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Button();
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 );
// user defined functions
}
- public class Xcls_Image19 : Object
+ public class Xcls_Image22 : Object
{
public Gtk.Image el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Image19(Xcls_MainWindow _owner )
+ public Xcls_Image22(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Image();
}
- public class Xcls_Button20 : Object
+ public class Xcls_Button23 : Object
{
public Gtk.Button el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Button20(Xcls_MainWindow _owner )
+ public Xcls_Button23(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Button();
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 );
return ;
}
_this.windowstate.file_details.show(
- _this.windowstate.file, this.el
+ _this.windowstate.file, this.el, false
);
return ;
// user defined functions
}
- public class Xcls_Image21 : Object
+ public class Xcls_Image24 : Object
{
public Gtk.Image el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Image21(Xcls_MainWindow _owner )
+ public Xcls_Image24(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Image();
}
- public class Xcls_MenuButton22 : Object
+ public class Xcls_MenuButton25 : Object
{
public Gtk.MenuButton el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_MenuButton22(Xcls_MainWindow _owner )
+ public Xcls_MenuButton25(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.MenuButton();
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 );
}
// 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 );
// user defined functions
}
- public class Xcls_MenuItem24 : Object
+ public class Xcls_MenuItem27 : Object
{
public Gtk.MenuItem el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_MenuItem24(Xcls_MainWindow _owner )
+ public Xcls_MenuItem27(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
// user defined functions
}
- public class Xcls_MenuItem25 : Object
+ public class Xcls_MenuItem28 : Object
{
public Gtk.MenuItem el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_MenuItem25(Xcls_MainWindow _owner )
+ public Xcls_MenuItem28(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.MenuItem();
}
- public class Xcls_Image26 : Object
+ public class Xcls_Image29 : Object
{
public Gtk.Image el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Image26(Xcls_MainWindow _owner )
+ public Xcls_Image29(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Image();
}
- public class Xcls_Label27 : Object
+ public class Xcls_Label30 : Object
{
public Gtk.Label el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Label27(Xcls_MainWindow _owner )
+ public Xcls_Label30(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Label( " " );
}
}
- public class Xcls_MenuBar30 : Object
+ public class Xcls_MenuBar33 : Object
{
public Gtk.MenuBar el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_MenuBar30(Xcls_MainWindow _owner )
+ public Xcls_MenuBar33(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.MenuBar();
// 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 );
// user defined functions
}
- public class Xcls_Image32 : Object
+ public class Xcls_Image35 : Object
{
public Gtk.Image el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Image32(Xcls_MainWindow _owner )
+ public Xcls_Image35(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Image();
// 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 );
}
}
- public class Xcls_Image35 : Object
+ public class Xcls_Image38 : Object
{
public Gtk.Image el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Image35(Xcls_MainWindow _owner )
+ public Xcls_Image38(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Image();
// 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 );
}
}
- public class Xcls_Image37 : Object
+ public class Xcls_Image40 : Object
{
public Gtk.Image el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Image37(Xcls_MainWindow _owner )
+ public Xcls_Image40(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Image();
// 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 );
}
}
- public class Xcls_Image39 : Object
+ public class Xcls_Image42 : Object
{
public Gtk.Image el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Image39(Xcls_MainWindow _owner )
+ public Xcls_Image42(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Image();
// 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 );
// user defined functions
}
- public class Xcls_Image41 : Object
+ public class Xcls_Image44 : Object
{
public Gtk.Image el;
private Xcls_MainWindow _this;
// my vars (def)
// ctor
- public Xcls_Image41(Xcls_MainWindow _owner )
+ public Xcls_Image44(Xcls_MainWindow _owner )
{
_this = _owner;
this.el = new Gtk.Image();
{
"# 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();",
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;
this.el = new Gtk.Popover( null );
// my vars (dec)
+ this.new_window = true;
this.file = null;
this.mainwindow = null;
this.done = false;
}
// 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();
{
_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)
{
_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)
{
_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)
"# 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) {",
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()
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;
}
// 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();
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;
}
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 );
});
}
{
_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)
var file = (JsRender.JsRender)gval;
- _this.win.windowstate.fileViewOpen(file);
+ _this.win.windowstate.fileViewOpen(file, _this.new_window);
{
_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)
var f = JsRender.JsRender.factory("PlainFile", _this.selectedProject, fn);
- _this.win.windowstate.fileViewOpen(f);
+ _this.win.windowstate.fileViewOpen(f, _this.new_window);
});
{
_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)
" ",
" 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..",
" ",
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()
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..
{
_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)
public Xcls_column(Xcls_ValaCompileErrors _owner )
{
_this = _owner;
+ _this.column = this;
this.el = new Gtk.TreeViewColumn();
// my vars (dec)
// ----------- 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()
{
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;
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)
// 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;
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();
--- /dev/null
+
+
\ No newline at end of file