"src/Builder4/WindowState.vala",
"src/Palete/GirObject.vala",
"src/Palete/Gir.vala",
+ "src/codegen/valaccodearraymodule.vala",
+ "src/codegen/valaccodeassignmentmodule.vala",
+ "src/codegen/valaccodeattribute.vala",
+ "src/codegen/valaccodebasemodule.vala",
+ "src/codegen/valaccodecompiler.vala",
+ "src/codegen/valaccodecontrolflowmodule.vala",
+ "src/codegen/valaccodedelegatemodule.vala",
+ "src/codegen/valaccodememberaccessmodule.vala",
+ "src/codegen/valaccodemethodcallmodule.vala",
+ "src/codegen/valaccodemethodmodule.vala",
+ "src/codegen/valaccodestructmodule.vala",
+ "src/codegen/valaccode.vala",
+ "src/codegen/valaclassregisterfunction.vala",
+ "src/codegen/valactype.vala",
+ "src/codegen/valaenumregisterfunction.vala",
+ "src/codegen/valagasyncmodule.vala",
+ "src/codegen/valagdbusclientmodule.vala",
+ "src/codegen/valagdbusservermodule.vala",
+ "src/codegen/valagdbusmodule.vala",
+ "src/codegen/valagerrormodule.vala",
+ "src/codegen/valagirwriter.vala",
+ "src/codegen/valaglibvalue.vala",
+ "src/codegen/valagobjectmodule.vala",
+ "src/codegen/valagsignalmodule.vala",
+ "src/codegen/valagtkmodule.vala",
+ "src/codegen/valagtypemodule.vala",
+ "src/codegen/valagvaluemodule.vala",
+ "src/codegen/valagvariantmodule.vala",
+ "src/codegen/valainterfaceregisterfunction.vala",
+ "src/codegen/valastructregisterfunction.vala",
+ "src/codegen/valatyperegisterfunction.vala",
"src/JsRender/Dir.vala",
"src/JsRender/Gtk.vala",
"src/JsRender/JsonGen.vala",
"src/Palete/Gtk.vala",
"src/Palete/Palete.vala",
"src/Palete/Roo.vala",
+ "src/Palete/ValaSourceCompiler.vala",
+ "src/Palete/ValaSource.vala",
"src/Palete/VapiParser.vala",
"src/Builder4/WindowLeftTree.bjs",
"src/Builder4/PopoverAddProp.bjs",
"src/Builder4/PopoverFileDetails.bjs",
+ "src/ccode/valaccode.vala",
+ "src/ccode/valaccodeassignment.vala",
+ "src/ccode/valaccodebinaryexpression.vala",
+ "src/ccode/valaccodeblock.vala",
+ "src/ccode/valaccodebreakstatement.vala",
+ "src/ccode/valaccodecasestatement.vala",
+ "src/ccode/valaccodecastexpression.vala",
+ "src/ccode/valaccodecommaexpression.vala",
+ "src/ccode/valaccodecomment.vala",
+ "src/ccode/valaccodeconditionalexpression.vala",
+ "src/ccode/valaccodeconstant.vala",
+ "src/ccode/valaccodeconstantidentifier.vala",
+ "src/ccode/valaccodecontinuestatement.vala",
+ "src/ccode/valaccodedeclaration.vala",
+ "src/ccode/valaccodedeclarator.vala",
+ "src/ccode/valaccodedefine.vala",
+ "src/ccode/valaccodedostatement.vala",
+ "src/ccode/valaccodeelementaccess.vala",
+ "src/ccode/valaccodeemptystatement.vala",
+ "src/ccode/valaccodeenum.vala",
+ "src/ccode/valaccodeenumvalue.vala",
+ "src/ccode/valaccodeexpression.vala",
+ "src/ccode/valaccodeexpressionstatement.vala",
+ "src/ccode/valaccodefile.vala",
+ "src/ccode/valaccodeforstatement.vala",
+ "src/ccode/valaccodefragment.vala",
+ "src/ccode/valaccodefunction.vala",
+ "src/ccode/valaccodefunctioncall.vala",
+ "src/ccode/valaccodefunctiondeclarator.vala",
+ "src/ccode/valaccodeggnucsection.vala",
+ "src/ccode/valaccodegotostatement.vala",
+ "src/ccode/valaccodeidentifier.vala",
+ "src/ccode/valaccodeifsection.vala",
+ "src/ccode/valaccodeifstatement.vala",
+ "src/ccode/valaccodeincludedirective.vala",
+ "src/ccode/valaccodeinitializerlist.vala",
+ "src/ccode/valaccodeinvalidexpression.vala",
+ "src/ccode/valaccodelabel.vala",
+ "src/ccode/valaccodelinedirective.vala",
+ "src/ccode/valaccodemacroreplacement.vala",
+ "src/ccode/valaccodememberaccess.vala",
+ "src/ccode/valaccodemodifiers.vala",
+ "src/ccode/valaccodenewline.vala",
+ "src/ccode/valaccodenode.vala",
+ "src/ccode/valaccodeoncesection.vala",
+ "src/ccode/valaccodeparameter.vala",
+ "src/ccode/valaccodeparenthesizedexpression.vala",
+ "src/ccode/valaccodereturnstatement.vala",
+ "src/ccode/valaccodestatement.vala",
+ "src/ccode/valaccodestruct.vala",
+ "src/ccode/valaccodeswitchstatement.vala",
+ "src/ccode/valaccodetypedefinition.vala",
+ "src/ccode/valaccodeunaryexpression.vala",
+ "src/ccode/valaccodevariabledeclarator.vala",
+ "src/ccode/valaccodewhilestatement.vala",
+ "src/ccode/valaccodewriter.vala",
"src/Project/GtkValaSettings.vala",
"src/Project/Project.vala",
"src/Project/Gtk.vala",
"src/Resources.vala",
"src/Spawn.vala",
"src/Application.vala",
+ "src/Palete/ValalCompileQueue.vala",
"src/Palete/Javascript.vala",
"src/Project/Meson.vala",
"src/Palete/RooDatabase.vala",
"src/Palete/LanguageClient.vala",
"src/Palete/LanguageClientVala.vala",
- "src/Palete/LanguageClientJavascript.vala",
"src/Lsp.vala",
"src/Palete/LanguageClientDummy.vala",
"src/Palete/ValaCompileRequest.vala"
'src/Builder4/WindowState.vala',
'src/Palete/GirObject.vala',
'src/Palete/Gir.vala',
+ 'src/codegen/valaccodearraymodule.vala',
+ 'src/codegen/valaccodeassignmentmodule.vala',
+ 'src/codegen/valaccodeattribute.vala',
+ 'src/codegen/valaccodebasemodule.vala',
+ 'src/codegen/valaccodecompiler.vala',
+ 'src/codegen/valaccodecontrolflowmodule.vala',
+ 'src/codegen/valaccodedelegatemodule.vala',
+ 'src/codegen/valaccodememberaccessmodule.vala',
+ 'src/codegen/valaccodemethodcallmodule.vala',
+ 'src/codegen/valaccodemethodmodule.vala',
+ 'src/codegen/valaccodestructmodule.vala',
+ 'src/codegen/valaccode.vala',
+ 'src/codegen/valaclassregisterfunction.vala',
+ 'src/codegen/valactype.vala',
+ 'src/codegen/valaenumregisterfunction.vala',
+ 'src/codegen/valagasyncmodule.vala',
+ 'src/codegen/valagdbusclientmodule.vala',
+ 'src/codegen/valagdbusservermodule.vala',
+ 'src/codegen/valagdbusmodule.vala',
+ 'src/codegen/valagerrormodule.vala',
+ 'src/codegen/valagirwriter.vala',
+ 'src/codegen/valaglibvalue.vala',
+ 'src/codegen/valagobjectmodule.vala',
+ 'src/codegen/valagsignalmodule.vala',
+ 'src/codegen/valagtkmodule.vala',
+ 'src/codegen/valagtypemodule.vala',
+ 'src/codegen/valagvaluemodule.vala',
+ 'src/codegen/valagvariantmodule.vala',
+ 'src/codegen/valainterfaceregisterfunction.vala',
+ 'src/codegen/valastructregisterfunction.vala',
+ 'src/codegen/valatyperegisterfunction.vala',
'src/JsRender/Dir.vala',
'src/JsRender/Gtk.vala',
'src/JsRender/JsonGen.vala',
'src/Palete/Gtk.vala',
'src/Palete/Palete.vala',
'src/Palete/Roo.vala',
+ 'src/Palete/ValaSourceCompiler.vala',
+ 'src/Palete/ValaSource.vala',
'src/Palete/VapiParser.vala',
'src/Builder4/WindowLeftTree.vala',
'src/Builder4/PopoverAddProp.vala',
'src/Builder4/PopoverFileDetails.vala',
+ 'src/ccode/valaccode.vala',
+ 'src/ccode/valaccodeassignment.vala',
+ 'src/ccode/valaccodebinaryexpression.vala',
+ 'src/ccode/valaccodeblock.vala',
+ 'src/ccode/valaccodebreakstatement.vala',
+ 'src/ccode/valaccodecasestatement.vala',
+ 'src/ccode/valaccodecastexpression.vala',
+ 'src/ccode/valaccodecommaexpression.vala',
+ 'src/ccode/valaccodecomment.vala',
+ 'src/ccode/valaccodeconditionalexpression.vala',
+ 'src/ccode/valaccodeconstant.vala',
+ 'src/ccode/valaccodeconstantidentifier.vala',
+ 'src/ccode/valaccodecontinuestatement.vala',
+ 'src/ccode/valaccodedeclaration.vala',
+ 'src/ccode/valaccodedeclarator.vala',
+ 'src/ccode/valaccodedefine.vala',
+ 'src/ccode/valaccodedostatement.vala',
+ 'src/ccode/valaccodeelementaccess.vala',
+ 'src/ccode/valaccodeemptystatement.vala',
+ 'src/ccode/valaccodeenum.vala',
+ 'src/ccode/valaccodeenumvalue.vala',
+ 'src/ccode/valaccodeexpression.vala',
+ 'src/ccode/valaccodeexpressionstatement.vala',
+ 'src/ccode/valaccodefile.vala',
+ 'src/ccode/valaccodeforstatement.vala',
+ 'src/ccode/valaccodefragment.vala',
+ 'src/ccode/valaccodefunction.vala',
+ 'src/ccode/valaccodefunctioncall.vala',
+ 'src/ccode/valaccodefunctiondeclarator.vala',
+ 'src/ccode/valaccodeggnucsection.vala',
+ 'src/ccode/valaccodegotostatement.vala',
+ 'src/ccode/valaccodeidentifier.vala',
+ 'src/ccode/valaccodeifsection.vala',
+ 'src/ccode/valaccodeifstatement.vala',
+ 'src/ccode/valaccodeincludedirective.vala',
+ 'src/ccode/valaccodeinitializerlist.vala',
+ 'src/ccode/valaccodeinvalidexpression.vala',
+ 'src/ccode/valaccodelabel.vala',
+ 'src/ccode/valaccodelinedirective.vala',
+ 'src/ccode/valaccodemacroreplacement.vala',
+ 'src/ccode/valaccodememberaccess.vala',
+ 'src/ccode/valaccodemodifiers.vala',
+ 'src/ccode/valaccodenewline.vala',
+ 'src/ccode/valaccodenode.vala',
+ 'src/ccode/valaccodeoncesection.vala',
+ 'src/ccode/valaccodeparameter.vala',
+ 'src/ccode/valaccodeparenthesizedexpression.vala',
+ 'src/ccode/valaccodereturnstatement.vala',
+ 'src/ccode/valaccodestatement.vala',
+ 'src/ccode/valaccodestruct.vala',
+ 'src/ccode/valaccodeswitchstatement.vala',
+ 'src/ccode/valaccodetypedefinition.vala',
+ 'src/ccode/valaccodeunaryexpression.vala',
+ 'src/ccode/valaccodevariabledeclarator.vala',
+ 'src/ccode/valaccodewhilestatement.vala',
+ 'src/ccode/valaccodewriter.vala',
'src/Project/GtkValaSettings.vala',
'src/Project/Project.vala',
'src/Project/Gtk.vala',
'src/Palete/RooDatabase.vala',
'src/Palete/LanguageClient.vala',
'src/Palete/LanguageClientVala.vala',
- 'src/Palete/LanguageClientJavascript.vala',
'src/Lsp.vala',
'src/Palete/LanguageClientDummy.vala',
'src/Palete/ValaCompileRequest.vala',
this.testBjs(cur_project);
this.languageServer(cur_project);
this.compileBjs(cur_project);
- //this.compileVala();
+ this.compileVala();
}
});
}
-
}
void listProjects()
var ar = cur_project.sortedFiles();
foreach(var file in ar) {
-
- if (file is JsRender.PlainFile) {
- continue;
- }
-
+ string oldstr;
file.loadItems();
var oldfn = file.targetName();
-
- print("\n\n\n\nFile : %s\n", oldfn);
- //GLib.FileUtils.get_contents(oldfn, out oldstr);
+ GLib.FileUtils.get_contents(oldfn, out oldstr);
var outstr = file.toSourceCode();
- var bad = false;
- // check line numbers:
- var bits = outstr.split("\n");
- var end = bits.length;
- for(var i = 0;i < end; i++) {
- print("%i : %s\n", i+1 , bits[i]);
- if (!bad && bits[i].has_prefix("/*") && !bits[i].has_prefix("/*%d*/".printf(i+1))) {
- end = i + 5 > bits.length ? bits.length: (i + 5);
- print ("^^^^ mismatch\null");
- bad = true;
- }
-
-
- }
- if (bad) {
- GLib.error("got bad file");
- }
- /*
if (outstr != oldstr) {
GLib.FileUtils.set_contents("/tmp/" + file.name + ".out", outstr);
print("meld %s /tmp/%s\n", oldfn, file.name + ".out");
//GLib.Process.exit(Posix.EXIT_SUCCESS);
}
-*.* */
- //print("# Files match %s\n", file.name);
+ print("# Files match %s\n", file.name);
}
} catch (FileError e) {
GLib.debug("Got error %s", e.message);
if (file == null) {
// then compile them all, and compare them...
-
+
+
+
+
GLib.error("missing file %s in project %s", BuilderApplication.opt_bjs_compile, cur_project.name);
}
// it's ready..
ls.document_open(file);
-
- ls.syntax.begin(file, (obj,res) => {
- ls.syntax.end(res);
-
- });
return false;
});
GLib.Process.exit(Posix.EXIT_SUCCESS);
}
- /*
+
void compileVala()
{
if (BuilderApplication.opt_compile_target == null) {
GLib.Process.exit(Posix.EXIT_SUCCESS);
}
- */
void pullResources()
{
if (!opt_pull_resources) {
}
- static int queue_update_compile_countdown = -1;
- static uint queue_update_compile_id = 0;
-
public static void updateCompileResults( )
{
- queue_update_compile_countdown = 4; // 1 second after last call.
- if (queue_update_compile_id == 0) {
- queue_update_compile_id = GLib.Timeout.add(250, () => {
- if (queue_update_compile_countdown < 0) {
- return true;
- }
- queue_update_compile_countdown--;
- if (queue_update_compile_countdown < 0) {
- realUpdateCompileResults();
- }
-
- return true;
- });
- }
- }
-
-
- public static void realUpdateCompileResults( )
- {
-
-
-
foreach(var ww in BuilderApplication.windows) {
if (ww == null || ww.windowstate == null || ww.windowstate.project ==null) {
continue;
}
}
-
- public static void showSpinnerLspLog(Palete.LanguageClientAction action, string message) {
-
- var msg = action.to_string() + " " + message;
- switch(action) {
-
- case Palete.LanguageClientAction.INIT:
- case Palete.LanguageClientAction.LAUNCH:
- case Palete.LanguageClientAction.ACCEPT:
- BuilderApplication.showSpinner( "software-update-available", msg );
- return;
-
- case Palete.LanguageClientAction.DIAG:
- BuilderApplication.showSpinner( "format-justify-fill", msg);
- return;
-
- case Palete.LanguageClientAction.OPEN:
- BuilderApplication.showSpinner( "document-open", msg);
- return;
- case Palete.LanguageClientAction.SAVE:
- BuilderApplication.showSpinner( "document-save", msg);
- return;
- case Palete.LanguageClientAction.CLOSE:
- BuilderApplication.showSpinner( "window.close", msg);
- return;
- case Palete.LanguageClientAction.CHANGE:
- BuilderApplication.showSpinner( "format-text-direction-ltr", msg);
- return;
- case Palete.LanguageClientAction.TERM:
- BuilderApplication.showSpinner( "media-playback-stop", msg);
- return;
- case Palete.LanguageClientAction.COMPLETE:
- BuilderApplication.showSpinner( "mail-send-recieve", msg);
- return;
-
- case Palete.LanguageClientAction.COMPLETE_REPLY:
- BuilderApplication.showSpinner( "face-cool", msg);
- return;
-
- case Palete.LanguageClientAction.RESTART:
- case Palete.LanguageClientAction.ERROR:
- case Palete.LanguageClientAction.ERROR_START:
- case Palete.LanguageClientAction.ERROR_RPC:
- case Palete.LanguageClientAction.ERROR_REPLY:
- BuilderApplication.showSpinner( "software-update-urgent", msg );
- return;
-
- case Palete.LanguageClientAction.EXIT:
- BuilderApplication.showSpinner( "face-sick", msg);
- return;
-
-
- }
- }
-
- public static void showSpinner(string icon, string tooltip = "")
+ public static void showSpinner(bool state)
{
-
- // events:
- // doc change send: - spinner -
-
-
- // ?? restart = software-update-urgent - crash?
-
-
foreach (var win in BuilderApplication.windows) {
- if (icon != "") {
- win.statusbar_compile_spinner.start(icon, tooltip);
+ if (state) {
+ win.statusbar_compile_spinner.start();
} else {
win.statusbar_compile_spinner.stop();
}
"| void show" : [
"(Gtk.Window parent) {",
"\tthis.el.application = parent.application;",
- "\tthis.el.set_transient_for(parent);",
- "\tthis.el.show();",
- " ",
- "\t ",
- "\t",
+ " this.el.set_transient_for(parent);",
+ " this.el.show();",
"}"
]
}
-static About _About;
+ static About _About;
-public class About : Object
-{
- public Gtk.AboutDialog el;
- private About _this;
+ public class About : Object
+ {
+ public Gtk.AboutDialog el;
+ private About _this;
- public static About singleton()
- {
- if (_About == null) {
- _About= new About();
- }
- return _About;
- }
+ public static About singleton()
+ {
+ if (_About == null) {
+ _About= new About();
+ }
+ return _About;
+ }
- // my vars (def)
+ // my vars (def)
- // ctor
- public About()
- {
- _this = this;
- this.el = new Gtk.AboutDialog();
+ // ctor
+ public About()
+ {
+ _this = this;
+ this.el = new Gtk.AboutDialog();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.program_name = "roobuilder";
- this.el.license = "LGPL";
- this.el.authors = { "Alan Knowles" };
- this.el.version = "4.4.2";
- this.el.website = "https://github.com/roojs/roobuilder";
- this.el.modal = true;
- this.el.copyright = "LGPL";
- }
+ // set gobject values
+ this.el.program_name = "roobuilder";
+ this.el.license = "LGPL";
+ this.el.authors = { "Alan Knowles" };
+ this.el.version = "4.4.2";
+ this.el.website = "https://github.com/roojs/roobuilder";
+ this.el.modal = true;
+ this.el.copyright = "LGPL";
+ }
- // user defined functions
- public void show (Gtk.Window parent) {
- this.el.application = parent.application;
- this.el.set_transient_for(parent);
- this.el.show();
-
-
-
- }
-}
+ // user defined functions
+ public void show (Gtk.Window parent) {
+ this.el.application = parent.application;
+ this.el.set_transient_for(parent);
+ this.el.show();
+ }
+ }
" this.el.response(Gtk.ResponseType.CANCEL);",
" this.el.hide();",
" return true;",
+ " ",
"}",
""
]
-static DialogConfirm _DialogConfirm;
-
-public class DialogConfirm : Object
-{
- public Gtk.MessageDialog el;
- private DialogConfirm _this;
-
- public static DialogConfirm singleton()
- {
- if (_DialogConfirm == null) {
- _DialogConfirm= new DialogConfirm();
- }
- return _DialogConfirm;
- }
-
- // my vars (def)
-
- // ctor
- public DialogConfirm()
- {
- _this = this;
- this.el = new Gtk.MessageDialog( null, Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, "Test" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.title = "Please Confirm ";
- this.el.name = "DialogConfirm";
- this.el.modal = true;
- this.el.use_markup = true;
-
- //listeners
- this.el.close_request.connect( (event) => {
- this.el.response(Gtk.ResponseType.CANCEL);
- this.el.hide();
- return true;
- });
- }
-
- // user defined functions
- public void showIt // caller needs to connect to the response - to get the result.
-
- (string title, string msg) {
- //if (!this.el) { this.init(); }
- //this.success = success;
- this.el.title = title;
- this.el.text = msg;
- this.el.show();
-
-
- }
-}
+ static DialogConfirm _DialogConfirm;
+
+ public class DialogConfirm : Object
+ {
+ public Gtk.MessageDialog el;
+ private DialogConfirm _this;
+
+ public static DialogConfirm singleton()
+ {
+ if (_DialogConfirm == null) {
+ _DialogConfirm= new DialogConfirm();
+ }
+ return _DialogConfirm;
+ }
+
+ // my vars (def)
+
+ // ctor
+ public DialogConfirm()
+ {
+ _this = this;
+ this.el = new Gtk.MessageDialog( null, Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, "Test" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.title = "Please Confirm ";
+ this.el.name = "DialogConfirm";
+ this.el.modal = true;
+ this.el.use_markup = true;
+
+ //listeners
+ this.el.close_request.connect( (event) => {
+ this.el.response(Gtk.ResponseType.CANCEL);
+ this.el.hide();
+ return true;
+
+ });
+ }
+
+ // user defined functions
+ public void showIt // caller needs to connect to the response - to get the result.
+
+ (string title, string msg) {
+ //if (!this.el) { this.init(); }
+ //this.success = success;
+ this.el.title = title;
+ this.el.text = msg;
+ this.el.show();
+
+
+ }
+ }
-g{
+{
"build_module" : "builder",
"gen_extended" : false,
"items" : [
" ",
"\tthis.css = new Gtk.CssProvider();",
" ",
- "\tthis.css.load_from_string(\"",
- "\t\t#project-list { font-size: 12px;}",
- "\t\");",
+ "\tthis.css.load_from_string(\"#project-list { font-size: 12px;}\");",
"",
"\tGtk.StyleContext.add_provider_for_display(",
"\t\tthis.el.get_display(),",
" ",
"\tthis.css = new Gtk.CssProvider();",
" ",
- "\tthis.css.load_from_string(\"",
- "#file-list { font-size: 12px;}",
- "#file-list indent {",
- "-gtk-icon-size : 2px;",
- "}",
- "#file-list indent:nth-last-child(2) {",
- "min-width: 24px;",
- "}",
- "\");",
+ "\tthis.css.load_from_string(\"#file-list { font-size: 12px;}\");",
"",
"\tGtk.StyleContext.add_provider_for_display(",
"\t\tthis.el.get_display(),",
"listeners" : {
"bind" : [
"(listitem) => {",
- "\t",
"\t //GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
- " \t",
- " \t",
- " \t",
- " \t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
- " \tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
- " \t ",
- " \tvar hbox = (Gtk.Box) expand.child;",
+ "\t",
+ "\t",
+ "\t",
+ "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
+ "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
+ "\t ",
" ",
+ "\tvar lbl = (Gtk.Label) expand.child;",
"\t",
- "\t\tvar img = (Gtk.Image) hbox.get_first_child();",
- "\t\tvar lbl = (Gtk.Label) img.get_next_sibling();",
+ "\t if (lbl.label != \"\") { // do not update",
+ "\t \treturn;",
+ " \t}",
+ "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
+ "\t//GLib.debug(\"LR = %s\", lr.get_type().name());",
"",
+ "\t",
+ "\tvar jr =(JsRender.JsRender) lr.get_item();",
+ "\t//GLib.debug(\"JR = %s\", jr.get_type().name());\t\t",
+ "\t",
+ "\t if (jr == null) {",
+ "\t\t GLib.debug(\"Problem getting item\"); ",
+ "\t\t return;",
+ "\t }",
+ "\t//GLib.debug(\"change %s to %s\", lbl.label, np.name);",
+ "\tlbl.label = jr.name; // for dir's we could hsow the sub path..",
+ "\tlbl.tooltip_markup = jr.path;",
+ "\t ",
+ " expand.set_hide_expander( jr.xtype != \"Dir\" );",
+ " \t expand.set_list_row(lr);",
" ",
- " \t",
- " \t if (lbl.label != \"\") { // do not update",
- " \t \treturn;",
- " \t}",
- " \tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
- " \t//GLib.debug(\"LR = %s\", lr.get_type().name());",
- " ",
- " \t",
- " \tvar jr =(JsRender.JsRender) lr.get_item();",
- " \t//GLib.debug(\"JR = %s\", jr.get_type().name());\t\t",
- " \t",
- " \t if (jr == null) {",
- " \t\t GLib.debug(\"Problem getting item\"); ",
- " \t\t return;",
- " \t }",
+ " \t ",
+ " \t// bind image...",
+ " \t",
+ "}",
"",
- "\t\tjr.bind_property(\"icon\",",
- " img, \"gicon\",",
- " GLib.BindingFlags.SYNC_CREATE);",
"",
- " \t//GLib.debug(\"change %s to %s\", lbl.label, np.name);",
- " \tlbl.label = jr.name; // for dir's we could hsow the sub path..",
- " \tlbl.tooltip_markup = jr.path;",
- " \t ",
- " expand.set_hide_expander( jr.xtype != \"Dir\" );",
- " \t expand.set_list_row(lr);",
- " ",
- " \t ",
- " \t// bind image...",
- "}",
""
],
"setup" : [
"\t ",
"\texpand.set_indent_for_depth(true);",
"\texpand.set_indent_for_icon(true);",
- "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
- "\tvar icon = new Gtk.Image();",
- "\ticon.margin_end = 4;",
+ "\t ",
"\tvar lbl = new Gtk.Label(\"\");",
"\tlbl.use_markup = true;",
"\t",
" \tlbl.justify = Gtk.Justification.LEFT;",
" \tlbl.xalign = 0;",
"",
- " \thbox.append(icon);",
- "\thbox.append(lbl);",
- "\texpand.set_child(hbox);",
+ " ",
+ "\texpand.set_child(lbl);",
"\t((Gtk.ListItem)listitem).set_child(expand);",
"\t((Gtk.ListItem)listitem).activatable = false;",
"}",
"xtype" : "Window",
"| void load" : [
"() {",
- " // cl list...",
- " ",
+ " // clear list...",
+ " ",
+ " ",
" _this.is_loading = true;",
+ " ",
+ " ",
" Project.Project.loadAll();",
" _this.project_list.el.set_model(new Gtk.SingleSelection(null));",
" Project.Project.loadIntoStore(this.projectmodel.el);",
" ",
" _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION; ",
"\t_this.btn_delfile.el.hide();",
+ "\t",
+ " ",
"}",
""
],
}
],
"name" : "DialogFiles"
-}
+}
\ No newline at end of file
-static DialogFiles _DialogFiles;
+ static DialogFiles _DialogFiles;
+
+ public class DialogFiles : Object
+ {
+ public Gtk.Window el;
+ private DialogFiles _this;
+
+ public static DialogFiles singleton()
+ {
+ if (_DialogFiles == null) {
+ _DialogFiles= new DialogFiles();
+ }
+ return _DialogFiles;
+ }
+ public Xcls_mainpane mainpane;
+ public Xcls_projectscroll projectscroll;
+ public Xcls_project_list project_list;
+ public Xcls_projectselection projectselection;
+ public Xcls_projectsort projectsort;
+ public Xcls_projectmodel projectmodel;
+ public Xcls_filepane filepane;
+ public Xcls_searchbox searchbox;
+ public Xcls_iconscroll iconscroll;
+ public Xcls_gridview gridview;
+ public Xcls_iconsel iconsel;
+ public Xcls_gridsort gridsort;
+ public Xcls_gridmodel gridmodel;
+ public Xcls_iconsearch iconsearch;
+ public Xcls_treescroll treescroll;
+ public Xcls_treeview treeview;
+ public Xcls_treeselmodel treeselmodel;
+ public Xcls_treelistsort treelistsort;
+ public Xcls_treelistmodel treelistmodel;
+ public Xcls_treemodel treemodel;
+ public Xcls_treefilter treefilter;
+ public Xcls_name name;
+ public Xcls_btn_newproj btn_newproj;
+ public Xcls_btn_projprop btn_projprop;
+ public Xcls_btn_delproj btn_delproj;
+ public Xcls_btn_addfile btn_addfile;
+ public Xcls_btn_delfile btn_delfile;
+
+ // my vars (def)
+ public Xcls_MainWindow win;
+ public string lastfilter;
+ public bool in_onprojectselected;
+ public bool is_loading;
+ public bool new_window;
+ public Project.Project selectedProject;
+ public Gdk.Pixbuf missing_thumb_pixbuf;
+ public Gee.HashMap<string,Gdk.Pixbuf> image_cache;
+
+ // ctor
+ public DialogFiles()
+ {
+ _this = this;
+ this.el = new Gtk.Window();
+
+ // my vars (dec)
+ this.in_onprojectselected = false;
+ this.is_loading = false;
+ this.new_window = false;
+
+ // set gobject values
+ this.el.title = "Select Project / File";
+ this.el.name = "DialogFiles";
+ this.el.default_height = 550;
+ this.el.default_width = 1000;
+ this.el.modal = true;
+ var child_1 = new Xcls_Box2( _this );
+ this.el.child = child_1.el;
+ var child_2 = new Xcls_HeaderBar44( _this );
+ this.el.titlebar = child_2.el;
+ }
+
+ // user defined functions
+ public void onProjectSelected (Project.Project? project)
+ {
+ if (this.in_onprojectselected) {
+ return;
+ }
+ this.selectedProject = project;
+
+ if (project == null) {
+ GLib.debug("Hide project files");
+ _this.mainpane.el.set_end_child(null);
+ _this.filepane.el.hide();
+ return;
+
+ }
+
+ GLib.debug("Show project files");
+ _this.mainpane.el.set_end_child(_this.filepane.el);
+
+ _this.filepane.el.show();
+ this.in_onprojectselected = true;
+
+
+
+ project.load();
+
+
+ _this.searchbox.el.text = "";
+ _this.gridview.el.set_model(new Gtk.SingleSelection(null));
+ _this.selectedProject.loadFilesIntoStore(_this.gridmodel.el);
+ _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
+
+ _this.gridview.el.set_model(_this.iconsel.el);
+
+
+ GLib.Timeout.add(500, () => {
+ _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
+ _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
+
+ _this.searchbox.el.grab_focus();
+ return false;
+ });
+ _this.treeview.el.set_model(new Gtk.SingleSelection(null));
+
+ this.selectedProject.loadDirsIntoStore(_this.treemodel.el);
+
+ _this.treeview.el.set_model(_this.treeselmodel.el);
+
+ _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
+ this.treescroll.el.vadjustment.value = 0;
+ this.in_onprojectselected = false;
+ }
+ public void selectProject (Project.Project? project) {
+
+
+
+ var sm = this.projectselection.el;
+ if (project == null) {
+ sm.selected = Gtk.INVALID_LIST_POSITION;
+ this.onProjectSelected(null);
+ return;
+ }
+
+
+ for (var i =0; i < sm.n_items; i++) {
+ var p = (Project.Project) sm.get_item(i);
+ if (p.path == project.path) {
+ GLib.debug("Select Project %s => %d", project.name, i);
+ sm.selected = i;
+ break;
+ }
+ }
+
+ }
+ public void show (Project.Project? project, bool new_window) {
+
+ this.new_window = new_window;
+
+ this.projectscroll.el.vadjustment.value = 0; // scroll to top?
+
+
+ //var win = this.win.el;
+ //var w = win.get_width();
+ //var h = win.get_height();
+
+
+ this.el.show();
+ this.load();
+ this.selectProject(project);
+ this.onProjectSelected(project); //?? twice?
+
+ GLib.Timeout.add(500, () => {
+ if (project == null) {
+ _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
+ this.onProjectSelected(null);
+
+ }
+ this.el.set_size_request( 800 , 750); // ?? based on default
+ return false;
+ });
+
+ }//
+ public void load () {
+ // clear list...
+
+
+ _this.is_loading = true;
+
+
+ Project.Project.loadAll();
+ _this.project_list.el.set_model(new Gtk.SingleSelection(null));
+ Project.Project.loadIntoStore(this.projectmodel.el);
+
+ _this.project_list.el.set_model(_this.projectselection.el);
+
+ _this.is_loading = false;
+
+ _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
+ _this.btn_delfile.el.hide();
+
+
+ }
+ public class Xcls_Box2 : Object
+ {
+ public Gtk.Box el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+ public bool expand;
+
+ // ctor
+ public Xcls_Box2(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+ this.expand = true;
+
+ // set gobject values
+ this.el.homogeneous = false;
+ this.el.margin_end = 10;
+ this.el.margin_start = 10;
+ this.el.margin_bottom = 10;
+ this.el.margin_top = 10;
+ var child_1 = new Xcls_Box3( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ new Xcls_mainpane( _this );
+ this.el.append( _this.mainpane.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Box3 : Object
+ {
+ public Gtk.Box el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box3(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_mainpane : Object
+ {
+ public Gtk.Paned el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+ public bool homogeneous;
+ public int spacing;
+
+ // ctor
+ public Xcls_mainpane(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.mainpane = this;
+ this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
+
+ // my vars (dec)
+ this.homogeneous = false;
+ this.spacing = 0;
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ this.el.position = 200;
+ new Xcls_projectscroll( _this );
+ this.el.start_child = _this.projectscroll.el;
+ new Xcls_filepane( _this );
+ this.el.end_child = _this.filepane.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_projectscroll : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+ public bool expand;
+
+ // ctor
+ public Xcls_projectscroll(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.projectscroll = this;
+ this.el = new Gtk.ScrolledWindow();
+
+ // my vars (dec)
+ this.expand = true;
+
+ // set gobject values
+ this.el.width_request = 150;
+ this.el.has_frame = true;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ new Xcls_project_list( _this );
+ this.el.child = _this.project_list.el;
+
+ // init method
+
+ this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+ }
+
+ // user defined functions
+ }
+ public class Xcls_project_list : Object
+ {
+ public Gtk.ColumnView el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+ public Gtk.CssProvider css;
+
+ // ctor
+ public Xcls_project_list(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.project_list = this;
+ new Xcls_projectselection( _this );
+ this.el = new Gtk.ColumnView( _this.projectselection.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.name = "project-list";
+ var child_2 = new Xcls_ColumnViewColumn12( _this );
+ child_2.ref();
+ this.el.append_column ( child_2.el );
+
+ // init method
+
+ {
+
+ this.css = new Gtk.CssProvider();
+
+ this.css.load_from_string("#project-list { font-size: 12px;}");
+
+ Gtk.StyleContext.add_provider_for_display(
+ this.el.get_display(),
+ this.css,
+ Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
+ );
+
+
+ }
+ }
+
+ // user defined functions
+ }
+ public class Xcls_projectselection : Object
+ {
+ public Gtk.SingleSelection el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_projectselection(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.projectselection = this;
+ new Xcls_projectsort( _this );
+ this.el = new Gtk.SingleSelection( _this.projectsort.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.can_unselect = true;
+
+ //listeners
+ this.el.notify["selected"].connect( (position, n_items) => {
+
+ if (_this.is_loading) {
+ return;
+ }
+
+ if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
+ _this.btn_delproj.el.hide();
+ _this.btn_projprop.el.hide();
+ _this.btn_addfile.el.hide();
+ //_this.btn_delfile.el.hide();
+
+ } else {
+ _this.btn_delproj.el.show();
+ _this.btn_projprop.el.show();
+ _this.btn_addfile.el.show();
+ //_this.btn_delfile.el.show(); // ??
+ }
+
+
+
+
+
+ if (_this.is_loading) {
+ return;
+ }
+
+ Project.Project project = this.el.selected == Gtk.INVALID_LIST_POSITION ? null :
+ (Project.Project) _this.projectsort.el.get_item(this.el.selected);
+
+ GLib.debug("selection changed to %s", project == null ? "none" : project.name);
+
+ _this.onProjectSelected(project);
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_projectsort : Object
+ {
+ public Gtk.SortListModel el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_projectsort(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.projectsort = this;
+ new Xcls_projectmodel( _this );
+ var child_2 = new Xcls_StringSorter10( _this );
+ child_2.ref();
+ this.el = new Gtk.SortListModel( _this.projectmodel.el, child_2.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.incremental = true;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_projectmodel : Object
+ {
+ public GLib.ListStore el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_projectmodel(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.projectmodel = this;
+ this.el = new GLib.ListStore( typeof(Project.Project) );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ public void remove (Project.Project p) {
+
+ for (var i =0;i < this.el.n_items; i++ ) {
+ var pr = (Project.Project) this.el.get_item(i);
+ if (p.path == pr.path) {
+ this.el.remove(i);
+ return;
+ }
+ }
+
+
+ }
+ }
+
+ public class Xcls_StringSorter10 : Object
+ {
+ public Gtk.StringSorter el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_StringSorter10(DialogFiles _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_PropertyExpression11( _this );
+ child_1.ref();
+ this.el = new Gtk.StringSorter( child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+ public class Xcls_PropertyExpression11 : Object
+ {
+ public Gtk.PropertyExpression el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
-public class DialogFiles : Object
-{
- public Gtk.Window el;
- private DialogFiles _this;
+ // ctor
+ public Xcls_PropertyExpression11(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.PropertyExpression( typeof(Project.Project), null, "name" );
- public static DialogFiles singleton()
- {
- if (_DialogFiles == null) {
- _DialogFiles= new DialogFiles();
- }
- return _DialogFiles;
- }
- public Xcls_mainpane mainpane;
- public Xcls_projectscroll projectscroll;
- public Xcls_project_list project_list;
- public Xcls_projectselection projectselection;
- public Xcls_projectsort projectsort;
- public Xcls_projectmodel projectmodel;
- public Xcls_filepane filepane;
- public Xcls_searchbox searchbox;
- public Xcls_iconscroll iconscroll;
- public Xcls_gridview gridview;
- public Xcls_iconsel iconsel;
- public Xcls_gridsort gridsort;
- public Xcls_gridmodel gridmodel;
- public Xcls_iconsearch iconsearch;
- public Xcls_treescroll treescroll;
- public Xcls_treeview treeview;
- public Xcls_treeselmodel treeselmodel;
- public Xcls_treelistsort treelistsort;
- public Xcls_treelistmodel treelistmodel;
- public Xcls_treemodel treemodel;
- public Xcls_treefilter treefilter;
- public Xcls_name name;
- public Xcls_btn_newproj btn_newproj;
- public Xcls_btn_projprop btn_projprop;
- public Xcls_btn_delproj btn_delproj;
- public Xcls_btn_addfile btn_addfile;
- public Xcls_btn_delfile btn_delfile;
-
- // my vars (def)
- public Xcls_MainWindow win;
- public string lastfilter;
- public bool in_onprojectselected;
- public bool is_loading;
- public bool new_window;
- public Project.Project selectedProject;
- public Gdk.Pixbuf missing_thumb_pixbuf;
- public Gee.HashMap<string,Gdk.Pixbuf> image_cache;
-
- // ctor
- public DialogFiles()
- {
- _this = this;
- this.el = new Gtk.Window();
-
- // my vars (dec)
- this.in_onprojectselected = false;
- this.is_loading = false;
- this.new_window = false;
-
- // set gobject values
- this.el.title = "Select Project / File";
- this.el.name = "DialogFiles";
- this.el.default_height = 550;
- this.el.default_width = 1000;
- this.el.modal = true;
- var child_1 = new Xcls_Box2( _this );
- this.el.child = child_1.el;
- var child_2 = new Xcls_HeaderBar44( _this );
- this.el.titlebar = child_2.el;
- }
-
- // user defined functions
- public void onProjectSelected (Project.Project? project)
- {
- if (this.in_onprojectselected) {
- return;
- }
- this.selectedProject = project;
-
- if (project == null) {
- GLib.debug("Hide project files");
- _this.mainpane.el.set_end_child(null);
- _this.filepane.el.hide();
- return;
-
- }
-
- GLib.debug("Show project files");
- _this.mainpane.el.set_end_child(_this.filepane.el);
-
- _this.filepane.el.show();
- this.in_onprojectselected = true;
-
-
-
- project.load();
-
-
- _this.searchbox.el.text = "";
- _this.gridview.el.set_model(new Gtk.SingleSelection(null));
- _this.selectedProject.loadFilesIntoStore(_this.gridmodel.el);
- _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
-
- _this.gridview.el.set_model(_this.iconsel.el);
-
-
- GLib.Timeout.add(500, () => {
- _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
- _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
-
- _this.searchbox.el.grab_focus();
- return false;
- });
- _this.treeview.el.set_model(new Gtk.SingleSelection(null));
-
- this.selectedProject.loadDirsIntoStore(_this.treemodel.el);
-
- _this.treeview.el.set_model(_this.treeselmodel.el);
-
- _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
- this.treescroll.el.vadjustment.value = 0;
- this.in_onprojectselected = false;
- }
- public void selectProject (Project.Project? project) {
-
-
-
- var sm = this.projectselection.el;
- if (project == null) {
- sm.selected = Gtk.INVALID_LIST_POSITION;
- this.onProjectSelected(null);
- return;
- }
-
-
- for (var i =0; i < sm.n_items; i++) {
- var p = (Project.Project) sm.get_item(i);
- if (p.path == project.path) {
- GLib.debug("Select Project %s => %d", project.name, i);
- sm.selected = i;
- break;
- }
- }
-
- }
- public void show (Project.Project? project, bool new_window) {
-
- this.new_window = new_window;
-
- this.projectscroll.el.vadjustment.value = 0; // scroll to top?
-
-
- //var win = this.win.el;
- //var w = win.get_width();
- //var h = win.get_height();
-
-
- this.el.show();
- this.load();
- this.selectProject(project);
- this.onProjectSelected(project); //?? twice?
-
- GLib.Timeout.add(500, () => {
- if (project == null) {
- _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
- this.onProjectSelected(null);
-
- }
- this.el.set_size_request( 800 , 750); // ?? based on default
- return false;
- });
-
- }//
- public void load () {
- // cl list...
-
- _this.is_loading = true;
-
- Project.Project.loadAll();
- _this.project_list.el.set_model(new Gtk.SingleSelection(null));
- Project.Project.loadIntoStore(this.projectmodel.el);
-
- _this.project_list.el.set_model(_this.projectselection.el);
-
- _this.is_loading = false;
-
- _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
- _this.btn_delfile.el.hide();
- }
- public class Xcls_Box2 : Object
- {
- public Gtk.Box el;
- private DialogFiles _this;
-
-
- // my vars (def)
- public bool expand;
-
- // ctor
- public Xcls_Box2(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
- this.expand = true;
-
- // set gobject values
- this.el.homogeneous = false;
- this.el.margin_end = 10;
- this.el.margin_start = 10;
- this.el.margin_bottom = 10;
- this.el.margin_top = 10;
- var child_1 = new Xcls_Box3( _this );
- child_1.ref();
- this.el.append( child_1.el );
- new Xcls_mainpane( _this );
- this.el.append( _this.mainpane.el );
- }
-
- // user defined functions
- }
- public class Xcls_Box3 : Object
- {
- public Gtk.Box el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box3(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_mainpane : Object
- {
- public Gtk.Paned el;
- private DialogFiles _this;
-
-
- // my vars (def)
- public bool homogeneous;
- public int spacing;
-
- // ctor
- public Xcls_mainpane(DialogFiles _owner )
- {
- _this = _owner;
- _this.mainpane = this;
- this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
-
- // my vars (dec)
- this.homogeneous = false;
- this.spacing = 0;
-
- // set gobject values
- this.el.hexpand = true;
- this.el.vexpand = true;
- this.el.position = 200;
- new Xcls_projectscroll( _this );
- this.el.start_child = _this.projectscroll.el;
- new Xcls_filepane( _this );
- this.el.end_child = _this.filepane.el;
- }
-
- // user defined functions
- }
- public class Xcls_projectscroll : Object
- {
- public Gtk.ScrolledWindow el;
- private DialogFiles _this;
-
-
- // my vars (def)
- public bool expand;
-
- // ctor
- public Xcls_projectscroll(DialogFiles _owner )
- {
- _this = _owner;
- _this.projectscroll = this;
- this.el = new Gtk.ScrolledWindow();
-
- // my vars (dec)
- this.expand = true;
-
- // set gobject values
- this.el.width_request = 150;
- this.el.has_frame = true;
- this.el.hexpand = true;
- this.el.vexpand = true;
- new Xcls_project_list( _this );
- this.el.child = _this.project_list.el;
-
- // init method
-
- this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
- }
-
- // user defined functions
- }
- public class Xcls_project_list : Object
- {
- public Gtk.ColumnView el;
- private DialogFiles _this;
-
-
- // my vars (def)
- public Gtk.CssProvider css;
-
- // ctor
- public Xcls_project_list(DialogFiles _owner )
- {
- _this = _owner;
- _this.project_list = this;
- new Xcls_projectselection( _this );
- this.el = new Gtk.ColumnView( _this.projectselection.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.name = "project-list";
- var child_2 = new Xcls_ColumnViewColumn12( _this );
- child_2.ref();
- this.el.append_column ( child_2.el );
-
- // init method
-
- {
-
- this.css = new Gtk.CssProvider();
-
- this.css.load_from_string("
- #project-list { font-size: 12px;}
- ");
-
- Gtk.StyleContext.add_provider_for_display(
- this.el.get_display(),
- this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
- );
-
-
- }
- }
-
- // user defined functions
- }
- public class Xcls_projectselection : Object
- {
- public Gtk.SingleSelection el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_projectselection(DialogFiles _owner )
- {
- _this = _owner;
- _this.projectselection = this;
- new Xcls_projectsort( _this );
- this.el = new Gtk.SingleSelection( _this.projectsort.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.can_unselect = true;
-
- //listeners
- this.el.notify["selected"].connect( (position, n_items) => {
-
- if (_this.is_loading) {
- return;
- }
-
- if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
- _this.btn_delproj.el.hide();
- _this.btn_projprop.el.hide();
- _this.btn_addfile.el.hide();
- //_this.btn_delfile.el.hide();
-
- } else {
- _this.btn_delproj.el.show();
- _this.btn_projprop.el.show();
- _this.btn_addfile.el.show();
- //_this.btn_delfile.el.show(); // ??
- }
-
-
-
-
-
- if (_this.is_loading) {
- return;
- }
-
- Project.Project project = this.el.selected == Gtk.INVALID_LIST_POSITION ? null :
- (Project.Project) _this.projectsort.el.get_item(this.el.selected);
-
- GLib.debug("selection changed to %s", project == null ? "none" : project.name);
-
- _this.onProjectSelected(project);
- });
- }
-
- // user defined functions
- }
- public class Xcls_projectsort : Object
- {
- public Gtk.SortListModel el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_projectsort(DialogFiles _owner )
- {
- _this = _owner;
- _this.projectsort = this;
- new Xcls_projectmodel( _this );
- var child_2 = new Xcls_StringSorter10( _this );
- child_2.ref();
- this.el = new Gtk.SortListModel( _this.projectmodel.el, child_2.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.incremental = true;
- }
-
- // user defined functions
- }
- public class Xcls_projectmodel : Object
- {
- public GLib.ListStore el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_projectmodel(DialogFiles _owner )
- {
- _this = _owner;
- _this.projectmodel = this;
- this.el = new GLib.ListStore( typeof(Project.Project) );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- public void remove (Project.Project p) {
-
- for (var i =0;i < this.el.n_items; i++ ) {
- var pr = (Project.Project) this.el.get_item(i);
- if (p.path == pr.path) {
- this.el.remove(i);
- return;
- }
- }
-
-
- }
- }
-
- public class Xcls_StringSorter10 : Object
- {
- public Gtk.StringSorter el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_StringSorter10(DialogFiles _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_PropertyExpression11( _this );
- child_1.ref();
- this.el = new Gtk.StringSorter( child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
- public class Xcls_PropertyExpression11 : Object
- {
- public Gtk.PropertyExpression el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_PropertyExpression11(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.PropertyExpression( typeof(Project.Project), null, "name" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
-
-
- public class Xcls_ColumnViewColumn12 : Object
- {
- public Gtk.ColumnViewColumn el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ColumnViewColumn12(DialogFiles _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_SignalListItemFactory13( _this );
- child_1.ref();
- this.el = new Gtk.ColumnViewColumn( "Project", child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.expand = true;
- }
-
- // user defined functions
- }
- public class Xcls_SignalListItemFactory13 : Object
- {
- public Gtk.SignalListItemFactory el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SignalListItemFactory13(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.SignalListItemFactory();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.setup.connect( (item) => {
- //var j = (JsRender.JsRender) item;
- var gi = (Gtk.ListItem)item;
-
- var lbl = new Gtk.Label("");
- lbl.halign = Gtk.Align.START;
- gi.set_child(lbl);
-
-
-
- });
- this.el.bind.connect( (listitem) => {
-
- var lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();
-
- var item = (Project.Project) ((Gtk.ListItem)listitem).get_item();
-
- item.bind_property("name",
- lbl, "label",
- GLib.BindingFlags.SYNC_CREATE);
-
-
- });
- }
-
- // user defined functions
- }
-
-
-
-
- public class Xcls_filepane : Object
- {
- public Gtk.Paned el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_filepane(DialogFiles _owner )
- {
- _this = _owner;
- _this.filepane = this;
- this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
-
- // my vars (dec)
-
- // set gobject values
- this.el.position = 200;
- this.el.visible = false;
- var child_1 = new Xcls_Box15( _this );
- this.el.end_child = child_1.el;
- new Xcls_treescroll( _this );
- this.el.start_child = _this.treescroll.el;
- }
-
- // user defined functions
- }
- public class Xcls_Box15 : Object
- {
- public Gtk.Box el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box15(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- this.el.vexpand = true;
- var child_1 = new Xcls_Box16( _this );
- child_1.ref();
- this.el.append( child_1.el );
- new Xcls_iconscroll( _this );
- this.el.append( _this.iconscroll.el );
- }
-
- // user defined functions
- }
- public class Xcls_Box16 : Object
- {
- public Gtk.Box el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box16(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- new Xcls_searchbox( _this );
- this.el.append( _this.searchbox.el );
- }
-
- // user defined functions
- }
- public class Xcls_searchbox : Object
- {
- public Gtk.SearchEntry el;
- private DialogFiles _this;
-
-
- // my vars (def)
- public Gtk.CssProvider css;
-
- // ctor
- public Xcls_searchbox(DialogFiles _owner )
- {
- _this = _owner;
- _this.searchbox = this;
- this.el = new Gtk.SearchEntry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.name = "popover-files-iconsearch";
- this.el.hexpand = true;
- this.el.placeholder_text = "type to filter results";
- this.el.search_delay = 1000;
-
- // init method
-
- /*
- this.css = new Gtk.CssProvider();
- try {
- this.css.load_from_data("#popover-files-iconsearch { font: 10px monospace;}".data);
- } catch (Error e) {}
- this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
-
- */
-
- //listeners
- this.el.search_changed.connect( ( ) => {
-
- _this.treefilter.el.changed(Gtk.FilterChange.DIFFERENT);
- _this.iconsearch.el.set_search(this.el.text);
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_iconscroll : Object
- {
- public Gtk.ScrolledWindow el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_iconscroll(DialogFiles _owner )
- {
- _this = _owner;
- _this.iconscroll = this;
- this.el = new Gtk.ScrolledWindow();
-
- // my vars (dec)
-
- // set gobject values
- this.el.has_frame = true;
- this.el.hexpand = true;
- this.el.vexpand = true;
- new Xcls_gridview( _this );
- this.el.child = _this.gridview.el;
-
- // init method
-
- this.el.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
- }
-
- // user defined functions
- }
- public class Xcls_gridview : Object
- {
- public Gtk.GridView el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_gridview(DialogFiles _owner )
- {
- _this = _owner;
- _this.gridview = this;
- new Xcls_iconsel( _this );
- var child_2 = new Xcls_SignalListItemFactory29( _this );
- child_2.ref();
- this.el = new Gtk.GridView( _this.iconsel.el, child_2.el );
-
- // my vars (dec)
-
- // set gobject values
- var child_3 = new Xcls_GestureClick20( _this );
- child_3.ref();
- this.el.add_controller( child_3.el );
- }
-
- // user defined functions
- }
- public class Xcls_GestureClick20 : Object
- {
- public Gtk.GestureClick el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_GestureClick20(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.GestureClick();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.pressed.connect( (n_press, x, y) => {
- if (n_press == 2) {
- GLib.debug("double cliced");
- } else {
- return;
- }
- var f = (JsRender.JsRender)_this.iconsel.el.selected_item;
-
- GLib.debug("Click %s", f.name);
- if (f.xtype == "Dir") {
- return;
- }
-
-
- _this.win.windowstate.fileViewOpen(f, _this.new_window);
- _this.el.hide();
-
-
-
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_iconsel : Object
- {
- public Gtk.SingleSelection el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_iconsel(DialogFiles _owner )
- {
- _this = _owner;
- _this.iconsel = this;
- var child_1 = new Xcls_FilterListModel22( _this );
- child_1.ref();
- this.el = new Gtk.SingleSelection( child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.can_unselect = true;
-
- //listeners
- this.el.notify["selected"].connect( () => {
- if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
- if (_this.treeselmodel.el.selected == Gtk.INVALID_LIST_POSITION) {
- _this.btn_delfile.el.hide();
- }
-
- return;
- }
- _this.btn_delfile.el.show();
- _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
-
-
- });
- }
-
- // user defined functions
- public JsRender.JsRender? selectedFile () {
-
- if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
- return null;
- }
- return (JsRender.JsRender)this.el.get_item(this.el.selected);
-
-
- }
- }
- public class Xcls_FilterListModel22 : Object
- {
- public Gtk.FilterListModel el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_FilterListModel22(DialogFiles _owner )
- {
- _this = _owner;
- new Xcls_gridsort( _this );
- new Xcls_iconsearch( _this );
- this.el = new Gtk.FilterListModel( _this.gridsort.el, _this.iconsearch.el );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
- public class Xcls_gridsort : Object
- {
- public Gtk.SortListModel el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_gridsort(DialogFiles _owner )
- {
- _this = _owner;
- _this.gridsort = this;
- new Xcls_gridmodel( _this );
- var child_2 = new Xcls_StringSorter25( _this );
- child_2.ref();
- this.el = new Gtk.SortListModel( _this.gridmodel.el, child_2.el );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
- public class Xcls_gridmodel : Object
- {
- public GLib.ListStore el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_gridmodel(DialogFiles _owner )
- {
- _this = _owner;
- _this.gridmodel = this;
- this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- public void remove (JsRender.JsRender p) {
-
- for (var i =0;i < this.el.n_items; i++ ) {
- var pr = (JsRender.JsRender) this.el.get_item(i);
- if (p.path == pr.path) {
- this.el.remove(i);
- return;
- }
- }
-
- }
- }
-
- public class Xcls_StringSorter25 : Object
- {
- public Gtk.StringSorter el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_StringSorter25(DialogFiles _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_PropertyExpression26( _this );
- child_1.ref();
- this.el = new Gtk.StringSorter( child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.ignore_case = true;
- }
-
- // user defined functions
- }
- public class Xcls_PropertyExpression26 : Object
- {
- public Gtk.PropertyExpression el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_PropertyExpression26(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
-
- public class Xcls_iconsearch : Object
- {
- public Gtk.StringFilter el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_iconsearch(DialogFiles _owner )
- {
- _this = _owner;
- _this.iconsearch = this;
- var child_1 = new Xcls_PropertyExpression28( _this );
- child_1.ref();
- this.el = new Gtk.StringFilter( child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.match_mode = Gtk.StringFilterMatchMode.SUBSTRING;
- this.el.ignore_case = true;
- }
-
- // user defined functions
- }
- public class Xcls_PropertyExpression28 : Object
- {
- public Gtk.PropertyExpression el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_PropertyExpression28(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
-
-
- public class Xcls_SignalListItemFactory29 : Object
- {
- public Gtk.SignalListItemFactory el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SignalListItemFactory29(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.SignalListItemFactory();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.setup.connect( (item) => {
- //var j = (JsRender.JsRender) item;
- var gi = (Gtk.ListItem)item;
- var b = new Gtk.Box(Gtk.Orientation.VERTICAL,4);
- var i = new Gtk.Image();
- i.pixel_size = 96;
- var t = new Gtk.Label("");
- b.append(i);
- b.append(t);
-
- gi.set_child(b);
- b.has_tooltip = true;
- b.query_tooltip.connect((x, y, keyboard_tooltip, tooltip) => {
- var j = (JsRender.JsRender) gi.get_item();
-
- var ti = new Gtk.Image.from_file ( j.getIconFileName());
- ti.pixel_size = 368;
- tooltip.set_custom( ti );
- return true;
- });
-
-
- });
- this.el.bind.connect( (listitem) => {
-
- var box = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();
-
- var img = (Gtk.Image) box.get_first_child();
- var lbl = (Gtk.Label)img.get_next_sibling();
-
- var item = (JsRender.JsRender) ((Gtk.ListItem)listitem).get_item();
- //GLib.debug("set label name to %s", item.name);
-
- var ns = item.name.split(".");
- if (ns.length < 2) {
- lbl.label = item.name;
- } else {
- lbl.label =
- item.name.substring(0, item.name.length - ns[ns.length-1].length)
- + "\n"+ ns[ns.length-1];
- }
-
- /*
- item.bind_property("name",
- lbl, "label",
- GLib.BindingFlags.SYNC_CREATE);
-
- */
- img.set_from_file(item.getIconFileName());
-
-
- });
- }
-
- // user defined functions
- }
+ // my vars (dec)
+ // set gobject values
+ }
+ // user defined functions
+ }
- public class Xcls_treescroll : Object
- {
- public Gtk.ScrolledWindow el;
- private DialogFiles _this;
- // my vars (def)
+ public class Xcls_ColumnViewColumn12 : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_ColumnViewColumn12(DialogFiles _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_SignalListItemFactory13( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Project", child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.expand = true;
+ }
- // ctor
- public Xcls_treescroll(DialogFiles _owner )
- {
- _this = _owner;
- _this.treescroll = this;
- this.el = new Gtk.ScrolledWindow();
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory13 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_SignalListItemFactory13(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (item) => {
+ //var j = (JsRender.JsRender) item;
+ var gi = (Gtk.ListItem)item;
+
+ var lbl = new Gtk.Label("");
+ lbl.halign = Gtk.Align.START;
+ gi.set_child(lbl);
+
+
+
+ });
+ this.el.bind.connect( (listitem) => {
+
+ var lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();
+
+ var item = (Project.Project) ((Gtk.ListItem)listitem).get_item();
+
+ item.bind_property("name",
+ lbl, "label",
+ GLib.BindingFlags.SYNC_CREATE);
+
+
+ });
+ }
- // my vars (dec)
+ // user defined functions
+ }
- // set gobject values
- this.el.width_request = 200;
- this.el.has_frame = true;
- this.el.hexpand = true;
- this.el.vexpand = true;
- this.el.visible = true;
- new Xcls_treeview( _this );
- this.el.child = _this.treeview.el;
- // init method
- this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
- }
- // user defined functions
- }
- public class Xcls_treeview : Object
- {
- public Gtk.ColumnView el;
- private DialogFiles _this;
-
-
- // my vars (def)
- public Gtk.CssProvider css;
-
- // ctor
- public Xcls_treeview(DialogFiles _owner )
- {
- _this = _owner;
- _this.treeview = this;
- new Xcls_treeselmodel( _this );
- this.el = new Gtk.ColumnView( _this.treeselmodel.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.name = "file-list";
- var child_2 = new Xcls_GestureClick32( _this );
- child_2.ref();
- this.el.add_controller( child_2.el );
- new Xcls_name( _this );
- this.el.append_column ( _this.name.el );
-
- // init method
-
- {
-
- this.css = new Gtk.CssProvider();
-
- this.css.load_from_string("
- #file-list { font-size: 12px;}
- #file-list indent {
- -gtk-icon-size : 2px;
- }
- #file-list indent:nth-last-child(2) {
- min-width: 24px;
- }
- ");
-
- Gtk.StyleContext.add_provider_for_display(
- this.el.get_display(),
- this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
- );
-
- }
- }
+ public class Xcls_filepane : Object
+ {
+ public Gtk.Paned el;
+ private DialogFiles _this;
- // user defined functions
- }
- public class Xcls_GestureClick32 : Object
- {
- public Gtk.GestureClick el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_GestureClick32(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.GestureClick();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.pressed.connect( (n_press, x, y) => {
- if (n_press == 2) {
- GLib.debug("double cliced");
- } else {
- return;
- }
- var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;
- GLib.debug("SELECTED = %s", tr.item.get_type().name());
- var f = (JsRender.JsRender) tr.item;
- GLib.debug("Click %s", f.name);
- if (f.xtype == "Dir") {
- return;
- }
-
-
- _this.win.windowstate.fileViewOpen(f, _this.new_window);
-
- _this.el.hide();
-
-
-
- });
- }
- // user defined functions
- }
+ // my vars (def)
- public class Xcls_treeselmodel : Object
- {
- public Gtk.SingleSelection el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_treeselmodel(DialogFiles _owner )
- {
- _this = _owner;
- _this.treeselmodel = this;
- var child_1 = new Xcls_FilterListModel34( _this );
- child_1.ref();
- this.el = new Gtk.SingleSelection( child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.can_unselect = true;
-
- //listeners
- this.el.notify["selected"].connect( () => {
- if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
- if (_this.iconsel.el.selected == Gtk.INVALID_LIST_POSITION) {
- _this.btn_delfile.el.hide();
- }
- return;
- }
-
- var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;
- GLib.debug("SELECTED = %s", tr.item.get_type().name());
- var f = (JsRender.JsRender) tr.item;
- if (f.xtype == "Dir") {
- _this.btn_delfile.el.hide();
- } else {
- _this.btn_delfile.el.show();
- }
-
- _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
-
-
- });
- }
+ // ctor
+ public Xcls_filepane(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.filepane = this;
+ this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.position = 200;
+ this.el.visible = false;
+ var child_1 = new Xcls_Box15( _this );
+ this.el.end_child = child_1.el;
+ new Xcls_treescroll( _this );
+ this.el.start_child = _this.treescroll.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Box15 : Object
+ {
+ public Gtk.Box el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box15(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ var child_1 = new Xcls_Box16( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ new Xcls_iconscroll( _this );
+ this.el.append( _this.iconscroll.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Box16 : Object
+ {
+ public Gtk.Box el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box16(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ new Xcls_searchbox( _this );
+ this.el.append( _this.searchbox.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_searchbox : Object
+ {
+ public Gtk.SearchEntry el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+ public Gtk.CssProvider css;
+
+ // ctor
+ public Xcls_searchbox(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.searchbox = this;
+ this.el = new Gtk.SearchEntry();
- // user defined functions
- public JsRender.JsRender? selectedFile () {
-
- if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
- return null;
- }
- var tr = (Gtk.TreeListRow) this.el.selected_item;
-
- return (JsRender.JsRender) tr.item;
- }
- }
- public class Xcls_FilterListModel34 : Object
- {
- public Gtk.FilterListModel el;
- private DialogFiles _this;
+ // my vars (dec)
+
+ // set gobject values
+ this.el.name = "popover-files-iconsearch";
+ this.el.hexpand = true;
+ this.el.placeholder_text = "type to filter results";
+ this.el.search_delay = 1000;
+
+ // init method
+
+ /*
+ this.css = new Gtk.CssProvider();
+ try {
+ this.css.load_from_data("#popover-files-iconsearch { font: 10px monospace;}".data);
+ } catch (Error e) {}
+ this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+
+
+ */
+
+ //listeners
+ this.el.search_changed.connect( ( ) => {
+
+ _this.treefilter.el.changed(Gtk.FilterChange.DIFFERENT);
+ _this.iconsearch.el.set_search(this.el.text);
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_iconscroll : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_iconscroll(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.iconscroll = this;
+ this.el = new Gtk.ScrolledWindow();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.has_frame = true;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ new Xcls_gridview( _this );
+ this.el.child = _this.gridview.el;
+
+ // init method
+
+ this.el.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
+ }
+
+ // user defined functions
+ }
+ public class Xcls_gridview : Object
+ {
+ public Gtk.GridView el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_gridview(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.gridview = this;
+ new Xcls_iconsel( _this );
+ var child_2 = new Xcls_SignalListItemFactory29( _this );
+ child_2.ref();
+ this.el = new Gtk.GridView( _this.iconsel.el, child_2.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_3 = new Xcls_GestureClick20( _this );
+ child_3.ref();
+ this.el.add_controller( child_3.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_GestureClick20 : Object
+ {
+ public Gtk.GestureClick el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_GestureClick20(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.GestureClick();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.pressed.connect( (n_press, x, y) => {
+ if (n_press == 2) {
+ GLib.debug("double cliced");
+ } else {
+ return;
+ }
+ var f = (JsRender.JsRender)_this.iconsel.el.selected_item;
+
+ GLib.debug("Click %s", f.name);
+ if (f.xtype == "Dir") {
+ return;
+ }
+
+
+ _this.win.windowstate.fileViewOpen(f, _this.new_window);
+ _this.el.hide();
+
+
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_iconsel : Object
+ {
+ public Gtk.SingleSelection el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_iconsel(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.iconsel = this;
+ var child_1 = new Xcls_FilterListModel22( _this );
+ child_1.ref();
+ this.el = new Gtk.SingleSelection( child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.can_unselect = true;
+
+ //listeners
+ this.el.notify["selected"].connect( () => {
+ if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
+ if (_this.treeselmodel.el.selected == Gtk.INVALID_LIST_POSITION) {
+ _this.btn_delfile.el.hide();
+ }
+
+ return;
+ }
+ _this.btn_delfile.el.show();
+ _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
+
+
+ });
+ }
+
+ // user defined functions
+ public JsRender.JsRender? selectedFile () {
+
+ if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
+ return null;
+ }
+ return (JsRender.JsRender)this.el.get_item(this.el.selected);
+
+
+ }
+ }
+ public class Xcls_FilterListModel22 : Object
+ {
+ public Gtk.FilterListModel el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_FilterListModel22(DialogFiles _owner )
+ {
+ _this = _owner;
+ new Xcls_gridsort( _this );
+ new Xcls_iconsearch( _this );
+ this.el = new Gtk.FilterListModel( _this.gridsort.el, _this.iconsearch.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+ public class Xcls_gridsort : Object
+ {
+ public Gtk.SortListModel el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_gridsort(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.gridsort = this;
+ new Xcls_gridmodel( _this );
+ var child_2 = new Xcls_StringSorter25( _this );
+ child_2.ref();
+ this.el = new Gtk.SortListModel( _this.gridmodel.el, child_2.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+ public class Xcls_gridmodel : Object
+ {
+ public GLib.ListStore el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_gridmodel(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.gridmodel = this;
+ this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ public void remove (JsRender.JsRender p) {
+
+ for (var i =0;i < this.el.n_items; i++ ) {
+ var pr = (JsRender.JsRender) this.el.get_item(i);
+ if (p.path == pr.path) {
+ this.el.remove(i);
+ return;
+ }
+ }
+
+ }
+ }
+ public class Xcls_StringSorter25 : Object
+ {
+ public Gtk.StringSorter el;
+ private DialogFiles _this;
- // my vars (def)
- // ctor
- public Xcls_FilterListModel34(DialogFiles _owner )
- {
- _this = _owner;
- new Xcls_treelistsort( _this );
- new Xcls_treefilter( _this );
- this.el = new Gtk.FilterListModel( _this.treelistsort.el, _this.treefilter.el );
+ // my vars (def)
- // my vars (dec)
+ // ctor
+ public Xcls_StringSorter25(DialogFiles _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_PropertyExpression26( _this );
+ child_1.ref();
+ this.el = new Gtk.StringSorter( child_1.el );
- // set gobject values
- }
-
- // user defined functions
- }
- public class Xcls_treelistsort : Object
- {
- public Gtk.SortListModel el;
- private DialogFiles _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.ignore_case = true;
+ }
- // my vars (def)
+ // user defined functions
+ }
+ public class Xcls_PropertyExpression26 : Object
+ {
+ public Gtk.PropertyExpression el;
+ private DialogFiles _this;
- // ctor
- public Xcls_treelistsort(DialogFiles _owner )
- {
- _this = _owner;
- _this.treelistsort = this;
- new Xcls_treelistmodel( _this );
- var child_2 = new Xcls_TreeListRowSorter38( _this );
- child_2.ref();
- this.el = new Gtk.SortListModel( _this.treelistmodel.el, child_2.el );
- // my vars (dec)
+ // my vars (def)
- // set gobject values
- this.el.incremental = true;
- }
+ // ctor
+ public Xcls_PropertyExpression26(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
- // user defined functions
- }
- public class Xcls_treelistmodel : Object
- {
- public Gtk.TreeListModel el;
- private DialogFiles _this;
+ // my vars (dec)
+ // set gobject values
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_treelistmodel(DialogFiles _owner )
- {
- _this = _owner;
- _this.treelistmodel = this;
- new Xcls_treemodel( _this );
- this.el = new Gtk.TreeListModel( _this.treemodel.el, false, true, (item) => {
+
+
+ public class Xcls_iconsearch : Object
+ {
+ public Gtk.StringFilter el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_iconsearch(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.iconsearch = this;
+ var child_1 = new Xcls_PropertyExpression28( _this );
+ child_1.ref();
+ this.el = new Gtk.StringFilter( child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.match_mode = Gtk.StringFilterMatchMode.SUBSTRING;
+ this.el.ignore_case = true;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_PropertyExpression28 : Object
+ {
+ public Gtk.PropertyExpression el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_PropertyExpression28(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+
+
+ public class Xcls_SignalListItemFactory29 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_SignalListItemFactory29(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (item) => {
+ //var j = (JsRender.JsRender) item;
+ var gi = (Gtk.ListItem)item;
+ var b = new Gtk.Box(Gtk.Orientation.VERTICAL,4);
+ var i = new Gtk.Image();
+ i.pixel_size = 96;
+ var t = new Gtk.Label("");
+ b.append(i);
+ b.append(t);
+
+ gi.set_child(b);
+ b.has_tooltip = true;
+ b.query_tooltip.connect((x, y, keyboard_tooltip, tooltip) => {
+ var j = (JsRender.JsRender) gi.get_item();
+
+ var ti = new Gtk.Image.from_file ( j.getIconFileName());
+ ti.pixel_size = 368;
+ tooltip.set_custom( ti );
+ return true;
+ });
+
+
+ });
+ this.el.bind.connect( (listitem) => {
+
+ var box = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();
+
+ var img = (Gtk.Image) box.get_first_child();
+ var lbl = (Gtk.Label)img.get_next_sibling();
+
+ var item = (JsRender.JsRender) ((Gtk.ListItem)listitem).get_item();
+ //GLib.debug("set label name to %s", item.name);
+
+ var ns = item.name.split(".");
+ if (ns.length < 2) {
+ lbl.label = item.name;
+ } else {
+ lbl.label =
+ item.name.substring(0, item.name.length - ns[ns.length-1].length)
+ + "\n"+ ns[ns.length-1];
+ }
+
+ /*
+ item.bind_property("name",
+ lbl, "label",
+ GLib.BindingFlags.SYNC_CREATE);
+
+ */
+ img.set_from_file(item.getIconFileName());
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+
+
+ public class Xcls_treescroll : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_treescroll(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.treescroll = this;
+ this.el = new Gtk.ScrolledWindow();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.width_request = 200;
+ this.el.has_frame = true;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ this.el.visible = true;
+ new Xcls_treeview( _this );
+ this.el.child = _this.treeview.el;
+
+ // init method
+
+ this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+ }
+
+ // user defined functions
+ }
+ public class Xcls_treeview : Object
+ {
+ public Gtk.ColumnView el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+ public Gtk.CssProvider css;
+
+ // ctor
+ public Xcls_treeview(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.treeview = this;
+ new Xcls_treeselmodel( _this );
+ this.el = new Gtk.ColumnView( _this.treeselmodel.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.name = "file-list";
+ var child_2 = new Xcls_GestureClick32( _this );
+ child_2.ref();
+ this.el.add_controller( child_2.el );
+ new Xcls_name( _this );
+ this.el.append_column ( _this.name.el );
+
+ // init method
+
+ {
+
+ this.css = new Gtk.CssProvider();
+
+ this.css.load_from_string("#file-list { font-size: 12px;}");
+
+ Gtk.StyleContext.add_provider_for_display(
+ this.el.get_display(),
+ this.css,
+ Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
+ );
+
+ }
+ }
+
+ // user defined functions
+ }
+ public class Xcls_GestureClick32 : Object
+ {
+ public Gtk.GestureClick el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_GestureClick32(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.GestureClick();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.pressed.connect( (n_press, x, y) => {
+ if (n_press == 2) {
+ GLib.debug("double cliced");
+ } else {
+ return;
+ }
+ var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;
+ GLib.debug("SELECTED = %s", tr.item.get_type().name());
+ var f = (JsRender.JsRender) tr.item;
+ GLib.debug("Click %s", f.name);
+ if (f.xtype == "Dir") {
+ return;
+ }
+
+
+ _this.win.windowstate.fileViewOpen(f, _this.new_window);
+
+ _this.el.hide();
+
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_treeselmodel : Object
+ {
+ public Gtk.SingleSelection el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_treeselmodel(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.treeselmodel = this;
+ var child_1 = new Xcls_FilterListModel34( _this );
+ child_1.ref();
+ this.el = new Gtk.SingleSelection( child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.can_unselect = true;
+
+ //listeners
+ this.el.notify["selected"].connect( () => {
+ if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
+ if (_this.iconsel.el.selected == Gtk.INVALID_LIST_POSITION) {
+ _this.btn_delfile.el.hide();
+ }
+ return;
+ }
+
+ var tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;
+ GLib.debug("SELECTED = %s", tr.item.get_type().name());
+ var f = (JsRender.JsRender) tr.item;
+ if (f.xtype == "Dir") {
+ _this.btn_delfile.el.hide();
+ } else {
+ _this.btn_delfile.el.show();
+ }
+
+ _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;
+
+
+ });
+ }
+
+ // user defined functions
+ public JsRender.JsRender? selectedFile () {
+
+ if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
+ return null;
+ }
+ var tr = (Gtk.TreeListRow) this.el.selected_item;
+
+ return (JsRender.JsRender) tr.item;
+ }
+ }
+ public class Xcls_FilterListModel34 : Object
+ {
+ public Gtk.FilterListModel el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_FilterListModel34(DialogFiles _owner )
+ {
+ _this = _owner;
+ new Xcls_treelistsort( _this );
+ new Xcls_treefilter( _this );
+ this.el = new Gtk.FilterListModel( _this.treelistsort.el, _this.treefilter.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+ public class Xcls_treelistsort : Object
+ {
+ public Gtk.SortListModel el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_treelistsort(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.treelistsort = this;
+ new Xcls_treelistmodel( _this );
+ var child_2 = new Xcls_TreeListRowSorter38( _this );
+ child_2.ref();
+ this.el = new Gtk.SortListModel( _this.treelistmodel.el, child_2.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.incremental = true;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_treelistmodel : Object
+ {
+ public Gtk.TreeListModel el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_treelistmodel(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.treelistmodel = this;
+ new Xcls_treemodel( _this );
+ this.el = new Gtk.TreeListModel( _this.treemodel.el, false, true, (item) => {
//GLib.debug("liststore got %s", item.get_type().name());
return ((JsRender.JsRender)item).childfiles;
} );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ }
- // user defined functions
- }
- public class Xcls_treemodel : Object
- {
- public GLib.ListStore el;
- private DialogFiles _this;
+ // user defined functions
+ }
+ public class Xcls_treemodel : Object
+ {
+ public GLib.ListStore el;
+ private DialogFiles _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_treemodel(DialogFiles _owner )
- {
- _this = _owner;
- _this.treemodel = this;
- this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
+ // ctor
+ public Xcls_treemodel(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.treemodel = this;
+ this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ }
- // user defined functions
- }
+ // user defined functions
+ }
- public class Xcls_TreeListRowSorter38 : Object
- {
- public Gtk.TreeListRowSorter el;
- private DialogFiles _this;
+ public class Xcls_TreeListRowSorter38 : Object
+ {
+ public Gtk.TreeListRowSorter el;
+ private DialogFiles _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_TreeListRowSorter38(DialogFiles _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_StringSorter39( _this );
- child_1.ref();
- this.el = new Gtk.TreeListRowSorter( child_1.el );
+ // ctor
+ public Xcls_TreeListRowSorter38(DialogFiles _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_StringSorter39( _this );
+ child_1.ref();
+ this.el = new Gtk.TreeListRowSorter( child_1.el );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ }
- // user defined functions
- }
- public class Xcls_StringSorter39 : Object
- {
- public Gtk.StringSorter el;
- private DialogFiles _this;
+ // user defined functions
+ }
+ public class Xcls_StringSorter39 : Object
+ {
+ public Gtk.StringSorter el;
+ private DialogFiles _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_StringSorter39(DialogFiles _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_PropertyExpression40( _this );
- child_1.ref();
- this.el = new Gtk.StringSorter( child_1.el );
+ // ctor
+ public Xcls_StringSorter39(DialogFiles _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_PropertyExpression40( _this );
+ child_1.ref();
+ this.el = new Gtk.StringSorter( child_1.el );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.ignore_case = true;
- }
+ // set gobject values
+ this.el.ignore_case = true;
+ }
- // user defined functions
- }
- public class Xcls_PropertyExpression40 : Object
- {
- public Gtk.PropertyExpression el;
- private DialogFiles _this;
+ // user defined functions
+ }
+ public class Xcls_PropertyExpression40 : Object
+ {
+ public Gtk.PropertyExpression el;
+ private DialogFiles _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_PropertyExpression40(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender) , null, "name" );
+ // ctor
+ public Xcls_PropertyExpression40(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender) , null, "name" );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ }
- // user defined functions
- }
+ // user defined functions
+ }
- public class Xcls_treefilter : Object
- {
- public Gtk.CustomFilter el;
- private DialogFiles _this;
+ public class Xcls_treefilter : Object
+ {
+ public Gtk.CustomFilter el;
+ private DialogFiles _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_treefilter(DialogFiles _owner )
- {
- _this = _owner;
- _this.treefilter = this;
- this.el = new Gtk.CustomFilter( (item) => {
+ // ctor
+ public Xcls_treefilter(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.treefilter = this;
+ this.el = new Gtk.CustomFilter( (item) => {
var tr = ((Gtk.TreeListRow)item).get_item();
//GLib.debug("filter %s", tr.get_type().name());
var j = (JsRender.JsRender) tr;
} );
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
-
- public class Xcls_name : Object
- {
- public Gtk.ColumnViewColumn el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_name(DialogFiles _owner )
- {
- _this = _owner;
- _this.name = this;
- var child_1 = new Xcls_SignalListItemFactory43( _this );
- child_1.ref();
- this.el = new Gtk.ColumnViewColumn( "General Files", child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.id = "name";
- this.el.expand = true;
- this.el.resizable = true;
-
- // init method
-
- {
- // this.el.set_sorter( new Gtk.StringSorter(
- // new Gtk.PropertyExpression(typeof(JsRender.NodeProp), null, "name")
- // ));
-
- }
- }
-
- // user defined functions
- }
- public class Xcls_SignalListItemFactory43 : Object
- {
- public Gtk.SignalListItemFactory el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SignalListItemFactory43(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.SignalListItemFactory();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.setup.connect( (listitem) => {
-
- var expand = new Gtk.TreeExpander();
-
- expand.set_indent_for_depth(true);
- expand.set_indent_for_icon(true);
- var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);
- var icon = new Gtk.Image();
- icon.margin_end = 4;
- var lbl = new Gtk.Label("");
- lbl.use_markup = true;
-
-
- lbl.justify = Gtk.Justification.LEFT;
- lbl.xalign = 0;
-
- hbox.append(icon);
- hbox.append(lbl);
- expand.set_child(hbox);
- ((Gtk.ListItem)listitem).set_child(expand);
- ((Gtk.ListItem)listitem).activatable = false;
- });
- this.el.bind.connect( (listitem) => {
-
- //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
-
-
-
- //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
- var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
-
- var hbox = (Gtk.Box) expand.child;
-
-
- var img = (Gtk.Image) hbox.get_first_child();
- var lbl = (Gtk.Label) img.get_next_sibling();
-
-
-
- if (lbl.label != "") { // do not update
- return;
- }
- var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
- //GLib.debug("LR = %s", lr.get_type().name());
-
-
- var jr =(JsRender.JsRender) lr.get_item();
- //GLib.debug("JR = %s", jr.get_type().name());
-
- if (jr == null) {
- GLib.debug("Problem getting item");
- return;
- }
-
- jr.bind_property("icon",
- img, "gicon",
- GLib.BindingFlags.SYNC_CREATE);
-
- //GLib.debug("change %s to %s", lbl.label, np.name);
- lbl.label = jr.name; // for dir's we could hsow the sub path..
- lbl.tooltip_markup = jr.path;
-
- expand.set_hide_expander( jr.xtype != "Dir" );
- expand.set_list_row(lr);
-
-
- // bind image...
- });
- }
-
- // user defined functions
- }
-
-
-
-
-
-
-
- public class Xcls_HeaderBar44 : Object
- {
- public Gtk.HeaderBar el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_HeaderBar44(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.HeaderBar();
-
- // my vars (dec)
-
- // set gobject values
- this.el.show_title_buttons = false;
- var child_1 = new Xcls_Button45( _this );
- child_1.ref();
- this.el.pack_end ( child_1.el );
- new Xcls_btn_newproj( _this );
- this.el.pack_start ( _this.btn_newproj.el );
- new Xcls_btn_projprop( _this );
- this.el.pack_start ( _this.btn_projprop.el );
- new Xcls_btn_delproj( _this );
- this.el.pack_start ( _this.btn_delproj.el );
- new Xcls_btn_addfile( _this );
- this.el.pack_start ( _this.btn_addfile.el );
- new Xcls_btn_delfile( _this );
- this.el.pack_start ( _this.btn_delfile.el );
- }
-
- // user defined functions
- }
- public class Xcls_Button45 : Object
- {
- public Gtk.Button el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button45(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Close / Cancel";
-
- //listeners
- this.el.clicked.connect( ( ) => {
- if (BuilderApplication.windows.size < 2 &&
- _this.win.windowstate.file == null
- ) {
- BuilderApplication.singleton(null).quit();
- return;
- }
-
- _this.el.hide();
-
- if (_this.win.windowstate.file == null) {
- BuilderApplication.removeWindow(_this.win);
-
-
-
- }
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_btn_newproj : Object
- {
- public Gtk.Button el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_btn_newproj(DialogFiles _owner )
- {
- _this = _owner;
- _this.btn_newproj = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- var child_1 = new Xcls_Box47( _this );
- this.el.child = child_1.el;
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
- // create a new file in project..
- //Xcls_DialogNewComponent.singleton().show(
- var pe = EditProject.singleton();
- pe.windowstate = _this.win.windowstate;
-
- pe.el.application = _this.win.el.application;
- pe.el.set_transient_for( _this.el );
-
- var cb = new Project.Callback();
- cb.call.connect((pr) => {
- _this.show( pr , _this.new_window);
- });
-
- pe.show( cb);
-
-
- });
- }
-
- // user defined functions
- public void onCreated () {
- var pe = EditProject.singleton();
-
- _this.show( pe.result , _this.new_window);
- }
- }
- public class Xcls_Box47 : Object
- {
- public Gtk.Box el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box47(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- var child_1 = new Xcls_Image48( _this );
- child_1.ref();
- this.el.append( child_1.el );
- var child_2 = new Xcls_Label49( _this );
- child_2.ref();
- this.el.append( child_2.el );
- }
-
- // user defined functions
- }
- public class Xcls_Image48 : Object
- {
- public Gtk.Image el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image48(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
-
- // my vars (dec)
-
- // set gobject values
- this.el.icon_name = "folder-new";
- this.el.margin_end = 4;
- this.el.icon_size = Gtk.IconSize.NORMAL;
- }
-
- // user defined functions
- }
-
- public class Xcls_Label49 : Object
- {
- public Gtk.Label el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label49(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "New Project" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.halign = Gtk.Align.START;
- }
-
- // user defined functions
- }
-
-
-
- public class Xcls_btn_projprop : Object
- {
- public Gtk.Button el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_btn_projprop(DialogFiles _owner )
- {
- _this = _owner;
- _this.btn_projprop = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- var child_1 = new Xcls_Box51( _this );
- this.el.child = child_1.el;
-
- //listeners
- this.el.clicked.connect( ( ) => {
- // should disable the button really.
- if (_this.selectedProject == null) {
- return;
- }
- _this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject, null);
- });
- }
-
- // user defined functions
- }
- public class Xcls_Box51 : Object
- {
- public Gtk.Box el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box51(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- var child_1 = new Xcls_Image52( _this );
- child_1.ref();
- this.el.append( child_1.el );
- var child_2 = new Xcls_Label53( _this );
- child_2.ref();
- this.el.append( child_2.el );
- }
-
- // user defined functions
- }
- public class Xcls_Image52 : Object
- {
- public Gtk.Image el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image52(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
-
- // my vars (dec)
-
- // set gobject values
- this.el.icon_name = "emblem-system";
- this.el.margin_end = 4;
- }
-
- // user defined functions
- }
-
- public class Xcls_Label53 : Object
- {
- public Gtk.Label el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label53(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Project Properties" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
-
- public class Xcls_btn_delproj : Object
- {
- public Gtk.Button el;
- private DialogFiles _this;
-
-
- // my vars (def)
- public DialogConfirm confirm;
-
- // ctor
- public Xcls_btn_delproj(DialogFiles _owner )
- {
- _this = _owner;
- _this.btn_delproj = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
- this.confirm = null;
-
- // set gobject values
- var child_1 = new Xcls_Box55( _this );
- this.el.child = child_1.el;
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
-
- if (this.confirm == null) {
- this.confirm = new DialogConfirm();
- this.confirm.el.set_transient_for(_this.el);
- }
-
- var project = (Project.Project) _this.projectsort.el.get_item(
- _this.projectselection.el.selected
- );
-
- this.confirm.el.response.connect((res) => {
- this.confirm.el.hide();
- if (res == Gtk.ResponseType.CANCEL) {
- return;
- }
- project = (Project.Project) _this.projectsort.el.get_item(
- _this.projectselection.el.selected
- );
- Project.Project.remove(project);
- _this.projectmodel.remove(project);
- _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
-
- });
- this.confirm.showIt("Confirm Delete Project", "Are you sure you want to delete this project?");
- });
- }
-
- // user defined functions
- }
- public class Xcls_Box55 : Object
- {
- public Gtk.Box el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box55(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- var child_1 = new Xcls_Image56( _this );
- child_1.ref();
- this.el.append( child_1.el );
- var child_2 = new Xcls_Label57( _this );
- child_2.ref();
- this.el.append( child_2.el );
- }
-
- // user defined functions
- }
- public class Xcls_Image56 : Object
- {
- public Gtk.Image el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image56(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
-
- // my vars (dec)
-
- // set gobject values
- this.el.icon_name = "user-trash";
- }
-
- // user defined functions
- }
-
- public class Xcls_Label57 : Object
- {
- public Gtk.Label el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label57(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Delete Project" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
-
- public class Xcls_btn_addfile : Object
- {
- public Gtk.Button el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_btn_addfile(DialogFiles _owner )
- {
- _this = _owner;
- _this.btn_addfile = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- var child_1 = new Xcls_Box59( _this );
- this.el.child = child_1.el;
-
- //listeners
- this.el.clicked.connect( () => {
- // create a new file in project..
- print("add file selected\n");
-
- if (_this.selectedProject == null) {
- return;
- }
- try {
- var f = JsRender.JsRender.factory(_this.selectedProject.xtype, _this.selectedProject, "");
- _this.win.windowstate.file_details.show( f, _this.el, _this.new_window );
- } catch (JsRender.Error e) {}
-
- });
- }
-
- // user defined functions
- }
- public class Xcls_Box59 : Object
- {
- public Gtk.Box el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box59(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- var child_1 = new Xcls_Image60( _this );
- child_1.ref();
- this.el.append( child_1.el );
- var child_2 = new Xcls_Label61( _this );
- child_2.ref();
- this.el.append( child_2.el );
- }
-
- // user defined functions
- }
- public class Xcls_Image60 : Object
- {
- public Gtk.Image el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image60(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
-
- // my vars (dec)
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+
+ public class Xcls_name : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_name(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.name = this;
+ var child_1 = new Xcls_SignalListItemFactory43( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "General Files", child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.id = "name";
+ this.el.expand = true;
+ this.el.resizable = true;
+
+ // init method
+
+ {
+ // this.el.set_sorter( new Gtk.StringSorter(
+ // new Gtk.PropertyExpression(typeof(JsRender.NodeProp), null, "name")
+ // ));
+
+ }
+ }
+
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory43 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_SignalListItemFactory43(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (listitem) => {
+
+ var expand = new Gtk.TreeExpander();
+
+ expand.set_indent_for_depth(true);
+ expand.set_indent_for_icon(true);
+
+ var lbl = new Gtk.Label("");
+ lbl.use_markup = true;
+
+
+ lbl.justify = Gtk.Justification.LEFT;
+ lbl.xalign = 0;
+
+
+ expand.set_child(lbl);
+ ((Gtk.ListItem)listitem).set_child(expand);
+ ((Gtk.ListItem)listitem).activatable = false;
+ });
+ this.el.bind.connect( (listitem) => {
+ //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
+
+
+
+ //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
+ var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
+
+
+ var lbl = (Gtk.Label) expand.child;
+
+ if (lbl.label != "") { // do not update
+ return;
+ }
+ var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
+ //GLib.debug("LR = %s", lr.get_type().name());
+
+
+ var jr =(JsRender.JsRender) lr.get_item();
+ //GLib.debug("JR = %s", jr.get_type().name());
+
+ if (jr == null) {
+ GLib.debug("Problem getting item");
+ return;
+ }
+ //GLib.debug("change %s to %s", lbl.label, np.name);
+ lbl.label = jr.name; // for dir's we could hsow the sub path..
+ lbl.tooltip_markup = jr.path;
+
+ expand.set_hide_expander( jr.xtype != "Dir" );
+ expand.set_list_row(lr);
+
+
+ // bind image...
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+
+
+
+
+
+ public class Xcls_HeaderBar44 : Object
+ {
+ public Gtk.HeaderBar el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_HeaderBar44(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.HeaderBar();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.show_title_buttons = false;
+ var child_1 = new Xcls_Button45( _this );
+ child_1.ref();
+ this.el.pack_end ( child_1.el );
+ new Xcls_btn_newproj( _this );
+ this.el.pack_start ( _this.btn_newproj.el );
+ new Xcls_btn_projprop( _this );
+ this.el.pack_start ( _this.btn_projprop.el );
+ new Xcls_btn_delproj( _this );
+ this.el.pack_start ( _this.btn_delproj.el );
+ new Xcls_btn_addfile( _this );
+ this.el.pack_start ( _this.btn_addfile.el );
+ new Xcls_btn_delfile( _this );
+ this.el.pack_start ( _this.btn_delfile.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Button45 : Object
+ {
+ public Gtk.Button el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button45(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "Close / Cancel";
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+ if (BuilderApplication.windows.size < 2 &&
+ _this.win.windowstate.file == null
+ ) {
+ BuilderApplication.singleton(null).quit();
+ return;
+ }
+
+ _this.el.hide();
+
+ if (_this.win.windowstate.file == null) {
+ BuilderApplication.removeWindow(_this.win);
+
+
+
+ }
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_btn_newproj : Object
+ {
+ public Gtk.Button el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_btn_newproj(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.btn_newproj = this;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Box47( _this );
+ this.el.child = child_1.el;
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ // create a new file in project..
+ //Xcls_DialogNewComponent.singleton().show(
+ var pe = EditProject.singleton();
+ pe.windowstate = _this.win.windowstate;
+
+ pe.el.application = _this.win.el.application;
+ pe.el.set_transient_for( _this.el );
+
+ var cb = new Project.Callback();
+ cb.call.connect((pr) => {
+ _this.show( pr , _this.new_window);
+ });
+
+ pe.show( cb);
+
+
+ });
+ }
+
+ // user defined functions
+ public void onCreated () {
+ var pe = EditProject.singleton();
+
+ _this.show( pe.result , _this.new_window);
+ }
+ }
+ public class Xcls_Box47 : Object
+ {
+ public Gtk.Box el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box47(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Image48( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Label49( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Image48 : Object
+ {
+ public Gtk.Image el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Image48(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Image();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.icon_name = "folder-new";
+ this.el.margin_end = 4;
+ this.el.icon_size = Gtk.IconSize.NORMAL;
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Label49 : Object
+ {
+ public Gtk.Label el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label49(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "New Project" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ }
+
+ // user defined functions
+ }
+
+
+
+ public class Xcls_btn_projprop : Object
+ {
+ public Gtk.Button el;
+ private DialogFiles _this;
+
- // set gobject values
- this.el.icon_name = "document-new";
- this.el.margin_end = 4;
- }
-
- // user defined functions
- }
-
- public class Xcls_Label61 : Object
- {
- public Gtk.Label el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label61(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "New File" );
+ // my vars (def)
- // my vars (dec)
+ // ctor
+ public Xcls_btn_projprop(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.btn_projprop = this;
+ this.el = new Gtk.Button();
- // set gobject values
- }
+ // my vars (dec)
- // user defined functions
- }
+ // set gobject values
+ var child_1 = new Xcls_Box51( _this );
+ this.el.child = child_1.el;
+ //listeners
+ this.el.clicked.connect( ( ) => {
+ // should disable the button really.
+ if (_this.selectedProject == null) {
+ return;
+ }
+ _this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject, null);
+ });
+ }
+ // user defined functions
+ }
+ public class Xcls_Box51 : Object
+ {
+ public Gtk.Box el;
+ private DialogFiles _this;
- public class Xcls_btn_delfile : Object
- {
- public Gtk.Button el;
- private DialogFiles _this;
-
-
- // my vars (def)
- public DialogConfirm confirm;
-
- // ctor
- public Xcls_btn_delfile(DialogFiles _owner )
- {
- _this = _owner;
- _this.btn_delfile = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
- this.confirm = null;
-
- // set gobject values
- var child_1 = new Xcls_Box63( _this );
- this.el.child = child_1.el;
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
- if (this.confirm == null) {
- this.confirm = new DialogConfirm();
- this.confirm.el.set_transient_for(_this.el);
-
- }
- GLib.debug("DELETE");
- var is_icon = true;
- var isel = _this.iconsel.selectedFile();
-
- if (isel == null) {
- GLib.debug("DELETE - no icons selected");
- is_icon = false;
- isel = _this.treeselmodel.selectedFile();
- }
- if (isel == null) {
- GLib.debug("DELETE - no tree item selected");
- return; // should nto happen..
- }
-
- GLib.debug("DELETE - calling confirm.");
- this.confirm.el.response.connect((res) => {
- this.confirm.el.hide();
- if (res == Gtk.ResponseType.CANCEL) {
- return;
- }
- is_icon = true;
- isel = _this.iconsel.selectedFile();
- if (isel == null) {
- is_icon = false;
- isel = _this.treeselmodel.selectedFile();
- }
- if (isel == null) {
- return; // should nto happen..
- }
-
- if (is_icon) {
- isel.project.deleteFile(isel);
- _this.gridmodel.remove(isel);
- return;
- }
- isel.project.deleteFile(isel);
-
- });
- this.confirm.showIt("Confirm Delete File",
- "Are you sure you want to delete this file?");
-
-
-
- });
- }
- // user defined functions
- }
- public class Xcls_Box63 : Object
- {
- public Gtk.Box el;
- private DialogFiles _this;
+ // my vars (def)
+ // ctor
+ public Xcls_Box51(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_Box63(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+ // set gobject values
+ var child_1 = new Xcls_Image52( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Label53( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Image52 : Object
+ {
+ public Gtk.Image el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Image52(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Image();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.icon_name = "emblem-system";
+ this.el.margin_end = 4;
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Label53 : Object
+ {
+ public Gtk.Label el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label53(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Project Properties" );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+
+ public class Xcls_btn_delproj : Object
+ {
+ public Gtk.Button el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+ public DialogConfirm confirm;
+
+ // ctor
+ public Xcls_btn_delproj(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.btn_delproj = this;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+ this.confirm = null;
+
+ // set gobject values
+ var child_1 = new Xcls_Box55( _this );
+ this.el.child = child_1.el;
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+
+ if (this.confirm == null) {
+ this.confirm = new DialogConfirm();
+ this.confirm.el.set_transient_for(_this.el);
+ }
+
+ var project = (Project.Project) _this.projectsort.el.get_item(
+ _this.projectselection.el.selected
+ );
+
+ this.confirm.el.response.connect((res) => {
+ this.confirm.el.hide();
+ if (res == Gtk.ResponseType.CANCEL) {
+ return;
+ }
+ project = (Project.Project) _this.projectsort.el.get_item(
+ _this.projectselection.el.selected
+ );
+ Project.Project.remove(project);
+ _this.projectmodel.remove(project);
+ _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;
+
+ });
+ this.confirm.showIt("Confirm Delete Project", "Are you sure you want to delete this project?");
+ });
+ }
- // my vars (dec)
+ // user defined functions
+ }
+ public class Xcls_Box55 : Object
+ {
+ public Gtk.Box el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box55(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Image56( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Label57( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Image56 : Object
+ {
+ public Gtk.Image el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Image56(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Image();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.icon_name = "user-trash";
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Label57 : Object
+ {
+ public Gtk.Label el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label57(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Delete Project" );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+
+ public class Xcls_btn_addfile : Object
+ {
+ public Gtk.Button el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_btn_addfile(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.btn_addfile = this;
+ this.el = new Gtk.Button();
- // set gobject values
- var child_1 = new Xcls_Image64( _this );
- child_1.ref();
- this.el.append( child_1.el );
- var child_2 = new Xcls_Label65( _this );
- child_2.ref();
- this.el.append( child_2.el );
- }
-
- // user defined functions
- }
- public class Xcls_Image64 : Object
- {
- public Gtk.Image el;
- private DialogFiles _this;
+ // my vars (dec)
+ // set gobject values
+ var child_1 = new Xcls_Box59( _this );
+ this.el.child = child_1.el;
- // my vars (def)
+ //listeners
+ this.el.clicked.connect( () => {
+ // create a new file in project..
+ print("add file selected\n");
+
+ if (_this.selectedProject == null) {
+ return;
+ }
+ try {
+ var f = JsRender.JsRender.factory(_this.selectedProject.xtype, _this.selectedProject, "");
+ _this.win.windowstate.file_details.show( f, _this.el, _this.new_window );
+ } catch (JsRender.Error e) {}
+
+ });
+ }
- // ctor
- public Xcls_Image64(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
+ // user defined functions
+ }
+ public class Xcls_Box59 : Object
+ {
+ public Gtk.Box el;
+ private DialogFiles _this;
- // my vars (dec)
-
- // set gobject values
- this.el.icon_name = "user-trash";
- }
-
- // user defined functions
- }
-
- public class Xcls_Label65 : Object
- {
- public Gtk.Label el;
- private DialogFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label65(DialogFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Delete File" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
+ // my vars (def)
+ // ctor
+ public Xcls_Box59(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+ // my vars (dec)
-}
+ // set gobject values
+ var child_1 = new Xcls_Image60( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Label61( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Image60 : Object
+ {
+ public Gtk.Image el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Image60(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Image();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.icon_name = "document-new";
+ this.el.margin_end = 4;
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Label61 : Object
+ {
+ public Gtk.Label el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label61(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "New File" );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+
+ public class Xcls_btn_delfile : Object
+ {
+ public Gtk.Button el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+ public DialogConfirm confirm;
+
+ // ctor
+ public Xcls_btn_delfile(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.btn_delfile = this;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+ this.confirm = null;
+
+ // set gobject values
+ var child_1 = new Xcls_Box63( _this );
+ this.el.child = child_1.el;
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ if (this.confirm == null) {
+ this.confirm = new DialogConfirm();
+ this.confirm.el.set_transient_for(_this.el);
+
+ }
+ GLib.debug("DELETE");
+ var is_icon = true;
+ var isel = _this.iconsel.selectedFile();
+
+ if (isel == null) {
+ GLib.debug("DELETE - no icons selected");
+ is_icon = false;
+ isel = _this.treeselmodel.selectedFile();
+ }
+ if (isel == null) {
+ GLib.debug("DELETE - no tree item selected");
+ return; // should nto happen..
+ }
+
+ GLib.debug("DELETE - calling confirm.");
+ this.confirm.el.response.connect((res) => {
+ this.confirm.el.hide();
+ if (res == Gtk.ResponseType.CANCEL) {
+ return;
+ }
+ is_icon = true;
+ isel = _this.iconsel.selectedFile();
+ if (isel == null) {
+ is_icon = false;
+ isel = _this.treeselmodel.selectedFile();
+ }
+ if (isel == null) {
+ return; // should nto happen..
+ }
+
+ if (is_icon) {
+ isel.project.deleteFile(isel);
+ _this.gridmodel.remove(isel);
+ return;
+ }
+ isel.project.deleteFile(isel);
+
+ });
+ this.confirm.showIt("Confirm Delete File",
+ "Are you sure you want to delete this file?");
+
+
+
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Box63 : Object
+ {
+ public Gtk.Box el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box63(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Image64( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Label65( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Image64 : Object
+ {
+ public Gtk.Image el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Image64(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Image();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.icon_name = "user-trash";
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Label65 : Object
+ {
+ public Gtk.Label el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label65(DialogFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Delete File" );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+
+
+ }
{
"build_module" : "builder",
- "gen_extended" : false,
"items" : [
{
"# GtkSource.SearchContext searchcontext" : "null",
"\tGtkSource.SpaceTypeFlags.ALL",
");",
"this.el.get_space_drawer().set_enable_matrix(true);",
- ""
+ "/*",
+ "Gtk.SourceDrawSpacesFlags.LEADING + ",
+ "Gtk.SourceDrawSpacesFlags.TRAILING + ",
+ "Gtk.SourceDrawSpacesFlags.TAB + ",
+ "Gtk.SourceDrawSpacesFlags.SPACE",
+ "*/"
],
"* prop" : "child",
"bool has_tooltip" : true,
"$ Gee.HashMap<int,string>? xmarks" : "null",
"$ xns" : "GtkSource",
"$ xtype" : "Buffer",
- "* init" : [
- "{",
- "\tvar buf = this.el;",
- "\tbuf.create_tag (\"bold\", \"weight\", Pango.Weight.BOLD);",
- " buf.create_tag (\"type\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#204a87\");",
- " buf.create_tag (\"keyword\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#a40000\");",
- " buf.create_tag (\"text\", \"weight\", Pango.Weight.NORMAL, \"foreground\", \"#729fcf\");",
- " buf.create_tag (\"number\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#ad7fa8\");",
- " buf.create_tag (\"method\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#729fcf\");",
- " buf.create_tag (\"property\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#BC1F51\");",
- " buf.create_tag (\"variable\", \"weight\", Pango.Weight.BOLD, \"foreground\", \"#A518B5\");",
- "",
- "}",
- ""
- ],
"* prop" : "buffer",
"bool check_queued" : false,
"bool enable_undo" : true,
- "bool highlight_matching_brackets" : true,
- "bool highlight_syntax" : true,
"id" : "buffer",
"int error_line" : "-1",
"listeners" : {
" var oldcode =_this.file.toSource();",
" _this.file.setSource(str);",
" _this.file.getLanguageServer().document_change(_this.file);",
- "\t BuilderApplication.showSpinner(\"appointment soon\",\"document change pending\");",
" _this.file.setSource(oldcode);",
" ",
"\t\t ",
"\tvar oldcode = _this.prop.val;",
"\t",
"\t_this.prop.val = str;",
- "\t_this.node.updated_count++;",
" _this.file.getLanguageServer().document_change(_this.file);",
- " _this.node.updated_count++;",
" _this.prop.val = oldcode;",
" ",
" ",
"\tif (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
"\t GLib.debug(\"SAVE: ctrl-f pressed\");",
"\t\t_this.search_entry.el.grab_focus();",
- "\t\t_this.search_entry.el.select_region(0,-1);",
"\t return;",
"\t}",
- "\tif (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
- "\t\t_this.view.el.show_completion();",
- "\t}",
- "\t",
- "\tGtk.TextIter iter;",
- "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position); ",
- "\tvar line = iter.get_line();",
- "\tvar offset = iter.get_line_offset();",
- "\tGLib.debug(\"line %d off %d\", line ,offset);",
- "\tif (_this.prop != null) {",
- "\t\tline += _this.prop.start_line + 1; // i think..",
- "\t\toffset += 12; // should probably be 8 without namespaced ",
- "\t\tGLib.debug(\"guess line %d off %d\", line ,offset);",
- "\t} ",
" //_this.view.el.show_completion();",
" // print(event.key.keyval)",
- " ",
- " ",
- " ",
" ",
" return;",
" ",
"}",
""
],
- "| string tempFileContents" : [
- "() {",
- " ",
- " ",
- " if (_this.file == null) {",
- " return \"\";",
- " }",
- "\tvar str= this.buffer.toString();",
- "\tif (_this.file.xtype == \"PlainFile\") {",
- " ",
- " \treturn str;",
- " ",
- " }",
- " ",
- " ",
- " ",
- " GLib.debug(\"calling validate\"); ",
- " // clear the buttons.",
- " \tif (_this.prop.name == \"xns\" || _this.prop.name == \"xtype\") {",
- "\t\treturn this.file.toSource(); ;",
- "\t}",
- "\t",
- "\tvar oldcode = _this.prop.val;",
- "\t_this.prop.val = str;",
- " var ret = _this.file.toSource();",
- " _this.prop.val = oldcode;",
- " return ret;",
- " ",
- "}"
- ],
"| void backSearch" : [
"(bool change_focus) {",
"",
"\tif (this.searchcontext == null) {",
"\t\treturn;",
"\t} ",
- "",
+ "\t",
"\tGtk.TextIter beg, st,en;",
"\t bool has_wrapped_around;",
"\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
"",
"\tbuf.remove_source_marks (start, end, category);",
" ",
- "\t//GLib.debug(\"highlight errors\");\t\t ",
+ "\tGLib.debug(\"highlight errors\");\t\t ",
"",
"\t // we should highlight other types of errors..",
"",
"\t\t&&",
"\t\t_this.window.windowstate.state != WindowState.State.CODE",
"\t\t) {",
- "\t\t//GLib.debug(\"windowstate != CODEONLY?\");",
+ "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
"\t\t",
"\t\treturn;",
"\t} ",
"\t}",
"\tvar ar = this.file.getErrors(category);",
"\tif (ar == null || ar.get_n_items() < 1) {",
- "\t\t//GLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
+ "\t\tGLib.debug(\"highlight %s : %s has no errors\", this.file.relpath, category);",
"\t\treturn;",
"\t}",
" ",
"\tvar tlines = buf.get_line_count () +1;",
"\t",
"\tif (_this.prop != null) {",
- "\t\t// this still seems flaky...",
- "\t\t",
- "\t\ttlines = _this.prop.end_line;",
- "\t\toffset = _this.prop.start_line;",
- "\t\t ",
+ "\t",
+ "\t\ttlines = _this.prop.end_line + 1;",
+ "\t\toffset = _this.prop.start_line + 1;",
+ "\t",
"\t}",
"\t ",
"\tfor (var i = 0; i < ar.get_n_items();i++) {",
"\t Gtk.TextIter iter;",
"// print(\"get inter\\n\");",
"\t var eline = err.line - offset;",
- "\t //GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
- "\t //\terr.line ,eline, offset);",
+ "\t GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
+ "\t \terr.line ,eline, offset);",
"\t ",
"\t ",
"\t if (eline > tlines || eline < 0) {",
"\t ",
"\t\tvar msg = \"Line: %d %s : %s\".printf(eline+1, err.category, err.msg);",
"\t buf.create_source_mark( msg, err.category, iter);",
- "\t // GLib.debug(\"set line %d to %s\", eline, msg);",
+ "\t GLib.debug(\"set line %d to %s\", eline, msg);",
"\t //this.marks.set(eline, msg);",
"\t}",
"\treturn ;",
]
}
],
- "name" : "Editor"
+ "modOrder" : "",
+ "name" : "Editor",
+ "parent" : "",
+ "path" : "/home/alan/gitlive/roobuilder/src/Builder4/Editor.bjs",
+ "permname" : "",
+ "title" : ""
}
\ No newline at end of file
public class Editor : Object
{
- public Gtk.Box el;
- private Editor _this;
-
- public static Editor singleton()
- {
- if (_Editor == null) {
- _Editor= new Editor();
- }
- return _Editor;
- }
- public Xcls_save_button save_button;
- public Xcls_close_btn close_btn;
- public Xcls_RightEditor RightEditor;
- public Xcls_view view;
- public Xcls_buffer buffer;
- public Xcls_search_entry search_entry;
- public Xcls_search_results search_results;
- public Xcls_nextBtn nextBtn;
- public Xcls_backBtn backBtn;
- public Xcls_search_settings search_settings;
- public Xcls_case_sensitive case_sensitive;
- public Xcls_regex regex;
- public Xcls_multiline multiline;
-
- // my vars (def)
- public int pos_root_x;
- public Xcls_MainWindow window;
- public bool dirty;
- public int pos_root_y;
- public bool pos;
- public GtkSource.SearchContext searchcontext;
- public int last_search_end;
- public signal void save ();
- public JsRender.JsRender? file;
- public JsRender.Node node;
- public JsRender.NodeProp? prop;
- public string activeEditor;
-
- // ctor
- public Editor()
- {
- _this = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
- this.window = null;
- this.dirty = false;
- this.pos = false;
- this.searchcontext = null;
- this.last_search_end = 0;
- this.file = null;
- this.node = null;
- this.prop = null;
- this.activeEditor = "";
-
- // set gobject values
- this.el.homogeneous = false;
- this.el.hexpand = true;
- this.el.vexpand = true;
- var child_1 = new Xcls_Box2( _this );
- child_1.ref();
- this.el.append( child_1.el );
- new Xcls_RightEditor( _this );
- this.el.append( _this.RightEditor.el );
- var child_3 = new Xcls_Box12( _this );
- child_3.ref();
- this.el.append ( child_3.el );
- }
-
- // user defined functions
- public bool saveContents () {
-
-
- if (_this.file == null) {
- return true;
- }
-
-
-
- var str = _this.buffer.toString();
-
- _this.buffer.checkSyntax();
-
-
-
- // LeftPanel.model.changed( str , false);
- _this.dirty = false;
- _this.save_button.el.sensitive = false;
-
- // find the text for the node..
- if (_this.file.xtype != "PlainFile") {
- // in theory these properties have to exist!?!
- this.prop.val = str;
- //this.window.windowstate.left_props.reload();
- } else {
- _this.file.setSource( str );
- }
-
- // call the signal..
- this.save();
-
- return true;
-
- }
- public void forwardSearch (bool change_focus) {
-
- if (this.searchcontext == null) {
- return;
- }
-
- Gtk.TextIter beg, st,en;
- bool has_wrapped_around;
- this.buffer.el.get_iter_at_offset(out beg, this.last_search_end);
- if (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {
-
- this.last_search_end = 0; // not sure if this should happen
- } else {
- if (has_wrapped_around) {
- return;
- }
-
- this.last_search_end = en.get_offset();
- if (change_focus) {
- this.view.el.grab_focus();
- }
- this.buffer.el.place_cursor(st);
- this.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);
- }
-
- }
- public void show (JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)
- {
- this.reset();
- this.file = file;
-
- if (file.xtype != "PlainFile") {
- this.prop = prop;
- this.node = node;
-
- // find the text for the node..
- this.view.load( prop.val );
-
-
- this.close_btn.el.show();
-
- } else {
- this.view.load( file.toSource() );
- this.close_btn.el.hide();
- }
-
- }
- public void backSearch (bool change_focus) {
-
- if (this.searchcontext == null) {
- return;
- }
-
- Gtk.TextIter beg, st,en;
- bool has_wrapped_around;
- this.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );
-
- if (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {
- this.last_search_end = 0;
- } else {
- this.last_search_end = en.get_offset();
- if (change_focus) {
- this.view.el.grab_focus();
- }
- this.buffer.el.place_cursor(st);
- this.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);
- }
-
- }
- public string tempFileContents () {
-
-
- if (_this.file == null) {
- return "";
- }
- var str= this.buffer.toString();
- if (_this.file.xtype == "PlainFile") {
-
- return str;
-
- }
-
-
-
- GLib.debug("calling validate");
- // clear the buttons.
- if (_this.prop.name == "xns" || _this.prop.name == "xtype") {
- return this.file.toSource(); ;
- }
-
- var oldcode = _this.prop.val;
- _this.prop.val = str;
- var ret = _this.file.toSource();
- _this.prop.val = oldcode;
- return ret;
-
- }
- public void reset () {
- this.file = null;
-
- this.node = null;
- this.prop = null;
- this.searchcontext = null;
-
- }
- public int search (string in_txt) {
-
- var s = new GtkSource.SearchSettings();
- s.case_sensitive = _this.case_sensitive.el.active;
- s.regex_enabled = _this.regex.el.active;
- s.wrap_around = false;
-
- this.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);
- this.searchcontext.set_highlight(true);
- var txt = in_txt;
-
- if (_this.multiline.el.active) {
- txt = in_txt.replace("\\n", "\n");
- }
-
- s.set_search_text(txt);
- Gtk.TextIter beg, st,en;
-
- this.buffer.el.get_start_iter(out beg);
- bool has_wrapped_around;
- this.searchcontext.forward(beg, out st, out en, out has_wrapped_around);
- this.last_search_end = 0;
-
- return this.searchcontext.get_occurrences_count();
-
-
-
-
- }
- public void updateErrorMarks (string category) {
-
-
-
- var buf = _this.buffer.el;
- Gtk.TextIter start;
- Gtk.TextIter end;
- buf.get_bounds (out start, out end);
-
- buf.remove_source_marks (start, end, category);
-
- //GLib.debug("highlight errors");
-
- // we should highlight other types of errors..
-
- if (_this.window.windowstate.state != WindowState.State.CODEONLY
- &&
- _this.window.windowstate.state != WindowState.State.CODE
- ) {
- //GLib.debug("windowstate != CODEONLY?");
-
- return;
- }
-
-
- if (_this.file == null) {
- GLib.debug("file is null?");
- return;
-
- }
- var ar = this.file.getErrors(category);
- if (ar == null || ar.get_n_items() < 1) {
- //GLib.debug("highlight %s : %s has no errors", this.file.relpath, category);
- return;
- }
-
-
-
-
- var offset = 0;
-
-
- var tlines = buf.get_line_count () +1;
-
- if (_this.prop != null) {
- // this still seems flaky...
-
- tlines = _this.prop.end_line;
- offset = _this.prop.start_line;
-
- }
-
- for (var i = 0; i < ar.get_n_items();i++) {
- var err = (Palete.CompileError) ar.get_item(i);
-
- Gtk.TextIter iter;
- // print("get inter\n");
- var eline = err.line - offset;
- //GLib.debug("GOT ERROR on line %d -- converted to %d (offset = %d)",
- // err.line ,eline, offset);
-
-
- if (eline > tlines || eline < 0) {
- return;
- }
-
-
- buf.get_iter_at_line( out iter, eline);
-
-
- var msg = "Line: %d %s : %s".printf(eline+1, err.category, err.msg);
- buf.create_source_mark( msg, err.category, iter);
- // GLib.debug("set line %d to %s", eline, msg);
- //this.marks.set(eline, msg);
- }
- return ;
-
-
-
-
-
- }
- public void scroll_to_line (int line) {
-
- GLib.Timeout.add(500, () => {
-
- var buf = this.view.el.get_buffer();
-
- var sbuf = (GtkSource.Buffer) buf;
-
-
- Gtk.TextIter iter;
- sbuf.get_iter_at_line(out iter, line);
- this.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
- return false;
- });
- }
- public class Xcls_Box2 : Object
- {
- public Gtk.Box el;
- private Editor _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box2(Editor _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- this.el.hexpand = true;
- new Xcls_save_button( _this );
- this.el.append( _this.save_button.el );
- var child_2 = new Xcls_Label4( _this );
- child_2.ref();
- this.el.append( child_2.el );
- var child_3 = new Xcls_Scale5( _this );
- child_3.ref();
- this.el.append( child_3.el );
- new Xcls_close_btn( _this );
- this.el.append( _this.close_btn.el );
- }
-
- // user defined functions
- }
- public class Xcls_save_button : Object
- {
- public Gtk.Button el;
- private Editor _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_save_button(Editor _owner )
- {
- _this = _owner;
- _this.save_button = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Save";
-
- //listeners
- this.el.clicked.connect( () => {
- _this.saveContents();
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Label4 : Object
- {
- public Gtk.Label el;
- private Editor _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label4(Editor _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( null );
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_Scale5 : Object
- {
- public Gtk.Scale el;
- private Editor _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Scale5(Editor _owner )
- {
- _this = _owner;
- this.el = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1);
+ public Gtk.Box el;
+ private Editor _this;
+
+ public static Editor singleton()
+ {
+ if (_Editor == null) {
+ _Editor= new Editor();
+ }
+ return _Editor;
+ }
+ public Xcls_save_button save_button;
+ public Xcls_close_btn close_btn;
+ public Xcls_RightEditor RightEditor;
+ public Xcls_view view;
+ public Xcls_buffer buffer;
+ public Xcls_search_entry search_entry;
+ public Xcls_search_results search_results;
+ public Xcls_nextBtn nextBtn;
+ public Xcls_backBtn backBtn;
+ public Xcls_search_settings search_settings;
+ public Xcls_case_sensitive case_sensitive;
+ public Xcls_regex regex;
+ public Xcls_multiline multiline;
+
+ // my vars (def)
+ public int pos_root_x;
+ public Xcls_MainWindow window;
+ public bool dirty;
+ public int pos_root_y;
+ public bool pos;
+ public GtkSource.SearchContext searchcontext;
+ public int last_search_end;
+ public signal void save ();
+ public JsRender.JsRender? file;
+ public JsRender.Node node;
+ public JsRender.NodeProp? prop;
+ public string activeEditor;
+
+ // ctor
+ public Editor()
+ {
+ _this = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+ this.window = null;
+ this.dirty = false;
+ this.pos = false;
+ this.searchcontext = null;
+ this.last_search_end = 0;
+ this.file = null;
+ this.node = null;
+ this.prop = null;
+ this.activeEditor = "";
+
+ // set gobject values
+ this.el.homogeneous = false;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ var child_1 = new Xcls_Box2( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_RightEditor( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ var child_3 = new Xcls_Box12( _this );
+ child_3.ref();
+ this.el.append ( child_3.el );
+ }
+
+ // user defined functions
+ public bool saveContents () {
+
+
+ if (_this.file == null) {
+ return true;
+ }
+
+
+
+ var str = _this.buffer.toString();
+
+ _this.buffer.checkSyntax();
+
+
+
+ // LeftPanel.model.changed( str , false);
+ _this.dirty = false;
+ _this.save_button.el.sensitive = false;
+
+ // find the text for the node..
+ if (_this.file.xtype != "PlainFile") {
+ // in theory these properties have to exist!?!
+ this.prop.val = str;
+ //this.window.windowstate.left_props.reload();
+ } else {
+ _this.file.setSource( str );
+ }
+
+ // call the signal..
+ this.save();
+
+ return true;
+
+ }
+ public void forwardSearch (bool change_focus) {
+
+ if (this.searchcontext == null) {
+ return;
+ }
+
+ Gtk.TextIter beg, st,en;
+ bool has_wrapped_around;
+ this.buffer.el.get_iter_at_offset(out beg, this.last_search_end);
+ if (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {
+
+ this.last_search_end = 0; // not sure if this should happen
+ } else {
+ if (has_wrapped_around) {
+ return;
+ }
+
+ this.last_search_end = en.get_offset();
+ if (change_focus) {
+ this.view.el.grab_focus();
+ }
+ this.buffer.el.place_cursor(st);
+ this.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);
+ }
+
+ }
+ public void show (JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)
+ {
+ this.reset();
+ this.file = file;
+
+ if (file.xtype != "PlainFile") {
+ this.prop = prop;
+ this.node = node;
+
+ // find the text for the node..
+ this.view.load( prop.val );
+
+
+ this.close_btn.el.show();
+
+ } else {
+ this.view.load( file.toSource() );
+ this.close_btn.el.hide();
+ }
+
+ }
+ public void backSearch (bool change_focus) {
+
+ if (this.searchcontext == null) {
+ return;
+ }
+
+ Gtk.TextIter beg, st,en;
+ bool has_wrapped_around;
+ this.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );
+
+ if (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {
+ this.last_search_end = 0;
+ } else {
+ this.last_search_end = en.get_offset();
+ if (change_focus) {
+ this.view.el.grab_focus();
+ }
+ this.buffer.el.place_cursor(st);
+ this.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);
+ }
+
+ }
+ public void reset () {
+ this.file = null;
+
+ this.node = null;
+ this.prop = null;
+ this.searchcontext = null;
+
+ }
+ public int search (string in_txt) {
+
+ var s = new GtkSource.SearchSettings();
+ s.case_sensitive = _this.case_sensitive.el.active;
+ s.regex_enabled = _this.regex.el.active;
+ s.wrap_around = false;
+
+ this.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);
+ this.searchcontext.set_highlight(true);
+ var txt = in_txt;
+
+ if (_this.multiline.el.active) {
+ txt = in_txt.replace("\\n", "\n");
+ }
+
+ s.set_search_text(txt);
+ Gtk.TextIter beg, st,en;
+
+ this.buffer.el.get_start_iter(out beg);
+ bool has_wrapped_around;
+ this.searchcontext.forward(beg, out st, out en, out has_wrapped_around);
+ this.last_search_end = 0;
+
+ return this.searchcontext.get_occurrences_count();
+
+
+
+
+ }
+ public void updateErrorMarks (string category) {
+
+
+
+ var buf = _this.buffer.el;
+ Gtk.TextIter start;
+ Gtk.TextIter end;
+ buf.get_bounds (out start, out end);
+
+ buf.remove_source_marks (start, end, category);
+
+ GLib.debug("highlight errors");
+
+ // we should highlight other types of errors..
+
+ if (_this.window.windowstate.state != WindowState.State.CODEONLY
+ &&
+ _this.window.windowstate.state != WindowState.State.CODE
+ ) {
+ GLib.debug("windowstate != CODEONLY?");
+
+ return;
+ }
+
+
+ if (_this.file == null) {
+ GLib.debug("file is null?");
+ return;
+
+ }
+ var ar = this.file.getErrors(category);
+ if (ar == null || ar.get_n_items() < 1) {
+ GLib.debug("highlight %s : %s has no errors", this.file.relpath, category);
+ return;
+ }
+
+
+
+
+ var offset = 0;
+
+
+ var tlines = buf.get_line_count () +1;
+
+ if (_this.prop != null) {
+
+ tlines = _this.prop.end_line + 1;
+ offset = _this.prop.start_line + 1;
+
+ }
+
+ for (var i = 0; i < ar.get_n_items();i++) {
+ var err = (Palete.CompileError) ar.get_item(i);
+
+ Gtk.TextIter iter;
+ // print("get inter\n");
+ var eline = err.line - offset;
+ GLib.debug("GOT ERROR on line %d -- converted to %d (offset = %d)",
+ err.line ,eline, offset);
+
+
+ if (eline > tlines || eline < 0) {
+ return;
+ }
+
+
+ buf.get_iter_at_line( out iter, eline);
+
+
+ var msg = "Line: %d %s : %s".printf(eline+1, err.category, err.msg);
+ buf.create_source_mark( msg, err.category, iter);
+ GLib.debug("set line %d to %s", eline, msg);
+ //this.marks.set(eline, msg);
+ }
+ return ;
+
+
+
+
+
+ }
+ public void scroll_to_line (int line) {
+
+ GLib.Timeout.add(500, () => {
+
+ var buf = this.view.el.get_buffer();
+
+ var sbuf = (GtkSource.Buffer) buf;
+
+
+ Gtk.TextIter iter;
+ sbuf.get_iter_at_line(out iter, line);
+ this.view.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
+ return false;
+ });
+ }
+ public class Xcls_Box2 : Object
+ {
+ public Gtk.Box el;
+ private Editor _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box2(Editor _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.homogeneous = false;
+ this.el.hexpand = true;
+ var child_1 = new Xcls_save_button( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Label4( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ var child_3 = new Xcls_Scale5( _this );
+ child_3.ref();
+ this.el.append( child_3.el );
+ var child_4 = new Xcls_close_btn( _this );
+ child_4.ref();
+ this.el.append( child_4.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_save_button : Object
+ {
+ public Gtk.Button el;
+ private Editor _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_save_button(Editor _owner )
+ {
+ _this = _owner;
+ _this.save_button = this;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "Save";
+
+ //listeners
+ this.el.clicked.connect( () => {
+ _this.saveContents();
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Label4 : Object
+ {
+ public Gtk.Label el;
+ private Editor _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label4(Editor _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( null );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Scale5 : Object
+ {
+ public Gtk.Scale el;
+ private Editor _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Scale5(Editor _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1);
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.width_request = 200;
- this.el.has_origin = true;
- this.el.draw_value = false;
- this.el.digits = 0;
- this.el.sensitive = true;
+ // set gobject values
+ this.el.width_request = 200;
+ this.el.has_origin = true;
+ this.el.draw_value = false;
+ this.el.digits = 0;
+ this.el.sensitive = true;
+
+ // init method
+
+ {
+ this.el.set_range(6,30);
+ this.el.set_value(8);
+ }
+
+ //listeners
+ this.el.change_value.connect( (st, val ) => {
+
+
+ _this.view.css.load_from_string(
+ "#editor-view { font: %dpx monospace; }".printf((int)val)
+ );
+
+ return false;
+ });
+ }
- // init method
-
- {
- this.el.set_range(6,30);
- this.el.set_value(8);
- }
-
- //listeners
- this.el.change_value.connect( (st, val ) => {
-
-
- _this.view.css.load_from_string(
- "#editor-view { font: %dpx monospace; }".printf((int)val)
- );
-
- return false;
- });
- }
+ // user defined functions
+ }
- // user defined functions
- }
+ public class Xcls_close_btn : Object
+ {
+ public Gtk.Button el;
+ private Editor _this;
- public class Xcls_close_btn : Object
- {
- public Gtk.Button el;
- private Editor _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_close_btn(Editor _owner )
+ {
+ _this = _owner;
+ _this.close_btn = this;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.icon_name = "window-close";
+ var child_1 = new Xcls_Image7( _this );
+ child_1.ref();
+ this.el.child = child_1.el;
+
+ //listeners
+ this.el.clicked.connect( () => {
+ _this.saveContents();
+ _this.window.windowstate.switchState(WindowState.State.PREVIEW);
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Image7 : Object
+ {
+ public Gtk.Image el;
+ private Editor _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Image7(Editor _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Image();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.icon_name = "window-close";
+ this.el.icon_size = Gtk.IconSize.NORMAL;
+ }
+
+ // user defined functions
+ }
+
+
+
+ public class Xcls_RightEditor : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private Editor _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_RightEditor(Editor _owner )
+ {
+ _this = _owner;
+ _this.RightEditor = this;
+ this.el = new Gtk.ScrolledWindow();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
+ this.el.vexpand = true;
+ this.el.overlay_scrolling = false;
+ this.el.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
+ var child_1 = new Xcls_view( _this );
+ child_1.ref();
+ this.el.child = child_1.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_view : Object
+ {
+ public GtkSource.View el;
+ private Editor _this;
+
+
+ // my vars (def)
+ public Gtk.CssProvider css;
+
+ // ctor
+ public Xcls_view(Editor _owner )
+ {
+ _this = _owner;
+ _this.view = this;
+ this.el = new GtkSource.View();
+
+ // my vars (dec)
+ this.css = null;
+
+ // set gobject values
+ this.el.auto_indent = true;
+ this.el.indent_width = 4;
+ this.el.name = "editor-view";
+ this.el.show_line_marks = true;
+ this.el.insert_spaces_instead_of_tabs = true;
+ this.el.show_line_numbers = true;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ this.el.has_tooltip = true;
+ this.el.tab_width = 4;
+ this.el.highlight_current_line = true;
+ var child_1 = new Xcls_buffer( _this );
+ child_1.ref();
+ this.el.buffer = child_1.el;
+ var child_2 = new Xcls_EventControllerKey11( _this );
+ child_2.ref();
+ this.el.add_controller( child_2.el );
+
+ // init method
+
+ this.css = new Gtk.CssProvider();
+
+ this.css.load_from_string(
+ "#editor-view { font: 12px monospace;}"
+ );
+
+ Gtk.StyleContext.add_provider_for_display(
+ this.el.get_display(),
+ this.css,
+ Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
+ );
+
+
+
+ /*
+ this is pretty flakey - triggers Gtk with < 0 d
+ var cp = new GtkSource.CompletionWords("test");
+ cp.minimum_word_size = 3;
+ //cp.priority = 100; //?? does this do anything
+ cp.proposals_batch_size = 10;
+ cp.scan_batch_size = 1000;
+
+ cp.register(_this.buffer.el);
+ this.el.completion.add_provider(cp);
+ */
+ this.el.completion.add_provider(new Palete.CompletionProvider(_this));
+
+ //this.el.completion.unblock_interactive();
+ this.el.completion.select_on_show = true; // select
+ //this.el.completion.remember_info_visibility = true;
+
+
+ var attrs = new GtkSource.MarkAttributes();
+ var pink = Gdk.RGBA();
+ pink.parse ( "pink");
+ attrs.set_background ( pink);
+ attrs.set_icon_name ( "process-stop");
+ attrs.query_tooltip_text.connect(( mark) => {
+ GLib.debug("tooltip query? %s", mark.name);
+ return strdup( mark.name);
+ });
+ attrs.query_tooltip_markup.connect(( mark) => {
+ GLib.debug("tooltip query? %s", mark.name);
+ return strdup( mark.name);
+ });
+ this.el.set_mark_attributes ("ERR", attrs, 1);
+ attrs.ref();
+ var wattrs = new GtkSource.MarkAttributes();
+ var blue = Gdk.RGBA();
+ blue.parse ( "#ABF4EB");
+ wattrs.set_background ( blue);
+ wattrs.set_icon_name ( "process-stop");
+ wattrs.query_tooltip_text.connect(( mark) => {
+ GLib.debug("tooltip query? %s", mark.name);
+ return strdup(mark.name);
+ });
+ wattrs.query_tooltip_markup.connect(( mark) => {
+ GLib.debug("tooltip query? %s", mark.name);
+ return strdup(mark.name);
+ });
+ this.el.set_mark_attributes ("WARN", wattrs, 1);
+ wattrs.ref();
+
+
+ var dattrs = new GtkSource.MarkAttributes();
+ var purple = Gdk.RGBA();
+ purple.parse ( "#EEA9FF");
+ dattrs.set_background ( purple);
+ dattrs.set_icon_name ( "process-stop");
+ dattrs.query_tooltip_text.connect(( mark) => {
+ GLib.debug("tooltip query? %s", mark.name);
+ return strdup(mark.name);
+ });
+ dattrs.query_tooltip_markup.connect(( mark) => {
+ GLib.debug("tooltip query? %s", mark.name);
+ return strdup(mark.name);
+ });
+ this.el.set_mark_attributes ("DEPR", dattrs, 1);
+ dattrs.ref();
+
+ this.el.get_space_drawer().set_matrix(null);
+ this.el.get_space_drawer().set_types_for_locations(
+ GtkSource.SpaceLocationFlags.ALL,
+ GtkSource.SpaceTypeFlags.ALL
+ );
+ this.el.get_space_drawer().set_enable_matrix(true);
+ /*
+ Gtk.SourceDrawSpacesFlags.LEADING +
+ Gtk.SourceDrawSpacesFlags.TRAILING +
+ Gtk.SourceDrawSpacesFlags.TAB +
+ Gtk.SourceDrawSpacesFlags.SPACE
+ */
+
+ //listeners
+ this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
+
+ //GLib.debug("query tooltip");
+ Gtk.TextIter iter;
+ int trailing;
+
+ var yoff = (int) _this.RightEditor.el.vadjustment.value;
+
+ // I think this is problematic - if it's compliing / updating at same time as query.
+
+ //if (_this.window.statusbar_compile_spinner.el.spinning) {
+ // return false;
+ //}
+
+ this.el.get_iter_at_position (out iter, out trailing, x, y + yoff);
+
+ var l = iter.get_line();
+
+
+
+ // GLib.debug("query tooltip line %d", (int) l);
+ if (l < 0) {
+
+ return false;
+ }
+ /*
+ if (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {
+ GLib.debug("line %d setting tip to %s", l, _this.buffer.marks.get(l));
+ tooltip.set_text(_this.buffer.marks.get(l).dup());
+ return true;
+ }
+
+ return false;
+ */
+
+
+ // this crashes?? - not sure why.
+ var marks = _this.buffer.el.get_source_marks_at_line(l, "ERR");
+ if (marks.is_empty()) {
+ marks = _this.buffer.el.get_source_marks_at_line(l, "WARN");
+ }
+ if (marks.is_empty()) {
+ marks = _this.buffer.el.get_source_marks_at_line(l, "DEPR");
+ }
+
+ // GLib.debug("query tooltip line %d marks %d", (int)l, (int) marks.length());
+ var str = "";
+ marks.@foreach((m) => {
+ //GLib.debug("got mark %s", m.name);
+ str += (str.length > 0 ? "\n" : "") + m.category + ": " + m.name;
+ });
+ // true if there is a mark..
+ if (str.length > 0 ) {
+ tooltip.set_text( str );
+ }
+ return str.length > 0 ? true : false;
+
+ });
+ }
+
+ // user defined functions
+ public void load (string str) {
+
+ // show the help page for the active node..
+ //this.get('/Help').show();
+
+ // this.get('/BottomPane').el.set_current_page(0);
+ GLib.debug("load called - Reset undo buffer");
+
+ var buf = (GtkSource.Buffer)this.el.get_buffer();
+ buf.begin_irreversible_action();
+ buf.set_text(str, str.length);
+ buf.end_irreversible_action();
+
+ var lm = GtkSource.LanguageManager.get_default();
+ var lang = "vala";
+ if (_this.file != null) {
+ lang = _this.file.language;
+ }
+ print("lang=%s, content_type = %s\n", lang, _this.file.content_type);
+ var lg = _this.file.content_type.length > 0 ?
+ lm.guess_language(_this.file.path, _this.file.content_type) :
+ lm.get_language(lang);
+
+
+ ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg);
+
+ this.el.insert_spaces_instead_of_tabs = true;
+ if (lg != null) {
+ print("sourcelanguage = %s\n", lg.name);
+ if (lg.name == "Vala") {
+ this.el.insert_spaces_instead_of_tabs = false;
+ }
+ }
+ _this.dirty = false;
+ this.el.grab_focus();
+ _this.save_button.el.sensitive = false;
+ }
+ }
+ public class Xcls_buffer : Object
+ {
+ public GtkSource.Buffer el;
+ private Editor _this;
+
+
+ // my vars (def)
+ public int error_line;
+ public Gee.HashMap<int,string>? xmarks;
+ public bool check_queued;
+
+ // ctor
+ public Xcls_buffer(Editor _owner )
+ {
+ _this = _owner;
+ _this.buffer = this;
+ this.el = new GtkSource.Buffer( null );
+
+ // my vars (dec)
+ this.error_line = -1;
+ this.xmarks = null;
+ this.check_queued = false;
+
+ // set gobject values
+ this.el.enable_undo = true;
+
+ //listeners
+ this.el.changed.connect( () => {
+ // check syntax??
+ // ??needed..??
+ _this.save_button.el.sensitive = true;
+ print("EDITOR CHANGED");
+ this.checkSyntax();
+
+ _this.dirty = true;
+
+ // this.get('/LeftPanel.model').changed( str , false);
+ return ;
+ });
+ }
+
+ // user defined functions
+ public bool checkSyntax () {
+
+
+ var str = this.toString();
+
+ // needed???
+ if (this.error_line > 0) {
+ Gtk.TextIter start;
+ Gtk.TextIter end;
+ this.el.get_bounds (out start, out end);
+
+ this.el.remove_source_marks (start, end, null);
+ }
+ if (str.length < 1) {
+ print("checkSyntax - empty string?\n");
+ return true;
+ }
+
+ // bit presumptiona
+ if (_this.file.xtype == "PlainFile") {
+
+ // assume it's gtk...
+ var oldcode =_this.file.toSource();
+ _this.file.setSource(str);
+ _this.file.getLanguageServer().document_change(_this.file);
+ _this.file.setSource(oldcode);
+
+
+ return true;
+
+ }
+ if (_this.file == null) {
+ return true;
+ }
+
+
+
+
+
+ GLib.debug("calling validate");
+ // clear the buttons.
+ if (_this.prop.name == "xns" || _this.prop.name == "xtype") {
+ return true ;
+ }
+ var oldcode = _this.prop.val;
+
+ _this.prop.val = str;
+ _this.file.getLanguageServer().document_change(_this.file);
+ _this.prop.val = oldcode;
+
+
+ //print("done mark line\n");
+
+ return true; // at present allow saving - even if it's invalid..
+ }
+ public bool highlightErrorsJson (string type, Json.Object obj) {
+ Gtk.TextIter start;
+ Gtk.TextIter end;
+ this.el.get_bounds (out start, out end);
+
+ this.el.remove_source_marks (start, end, type);
+ GLib.debug("highlight errors");
+
+ // we should highlight other types of errors..
+
+ if (!obj.has_member(type)) {
+ GLib.debug("Return has no errors\n");
+ return true;
+ }
+
+ if (_this.window.windowstate.state != WindowState.State.CODEONLY
+ &&
+ _this.window.windowstate.state != WindowState.State.CODE
+ ) {
+ GLib.debug("windowstate != CODEONLY?");
+
+ return true;
+ }
+
+ //this.marks = new Gee.HashMap<int,string>();
+ var err = obj.get_object_member(type);
+
+ if (_this.file == null) {
+ GLib.debug("file is null?");
+ return true;
+
+ }
+ var valafn = _this.file.path;
+
+ if (_this.file.xtype != "PlainFile") {
+
+ valafn = "";
+ try {
+ var regex = new Regex("\\.bjs$");
+ // should not happen
+ valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
+ } catch (GLib.RegexError e) {
+ return true;
+ }
+
+
+
+ }
+ if (!err.has_member(valafn)) {
+ GLib.debug("File path has no errors");
+ return true;
+ }
+
+ var lines = err.get_object_member(valafn);
+
+ var offset = 1;
+ if (obj.has_member("line_offset")) { // ?? why??
+ offset = (int)obj.get_int_member("line_offset") + 1;
+ }
+
+
+ var tlines = this.el.get_line_count () +1;
+
+ if (_this.prop != null) {
+
+ tlines = _this.prop.end_line + 1;
+ offset = _this.prop.start_line + 1;
+
+ }
+
+
+
+ lines.foreach_member((obj, line, node) => {
+
+ Gtk.TextIter iter;
+ // print("get inter\n");
+ var eline = int.parse(line) - offset;
+ GLib.debug("GOT ERROR on line %s -- converted to %d (offset = %d)\n", line,eline, offset);
+
+
+ if (eline > tlines || eline < 0) {
+ return;
+ }
+
+
+ this.el.get_iter_at_line( out iter, eline);
+ //print("mark line\n");
+ var msg = "";
+ var ar = lines.get_array_member(line);
+ for (var i = 0 ; i < ar.get_length(); i++) {
+ if (ar.get_string_element(i) == "Success") {
+ continue;
+ }
+ msg += (msg.length > 0) ? "\n" : "";
+ msg += ar.get_string_element(i);
+ }
+ if (msg == "") {
+ return;
+ }
+ msg = "Line: %d".printf(eline+1) + " " + msg;
+ this.el.create_source_mark(msg, type, iter);
+ GLib.debug("set line %d to %m", eline, msg);
+ // this.marks.set(eline, msg);
+ } );
+ return false;
+
+
+
+
+
+ }
+ public bool highlightErrors ( Gee.HashMap<int,string> validate_res) {
+
+ this.error_line = validate_res.size;
+
+ if (this.error_line < 1) {
+ return true;
+ }
+ var tlines = this.el.get_line_count ();
+ Gtk.TextIter iter;
+ var valiter = validate_res.map_iterator();
+ while (valiter.next()) {
+
+ // print("get inter\n");
+ var eline = valiter.get_key();
+ if (eline > tlines) {
+ continue;
+ }
+ this.el.get_iter_at_line( out iter, eline);
+ //print("mark line\n");
+ this.el.create_source_mark(valiter.get_value(), "ERR", iter);
+ }
+ return false;
+ }
+ public string toString () {
+
+ Gtk.TextIter s;
+ Gtk.TextIter e;
+ this.el.get_start_iter(out s);
+ this.el.get_end_iter(out e);
+ var ret = this.el.get_text(s,e,true);
+ //print("TO STRING? " + ret);
+ return ret;
+ }
+ }
+
+ public class Xcls_EventControllerKey11 : Object
+ {
+ public Gtk.EventControllerKey el;
+ private Editor _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_EventControllerKey11(Editor _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.EventControllerKey();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.key_released.connect( (keyval, keycode, state) => {
+
+
+ if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
+ GLib.debug("SAVE: ctrl-S pressed");
+ _this.saveContents();
+ return;
+ }
+
+ if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
+ GLib.debug("SAVE: ctrl-g pressed");
+ _this.forwardSearch(true);
+ return;
+ }
+ if (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
+ GLib.debug("SAVE: ctrl-f pressed");
+ _this.search_entry.el.grab_focus();
+ return;
+ }
+ //_this.view.el.show_completion();
+ // print(event.key.keyval)
+
+ return;
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+
+ public class Xcls_Box12 : Object
+ {
+ public Gtk.Box el;
+ private Editor _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box12(Editor _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.homogeneous = false;
+ this.el.vexpand = false;
+ var child_1 = new Xcls_search_entry( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_search_results( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ var child_3 = new Xcls_nextBtn( _this );
+ child_3.ref();
+ this.el.append( child_3.el );
+ var child_4 = new Xcls_backBtn( _this );
+ child_4.ref();
+ this.el.append( child_4.el );
+ var child_5 = new Xcls_MenuButton18( _this );
+ child_5.ref();
+ this.el.append( child_5.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_search_entry : Object
+ {
+ public Gtk.SearchEntry el;
+ private Editor _this;
+
+
+ // my vars (def)
+ public Gtk.CssProvider css;
+
+ // ctor
+ public Xcls_search_entry(Editor _owner )
+ {
+ _this = _owner;
+ _this.search_entry = this;
+ this.el = new Gtk.SearchEntry();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.name = "editor-search-entry";
+ this.el.hexpand = true;
+ this.el.placeholder_text = "Press enter to search";
+ this.el.search_delay = 3;
+ var child_1 = new Xcls_EventControllerKey14( _this );
+ child_1.ref();
+ this.el.add_controller( child_1.el );
+
+ //listeners
+ this.el.search_changed.connect( ( ) => {
+
+ _this.search(_this.search_entry.el.text);
+ _this.search_results.updateResults();
+
+ GLib.Timeout.add_seconds(1,() => {
+ _this.search_results.updateResults();
+ return false;
+ });
+ });
+ }
+
+ // user defined functions
+ public void forwardSearch (bool change_focus) {
+
+
+ _this.forwardSearch(change_focus);
+
+ /*
+
+ switch(_this.windowstate.state) {
+ case WindowState.State.CODEONLY:
+ //case WindowState.State.CODE:
+ // search the code being edited..
+ _this.windowstate.code_editor_tab.forwardSearch(change_focus);
+
+ break;
+ case WindowState.State.PREVIEW:
+ if (_this.windowstate.file.xtype == "Gtk") {
+ _this.windowstate.window_gladeview.forwardSearch(change_focus);
+ } else {
+ _this.windowstate.window_rooview.forwardSearch(change_focus);
+ }
+
+ break;
+ }
+ */
+
+ }
+ }
+ public class Xcls_EventControllerKey14 : Object
+ {
+ public Gtk.EventControllerKey el;
+ private Editor _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_EventControllerKey14(Editor _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.EventControllerKey();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.key_pressed.connect( (keyval, keycode, state) => {
+
+ if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
+ GLib.debug("SAVE: ctrl-g pressed");
+ _this.forwardSearch(true);
+ return true;
+ }
+
+
+ if (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {
+ _this.forwardSearch(true);
+
+
+ return true;
+
+ }
+ // print(event.key.keyval)
+
+ return false;
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_search_results : Object
+ {
+ public Gtk.Label el;
+ private Editor _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_search_results(Editor _owner )
+ {
+ _this = _owner;
+ _this.search_results = this;
+ this.el = new Gtk.Label( "No Results" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.margin_end = 4;
+ this.el.margin_start = 4;
+ }
+
+ // user defined functions
+ public void updateResults () {
+ this.el.visible = true;
+
+ var res = _this.searchcontext.get_occurrences_count();
+ if (res < 0) {
+ _this.search_results.el.label = "??? Matches";
+ return;
+ }
+
+ _this.nextBtn.el.sensitive = false;
+ _this.backBtn.el.sensitive = false;
+
+ if (res > 0) {
+ _this.search_results.el.label = "%d Matches".printf(res);
+ _this.nextBtn.el.sensitive = true;
+ _this.backBtn.el.sensitive = true;
+ return;
+ }
+ _this.search_results.el.label = "No Matches";
+
+ }
+ }
+
+ public class Xcls_nextBtn : Object
+ {
+ public Gtk.Button el;
+ private Editor _this;
+
+
+ // my vars (def)
+ public bool always_show_image;
+
+ // ctor
+ public Xcls_nextBtn(Editor _owner )
+ {
+ _this = _owner;
+ _this.nextBtn = this;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+ this.always_show_image = true;
+
+ // set gobject values
+ this.el.icon_name = "go-down";
+ this.el.sensitive = false;
+
+ //listeners
+ this.el.clicked.connect( (event) => {
+
+ _this.forwardSearch(true);
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_backBtn : Object
+ {
+ public Gtk.Button el;
+ private Editor _this;
+
+
+ // my vars (def)
+ public bool always_show_image;
+
+ // ctor
+ public Xcls_backBtn(Editor _owner )
+ {
+ _this = _owner;
+ _this.backBtn = this;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+ this.always_show_image = true;
+
+ // set gobject values
+ this.el.icon_name = "go-up";
+ this.el.sensitive = false;
+
+ //listeners
+ this.el.clicked.connect( (event) => {
+
+ _this.backSearch(true);
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_MenuButton18 : Object
+ {
+ public Gtk.MenuButton el;
+ private Editor _this;
+
+
+ // my vars (def)
+ public bool always_show_image;
+
+ // ctor
+ public Xcls_MenuButton18(Editor _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.MenuButton();
+
+ // my vars (dec)
+ this.always_show_image = true;
+
+ // set gobject values
+ this.el.icon_name = "emblem-system";
+ this.el.always_show_arrow = true;
+ var child_1 = new Xcls_search_settings( _this );
+ child_1.ref();
+ this.el.popover = child_1.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_search_settings : Object
+ {
+ public Gtk.Popover el;
+ private Editor _this;
+
+
+ // my vars (def)
- // ctor
- public Xcls_close_btn(Editor _owner )
- {
- _this = _owner;
- _this.close_btn = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.icon_name = "window-close";
- var child_1 = new Xcls_Image7( _this );
- this.el.child = child_1.el;
-
- //listeners
- this.el.clicked.connect( () => {
- _this.saveContents();
- _this.window.windowstate.switchState(WindowState.State.PREVIEW);
- });
- }
-
- // user defined functions
- }
- public class Xcls_Image7 : Object
- {
- public Gtk.Image el;
- private Editor _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image7(Editor _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
-
- // my vars (dec)
-
- // set gobject values
- this.el.icon_name = "window-close";
- this.el.icon_size = Gtk.IconSize.NORMAL;
- }
-
- // user defined functions
- }
-
-
-
- public class Xcls_RightEditor : Object
- {
- public Gtk.ScrolledWindow el;
- private Editor _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_RightEditor(Editor _owner )
- {
- _this = _owner;
- _this.RightEditor = this;
- this.el = new Gtk.ScrolledWindow();
-
- // my vars (dec)
-
- // set gobject values
- this.el.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
- this.el.vexpand = true;
- this.el.overlay_scrolling = false;
- this.el.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
- new Xcls_view( _this );
- this.el.child = _this.view.el;
- }
-
- // user defined functions
- }
- public class Xcls_view : Object
- {
- public GtkSource.View el;
- private Editor _this;
-
-
- // my vars (def)
- public Gtk.CssProvider css;
-
- // ctor
- public Xcls_view(Editor _owner )
- {
- _this = _owner;
- _this.view = this;
- this.el = new GtkSource.View();
-
- // my vars (dec)
- this.css = null;
-
- // set gobject values
- this.el.auto_indent = true;
- this.el.indent_width = 4;
- this.el.name = "editor-view";
- this.el.show_line_marks = true;
- this.el.insert_spaces_instead_of_tabs = true;
- this.el.show_line_numbers = true;
- this.el.hexpand = true;
- this.el.vexpand = true;
- this.el.has_tooltip = true;
- this.el.tab_width = 4;
- this.el.highlight_current_line = true;
- new Xcls_buffer( _this );
- this.el.buffer = _this.buffer.el;
- var child_2 = new Xcls_EventControllerKey11( _this );
- child_2.ref();
- this.el.add_controller( child_2.el );
-
- // init method
-
- this.css = new Gtk.CssProvider();
-
- this.css.load_from_string(
- "#editor-view { font: 12px monospace;}"
- );
-
- Gtk.StyleContext.add_provider_for_display(
- this.el.get_display(),
- this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
- );
-
-
-
- /*
- this is pretty flakey - triggers Gtk with < 0 d
- var cp = new GtkSource.CompletionWords("test");
- cp.minimum_word_size = 3;
- //cp.priority = 100; //?? does this do anything
- cp.proposals_batch_size = 10;
- cp.scan_batch_size = 1000;
-
- cp.register(_this.buffer.el);
- this.el.completion.add_provider(cp);
- */
- this.el.completion.add_provider(new Palete.CompletionProvider(_this));
-
- //this.el.completion.unblock_interactive();
- this.el.completion.select_on_show = true; // select
- //this.el.completion.remember_info_visibility = true;
-
-
- var attrs = new GtkSource.MarkAttributes();
- var pink = Gdk.RGBA();
- pink.parse ( "pink");
- attrs.set_background ( pink);
- attrs.set_icon_name ( "process-stop");
- attrs.query_tooltip_text.connect(( mark) => {
- GLib.debug("tooltip query? %s", mark.name);
- return strdup( mark.name);
- });
- attrs.query_tooltip_markup.connect(( mark) => {
- GLib.debug("tooltip query? %s", mark.name);
- return strdup( mark.name);
- });
- this.el.set_mark_attributes ("ERR", attrs, 1);
- attrs.ref();
- var wattrs = new GtkSource.MarkAttributes();
- var blue = Gdk.RGBA();
- blue.parse ( "#ABF4EB");
- wattrs.set_background ( blue);
- wattrs.set_icon_name ( "process-stop");
- wattrs.query_tooltip_text.connect(( mark) => {
- GLib.debug("tooltip query? %s", mark.name);
- return strdup(mark.name);
- });
- wattrs.query_tooltip_markup.connect(( mark) => {
- GLib.debug("tooltip query? %s", mark.name);
- return strdup(mark.name);
- });
- this.el.set_mark_attributes ("WARN", wattrs, 1);
- wattrs.ref();
-
-
- var dattrs = new GtkSource.MarkAttributes();
- var purple = Gdk.RGBA();
- purple.parse ( "#EEA9FF");
- dattrs.set_background ( purple);
- dattrs.set_icon_name ( "process-stop");
- dattrs.query_tooltip_text.connect(( mark) => {
- GLib.debug("tooltip query? %s", mark.name);
- return strdup(mark.name);
- });
- dattrs.query_tooltip_markup.connect(( mark) => {
- GLib.debug("tooltip query? %s", mark.name);
- return strdup(mark.name);
- });
- this.el.set_mark_attributes ("DEPR", dattrs, 1);
- dattrs.ref();
-
- this.el.get_space_drawer().set_matrix(null);
- this.el.get_space_drawer().set_types_for_locations(
- GtkSource.SpaceLocationFlags.ALL,
- GtkSource.SpaceTypeFlags.ALL
- );
- this.el.get_space_drawer().set_enable_matrix(true);
-
- //listeners
- this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
-
- //GLib.debug("query tooltip");
- Gtk.TextIter iter;
- int trailing;
-
- var yoff = (int) _this.RightEditor.el.vadjustment.value;
-
- // I think this is problematic - if it's compliing / updating at same time as query.
-
- //if (_this.window.statusbar_compile_spinner.el.spinning) {
- // return false;
- //}
-
- this.el.get_iter_at_position (out iter, out trailing, x, y + yoff);
-
- var l = iter.get_line();
-
-
-
- // GLib.debug("query tooltip line %d", (int) l);
- if (l < 0) {
-
- return false;
- }
- /*
- if (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {
- GLib.debug("line %d setting tip to %s", l, _this.buffer.marks.get(l));
- tooltip.set_text(_this.buffer.marks.get(l).dup());
- return true;
- }
-
- return false;
- */
-
-
- // this crashes?? - not sure why.
- var marks = _this.buffer.el.get_source_marks_at_line(l, "ERR");
- if (marks.is_empty()) {
- marks = _this.buffer.el.get_source_marks_at_line(l, "WARN");
- }
- if (marks.is_empty()) {
- marks = _this.buffer.el.get_source_marks_at_line(l, "DEPR");
- }
-
- // GLib.debug("query tooltip line %d marks %d", (int)l, (int) marks.length());
- var str = "";
- marks.@foreach((m) => {
- //GLib.debug("got mark %s", m.name);
- str += (str.length > 0 ? "\n" : "") + m.category + ": " + m.name;
- });
- // true if there is a mark..
- if (str.length > 0 ) {
- tooltip.set_text( str );
- }
- return str.length > 0 ? true : false;
-
- });
- }
-
- // user defined functions
- public void load (string str) {
-
- // show the help page for the active node..
- //this.get('/Help').show();
-
- // this.get('/BottomPane').el.set_current_page(0);
- GLib.debug("load called - Reset undo buffer");
-
- var buf = (GtkSource.Buffer)this.el.get_buffer();
- buf.begin_irreversible_action();
- buf.set_text(str, str.length);
- buf.end_irreversible_action();
-
- var lm = GtkSource.LanguageManager.get_default();
- var lang = "vala";
- if (_this.file != null) {
- lang = _this.file.language;
- }
- print("lang=%s, content_type = %s\n", lang, _this.file.content_type);
- var lg = _this.file.content_type.length > 0 ?
- lm.guess_language(_this.file.path, _this.file.content_type) :
- lm.get_language(lang);
-
-
- ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg);
-
- this.el.insert_spaces_instead_of_tabs = true;
- if (lg != null) {
- print("sourcelanguage = %s\n", lg.name);
- if (lg.name == "Vala") {
- this.el.insert_spaces_instead_of_tabs = false;
- }
- }
- _this.dirty = false;
- this.el.grab_focus();
- _this.save_button.el.sensitive = false;
- }
- }
- public class Xcls_buffer : Object
- {
- public GtkSource.Buffer el;
- private Editor _this;
-
-
- // my vars (def)
- public int error_line;
- public Gee.HashMap<int,string>? xmarks;
- public bool check_queued;
-
- // ctor
- public Xcls_buffer(Editor _owner )
- {
- _this = _owner;
- _this.buffer = this;
- this.el = new GtkSource.Buffer( null );
-
- // my vars (dec)
- this.error_line = -1;
- this.xmarks = null;
- this.check_queued = false;
-
- // set gobject values
- this.el.highlight_syntax = true;
- this.el.highlight_matching_brackets = true;
- this.el.enable_undo = true;
-
- // init method
-
- {
- var buf = this.el;
- buf.create_tag ("bold", "weight", Pango.Weight.BOLD);
- buf.create_tag ("type", "weight", Pango.Weight.BOLD, "foreground", "#204a87");
- buf.create_tag ("keyword", "weight", Pango.Weight.BOLD, "foreground", "#a40000");
- buf.create_tag ("text", "weight", Pango.Weight.NORMAL, "foreground", "#729fcf");
- buf.create_tag ("number", "weight", Pango.Weight.BOLD, "foreground", "#ad7fa8");
- buf.create_tag ("method", "weight", Pango.Weight.BOLD, "foreground", "#729fcf");
- buf.create_tag ("property", "weight", Pango.Weight.BOLD, "foreground", "#BC1F51");
- buf.create_tag ("variable", "weight", Pango.Weight.BOLD, "foreground", "#A518B5");
-
- }
-
- //listeners
- this.el.changed.connect( () => {
- // check syntax??
- // ??needed..??
- _this.save_button.el.sensitive = true;
- print("EDITOR CHANGED");
- this.checkSyntax();
-
- _this.dirty = true;
-
- // this.get('/LeftPanel.model').changed( str , false);
- return ;
- });
- }
-
- // user defined functions
- public bool checkSyntax () {
-
-
- var str = this.toString();
-
- // needed???
- if (this.error_line > 0) {
- Gtk.TextIter start;
- Gtk.TextIter end;
- this.el.get_bounds (out start, out end);
-
- this.el.remove_source_marks (start, end, null);
- }
- if (str.length < 1) {
- print("checkSyntax - empty string?\n");
- return true;
- }
-
- // bit presumptiona
- if (_this.file.xtype == "PlainFile") {
-
- // assume it's gtk...
- var oldcode =_this.file.toSource();
- _this.file.setSource(str);
- _this.file.getLanguageServer().document_change(_this.file);
- BuilderApplication.showSpinner("appointment soon","document change pending");
- _this.file.setSource(oldcode);
-
-
- return true;
-
- }
- if (_this.file == null) {
- return true;
- }
-
-
-
-
-
- GLib.debug("calling validate");
- // clear the buttons.
- if (_this.prop.name == "xns" || _this.prop.name == "xtype") {
- return true ;
- }
- var oldcode = _this.prop.val;
-
- _this.prop.val = str;
- _this.node.updated_count++;
- _this.file.getLanguageServer().document_change(_this.file);
- _this.node.updated_count++;
- _this.prop.val = oldcode;
-
-
- //print("done mark line\n");
-
- return true; // at present allow saving - even if it's invalid..
- }
- public bool highlightErrorsJson (string type, Json.Object obj) {
- Gtk.TextIter start;
- Gtk.TextIter end;
- this.el.get_bounds (out start, out end);
-
- this.el.remove_source_marks (start, end, type);
- GLib.debug("highlight errors");
-
- // we should highlight other types of errors..
-
- if (!obj.has_member(type)) {
- GLib.debug("Return has no errors\n");
- return true;
- }
-
- if (_this.window.windowstate.state != WindowState.State.CODEONLY
- &&
- _this.window.windowstate.state != WindowState.State.CODE
- ) {
- GLib.debug("windowstate != CODEONLY?");
-
- return true;
- }
-
- //this.marks = new Gee.HashMap<int,string>();
- var err = obj.get_object_member(type);
-
- if (_this.file == null) {
- GLib.debug("file is null?");
- return true;
-
- }
- var valafn = _this.file.path;
-
- if (_this.file.xtype != "PlainFile") {
-
- valafn = "";
- try {
- var regex = new Regex("\\.bjs$");
- // should not happen
- valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
- } catch (GLib.RegexError e) {
- return true;
- }
-
-
-
- }
- if (!err.has_member(valafn)) {
- GLib.debug("File path has no errors");
- return true;
- }
-
- var lines = err.get_object_member(valafn);
-
- var offset = 1;
- if (obj.has_member("line_offset")) { // ?? why??
- offset = (int)obj.get_int_member("line_offset") + 1;
- }
-
-
- var tlines = this.el.get_line_count () +1;
-
- if (_this.prop != null) {
-
- tlines = _this.prop.end_line + 1;
- offset = _this.prop.start_line + 1;
-
- }
-
-
-
- lines.foreach_member((obj, line, node) => {
-
- Gtk.TextIter iter;
- // print("get inter\n");
- var eline = int.parse(line) - offset;
- GLib.debug("GOT ERROR on line %s -- converted to %d (offset = %d)\n", line,eline, offset);
-
-
- if (eline > tlines || eline < 0) {
- return;
- }
-
-
- this.el.get_iter_at_line( out iter, eline);
- //print("mark line\n");
- var msg = "";
- var ar = lines.get_array_member(line);
- for (var i = 0 ; i < ar.get_length(); i++) {
- if (ar.get_string_element(i) == "Success") {
- continue;
- }
- msg += (msg.length > 0) ? "\n" : "";
- msg += ar.get_string_element(i);
- }
- if (msg == "") {
- return;
- }
- msg = "Line: %d".printf(eline+1) + " " + msg;
- this.el.create_source_mark(msg, type, iter);
- GLib.debug("set line %d to %m", eline, msg);
- // this.marks.set(eline, msg);
- } );
- return false;
-
-
-
-
-
- }
- public bool highlightErrors ( Gee.HashMap<int,string> validate_res) {
-
- this.error_line = validate_res.size;
-
- if (this.error_line < 1) {
- return true;
- }
- var tlines = this.el.get_line_count ();
- Gtk.TextIter iter;
- var valiter = validate_res.map_iterator();
- while (valiter.next()) {
-
- // print("get inter\n");
- var eline = valiter.get_key();
- if (eline > tlines) {
- continue;
- }
- this.el.get_iter_at_line( out iter, eline);
- //print("mark line\n");
- this.el.create_source_mark(valiter.get_value(), "ERR", iter);
- }
- return false;
- }
- public string toString () {
-
- Gtk.TextIter s;
- Gtk.TextIter e;
- this.el.get_start_iter(out s);
- this.el.get_end_iter(out e);
- var ret = this.el.get_text(s,e,true);
- //print("TO STRING? " + ret);
- return ret;
- }
- }
-
- public class Xcls_EventControllerKey11 : Object
- {
- public Gtk.EventControllerKey el;
- private Editor _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_EventControllerKey11(Editor _owner )
- {
- _this = _owner;
- this.el = new Gtk.EventControllerKey();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.key_released.connect( (keyval, keycode, state) => {
-
-
- if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-S pressed");
- _this.saveContents();
- return;
- }
-
- if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-g pressed");
- _this.forwardSearch(true);
- return;
- }
- if (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-f pressed");
- _this.search_entry.el.grab_focus();
- _this.search_entry.el.select_region(0,-1);
- return;
- }
- if (keyval == Gdk.Key.space && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- _this.view.el.show_completion();
- }
-
- Gtk.TextIter iter;
- _this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position);
- var line = iter.get_line();
- var offset = iter.get_line_offset();
- GLib.debug("line %d off %d", line ,offset);
- if (_this.prop != null) {
- line += _this.prop.start_line + 1; // i think..
- offset += 12; // should probably be 8 without namespaced
- GLib.debug("guess line %d off %d", line ,offset);
- }
- //_this.view.el.show_completion();
- // print(event.key.keyval)
-
-
-
-
- return;
-
-
- });
- }
-
- // user defined functions
- }
-
-
-
- public class Xcls_Box12 : Object
- {
- public Gtk.Box el;
- private Editor _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box12(Editor _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- this.el.vexpand = false;
- new Xcls_search_entry( _this );
- this.el.append( _this.search_entry.el );
- new Xcls_search_results( _this );
- this.el.append( _this.search_results.el );
- new Xcls_nextBtn( _this );
- this.el.append( _this.nextBtn.el );
- new Xcls_backBtn( _this );
- this.el.append( _this.backBtn.el );
- var child_5 = new Xcls_MenuButton18( _this );
- child_5.ref();
- this.el.append( child_5.el );
- }
-
- // user defined functions
- }
- public class Xcls_search_entry : Object
- {
- public Gtk.SearchEntry el;
- private Editor _this;
-
-
- // my vars (def)
- public Gtk.CssProvider css;
-
- // ctor
- public Xcls_search_entry(Editor _owner )
- {
- _this = _owner;
- _this.search_entry = this;
- this.el = new Gtk.SearchEntry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.name = "editor-search-entry";
- this.el.hexpand = true;
- this.el.placeholder_text = "Press enter to search";
- this.el.search_delay = 3;
- var child_1 = new Xcls_EventControllerKey14( _this );
- child_1.ref();
- this.el.add_controller( child_1.el );
-
- //listeners
- this.el.search_changed.connect( ( ) => {
-
- _this.search(_this.search_entry.el.text);
- _this.search_results.updateResults();
-
- GLib.Timeout.add_seconds(1,() => {
- _this.search_results.updateResults();
- return false;
- });
- });
- }
-
- // user defined functions
- public void forwardSearch (bool change_focus) {
-
-
- _this.forwardSearch(change_focus);
-
- /*
-
- switch(_this.windowstate.state) {
- case WindowState.State.CODEONLY:
- //case WindowState.State.CODE:
- // search the code being edited..
- _this.windowstate.code_editor_tab.forwardSearch(change_focus);
-
- break;
- case WindowState.State.PREVIEW:
- if (_this.windowstate.file.xtype == "Gtk") {
- _this.windowstate.window_gladeview.forwardSearch(change_focus);
- } else {
- _this.windowstate.window_rooview.forwardSearch(change_focus);
- }
-
- break;
- }
- */
-
- }
- }
- public class Xcls_EventControllerKey14 : Object
- {
- public Gtk.EventControllerKey el;
- private Editor _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_EventControllerKey14(Editor _owner )
- {
- _this = _owner;
- this.el = new Gtk.EventControllerKey();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.key_pressed.connect( (keyval, keycode, state) => {
-
- if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-g pressed");
- _this.forwardSearch(true);
- return true;
- }
-
-
- if (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {
- _this.forwardSearch(true);
-
-
- return true;
-
- }
- // print(event.key.keyval)
-
- return false;
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_search_results : Object
- {
- public Gtk.Label el;
- private Editor _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_search_results(Editor _owner )
- {
- _this = _owner;
- _this.search_results = this;
- this.el = new Gtk.Label( "No Results" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.margin_end = 4;
- this.el.margin_start = 4;
- }
-
- // user defined functions
- public void updateResults () {
- this.el.visible = true;
-
- var res = _this.searchcontext.get_occurrences_count();
- if (res < 0) {
- _this.search_results.el.label = "??? Matches";
- return;
- }
-
- _this.nextBtn.el.sensitive = false;
- _this.backBtn.el.sensitive = false;
-
- if (res > 0) {
- _this.search_results.el.label = "%d Matches".printf(res);
- _this.nextBtn.el.sensitive = true;
- _this.backBtn.el.sensitive = true;
- return;
- }
- _this.search_results.el.label = "No Matches";
-
- }
- }
-
- public class Xcls_nextBtn : Object
- {
- public Gtk.Button el;
- private Editor _this;
-
-
- // my vars (def)
- public bool always_show_image;
-
- // ctor
- public Xcls_nextBtn(Editor _owner )
- {
- _this = _owner;
- _this.nextBtn = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
- this.always_show_image = true;
-
- // set gobject values
- this.el.icon_name = "go-down";
- this.el.sensitive = false;
-
- //listeners
- this.el.clicked.connect( (event) => {
-
- _this.forwardSearch(true);
-
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_backBtn : Object
- {
- public Gtk.Button el;
- private Editor _this;
-
-
- // my vars (def)
- public bool always_show_image;
-
- // ctor
- public Xcls_backBtn(Editor _owner )
- {
- _this = _owner;
- _this.backBtn = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
- this.always_show_image = true;
-
- // set gobject values
- this.el.icon_name = "go-up";
- this.el.sensitive = false;
-
- //listeners
- this.el.clicked.connect( (event) => {
-
- _this.backSearch(true);
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_MenuButton18 : Object
- {
- public Gtk.MenuButton el;
- private Editor _this;
-
-
- // my vars (def)
- public bool always_show_image;
-
- // ctor
- public Xcls_MenuButton18(Editor _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuButton();
-
- // my vars (dec)
- this.always_show_image = true;
-
- // set gobject values
- this.el.icon_name = "emblem-system";
- this.el.always_show_arrow = true;
- new Xcls_search_settings( _this );
- this.el.popover = _this.search_settings.el;
- }
-
- // user defined functions
- }
- public class Xcls_search_settings : Object
- {
- public Gtk.Popover el;
- private Editor _this;
+ // ctor
+ public Xcls_search_settings(Editor _owner )
+ {
+ _this = _owner;
+ _this.search_settings = this;
+ this.el = new Gtk.Popover();
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Box20( _this );
+ child_1.ref();
+ this.el.child = child_1.el;
+ }
+ // user defined functions
+ }
+ public class Xcls_Box20 : Object
+ {
+ public Gtk.Box el;
+ private Editor _this;
- // my vars (def)
- // ctor
- public Xcls_search_settings(Editor _owner )
- {
- _this = _owner;
- _this.search_settings = this;
- this.el = new Gtk.Popover();
-
- // my vars (dec)
+ // my vars (def)
- // set gobject values
- var child_1 = new Xcls_Box20( _this );
- this.el.child = child_1.el;
- }
+ // ctor
+ public Xcls_Box20(Editor _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
- // user defined functions
- }
- public class Xcls_Box20 : Object
- {
- public Gtk.Box el;
- private Editor _this;
+ // my vars (dec)
+ // set gobject values
+ var child_1 = new Xcls_case_sensitive( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_regex( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ var child_3 = new Xcls_multiline( _this );
+ child_3.ref();
+ this.el.append( child_3.el );
+ }
- // my vars (def)
+ // user defined functions
+ }
+ public class Xcls_case_sensitive : Object
+ {
+ public Gtk.CheckButton el;
+ private Editor _this;
- // ctor
- public Xcls_Box20(Editor _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
- // my vars (dec)
+ // my vars (def)
- // set gobject values
- new Xcls_case_sensitive( _this );
- this.el.append( _this.case_sensitive.el );
- new Xcls_regex( _this );
- this.el.append( _this.regex.el );
- new Xcls_multiline( _this );
- this.el.append( _this.multiline.el );
- }
+ // ctor
+ public Xcls_case_sensitive(Editor _owner )
+ {
+ _this = _owner;
+ _this.case_sensitive = this;
+ this.el = new Gtk.CheckButton();
- // user defined functions
- }
- public class Xcls_case_sensitive : Object
- {
- public Gtk.CheckButton el;
- private Editor _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.label = "Case Sensitive";
- // my vars (def)
+ // init method
- // ctor
- public Xcls_case_sensitive(Editor _owner )
- {
- _this = _owner;
- _this.case_sensitive = this;
- this.el = new Gtk.CheckButton();
+ {
+ this.el.show();
+ }
+ }
- // my vars (dec)
+ // user defined functions
+ }
- // set gobject values
- this.el.label = "Case Sensitive";
+ public class Xcls_regex : Object
+ {
+ public Gtk.CheckButton el;
+ private Editor _this;
- // init method
- {
- this.el.show();
- }
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_regex(Editor _owner )
+ {
+ _this = _owner;
+ _this.regex = this;
+ this.el = new Gtk.CheckButton();
- public class Xcls_regex : Object
- {
- public Gtk.CheckButton el;
- private Editor _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.label = "Regex";
- // my vars (def)
+ // init method
- // ctor
- public Xcls_regex(Editor _owner )
- {
- _this = _owner;
- _this.regex = this;
- this.el = new Gtk.CheckButton();
+ {
+ this.el.show();
+ }
+ }
- // my vars (dec)
+ // user defined functions
+ }
- // set gobject values
- this.el.label = "Regex";
+ public class Xcls_multiline : Object
+ {
+ public Gtk.CheckButton el;
+ private Editor _this;
- // init method
- {
- this.el.show();
- }
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_multiline(Editor _owner )
+ {
+ _this = _owner;
+ _this.multiline = this;
+ this.el = new Gtk.CheckButton();
- public class Xcls_multiline : Object
- {
- public Gtk.CheckButton el;
- private Editor _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.label = "Multi-line (add \\n)";
+ }
- // my vars (def)
-
- // ctor
- public Xcls_multiline(Editor _owner )
- {
- _this = _owner;
- _this.multiline = this;
- this.el = new Gtk.CheckButton();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Multi-line (add \\n)";
- }
-
- // user defined functions
- }
+ // user defined functions
+ }
],
"* pack" : "set_child",
"Gtk.CssProvider css" : "",
- "bool loading" : false,
- "bool zallow_node_scroll" : true,
+ "bool allow_node_scroll" : true,
+ "bool loading" : true,
"gboolean editable" : false,
"gboolean show_line_marks" : true,
"gboolean show_line_numbers" : true,
"$ xns" : "GtkSource",
"* pack" : "set_buffer",
"bool dirty" : false,
- "bool in_cursor_change" : false,
"id" : "buffer",
"int error_line" : "-1",
- "int last_line" : "-1",
"listeners" : {
- "cursor_moved" : [
- "( ) => {",
- "GLib.debug(\"cursor moved called\");",
+ "notify[\"cursor_position\"]" : [
+ "() => {",
"",
"",
- " \tif (this.in_cursor_change ) {",
- " GLib.debug(\"cursor changed : %d [ignoring nested call)\", this.el.cursor_position);",
+ " if (_this.sourceview.loading) {",
" return;",
" }",
" ",
" this.el.get_iter_at_offset(out cpos, this.el.cursor_position);",
" ",
" var ln = cpos.get_line();",
- " if (this.last_line == ln ){",
- " \treturn;",
- "\t}",
- "\tthis.last_line = ln;",
+ "",
" var node = _this.file.lineToNode(ln);",
"",
" if (node == null) {",
" print(\"can not find node\\n\");",
" return;",
" }",
- " this.in_cursor_change = true;",
+ " _this.sourceview.loading = true;",
" var ltree = _this.main_window.windowstate.left_tree;",
" ltree.model.selectNode(node);",
- " this.in_cursor_change = false;",
- "}",
- ""
+ " _this.sourceview.loading = false;",
+ " ",
+ " //print(\"got tree path %s\\n\", tp);",
+ " //if (tp != \"\") {",
+ " // this.allow_node_scroll = false; ",
+ " // print(\"changing cursor on tree..\\n\");",
+ " //ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false);",
+ " // scrolling is disabled... as node selection calls scroll 10ms after it changes.",
+ " ///GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {",
+ " // this.allow_node_scroll = true;",
+ " // return false;",
+ " // });",
+ " // }",
+ " ",
+ " // highlight the node..",
+ " ",
+ " ",
+ "",
+ " }"
]
},
"xtype" : "Buffer"
]
},
"string name" : "gtkview-view",
- "uint tab_width" : 4,
"xtype" : "View",
"| string toString" : [
"() {",
" var buf = this.el.get_buffer();",
" buf.set_text(\"\",0);",
" var sbuf = (GtkSource.Buffer) buf;",
- "\tvar cpos = buf.cursor_position;",
+ "",
" ",
- " \tprint(\"BEFORE LOAD cursor = %d\\n\", cpos);",
- " var vadj_pos = this.el.get_vadjustment().get_value();",
"",
" if (_this.file == null || _this.file.xtype != \"Gtk\") {",
" print(\"xtype != Gtk\");",
" ",
" ",
" _this.main_window.windowstate.updateErrorMarksAll(); ",
- " // restore the cursor position?",
- " // after reloading the contents.",
- " GLib.Timeout.add(500, () => {",
- "\t\t_this.buffer.in_cursor_change = true;",
- " print(\"RESORTING cursor to = %d\\n\", cpos);",
- "\t\tGtk.TextIter cpos_iter;",
- "\t\tbuf.get_iter_at_offset(out cpos_iter, cpos);",
- "\t\tbuf.place_cursor(cpos_iter); ",
- "\t\t",
- "\t\tthis.el.get_vadjustment().set_value(vadj_pos);;",
- "\t\t_this.buffer.in_cursor_change = false;",
- " ",
- "\t\t",
- "\t\t",
- "\t\t//_this.buffer.checkSyntax();",
- "\t\treturn false;",
- "\t});",
+ " ",
" ",
" ",
" this.loading = false; ",
" var sbuf = (GtkSource.Buffer) buf;",
"",
" ",
- " ",
+ " // while(Gtk.events_pending()) {",
+ " // Gtk.main_iteration();",
+ " // }",
" ",
" ",
" // clear all the marks..",
" Gtk.TextIter cur_iter;",
" sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);",
" ",
+ " //var cur_line = cur_iter.get_line();",
+ " //if (cur_line > sel.line_start && cur_line < sel.line_end) {",
" ",
- " if (!_this.buffer.in_cursor_change) {",
- "",
+ " //} else {",
+ " if (this.allow_node_scroll) {",
+ "\t\t ",
" \tthis.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
- "\t} ",
+ "\t}",
" ",
" ",
" ",
" ",
"",
" ",
+ "\t",
+ "\tvar offset = 0;",
"\t ",
"",
"\tvar tlines = buf.get_line_count () +1;",
"\t\t",
"\t Gtk.TextIter iter;",
"// print(\"get inter\\n\");",
- "\t var eline = err.line + 1;",
- "\t GLib.debug(\"GOT ERROR on line %d -- converted to %d \",",
- "\t \terr.line ,eline);",
+ "\t var eline = err.line - offset;",
+ "\t GLib.debug(\"GOT ERROR on line %d -- converted to %d (offset = %d)\",",
+ "\t \terr.line ,eline, offset);",
"\t ",
"\t ",
"\t if (eline > tlines || eline < 0) {",
-static Xcls_GtkView _GtkView;
-
-public class Xcls_GtkView : Object
-{
- public Gtk.Box el;
- private Xcls_GtkView _this;
-
- public static Xcls_GtkView singleton()
- {
- if (_GtkView == null) {
- _GtkView= new Xcls_GtkView();
- }
- return _GtkView;
- }
- public Xcls_notebook notebook;
- public Xcls_label_preview label_preview;
- public Xcls_label_code label_code;
- public Xcls_view_layout view_layout;
- public Xcls_container container;
- public Xcls_sourceviewscroll sourceviewscroll;
- public Xcls_sourceview sourceview;
- public Xcls_buffer buffer;
- public Xcls_search_entry search_entry;
- public Xcls_search_results search_results;
- public Xcls_nextBtn nextBtn;
- public Xcls_backBtn backBtn;
- public Xcls_search_settings search_settings;
- public Xcls_case_sensitive case_sensitive;
- public Xcls_regex regex;
- public Xcls_multiline multiline;
-
- // my vars (def)
- public Gtk.Widget lastObj;
- public Gtk.CssProvider css;
- public Xcls_MainWindow main_window;
- public GtkSource.SearchContext searchcontext;
- public int last_search_end;
- public JsRender.JsRender file;
-
- // ctor
- public Xcls_GtkView()
- {
- _this = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
- this.lastObj = null;
- this.last_search_end = 0;
- this.file = null;
-
- // set gobject values
- this.el.hexpand = true;
- this.el.vexpand = true;
- new Xcls_notebook( _this );
- this.el.append( _this.notebook.el );
-
- // init method
-
- {
-
- this.css = new Gtk.CssProvider();
-
- this.css.load_from_string(
- "#gtkview-view-layout { background-color: #ccc; }"
- );
-
- Gtk.StyleContext.add_provider_for_display(
- this.el.get_display(),
- this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
- );
-
-
- }
- }
-
- // user defined functions
- public void loadFile (JsRender.JsRender file)
- {
- this.file = null;
-
- if (file.tree == null) {
- return;
- }
- this.notebook.el.page = 0;// gtk preview
-
-
-
- this.file = file;
- this.sourceview.loadFile();
- this.searchcontext = null;
-
-
- if (this.lastObj != null) {
- this.container.el.remove(this.lastObj);
- }
-
- // hide the compile view at present..
-
-
- var w = this.el.get_width();
- var h = this.el.get_height();
-
- print("ALLOC SET SIZES %d, %d\n", w,h);
-
- // set the container size min to 500/500 or 20 px less than max..
- w = int.max (w-20, 500);
- h = int.max (h-20, 500);
-
- print("SET SIZES %d, %d\n", w,h);
- _this.container.el.set_size_request(w,h);
-
- _this.view_layout.el.set_size_request(w,h);
- // should be baded on calc.. -- see update_scrolled.
-
- var fc = this.container.el.get_first_child();
- if (fc != null) {
- this.container.el.remove(fc);
- }
-
- var xmlstr = JsRender.NodeToGlade.mungeFile( file);
- var builder = new Gtk.Builder.from_string (xmlstr, xmlstr.length);
- var obj = (Gtk.Widget) builder.get_object("w"+ file.tree.oid.to_string());
- this.container.el.append(obj);
- obj.show();
- this.createThumb();
-
-
- return;/*
- var x = new JsRender.NodeToGtk((Project.Gtk) file.project, file.tree);
- var obj = x.munge() as Gtk.Widget;
- this.lastObj = null;
- if (obj == null) {
- return;
- }
- this.lastObj = obj;
-
- this.container.el.append(obj);
- obj.show();
-
- */
-
- }
- public void highlightNodeAtLine (int ln) {
-
- // this is done from clicking on the editor..
-
- // highlight node...
-
-
- var node = _this.file.lineToNode(ln+1);
-
- if (node == null) {
- //print("can not find node\n");
- return;
- }
- var prop = node.lineToProp(ln+1);
- print("prop : %s", prop == null ? "???" : prop.name);
-
-
- // ---------- this selects the tree's node...
-
- var ltree = _this.main_window.windowstate.left_tree;
- ltree.model.selectNode(node);
- //var tp = ltree.model.treePathFromNode(node);
-
- //print("got tree path %s\n", tp);
- //if (tp == "") {
- // return;
- //}
- //_this.sourceview.allow_node_scroll = false; /// block node scrolling..
-
-
- //print("changing cursor on tree..\n");
-
-
-
- // let's try allowing editing on the methods.
- // a little klunky at present..
- _this.sourceview.prop_selected = "";
- /*
- if (prop != null) {
- //see if we can find it..
- var kv = prop.split(":");
- if (kv[0] == "p") {
-
- //var k = prop.get_key(kv[1]);
- // fixme -- need to determine if it's an editable property...
- _this.sourceview.prop_selected = prop;
-
- } else if (kv[0] == "l") {
- _this.sourceview.prop_selected = prop;
-
- }
- }
- */
- //ltree.view.setCursor(tp, "editor");
- // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false);
- _this.sourceview.nodeSelected(node,false);
-
- // scrolling is disabled... as node selection calls scroll 10ms after it changes.
- // GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
- // this.allow_node_scroll = true;
- // return false;
- // });
- // }
-
-
-
-
-
-
-
-
-
-
-
- }
- public void forwardSearch (bool change_focus) {
-
- if (this.searchcontext == null) {
- return;
- }
- this.notebook.el.page = 1;
- Gtk.TextIter beg, st,en;
- bool has_wrapped_around;
- var buf = this.sourceview.el.get_buffer();
- buf.get_iter_at_offset(out beg, this.last_search_end);
- if (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {
- this.last_search_end = 0;
- return;
- }
- this.last_search_end = en.get_offset();
- if (change_focus) {
- this.sourceview.el.grab_focus();
- }
- buf.place_cursor(st);
-
-
-
- this.sourceview.el.scroll_to_iter(st, 0.0f, true, 0.0f, 0.5f);
-
-
- var ln = st.get_line();
-
- this.highlightNodeAtLine(ln);
- }
- public void backSearch (bool change_focus) {
-
- if (this.searchcontext == null) {
- return;
- }
-
- Gtk.TextIter beg, st,en;
- bool has_wrapped_around;
- this.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );
-
- if (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {
-
- this.last_search_end = 0;
- return;
- }
- this.last_search_end = en.get_offset();
- if (change_focus) {
- this.sourceview.el.grab_focus();
- }
- this.buffer.el.place_cursor(st);
- this.sourceview.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);
- var ln = st.get_line();
- this.highlightNodeAtLine(ln);
-
- }
- public int search (string in_txt) {
- this.notebook.el.page = 1;
-
-
-
- var s = new GtkSource.SearchSettings();
- s.case_sensitive = _this.case_sensitive.el.active;
- s.regex_enabled = _this.regex.el.active;
- s.wrap_around = false;
-
- this.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);
- this.searchcontext.set_highlight(true);
- var txt = in_txt;
-
- if (_this.multiline.el.active) {
- txt = in_txt.replace("\\n", "\n");
- }
-
- s.set_search_text(txt);
- Gtk.TextIter beg, st,en;
- bool has_wrapped_around;
- this.buffer.el.get_start_iter(out beg);
- this.searchcontext.forward(beg, out st, out en, out has_wrapped_around);
- this.last_search_end = 0;
-
- return this.searchcontext.get_occurrences_count();
-
-
-
-
- }
- public void createThumb () {
-
-
- if (this.file == null) {
- return;
- }
- // only screenshot the gtk preview..
- if (this.notebook.el.page > 0 ) {
- return;
- }
-
-
- this.file.widgetToIcon(this.container.el);
-
-
- return;
-
-
-
-
-
- // should we hold until it's printed...
-
-
-
-
- }
- public void updateErrorMarks (string category) {
-
-
-
- var buf = _this.buffer.el;
- Gtk.TextIter start;
- Gtk.TextIter end;
- buf.get_bounds (out start, out end);
-
- buf.remove_source_marks (start, end, category);
-
- GLib.debug("highlight errors");
-
- // we should highlight other types of errors..
-
-
-
-
- if (_this.file == null) {
- GLib.debug("file is null?");
- return;
-
- }
- var ar = this.file.getErrors(category);
- if (ar == null || ar.get_n_items() < 1) {
- GLib.debug("higjlight %s has no errors", category);
- return;
- }
-
-
-
-
-
- var tlines = buf.get_line_count () +1;
-
-
-
- for (var i = 0; i < ar.get_n_items();i++) {
- var err = (Palete.CompileError) ar.get_item(i);
-
- Gtk.TextIter iter;
- // print("get inter\n");
- var eline = err.line + 1;
- GLib.debug("GOT ERROR on line %d -- converted to %d ",
- err.line ,eline);
-
-
- if (eline > tlines || eline < 0) {
- return;
- }
-
-
- buf.get_iter_at_line( out iter, eline);
-
-
- var msg = "Line: %d %s : %s".printf(eline+1, err.category, err.msg);
- buf.create_source_mark( msg, err.category, iter);
- GLib.debug("set line %d to %s", eline, msg);
- //this.marks.set(eline, msg);
- }
- return ;
-
-
-
-
-
- }
- public void scroll_to_line (int line) {
- // code preview...
-
- GLib.Timeout.add(100, () => {
-
-
- this.notebook.el.set_current_page(1);
-
- var buf = this.sourceview.el.get_buffer();
-
- var sbuf = (GtkSource.Buffer) buf;
-
-
- Gtk.TextIter iter;
- sbuf.get_iter_at_line(out iter, line);
- this.sourceview.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
- return false;
- });
-
-
- }
- public class Xcls_notebook : Object
- {
- public Gtk.Notebook el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_notebook(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.notebook = this;
- this.el = new Gtk.Notebook();
-
- // my vars (dec)
-
- // set gobject values
- this.el.overflow = Gtk.Overflow.VISIBLE;
- new Xcls_label_preview( _this );
- new Xcls_label_code( _this );
- var child_3 = new Xcls_ScrolledWindow5( _this );
- child_3.ref();
- this.el.append_page ( child_3.el , _this.label_preview.el );
- var child_4 = new Xcls_Box8( _this );
- child_4.ref();
- this.el.append_page ( child_4.el , _this.label_code.el );
- }
-
- // user defined functions
- }
- public class Xcls_label_preview : Object
- {
- public Gtk.Label el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_label_preview(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.label_preview = this;
- this.el = new Gtk.Label( "Preview" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_label_code : Object
- {
- public Gtk.Label el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_label_code(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.label_code = this;
- this.el = new Gtk.Label( "Preview Generated Code" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_ScrolledWindow5 : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
+ static Xcls_GtkView _GtkView;
+
+ public class Xcls_GtkView : Object
+ {
+ public Gtk.Box el;
+ private Xcls_GtkView _this;
+
+ public static Xcls_GtkView singleton()
+ {
+ if (_GtkView == null) {
+ _GtkView= new Xcls_GtkView();
+ }
+ return _GtkView;
+ }
+ public Xcls_notebook notebook;
+ public Xcls_label_preview label_preview;
+ public Xcls_label_code label_code;
+ public Xcls_view_layout view_layout;
+ public Xcls_container container;
+ public Xcls_sourceviewscroll sourceviewscroll;
+ public Xcls_sourceview sourceview;
+ public Xcls_buffer buffer;
+ public Xcls_search_entry search_entry;
+ public Xcls_search_results search_results;
+ public Xcls_nextBtn nextBtn;
+ public Xcls_backBtn backBtn;
+ public Xcls_search_settings search_settings;
+ public Xcls_case_sensitive case_sensitive;
+ public Xcls_regex regex;
+ public Xcls_multiline multiline;
+
+ // my vars (def)
+ public Gtk.Widget lastObj;
+ public Gtk.CssProvider css;
+ public Xcls_MainWindow main_window;
+ public GtkSource.SearchContext searchcontext;
+ public int last_search_end;
+ public JsRender.JsRender file;
+
+ // ctor
+ public Xcls_GtkView()
+ {
+ _this = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+ this.lastObj = null;
+ this.last_search_end = 0;
+ this.file = null;
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ new Xcls_notebook( _this );
+ this.el.append( _this.notebook.el );
+
+ // init method
+
+ {
+
+ this.css = new Gtk.CssProvider();
+
+ this.css.load_from_string(
+ "#gtkview-view-layout { background-color: #ccc; }"
+ );
+
+ Gtk.StyleContext.add_provider_for_display(
+ this.el.get_display(),
+ this.css,
+ Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
+ );
+
+
+ }
+ }
+
+ // user defined functions
+ public void loadFile (JsRender.JsRender file)
+ {
+ this.file = null;
+
+ if (file.tree == null) {
+ return;
+ }
+ this.notebook.el.page = 0;// gtk preview
+
+
+
+ this.file = file;
+ this.sourceview.loadFile();
+ this.searchcontext = null;
+
+
+ if (this.lastObj != null) {
+ this.container.el.remove(this.lastObj);
+ }
+
+ // hide the compile view at present..
+
+
+ var w = this.el.get_width();
+ var h = this.el.get_height();
+
+ print("ALLOC SET SIZES %d, %d\n", w,h);
+
+ // set the container size min to 500/500 or 20 px less than max..
+ w = int.max (w-20, 500);
+ h = int.max (h-20, 500);
+
+ print("SET SIZES %d, %d\n", w,h);
+ _this.container.el.set_size_request(w,h);
+
+ _this.view_layout.el.set_size_request(w,h);
+ // should be baded on calc.. -- see update_scrolled.
+
+ var fc = this.container.el.get_first_child();
+ if (fc != null) {
+ this.container.el.remove(fc);
+ }
+
+ var xmlstr = JsRender.NodeToGlade.mungeFile( file);
+ var builder = new Gtk.Builder.from_string (xmlstr, xmlstr.length);
+ var obj = (Gtk.Widget) builder.get_object("w"+ file.tree.oid.to_string());
+ this.container.el.append(obj);
+ obj.show();
+ this.createThumb();
+
+
+ return;/*
+ var x = new JsRender.NodeToGtk((Project.Gtk) file.project, file.tree);
+ var obj = x.munge() as Gtk.Widget;
+ this.lastObj = null;
+ if (obj == null) {
+ return;
+ }
+ this.lastObj = obj;
+
+ this.container.el.append(obj);
+ obj.show();
+
+ */
+
+ }
+ public void highlightNodeAtLine (int ln) {
+
+ // this is done from clicking on the editor..
+
+ // highlight node...
+
+
+ var node = _this.file.lineToNode(ln+1);
+
+ if (node == null) {
+ //print("can not find node\n");
+ return;
+ }
+ var prop = node.lineToProp(ln+1);
+ print("prop : %s", prop == null ? "???" : prop.name);
+
+
+ // ---------- this selects the tree's node...
+
+ var ltree = _this.main_window.windowstate.left_tree;
+ ltree.model.selectNode(node);
+ //var tp = ltree.model.treePathFromNode(node);
+
+ //print("got tree path %s\n", tp);
+ //if (tp == "") {
+ // return;
+ //}
+ //_this.sourceview.allow_node_scroll = false; /// block node scrolling..
+
+
+ //print("changing cursor on tree..\n");
+
+
+
+ // let's try allowing editing on the methods.
+ // a little klunky at present..
+ _this.sourceview.prop_selected = "";
+ /*
+ if (prop != null) {
+ //see if we can find it..
+ var kv = prop.split(":");
+ if (kv[0] == "p") {
+
+ //var k = prop.get_key(kv[1]);
+ // fixme -- need to determine if it's an editable property...
+ _this.sourceview.prop_selected = prop;
+
+ } else if (kv[0] == "l") {
+ _this.sourceview.prop_selected = prop;
+
+ }
+ }
+ */
+ //ltree.view.setCursor(tp, "editor");
+ // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false);
+ _this.sourceview.nodeSelected(node,false);
+
+ // scrolling is disabled... as node selection calls scroll 10ms after it changes.
+ // GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
+ // this.allow_node_scroll = true;
+ // return false;
+ // });
+ // }
+
+
+
+
+
+
+
+
+
+
+
+ }
+ public void forwardSearch (bool change_focus) {
+
+ if (this.searchcontext == null) {
+ return;
+ }
+ this.notebook.el.page = 1;
+ Gtk.TextIter beg, st,en;
+ bool has_wrapped_around;
+ var buf = this.sourceview.el.get_buffer();
+ buf.get_iter_at_offset(out beg, this.last_search_end);
+ if (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {
+ this.last_search_end = 0;
+ return;
+ }
+ this.last_search_end = en.get_offset();
+ if (change_focus) {
+ this.sourceview.el.grab_focus();
+ }
+ buf.place_cursor(st);
+
+
+
+ this.sourceview.el.scroll_to_iter(st, 0.0f, true, 0.0f, 0.5f);
+
+
+ var ln = st.get_line();
+
+ this.highlightNodeAtLine(ln);
+ }
+ public void backSearch (bool change_focus) {
+
+ if (this.searchcontext == null) {
+ return;
+ }
+
+ Gtk.TextIter beg, st,en;
+ bool has_wrapped_around;
+ this.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );
+
+ if (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {
+
+ this.last_search_end = 0;
+ return;
+ }
+ this.last_search_end = en.get_offset();
+ if (change_focus) {
+ this.sourceview.el.grab_focus();
+ }
+ this.buffer.el.place_cursor(st);
+ this.sourceview.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);
+ var ln = st.get_line();
+ this.highlightNodeAtLine(ln);
+
+ }
+ public int search (string in_txt) {
+ this.notebook.el.page = 1;
+
+
+
+ var s = new GtkSource.SearchSettings();
+ s.case_sensitive = _this.case_sensitive.el.active;
+ s.regex_enabled = _this.regex.el.active;
+ s.wrap_around = false;
+
+ this.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);
+ this.searchcontext.set_highlight(true);
+ var txt = in_txt;
+
+ if (_this.multiline.el.active) {
+ txt = in_txt.replace("\\n", "\n");
+ }
+
+ s.set_search_text(txt);
+ Gtk.TextIter beg, st,en;
+ bool has_wrapped_around;
+ this.buffer.el.get_start_iter(out beg);
+ this.searchcontext.forward(beg, out st, out en, out has_wrapped_around);
+ this.last_search_end = 0;
+
+ return this.searchcontext.get_occurrences_count();
+
+
+
+
+ }
+ public void createThumb () {
+
+
+ if (this.file == null) {
+ return;
+ }
+ // only screenshot the gtk preview..
+ if (this.notebook.el.page > 0 ) {
+ return;
+ }
+
+
+ this.file.widgetToIcon(this.container.el);
+
+
+ return;
+
+
+
+
+
+ // should we hold until it's printed...
+
+
+
+
+ }
+ public void updateErrorMarks (string category) {
+
+
+
+ var buf = _this.buffer.el;
+ Gtk.TextIter start;
+ Gtk.TextIter end;
+ buf.get_bounds (out start, out end);
+
+ buf.remove_source_marks (start, end, category);
+
+ GLib.debug("highlight errors");
+
+ // we should highlight other types of errors..
+
+
+
+
+ if (_this.file == null) {
+ GLib.debug("file is null?");
+ return;
+
+ }
+ var ar = this.file.getErrors(category);
+ if (ar == null || ar.get_n_items() < 1) {
+ GLib.debug("higjlight %s has no errors", category);
+ return;
+ }
+
+
+
+
+ var offset = 0;
+
+
+ var tlines = buf.get_line_count () +1;
+
+
+
+ for (var i = 0; i < ar.get_n_items();i++) {
+ var err = (Palete.CompileError) ar.get_item(i);
+
+ Gtk.TextIter iter;
+ // print("get inter\n");
+ var eline = err.line - offset;
+ GLib.debug("GOT ERROR on line %d -- converted to %d (offset = %d)",
+ err.line ,eline, offset);
+
+
+ if (eline > tlines || eline < 0) {
+ return;
+ }
+
+
+ buf.get_iter_at_line( out iter, eline);
+
+
+ var msg = "Line: %d %s : %s".printf(eline+1, err.category, err.msg);
+ buf.create_source_mark( msg, err.category, iter);
+ GLib.debug("set line %d to %s", eline, msg);
+ //this.marks.set(eline, msg);
+ }
+ return ;
+
+
+
+
+
+ }
+ public void scroll_to_line (int line) {
+ // code preview...
+
+ GLib.Timeout.add(100, () => {
+
+
+ this.notebook.el.set_current_page(1);
+
+ var buf = this.sourceview.el.get_buffer();
+
+ var sbuf = (GtkSource.Buffer) buf;
+
+
+ Gtk.TextIter iter;
+ sbuf.get_iter_at_line(out iter, line);
+ this.sourceview.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
+ return false;
+ });
+
+
+ }
+ public class Xcls_notebook : Object
+ {
+ public Gtk.Notebook el;
+ private Xcls_GtkView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_notebook(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.notebook = this;
+ this.el = new Gtk.Notebook();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.overflow = Gtk.Overflow.VISIBLE;
+ new Xcls_label_preview( _this );
+ new Xcls_label_code( _this );
+ var child_3 = new Xcls_ScrolledWindow5( _this );
+ child_3.ref();
+ this.el.append_page ( child_3.el , _this.label_preview.el );
+ var child_4 = new Xcls_Box8( _this );
+ child_4.ref();
+ this.el.append_page ( child_4.el , _this.label_code.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_label_preview : Object
+ {
+ public Gtk.Label el;
+ private Xcls_GtkView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_label_preview(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.label_preview = this;
+ this.el = new Gtk.Label( "Preview" );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_label_code : Object
+ {
+ public Gtk.Label el;
+ private Xcls_GtkView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_label_code(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.label_code = this;
+ this.el = new Gtk.Label( "Preview Generated Code" );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_ScrolledWindow5 : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private Xcls_GtkView _this;
+
+
+ // my vars (def)
- // ctor
- public Xcls_ScrolledWindow5(Xcls_GtkView _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow();
+ // ctor
+ public Xcls_ScrolledWindow5(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.ScrolledWindow();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- new Xcls_view_layout( _this );
- this.el.set_child ( _this.view_layout.el );
- }
+ // set gobject values
+ new Xcls_view_layout( _this );
+ this.el.set_child ( _this.view_layout.el );
+ }
- // user defined functions
- }
- public class Xcls_view_layout : Object
- {
- public Gtk.Fixed el;
- private Xcls_GtkView _this;
+ // user defined functions
+ }
+ public class Xcls_view_layout : Object
+ {
+ public Gtk.Fixed el;
+ private Xcls_GtkView _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_view_layout(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.view_layout = this;
- this.el = new Gtk.Fixed();
+ // ctor
+ public Xcls_view_layout(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.view_layout = this;
+ this.el = new Gtk.Fixed();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.name = "gtkview-view-layout";
- new Xcls_container( _this );
- this.el.put ( _this.container.el , 10,10 );
- }
+ // set gobject values
+ this.el.name = "gtkview-view-layout";
+ new Xcls_container( _this );
+ this.el.put ( _this.container.el , 10,10 );
+ }
- // user defined functions
- }
- public class Xcls_container : Object
- {
- public Gtk.Box el;
- private Xcls_GtkView _this;
+ // user defined functions
+ }
+ public class Xcls_container : Object
+ {
+ public Gtk.Box el;
+ private Xcls_GtkView _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_container(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.container = this;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+ // ctor
+ public Xcls_container(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.container = this;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ }
- // user defined functions
- }
+ // user defined functions
+ }
- public class Xcls_Box8 : Object
- {
- public Gtk.Box el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box8(Xcls_GtkView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- new Xcls_sourceviewscroll( _this );
- this.el.append( _this.sourceviewscroll.el );
- var child_2 = new Xcls_Box13( _this );
- child_2.ref();
- this.el.append( child_2.el );
- }
-
- // user defined functions
- }
- public class Xcls_sourceviewscroll : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_sourceviewscroll(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.sourceviewscroll = this;
- this.el = new Gtk.ScrolledWindow();
-
- // my vars (dec)
-
- // set gobject values
- this.el.vexpand = true;
- new Xcls_sourceview( _this );
- this.el.set_child ( _this.sourceview.el );
- }
-
- // user defined functions
- }
- public class Xcls_sourceview : Object
- {
- public GtkSource.View el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
- public bool loading;
- public bool zallow_node_scroll;
- public string prop_selected;
- public Gtk.CssProvider css;
- public JsRender.Node? node_selected;
-
- // ctor
- public Xcls_sourceview(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.sourceview = this;
- this.el = new GtkSource.View();
-
- // my vars (dec)
- this.loading = false;
- this.zallow_node_scroll = true;
- this.prop_selected = "";
-
- // set gobject values
- this.el.name = "gtkview-view";
- this.el.editable = false;
- this.el.show_line_marks = true;
- this.el.show_line_numbers = true;
- this.el.tab_width = 4;
- new Xcls_buffer( _this );
- this.el.set_buffer ( _this.buffer.el );
- var child_2 = new Xcls_EventControllerKey12( _this );
- child_2.ref();
- this.el.add_controller( child_2.el );
-
- // init method
-
- {
-
-
- this.css = new Gtk.CssProvider();
-
- this.css.load_from_string("#gtkview-view { font: 10px monospace ;}");
-
- Gtk.StyleContext.add_provider_for_display(
- this.el.get_display(),
- this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
- );
-
-
- this.loading = true;
-
-
-
- var attrs = new GtkSource.MarkAttributes();
- var pink = Gdk.RGBA();
- pink.parse ( "pink");
- attrs.set_background ( pink);
- attrs.set_icon_name ( "process-stop");
- attrs.query_tooltip_text.connect(( mark) => {
- //print("tooltip query? %s\n", mark.name);
- return mark.name;
- });
-
- this.el.set_mark_attributes ("ERR", attrs, 1);
-
- var wattrs = new GtkSource.MarkAttributes();
- var blue = Gdk.RGBA();
- blue.parse ( "#ABF4EB");
- wattrs.set_background ( blue);
- wattrs.set_icon_name ( "process-stop");
- wattrs.query_tooltip_text.connect(( mark) => {
- //print("tooltip query? %s\n", mark.name);
- return mark.name;
- });
-
- this.el.set_mark_attributes ("WARN", wattrs, 1);
-
-
-
- var dattrs = new GtkSource.MarkAttributes();
- var purple = Gdk.RGBA();
- purple.parse ( "#EEA9FF");
- dattrs.set_background ( purple);
- dattrs.set_icon_name ( "process-stop");
- dattrs.query_tooltip_text.connect(( mark) => {
- //print("tooltip query? %s\n", mark.name);
- return mark.name;
- });
-
- this.el.set_mark_attributes ("DEPR", dattrs, 1);
-
-
- var gattrs = new GtkSource.MarkAttributes();
- var grey = Gdk.RGBA();
- grey.parse ( "#ccc");
- gattrs.set_background ( grey);
-
-
- this.el.set_mark_attributes ("grey", gattrs, 1);
-
-
-
-
-
-
- }
-
- //listeners
- this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
-
- //GLib.debug("query tooltip");
- Gtk.TextIter iter;
- int trailing;
-
- var yoff = (int) _this.sourceviewscroll.el.vadjustment.value;
-
- this.el.get_iter_at_position (out iter, out trailing, x, y + yoff);
-
- var l = iter.get_line();
- // GLib.debug("query tooltip line %d", (int) l);
- var marks = _this.buffer.el.get_source_marks_at_line(l, "ERR");
- if (marks.is_empty()) {
- marks = _this.buffer.el.get_source_marks_at_line(l, "WARN");
- }
- if (marks.is_empty()) {
- marks = _this.buffer.el.get_source_marks_at_line(l, "DEPR");
- }
-
- // GLib.debug("query tooltip line marks %d", (int) marks.length());
- var str = "";
- marks.@foreach((m) => {
- //GLib.debug("got mark %s", m.name);
- str += (str.length > 0 ? "\n" : "") + m.name;
- });
-
- // true if there is a mark..
- tooltip.set_text( str);
- return str.length > 0 ? true : false;
-
- });
- }
-
- // user defined functions
- public void loadFile ( ) {
- this.loading = true;
- var buf = this.el.get_buffer();
- buf.set_text("",0);
- var sbuf = (GtkSource.Buffer) buf;
- var cpos = buf.cursor_position;
-
- print("BEFORE LOAD cursor = %d\n", cpos);
- var vadj_pos = this.el.get_vadjustment().get_value();
-
- if (_this.file == null || _this.file.xtype != "Gtk") {
- print("xtype != Gtk");
- this.loading = false;
- return;
- }
-
- var valafn = "";
- try {
- var regex = new Regex("\\.bjs$");
-
-
- valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
- } catch (GLib.RegexError e) {
- this.loading = false;
- return;
- }
-
-
- if (!FileUtils.test(valafn,FileTest.IS_REGULAR) ) {
- print("File path has no errors\n");
- this.loading = false;
- return ;
- }
-
- string str;
- try {
-
- GLib.FileUtils.get_contents (valafn, out str);
- } catch (Error e) {
- this.loading = false;
- return ;
- }
-
- // print("setting str %d\n", str.length);
- buf.set_text(str, str.length);
- var lm = GtkSource.LanguageManager.get_default();
-
- //?? is javascript going to work as js?
-
- ((GtkSource.Buffer)(buf)) .set_language(lm.get_language(_this.file.language));
-
-
- _this.main_window.windowstate.updateErrorMarksAll();
- // restore the cursor position?
- // after reloading the contents.
- GLib.Timeout.add(500, () => {
- _this.buffer.in_cursor_change = true;
- print("RESORTING cursor to = %d\n", cpos);
- Gtk.TextIter cpos_iter;
- buf.get_iter_at_offset(out cpos_iter, cpos);
- buf.place_cursor(cpos_iter);
-
- this.el.get_vadjustment().set_value(vadj_pos);;
- _this.buffer.in_cursor_change = false;
-
-
-
- //_this.buffer.checkSyntax();
- return false;
- });
-
-
- this.loading = false;
- }
- public void nodeSelected (JsRender.Node? sel, bool scroll) {
-
-
- if (this.loading) {
- return;
- }
- // this is connected in widnowstate
- print("Roo-view - node selected\n");
- var buf = this.el.get_buffer();
-
- var sbuf = (GtkSource.Buffer) buf;
-
-
-
-
-
- // clear all the marks..
- Gtk.TextIter start;
- Gtk.TextIter end;
-
- sbuf.get_bounds (out start, out end);
- sbuf.remove_source_marks (start, end, "grey");
-
- this.node_selected = sel;
- if (sel == null) {
- // no highlighting..
- return;
- }
- Gtk.TextIter iter;
- sbuf.get_iter_at_line(out iter, sel.line_start);
-
-
- Gtk.TextIter cur_iter;
- sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);
-
-
- if (!_this.buffer.in_cursor_change) {
-
- this.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
- }
-
-
-
- for (var i = 0; i < buf.get_line_count();i++) {
- if (i < sel.line_start || i > sel.line_end) {
-
- sbuf.get_iter_at_line(out iter, i);
- sbuf.create_source_mark(null, "grey", iter);
-
- }
-
- }
-
-
- }
- 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 class Xcls_buffer : Object
- {
- public GtkSource.Buffer el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
- public int error_line;
- public bool in_cursor_change;
- public bool dirty;
- public int last_line;
-
- // ctor
- public Xcls_buffer(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.buffer = this;
- this.el = new GtkSource.Buffer( null );
-
- // my vars (dec)
- this.error_line = -1;
- this.in_cursor_change = false;
- this.dirty = false;
- this.last_line = -1;
-
- // set gobject values
-
- //listeners
- this.el.cursor_moved.connect( ( ) => {
- GLib.debug("cursor moved called");
-
-
- if (this.in_cursor_change ) {
- GLib.debug("cursor changed : %d [ignoring nested call)", this.el.cursor_position);
- return;
- }
-
- GLib.debug("cursor changed : %d", this.el.cursor_position);
- Gtk.TextIter cpos;
- this.el.get_iter_at_offset(out cpos, this.el.cursor_position);
-
- var ln = cpos.get_line();
- if (this.last_line == ln ){
- return;
- }
- this.last_line = ln;
- var node = _this.file.lineToNode(ln);
-
- if (node == null) {
- print("can not find node\n");
- return;
- }
- this.in_cursor_change = true;
- var ltree = _this.main_window.windowstate.left_tree;
- ltree.model.selectNode(node);
- this.in_cursor_change = false;
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_EventControllerKey12 : Object
- {
- public Gtk.EventControllerKey el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_EventControllerKey12(Xcls_GtkView _owner )
- {
- _this = _owner;
- this.el = new Gtk.EventControllerKey();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.key_pressed.connect( (keyval, keycode, state) => {
-
-
-
- if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-g pressed");
- _this.forwardSearch(true);
- return true;
- }
- if (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-f pressed");
- _this.search_entry.el.grab_focus();
- return true;
- }
-
- return false;
- });
- }
-
- // user defined functions
- }
-
-
-
- public class Xcls_Box13 : Object
- {
- public Gtk.Box el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box13(Xcls_GtkView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- this.el.vexpand = false;
- new Xcls_search_entry( _this );
- this.el.append( _this.search_entry.el );
- new Xcls_search_results( _this );
- this.el.append( _this.search_results.el );
- new Xcls_nextBtn( _this );
- this.el.append( _this.nextBtn.el );
- new Xcls_backBtn( _this );
- this.el.append( _this.backBtn.el );
- var child_5 = new Xcls_MenuButton19( _this );
- child_5.ref();
- this.el.append( child_5.el );
- }
-
- // user defined functions
- }
- public class Xcls_search_entry : Object
- {
- public Gtk.SearchEntry el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
- public Gtk.CssProvider css;
-
- // ctor
- public Xcls_search_entry(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.search_entry = this;
- this.el = new Gtk.SearchEntry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.name = "gtkview-search-entry";
- this.el.hexpand = true;
- this.el.placeholder_text = "Press enter to search";
- this.el.search_delay = 3;
- var child_1 = new Xcls_EventControllerKey15( _this );
- child_1.ref();
- this.el.add_controller( child_1.el );
-
- // init method
-
- this.css = new Gtk.CssProvider();
-
- this.css.load_from_string("
- #gtkview-search-entry { font: 10px monospace ;}"
- );
-
- Gtk.StyleContext.add_provider_for_display(
- this.el.get_display(),
- this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
- );
-
- //listeners
- this.el.search_changed.connect( () => {
-
- _this.search(_this.search_entry.el.text);
- _this.search_results.updateResults();
-
- GLib.Timeout.add_seconds(1,() => {
- _this.search_results.updateResults();
- return false;
- });
-
-
-
- });
- }
-
- // user defined functions
- public void forwardSearch (bool change_focus) {
-
-
- _this.forwardSearch(change_focus);
-
- /*
-
- switch(_this.windowstate.state) {
- case WindowState.State.CODEONLY:
- //case WindowState.State.CODE:
- // search the code being edited..
- _this.windowstate.code_editor_tab.forwardSearch(change_focus);
-
- break;
- case WindowState.State.PREVIEW:
- if (_this.windowstate.file.xtype == "Gtk") {
- _this.windowstate.window_gladeview.forwardSearch(change_focus);
- } else {
- _this.windowstate.window_rooview.forwardSearch(change_focus);
- }
-
- break;
- }
- */
-
- }
- }
- public class Xcls_EventControllerKey15 : Object
- {
- public Gtk.EventControllerKey el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_EventControllerKey15(Xcls_GtkView _owner )
- {
- _this = _owner;
- this.el = new Gtk.EventControllerKey();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.key_pressed.connect( (keyval, keycode, state) => {
-
- if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-g pressed");
- _this.forwardSearch(true);
- return true;
- }
-
-
- if (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {
- _this.forwardSearch(true);
-
-
- return true;
-
- }
- // print(event.key.keyval)
-
- return false;
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_search_results : Object
- {
- public Gtk.Label el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_search_results(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.search_results = this;
- this.el = new Gtk.Label( "No Results" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.margin_end = 4;
- this.el.margin_start = 4;
- }
-
- // user defined functions
- public void updateResults () {
- this.el.visible = true;
-
- var res = _this.searchcontext.get_occurrences_count();
- if (res < 0) {
- _this.search_results.el.label = "??? Matches";
- return;
- }
-
- _this.nextBtn.el.sensitive = false;
- _this.backBtn.el.sensitive = false;
-
- if (res > 0) {
- _this.search_results.el.label = "%d Matches".printf(res);
- _this.nextBtn.el.sensitive = true;
- _this.backBtn.el.sensitive = true;
- return;
- }
- _this.search_results.el.label = "No Matches";
-
- }
- }
-
- public class Xcls_nextBtn : Object
- {
- public Gtk.Button el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
- public bool always_show_image;
-
- // ctor
- public Xcls_nextBtn(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.nextBtn = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
- this.always_show_image = true;
-
- // set gobject values
- this.el.icon_name = "go-down";
- this.el.sensitive = false;
-
- //listeners
- this.el.clicked.connect( ( ) => {
- _this.forwardSearch(true);
-
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_backBtn : Object
- {
- public Gtk.Button el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
- public bool always_show_image;
-
- // ctor
- public Xcls_backBtn(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.backBtn = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
- this.always_show_image = true;
-
- // set gobject values
- this.el.icon_name = "go-up";
- this.el.sensitive = false;
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
- _this.backSearch(true);
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_MenuButton19 : Object
- {
- public Gtk.MenuButton el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
- public bool always_show_image;
-
- // ctor
- public Xcls_MenuButton19(Xcls_GtkView _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuButton();
-
- // my vars (dec)
- this.always_show_image = true;
-
- // set gobject values
- this.el.icon_name = "emblem-system";
- this.el.always_show_arrow = true;
- new Xcls_search_settings( _this );
- this.el.popover = _this.search_settings.el;
- }
-
- // user defined functions
- }
- public class Xcls_search_settings : Object
- {
- public Gtk.PopoverMenu el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
+ public class Xcls_Box8 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_GtkView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box8(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ new Xcls_sourceviewscroll( _this );
+ this.el.append( _this.sourceviewscroll.el );
+ var child_2 = new Xcls_Box13( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_sourceviewscroll : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private Xcls_GtkView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_sourceviewscroll(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.sourceviewscroll = this;
+ this.el = new Gtk.ScrolledWindow();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.vexpand = true;
+ new Xcls_sourceview( _this );
+ this.el.set_child ( _this.sourceview.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_sourceview : Object
+ {
+ public GtkSource.View el;
+ private Xcls_GtkView _this;
+
+
+ // my vars (def)
+ public bool loading;
+ public string prop_selected;
+ public bool allow_node_scroll;
+ public Gtk.CssProvider css;
+ public JsRender.Node? node_selected;
+
+ // ctor
+ public Xcls_sourceview(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.sourceview = this;
+ this.el = new GtkSource.View();
+
+ // my vars (dec)
+ this.loading = true;
+ this.prop_selected = "";
+ this.allow_node_scroll = true;
+
+ // set gobject values
+ this.el.name = "gtkview-view";
+ this.el.editable = false;
+ this.el.show_line_marks = true;
+ this.el.show_line_numbers = true;
+ new Xcls_buffer( _this );
+ this.el.set_buffer ( _this.buffer.el );
+ var child_2 = new Xcls_EventControllerKey12( _this );
+ child_2.ref();
+ this.el.add_controller( child_2.el );
+
+ // init method
+
+ {
+
+
+ this.css = new Gtk.CssProvider();
+
+ this.css.load_from_string("#gtkview-view { font: 10px monospace ;}");
+
+ Gtk.StyleContext.add_provider_for_display(
+ this.el.get_display(),
+ this.css,
+ Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
+ );
+
+
+ this.loading = true;
+
+
+
+ var attrs = new GtkSource.MarkAttributes();
+ var pink = Gdk.RGBA();
+ pink.parse ( "pink");
+ attrs.set_background ( pink);
+ attrs.set_icon_name ( "process-stop");
+ attrs.query_tooltip_text.connect(( mark) => {
+ //print("tooltip query? %s\n", mark.name);
+ return mark.name;
+ });
+
+ this.el.set_mark_attributes ("ERR", attrs, 1);
+
+ var wattrs = new GtkSource.MarkAttributes();
+ var blue = Gdk.RGBA();
+ blue.parse ( "#ABF4EB");
+ wattrs.set_background ( blue);
+ wattrs.set_icon_name ( "process-stop");
+ wattrs.query_tooltip_text.connect(( mark) => {
+ //print("tooltip query? %s\n", mark.name);
+ return mark.name;
+ });
+
+ this.el.set_mark_attributes ("WARN", wattrs, 1);
+
+
+
+ var dattrs = new GtkSource.MarkAttributes();
+ var purple = Gdk.RGBA();
+ purple.parse ( "#EEA9FF");
+ dattrs.set_background ( purple);
+ dattrs.set_icon_name ( "process-stop");
+ dattrs.query_tooltip_text.connect(( mark) => {
+ //print("tooltip query? %s\n", mark.name);
+ return mark.name;
+ });
+
+ this.el.set_mark_attributes ("DEPR", dattrs, 1);
+
+
+ var gattrs = new GtkSource.MarkAttributes();
+ var grey = Gdk.RGBA();
+ grey.parse ( "#ccc");
+ gattrs.set_background ( grey);
+
+
+ this.el.set_mark_attributes ("grey", gattrs, 1);
+
+
+
+
+
+
+ }
+
+ //listeners
+ this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
+
+ //GLib.debug("query tooltip");
+ Gtk.TextIter iter;
+ int trailing;
+
+ var yoff = (int) _this.sourceviewscroll.el.vadjustment.value;
+
+ this.el.get_iter_at_position (out iter, out trailing, x, y + yoff);
+
+ var l = iter.get_line();
+ // GLib.debug("query tooltip line %d", (int) l);
+ var marks = _this.buffer.el.get_source_marks_at_line(l, "ERR");
+ if (marks.is_empty()) {
+ marks = _this.buffer.el.get_source_marks_at_line(l, "WARN");
+ }
+ if (marks.is_empty()) {
+ marks = _this.buffer.el.get_source_marks_at_line(l, "DEPR");
+ }
+
+ // GLib.debug("query tooltip line marks %d", (int) marks.length());
+ var str = "";
+ marks.@foreach((m) => {
+ //GLib.debug("got mark %s", m.name);
+ str += (str.length > 0 ? "\n" : "") + m.name;
+ });
+
+ // true if there is a mark..
+ tooltip.set_text( str);
+ return str.length > 0 ? true : false;
+
+ });
+ }
+
+ // user defined functions
+ public void loadFile ( ) {
+ this.loading = true;
+ var buf = this.el.get_buffer();
+ buf.set_text("",0);
+ var sbuf = (GtkSource.Buffer) buf;
+
+
+
+ if (_this.file == null || _this.file.xtype != "Gtk") {
+ print("xtype != Gtk");
+ this.loading = false;
+ return;
+ }
+
+ var valafn = "";
+ try {
+ var regex = new Regex("\\.bjs$");
+
+
+ valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
+ } catch (GLib.RegexError e) {
+ this.loading = false;
+ return;
+ }
+
+
+ if (!FileUtils.test(valafn,FileTest.IS_REGULAR) ) {
+ print("File path has no errors\n");
+ this.loading = false;
+ return ;
+ }
+
+ string str;
+ try {
+
+ GLib.FileUtils.get_contents (valafn, out str);
+ } catch (Error e) {
+ this.loading = false;
+ return ;
+ }
+
+ // print("setting str %d\n", str.length);
+ buf.set_text(str, str.length);
+ var lm = GtkSource.LanguageManager.get_default();
+
+ //?? is javascript going to work as js?
+
+ ((GtkSource.Buffer)(buf)) .set_language(lm.get_language(_this.file.language));
+
+
+ _this.main_window.windowstate.updateErrorMarksAll();
+
+
+
+ this.loading = false;
+ }
+ public void nodeSelected (JsRender.Node? sel, bool scroll) {
+
+
+ if (this.loading) {
+ return;
+ }
+ // this is connected in widnowstate
+ print("Roo-view - node selected\n");
+ var buf = this.el.get_buffer();
+
+ var sbuf = (GtkSource.Buffer) buf;
+
+
+ // while(Gtk.events_pending()) {
+ // Gtk.main_iteration();
+ // }
+
+
+ // clear all the marks..
+ Gtk.TextIter start;
+ Gtk.TextIter end;
+
+ sbuf.get_bounds (out start, out end);
+ sbuf.remove_source_marks (start, end, "grey");
+
+ this.node_selected = sel;
+ if (sel == null) {
+ // no highlighting..
+ return;
+ }
+ Gtk.TextIter iter;
+ sbuf.get_iter_at_line(out iter, sel.line_start);
+
+
+ Gtk.TextIter cur_iter;
+ sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);
+
+ //var cur_line = cur_iter.get_line();
+ //if (cur_line > sel.line_start && cur_line < sel.line_end) {
+
+ //} else {
+ if (this.allow_node_scroll) {
+
+ this.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
+ }
+
+
+
+ for (var i = 0; i < buf.get_line_count();i++) {
+ if (i < sel.line_start || i > sel.line_end) {
+
+ sbuf.get_iter_at_line(out iter, i);
+ sbuf.create_source_mark(null, "grey", iter);
+
+ }
+
+ }
+
+
+ }
+ 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 class Xcls_buffer : Object
+ {
+ public GtkSource.Buffer el;
+ private Xcls_GtkView _this;
+
+
+ // my vars (def)
+ public int error_line;
+ public bool dirty;
+
+ // ctor
+ public Xcls_buffer(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.buffer = this;
+ this.el = new GtkSource.Buffer( null );
+
+ // my vars (dec)
+ this.error_line = -1;
+ this.dirty = false;
+
+ // set gobject values
+
+ //listeners
+ this.el.notify["cursor_position"].connect( () => {
+
+
+ if (_this.sourceview.loading) {
+ return;
+ }
+
+ GLib.debug("cursor changed : %d", this.el.cursor_position);
+ Gtk.TextIter cpos;
+ this.el.get_iter_at_offset(out cpos, this.el.cursor_position);
+
+ var ln = cpos.get_line();
+
+ var node = _this.file.lineToNode(ln);
+
+ if (node == null) {
+ print("can not find node\n");
+ return;
+ }
+ _this.sourceview.loading = true;
+ var ltree = _this.main_window.windowstate.left_tree;
+ ltree.model.selectNode(node);
+ _this.sourceview.loading = false;
+
+ //print("got tree path %s\n", tp);
+ //if (tp != "") {
+ // this.allow_node_scroll = false;
+ // print("changing cursor on tree..\n");
+ //ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false);
+ // scrolling is disabled... as node selection calls scroll 10ms after it changes.
+ ///GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
+ // this.allow_node_scroll = true;
+ // return false;
+ // });
+ // }
+
+ // highlight the node..
+
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_EventControllerKey12 : Object
+ {
+ public Gtk.EventControllerKey el;
+ private Xcls_GtkView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_EventControllerKey12(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.EventControllerKey();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.key_pressed.connect( (keyval, keycode, state) => {
+
+
+
+ if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
+ GLib.debug("SAVE: ctrl-g pressed");
+ _this.forwardSearch(true);
+ return true;
+ }
+ if (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
+ GLib.debug("SAVE: ctrl-f pressed");
+ _this.search_entry.el.grab_focus();
+ return true;
+ }
+
+ return false;
+ });
+ }
+
+ // user defined functions
+ }
+
+
+
+ public class Xcls_Box13 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_GtkView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box13(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.homogeneous = false;
+ this.el.vexpand = false;
+ new Xcls_search_entry( _this );
+ this.el.append( _this.search_entry.el );
+ new Xcls_search_results( _this );
+ this.el.append( _this.search_results.el );
+ new Xcls_nextBtn( _this );
+ this.el.append( _this.nextBtn.el );
+ new Xcls_backBtn( _this );
+ this.el.append( _this.backBtn.el );
+ var child_5 = new Xcls_MenuButton19( _this );
+ child_5.ref();
+ this.el.append( child_5.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_search_entry : Object
+ {
+ public Gtk.SearchEntry el;
+ private Xcls_GtkView _this;
+
+
+ // my vars (def)
+ public Gtk.CssProvider css;
+
+ // ctor
+ public Xcls_search_entry(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.search_entry = this;
+ this.el = new Gtk.SearchEntry();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.name = "gtkview-search-entry";
+ this.el.hexpand = true;
+ this.el.placeholder_text = "Press enter to search";
+ this.el.search_delay = 3;
+ var child_1 = new Xcls_EventControllerKey15( _this );
+ child_1.ref();
+ this.el.add_controller( child_1.el );
+
+ // init method
+
+ this.css = new Gtk.CssProvider();
+
+ this.css.load_from_string("
+ #gtkview-search-entry { font: 10px monospace ;}"
+ );
+
+ Gtk.StyleContext.add_provider_for_display(
+ this.el.get_display(),
+ this.css,
+ Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
+ );
+
+ //listeners
+ this.el.search_changed.connect( () => {
+
+ _this.search(_this.search_entry.el.text);
+ _this.search_results.updateResults();
+
+ GLib.Timeout.add_seconds(1,() => {
+ _this.search_results.updateResults();
+ return false;
+ });
+
+
+
+ });
+ }
+
+ // user defined functions
+ public void forwardSearch (bool change_focus) {
+
+
+ _this.forwardSearch(change_focus);
+
+ /*
+
+ switch(_this.windowstate.state) {
+ case WindowState.State.CODEONLY:
+ //case WindowState.State.CODE:
+ // search the code being edited..
+ _this.windowstate.code_editor_tab.forwardSearch(change_focus);
+
+ break;
+ case WindowState.State.PREVIEW:
+ if (_this.windowstate.file.xtype == "Gtk") {
+ _this.windowstate.window_gladeview.forwardSearch(change_focus);
+ } else {
+ _this.windowstate.window_rooview.forwardSearch(change_focus);
+ }
+
+ break;
+ }
+ */
+
+ }
+ }
+ public class Xcls_EventControllerKey15 : Object
+ {
+ public Gtk.EventControllerKey el;
+ private Xcls_GtkView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_EventControllerKey15(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.EventControllerKey();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.key_pressed.connect( (keyval, keycode, state) => {
+
+ if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
+ GLib.debug("SAVE: ctrl-g pressed");
+ _this.forwardSearch(true);
+ return true;
+ }
+
+
+ if (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {
+ _this.forwardSearch(true);
+
+
+ return true;
+
+ }
+ // print(event.key.keyval)
+
+ return false;
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_search_results : Object
+ {
+ public Gtk.Label el;
+ private Xcls_GtkView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_search_results(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.search_results = this;
+ this.el = new Gtk.Label( "No Results" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.margin_end = 4;
+ this.el.margin_start = 4;
+ }
+
+ // user defined functions
+ public void updateResults () {
+ this.el.visible = true;
+
+ var res = _this.searchcontext.get_occurrences_count();
+ if (res < 0) {
+ _this.search_results.el.label = "??? Matches";
+ return;
+ }
+
+ _this.nextBtn.el.sensitive = false;
+ _this.backBtn.el.sensitive = false;
+
+ if (res > 0) {
+ _this.search_results.el.label = "%d Matches".printf(res);
+ _this.nextBtn.el.sensitive = true;
+ _this.backBtn.el.sensitive = true;
+ return;
+ }
+ _this.search_results.el.label = "No Matches";
+
+ }
+ }
+
+ public class Xcls_nextBtn : Object
+ {
+ public Gtk.Button el;
+ private Xcls_GtkView _this;
+
+
+ // my vars (def)
+ public bool always_show_image;
+
+ // ctor
+ public Xcls_nextBtn(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.nextBtn = this;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+ this.always_show_image = true;
+
+ // set gobject values
+ this.el.icon_name = "go-down";
+ this.el.sensitive = false;
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+ _this.forwardSearch(true);
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_backBtn : Object
+ {
+ public Gtk.Button el;
+ private Xcls_GtkView _this;
+
+
+ // my vars (def)
+ public bool always_show_image;
+
+ // ctor
+ public Xcls_backBtn(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.backBtn = this;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+ this.always_show_image = true;
+
+ // set gobject values
+ this.el.icon_name = "go-up";
+ this.el.sensitive = false;
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ _this.backSearch(true);
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_MenuButton19 : Object
+ {
+ public Gtk.MenuButton el;
+ private Xcls_GtkView _this;
+
+
+ // my vars (def)
+ public bool always_show_image;
+
+ // ctor
+ public Xcls_MenuButton19(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.MenuButton();
+
+ // my vars (dec)
+ this.always_show_image = true;
+
+ // set gobject values
+ this.el.icon_name = "emblem-system";
+ this.el.always_show_arrow = true;
+ new Xcls_search_settings( _this );
+ this.el.popover = _this.search_settings.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_search_settings : Object
+ {
+ public Gtk.PopoverMenu el;
+ private Xcls_GtkView _this;
+
+
+ // my vars (def)
- // ctor
- public Xcls_search_settings(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.search_settings = this;
- this.el = new Gtk.PopoverMenu.from_model(null);
-
- // my vars (dec)
+ // ctor
+ public Xcls_search_settings(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.search_settings = this;
+ this.el = new Gtk.PopoverMenu.from_model(null);
+
+ // my vars (dec)
- // set gobject values
- var child_1 = new Xcls_Box21( _this );
- child_1.ref();
- this.el.set_child ( child_1.el );
- }
+ // set gobject values
+ var child_1 = new Xcls_Box21( _this );
+ child_1.ref();
+ this.el.set_child ( child_1.el );
+ }
- // user defined functions
- }
- public class Xcls_Box21 : Object
- {
- public Gtk.Box el;
- private Xcls_GtkView _this;
+ // user defined functions
+ }
+ public class Xcls_Box21 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_GtkView _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Box21(Xcls_GtkView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ // ctor
+ public Xcls_Box21(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- new Xcls_case_sensitive( _this );
- this.el.append( _this.case_sensitive.el );
- new Xcls_regex( _this );
- this.el.append( _this.regex.el );
- new Xcls_multiline( _this );
- this.el.append( _this.multiline.el );
- }
+ // set gobject values
+ new Xcls_case_sensitive( _this );
+ this.el.append( _this.case_sensitive.el );
+ new Xcls_regex( _this );
+ this.el.append( _this.regex.el );
+ new Xcls_multiline( _this );
+ this.el.append( _this.multiline.el );
+ }
- // user defined functions
- }
- public class Xcls_case_sensitive : Object
- {
- public Gtk.CheckButton el;
- private Xcls_GtkView _this;
+ // user defined functions
+ }
+ public class Xcls_case_sensitive : Object
+ {
+ public Gtk.CheckButton el;
+ private Xcls_GtkView _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_case_sensitive(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.case_sensitive = this;
- this.el = new Gtk.CheckButton();
+ // ctor
+ public Xcls_case_sensitive(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.case_sensitive = this;
+ this.el = new Gtk.CheckButton();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.label = "Case Sensitive";
- }
+ // set gobject values
+ this.el.label = "Case Sensitive";
+ }
- // user defined functions
- }
+ // user defined functions
+ }
- public class Xcls_regex : Object
- {
- public Gtk.CheckButton el;
- private Xcls_GtkView _this;
+ public class Xcls_regex : Object
+ {
+ public Gtk.CheckButton el;
+ private Xcls_GtkView _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_regex(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.regex = this;
- this.el = new Gtk.CheckButton();
+ // ctor
+ public Xcls_regex(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.regex = this;
+ this.el = new Gtk.CheckButton();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.label = "Regex";
- }
+ // set gobject values
+ this.el.label = "Regex";
+ }
- // user defined functions
- }
+ // user defined functions
+ }
- public class Xcls_multiline : Object
- {
- public Gtk.CheckButton el;
- private Xcls_GtkView _this;
+ public class Xcls_multiline : Object
+ {
+ public Gtk.CheckButton el;
+ private Xcls_GtkView _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_multiline(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.multiline = this;
- this.el = new Gtk.CheckButton();
+ // ctor
+ public Xcls_multiline(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.multiline = this;
+ this.el = new Gtk.CheckButton();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.label = "Multi-line (add \\n)";
- }
+ // set gobject values
+ this.el.label = "Multi-line (add \\n)";
+ }
- // user defined functions
- }
+ // user defined functions
+ }
-}
+ }
"xtype" : "Button",
"| void setNotices" : [
"(GLib.ListStore nots, GLib.ListStore fe ) {",
- " BuilderApplication.showSpinner(\"\");",
+ " ",
" if (nots.get_n_items() < 1 ) {",
" \tthis.el.hide();",
" \tif (this.popup != null) {",
" // this.popup.el.set_transient_for( _this.el );",
" this.popup.el.set_parent(this.el);",
" }",
- " ",
"\tthis.popup.updateNotices(nots);",
"\t ",
"}",
},
{
"$ xns" : "Gtk",
- "Palete.ValaCompileRequest? last_request" : "null",
"Xcls_ValaCompileErrors popup" : "",
- "bool visible" : false,
"id" : "statusbar_run",
"listeners" : {
"clicked" : [
" \treturn;",
"\t}",
"\t",
- "\tif (this.last_request != null) {",
- "\t\tthis.last_request.cancel();",
- "\t\tif (this.last_request.terminal_pid > 0) {",
- "\t\t\tthis.last_request.killChildren(this.last_request.terminal_pid);",
- "\t\t}",
- "\t}",
- "\tvar pr = _this.windowstate.project as Project.Gtk;",
- "\tif (pr == null) {",
- "\t\treturn;",
- "\t}",
- "\t",
- "\t",
- "\tthis.last_request= new Palete.ValaCompileRequest(",
- "\t\tpr,",
- "\t\tpr.firstBuildModuleWith(_this.windowstate.file)",
+ "\tvar req = new Palete.ValaCompileRequest(",
+ "\t\tPalete.ValaCompileRequestType.RUN,",
+ "\t\t_this.windowstate.file,",
+ "\t\tnull,",
+ "\t\tnull,",
+ "\t\t\"\"",
"\t);",
- "\tthis.last_request.onOutput.connect( ( str) => {",
- "\t\t_this.windowstate.compile_results.addLine(str);",
- "\t});",
- "\tthis.last_request.run.begin( ( a, r) => {",
- "\t\tthis.last_request.run.end(r);",
- "\t});",
- "\t if (_this.windowstate.compile_results.el.parent == null) {",
- "\t\t_this.windowstate.compile_results.el.set_parent(this.el);",
- "\t}",
+ "\treq.run();",
+ "\t ",
+ "\t_this.windowstate.compile_results.el.set_parent(this.el);",
"\t_this.windowstate.compile_results.show(this.el,true);",
"\t ",
"}"
"string tooltip_text" : "Compiling",
"xtype" : "Spinner",
"| void start" : [
- "(string icon, string tooltip) {",
- "",
- "\tif (icon == \"spinner\") {",
- "\t this.el.show();",
- "\t this.el.start(); ",
- "\t this.el.tooltip_text = tooltip;",
- "\t _this.statusbar_compile_icon.el.hide();",
- " } else {",
- "\t this.el.hide();",
- "\t// GLib.debug(\"set status icon %s, %s\", icon, tooltip);",
- "\t _this.statusbar_compile_icon.el.tooltip_text = tooltip;",
- "\t _this.statusbar_compile_icon.el.icon_name = icon;",
- "\t _this.statusbar_compile_icon.el.show();\t ",
- " }",
+ "() {",
+ " this.el.show();",
+ " this.el.start(); ",
" ",
"\t ",
"}",
"() {",
" this.el.stop();",
" this.el.hide();",
- " _this.statusbar_compile_icon.el.hide(); ",
+ " ",
"}",
""
]
- },
- {
- "$ xns" : "Gtk",
- "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
- "id" : "statusbar_compile_icon",
- "int margin_end" : 4,
- "int margin_start" : 4,
- "xtype" : "Image"
}
],
"xtype" : "Box"
-static Xcls_MainWindow _MainWindow;
-
-public class Xcls_MainWindow : Object
-{
- public Gtk.ApplicationWindow el;
- private Xcls_MainWindow _this;
-
- public static Xcls_MainWindow singleton()
- {
- if (_MainWindow == null) {
- _MainWindow= new Xcls_MainWindow();
- }
- return _MainWindow;
- }
- public Xcls_headerbar headerbar;
- public Xcls_windowbtn windowbtn;
- public Xcls_windowspopup windowspopup;
- public Xcls_popover_menu popover_menu;
- public Xcls_open_projects_btn open_projects_btn;
- public Xcls_vbox vbox;
- public Xcls_mainpane mainpane;
- public Xcls_leftpane leftpane;
- public Xcls_editpane editpane;
- public Xcls_tree tree;
- public Xcls_props props;
- public Xcls_rooviewbox rooviewbox;
- public Xcls_codeeditviewbox codeeditviewbox;
- public Xcls_topbarmenu topbarmenu;
- public Xcls_statusbar statusbar;
- public Xcls_statusbar_compilestatus_label statusbar_compilestatus_label;
- public Xcls_statusbar_errors statusbar_errors;
- public Xcls_statusbar_warnings statusbar_warnings;
- public Xcls_statusbar_depricated statusbar_depricated;
- public Xcls_statusbar_run statusbar_run;
- public Xcls_statusbar_compile_spinner statusbar_compile_spinner;
- public Xcls_statusbar_compile_icon statusbar_compile_icon;
-
- // my vars (def)
- public WindowState windowstate;
- public Project.Project project;
-
- // ctor
- public Xcls_MainWindow()
- {
- _this = this;
- this.el = new Gtk.ApplicationWindow(BuilderApplication.singleton({}));
-
- // my vars (dec)
- this.project = null;
-
- // set gobject values
- this.el.title = "Roo Application Builder";
- this.el.default_height = 850;
- this.el.default_width = 1200;
- new Xcls_headerbar( _this );
- this.el.set_titlebar ( _this.headerbar.el );
- new Xcls_vbox( _this );
- this.el.set_child ( _this.vbox.el );
-
- // init method
-
- this.el.set_icon_name("roobuilder");
-
- //listeners
- this.el.close_request.connect( ( ) => {
- Resources.singleton().disconnect(_this.statusbar.handler_id);
-
-
- this.windowstate.file.getLanguageServer().document_close(
- this.windowstate.file
- );
-
- BuilderApplication.removeWindow(this);
-
- if (BuilderApplication.windows.size < 1) {
- this.windowstate.file.getLanguageServer().exit();
- BuilderApplication.singleton( null ).quit();
- }
- return true;
- });
- this.el.show.connect( ( ) => {
- // hide the file editing..
-
- //this.hideViewEditing();
- // this is updated by windowstate - we try and fill it in..
- _this.statusbar.el.hide();
- //_this.statusbar_errors.el.hide();
- //_this.statusbar_warnings.el.hide();
- //_this.statusbar_depricated.el.hide();
- _this.statusbar_compile_spinner.el.hide();
-
- Resources.singleton().checkResources();
-
-
-
- });
- this.el.hide.connect( () => {
-
-
-
- });
- }
-
- // user defined functions
- public void updateErrors () {
-
-
- GLib.debug("updateErrors");
-
- var pr = this.windowstate.project.getErrors("ERR");
-
- this.statusbar_errors.setNotices(
- pr,
- this.windowstate.file.getErrors("ERR")
- );
-
- this.statusbar_warnings.setNotices(
- this.windowstate.project.getErrors("WARN"),
- this.windowstate.file.getErrors("WARN")
- );
- this.statusbar_depricated.setNotices(
- this.windowstate.project.getErrors("DEPR"),
- this.windowstate.file.getErrors("DEPR")
- );
-
- _this.statusbar_run.el.hide();
-
- if (pr.get_n_items() < 1) {
- _this.statusbar_run.el.show();
- }
-
- }
- public void initChildren () {
- // this needs putting in a better place..
- this.windowstate = new WindowState(this);
-
-
-
-
-
-
-
-
- }
- public void show () {
-
- this.el.show();
- if (this.windowstate.file == null) {
- this.windowstate.showPopoverFiles(this.open_projects_btn.el, null, false);
- }
- }
- public void setTitle () {
- if (_this.windowstate.project == null ||
- _this.windowstate.file == null
- ) {
- this.el.set_title("Select File");
- return;
- }
- _this.el.set_title(
- _this.windowstate.project.name +
- " - " +
- _this.windowstate.file.relpath);
- }
- public void openNewWindow () {
-
- var w = new Xcls_MainWindow();
- w.ref();
- BuilderApplication.addWindow(w);
- w.el.show();
- w.initChildren();
- w.windowstate.showPopoverFiles(w.open_projects_btn.el, _this.project, false);
-
- }
- public class Xcls_headerbar : Object
- {
- public Gtk.HeaderBar el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
- public bool show_close_button;
- public string title;
-
- // ctor
- public Xcls_headerbar(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.headerbar = this;
- this.el = new Gtk.HeaderBar();
-
- // my vars (dec)
- this.show_close_button = true;
- this.title = "Application Builder";
-
- // set gobject values
- var child_1 = new Xcls_Box3( _this );
- child_1.ref();
- this.el.pack_start ( child_1.el );
- }
-
- // user defined functions
- }
- public class Xcls_Box3 : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box3(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- new Xcls_windowbtn( _this );
- this.el.append( _this.windowbtn.el );
- new Xcls_open_projects_btn( _this );
- this.el.append ( _this.open_projects_btn.el );
- }
-
- // user defined functions
- }
- public class Xcls_windowbtn : Object
- {
- public Gtk.Button el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
- public Gee.ArrayList<Gtk.Widget> mitems;
-
- // ctor
- public Xcls_windowbtn(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.windowbtn = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.margin_end = 4;
- this.el.halign = Gtk.Align.START;
- new Xcls_windowspopup( _this );
- var child_2 = new Xcls_Box10( _this );
- this.el.child = child_2.el;
-
- // init method
-
- {
- this.mitems = new Gee.ArrayList<Gtk.Button>();
- }
-
- //listeners
- this.el.clicked.connect( ( ) => {
- this.updateMenu();
-
- _this.windowspopup.el.set_parent(this.el);
-
- _this.windowspopup.el.set_position(Gtk.PositionType.BOTTOM);
- _this.windowspopup.el.popup();
- });
- }
-
- // user defined functions
- public void updateMenu () {
- foreach(var m in this.mitems) {
- _this.popover_menu.el.remove(m);
- }
- this.mitems.clear();
-
- BuilderApplication.windows.sort((a,b) => {
- if (a.windowstate == null ||
- a.windowstate.file == null ||
- b.windowstate == null ||
- b.windowstate.file == null
- ) {
- return 0;
- }
-
- var ap = a.windowstate.file.project.name;
- var bp = b.windowstate.file.project.name;
-
-
-
- if (ap != bp) {
- return ap.collate(bp);
- }
- var af = a.windowstate.file == null ? "" : a.windowstate.file.getTitle();
- var bf = b.windowstate.file == null ? "" : b.windowstate.file.getTitle();
- return af.collate(bf);
-
- });
-
- var p = "";
- 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;
- }
- // should not happen...
- if (w.windowstate.file.path == _this.windowstate.file.path) {
- continue;
- }
- if (w.windowstate.file.project.name != p || p != "") {
- var ms = new Gtk.Separator(Gtk.Orientation.HORIZONTAL);
- _this.popover_menu.el.append(ms);
- ms.show();
- this.mitems.add(ms);
- }
-
- p = w.windowstate.file.project.name;
-
-
- GLib.debug("add menuitem %s", w.windowstate.file.path);
-
-
-
- var m = new Gtk.Button.with_label(
- w.windowstate.file.project.name + " : " + w.windowstate.file.relpath
- );
- m.halign = Gtk.Align.START;
-
-
- //w.windowstate.file.path);
- m.clicked.connect(() => {
- _this.windowspopup.el.hide();
- BuilderApplication.windows.get(wid).el.present();
- });
- _this.popover_menu.el.append(m);
- //m.show();
- this.mitems.add(m);
- }
- }
- }
- public class Xcls_windowspopup : Object
- {
- public Gtk.Popover el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_windowspopup(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.windowspopup = this;
- this.el = new Gtk.Popover();
-
- // my vars (dec)
-
- // set gobject values
- new Xcls_popover_menu( _this );
- this.el.set_child ( _this.popover_menu.el );
- }
-
- // user defined functions
- }
- public class Xcls_popover_menu : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_popover_menu(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.popover_menu = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- var child_1 = new Xcls_Button7( _this );
- child_1.ref();
- this.el.append ( child_1.el );
- var child_2 = new Xcls_Separator9( _this );
- child_2.ref();
- this.el.append ( child_2.el );
- }
-
- // user defined functions
- }
- public class Xcls_Button7 : Object
- {
- public Gtk.Button el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button7(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "New Window";
- var child_1 = new Xcls_ShortcutController8( _this );
- child_1.ref();
- this.el.add_controller( child_1.el );
-
- //listeners
- this.el.clicked.connect( ( ) => {
- _this.windowspopup.el.hide();
- _this.windowstate.showPopoverFiles(_this.windowbtn.el, _this.project, true);
- });
- }
-
- // user defined functions
- }
- public class Xcls_ShortcutController8 : Object
- {
- public Gtk.ShortcutController el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
+ static Xcls_MainWindow _MainWindow;
+
+ public class Xcls_MainWindow : Object
+ {
+ public Gtk.ApplicationWindow el;
+ private Xcls_MainWindow _this;
+
+ public static Xcls_MainWindow singleton()
+ {
+ if (_MainWindow == null) {
+ _MainWindow= new Xcls_MainWindow();
+ }
+ return _MainWindow;
+ }
+ public Xcls_headerbar headerbar;
+ public Xcls_windowbtn windowbtn;
+ public Xcls_windowspopup windowspopup;
+ public Xcls_popover_menu popover_menu;
+ public Xcls_open_projects_btn open_projects_btn;
+ public Xcls_vbox vbox;
+ public Xcls_mainpane mainpane;
+ public Xcls_leftpane leftpane;
+ public Xcls_editpane editpane;
+ public Xcls_tree tree;
+ public Xcls_props props;
+ public Xcls_rooviewbox rooviewbox;
+ public Xcls_codeeditviewbox codeeditviewbox;
+ public Xcls_topbarmenu topbarmenu;
+ public Xcls_statusbar statusbar;
+ public Xcls_statusbar_compilestatus_label statusbar_compilestatus_label;
+ public Xcls_statusbar_errors statusbar_errors;
+ public Xcls_statusbar_warnings statusbar_warnings;
+ public Xcls_statusbar_depricated statusbar_depricated;
+ public Xcls_statusbar_run statusbar_run;
+ public Xcls_statusbar_compile_spinner statusbar_compile_spinner;
+
+ // my vars (def)
+ public WindowState windowstate;
+ public Project.Project project;
+
+ // ctor
+ public Xcls_MainWindow()
+ {
+ _this = this;
+ this.el = new Gtk.ApplicationWindow(BuilderApplication.singleton({}));
+
+ // my vars (dec)
+ this.project = null;
+
+ // set gobject values
+ this.el.title = "Roo Application Builder";
+ this.el.default_height = 850;
+ this.el.default_width = 1200;
+ new Xcls_headerbar( _this );
+ this.el.set_titlebar ( _this.headerbar.el );
+ new Xcls_vbox( _this );
+ this.el.set_child ( _this.vbox.el );
+
+ // init method
+
+ this.el.set_icon_name("roobuilder");
+
+ //listeners
+ this.el.close_request.connect( ( ) => {
+ Resources.singleton().disconnect(_this.statusbar.handler_id);
+
+
+ this.windowstate.file.getLanguageServer().document_close(
+ this.windowstate.file
+ );
+
+ BuilderApplication.removeWindow(this);
+
+ if (BuilderApplication.windows.size < 1) {
+ this.windowstate.file.getLanguageServer().exit();
+ BuilderApplication.singleton( null ).quit();
+ }
+ return true;
+ });
+ this.el.show.connect( ( ) => {
+ // hide the file editing..
+
+ //this.hideViewEditing();
+ // this is updated by windowstate - we try and fill it in..
+ _this.statusbar.el.hide();
+ //_this.statusbar_errors.el.hide();
+ //_this.statusbar_warnings.el.hide();
+ //_this.statusbar_depricated.el.hide();
+ _this.statusbar_compile_spinner.el.hide();
+
+ Resources.singleton().checkResources();
+
+
+
+ });
+ this.el.hide.connect( () => {
+
+
+
+ });
+ }
+
+ // user defined functions
+ public void updateErrors () {
+
+
+ GLib.debug("updateErrors");
+
+ var pr = this.windowstate.project.getErrors("ERR");
+
+ this.statusbar_errors.setNotices(
+ pr,
+ this.windowstate.file.getErrors("ERR")
+ );
+
+ this.statusbar_warnings.setNotices(
+ this.windowstate.project.getErrors("WARN"),
+ this.windowstate.file.getErrors("WARN")
+ );
+ this.statusbar_depricated.setNotices(
+ this.windowstate.project.getErrors("DEPR"),
+ this.windowstate.file.getErrors("DEPR")
+ );
+
+ _this.statusbar_run.el.hide();
+
+ if (pr.get_n_items() < 1) {
+ _this.statusbar_run.el.show();
+ }
+
+ }
+ public void initChildren () {
+ // this needs putting in a better place..
+ this.windowstate = new WindowState(this);
+
+
+
+
+
+
+
+
+ }
+ public void show () {
+
+ this.el.show();
+ if (this.windowstate.file == null) {
+ this.windowstate.showPopoverFiles(this.open_projects_btn.el, null, false);
+ }
+ }
+ public void setTitle () {
+ if (_this.windowstate.project == null ||
+ _this.windowstate.file == null
+ ) {
+ this.el.set_title("Select File");
+ return;
+ }
+ _this.el.set_title(
+ _this.windowstate.project.name +
+ " - " +
+ _this.windowstate.file.relpath);
+ }
+ public void openNewWindow () {
+
+ var w = new Xcls_MainWindow();
+ w.ref();
+ BuilderApplication.addWindow(w);
+ w.el.show();
+ w.initChildren();
+ w.windowstate.showPopoverFiles(w.open_projects_btn.el, _this.project, false);
+
+ }
+ public class Xcls_headerbar : Object
+ {
+ public Gtk.HeaderBar el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+ public bool show_close_button;
+ public string title;
+
+ // ctor
+ public Xcls_headerbar(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.headerbar = this;
+ this.el = new Gtk.HeaderBar();
+
+ // my vars (dec)
+ this.show_close_button = true;
+ this.title = "Application Builder";
+
+ // set gobject values
+ var child_1 = new Xcls_Box3( _this );
+ child_1.ref();
+ this.el.pack_start ( child_1.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Box3 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box3(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ new Xcls_windowbtn( _this );
+ this.el.append( _this.windowbtn.el );
+ new Xcls_open_projects_btn( _this );
+ this.el.append ( _this.open_projects_btn.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_windowbtn : Object
+ {
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+ public Gee.ArrayList<Gtk.Widget> mitems;
+
+ // ctor
+ public Xcls_windowbtn(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.windowbtn = this;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.margin_end = 4;
+ this.el.halign = Gtk.Align.START;
+ new Xcls_windowspopup( _this );
+ var child_2 = new Xcls_Box10( _this );
+ this.el.child = child_2.el;
+
+ // init method
+
+ {
+ this.mitems = new Gee.ArrayList<Gtk.Button>();
+ }
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+ this.updateMenu();
+
+ _this.windowspopup.el.set_parent(this.el);
+
+ _this.windowspopup.el.set_position(Gtk.PositionType.BOTTOM);
+ _this.windowspopup.el.popup();
+ });
+ }
+
+ // user defined functions
+ public void updateMenu () {
+ foreach(var m in this.mitems) {
+ _this.popover_menu.el.remove(m);
+ }
+ this.mitems.clear();
+
+ BuilderApplication.windows.sort((a,b) => {
+ if (a.windowstate == null ||
+ a.windowstate.file == null ||
+ b.windowstate == null ||
+ b.windowstate.file == null
+ ) {
+ return 0;
+ }
+
+ var ap = a.windowstate.file.project.name;
+ var bp = b.windowstate.file.project.name;
+
+
+
+ if (ap != bp) {
+ return ap.collate(bp);
+ }
+ var af = a.windowstate.file == null ? "" : a.windowstate.file.getTitle();
+ var bf = b.windowstate.file == null ? "" : b.windowstate.file.getTitle();
+ return af.collate(bf);
+
+ });
+
+ var p = "";
+ 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;
+ }
+ // should not happen...
+ if (w.windowstate.file.path == _this.windowstate.file.path) {
+ continue;
+ }
+ if (w.windowstate.file.project.name != p || p != "") {
+ var ms = new Gtk.Separator(Gtk.Orientation.HORIZONTAL);
+ _this.popover_menu.el.append(ms);
+ ms.show();
+ this.mitems.add(ms);
+ }
+
+ p = w.windowstate.file.project.name;
+
+
+ GLib.debug("add menuitem %s", w.windowstate.file.path);
+
+
+
+ var m = new Gtk.Button.with_label(
+ w.windowstate.file.project.name + " : " + w.windowstate.file.relpath
+ );
+ m.halign = Gtk.Align.START;
+
+
+ //w.windowstate.file.path);
+ m.clicked.connect(() => {
+ _this.windowspopup.el.hide();
+ BuilderApplication.windows.get(wid).el.present();
+ });
+ _this.popover_menu.el.append(m);
+ //m.show();
+ this.mitems.add(m);
+ }
+ }
+ }
+ public class Xcls_windowspopup : Object
+ {
+ public Gtk.Popover el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_windowspopup(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.windowspopup = this;
+ this.el = new Gtk.Popover();
+
+ // my vars (dec)
+
+ // set gobject values
+ new Xcls_popover_menu( _this );
+ this.el.set_child ( _this.popover_menu.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_popover_menu : Object
+ {
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_popover_menu(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.popover_menu = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Button7( _this );
+ child_1.ref();
+ this.el.append ( child_1.el );
+ var child_2 = new Xcls_Separator9( _this );
+ child_2.ref();
+ this.el.append ( child_2.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Button7 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button7(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "New Window";
+ var child_1 = new Xcls_ShortcutController8( _this );
+ child_1.ref();
+ this.el.add_controller( child_1.el );
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+ _this.windowspopup.el.hide();
+ _this.windowstate.showPopoverFiles(_this.windowbtn.el, _this.project, true);
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_ShortcutController8 : Object
+ {
+ public Gtk.ShortcutController el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
- // ctor
- public Xcls_ShortcutController8(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.ShortcutController();
+ // ctor
+ public Xcls_ShortcutController8(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.ShortcutController();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.scope = Gtk.ShortcutScope.GLOBAL;
+ // set gobject values
+ this.el.scope = Gtk.ShortcutScope.GLOBAL;
- // init method
+ // init method
- {
- this.el.add_shortcut(
- new Gtk.Shortcut(
- new Gtk.KeyvalTrigger(Gdk.Key.N,Gdk.ModifierType.CONTROL_MASK),
- new Gtk.SignalAction("clicked")
- )
- );
- }
- }
+ {
+ this.el.add_shortcut(
+ new Gtk.Shortcut(
+ new Gtk.KeyvalTrigger(Gdk.Key.N,Gdk.ModifierType.CONTROL_MASK),
+ new Gtk.SignalAction("clicked")
+ )
+ );
+ }
+ }
- // user defined functions
- }
+ // user defined functions
+ }
- public class Xcls_Separator9 : Object
- {
- public Gtk.Separator el;
- private Xcls_MainWindow _this;
+ public class Xcls_Separator9 : Object
+ {
+ public Gtk.Separator el;
+ private Xcls_MainWindow _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Separator9(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
+ // ctor
+ public Xcls_Separator9(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ }
- // user defined functions
- }
+ // user defined functions
+ }
- public class Xcls_Box10 : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
+ public class Xcls_Box10 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Box10(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+ // ctor
+ public Xcls_Box10(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- var child_1 = new Xcls_Image11( _this );
- child_1.ref();
- this.el.append( child_1.el );
- var child_2 = new Xcls_Label12( _this );
- child_2.ref();
- this.el.append( child_2.el );
- }
+ // set gobject values
+ var child_1 = new Xcls_Image11( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Label12( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ }
- // user defined functions
- }
- public class Xcls_Image11 : Object
- {
- public Gtk.Image el;
- private Xcls_MainWindow _this;
+ // user defined functions
+ }
+ public class Xcls_Image11 : Object
+ {
+ public Gtk.Image el;
+ private Xcls_MainWindow _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Image11(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
+ // ctor
+ public Xcls_Image11(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Image();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.icon_name = "window-new";
- this.el.margin_start = 4;
- }
+ // set gobject values
+ this.el.icon_name = "window-new";
+ this.el.margin_start = 4;
+ }
- // user defined functions
- }
+ // user defined functions
+ }
- public class Xcls_Label12 : Object
- {
- public Gtk.Label el;
- private Xcls_MainWindow _this;
+ public class Xcls_Label12 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_MainWindow _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Label12(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Windows (Add/List)" );
+ // ctor
+ public Xcls_Label12(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Windows (Add/List)" );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ }
- // user defined functions
- }
+ // user defined functions
+ }
- public class Xcls_open_projects_btn : Object
- {
- public Gtk.Button el;
- private Xcls_MainWindow _this;
+ public class Xcls_open_projects_btn : Object
+ {
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
- // my vars (def)
- public bool always_show_image;
+ // my vars (def)
+ public bool always_show_image;
- // ctor
- public Xcls_open_projects_btn(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.open_projects_btn = this;
- this.el = new Gtk.Button();
+ // ctor
+ public Xcls_open_projects_btn(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.open_projects_btn = this;
+ this.el = new Gtk.Button();
- // my vars (dec)
- this.always_show_image = true;
+ // my vars (dec)
+ this.always_show_image = true;
- // set gobject values
- this.el.icon_name = "system-file-manager";
- this.el.label = "Files / Projects";
+ // set gobject values
+ this.el.icon_name = "system-file-manager";
+ this.el.label = "Files / Projects";
- //listeners
- this.el.clicked.connect( ( ) => {
- _this.windowstate.showPopoverFiles(this.el, _this.project, false);
- });
- }
+ //listeners
+ this.el.clicked.connect( ( ) => {
+ _this.windowstate.showPopoverFiles(this.el, _this.project, false);
+ });
+ }
- // user defined functions
- }
+ // user defined functions
+ }
- public class Xcls_vbox : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
+ public class Xcls_vbox : Object
+ {
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_vbox(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.vbox = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ // ctor
+ public Xcls_vbox(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.vbox = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.homogeneous = false;
- this.el.vexpand = true;
- new Xcls_mainpane( _this );
- this.el.append( _this.mainpane.el );
- var child_2 = new Xcls_Box23( _this );
- child_2.ref();
- this.el.append( child_2.el );
- }
-
- // user defined functions
- }
- public class Xcls_mainpane : Object
- {
- public Gtk.Paned el;
- private Xcls_MainWindow _this;
+ // set gobject values
+ this.el.homogeneous = false;
+ this.el.vexpand = true;
+ new Xcls_mainpane( _this );
+ this.el.append( _this.mainpane.el );
+ var child_2 = new Xcls_Box23( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_mainpane : Object
+ {
+ public Gtk.Paned el;
+ private Xcls_MainWindow _this;
- // my vars (def)
- public int lastWidth;
-
- // ctor
- public Xcls_mainpane(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.mainpane = this;
- this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
+ // my vars (def)
+ public int lastWidth;
+
+ // ctor
+ public Xcls_mainpane(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.mainpane = this;
+ this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
- // my vars (dec)
- this.lastWidth = 0;
-
- // set gobject values
- this.el.hexpand = true;
- this.el.vexpand = true;
- this.el.position = 400;
- new Xcls_leftpane( _this );
- this.el.start_child = _this.leftpane.el;
- var child_2 = new Xcls_Box20( _this );
- this.el.end_child = child_2.el;
-
- //listeners
- this.el.accept_position.connect( ( ) => {
- _this.windowstate.left_tree.onresize();
- return true;
- });
- }
-
- // user defined functions
- }
- public class Xcls_leftpane : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_leftpane(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.leftpane = this;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- this.el.vexpand = true;
- new Xcls_editpane( _this );
- this.el.append( _this.editpane.el );
- }
-
- // user defined functions
- }
- public class Xcls_editpane : Object
- {
- public Gtk.Paned el;
- private Xcls_MainWindow _this;
+ // my vars (dec)
+ this.lastWidth = 0;
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ this.el.position = 400;
+ new Xcls_leftpane( _this );
+ this.el.start_child = _this.leftpane.el;
+ var child_2 = new Xcls_Box20( _this );
+ this.el.end_child = child_2.el;
+
+ //listeners
+ this.el.accept_position.connect( ( ) => {
+ _this.windowstate.left_tree.onresize();
+ return true;
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_leftpane : Object
+ {
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_leftpane(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.leftpane = this;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ new Xcls_editpane( _this );
+ this.el.append( _this.editpane.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_editpane : Object
+ {
+ public Gtk.Paned el;
+ private Xcls_MainWindow _this;
- // my vars (def)
-
- // ctor
- public Xcls_editpane(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.editpane = this;
- this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
-
- // my vars (dec)
-
- // set gobject values
- new Xcls_tree( _this );
- this.el.start_child = _this.tree.el;
- new Xcls_props( _this );
- this.el.end_child = _this.props.el;
-
- //listeners
- this.el.accept_position.connect( ( ) => {
- _this.windowstate.left_tree.onresize();
- return true;
- });
- this.el.move_handle.connect( (scroll) => {
- GLib.debug("Move handle");
- return true;
- });
- }
-
- // user defined functions
- }
- public class Xcls_tree : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_tree(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.tree = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- this.el.vexpand = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_props : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
+ // my vars (def)
+
+ // ctor
+ public Xcls_editpane(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.editpane = this;
+ this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
+
+ // my vars (dec)
+
+ // set gobject values
+ new Xcls_tree( _this );
+ this.el.start_child = _this.tree.el;
+ new Xcls_props( _this );
+ this.el.end_child = _this.props.el;
+
+ //listeners
+ this.el.accept_position.connect( ( ) => {
+ _this.windowstate.left_tree.onresize();
+ return true;
+ });
+ this.el.move_handle.connect( (scroll) => {
+ GLib.debug("Move handle");
+ return true;
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_tree : Object
+ {
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_tree(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.tree = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_props : Object
+ {
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_props(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.props = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ // ctor
+ public Xcls_props(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.props = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.hexpand = true;
- this.el.vexpand = true;
- }
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ }
- // user defined functions
- }
+ // user defined functions
+ }
- public class Xcls_Box20 : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
+ public class Xcls_Box20 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Box20(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ // ctor
+ public Xcls_Box20(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.hexpand = true;
- this.el.vexpand = true;
- new Xcls_rooviewbox( _this );
- this.el.append( _this.rooviewbox.el );
- new Xcls_codeeditviewbox( _this );
- this.el.append( _this.codeeditviewbox.el );
- }
-
- // user defined functions
- }
- public class Xcls_rooviewbox : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_rooviewbox(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.rooviewbox = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ new Xcls_rooviewbox( _this );
+ this.el.append( _this.rooviewbox.el );
+ new Xcls_codeeditviewbox( _this );
+ this.el.append( _this.codeeditviewbox.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_rooviewbox : Object
+ {
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_rooviewbox(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.rooviewbox = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.hexpand = true;
- this.el.vexpand = true;
- }
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ }
- // user defined functions
- }
+ // user defined functions
+ }
- public class Xcls_codeeditviewbox : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_codeeditviewbox(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.codeeditviewbox = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ public class Xcls_codeeditviewbox : Object
+ {
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_codeeditviewbox(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.codeeditviewbox = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.hexpand = true;
- this.el.vexpand = true;
- }
-
- // user defined functions
- }
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ }
+ // user defined functions
+ }
- public class Xcls_Box23 : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box23(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- this.el.vexpand = false;
- var child_1 = new Xcls_Button24( _this );
- child_1.ref();
- this.el.append( child_1.el );
- var child_2 = new Xcls_Button25( _this );
- child_2.ref();
- this.el.append( child_2.el );
- var child_3 = new Xcls_MenuButton26( _this );
- child_3.ref();
- this.el.append( child_3.el );
- var child_4 = new Xcls_Label31( _this );
- child_4.ref();
- this.el.append( child_4.el );
- new Xcls_statusbar( _this );
- this.el.append( _this.statusbar.el );
- var child_6 = new Xcls_Box33( _this );
- child_6.ref();
- this.el.append( child_6.el );
- new Xcls_statusbar_compile_spinner( _this );
- this.el.append( _this.statusbar_compile_spinner.el );
- new Xcls_statusbar_compile_icon( _this );
- this.el.append( _this.statusbar_compile_icon.el );
- }
-
- // user defined functions
- }
- public class Xcls_Button24 : Object
- {
- public Gtk.Button el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
- public bool always_show_image;
-
- // ctor
- public Xcls_Button24(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
- this.always_show_image = true;
-
- // set gobject values
- this.el.icon_name = "emblem-system";
- this.el.tooltip_text = "Project Details";
- this.el.label = "Edit Project Settings";
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
- _this.windowstate.projectPopoverShow(_this.el, null, null);
-
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Button25 : Object
- {
- public Gtk.Button el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
- public bool always_show_image;
-
- // ctor
- public Xcls_Button25(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
- this.always_show_image = true;
-
- // set gobject values
- this.el.icon_name = "document-properties";
- this.el.tooltip_text = "File Details";
- this.el.label = "Edit File Properties";
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
- // create a new file in project..
- if (_this.project == null || _this.windowstate.file == null) {
- return ;
- }
- _this.windowstate.file_details.show(
- _this.windowstate.file, _this.el, false
- );
-
- return ;
-
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_MenuButton26 : Object
- {
- public Gtk.MenuButton el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
- public bool always_show_image;
-
- // ctor
- public Xcls_MenuButton26(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuButton();
-
- // my vars (dec)
- this.always_show_image = true;
-
- // set gobject values
- this.el.icon_name = "dialog-information";
- this.el.label = "About";
- new Xcls_topbarmenu( _this );
- this.el.popover = _this.topbarmenu.el;
- }
-
- // user defined functions
- }
- public class Xcls_topbarmenu : Object
- {
- public Gtk.PopoverMenu el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_topbarmenu(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.topbarmenu = this;
- this.el = new Gtk.PopoverMenu.from_model(null);
-
- // my vars (dec)
-
- // set gobject values
- var child_1 = new Xcls_Box28( _this );
- child_1.ref();
- this.el.set_child ( child_1.el );
- // init method
+ public class Xcls_Box23 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box23(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.homogeneous = false;
+ this.el.vexpand = false;
+ var child_1 = new Xcls_Button24( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Button25( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ var child_3 = new Xcls_MenuButton26( _this );
+ child_3.ref();
+ this.el.append( child_3.el );
+ var child_4 = new Xcls_Label31( _this );
+ child_4.ref();
+ this.el.append( child_4.el );
+ new Xcls_statusbar( _this );
+ this.el.append( _this.statusbar.el );
+ var child_6 = new Xcls_Box33( _this );
+ child_6.ref();
+ this.el.append( child_6.el );
+ new Xcls_statusbar_compile_spinner( _this );
+ this.el.append( _this.statusbar_compile_spinner.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Button24 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+ public bool always_show_image;
+
+ // ctor
+ public Xcls_Button24(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+ this.always_show_image = true;
+
+ // set gobject values
+ this.el.icon_name = "emblem-system";
+ this.el.tooltip_text = "Project Details";
+ this.el.label = "Edit Project Settings";
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ _this.windowstate.projectPopoverShow(_this.el, null, null);
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button25 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+ public bool always_show_image;
+
+ // ctor
+ public Xcls_Button25(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+ this.always_show_image = true;
+
+ // set gobject values
+ this.el.icon_name = "document-properties";
+ this.el.tooltip_text = "File Details";
+ this.el.label = "Edit File Properties";
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ // create a new file in project..
+ if (_this.project == null || _this.windowstate.file == null) {
+ return ;
+ }
+ _this.windowstate.file_details.show(
+ _this.windowstate.file, _this.el, false
+ );
+
+ return ;
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_MenuButton26 : Object
+ {
+ public Gtk.MenuButton el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+ public bool always_show_image;
+
+ // ctor
+ public Xcls_MenuButton26(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.MenuButton();
+
+ // my vars (dec)
+ this.always_show_image = true;
+
+ // set gobject values
+ this.el.icon_name = "dialog-information";
+ this.el.label = "About";
+ new Xcls_topbarmenu( _this );
+ this.el.popover = _this.topbarmenu.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_topbarmenu : Object
+ {
+ public Gtk.PopoverMenu el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_topbarmenu(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.topbarmenu = this;
+ this.el = new Gtk.PopoverMenu.from_model(null);
+
+ // my vars (dec)
- {
- // this.el.show();
- }
- }
+ // set gobject values
+ var child_1 = new Xcls_Box28( _this );
+ child_1.ref();
+ this.el.set_child ( child_1.el );
- // user defined functions
- }
- public class Xcls_Box28 : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
+ // init method
+ {
+ // this.el.show();
+ }
+ }
- // my vars (def)
+ // user defined functions
+ }
+ public class Xcls_Box28 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
- // ctor
- public Xcls_Box28(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
- // my vars (dec)
+ // my vars (def)
- // set gobject values
- var child_1 = new Xcls_Button29( _this );
- child_1.ref();
- this.el.append( child_1.el );
- var child_2 = new Xcls_Button30( _this );
- child_2.ref();
- this.el.append( child_2.el );
- }
+ // ctor
+ public Xcls_Box28(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
- // user defined functions
- }
- public class Xcls_Button29 : Object
- {
- public Gtk.Button el;
- private Xcls_MainWindow _this;
+ // my vars (dec)
+ // set gobject values
+ var child_1 = new Xcls_Button29( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Button30( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ }
- // my vars (def)
+ // user defined functions
+ }
+ public class Xcls_Button29 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
- // ctor
- public Xcls_Button29(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
- // my vars (dec)
+ // my vars (def)
- // set gobject values
- this.el.label = "Download updated Resources";
+ // ctor
+ public Xcls_Button29(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- //listeners
- this.el.activate.connect( ( ) => {
- Resources.singleton().fetchStart();
- });
- }
+ // my vars (dec)
- // user defined functions
- }
+ // set gobject values
+ this.el.label = "Download updated Resources";
- public class Xcls_Button30 : Object
- {
- public Gtk.Button el;
- private Xcls_MainWindow _this;
+ //listeners
+ this.el.activate.connect( ( ) => {
+ Resources.singleton().fetchStart();
+ });
+ }
+ // user defined functions
+ }
- // my vars (def)
+ public class Xcls_Button30 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
- // ctor
- public Xcls_Button30(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
- // my vars (dec)
+ // my vars (def)
- // set gobject values
- this.el.label = "About the Builder";
+ // ctor
+ public Xcls_Button30(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- //listeners
- this.el.clicked.connect( () => {
- About.singleton().el.show();
- });
- }
+ // my vars (dec)
- // user defined functions
- }
+ // set gobject values
+ this.el.label = "About the Builder";
+ //listeners
+ this.el.clicked.connect( () => {
+ About.singleton().el.show();
+ });
+ }
+ // user defined functions
+ }
- public class Xcls_Label31 : Object
- {
- public Gtk.Label el;
- private Xcls_MainWindow _this;
- // my vars (def)
+ public class Xcls_Label31 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_MainWindow _this;
- // ctor
- public Xcls_Label31(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( " " );
- // my vars (dec)
+ // my vars (def)
- // set gobject values
- this.el.hexpand = true;
- }
+ // ctor
+ public Xcls_Label31(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( " " );
- // user defined functions
- }
+ // my vars (dec)
- public class Xcls_statusbar : Object
- {
- public Gtk.ProgressBar el;
- private Xcls_MainWindow _this;
+ // set gobject values
+ this.el.hexpand = true;
+ }
+ // user defined functions
+ }
- // my vars (def)
- public ulong handler_id;
+ public class Xcls_statusbar : Object
+ {
+ public Gtk.ProgressBar el;
+ private Xcls_MainWindow _this;
- // ctor
- public Xcls_statusbar(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.statusbar = this;
- this.el = new Gtk.ProgressBar();
- // my vars (dec)
- this.handler_id = -1;
+ // my vars (def)
+ public ulong handler_id;
- // set gobject values
- this.el.show_text = true;
+ // ctor
+ public Xcls_statusbar(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.statusbar = this;
+ this.el = new Gtk.ProgressBar();
- // init method
+ // my vars (dec)
+ this.handler_id = -1;
- {
- this.handler_id = Resources.singleton().updateProgress.connect((pos,total) => {
- if (pos < 1) {
- this.el.hide();
- _this.mainpane.el.set_sensitive(true);
-
- return;
- }
- _this.mainpane.el.set_sensitive(false);
- this.el.show();
- this.el.set_fraction ((1.0f * pos) / (1.0f * total));
- this.el.set_text("Fetching Resource : %s/%s".printf(pos.to_string(), total.to_string()));
-
- });
- }
- }
-
- // user defined functions
- }
-
- public class Xcls_Box33 : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box33(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- new Xcls_statusbar_compilestatus_label( _this );
- this.el.append( _this.statusbar_compilestatus_label.el );
- new Xcls_statusbar_errors( _this );
- this.el.append( _this.statusbar_errors.el );
- new Xcls_statusbar_warnings( _this );
- this.el.append( _this.statusbar_warnings.el );
- new Xcls_statusbar_depricated( _this );
- this.el.append( _this.statusbar_depricated.el );
- new Xcls_statusbar_run( _this );
- this.el.append( _this.statusbar_run.el );
- }
-
- // user defined functions
- }
- public class Xcls_statusbar_compilestatus_label : Object
- {
- public Gtk.Label el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_statusbar_compilestatus_label(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.statusbar_compilestatus_label = this;
- this.el = new Gtk.Label( "Compile Status:" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.margin_end = 4;
- this.el.margin_start = 4;
- }
-
- // user defined functions
- }
-
- public class Xcls_statusbar_errors : Object
- {
- public Gtk.Button el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
- public Xcls_ValaCompileErrors popup;
-
- // ctor
- public Xcls_statusbar_errors(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.statusbar_errors = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.icon_name = "dialog-error";
- this.el.label = "0 Errors";
-
- //listeners
- this.el.clicked.connect( () => {
-
- if (this.popup == null) {
- return;
- }
-
- this.popup.show();
-
- });
- }
-
- // user defined functions
- public void setNotices (GLib.ListStore nots, GLib.ListStore fe ) {
- BuilderApplication.showSpinner("");
- if (nots.get_n_items() < 1 ) {
- this.el.hide();
- if (this.popup != null) {
- this.popup.el.hide();
- }
- return;
- }
-
- this.el.show();
- this.el.label = "%d/%d Errors".printf((int)fe.get_n_items(),(int)nots.get_n_items());
-
-
-
- if (this.popup == null) {
- this.popup = new Xcls_ValaCompileErrors();
- this.popup.window = _this;
- // this.popup.el.set_transient_for( _this.el );
- this.popup.el.set_parent(this.el);
- }
-
- this.popup.updateNotices(nots);
-
- }
- }
-
- public class Xcls_statusbar_warnings : Object
- {
- public Gtk.Button el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
- public Xcls_ValaCompileErrors popup;
-
- // ctor
- public Xcls_statusbar_warnings(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.statusbar_warnings = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.icon_name = "dialog-warning";
- this.el.label = "0 Warnings";
-
- //listeners
- this.el.clicked.connect( () => {
-
- if (this.popup == null) {
- return;
- }
-
- this.popup.show();
- return;
- });
- }
-
- // user defined functions
- public void setNotices (GLib.ListStore nots, GLib.ListStore fe ) {
-
- if (nots.get_n_items() < 1 ) {
- this.el.hide();
- if (this.popup != null) {
- this.popup.el.hide();
- }
- return;
- }
-
- this.el.show();
- this.el.label = "%d/%d Warnings".printf((int)fe.get_n_items(),(int)nots.get_n_items());
-
-
-
- if (this.popup == null) {
- this.popup = new Xcls_ValaCompileErrors();
- this.popup.window = _this;
- // this.popup.el.set_transient_for( _this.el );
- this.popup.el.set_parent(this.el);
- }
- this.popup.updateNotices(nots);
-
- }
- }
-
- public class Xcls_statusbar_depricated : Object
- {
- public Gtk.Button el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
- public Xcls_ValaCompileErrors popup;
- public GLib.ListStore notices;
-
- // ctor
- public Xcls_statusbar_depricated(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.statusbar_depricated = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
- this.notices = null;
-
- // set gobject values
- this.el.icon_name = "dialog-information";
- this.el.label = "0 Depricated";
-
- //listeners
- this.el.clicked.connect( () => {
-
- if (this.popup == null) {
- return;
- }
-
- this.popup.show();
-
- });
- }
-
- // user defined functions
- public void setNotices (GLib.ListStore nots, GLib.ListStore fe ) {
-
- if (nots.get_n_items() < 1 ) {
- this.el.hide();
- if (this.popup != null) {
- this.popup.el.hide();
- }
- return;
- }
-
- this.el.show();
- this.el.label = "%d/%d Depricated".printf((int)fe.get_n_items(),(int)nots.get_n_items());
-
-
-
- if (this.popup == null) {
- this.popup = new Xcls_ValaCompileErrors();
- this.popup.window = _this;
- // this.popup.el.set_transient_for( _this.el );
- this.popup.el.set_parent(this.el);
- }
- this.popup.updateNotices(nots);
-
- }
- }
-
- public class Xcls_statusbar_run : Object
- {
- public Gtk.Button el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
- public Xcls_ValaCompileErrors popup;
- public Palete.ValaCompileRequest? last_request;
-
- // ctor
- public Xcls_statusbar_run(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.statusbar_run = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
- this.last_request = null;
-
- // set gobject values
- this.el.icon_name = "media-playback-start";
- this.el.label = "Run";
- this.el.visible = false;
-
- //listeners
- this.el.clicked.connect( () => {
-
- if (_this.windowstate.file == null) {
- return;
- }
- if (_this.statusbar_compile_spinner.el.spinning) {
- _this.windowstate.compile_results.el.set_parent(this.el);
- _this.windowstate.compile_results.el.show(); // show currently running.
- return;
- }
-
- if (this.last_request != null) {
- this.last_request.cancel();
- if (this.last_request.terminal_pid > 0) {
- this.last_request.killChildren(this.last_request.terminal_pid);
- }
- }
- var pr = _this.windowstate.project as Project.Gtk;
- if (pr == null) {
- return;
- }
-
-
- this.last_request= new Palete.ValaCompileRequest(
- pr,
- pr.firstBuildModuleWith(_this.windowstate.file)
- );
- this.last_request.onOutput.connect( ( str) => {
- _this.windowstate.compile_results.addLine(str);
- });
- this.last_request.run.begin( ( a, r) => {
- this.last_request.run.end(r);
- });
- if (_this.windowstate.compile_results.el.parent == null) {
- _this.windowstate.compile_results.el.set_parent(this.el);
- }
- _this.windowstate.compile_results.show(this.el,true);
-
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_statusbar_compile_spinner : Object
- {
- public Gtk.Spinner el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_statusbar_compile_spinner(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.statusbar_compile_spinner = this;
- this.el = new Gtk.Spinner();
-
- // my vars (dec)
-
- // set gobject values
- this.el.margin_end = 4;
- this.el.margin_start = 4;
- this.el.tooltip_text = "Compiling";
- }
-
- // user defined functions
- public void start (string icon, string tooltip) {
-
- if (icon == "spinner") {
- this.el.show();
- this.el.start();
- this.el.tooltip_text = tooltip;
- _this.statusbar_compile_icon.el.hide();
- } else {
- this.el.hide();
- // GLib.debug("set status icon %s, %s", icon, tooltip);
- _this.statusbar_compile_icon.el.tooltip_text = tooltip;
- _this.statusbar_compile_icon.el.icon_name = icon;
- _this.statusbar_compile_icon.el.show();
- }
-
-
- }
- public void stop () {
- this.el.stop();
- this.el.hide();
- _this.statusbar_compile_icon.el.hide();
- }
- }
-
- public class Xcls_statusbar_compile_icon : Object
- {
- public Gtk.Image el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_statusbar_compile_icon(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.statusbar_compile_icon = this;
- this.el = new Gtk.Image();
-
- // my vars (dec)
-
- // set gobject values
- this.el.margin_end = 4;
- this.el.margin_start = 4;
- this.el.icon_size = Gtk.IconSize.NORMAL;
- }
-
- // user defined functions
- }
-
-
-
-}
+ // set gobject values
+ this.el.show_text = true;
+
+ // init method
+
+ {
+ this.handler_id = Resources.singleton().updateProgress.connect((pos,total) => {
+ if (pos < 1) {
+ this.el.hide();
+ _this.mainpane.el.set_sensitive(true);
+
+ return;
+ }
+ _this.mainpane.el.set_sensitive(false);
+ this.el.show();
+ this.el.set_fraction ((1.0f * pos) / (1.0f * total));
+ this.el.set_text("Fetching Resource : %s/%s".printf(pos.to_string(), total.to_string()));
+
+ });
+ }
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Box33 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box33(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ new Xcls_statusbar_compilestatus_label( _this );
+ this.el.append( _this.statusbar_compilestatus_label.el );
+ new Xcls_statusbar_errors( _this );
+ this.el.append( _this.statusbar_errors.el );
+ new Xcls_statusbar_warnings( _this );
+ this.el.append( _this.statusbar_warnings.el );
+ new Xcls_statusbar_depricated( _this );
+ this.el.append( _this.statusbar_depricated.el );
+ new Xcls_statusbar_run( _this );
+ this.el.append( _this.statusbar_run.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_statusbar_compilestatus_label : Object
+ {
+ public Gtk.Label el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_statusbar_compilestatus_label(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.statusbar_compilestatus_label = this;
+ this.el = new Gtk.Label( "Compile Status:" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.margin_end = 4;
+ this.el.margin_start = 4;
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_statusbar_errors : Object
+ {
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+ public Xcls_ValaCompileErrors popup;
+
+ // ctor
+ public Xcls_statusbar_errors(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.statusbar_errors = this;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.icon_name = "dialog-error";
+ this.el.label = "0 Errors";
+
+ //listeners
+ this.el.clicked.connect( () => {
+
+ if (this.popup == null) {
+ return;
+ }
+
+ this.popup.show();
+
+ });
+ }
+
+ // user defined functions
+ public void setNotices (GLib.ListStore nots, GLib.ListStore fe ) {
+
+ if (nots.get_n_items() < 1 ) {
+ this.el.hide();
+ if (this.popup != null) {
+ this.popup.el.hide();
+ }
+ return;
+ }
+
+ this.el.show();
+ this.el.label = "%d/%d Errors".printf((int)fe.get_n_items(),(int)nots.get_n_items());
+
+
+
+ if (this.popup == null) {
+ this.popup = new Xcls_ValaCompileErrors();
+ this.popup.window = _this;
+ // this.popup.el.set_transient_for( _this.el );
+ this.popup.el.set_parent(this.el);
+ }
+ this.popup.updateNotices(nots);
+
+ }
+ }
+
+ public class Xcls_statusbar_warnings : Object
+ {
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+ public Xcls_ValaCompileErrors popup;
+
+ // ctor
+ public Xcls_statusbar_warnings(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.statusbar_warnings = this;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.icon_name = "dialog-warning";
+ this.el.label = "0 Warnings";
+
+ //listeners
+ this.el.clicked.connect( () => {
+
+ if (this.popup == null) {
+ return;
+ }
+
+ this.popup.show();
+ return;
+ });
+ }
+
+ // user defined functions
+ public void setNotices (GLib.ListStore nots, GLib.ListStore fe ) {
+
+ if (nots.get_n_items() < 1 ) {
+ this.el.hide();
+ if (this.popup != null) {
+ this.popup.el.hide();
+ }
+ return;
+ }
+
+ this.el.show();
+ this.el.label = "%d/%d Warnings".printf((int)fe.get_n_items(),(int)nots.get_n_items());
+
+
+
+ if (this.popup == null) {
+ this.popup = new Xcls_ValaCompileErrors();
+ this.popup.window = _this;
+ // this.popup.el.set_transient_for( _this.el );
+ this.popup.el.set_parent(this.el);
+ }
+ this.popup.updateNotices(nots);
+
+ }
+ }
+
+ public class Xcls_statusbar_depricated : Object
+ {
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+ public Xcls_ValaCompileErrors popup;
+ public GLib.ListStore notices;
+
+ // ctor
+ public Xcls_statusbar_depricated(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.statusbar_depricated = this;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+ this.notices = null;
+
+ // set gobject values
+ this.el.icon_name = "dialog-information";
+ this.el.label = "0 Depricated";
+
+ //listeners
+ this.el.clicked.connect( () => {
+
+ if (this.popup == null) {
+ return;
+ }
+
+ this.popup.show();
+
+ });
+ }
+
+ // user defined functions
+ public void setNotices (GLib.ListStore nots, GLib.ListStore fe ) {
+
+ if (nots.get_n_items() < 1 ) {
+ this.el.hide();
+ if (this.popup != null) {
+ this.popup.el.hide();
+ }
+ return;
+ }
+
+ this.el.show();
+ this.el.label = "%d/%d Depricated".printf((int)fe.get_n_items(),(int)nots.get_n_items());
+
+
+
+ if (this.popup == null) {
+ this.popup = new Xcls_ValaCompileErrors();
+ this.popup.window = _this;
+ // this.popup.el.set_transient_for( _this.el );
+ this.popup.el.set_parent(this.el);
+ }
+ this.popup.updateNotices(nots);
+
+ }
+ }
+
+ public class Xcls_statusbar_run : Object
+ {
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+ public Xcls_ValaCompileErrors popup;
+
+ // ctor
+ public Xcls_statusbar_run(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.statusbar_run = this;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.icon_name = "media-playback-start";
+ this.el.label = "Run";
+
+ //listeners
+ this.el.clicked.connect( () => {
+
+ if (_this.windowstate.file == null) {
+ return;
+ }
+ if (_this.statusbar_compile_spinner.el.spinning) {
+ _this.windowstate.compile_results.el.set_parent(this.el);
+ _this.windowstate.compile_results.el.show(); // show currently running.
+ return;
+ }
+
+ var req = new Palete.ValaCompileRequest(
+ Palete.ValaCompileRequestType.RUN,
+ _this.windowstate.file,
+ null,
+ null,
+ ""
+ );
+ req.run();
+
+ _this.windowstate.compile_results.el.set_parent(this.el);
+ _this.windowstate.compile_results.show(this.el,true);
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_statusbar_compile_spinner : Object
+ {
+ public Gtk.Spinner el;
+ private Xcls_MainWindow _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_statusbar_compile_spinner(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.statusbar_compile_spinner = this;
+ this.el = new Gtk.Spinner();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.margin_end = 4;
+ this.el.margin_start = 4;
+ this.el.tooltip_text = "Compiling";
+ }
+
+ // user defined functions
+ public void start () {
+ this.el.show();
+ this.el.start();
+
+
+ }
+ public void stop () {
+ this.el.stop();
+ this.el.hide();
+
+ }
+ }
+
+
+
+ }
}
],
"xtype" : "Popover",
- "| void addLine" : [
- "(string str) {",
- "\t ",
- "\t",
- "\t",
- "\tvar buf = (GtkSource.Buffer)this.sourceview.el.get_buffer();",
- "\tGtk.TextIter iter;",
- "\tbuf.get_end_iter (out iter);",
- "\tbuf.insert(ref iter, str, str.length);",
- "\t/// scroll..",
- "\tbuf.get_end_iter (out iter);",
- "\tthis.sourceview.el.scroll_to_iter(iter, 0.0f, true, 0.0f, 1.0f);",
- " ",
- "}",
- ""
- ],
"| void show" : [
"( Gtk.Widget onbtn, bool reset) {",
"\tvar win = this.window.el;",
" ",
"}",
""
+ ],
+ "| void xaddLine" : [
+ "(string str) {",
+ "\t/*",
+ "\tif (this.window.windowstate.project.path != BuilderApplication.valasource.file.project.path) {",
+ "\t\t// not our project.",
+ "\t\treturn;",
+ "\t}",
+ "\t",
+ "\t",
+ "\tvar buf = (GtkSource.Buffer)this.sourceview.el.get_buffer();",
+ "\tGtk.TextIter iter;",
+ "\tbuf.get_end_iter (out iter);",
+ "\tbuf.insert(ref iter, str, str.length);",
+ "\t/// scroll..",
+ "\tbuf.get_end_iter (out iter);",
+ "\tthis.sourceview.el.scroll_to_iter(iter, 0.0f, true, 0.0f, 1.0f);",
+ " */",
+ "}",
+ ""
]
}
],
-static Xcls_ValaCompileResults _ValaCompileResults;
-
-public class Xcls_ValaCompileResults : Object
-{
- public Gtk.Popover el;
- private Xcls_ValaCompileResults _this;
-
- public static Xcls_ValaCompileResults singleton()
- {
- if (_ValaCompileResults == null) {
- _ValaCompileResults= new Xcls_ValaCompileResults();
- }
- return _ValaCompileResults;
- }
- public Xcls_compile_view compile_view;
- public Xcls_sourceview sourceview;
-
- // my vars (def)
- public bool modal;
- public Xcls_MainWindow window;
- public bool active;
-
- // ctor
- public Xcls_ValaCompileResults()
- {
- _this = this;
- this.el = new Gtk.Popover();
-
- // my vars (dec)
- this.modal = true;
- this.active = true;
-
- // set gobject values
- this.el.width_request = 600;
- this.el.height_request = 400;
- this.el.position = Gtk.PositionType.TOP;
- new Xcls_compile_view( _this );
- this.el.set_child ( _this.compile_view.el );
- }
-
- // user defined functions
- public void show ( Gtk.Widget onbtn, bool reset) {
- var win = this.window.el;
- var w = win.get_width();
- var h = win.get_height();
-
- // left tree = 250, editor area = 500?
-
- var new_w = int.min(750, w-100);
- if (new_w > (w-100)) {
- new_w = w-100;
- }
- this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
- if (this.el.parent == null) {
- this.el.set_parent(win);
- }
- // Gtk.Allocation rect;
- //onbtn.get_allocation(out rect);
- //this.el.set_pointing_to(rect);
-
- this.el.popup();
- // not sure why..
-
- if (reset) {
- var buf = (GtkSource.Buffer)this.sourceview.el.get_buffer();
- buf.set_text("",0);
- }
-
-
-
-
- }
- public void addLine (string str) {
-
-
-
- var buf = (GtkSource.Buffer)this.sourceview.el.get_buffer();
- Gtk.TextIter iter;
- buf.get_end_iter (out iter);
- buf.insert(ref iter, str, str.length);
- /// scroll..
- buf.get_end_iter (out iter);
- this.sourceview.el.scroll_to_iter(iter, 0.0f, true, 0.0f, 1.0f);
-
- }
- public class Xcls_compile_view : Object
- {
- public Gtk.Box el;
- private Xcls_ValaCompileResults _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_compile_view(Xcls_ValaCompileResults _owner )
- {
- _this = _owner;
- _this.compile_view = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- this.el.hexpand = true;
- this.el.vexpand = true;
- var child_1 = new Xcls_ScrolledWindow3( _this );
- child_1.ref();
- this.el.append( child_1.el );
- }
-
- // user defined functions
- }
- public class Xcls_ScrolledWindow3 : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_ValaCompileResults _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ScrolledWindow3(Xcls_ValaCompileResults _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow();
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- this.el.vexpand = true;
- new Xcls_sourceview( _this );
- this.el.child = _this.sourceview.el;
-
- // init method
-
- {
- this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
-
-
- }
- }
-
- // user defined functions
- }
- public class Xcls_sourceview : Object
- {
- public GtkSource.View el;
- private Xcls_ValaCompileResults _this;
-
-
- // my vars (def)
- public Gtk.CssProvider css;
-
- // ctor
- public Xcls_sourceview(Xcls_ValaCompileResults _owner )
- {
- _this = _owner;
- _this.sourceview = this;
- this.el = new GtkSource.View();
-
- // my vars (dec)
-
- // set gobject values
- this.el.name = "compile-results-view";
- this.el.editable = false;
- this.el.show_line_numbers = false;
- this.el.hexpand = true;
- this.el.vexpand = true;
-
- // init method
-
- {
-
- this.css = new Gtk.CssProvider();
-
- this.css.load_from_string(
- "#compile-results-view { font: 10px monospace ;}"
- );
-
- Gtk.StyleContext.add_provider_for_display(
- this.el.get_display(),
- this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
- );
-
-
- }
- }
-
- // user defined functions
- }
-
-
-
-}
+ static Xcls_ValaCompileResults _ValaCompileResults;
+
+ public class Xcls_ValaCompileResults : Object
+ {
+ public Gtk.Popover el;
+ private Xcls_ValaCompileResults _this;
+
+ public static Xcls_ValaCompileResults singleton()
+ {
+ if (_ValaCompileResults == null) {
+ _ValaCompileResults= new Xcls_ValaCompileResults();
+ }
+ return _ValaCompileResults;
+ }
+ public Xcls_compile_view compile_view;
+ public Xcls_sourceview sourceview;
+
+ // my vars (def)
+ public bool modal;
+ public Xcls_MainWindow window;
+ public bool active;
+
+ // ctor
+ public Xcls_ValaCompileResults()
+ {
+ _this = this;
+ this.el = new Gtk.Popover();
+
+ // my vars (dec)
+ this.modal = true;
+ this.active = true;
+
+ // set gobject values
+ this.el.width_request = 600;
+ this.el.height_request = 400;
+ this.el.position = Gtk.PositionType.TOP;
+ new Xcls_compile_view( _this );
+ this.el.set_child ( _this.compile_view.el );
+ }
+
+ // user defined functions
+ public void xaddLine (string str) {
+ /*
+ if (this.window.windowstate.project.path != BuilderApplication.valasource.file.project.path) {
+ // not our project.
+ return;
+ }
+
+
+ var buf = (GtkSource.Buffer)this.sourceview.el.get_buffer();
+ Gtk.TextIter iter;
+ buf.get_end_iter (out iter);
+ buf.insert(ref iter, str, str.length);
+ /// scroll..
+ buf.get_end_iter (out iter);
+ this.sourceview.el.scroll_to_iter(iter, 0.0f, true, 0.0f, 1.0f);
+ */
+ }
+ public void show ( Gtk.Widget onbtn, bool reset) {
+ var win = this.window.el;
+ var w = win.get_width();
+ var h = win.get_height();
+
+ // left tree = 250, editor area = 500?
+
+ var new_w = int.min(750, w-100);
+ if (new_w > (w-100)) {
+ new_w = w-100;
+ }
+ this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
+ if (this.el.parent == null) {
+ this.el.set_parent(win);
+ }
+ // Gtk.Allocation rect;
+ //onbtn.get_allocation(out rect);
+ //this.el.set_pointing_to(rect);
+
+ this.el.popup();
+ // not sure why..
+
+ if (reset) {
+ var buf = (GtkSource.Buffer)this.sourceview.el.get_buffer();
+ buf.set_text("",0);
+ }
+
+
+
+
+ }
+ public class Xcls_compile_view : Object
+ {
+ public Gtk.Box el;
+ private Xcls_ValaCompileResults _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_compile_view(Xcls_ValaCompileResults _owner )
+ {
+ _this = _owner;
+ _this.compile_view = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.homogeneous = false;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ var child_1 = new Xcls_ScrolledWindow3( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_ScrolledWindow3 : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private Xcls_ValaCompileResults _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_ScrolledWindow3(Xcls_ValaCompileResults _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.ScrolledWindow();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ new Xcls_sourceview( _this );
+ this.el.child = _this.sourceview.el;
+
+ // init method
+
+ {
+ this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+
+
+ }
+ }
+
+ // user defined functions
+ }
+ public class Xcls_sourceview : Object
+ {
+ public GtkSource.View el;
+ private Xcls_ValaCompileResults _this;
+
+
+ // my vars (def)
+ public Gtk.CssProvider css;
+
+ // ctor
+ public Xcls_sourceview(Xcls_ValaCompileResults _owner )
+ {
+ _this = _owner;
+ _this.sourceview = this;
+ this.el = new GtkSource.View();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.name = "compile-results-view";
+ this.el.editable = false;
+ this.el.show_line_numbers = false;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+
+ // init method
+
+ {
+
+ this.css = new Gtk.CssProvider();
+
+ this.css.load_from_string(
+ "#compile-results-view { font: 10px monospace ;}"
+ );
+
+ Gtk.StyleContext.add_provider_for_display(
+ this.el.get_display(),
+ this.css,
+ Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
+ );
+
+
+ }
+ }
+
+ // user defined functions
+ }
+
+
+
+ }
"Project.Gtk project" : "null",
"Project.GtkValaSettings? selected_target" : "null",
"Xcls_MainWindow window" : "null",
- "bool cg_loading" : false,
"bool done" : false,
"bool modal" : true,
"items" : [
"bind" : [
"(listitem) => {",
" ",
- "\tvar lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();",
+ "\tvar lbl = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();",
"\t ",
"\tvar item = (Project.VapiSelection) ((Gtk.ListItem)listitem).get_item();",
"",
" expand.set_hide_expander( jr.childfiles.n_items < 1);",
" \texpand.set_list_row(lr);",
" ",
- " \texpand.set_hide_expander( jr.xtype != \"Dir\" );",
+ " expand.set_hide_expander( jr.xtype != \"Dir\" );",
" \t expand.set_list_row(lr);",
" ",
" \t// bind image...",
"\tvar jr = (JsRender.JsRender) lr.get_item();",
"\t//GLib.debug(\"change %s to %s\", lbl.label, np.name);",
"",
- "\t//btn.active = jr.compile_group_selected;",
- "\tbtn.active = _this.selected_target.has_file(jr);",
"\t",
- " \t//jr.bind_property(\"compile_group_selected\",",
- " // btn, \"active\",",
- " // GLib.BindingFlags.BIDIRECTIONAL); ",
+ "\t ",
+ " \tjr.bind_property(\"compile_group_selected\",",
+ " btn, \"active\",",
+ " GLib.BindingFlags.SYNC_CREATE); ",
" \t// bind image...",
" \t",
"}"
],
"setup" : [
+ "",
"(listitem) => {",
"",
"\tvar btn = new Gtk.CheckButton();",
"\t((Gtk.ListItem)listitem).set_child(btn);",
"\t",
"\tbtn.toggled.connect(() => {",
- "\t \tif (_this.cg_loading) {",
- "\t \t\treturn;",
- " \t\t}",
+ "\t ",
"\t\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
"\t\tvar jr = (JsRender.JsRender) lr.get_item();",
"\t\tjr.compile_group_selected = btn.active;",
"\t ",
"\t GLib.debug(\"loading dirs into project list\");",
"\t cg.loading_ui = true;",
- "\t _this.cg_loading = true;",
+ "\t ",
"",
"\t _this.treeview.el.set_model(new Gtk.SingleSelection(null));",
"\t _this.project.loadDirsIntoStore(_this.treemodel.el);",
" \t _this.treeview.el.set_model(_this.treeselmodel.el);",
"\t ",
"\t cg.loading_ui = false;",
- "\t ",
- "\t _this.cg_loading = false;",
"\t GLib.debug(\"Set name to %s\", cg.name);",
"\t ",
" \t_this.build_name.el.buffer.set_text(cg.name.data);",
" ",
" ",
"\t_this.build_execute_args.el.buffer.set_text( cg.execute_args.data );",
+ "",
" ",
"}",
""
"bind" : [
"(listitem) => {",
" ",
- "\tvar lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();",
+ "\tvar lbl = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();",
"\t ",
"\tvar item = (Project.GtkValaSettings) ((Gtk.ListItem)listitem).get_item();",
"",
"\t\treturn true;",
"\t}",
"\treturn false;",
- "\t",
"}",
""
],
"() => {",
"\t if (!this.done) {",
" _this.el.show();",
+ " ",
" }",
"}"
]
-static ValaProjectSettingsPopover _ValaProjectSettingsPopover;
+ static ValaProjectSettingsPopover _ValaProjectSettingsPopover;
+
+ public class ValaProjectSettingsPopover : Object
+ {
+ public Gtk.Window el;
+ private ValaProjectSettingsPopover _this;
+
+ public static ValaProjectSettingsPopover singleton()
+ {
+ if (_ValaProjectSettingsPopover == null) {
+ _ValaProjectSettingsPopover= new ValaProjectSettingsPopover();
+ }
+ return _ValaProjectSettingsPopover;
+ }
+ public Xcls_notebook notebook;
+ public Xcls_label_global label_global;
+ public Xcls_label_targets label_targets;
+ public Xcls_compile_flags compile_flags;
+ public Xcls_vapi_scroll vapi_scroll;
+ public Xcls_vapimodel vapimodel;
+ public Xcls_vapi_filter vapi_filter;
+ public Xcls_vapi_search vapi_search;
+ public Xcls_set_vbox set_vbox;
+ public Xcls_treeview treeview;
+ public Xcls_treeselmodel treeselmodel;
+ public Xcls_treelistsort treelistsort;
+ public Xcls_treelistmodel treelistmodel;
+ public Xcls_treemodel treemodel;
+ public Xcls_name name;
+ public Xcls_target_sel target_sel;
+ public Xcls_target_model target_model;
+ public Xcls_set_vboxb set_vboxb;
+ public Xcls_build_name build_name;
+ public Xcls_build_execute_args build_execute_args;
+ public Xcls_save_btn save_btn;
+
+ // my vars (def)
+ public Project.Callback doneObj;
+ public Xcls_MainWindow window;
+ public Project.GtkValaSettings? selected_target;
+ public uint border_width;
+ public bool done;
+ public Project.Gtk project;
+
+ // ctor
+ public ValaProjectSettingsPopover()
+ {
+ _this = this;
+ this.el = new Gtk.Window();
+
+ // my vars (dec)
+ this.doneObj = null;
+ this.window = null;
+ this.selected_target = null;
+ this.border_width = 0;
+ this.done = false;
+ this.project = null;
+
+ // set gobject values
+ this.el.modal = true;
+ var child_1 = new Xcls_HeaderBar2( _this );
+ this.el.titlebar = child_1.el;
+ var child_2 = new Xcls_Box4( _this );
+ child_2.ref();
+ this.el.set_child ( child_2.el );
+
+ //listeners
+ this.el.close_request.connect( ( ) => {
+ if (!this.done) {
+ return true;
+ }
+ return false;
+ });
+ this.el.hide.connect( () => {
+ if (!this.done) {
+ _this.el.show();
+
+ }
+ });
+ }
+
+ // user defined functions
+ public void show (Gtk.Window pwin, Project.Gtk project, Project.Callback? doneObj) {
+
+ //print("ValaProjectSettings show\n");
+ this.doneObj = doneObj;
+ this.project= project;
+
+ this.compile_flags.el.buffer.set_text(
+ project.compile_flags.data
+ );
+
+ project.loadVapiIntoStore(_this.vapimodel.el);
+ GLib.Timeout.add(500, () => {
+ this.vapi_scroll.el.vadjustment.value = 0;
+ return false;
+ });
+
+
+
+ project.loadTargetsIntoStore(this.target_model.el);
+
+ _this.target_sel.el.selected = Gtk.INVALID_LIST_POSITION;
+ _this.target_sel.selectTarget(null);
+ // Gtk.Allocation rect;
+ //btn.get_allocation(out rect);
+ // this.el.set_pointing_to(rect);
+ this.el.application = pwin.application; // ??? make it modal?
+ this.el.set_transient_for(pwin);
+
+ // window + header?
+ // print("SHOWALL - POPIP\n");
+ this.el.set_size_request(800,800);
+ this.el.show();
+ this.notebook.el.page = 0; // first page.
+
+ //this.view.el.grab_focus();
+
+ }
+ public void save () {
+ this.project.save();
+ }
+ public class Xcls_HeaderBar2 : Object
+ {
+ public Gtk.HeaderBar el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_HeaderBar2(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.HeaderBar();
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Label3( _this );
+ this.el.title_widget = child_1.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Label3 : Object
+ {
+ public Gtk.Label el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label3(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Change Vala Compile settings" );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_Box4 : Object
+ {
+ public Gtk.Box el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box4(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ new Xcls_notebook( _this );
+ this.el.append( _this.notebook.el );
+ var child_2 = new Xcls_Box58( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_notebook : Object
+ {
+ public Gtk.Notebook el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_notebook(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.notebook = this;
+ this.el = new Gtk.Notebook();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.vexpand = true;
+ new Xcls_label_global( _this );
+ new Xcls_label_targets( _this );
+ var child_3 = new Xcls_Box8( _this );
+ child_3.ref();
+ this.el.append_page ( child_3.el , _this.label_global.el );
+ var child_4 = new Xcls_Paned26( _this );
+ child_4.ref();
+ this.el.append_page ( child_4.el , _this.label_targets.el );
+ }
-public class ValaProjectSettingsPopover : Object
-{
- public Gtk.Window el;
- private ValaProjectSettingsPopover _this;
+ // user defined functions
+ }
+ public class Xcls_label_global : Object
+ {
+ public Gtk.Label el;
+ private ValaProjectSettingsPopover _this;
- public static ValaProjectSettingsPopover singleton()
- {
- if (_ValaProjectSettingsPopover == null) {
- _ValaProjectSettingsPopover= new ValaProjectSettingsPopover();
- }
- return _ValaProjectSettingsPopover;
- }
- public Xcls_notebook notebook;
- public Xcls_label_global label_global;
- public Xcls_label_targets label_targets;
- public Xcls_compile_flags compile_flags;
- public Xcls_vapi_scroll vapi_scroll;
- public Xcls_vapimodel vapimodel;
- public Xcls_vapi_filter vapi_filter;
- public Xcls_vapi_search vapi_search;
- public Xcls_set_vbox set_vbox;
- public Xcls_treeview treeview;
- public Xcls_treeselmodel treeselmodel;
- public Xcls_treelistsort treelistsort;
- public Xcls_treelistmodel treelistmodel;
- public Xcls_treemodel treemodel;
- public Xcls_name name;
- public Xcls_target_sel target_sel;
- public Xcls_target_model target_model;
- public Xcls_set_vboxb set_vboxb;
- public Xcls_build_name build_name;
- public Xcls_build_execute_args build_execute_args;
- public Xcls_save_btn save_btn;
-
- // my vars (def)
- public Project.Callback doneObj;
- public bool cg_loading;
- public Xcls_MainWindow window;
- public Project.GtkValaSettings? selected_target;
- public uint border_width;
- public bool done;
- public Project.Gtk project;
-
- // ctor
- public ValaProjectSettingsPopover()
- {
- _this = this;
- this.el = new Gtk.Window();
-
- // my vars (dec)
- this.doneObj = null;
- this.cg_loading = false;
- this.window = null;
- this.selected_target = null;
- this.border_width = 0;
- this.done = false;
- this.project = null;
-
- // set gobject values
- this.el.modal = true;
- var child_1 = new Xcls_HeaderBar2( _this );
- this.el.titlebar = child_1.el;
- var child_2 = new Xcls_Box4( _this );
- child_2.ref();
- this.el.set_child ( child_2.el );
-
- //listeners
- this.el.close_request.connect( ( ) => {
- if (!this.done) {
- return true;
- }
- return false;
-
- });
- this.el.hide.connect( () => {
- if (!this.done) {
- _this.el.show();
- }
- });
- }
- // user defined functions
- public void show (Gtk.Window pwin, Project.Gtk project, Project.Callback? doneObj) {
-
- //print("ValaProjectSettings show\n");
- this.doneObj = doneObj;
- this.project= project;
-
- this.compile_flags.el.buffer.set_text(
- project.compile_flags.data
- );
-
- project.loadVapiIntoStore(_this.vapimodel.el);
- GLib.Timeout.add(500, () => {
- this.vapi_scroll.el.vadjustment.value = 0;
- return false;
- });
-
-
-
- project.loadTargetsIntoStore(this.target_model.el);
-
- _this.target_sel.el.selected = Gtk.INVALID_LIST_POSITION;
- _this.target_sel.selectTarget(null);
- // Gtk.Allocation rect;
- //btn.get_allocation(out rect);
- // this.el.set_pointing_to(rect);
- this.el.application = pwin.application; // ??? make it modal?
- this.el.set_transient_for(pwin);
-
- // window + header?
- // print("SHOWALL - POPIP\n");
- this.el.set_size_request(800,800);
- this.el.show();
- this.notebook.el.page = 0; // first page.
-
- //this.view.el.grab_focus();
-
- }
- public void save () {
- this.project.save();
- }
- public class Xcls_HeaderBar2 : Object
- {
- public Gtk.HeaderBar el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
+ // ctor
+ public Xcls_label_global(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.label_global = this;
+ this.el = new Gtk.Label( "Global" );
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_HeaderBar2(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.HeaderBar();
+ // set gobject values
+ }
- // my vars (dec)
+ // user defined functions
+ }
- // set gobject values
- var child_1 = new Xcls_Label3( _this );
- this.el.title_widget = child_1.el;
- }
+ public class Xcls_label_targets : Object
+ {
+ public Gtk.Label el;
+ private ValaProjectSettingsPopover _this;
- // user defined functions
- }
- public class Xcls_Label3 : Object
- {
- public Gtk.Label el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_label_targets(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.label_targets = this;
+ this.el = new Gtk.Label( "Targets" );
+
+ // my vars (dec)
- // ctor
- public Xcls_Label3(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Change Vala Compile settings" );
+ // set gobject values
+ }
- // my vars (dec)
+ // user defined functions
+ }
- // set gobject values
- }
+ public class Xcls_Box8 : Object
+ {
+ public Gtk.Box el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box8(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.homogeneous = false;
+ var child_1 = new Xcls_Label9( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ new Xcls_compile_flags( _this );
+ this.el.append( _this.compile_flags.el );
+ new Xcls_vapi_scroll( _this );
+ this.el.append( _this.vapi_scroll.el );
+ new Xcls_vapi_search( _this );
+ this.el.append( _this.vapi_search.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Label9 : Object
+ {
+ public Gtk.Label el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label9(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "compile flags" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.hexpand = true;
+ }
- // user defined functions
- }
+ // user defined functions
+ }
+ public class Xcls_compile_flags : Object
+ {
+ public Gtk.Entry el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_compile_flags(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.compile_flags = this;
+ this.el = new Gtk.Entry();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.placeholder_text = "eg. -g --valasrc $BASEDIR ";
+
+ //listeners
+ this.el.changed.connect( () => {
+
+ _this.project.compile_flags = this.el.buffer.text;
+ _this.project.save();
+ // _this.project.save();
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_vapi_scroll : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_vapi_scroll(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.vapi_scroll = this;
+ this.el = new Gtk.ScrolledWindow();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
+ this.el.has_frame = true;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ this.el.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
+ var child_1 = new Xcls_ColumnView12( _this );
+ this.el.child = child_1.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_ColumnView12 : Object
+ {
+ public Gtk.ColumnView el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_ColumnView12(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_NoSelection13( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnView( child_1.el );
+
+ // my vars (dec)
- public class Xcls_Box4 : Object
- {
- public Gtk.Box el;
- private ValaProjectSettingsPopover _this;
+ // set gobject values
+ var child_2 = new Xcls_ColumnViewColumn21( _this );
+ child_2.ref();
+ this.el.append_column ( child_2.el );
+ var child_3 = new Xcls_ColumnViewColumn23( _this );
+ child_3.ref();
+ this.el.append_column ( child_3.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_NoSelection13 : Object
+ {
+ public Gtk.NoSelection el;
+ private ValaProjectSettingsPopover _this;
- // my vars (def)
+ // my vars (def)
+
+ // ctor
+ public Xcls_NoSelection13(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_FilterListModel14( _this );
+ child_1.ref();
+ this.el = new Gtk.NoSelection( child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+ public class Xcls_FilterListModel14 : Object
+ {
+ public Gtk.FilterListModel el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_FilterListModel14(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_SortListModel15( _this );
+ child_1.ref();
+ new Xcls_vapi_filter( _this );
+ this.el = new Gtk.FilterListModel( child_1.el, _this.vapi_filter.el );
- // ctor
- public Xcls_Box4(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ }
- // set gobject values
- this.el.hexpand = true;
- this.el.vexpand = true;
- new Xcls_notebook( _this );
- this.el.append( _this.notebook.el );
- var child_2 = new Xcls_Box58( _this );
- child_2.ref();
- this.el.append( child_2.el );
- }
+ // user defined functions
+ }
+ public class Xcls_SortListModel15 : Object
+ {
+ public Gtk.SortListModel el;
+ private ValaProjectSettingsPopover _this;
- // user defined functions
- }
- public class Xcls_notebook : Object
- {
- public Gtk.Notebook el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_notebook(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.notebook = this;
- this.el = new Gtk.Notebook();
-
- // my vars (dec)
-
- // set gobject values
- this.el.vexpand = true;
- new Xcls_label_global( _this );
- new Xcls_label_targets( _this );
- var child_3 = new Xcls_Box8( _this );
- child_3.ref();
- this.el.append_page ( child_3.el , _this.label_global.el );
- var child_4 = new Xcls_Paned26( _this );
- child_4.ref();
- this.el.append_page ( child_4.el , _this.label_targets.el );
- }
- // user defined functions
- }
- public class Xcls_label_global : Object
- {
- public Gtk.Label el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
+ // ctor
+ public Xcls_SortListModel15(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ new Xcls_vapimodel( _this );
+ var child_2 = new Xcls_StringSorter17( _this );
+ child_2.ref();
+ this.el = new Gtk.SortListModel( _this.vapimodel.el, child_2.el );
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_label_global(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.label_global = this;
- this.el = new Gtk.Label( "Global" );
+ // set gobject values
+ }
- // my vars (dec)
+ // user defined functions
+ }
+ public class Xcls_vapimodel : Object
+ {
+ public GLib.ListStore el;
+ private ValaProjectSettingsPopover _this;
- // set gobject values
- }
- // user defined functions
- }
+ // my vars (def)
- public class Xcls_label_targets : Object
- {
- public Gtk.Label el;
- private ValaProjectSettingsPopover _this;
+ // ctor
+ public Xcls_vapimodel(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.vapimodel = this;
+ this.el = new GLib.ListStore( typeof(Project.VapiSelection) );
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ }
- // ctor
- public Xcls_label_targets(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.label_targets = this;
- this.el = new Gtk.Label( "Targets" );
+ // user defined functions
+ }
- // my vars (dec)
+ public class Xcls_StringSorter17 : Object
+ {
+ public Gtk.StringSorter el;
+ private ValaProjectSettingsPopover _this;
- // set gobject values
- }
- // user defined functions
- }
+ // my vars (def)
- public class Xcls_Box8 : Object
- {
- public Gtk.Box el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box8(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- var child_1 = new Xcls_Label9( _this );
- child_1.ref();
- this.el.append( child_1.el );
- new Xcls_compile_flags( _this );
- this.el.append( _this.compile_flags.el );
- new Xcls_vapi_scroll( _this );
- this.el.append( _this.vapi_scroll.el );
- new Xcls_vapi_search( _this );
- this.el.append( _this.vapi_search.el );
- }
+ // ctor
+ public Xcls_StringSorter17(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_PropertyExpression18( _this );
+ child_1.ref();
+ this.el = new Gtk.StringSorter( child_1.el );
- // user defined functions
- }
- public class Xcls_Label9 : Object
- {
- public Gtk.Label el;
- private ValaProjectSettingsPopover _this;
+ // my vars (dec)
+ // set gobject values
+ }
- // my vars (def)
+ // user defined functions
+ }
+ public class Xcls_PropertyExpression18 : Object
+ {
+ public Gtk.PropertyExpression el;
+ private ValaProjectSettingsPopover _this;
- // ctor
- public Xcls_Label9(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "compile flags" );
- // my vars (dec)
+ // my vars (def)
- // set gobject values
- this.el.halign = Gtk.Align.START;
- this.el.hexpand = true;
- }
+ // ctor
+ public Xcls_PropertyExpression18(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.PropertyExpression( typeof(Project.VapiSelection), null, "sortkey" );
- // user defined functions
- }
+ // my vars (dec)
- public class Xcls_compile_flags : Object
- {
- public Gtk.Entry el;
- private ValaProjectSettingsPopover _this;
+ // set gobject values
+ }
+ // user defined functions
+ }
- // my vars (def)
- // ctor
- public Xcls_compile_flags(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.compile_flags = this;
- this.el = new Gtk.Entry();
- // my vars (dec)
+ public class Xcls_vapi_filter : Object
+ {
+ public Gtk.StringFilter el;
+ private ValaProjectSettingsPopover _this;
- // set gobject values
- this.el.placeholder_text = "eg. -g --valasrc $BASEDIR ";
- //listeners
- this.el.changed.connect( () => {
-
- _this.project.compile_flags = this.el.buffer.text;
- _this.project.save();
- // _this.project.save();
-
- });
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_vapi_filter(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.vapi_filter = this;
+ var child_1 = new Xcls_PropertyExpression20( _this );
+ child_1.ref();
+ this.el = new Gtk.StringFilter( child_1.el );
- public class Xcls_vapi_scroll : Object
- {
- public Gtk.ScrolledWindow el;
- private ValaProjectSettingsPopover _this;
+ // my vars (dec)
+ // set gobject values
+ }
- // my vars (def)
+ // user defined functions
+ }
+ public class Xcls_PropertyExpression20 : Object
+ {
+ public Gtk.PropertyExpression el;
+ private ValaProjectSettingsPopover _this;
- // ctor
- public Xcls_vapi_scroll(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.vapi_scroll = this;
- this.el = new Gtk.ScrolledWindow();
- // my vars (dec)
+ // my vars (def)
- // set gobject values
- this.el.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
- this.el.has_frame = true;
- this.el.hexpand = true;
- this.el.vexpand = true;
- this.el.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
- var child_1 = new Xcls_ColumnView12( _this );
- this.el.child = child_1.el;
- }
+ // ctor
+ public Xcls_PropertyExpression20(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.PropertyExpression( typeof(Project.VapiSelection), null, "sortkey" );
- // user defined functions
- }
- public class Xcls_ColumnView12 : Object
- {
- public Gtk.ColumnView el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ColumnView12(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_NoSelection13( _this );
- child_1.ref();
- this.el = new Gtk.ColumnView( child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- var child_2 = new Xcls_ColumnViewColumn21( _this );
- child_2.ref();
- this.el.append_column ( child_2.el );
- var child_3 = new Xcls_ColumnViewColumn23( _this );
- child_3.ref();
- this.el.append_column ( child_3.el );
- }
+ // my vars (dec)
- // user defined functions
- }
- public class Xcls_NoSelection13 : Object
- {
- public Gtk.NoSelection el;
- private ValaProjectSettingsPopover _this;
+ // set gobject values
+ }
+ // user defined functions
+ }
- // my vars (def)
- // ctor
- public Xcls_NoSelection13(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_FilterListModel14( _this );
- child_1.ref();
- this.el = new Gtk.NoSelection( child_1.el );
- // my vars (dec)
- // set gobject values
- }
+ public class Xcls_ColumnViewColumn21 : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private ValaProjectSettingsPopover _this;
- // user defined functions
- }
- public class Xcls_FilterListModel14 : Object
- {
- public Gtk.FilterListModel el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_ColumnViewColumn21(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_SignalListItemFactory22( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Vapi Package", child_1.el );
- // ctor
- public Xcls_FilterListModel14(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_SortListModel15( _this );
- child_1.ref();
- new Xcls_vapi_filter( _this );
- this.el = new Gtk.FilterListModel( child_1.el, _this.vapi_filter.el );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.expand = true;
+ }
- // set gobject values
- }
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory22 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private ValaProjectSettingsPopover _this;
- // user defined functions
- }
- public class Xcls_SortListModel15 : Object
- {
- public Gtk.SortListModel el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_SignalListItemFactory22(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (item) => {
+ //var j = (JsRender.JsRender) item;
+ var gi = (Gtk.ListItem)item;
+
+ var lbl = new Gtk.Label("");
+ lbl.halign = Gtk.Align.START;
+ gi.set_child(lbl);
+
+
+
+ });
+ this.el.bind.connect( (listitem) => {
+
+ var lbl = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();
+
+ var item = (Project.VapiSelection) ((Gtk.ListItem)listitem).get_item();
+
+ item.bind_property("name",
+ lbl, "label",
+ GLib.BindingFlags.SYNC_CREATE);
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_ColumnViewColumn23 : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_ColumnViewColumn23(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_SignalListItemFactory24( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "use", child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory24 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_SignalListItemFactory24(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (listitem) => {
+
+ var btn = new Gtk.CheckButton();
+
+ ((Gtk.ListItem)listitem).set_child(btn);
+
+ btn.toggled.connect(() => {
+
+ var jr = (Project.VapiSelection) ((Gtk.ListItem)listitem).get_item();
+ jr.selected = btn.active;
+ });
+ });
+ this.el.bind.connect( (listitem) => {
+ //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
+
+
+
+ //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
+ var btn = (Gtk.CheckButton) ((Gtk.ListItem)listitem).get_child();
+
+
+ var vs = (Project.VapiSelection)((Gtk.ListItem)listitem).get_item();
+
+ //GLib.debug("change %s to %s", lbl.label, np.name);
+
+ btn.active = vs.selected;
+
+ vs.btn = btn;
+ // bind image...
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+
+
+ public class Xcls_vapi_search : Object
+ {
+ public Gtk.SearchEntry el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_vapi_search(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.vapi_search = this;
+ this.el = new Gtk.SearchEntry();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.placeholder_text = "Search Libraries (Vapi)";
+ this.el.search_delay = 500;
+
+ //listeners
+ this.el.search_changed.connect( ( ) => {
+
+ _this.vapi_filter.el.set_search(this.el.get_text());
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_Paned26 : Object
+ {
+ public Gtk.Paned el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Paned26(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.vexpand = true;
+ this.el.position = 300;
+ new Xcls_set_vbox( _this );
+ this.el.set_end_child ( _this.set_vbox.el );
+ var child_2 = new Xcls_Box43( _this );
+ this.el.start_child = child_2.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_set_vbox : Object
+ {
+ public Gtk.Box el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_set_vbox(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.set_vbox = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.homogeneous = false;
+ var child_1 = new Xcls_ScrolledWindow28( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ }
- // ctor
- public Xcls_SortListModel15(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- new Xcls_vapimodel( _this );
- var child_2 = new Xcls_StringSorter17( _this );
- child_2.ref();
- this.el = new Gtk.SortListModel( _this.vapimodel.el, child_2.el );
+ // user defined functions
+ }
+ public class Xcls_ScrolledWindow28 : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- }
-
- // user defined functions
- }
- public class Xcls_vapimodel : Object
- {
- public GLib.ListStore el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
+ // ctor
+ public Xcls_ScrolledWindow28(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.ScrolledWindow();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.vexpand = true;
+ new Xcls_treeview( _this );
+ this.el.child = _this.treeview.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_treeview : Object
+ {
+ public Gtk.ColumnView el;
+ private ValaProjectSettingsPopover _this;
- // my vars (def)
-
- // ctor
- public Xcls_vapimodel(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.vapimodel = this;
- this.el = new GLib.ListStore( typeof(Project.VapiSelection) );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_StringSorter17 : Object
- {
- public Gtk.StringSorter el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_StringSorter17(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_PropertyExpression18( _this );
- child_1.ref();
- this.el = new Gtk.StringSorter( child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
- public class Xcls_PropertyExpression18 : Object
- {
- public Gtk.PropertyExpression el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_PropertyExpression18(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.PropertyExpression( typeof(Project.VapiSelection), null, "sortkey" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
-
- public class Xcls_vapi_filter : Object
- {
- public Gtk.StringFilter el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_vapi_filter(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.vapi_filter = this;
- var child_1 = new Xcls_PropertyExpression20( _this );
- child_1.ref();
- this.el = new Gtk.StringFilter( child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
- public class Xcls_PropertyExpression20 : Object
- {
- public Gtk.PropertyExpression el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_PropertyExpression20(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.PropertyExpression( typeof(Project.VapiSelection), null, "sortkey" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
+ // my vars (def)
+
+ // ctor
+ public Xcls_treeview(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.treeview = this;
+ new Xcls_treeselmodel( _this );
+ this.el = new Gtk.ColumnView( _this.treeselmodel.el );
+
+ // my vars (dec)
+ // set gobject values
+ new Xcls_name( _this );
+ this.el.append_column ( _this.name.el );
+ var child_3 = new Xcls_ColumnViewColumn41( _this );
+ child_3.ref();
+ this.el.append_column ( child_3.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_treeselmodel : Object
+ {
+ public Gtk.SingleSelection el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_treeselmodel(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.treeselmodel = this;
+ var child_1 = new Xcls_FilterListModel31( _this );
+ child_1.ref();
+ this.el = new Gtk.SingleSelection( child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+ public class Xcls_FilterListModel31 : Object
+ {
+ public Gtk.FilterListModel el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_FilterListModel31(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ new Xcls_treelistsort( _this );
+ var child_2 = new Xcls_CustomFilter38( _this );
+ child_2.ref();
+ this.el = new Gtk.FilterListModel( _this.treelistsort.el, child_2.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+ public class Xcls_treelistsort : Object
+ {
+ public Gtk.SortListModel el;
+ private ValaProjectSettingsPopover _this;
- public class Xcls_ColumnViewColumn21 : Object
- {
- public Gtk.ColumnViewColumn el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ColumnViewColumn21(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_SignalListItemFactory22( _this );
- child_1.ref();
- this.el = new Gtk.ColumnViewColumn( "Vapi Package", child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.expand = true;
- }
-
- // user defined functions
- }
- public class Xcls_SignalListItemFactory22 : Object
- {
- public Gtk.SignalListItemFactory el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SignalListItemFactory22(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.SignalListItemFactory();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.setup.connect( (item) => {
- //var j = (JsRender.JsRender) item;
- var gi = (Gtk.ListItem)item;
-
- var lbl = new Gtk.Label("");
- lbl.halign = Gtk.Align.START;
- gi.set_child(lbl);
-
-
-
- });
- this.el.bind.connect( (listitem) => {
-
- var lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();
-
- var item = (Project.VapiSelection) ((Gtk.ListItem)listitem).get_item();
-
- item.bind_property("name",
- lbl, "label",
- GLib.BindingFlags.SYNC_CREATE);
-
-
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_ColumnViewColumn23 : Object
- {
- public Gtk.ColumnViewColumn el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ColumnViewColumn23(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_SignalListItemFactory24( _this );
- child_1.ref();
- this.el = new Gtk.ColumnViewColumn( "use", child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
- public class Xcls_SignalListItemFactory24 : Object
- {
- public Gtk.SignalListItemFactory el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SignalListItemFactory24(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.SignalListItemFactory();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.setup.connect( (listitem) => {
-
- var btn = new Gtk.CheckButton();
-
- ((Gtk.ListItem)listitem).set_child(btn);
-
- btn.toggled.connect(() => {
-
- var jr = (Project.VapiSelection) ((Gtk.ListItem)listitem).get_item();
- jr.selected = btn.active;
- });
- });
- this.el.bind.connect( (listitem) => {
- //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
-
-
-
- //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
- var btn = (Gtk.CheckButton) ((Gtk.ListItem)listitem).get_child();
-
-
- var vs = (Project.VapiSelection)((Gtk.ListItem)listitem).get_item();
-
- //GLib.debug("change %s to %s", lbl.label, np.name);
-
- btn.active = vs.selected;
-
- vs.btn = btn;
- // bind image...
-
- });
- }
-
- // user defined functions
- }
-
-
-
-
- public class Xcls_vapi_search : Object
- {
- public Gtk.SearchEntry el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_vapi_search(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.vapi_search = this;
- this.el = new Gtk.SearchEntry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.placeholder_text = "Search Libraries (Vapi)";
- this.el.search_delay = 500;
-
- //listeners
- this.el.search_changed.connect( ( ) => {
-
- _this.vapi_filter.el.set_search(this.el.get_text());
-
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_Paned26 : Object
- {
- public Gtk.Paned el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Paned26(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
-
- // my vars (dec)
-
- // set gobject values
- this.el.vexpand = true;
- this.el.position = 300;
- new Xcls_set_vbox( _this );
- this.el.set_end_child ( _this.set_vbox.el );
- var child_2 = new Xcls_Box43( _this );
- this.el.start_child = child_2.el;
- }
-
- // user defined functions
- }
- public class Xcls_set_vbox : Object
- {
- public Gtk.Box el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_set_vbox(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.set_vbox = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- var child_1 = new Xcls_ScrolledWindow28( _this );
- child_1.ref();
- this.el.append( child_1.el );
- }
-
- // user defined functions
- }
- public class Xcls_ScrolledWindow28 : Object
- {
- public Gtk.ScrolledWindow el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ScrolledWindow28(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow();
-
- // my vars (dec)
-
- // set gobject values
- this.el.vexpand = true;
- new Xcls_treeview( _this );
- this.el.child = _this.treeview.el;
- }
-
- // user defined functions
- }
- public class Xcls_treeview : Object
- {
- public Gtk.ColumnView el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_treeview(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.treeview = this;
- new Xcls_treeselmodel( _this );
- this.el = new Gtk.ColumnView( _this.treeselmodel.el );
-
- // my vars (dec)
-
- // set gobject values
- new Xcls_name( _this );
- this.el.append_column ( _this.name.el );
- var child_3 = new Xcls_ColumnViewColumn41( _this );
- child_3.ref();
- this.el.append_column ( child_3.el );
- }
-
- // user defined functions
- }
- public class Xcls_treeselmodel : Object
- {
- public Gtk.SingleSelection el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_treeselmodel(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.treeselmodel = this;
- var child_1 = new Xcls_FilterListModel31( _this );
- child_1.ref();
- this.el = new Gtk.SingleSelection( child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
- public class Xcls_FilterListModel31 : Object
- {
- public Gtk.FilterListModel el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_FilterListModel31(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- new Xcls_treelistsort( _this );
- var child_2 = new Xcls_CustomFilter38( _this );
- child_2.ref();
- this.el = new Gtk.FilterListModel( _this.treelistsort.el, child_2.el );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
- public class Xcls_treelistsort : Object
- {
- public Gtk.SortListModel el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_treelistsort(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.treelistsort = this;
- new Xcls_treelistmodel( _this );
- var child_2 = new Xcls_TreeListRowSorter35( _this );
- child_2.ref();
- this.el = new Gtk.SortListModel( _this.treelistmodel.el, child_2.el );
-
- // my vars (dec)
-
- // set gobject values
-
- // init method
-
- {
- //this.el.set_sorter(new Gtk.TreeListRowSorter(_this.treeview.el.sorter));
- }
- }
-
- // user defined functions
- }
- public class Xcls_treelistmodel : Object
- {
- public Gtk.TreeListModel el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_treelistmodel(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.treelistmodel = this;
- new Xcls_treemodel( _this );
- this.el = new Gtk.TreeListModel( _this.treemodel.el, false, true, (item) => {
+ // my vars (def)
+
+ // ctor
+ public Xcls_treelistsort(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.treelistsort = this;
+ new Xcls_treelistmodel( _this );
+ var child_2 = new Xcls_TreeListRowSorter35( _this );
+ child_2.ref();
+ this.el = new Gtk.SortListModel( _this.treelistmodel.el, child_2.el );
+
+ // my vars (dec)
+
+ // set gobject values
+
+ // init method
+
+ {
+ //this.el.set_sorter(new Gtk.TreeListRowSorter(_this.treeview.el.sorter));
+ }
+ }
+
+ // user defined functions
+ }
+ public class Xcls_treelistmodel : Object
+ {
+ public Gtk.TreeListModel el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_treelistmodel(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.treelistmodel = this;
+ new Xcls_treemodel( _this );
+ this.el = new Gtk.TreeListModel( _this.treemodel.el, false, true, (item) => {
//GLib.debug("liststore got %s", item.get_type().name());
return ((JsRender.JsRender)item).childfiles;
} );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ }
- // user defined functions
- }
- public class Xcls_treemodel : Object
- {
- public GLib.ListStore el;
- private ValaProjectSettingsPopover _this;
+ // user defined functions
+ }
+ public class Xcls_treemodel : Object
+ {
+ public GLib.ListStore el;
+ private ValaProjectSettingsPopover _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_treemodel(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.treemodel = this;
- this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
+ // ctor
+ public Xcls_treemodel(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.treemodel = this;
+ this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ }
- // user defined functions
- }
+ // user defined functions
+ }
- public class Xcls_TreeListRowSorter35 : Object
- {
- public Gtk.TreeListRowSorter el;
- private ValaProjectSettingsPopover _this;
+ public class Xcls_TreeListRowSorter35 : Object
+ {
+ public Gtk.TreeListRowSorter el;
+ private ValaProjectSettingsPopover _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_TreeListRowSorter35(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_StringSorter36( _this );
- child_1.ref();
- this.el = new Gtk.TreeListRowSorter( child_1.el );
+ // ctor
+ public Xcls_TreeListRowSorter35(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_StringSorter36( _this );
+ child_1.ref();
+ this.el = new Gtk.TreeListRowSorter( child_1.el );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ }
- // user defined functions
- }
- public class Xcls_StringSorter36 : Object
- {
- public Gtk.StringSorter el;
- private ValaProjectSettingsPopover _this;
+ // user defined functions
+ }
+ public class Xcls_StringSorter36 : Object
+ {
+ public Gtk.StringSorter el;
+ private ValaProjectSettingsPopover _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_StringSorter36(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_PropertyExpression37( _this );
- child_1.ref();
- this.el = new Gtk.StringSorter( child_1.el );
+ // ctor
+ public Xcls_StringSorter36(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_PropertyExpression37( _this );
+ child_1.ref();
+ this.el = new Gtk.StringSorter( child_1.el );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ }
- // user defined functions
- }
- public class Xcls_PropertyExpression37 : Object
- {
- public Gtk.PropertyExpression el;
- private ValaProjectSettingsPopover _this;
+ // user defined functions
+ }
+ public class Xcls_PropertyExpression37 : Object
+ {
+ public Gtk.PropertyExpression el;
+ private ValaProjectSettingsPopover _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_PropertyExpression37(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
+ // ctor
+ public Xcls_PropertyExpression37(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ }
- // user defined functions
- }
+ // user defined functions
+ }
- public class Xcls_CustomFilter38 : Object
- {
- public Gtk.CustomFilter el;
- private ValaProjectSettingsPopover _this;
+ public class Xcls_CustomFilter38 : Object
+ {
+ public Gtk.CustomFilter el;
+ private ValaProjectSettingsPopover _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_CustomFilter38(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.CustomFilter( (item) => {
+ // ctor
+ public Xcls_CustomFilter38(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.CustomFilter( (item) => {
var tr = ((Gtk.TreeListRow)item).get_item();
//GLib.debug("filter %s", tr.get_type().name());
} );
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
-
- public class Xcls_name : Object
- {
- public Gtk.ColumnViewColumn el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_name(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.name = this;
- var child_1 = new Xcls_SignalListItemFactory40( _this );
- child_1.ref();
- this.el = new Gtk.ColumnViewColumn( "Other Files", child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.id = "name";
- this.el.expand = true;
- this.el.resizable = true;
-
- // init method
-
- {
- this.el.set_sorter( new Gtk.StringSorter(
- new Gtk.PropertyExpression(typeof(JsRender.JsRender), null, "name")
- ));
- ;
-
- }
- }
-
- // user defined functions
- }
- public class Xcls_SignalListItemFactory40 : Object
- {
- public Gtk.SignalListItemFactory el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SignalListItemFactory40(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.SignalListItemFactory();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.setup.connect( (listitem) => {
-
- var expand = new Gtk.TreeExpander();
-
- expand.set_indent_for_depth(true);
- expand.set_indent_for_icon(true);
-
- var lbl = new Gtk.Label("");
- lbl.use_markup = true;
-
-
- lbl.justify = Gtk.Justification.LEFT;
- lbl.xalign = 0;
-
-
- expand.set_child(lbl);
- ((Gtk.ListItem)listitem).set_child(expand);
- ((Gtk.ListItem)listitem).activatable = false;
- });
- this.el.bind.connect( (listitem) => {
- //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
-
-
-
- //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
- var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
-
-
- var lbl = (Gtk.Label) expand.child;
-
- if (lbl.label != "") { // do not update
- return;
- }
-
-
- var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
- var jr = (JsRender.JsRender) lr.get_item();
- //GLib.debug("change %s to %s", lbl.label, np.name);
- lbl.label = jr.name; // for dir's we could hsow the sub path..
- lbl.tooltip_markup = jr.path;
-
- expand.set_hide_expander( jr.childfiles.n_items < 1);
- expand.set_list_row(lr);
-
- expand.set_hide_expander( jr.xtype != "Dir" );
- expand.set_list_row(lr);
-
- // bind image...
-
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_ColumnViewColumn41 : Object
- {
- public Gtk.ColumnViewColumn el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ColumnViewColumn41(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_SignalListItemFactory42( _this );
- child_1.ref();
- this.el = new Gtk.ColumnViewColumn( "use", child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
- public class Xcls_SignalListItemFactory42 : Object
- {
- public Gtk.SignalListItemFactory el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SignalListItemFactory42(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.SignalListItemFactory();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.setup.connect( (listitem) => {
-
- var btn = new Gtk.CheckButton();
-
- ((Gtk.ListItem)listitem).set_child(btn);
-
- btn.toggled.connect(() => {
- if (_this.cg_loading) {
- return;
- }
- var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
- var jr = (JsRender.JsRender) lr.get_item();
- jr.compile_group_selected = btn.active;
-
-
- });
- });
- this.el.bind.connect( (listitem) => {
- //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
-
-
-
- //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
- var btn = (Gtk.CheckButton) ((Gtk.ListItem)listitem).get_child();
-
-
- var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
- var jr = (JsRender.JsRender) lr.get_item();
- //GLib.debug("change %s to %s", lbl.label, np.name);
-
- //btn.active = jr.compile_group_selected;
- btn.active = _this.selected_target.has_file(jr);
-
- //jr.bind_property("compile_group_selected",
- // btn, "active",
- // GLib.BindingFlags.BIDIRECTIONAL);
- // bind image...
-
- });
- }
-
- // user defined functions
- }
-
-
-
-
-
- public class Xcls_Box43 : Object
- {
- public Gtk.Box el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box43(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- var child_1 = new Xcls_Box44( _this );
- child_1.ref();
- this.el.append( child_1.el );
- var child_2 = new Xcls_ScrolledWindow47( _this );
- child_2.ref();
- this.el.append( child_2.el );
- new Xcls_set_vboxb( _this );
- this.el.append( _this.set_vboxb.el );
- }
-
- // user defined functions
- }
- public class Xcls_Box44 : Object
- {
- public Gtk.Box el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box44(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- var child_1 = new Xcls_Button45( _this );
- child_1.ref();
- this.el.append( child_1.el );
- var child_2 = new Xcls_Button46( _this );
- child_2.ref();
- this.el.append( child_2.el );
- }
-
- // user defined functions
- }
- public class Xcls_Button45 : Object
- {
- public Gtk.Button el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button45(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- this.el.label = "Add Compile Target";
-
- //listeners
- this.el.clicked.connect( () => {
-
- if (_this.project.compilegroups.has_key("NEW GROUP")) {
- return;
- }
- var cg = new Project.GtkValaSettings(_this.project, "NEW GROUP");
- _this.project.compilegroups.set(cg.name, cg);
- _this.project.loadTargetsIntoStore(_this.target_model.el);
- // select it.. ?? should load it??
- for(var i =0;i < _this.target_model.el.n_items; i++) {
- var ncg = (Project.GtkValaSettings) _this.target_model.el.get_item(i);
- if (ncg.name == cg.name) {
- _this.target_sel.el.selected = i;
- _this.target_sel.selectTarget(cg);
- break;
- }
- }
-
-
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Button46 : Object
- {
- public Gtk.Button el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button46(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- this.el.label = "Remove Target";
-
- //listeners
- this.el.clicked.connect( () => {
- // load the new values.
- if (_this.target_sel.el.selected == Gtk.INVALID_LIST_POSITION) {
- GLib.debug("nothing selected");
- return;
- }
-
-
- // add the directory..
- var cg = (Project.GtkValaSettings) _this.target_model.el.get_item(_this.target_sel.el.selected);
-
-
- GLib.debug("remove: %s\n", cg.name);
- if (!_this.project.compilegroups.unset(cg.name)) {
- GLib.debug("remove failed");
- }
- _this.project.loadTargetsIntoStore(_this.target_model.el);
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_ScrolledWindow47 : Object
- {
- public Gtk.ScrolledWindow el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ScrolledWindow47(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow();
-
- // my vars (dec)
-
- // set gobject values
- this.el.vexpand = true;
- var child_1 = new Xcls_ColumnView48( _this );
- this.el.child = child_1.el;
-
- // init method
-
- {
- this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
-
- }
- }
-
- // user defined functions
- }
- public class Xcls_ColumnView48 : Object
- {
- public Gtk.ColumnView el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ColumnView48(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- new Xcls_target_sel( _this );
- this.el = new Gtk.ColumnView( _this.target_sel.el );
-
- // my vars (dec)
-
- // set gobject values
- var child_2 = new Xcls_ColumnViewColumn51( _this );
- child_2.ref();
- this.el.append_column ( child_2.el );
- }
-
- // user defined functions
- }
- public class Xcls_target_sel : Object
- {
- public Gtk.SingleSelection el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_target_sel(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.target_sel = this;
- new Xcls_target_model( _this );
- this.el = new Gtk.SingleSelection( _this.target_model.el );
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.selection_changed.connect( (position, n_items) => {
-
-
- // load the new values.
- if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
- this.selectTarget(null);
- return;
- }
- this.selectTarget(null);
-
-
-
- // add the directory..
- var cg = (Project.GtkValaSettings) _this.target_model.el.get_item(this.el.selected);
-
- this.selectTarget(cg);
-
- });
- }
-
- // user defined functions
- public void selectTarget (Project.GtkValaSettings? cg) {
- // load the new values
- _this.selected_target = cg;
- _this.project.active_cg = cg;
-
-
- if (cg == null) {
-
- _this.set_vbox.el.hide();
- _this.set_vboxb.el.hide();
- return;
- }
-
-
- _this.set_vbox.el.show();
- _this.set_vboxb.el.show();
- // add the directory..
-
-
- GLib.debug("loading dirs into project list");
- cg.loading_ui = true;
- _this.cg_loading = true;
-
- _this.treeview.el.set_model(new Gtk.SingleSelection(null));
- _this.project.loadDirsIntoStore(_this.treemodel.el);
- _this.treeview.el.set_model(_this.treeselmodel.el);
-
- cg.loading_ui = false;
-
- _this.cg_loading = false;
- GLib.debug("Set name to %s", cg.name);
-
- _this.build_name.el.buffer.set_text(cg.name.data);
-
-
- _this.build_execute_args.el.buffer.set_text( cg.execute_args.data );
-
- }
- }
- public class Xcls_target_model : Object
- {
- public GLib.ListStore el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_target_model(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.target_model = this;
- this.el = new GLib.ListStore( typeof(Project.GtkValaSettings) );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
- public class Xcls_ColumnViewColumn51 : Object
- {
- public Gtk.ColumnViewColumn el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ColumnViewColumn51(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_SignalListItemFactory52( _this );
- child_1.ref();
- this.el = new Gtk.ColumnViewColumn( "Build Target", child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.expand = true;
- }
-
- // user defined functions
- }
- public class Xcls_SignalListItemFactory52 : Object
- {
- public Gtk.SignalListItemFactory el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SignalListItemFactory52(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.SignalListItemFactory();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.setup.connect( (item) => {
- //var j = (JsRender.JsRender) item;
- var gi = (Gtk.ListItem)item;
-
- var lbl = new Gtk.Label("");
- lbl.halign = Gtk.Align.START;
- gi.set_child(lbl);
-
-
-
- });
- this.el.bind.connect( (listitem) => {
-
- var lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();
-
- var item = (Project.GtkValaSettings) ((Gtk.ListItem)listitem).get_item();
-
- item.bind_property("name",
- lbl, "label",
- GLib.BindingFlags.SYNC_CREATE);
-
-
- });
- }
-
- // user defined functions
- }
-
-
-
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+
+ public class Xcls_name : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_name(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.name = this;
+ var child_1 = new Xcls_SignalListItemFactory40( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Other Files", child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.id = "name";
+ this.el.expand = true;
+ this.el.resizable = true;
+
+ // init method
+
+ {
+ this.el.set_sorter( new Gtk.StringSorter(
+ new Gtk.PropertyExpression(typeof(JsRender.JsRender), null, "name")
+ ));
+ ;
+
+ }
+ }
+
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory40 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_SignalListItemFactory40(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (listitem) => {
+
+ var expand = new Gtk.TreeExpander();
+
+ expand.set_indent_for_depth(true);
+ expand.set_indent_for_icon(true);
+
+ var lbl = new Gtk.Label("");
+ lbl.use_markup = true;
+
+
+ lbl.justify = Gtk.Justification.LEFT;
+ lbl.xalign = 0;
+
+
+ expand.set_child(lbl);
+ ((Gtk.ListItem)listitem).set_child(expand);
+ ((Gtk.ListItem)listitem).activatable = false;
+ });
+ this.el.bind.connect( (listitem) => {
+ //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
+
+
+
+ //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
+ var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
+
+
+ var lbl = (Gtk.Label) expand.child;
+
+ if (lbl.label != "") { // do not update
+ return;
+ }
+
+
+ var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
+ var jr = (JsRender.JsRender) lr.get_item();
+ //GLib.debug("change %s to %s", lbl.label, np.name);
+ lbl.label = jr.name; // for dir's we could hsow the sub path..
+ lbl.tooltip_markup = jr.path;
+
+ expand.set_hide_expander( jr.childfiles.n_items < 1);
+ expand.set_list_row(lr);
+
+ expand.set_hide_expander( jr.xtype != "Dir" );
+ expand.set_list_row(lr);
+
+ // bind image...
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_ColumnViewColumn41 : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_ColumnViewColumn41(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_SignalListItemFactory42( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "use", child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory42 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_SignalListItemFactory42(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (listitem) => {
+
+ var btn = new Gtk.CheckButton();
+
+ ((Gtk.ListItem)listitem).set_child(btn);
+
+ btn.toggled.connect(() => {
+
+ var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
+ var jr = (JsRender.JsRender) lr.get_item();
+ jr.compile_group_selected = btn.active;
+
+
+ });
+ });
+ this.el.bind.connect( (listitem) => {
+ //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
+
+
+
+ //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
+ var btn = (Gtk.CheckButton) ((Gtk.ListItem)listitem).get_child();
+
+
+ var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
+ var jr = (JsRender.JsRender) lr.get_item();
+ //GLib.debug("change %s to %s", lbl.label, np.name);
+
+
+
+ jr.bind_property("compile_group_selected",
+ btn, "active",
+ GLib.BindingFlags.SYNC_CREATE);
+ // bind image...
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+
+
+
+ public class Xcls_Box43 : Object
+ {
+ public Gtk.Box el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box43(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Box44( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_ScrolledWindow47( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ new Xcls_set_vboxb( _this );
+ this.el.append( _this.set_vboxb.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Box44 : Object
+ {
+ public Gtk.Box el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box44(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ var child_1 = new Xcls_Button45( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Button46( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Button45 : Object
+ {
+ public Gtk.Button el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button45(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.label = "Add Compile Target";
+
+ //listeners
+ this.el.clicked.connect( () => {
+
+ if (_this.project.compilegroups.has_key("NEW GROUP")) {
+ return;
+ }
+ var cg = new Project.GtkValaSettings(_this.project, "NEW GROUP");
+ _this.project.compilegroups.set(cg.name, cg);
+ _this.project.loadTargetsIntoStore(_this.target_model.el);
+ // select it.. ?? should load it??
+ for(var i =0;i < _this.target_model.el.n_items; i++) {
+ var ncg = (Project.GtkValaSettings) _this.target_model.el.get_item(i);
+ if (ncg.name == cg.name) {
+ _this.target_sel.el.selected = i;
+ _this.target_sel.selectTarget(cg);
+ break;
+ }
+ }
+
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button46 : Object
+ {
+ public Gtk.Button el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button46(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.label = "Remove Target";
+
+ //listeners
+ this.el.clicked.connect( () => {
+ // load the new values.
+ if (_this.target_sel.el.selected == Gtk.INVALID_LIST_POSITION) {
+ GLib.debug("nothing selected");
+ return;
+ }
+
+
+ // add the directory..
+ var cg = (Project.GtkValaSettings) _this.target_model.el.get_item(_this.target_sel.el.selected);
+
+
+ GLib.debug("remove: %s\n", cg.name);
+ if (!_this.project.compilegroups.unset(cg.name)) {
+ GLib.debug("remove failed");
+ }
+ _this.project.loadTargetsIntoStore(_this.target_model.el);
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_ScrolledWindow47 : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_ScrolledWindow47(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.ScrolledWindow();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.vexpand = true;
+ var child_1 = new Xcls_ColumnView48( _this );
+ this.el.child = child_1.el;
+
+ // init method
+
+ {
+ this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+
+ }
+ }
+
+ // user defined functions
+ }
+ public class Xcls_ColumnView48 : Object
+ {
+ public Gtk.ColumnView el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_ColumnView48(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ new Xcls_target_sel( _this );
+ this.el = new Gtk.ColumnView( _this.target_sel.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_2 = new Xcls_ColumnViewColumn51( _this );
+ child_2.ref();
+ this.el.append_column ( child_2.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_target_sel : Object
+ {
+ public Gtk.SingleSelection el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_target_sel(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.target_sel = this;
+ new Xcls_target_model( _this );
+ this.el = new Gtk.SingleSelection( _this.target_model.el );
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.selection_changed.connect( (position, n_items) => {
+
+
+ // load the new values.
+ if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
+ this.selectTarget(null);
+ return;
+ }
+ this.selectTarget(null);
+
+
+
+ // add the directory..
+ var cg = (Project.GtkValaSettings) _this.target_model.el.get_item(this.el.selected);
+
+ this.selectTarget(cg);
+
+ });
+ }
+
+ // user defined functions
+ public void selectTarget (Project.GtkValaSettings? cg) {
+ // load the new values
+ _this.selected_target = cg;
+ _this.project.active_cg = cg;
+
+
+ if (cg == null) {
+
+ _this.set_vbox.el.hide();
+ _this.set_vboxb.el.hide();
+ return;
+ }
+
+
+ _this.set_vbox.el.show();
+ _this.set_vboxb.el.show();
+ // add the directory..
+
+
+ GLib.debug("loading dirs into project list");
+ cg.loading_ui = true;
+
+
+ _this.treeview.el.set_model(new Gtk.SingleSelection(null));
+ _this.project.loadDirsIntoStore(_this.treemodel.el);
+ _this.treeview.el.set_model(_this.treeselmodel.el);
+
+ cg.loading_ui = false;
+ GLib.debug("Set name to %s", cg.name);
+
+ _this.build_name.el.buffer.set_text(cg.name.data);
+
+
+ _this.build_execute_args.el.buffer.set_text( cg.execute_args.data );
+
+
+ }
+ }
+ public class Xcls_target_model : Object
+ {
+ public GLib.ListStore el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_target_model(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.target_model = this;
+ this.el = new GLib.ListStore( typeof(Project.GtkValaSettings) );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_ColumnViewColumn51 : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_ColumnViewColumn51(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_SignalListItemFactory52( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Build Target", child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.expand = true;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory52 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_SignalListItemFactory52(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (item) => {
+ //var j = (JsRender.JsRender) item;
+ var gi = (Gtk.ListItem)item;
+
+ var lbl = new Gtk.Label("");
+ lbl.halign = Gtk.Align.START;
+ gi.set_child(lbl);
+
+
+
+ });
+ this.el.bind.connect( (listitem) => {
+
+ var lbl = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();
+
+ var item = (Project.GtkValaSettings) ((Gtk.ListItem)listitem).get_item();
+
+ item.bind_property("name",
+ lbl, "label",
+ GLib.BindingFlags.SYNC_CREATE);
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+
+
+ public class Xcls_set_vboxb : Object
+ {
+ public Gtk.Box el;
+ private ValaProjectSettingsPopover _this;
+
- public class Xcls_set_vboxb : Object
- {
- public Gtk.Box el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
+ // ctor
+ public Xcls_set_vboxb(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.set_vboxb = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_set_vboxb(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.set_vboxb = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ // set gobject values
+ var child_1 = new Xcls_Label54( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ new Xcls_build_name( _this );
+ this.el.append( _this.build_name.el );
+ var child_3 = new Xcls_Label56( _this );
+ child_3.ref();
+ this.el.append( child_3.el );
+ new Xcls_build_execute_args( _this );
+ this.el.append( _this.build_execute_args.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Label54 : Object
+ {
+ public Gtk.Label el;
+ private ValaProjectSettingsPopover _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label54(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Build Name (executable name)" );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
- // my vars (dec)
+ // user defined functions
+ }
- // set gobject values
- var child_1 = new Xcls_Label54( _this );
- child_1.ref();
- this.el.append( child_1.el );
- new Xcls_build_name( _this );
- this.el.append( _this.build_name.el );
- var child_3 = new Xcls_Label56( _this );
- child_3.ref();
- this.el.append( child_3.el );
- new Xcls_build_execute_args( _this );
- this.el.append( _this.build_execute_args.el );
- }
+ public class Xcls_build_name : Object
+ {
+ public Gtk.Entry el;
+ private ValaProjectSettingsPopover _this;
- // user defined functions
- }
- public class Xcls_Label54 : Object
- {
- public Gtk.Label el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_build_name(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.build_name = this;
+ this.el = new Gtk.Entry();
- // ctor
- public Xcls_Label54(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Build Name (executable name)" );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
- // set gobject values
- }
+ //listeners
+ this.el.changed.connect( () => {
+ if (_this.selected_target == null) {
+ return;
+ }
+ var name = this.el.text;
+ // name ischanging.. probably always..
+ if (_this.selected_target.name != name) {
+ _this.project.compilegroups.unset(_this.selected_target.name);
+ _this.project.compilegroups.set(name, _this.selected_target);
+ }
+
+ _this.selected_target.name = this.el.buffer.text;
+ });
+ }
- // user defined functions
- }
+ // user defined functions
+ }
- public class Xcls_build_name : Object
- {
- public Gtk.Entry el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_build_name(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.build_name = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.changed.connect( () => {
- if (_this.selected_target == null) {
- return;
- }
- var name = this.el.text;
- // name ischanging.. probably always..
- if (_this.selected_target.name != name) {
- _this.project.compilegroups.unset(_this.selected_target.name);
- _this.project.compilegroups.set(name, _this.selected_target);
- }
-
- _this.selected_target.name = this.el.buffer.text;
- });
- }
+ public class Xcls_Label56 : Object
+ {
+ public Gtk.Label el;
+ private ValaProjectSettingsPopover _this;
- // user defined functions
- }
- public class Xcls_Label56 : Object
- {
- public Gtk.Label el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
+ // ctor
+ public Xcls_Label56(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "test argments - when run after a build" );
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_Label56(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "test argments - when run after a build" );
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_build_execute_args : Object
+ {
+ public Gtk.Entry el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_build_execute_args(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.build_execute_args = this;
+ this.el = new Gtk.Entry();
- public class Xcls_build_execute_args : Object
- {
- public Gtk.Entry el;
- private ValaProjectSettingsPopover _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.placeholder_text = "eg. -f somefile -g ";
- // my vars (def)
+ //listeners
+ this.el.changed.connect( () => {
+ if (_this.selected_target == null) {
+ return;
+ }
+ _this.selected_target.execute_args = this.el.buffer.text;
+
+ });
+ }
- // ctor
- public Xcls_build_execute_args(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.build_execute_args = this;
- this.el = new Gtk.Entry();
+ // user defined functions
+ }
- // my vars (dec)
- // set gobject values
- this.el.placeholder_text = "eg. -f somefile -g ";
- //listeners
- this.el.changed.connect( () => {
- if (_this.selected_target == null) {
- return;
- }
- _this.selected_target.execute_args = this.el.buffer.text;
-
- });
- }
- // user defined functions
- }
+ public class Xcls_Box58 : Object
+ {
+ public Gtk.Box el;
+ private ValaProjectSettingsPopover _this;
+ // my vars (def)
+ // ctor
+ public Xcls_Box58(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
- public class Xcls_Box58 : Object
- {
- public Gtk.Box el;
- private ValaProjectSettingsPopover _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.margin_end = 4;
+ this.el.margin_start = 4;
+ this.el.hexpand = true;
+ this.el.margin_bottom = 4;
+ this.el.margin_top = 4;
+ var child_1 = new Xcls_Button59( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Label60( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ new Xcls_save_btn( _this );
+ this.el.append( _this.save_btn.el );
+ }
- // my vars (def)
+ // user defined functions
+ }
+ public class Xcls_Button59 : Object
+ {
+ public Gtk.Button el;
+ private ValaProjectSettingsPopover _this;
- // ctor
- public Xcls_Box58(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
- // my vars (dec)
+ // my vars (def)
- // set gobject values
- this.el.margin_end = 4;
- this.el.margin_start = 4;
- this.el.hexpand = true;
- this.el.margin_bottom = 4;
- this.el.margin_top = 4;
- var child_1 = new Xcls_Button59( _this );
- child_1.ref();
- this.el.append( child_1.el );
- var child_2 = new Xcls_Label60( _this );
- child_2.ref();
- this.el.append( child_2.el );
- new Xcls_save_btn( _this );
- this.el.append( _this.save_btn.el );
- }
+ // ctor
+ public Xcls_Button59(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // user defined functions
- }
- public class Xcls_Button59 : Object
- {
- public Gtk.Button el;
- private ValaProjectSettingsPopover _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.label = "Cancel";
- // my vars (def)
+ //listeners
+ this.el.clicked.connect( () => {
+
+ _this.done = true;
+ _this.el.hide();
+ });
+ }
- // ctor
- public Xcls_Button59(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
+ // user defined functions
+ }
- // my vars (dec)
+ public class Xcls_Label60 : Object
+ {
+ public Gtk.Label el;
+ private ValaProjectSettingsPopover _this;
- // set gobject values
- this.el.label = "Cancel";
- //listeners
- this.el.clicked.connect( () => {
-
- _this.done = true;
- _this.el.hide();
- });
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_Label60(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "" );
- public class Xcls_Label60 : Object
- {
- public Gtk.Label el;
- private ValaProjectSettingsPopover _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.hexpand = true;
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_Label60(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "" );
+ public class Xcls_save_btn : Object
+ {
+ public Gtk.Button el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- this.el.hexpand = true;
- }
+ // my vars (def)
- // user defined functions
- }
-
- public class Xcls_save_btn : Object
- {
- public Gtk.Button el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_save_btn(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.save_btn = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.css_classes = { "suggested-action" };
- this.el.label = "Save";
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
-
- _this.project.save();
-
- // what about .js ?
- _this.done = true;
- _this.el.hide();
- if (_this.doneObj != null) {
- _this.doneObj.call(_this.project);
- }
-
-
- });
- }
+ // ctor
+ public Xcls_save_btn(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.save_btn = this;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.css_classes = { "suggested-action" };
+ this.el.label = "Save";
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+
+ _this.project.save();
+
+ // what about .js ?
+ _this.done = true;
+ _this.el.hide();
+ if (_this.doneObj != null) {
+ _this.doneObj.call(_this.project);
+ }
+
+
+ });
+ }
- // user defined functions
- }
+ // user defined functions
+ }
-}
+ }
" ",
" //\tGtk.Allocation rect;",
"\t//this.el.get_allocation(out rect);",
- "\tif (p.el.parent == null) {",
- "\t\t p.el.set_parent(this.el);",
- "\t }",
+ "",
+ "\t p.el.set_parent(this.el);",
" //p.el.set_pointing_to(rect);",
"\tp.el.show();",
"\tp.el.set_position(Gtk.PositionType.BOTTOM);",
"\t",
"\tGLib.debug(\"Prssed %d\", (int) this.el.get_current_button());",
"\t//_this.deletemenu.el.set_parent(_this.view.el);",
- "\tif (_this.deletemenu.el.parent == null) {",
- "\t\t_this.deletemenu.el.set_parent(_this.main_window.el);",
- "\t}",
+ "\t_this.deletemenu.el.set_parent(_this.main_window.el);",
"\t",
"\t",
"\t ",
"\t\tvar ll = (Gtk.Label)ca.get_first_child();",
"\t\tvar cb = ca.get_next_sibling();",
"\t\tvar b = cb.get_first_child();",
- "\t\tvar e = (Gtk.EditableLabel) b.get_first_child();",
+ "\t\tvar e = (Gtk.Entry) b.get_first_child();",
"\t\tvar l = (Gtk.Label) e.get_next_sibling();",
"\t\tvar d = (Gtk.DropDown) l.get_next_sibling();",
"\t\t",
"\t\tGLib.debug(\"row key = %s\", ll.label);",
"\t\tif (e.get_visible()) {",
"\t\t\t_this.stop_editor();",
- "\t\t\te.start_editing();",
- "\t\t\t//GLib.Timeout.add_once(500, () => {",
- "\t\t\t//\tvar st = (Gtk.Stack) e.get_first_child();",
- "\t\t\t//\tvar ed = (Gtk.Entry) st.get_visible_child();",
- "\t\t\t//\ted.grab_focus_without_selecting();",
- "\t\t\t//});",
+ "\t\t\te.grab_focus_without_selecting();",
"\t\t\treturn;",
"\t\t}",
"\t\tif (d.get_visible()) {",
-static Xcls_LeftProps _LeftProps;
-
-public class Xcls_LeftProps : Object
-{
- public Gtk.Box el;
- private Xcls_LeftProps _this;
-
- public static Xcls_LeftProps singleton()
- {
- if (_LeftProps == null) {
- _LeftProps= new Xcls_LeftProps();
- }
- return _LeftProps;
- }
- public Xcls_AddPropertyPopup AddPropertyPopup;
- public Xcls_EditProps EditProps;
- public Xcls_view view;
- public Xcls_deletemenu deletemenu;
- public Xcls_selmodel selmodel;
- public Xcls_model model;
- public Xcls_keycol keycol;
- public Xcls_valcol valcol;
- public Xcls_ContextMenu ContextMenu;
-
- // my vars (def)
- public bool loading;
- public bool allow_edit;
- public signal void show_add_props (string type);
- public signal bool stop_editor ();
- public Xcls_MainWindow main_window;
- public signal void changed ();
- public JsRender.JsRender file;
- public JsRender.Node node;
- public signal void show_editor (JsRender.JsRender file, JsRender.Node node, JsRender.NodeProp prop);
-
- // ctor
- public Xcls_LeftProps()
- {
- _this = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
- this.loading = false;
- this.allow_edit = false;
- this.main_window = null;
-
- // set gobject values
- this.el.homogeneous = false ;
- this.el.hexpand = true;
- this.el.vexpand = true;
- var child_1 = new Xcls_Box2( _this );
- child_1.ref();
- this.el.append( child_1.el );
- new Xcls_EditProps( _this );
- this.el.append( _this.EditProps.el );
- }
-
- // user defined functions
- public string keySortFormat (string key) {
- // listeners first - with 0
- // specials
- if (key[0] == '*') {
- return "1 " + key;
- }
- // functions
-
- var bits = key.split(" ");
-
- if (key[0] == '|') {
- return "2 " + bits[bits.length -1];
- }
- // signals
- if (key[0] == '@') {
- return "3 " + bits[bits.length -1];
- }
-
- // props
- if (key[0] == '#') {
- return "4 " + bits[bits.length -1];
- }
- // the rest..
- return "5 " + bits[bits.length -1];
-
-
-
- }
- public string keyFormat (string val, string type) {
-
- // Glib.markup_escape_text(val);
-
- if (type == "listener") {
- return "<span font_weight=\"bold\" color=\"#660000\">" +
- GLib.Markup.escape_text(val) +
- "</span>";
- }
- // property..
- if (val.length < 1) {
- return "<span color=\"#FF0000\">--empty--</span>";
- }
-
- //@ = signal
- //$ = property with
- //# - object properties
- //* = special
- // all of these... - display value is last element..
- var ar = val.strip().split(" ");
-
-
- var dval = GLib.Markup.escape_text(ar[ar.length-1]);
-
-
-
-
- switch(val[0]) {
- case '@': // signal // just bold balck?
- if (dval[0] == '@') {
- dval = dval.substring(1);
- }
-
- return @"<span font_weight=\"bold\">@ $dval</span>";
- case '#': // object properties?
- if (dval[0] == '#') {
- dval = dval.substring(1);
- }
- return @"<span font_weight=\"bold\">$dval</span>";
- case '*': // special
- if (dval[0] == '*') {
- dval = dval.substring(1);
- }
- return @"<span color=\"#0000CC\" font_weight=\"bold\">$dval</span>";
- case '$':
- if (dval[0] == '$') {
- dval = dval.substring(1);
- }
- return @"<span style=\"italic\">$dval</span>";
- case '|': // user defined methods
- if (dval[0] == '|') {
- dval = dval.substring(1);
- }
- return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
-
-
-
- default:
- return dval;
- }
-
-
-
- }
- public void deleteSelected () {
-
- return;
- /*
-
- Gtk.TreeIter iter;
- Gtk.TreeModel mod;
-
- var s = this.view.el.get_selection();
- s.get_selected(out mod, out iter);
-
-
- GLib.Value gval;
- mod.get_value(iter, 0 , out gval);
- var prop = (JsRender.NodeProp)gval;
- if (prop == null) {
- this.load(this.file, this.node);
- return;
- }
- // stop editor after fetching property - otherwise prop is null.
- this.stop_editor();
-
-
- switch(prop.ptype) {
- case JsRender.NodePropType.LISTENER:
- this.node.listeners.unset(prop.to_index_key());
- break;
-
- default:
- this.node.props.unset(prop.to_index_key());
- break;
- }
- this.load(this.file, this.node);
-
- _this.changed();
- */
- }
- public void a_addProp (JsRender.NodeProp prop) {
- // info includes key, val, skel, etype..
- //console.dump(info);
- //type = info.type.toLowerCase();
- //var data = this.toJS();
-
-
- if (prop.ptype == JsRender.NodePropType.LISTENER) {
- if (this.node.listeners.has_key(prop.name)) {
- return;
- }
- this.node.listeners.set(prop.name,prop);
- } else {
- assert(this.node != null);
- assert(this.node.props != null);
- if (this.node.props.has_key(prop.to_index_key())) {
- return;
- }
- this.node.props.set(prop.to_index_key(),prop);
- }
-
-
- // add a row???
- this.load(this.file, this.node);
-
-
-
-
- GLib.debug("trying to find new iter");
-
-
-
- }
- public void load (JsRender.JsRender file, JsRender.Node? node)
- {
- // not sure when to initialize this - we should do it on setting main window really.
-
- this.loading = true;
- if (this.view.popover == null) {
- this.view.popover = new Xcls_PopoverProperty();
- this.view.popover.mainwindow = _this.main_window;
- }
-
-
- if (this.node != null) {
- this.node.dupeProps(); // ensures removeall will not do somethign silly
-
- }
-
- GLib.debug("load leftprops\n");
-
- this.node = node;
- this.file = file;
-
-
- this.model.el.remove_all();
-
- //this.get('/RightEditor').el.hide();
- if (node ==null) {
- return ;
- }
- node.loadProps(this.model.el);
-
-
- //GLib.debug("clear selection\n");
-
- this.loading = false;
- this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);
- // clear selection?
- //this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..
-
- // this.view.el.get_selection().unselect_all();
-
- // _this.keycol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);
- // _this.valcol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);
-
- }
- public class Xcls_Box2 : Object
- {
- public Gtk.Box el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box2(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- var child_1 = new Xcls_Label3( _this );
- child_1.ref();
- this.el.append( child_1.el );
- var child_2 = new Xcls_Button4( _this );
- child_2.ref();
- this.el.append( child_2.el );
- var child_3 = new Xcls_Button5( _this );
- child_3.ref();
- this.el.append( child_3.el );
- var child_4 = new Xcls_Button6( _this );
- child_4.ref();
- this.el.append( child_4.el );
- }
-
- // user defined functions
- }
- public class Xcls_Label3 : Object
- {
- public Gtk.Label el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label3(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Add:" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.margin_end = 5;
- this.el.margin_start = 5;
- }
-
- // user defined functions
- }
-
- public class Xcls_Button4 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
- public bool always_show_image;
-
- // ctor
- public Xcls_Button4(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
- this.always_show_image = true;
-
- // set gobject values
- this.el.icon_name = "format-justify-left";
- this.el.hexpand = true;
- this.el.tooltip_text = "Add Property";
- this.el.label = "Property";
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
- _this.main_window.windowstate.showProps(
- _this.view.el,
- JsRender.NodePropType.PROP
- );
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Button5 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
- public bool always_show_image;
-
- // ctor
- public Xcls_Button5(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
- this.always_show_image = true;
-
- // set gobject values
- this.el.icon_name = "appointment-new";
- this.el.hexpand = true;
- this.el.tooltip_text = "Add Event Code";
- this.el.label = "Event";
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
-
- _this.main_window.windowstate.showProps(
- _this.view.el,
- JsRender.NodePropType.LISTENER
- );
-
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Button6 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
- public bool always_show_image;
-
- // ctor
- public Xcls_Button6(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
- this.always_show_image = true;
-
- // set gobject values
- this.el.icon_name = "list-add";
- this.el.hexpand = true;
- this.el.label = "Other";
- new Xcls_AddPropertyPopup( _this );
-
- //listeners
- this.el.clicked.connect( ( ) => {
- //_this.before_edit();
-
-
- var p = _this.AddPropertyPopup;
-
- // Gtk.Allocation rect;
- //this.el.get_allocation(out rect);
- if (p.el.parent == null) {
- p.el.set_parent(this.el);
- }
- //p.el.set_pointing_to(rect);
- p.el.show();
- p.el.set_position(Gtk.PositionType.BOTTOM);
- p.el.autohide = true;
- return;
-
- });
- }
-
- // user defined functions
- }
- public class Xcls_AddPropertyPopup : Object
- {
- public Gtk.Popover el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.AddPropertyPopup = this;
- this.el = new Gtk.Popover();
-
- // my vars (dec)
-
- // set gobject values
- this.el.autohide = true;
- var child_1 = new Xcls_Box8( _this );
- this.el.child = child_1.el;
- }
-
- // user defined functions
- }
- public class Xcls_Box8 : Object
- {
- public Gtk.Box el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box8(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- var child_1 = new Xcls_Button9( _this );
- child_1.ref();
- this.el.append( child_1.el );
- var child_2 = new Xcls_Button10( _this );
- child_2.ref();
- this.el.append( child_2.el );
- var child_3 = new Xcls_Button11( _this );
- child_3.ref();
- this.el.append( child_3.el );
- var child_4 = new Xcls_Button12( _this );
- child_4.ref();
- this.el.append( child_4.el );
- var child_5 = new Xcls_Button13( _this );
- child_5.ref();
- this.el.append( child_5.el );
- var child_6 = new Xcls_Separator14( _this );
- child_6.ref();
- this.el.append( child_6.el );
- var child_7 = new Xcls_Button15( _this );
- child_7.ref();
- this.el.append( child_7.el );
- var child_8 = new Xcls_Button16( _this );
- child_8.ref();
- this.el.append( child_8.el );
- var child_9 = new Xcls_Button17( _this );
- child_9.ref();
- this.el.append( child_9.el );
- var child_10 = new Xcls_Separator18( _this );
- child_10.ref();
- this.el.append( child_10.el );
- var child_11 = new Xcls_Button19( _this );
- child_11.ref();
- this.el.append( child_11.el );
- var child_12 = new Xcls_Button20( _this );
- child_12.ref();
- this.el.append( child_12.el );
- var child_13 = new Xcls_Button21( _this );
- child_13.ref();
- this.el.append( child_13.el );
- var child_14 = new Xcls_Separator22( _this );
- child_14.ref();
- this.el.append( child_14.el );
- var child_15 = new Xcls_Button23( _this );
- child_15.ref();
- this.el.append( child_15.el );
- var child_16 = new Xcls_Button24( _this );
- child_16.ref();
- this.el.append( child_16.el );
- var child_17 = new Xcls_Button25( _this );
- child_17.ref();
- this.el.append( child_17.el );
- }
-
- // user defined functions
- }
- public class Xcls_Button9 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button9(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_markup = "Using _this.{ID} will map to this element";
- this.el.label = "id: _this.{ID} (Vala)";
-
- //listeners
- this.el.clicked.connect( () => {
- _this.AddPropertyPopup.el.hide();
- // is this userdef or special??
- var add = new JsRender.NodeProp.prop("id");
- if (_this.node.has_prop_key(add)) {
- return;
- }
-
- _this.node.add_prop( add );
-
- _this.view.editProp( add );
-
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Button10 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button10(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_markup = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
- this.el.label = "pack: Pack method (Vala)";
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
-
- _this.AddPropertyPopup.el.hide();
- // is this userdef or special??
- var add = new JsRender.NodeProp.special("pack", "add");
- if (_this.node.has_prop_key(add)) {
- return;
- }
-
- _this.node.add_prop( add );
-
- _this.view.editProp( add );
-
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Button11 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button11(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_markup = "eg. \n\nnew Clutter.Image.from_file(.....)";
- this.el.label = "ctor: Alterative to default contructor (Vala)";
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
- _this.AddPropertyPopup.el.hide();
- // is this userdef or special??
- var add = new JsRender.NodeProp.special("ctor");
- if (_this.node.has_prop_key(add)) {
- return;
- }
-
- _this.node.add_prop( add );
-
- _this.view.editProp( add );
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Button12 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button12(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_markup = "This code is called after the ctor";
- this.el.label = "init: initialziation code (vala)";
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
- _this.AddPropertyPopup.el.hide();
- // is this userdef or special??
- var add = new JsRender.NodeProp.special("init","{\n\n}\n" ) ;
- if (_this.node.has_prop_key(add)) {
- return;
- }
-
- _this.node.add_prop( add );
-
- _this.view.editProp( add );
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Button13 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button13(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_markup = "set the cms-id for this element, when converted to javascript, the html value will be wrapped with Pman.Cms.content({cms-id},{original-html})\n";
- this.el.label = "cms-id: (Roo JS/Pman library)";
-
- //listeners
- this.el.clicked.connect( () => {
-
- _this.AddPropertyPopup.el.hide();
- // is this userdef or special??
- var add = new JsRender.NodeProp.prop("cms-id","string", "" ) ;
- if (_this.node.has_prop_key(add)) {
- return;
- }
-
- _this.node.add_prop( add );
-
- _this.view.editProp( add );
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Separator14 : Object
- {
- public Gtk.Separator el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Separator14(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_Button15 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button15(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_markup = "Add a user defined string property";
- this.el.label = "String";
-
- //listeners
- this.el.clicked.connect( (self) => {
- _this.AddPropertyPopup.el.hide();
- _this.view.popover.show(
- _this.view.el,
- _this.node,
- new JsRender.NodeProp.prop("", "string", "") ,
- -1,
- true
- );
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Button16 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button16(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_markup = "Add a user defined number property";
- this.el.label = "Number";
-
- //listeners
- this.el.clicked.connect( ( ) =>{
- _this.AddPropertyPopup.el.hide();
-
- _this.view.popover.show(
- _this.view.el,
- _this.node,
- new JsRender.NodeProp.prop("", "int", "0") ,
- -1,
- true
- );
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Button17 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button17(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_markup = "Add a user defined boolean property";
- this.el.label = "Boolean";
-
- //listeners
- this.el.clicked.connect( ( ) =>{
-
- _this.AddPropertyPopup.el.hide();
- _this.view.popover.show(
- _this.view.el,
- _this.node,
- new JsRender.NodeProp.prop("", "bool", "true") ,
- -1,
- true
- );
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Separator18 : Object
- {
- public Gtk.Separator el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Separator18(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_Button19 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button19(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_markup = "Add a user function boolean property";
- this.el.label = "Javascript Function";
-
- //listeners
- this.el.clicked.connect( ( ) =>{
- _this.AddPropertyPopup.el.hide();
- _this.view.popover.show(
- _this.view.el,
- _this.node,
- new JsRender.NodeProp.jsmethod("") ,
- -1,
- true
- );
-
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Button20 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button20(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_markup = "Add a user function boolean property";
- this.el.label = "Vala Method";
-
- //listeners
- this.el.clicked.connect( ( ) =>{
- _this.AddPropertyPopup.el.hide();
- _this.view.popover.show(
- _this.view.el,
- _this.node,
- new JsRender.NodeProp.valamethod("") ,
- -1,
- true
- );
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Button21 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button21(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_markup = "Add a vala signal";
- this.el.label = "Vala Signal";
-
- //listeners
- this.el.clicked.connect( ( ) =>{
- _this.AddPropertyPopup.el.hide();
- _this.view.popover.show(
- _this.view.el,
- _this.node,
- new JsRender.NodeProp.sig("" ) ,
- -1,
- true
- );
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Separator22 : Object
- {
- public Gtk.Separator el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Separator22(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_Button23 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button23(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_markup = "Add a flexy if (for HTML templates)";
- this.el.label = "Flexy - If";
-
- //listeners
- this.el.clicked.connect( ( ) =>{
- _this.AddPropertyPopup.el.hide();
- _this.view.popover.show(
- _this.view.el,
- _this.node,
- new JsRender.NodeProp.prop("flexy:if", "string", "value_or_condition") ,
- -1,
- true
- );
-
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Button24 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
+ static Xcls_LeftProps _LeftProps;
+
+ public class Xcls_LeftProps : Object
+ {
+ public Gtk.Box el;
+ private Xcls_LeftProps _this;
+
+ public static Xcls_LeftProps singleton()
+ {
+ if (_LeftProps == null) {
+ _LeftProps= new Xcls_LeftProps();
+ }
+ return _LeftProps;
+ }
+ public Xcls_AddPropertyPopup AddPropertyPopup;
+ public Xcls_EditProps EditProps;
+ public Xcls_view view;
+ public Xcls_deletemenu deletemenu;
+ public Xcls_selmodel selmodel;
+ public Xcls_model model;
+ public Xcls_keycol keycol;
+ public Xcls_valcol valcol;
+ public Xcls_ContextMenu ContextMenu;
+
+ // my vars (def)
+ public bool loading;
+ public bool allow_edit;
+ public signal void show_add_props (string type);
+ public signal bool stop_editor ();
+ public Xcls_MainWindow main_window;
+ public signal void changed ();
+ public JsRender.JsRender file;
+ public JsRender.Node node;
+ public signal void show_editor (JsRender.JsRender file, JsRender.Node node, JsRender.NodeProp prop);
+
+ // ctor
+ public Xcls_LeftProps()
+ {
+ _this = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+ this.loading = false;
+ this.allow_edit = false;
+ this.main_window = null;
+
+ // set gobject values
+ this.el.homogeneous = false ;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ var child_1 = new Xcls_Box2( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ new Xcls_EditProps( _this );
+ this.el.append( _this.EditProps.el );
+ }
+
+ // user defined functions
+ public string keySortFormat (string key) {
+ // listeners first - with 0
+ // specials
+ if (key[0] == '*') {
+ return "1 " + key;
+ }
+ // functions
+
+ var bits = key.split(" ");
+
+ if (key[0] == '|') {
+ return "2 " + bits[bits.length -1];
+ }
+ // signals
+ if (key[0] == '@') {
+ return "3 " + bits[bits.length -1];
+ }
+
+ // props
+ if (key[0] == '#') {
+ return "4 " + bits[bits.length -1];
+ }
+ // the rest..
+ return "5 " + bits[bits.length -1];
+
+
+
+ }
+ public string keyFormat (string val, string type) {
+
+ // Glib.markup_escape_text(val);
+
+ if (type == "listener") {
+ return "<span font_weight=\"bold\" color=\"#660000\">" +
+ GLib.Markup.escape_text(val) +
+ "</span>";
+ }
+ // property..
+ if (val.length < 1) {
+ return "<span color=\"#FF0000\">--empty--</span>";
+ }
+
+ //@ = signal
+ //$ = property with
+ //# - object properties
+ //* = special
+ // all of these... - display value is last element..
+ var ar = val.strip().split(" ");
+
+
+ var dval = GLib.Markup.escape_text(ar[ar.length-1]);
+
+
+
+
+ switch(val[0]) {
+ case '@': // signal // just bold balck?
+ if (dval[0] == '@') {
+ dval = dval.substring(1);
+ }
+
+ return @"<span font_weight=\"bold\">@ $dval</span>";
+ case '#': // object properties?
+ if (dval[0] == '#') {
+ dval = dval.substring(1);
+ }
+ return @"<span font_weight=\"bold\">$dval</span>";
+ case '*': // special
+ if (dval[0] == '*') {
+ dval = dval.substring(1);
+ }
+ return @"<span color=\"#0000CC\" font_weight=\"bold\">$dval</span>";
+ case '$':
+ if (dval[0] == '$') {
+ dval = dval.substring(1);
+ }
+ return @"<span style=\"italic\">$dval</span>";
+ case '|': // user defined methods
+ if (dval[0] == '|') {
+ dval = dval.substring(1);
+ }
+ return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
+
+
+
+ default:
+ return dval;
+ }
+
+
+
+ }
+ public void deleteSelected () {
+
+ return;
+ /*
+
+ Gtk.TreeIter iter;
+ Gtk.TreeModel mod;
+
+ var s = this.view.el.get_selection();
+ s.get_selected(out mod, out iter);
+
+
+ GLib.Value gval;
+ mod.get_value(iter, 0 , out gval);
+ var prop = (JsRender.NodeProp)gval;
+ if (prop == null) {
+ this.load(this.file, this.node);
+ return;
+ }
+ // stop editor after fetching property - otherwise prop is null.
+ this.stop_editor();
+
+
+ switch(prop.ptype) {
+ case JsRender.NodePropType.LISTENER:
+ this.node.listeners.unset(prop.to_index_key());
+ break;
+
+ default:
+ this.node.props.unset(prop.to_index_key());
+ break;
+ }
+ this.load(this.file, this.node);
+
+ _this.changed();
+ */
+ }
+ public void a_addProp (JsRender.NodeProp prop) {
+ // info includes key, val, skel, etype..
+ //console.dump(info);
+ //type = info.type.toLowerCase();
+ //var data = this.toJS();
+
+
+ if (prop.ptype == JsRender.NodePropType.LISTENER) {
+ if (this.node.listeners.has_key(prop.name)) {
+ return;
+ }
+ this.node.listeners.set(prop.name,prop);
+ } else {
+ assert(this.node != null);
+ assert(this.node.props != null);
+ if (this.node.props.has_key(prop.to_index_key())) {
+ return;
+ }
+ this.node.props.set(prop.to_index_key(),prop);
+ }
+
+
+ // add a row???
+ this.load(this.file, this.node);
+
+
+
+
+ GLib.debug("trying to find new iter");
+
+
+
+ }
+ public void load (JsRender.JsRender file, JsRender.Node? node)
+ {
+ // not sure when to initialize this - we should do it on setting main window really.
+
+ this.loading = true;
+ if (this.view.popover == null) {
+ this.view.popover = new Xcls_PopoverProperty();
+ this.view.popover.mainwindow = _this.main_window;
+ }
+
+
+ if (this.node != null) {
+ this.node.dupeProps(); // ensures removeall will not do somethign silly
+
+ }
+
+ GLib.debug("load leftprops\n");
+
+ this.node = node;
+ this.file = file;
+
+
+ this.model.el.remove_all();
+
+ //this.get('/RightEditor').el.hide();
+ if (node ==null) {
+ return ;
+ }
+ node.loadProps(this.model.el);
+
+
+ //GLib.debug("clear selection\n");
+
+ this.loading = false;
+ this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);
+ // clear selection?
+ //this.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..
+
+ // this.view.el.get_selection().unselect_all();
+
+ // _this.keycol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);
+ // _this.valcol.el.set_max_width(_this.EditProps.el.get_allocated_width()/ 2);
+
+ }
+ public class Xcls_Box2 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box2(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ var child_1 = new Xcls_Label3( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Button4( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ var child_3 = new Xcls_Button5( _this );
+ child_3.ref();
+ this.el.append( child_3.el );
+ var child_4 = new Xcls_Button6( _this );
+ child_4.ref();
+ this.el.append( child_4.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Label3 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Label3(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Add:" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.margin_end = 5;
+ this.el.margin_start = 5;
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button4 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+ public bool always_show_image;
+
+ // ctor
+ public Xcls_Button4(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+ this.always_show_image = true;
+
+ // set gobject values
+ this.el.icon_name = "format-justify-left";
+ this.el.hexpand = true;
+ this.el.tooltip_text = "Add Property";
+ this.el.label = "Property";
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ _this.main_window.windowstate.showProps(
+ _this.view.el,
+ JsRender.NodePropType.PROP
+ );
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button5 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+ public bool always_show_image;
+
+ // ctor
+ public Xcls_Button5(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+ this.always_show_image = true;
+
+ // set gobject values
+ this.el.icon_name = "appointment-new";
+ this.el.hexpand = true;
+ this.el.tooltip_text = "Add Event Code";
+ this.el.label = "Event";
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+
+ _this.main_window.windowstate.showProps(
+ _this.view.el,
+ JsRender.NodePropType.LISTENER
+ );
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button6 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+ public bool always_show_image;
+
+ // ctor
+ public Xcls_Button6(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+ this.always_show_image = true;
+
+ // set gobject values
+ this.el.icon_name = "list-add";
+ this.el.hexpand = true;
+ this.el.label = "Other";
+ new Xcls_AddPropertyPopup( _this );
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+ //_this.before_edit();
+
+
+ var p = _this.AddPropertyPopup;
+
+ // Gtk.Allocation rect;
+ //this.el.get_allocation(out rect);
+
+ p.el.set_parent(this.el);
+ //p.el.set_pointing_to(rect);
+ p.el.show();
+ p.el.set_position(Gtk.PositionType.BOTTOM);
+ p.el.autohide = true;
+ return;
+
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_AddPropertyPopup : Object
+ {
+ public Gtk.Popover el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.AddPropertyPopup = this;
+ this.el = new Gtk.Popover();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.autohide = true;
+ var child_1 = new Xcls_Box8( _this );
+ this.el.child = child_1.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Box8 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box8(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Button9( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Button10( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ var child_3 = new Xcls_Button11( _this );
+ child_3.ref();
+ this.el.append( child_3.el );
+ var child_4 = new Xcls_Button12( _this );
+ child_4.ref();
+ this.el.append( child_4.el );
+ var child_5 = new Xcls_Button13( _this );
+ child_5.ref();
+ this.el.append( child_5.el );
+ var child_6 = new Xcls_Separator14( _this );
+ child_6.ref();
+ this.el.append( child_6.el );
+ var child_7 = new Xcls_Button15( _this );
+ child_7.ref();
+ this.el.append( child_7.el );
+ var child_8 = new Xcls_Button16( _this );
+ child_8.ref();
+ this.el.append( child_8.el );
+ var child_9 = new Xcls_Button17( _this );
+ child_9.ref();
+ this.el.append( child_9.el );
+ var child_10 = new Xcls_Separator18( _this );
+ child_10.ref();
+ this.el.append( child_10.el );
+ var child_11 = new Xcls_Button19( _this );
+ child_11.ref();
+ this.el.append( child_11.el );
+ var child_12 = new Xcls_Button20( _this );
+ child_12.ref();
+ this.el.append( child_12.el );
+ var child_13 = new Xcls_Button21( _this );
+ child_13.ref();
+ this.el.append( child_13.el );
+ var child_14 = new Xcls_Separator22( _this );
+ child_14.ref();
+ this.el.append( child_14.el );
+ var child_15 = new Xcls_Button23( _this );
+ child_15.ref();
+ this.el.append( child_15.el );
+ var child_16 = new Xcls_Button24( _this );
+ child_16.ref();
+ this.el.append( child_16.el );
+ var child_17 = new Xcls_Button25( _this );
+ child_17.ref();
+ this.el.append( child_17.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Button9 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button9(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.tooltip_markup = "Using _this.{ID} will map to this element";
+ this.el.label = "id: _this.{ID} (Vala)";
+
+ //listeners
+ this.el.clicked.connect( () => {
+ _this.AddPropertyPopup.el.hide();
+ // is this userdef or special??
+ var add = new JsRender.NodeProp.prop("id");
+ if (_this.node.has_prop_key(add)) {
+ return;
+ }
+
+ _this.node.add_prop( add );
+
+ _this.view.editProp( add );
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button10 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button10(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.tooltip_markup = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
+ this.el.label = "pack: Pack method (Vala)";
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+
+ _this.AddPropertyPopup.el.hide();
+ // is this userdef or special??
+ var add = new JsRender.NodeProp.special("pack", "add");
+ if (_this.node.has_prop_key(add)) {
+ return;
+ }
+
+ _this.node.add_prop( add );
+
+ _this.view.editProp( add );
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button11 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button11(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.tooltip_markup = "eg. \n\nnew Clutter.Image.from_file(.....)";
+ this.el.label = "ctor: Alterative to default contructor (Vala)";
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ _this.AddPropertyPopup.el.hide();
+ // is this userdef or special??
+ var add = new JsRender.NodeProp.special("ctor");
+ if (_this.node.has_prop_key(add)) {
+ return;
+ }
+
+ _this.node.add_prop( add );
+
+ _this.view.editProp( add );
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button12 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button12(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.tooltip_markup = "This code is called after the ctor";
+ this.el.label = "init: initialziation code (vala)";
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ _this.AddPropertyPopup.el.hide();
+ // is this userdef or special??
+ var add = new JsRender.NodeProp.special("init","{\n\n}\n" ) ;
+ if (_this.node.has_prop_key(add)) {
+ return;
+ }
+
+ _this.node.add_prop( add );
+
+ _this.view.editProp( add );
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button13 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button13(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.tooltip_markup = "set the cms-id for this element, when converted to javascript, the html value will be wrapped with Pman.Cms.content({cms-id},{original-html})\n";
+ this.el.label = "cms-id: (Roo JS/Pman library)";
+
+ //listeners
+ this.el.clicked.connect( () => {
+
+ _this.AddPropertyPopup.el.hide();
+ // is this userdef or special??
+ var add = new JsRender.NodeProp.prop("cms-id","string", "" ) ;
+ if (_this.node.has_prop_key(add)) {
+ return;
+ }
+
+ _this.node.add_prop( add );
+
+ _this.view.editProp( add );
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Separator14 : Object
+ {
+ public Gtk.Separator el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Separator14(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button15 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button15(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.tooltip_markup = "Add a user defined string property";
+ this.el.label = "String";
+
+ //listeners
+ this.el.clicked.connect( (self) => {
+ _this.AddPropertyPopup.el.hide();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("", "string", "") ,
+ -1,
+ true
+ );
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button16 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button16(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.tooltip_markup = "Add a user defined number property";
+ this.el.label = "Number";
+
+ //listeners
+ this.el.clicked.connect( ( ) =>{
+ _this.AddPropertyPopup.el.hide();
+
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("", "int", "0") ,
+ -1,
+ true
+ );
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button17 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button17(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.tooltip_markup = "Add a user defined boolean property";
+ this.el.label = "Boolean";
+
+ //listeners
+ this.el.clicked.connect( ( ) =>{
+
+ _this.AddPropertyPopup.el.hide();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("", "bool", "true") ,
+ -1,
+ true
+ );
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Separator18 : Object
+ {
+ public Gtk.Separator el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Separator18(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button19 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button19(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.tooltip_markup = "Add a user function boolean property";
+ this.el.label = "Javascript Function";
+
+ //listeners
+ this.el.clicked.connect( ( ) =>{
+ _this.AddPropertyPopup.el.hide();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.jsmethod("") ,
+ -1,
+ true
+ );
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button20 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button20(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.tooltip_markup = "Add a user function boolean property";
+ this.el.label = "Vala Method";
+
+ //listeners
+ this.el.clicked.connect( ( ) =>{
+ _this.AddPropertyPopup.el.hide();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.valamethod("") ,
+ -1,
+ true
+ );
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button21 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button21(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.tooltip_markup = "Add a vala signal";
+ this.el.label = "Vala Signal";
+
+ //listeners
+ this.el.clicked.connect( ( ) =>{
+ _this.AddPropertyPopup.el.hide();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.sig("" ) ,
+ -1,
+ true
+ );
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Separator22 : Object
+ {
+ public Gtk.Separator el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Separator22(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button23 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button23(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.tooltip_markup = "Add a flexy if (for HTML templates)";
+ this.el.label = "Flexy - If";
+
+ //listeners
+ this.el.clicked.connect( ( ) =>{
+ _this.AddPropertyPopup.el.hide();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("flexy:if", "string", "value_or_condition") ,
+ -1,
+ true
+ );
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button24 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Button24(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
- this.el.label = "Flexy - Include";
-
- //listeners
- this.el.clicked.connect( ( ) =>{
- _this.AddPropertyPopup.el.hide();
- _this.view.popover.show(
- _this.view.el,
- _this.node,
- new JsRender.NodeProp.prop("flexy:include", "string", "name_of_file.html") ,
- -1,
- true
- );
-
-
- });
- }
+ // ctor
+ public Xcls_Button24(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
+ this.el.label = "Flexy - Include";
+
+ //listeners
+ this.el.clicked.connect( ( ) =>{
+ _this.AddPropertyPopup.el.hide();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("flexy:include", "string", "name_of_file.html") ,
+ -1,
+ true
+ );
+
+
+ });
+ }
- // user defined functions
- }
-
- public class Xcls_Button25 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button25(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
- this.el.label = "Flexy - Foreach";
-
- //listeners
- this.el.clicked.connect( ( ) =>{
- _this.AddPropertyPopup.el.hide();
- _this.view.popover.show(
- _this.view.el,
- _this.node,
- new JsRender.NodeProp.prop("flexy:if", "string", "value_or_condition") ,
- -1,
- true
- );
-
- });
- }
-
- // user defined functions
- }
-
-
-
-
-
- public class Xcls_EditProps : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
- public bool editing;
-
- // ctor
- public Xcls_EditProps(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.EditProps = this;
- this.el = new Gtk.ScrolledWindow();
-
- // my vars (dec)
- this.editing = false;
-
- // set gobject values
- this.el.hexpand = true;
- this.el.vexpand = true;
- new Xcls_view( _this );
- this.el.set_child ( _this.view.el );
-
- // init method
-
- {
-
- this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
- }
- }
-
- // user defined functions
- }
- public class Xcls_view : Object
- {
- public Gtk.ColumnView el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
- public Gtk.CssProvider css;
- public Xcls_PopoverProperty popover;
-
- // ctor
- public Xcls_view(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.view = this;
- new Xcls_selmodel( _this );
- this.el = new Gtk.ColumnView( _this.selmodel.el );
-
- // my vars (dec)
- this.popover = null;
-
- // set gobject values
- this.el.name = "leftprops-view";
- this.el.single_click_activate = false;
- this.el.hexpand = true;
- this.el.vexpand = true;
- this.el.show_row_separators = true;
- new Xcls_deletemenu( _this );
- var child_3 = new Xcls_GestureClick31( _this );
- child_3.ref();
- this.el.add_controller( child_3.el );
- var child_4 = new Xcls_GestureClick32( _this );
- child_4.ref();
- this.el.add_controller( child_4.el );
- new Xcls_keycol( _this );
- this.el.append_column ( _this.keycol.el );
- new Xcls_valcol( _this );
- this.el.append_column ( _this.valcol.el );
- new Xcls_ContextMenu( _this );
-
- // init method
-
- {
-
- this.css = new Gtk.CssProvider();
-
- this.css.load_from_string("
- #leftprops-view { font-size: 12px;}
-
- #leftprops-view dropdown button {
- min-height: 16px;
- outline-offset : 0;
- }
- #leftprops-view cell dropdown label {
- padding-top:0px;
- padding-bottom:0px;
- }
- #leftprops-view cell {
- padding-top:2px;
- padding-bottom:2px;
- }
- #leftprops-view cell label, #leftprops-view cell editablelable {
- padding-top:4px;
- padding-bottom:4px;
- }");
-
- Gtk.StyleContext.add_provider_for_display(
- this.el.get_display(),
- this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
- );
-
-
- }
- }
-
- // user defined functions
- public Gtk.Widget? getWidgetAtRow (uint row) {
- /*
-
- from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
- var colview = gesture.widget;
- var line_no = check_list_widget(colview, x,y);
- if (line_no > -1) {
- var item = colview.model.get_item(line_no);
-
- }
- */
- GLib.debug("Get Widget At Row %d", (int)row);
- var child = this.el.get_first_child();
- var line_no = -1;
- var reading_header = true;
-
- while (child != null) {
- GLib.debug("Got %s", child.get_type().name());
- if (reading_header) {
-
-
- if (child.get_type().name() != "GtkColumnListView") {
- child = child.get_next_sibling();
- continue;
- }
- child = child.get_first_child();
- reading_header = false;
- }
- if (child.get_type().name() != "GtkColumnViewRowWidget") {
- child = child.get_next_sibling();
- continue;
- }
- line_no++;
- if (line_no == row) {
- GLib.debug("Returning widget %s", child.get_type().name());
- return (Gtk.Widget)child;
- }
- child = child.get_next_sibling();
- }
- GLib.debug("Rturning null");
- return null;
-
- }
- public void editProp (JsRender.NodeProp prop)
- {
- var sm = _this.selmodel.el;
-
- var sr = -1;
- GLib.debug("finding node");
- _this.selmodel.selectProp(prop);
-
- for (var i = 0 ; i < sm.n_items; i++) {
- var r = (JsRender.NodeProp)sm.get_item(i);
- if (r.equals(prop)) {
- sr = i;
- break;
- }
- }
- if (sr < 0) {
- GLib.debug("finding node - cant find it");
-
- return;
- }
- var r = this.getWidgetAtRow(sr);
- GLib.debug("r = %s", r.get_type().name());
- var ca = r.get_first_child();
- var ll = (Gtk.Label)ca.get_first_child();
- var cb = ca.get_next_sibling();
- var b = cb.get_first_child();
- var e = (Gtk.EditableLabel) b.get_first_child();
- var l = (Gtk.Label) e.get_next_sibling();
- var d = (Gtk.DropDown) l.get_next_sibling();
-
- GLib.debug("row key = %s", ll.label);
- if (e.get_visible()) {
- _this.stop_editor();
- e.start_editing();
- //GLib.Timeout.add_once(500, () => {
- // var st = (Gtk.Stack) e.get_first_child();
- // var ed = (Gtk.Entry) st.get_visible_child();
- // ed.grab_focus_without_selecting();
- //});
- return;
- }
- if (d.get_visible()) {
- _this.stop_editor();
- d.activate();
- return;
- }
- if (l.get_visible()) {
- _this.stop_editor();
- _this.show_editor(_this.file, prop.parent, prop);
-
- }
-
-
-
- //gtkcolumnviewrowwidget
- // cell widet
- // cell widget
- // box
- // entry / label / dropdown
-
-
- }
- public int getColAt (double x, double y) {
- /*
-
- from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
-
- */
- //Gtk.Allocation alloc = { 0, 0, 0, 0 };
- var child = this.el.get_first_child();
-
- var col = 0;
- var offx = 0;
- while (child != null) {
- GLib.debug("Got %s", child.get_type().name());
-
- if (child.get_type().name() == "GtkColumnViewRowWidget") {
- child = child.get_first_child();
- continue;
- }
-
- //child.get_allocation(out alloc);
- if (x < (child.get_width() + offx)) {
- return col;
- }
- offx += child.get_width();
- col++;
- child = child.get_next_sibling();
- }
-
-
- return -1;
-
- }
- public int getRowAt (double x, double in_y, out string pos) {
-
-
-
-
- /*
-
- from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
- var colview = gesture.widget;
- var line_no = check_list_widget(colview, x,y);
- if (line_no > -1) {
- var item = colview.model.get_item(line_no);
-
- }
- */
-
-
- //GLib.debug("offset = %d y = %d", (int) voff, (int) in_y);
- var y = in_y + _this.EditProps.el.vadjustment.value;
- var child = this.el.get_first_child();
- //Gtk.Allocation alloc = { 0, 0, 0, 0 };
- var line_no = -1;
- var reading_header = true;
- var real_y = 0;
- var header_height = 0;
- pos = "none";
- var h = 0;
- while (child != null) {
- //GLib.debug("Got %s", child.get_type().name());
- if (reading_header) {
-
-
- if (child.get_type().name() != "GtkColumnListView") {
- h += child.get_height();
- child = child.get_next_sibling();
- continue;
- }
- // should be columnlistview
- child = child.get_first_child();
- GLib.debug("header height=%d", h);
- header_height = h;
-
- reading_header = false;
-
- }
-
- if (child.get_type().name() != "GtkColumnViewRowWidget") {
- child = child.get_next_sibling();
- continue;
- }
-
- if (y < header_height) {
- return -1;
- }
-
- line_no++;
- var hh = child.get_height();
- //child.get_allocation(out alloc);
- //GLib.debug("got cell xy = %d,%d w,h= %d,%d", alloc.x, alloc.y, alloc.width, alloc.height);
- //GLib.debug("row %d y= %d %s", line_no, (int) (header_height + alloc.y),
-
- // child.visible ? "VIS" : "hidden");
-
- if (y > (header_height + real_y) && y <= (header_height + real_y + hh) ) {
- if (y > ( header_height + real_y + (hh * 0.8))) {
- pos = "below";
- } else if (y > ( header_height + real_y + (hh * 0.2))) {
- pos = "over";
- } else {
- pos = "above";
- }
- GLib.debug("getRowAt return : %d, %s", line_no, pos);
- return line_no;
- }
-
-
- if (real_y + hh > y) {
- return -1;
- }
- real_y += hh;
- child = child.get_next_sibling();
- }
- return -1;
-
- }
- }
- public class Xcls_deletemenu : Object
- {
- public Gtk.Popover el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_deletemenu(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.deletemenu = this;
- this.el = new Gtk.Popover();
-
- // my vars (dec)
-
- // set gobject values
- var child_1 = new Xcls_Box29( _this );
- this.el.child = child_1.el;
- }
-
- // user defined functions
- }
- public class Xcls_Box29 : Object
- {
- public Gtk.Box el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box29(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- var child_1 = new Xcls_Button30( _this );
- child_1.ref();
- this.el.append( child_1.el );
- }
-
- // user defined functions
- }
- public class Xcls_Button30 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button30(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Delete";
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
-
- var n = (JsRender.NodeProp) _this.selmodel.el.selected_item;
-
- _this.deletemenu.el.hide();
- _this.node.remove_prop(n);
- });
- }
-
- // user defined functions
- }
-
-
-
- public class Xcls_GestureClick31 : Object
- {
- public Gtk.GestureClick el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_GestureClick31(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.GestureClick();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.pressed.connect( (n_press, in_x, in_y) => {
-
- GLib.debug("Prssed %d", (int) this.el.get_current_button());
-
- var col = _this.view.getColAt(in_x, in_y);
- if (col != 0) {
- return;
- }
- string pos;
- var row = _this.view.getRowAt(in_x, in_y, out pos);
-
- if (row < 0) {
- return;
-
- }
- GLib.debug("hit row %d", row);
- var prop = _this.selmodel.getPropAt(row);
- _this.selmodel.selectProp(prop);
-
- //var point_at = _this.view.getWidgetAtRow(row);
-
- // need to shift down, as ev.y does not inclucde header apparently..
- // or popover might be trying to do a central?
- // _this.view.editPropertyDetails(prop, (int) in_y + 12);
- _this.stop_editor();
- _this.view.popover.show(
- _this.view.el,
- _this.node, prop,
- (int)in_y);
-
-
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_GestureClick32 : Object
- {
- public Gtk.GestureClick el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_GestureClick32(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.GestureClick();
-
- // my vars (dec)
-
- // set gobject values
- this.el.button = 3;
-
- //listeners
- this.el.pressed.connect( (n_press, in_x, in_y) => {
-
-
-
- string pos;
- var row = _this.view.getRowAt(in_x, in_y, out pos);
-
- if (row < 0) {
- return;
-
- }
-
- _this.stop_editor();
- GLib.debug("hit row %d", row);
- var prop = _this.selmodel.getPropAt(row);
- _this.selmodel.selectProp(prop);
-
-
-
- GLib.debug("Prssed %d", (int) this.el.get_current_button());
- //_this.deletemenu.el.set_parent(_this.view.el);
- if (_this.deletemenu.el.parent == null) {
- _this.deletemenu.el.set_parent(_this.main_window.el);
- }
-
-
-
- _this.deletemenu.el.set_offset(
- (int)in_x - _this.view.el.get_width() ,
- (int)in_y - _this.view.el.get_height()
- );
- _this.deletemenu.el.set_position(Gtk.PositionType.BOTTOM);
- _this.deletemenu.el.popup();
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_selmodel : Object
- {
- public Gtk.SingleSelection el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_selmodel(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.selmodel = this;
- new Xcls_model( _this );
- this.el = new Gtk.SingleSelection( _this.model.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.can_unselect = true;
- }
-
- // user defined functions
- public void startEditing (JsRender.NodeProp prop) {
- // should we call select?? - caller does int (from windowstate)
-
- }
- public void selectProp (JsRender.NodeProp prop) {
- for (var i = 0 ; i < this.el.n_items; i++) {
- var r = (JsRender.NodeProp)this.el.get_item(i);
- if (r.equals(prop)) {
- this.el.selected = i;
- return;
- }
- }
-
- }
- public JsRender.NodeProp getPropAt (uint row) {
-
- return (JsRender.NodeProp) this.el.get_item(row);
-
-
- }
- }
- public class Xcls_model : Object
- {
- public GLib.ListStore el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_model(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.model = this;
- this.el = new GLib.ListStore(typeof(JsRender.NodeProp));
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
- public class Xcls_keycol : Object
- {
- public Gtk.ColumnViewColumn el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_keycol(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.keycol = this;
- var child_1 = new Xcls_SignalListItemFactory36( _this );
- child_1.ref();
- this.el = new Gtk.ColumnViewColumn( "Property", child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.id = "keycol";
- this.el.expand = true;
- this.el.resizable = true;
- }
-
- // user defined functions
- }
- public class Xcls_SignalListItemFactory36 : Object
- {
- public Gtk.SignalListItemFactory el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SignalListItemFactory36(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.SignalListItemFactory();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.setup.connect( (listitem) => {
- var lbl = new Gtk.Label("");
- ((Gtk.ListItem)listitem).set_child(lbl);
- lbl.justify = Gtk.Justification.LEFT;
- lbl.xalign = 1;
- lbl.use_markup = true;
- lbl.ellipsize = Pango.EllipsizeMode.START;
- /*lbl.changed.connect(() => {
- // notify and save the changed value...
- //var prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem.get_item());
-
- //prop.val = lbl.text;
- //_this.updateIter(iter,prop);
- _this.changed();
- });
- */
- ((Gtk.ListItem)listitem).activatable = true;
- });
- this.el.bind.connect( (listitem) => {
- var lb = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();
- var item = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();
-
-
- item.bind_property("to_display_name_prop",
- lb, "label",
- GLib.BindingFlags.SYNC_CREATE);
- item.bind_property("to_tooltip_name_prop",
- lb, "tooltip_markup",
- GLib.BindingFlags.SYNC_CREATE);
- // was item (1) in old layout
-
-
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_valcol : Object
- {
- public Gtk.ColumnViewColumn el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_valcol(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.valcol = this;
- var child_1 = new Xcls_SignalListItemFactory38( _this );
- child_1.ref();
- this.el = new Gtk.ColumnViewColumn( "Value", child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.id = "valcol";
- this.el.expand = true;
- this.el.resizable = true;
- }
-
- // user defined functions
- }
- public class Xcls_SignalListItemFactory38 : Object
- {
- public Gtk.SignalListItemFactory el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
- public bool is_setting;
-
- // ctor
- public Xcls_SignalListItemFactory38(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.SignalListItemFactory();
-
- // my vars (dec)
- this.is_setting = false;
-
- // set gobject values
-
- //listeners
- this.el.setup.connect( (listitem) => {
- var hb = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);
- var elbl = new Gtk.EditableLabel("");
- elbl.hexpand = true;
- hb.append(elbl);
- var lbl = new Gtk.Label("");
- hb.append(lbl);
- lbl.hexpand = true;
- lbl.use_markup = true;
- lbl.xalign =0;
- lbl.ellipsize = Pango.EllipsizeMode.END;
- var cb = new Gtk.DropDown(new Gtk.StringList({}), null);
- cb.hexpand = true;
-
- hb.append(cb);
- ((Gtk.ListItem)listitem).set_child(hb);
-
- var ef = new Gtk.EventControllerFocus();
- ef.enter.connect(() => {
- _this.stop_editor();
- var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
- _this.selmodel.selectProp(prop);
- });
- elbl.add_controller(ef);
-
-
- // dropdown??? - stop editing, and highliht node
- var tb = (Gtk.ToggleButton) cb.get_first_child();
- tb.clicked.connect(() => {
- var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
-
- _this.stop_editor();
- _this.selmodel.selectProp(prop);
-
- });
- elbl.changed.connect(() => {
- // notify and save the changed value...
-
- //_this.updateIter(iter,prop);
- // this should happen automatically
-
- if (!_this.loading && !this.is_setting) {
- var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
-
-
- prop.val = elbl.text;
- GLib.debug("calling changed");
- _this.changed();
-
- }
-
- });
-
-
- cb.notify["selected"].connect(() => {
- // dropdown selection changed.
-
-
-
- //_this.updateIter(iter,prop);
- if (!_this.loading && !this.is_setting) {
- var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
- var model = (Gtk.StringList)cb.model;
- prop.val = model.get_string(cb.selected);
- GLib.debug("property set to %s", prop.val);
- GLib.debug("calling changed");
- _this.changed();
-
- }
-
-
- });
- var gc = new Gtk.GestureClick();
- lbl.add_controller(gc);
- gc.pressed.connect(() => {
- var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
- _this.stop_editor();
- _this.show_editor(_this.file, prop.parent, prop);
- });
-
-
-
- });
- this.el.bind.connect( (listitem) => {
- this.is_setting = true;
-
-
- var bx = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();
-
-
-
-
- var elbl = (Gtk.EditableLabel)bx.get_first_child();
- var lbl = (Gtk.Label) elbl.get_next_sibling();
- var cb = (Gtk.DropDown) lbl.get_next_sibling();
- // decide if it's a combo or editable text..
- var model = (Gtk.StringList) cb.model;
-
- elbl.hide();
- lbl.hide();
- cb.hide();
-
- var prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();
- //GLib.debug("prop = %s", prop.get_type().name());
- //GLib.debug("prop.val = %s", prop.val);
- //GLib.debug("prop.key = %s", prop.to_display_name());
-
- var use_textarea = prop.useTextArea();
-
-
- var pal = _this.file.project.palete;
-
- string[] opts;
- var has_opts = pal.typeOptions(_this.node.fqn(), prop.name, prop.rtype, out opts);
-
- if (!has_opts && prop.ptype == JsRender.NodePropType.RAW) {
- use_textarea = true;
- }
-
-
- if (use_textarea) {
- prop.bind_property("val_short",
- lbl, "label",
- GLib.BindingFlags.SYNC_CREATE);
- prop.bind_property("val_tooltip",
- lbl, "tooltip_markup",
- GLib.BindingFlags.SYNC_CREATE);
- lbl.show();
- this.is_setting = false;
- return;
-
- }
-
-
-
-
-
- // others... - fill in options for true/false?
- // GLib.debug (ktype.up());
- if (has_opts) {
-
- while(model.get_n_items() > 0) {
- model.remove(0);
- }
- cb.show();
- // can not remove - hopefully always empty.
- var sel = -1;
- for(var i = 0; i < opts.length; i ++) {
- model.append( opts[i]);
- // not sure this is a great idea...
- if (opts[i].down() == prop.val.down()) {
- sel = i;
- }
- }
- GLib.debug("Set selected item to %d", sel);
- cb.set_selected(sel > -1 ? sel : Gtk.INVALID_LIST_POSITION);
- this.is_setting = false;
- return ;
- }
-
- // see if type is a Enum.
- // triggers a changed event
-
- elbl.set_text(prop.val);
-
- elbl.show();
- this.is_setting = false;
-
-
-
-
-
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_ContextMenu : Object
- {
- public Gtk.Popover el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ContextMenu(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.ContextMenu = this;
- this.el = new Gtk.Popover();
-
- // my vars (dec)
-
- // set gobject values
- var child_1 = new Xcls_Box40( _this );
- this.el.child = child_1.el;
- }
-
- // user defined functions
- }
- public class Xcls_Box40 : Object
- {
- public Gtk.Box el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box40(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- var child_1 = new Xcls_Button41( _this );
- child_1.ref();
- this.el.append( child_1.el );
- }
-
- // user defined functions
- }
- public class Xcls_Button41 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button41(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Delete";
-
- //listeners
- this.el.activate.connect( ( ) =>{
- _this.deleteSelected();
-
- });
- }
+ // user defined functions
+ }
+
+ public class Xcls_Button25 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button25(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
+ this.el.label = "Flexy - Foreach";
+
+ //listeners
+ this.el.clicked.connect( ( ) =>{
+ _this.AddPropertyPopup.el.hide();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node,
+ new JsRender.NodeProp.prop("flexy:if", "string", "value_or_condition") ,
+ -1,
+ true
+ );
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+
+
+
+ public class Xcls_EditProps : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+ public bool editing;
+
+ // ctor
+ public Xcls_EditProps(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.EditProps = this;
+ this.el = new Gtk.ScrolledWindow();
+
+ // my vars (dec)
+ this.editing = false;
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ new Xcls_view( _this );
+ this.el.set_child ( _this.view.el );
+
+ // init method
+
+ {
+
+ this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+ }
+ }
+
+ // user defined functions
+ }
+ public class Xcls_view : Object
+ {
+ public Gtk.ColumnView el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+ public Gtk.CssProvider css;
+ public Xcls_PopoverProperty popover;
+
+ // ctor
+ public Xcls_view(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.view = this;
+ new Xcls_selmodel( _this );
+ this.el = new Gtk.ColumnView( _this.selmodel.el );
+
+ // my vars (dec)
+ this.popover = null;
+
+ // set gobject values
+ this.el.name = "leftprops-view";
+ this.el.single_click_activate = false;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ this.el.show_row_separators = true;
+ new Xcls_deletemenu( _this );
+ var child_3 = new Xcls_GestureClick31( _this );
+ child_3.ref();
+ this.el.add_controller( child_3.el );
+ var child_4 = new Xcls_GestureClick32( _this );
+ child_4.ref();
+ this.el.add_controller( child_4.el );
+ new Xcls_keycol( _this );
+ this.el.append_column ( _this.keycol.el );
+ new Xcls_valcol( _this );
+ this.el.append_column ( _this.valcol.el );
+ new Xcls_ContextMenu( _this );
+
+ // init method
+
+ {
+
+ this.css = new Gtk.CssProvider();
+
+ this.css.load_from_string("
+ #leftprops-view { font-size: 12px;}
+
+ #leftprops-view dropdown button {
+ min-height: 16px;
+ outline-offset : 0;
+ }
+ #leftprops-view cell dropdown label {
+ padding-top:0px;
+ padding-bottom:0px;
+ }
+ #leftprops-view cell {
+ padding-top:2px;
+ padding-bottom:2px;
+ }
+ #leftprops-view cell label, #leftprops-view cell editablelable {
+ padding-top:4px;
+ padding-bottom:4px;
+ }");
+
+ Gtk.StyleContext.add_provider_for_display(
+ this.el.get_display(),
+ this.css,
+ Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
+ );
+
+
+ }
+ }
+
+ // user defined functions
+ public Gtk.Widget? getWidgetAtRow (uint row) {
+ /*
+
+ from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
+ var colview = gesture.widget;
+ var line_no = check_list_widget(colview, x,y);
+ if (line_no > -1) {
+ var item = colview.model.get_item(line_no);
+
+ }
+ */
+ GLib.debug("Get Widget At Row %d", (int)row);
+ var child = this.el.get_first_child();
+ var line_no = -1;
+ var reading_header = true;
+
+ while (child != null) {
+ GLib.debug("Got %s", child.get_type().name());
+ if (reading_header) {
+
+
+ if (child.get_type().name() != "GtkColumnListView") {
+ child = child.get_next_sibling();
+ continue;
+ }
+ child = child.get_first_child();
+ reading_header = false;
+ }
+ if (child.get_type().name() != "GtkColumnViewRowWidget") {
+ child = child.get_next_sibling();
+ continue;
+ }
+ line_no++;
+ if (line_no == row) {
+ GLib.debug("Returning widget %s", child.get_type().name());
+ return (Gtk.Widget)child;
+ }
+ child = child.get_next_sibling();
+ }
+ GLib.debug("Rturning null");
+ return null;
+
+ }
+ public void editProp (JsRender.NodeProp prop)
+ {
+ var sm = _this.selmodel.el;
+
+ var sr = -1;
+ GLib.debug("finding node");
+ _this.selmodel.selectProp(prop);
+
+ for (var i = 0 ; i < sm.n_items; i++) {
+ var r = (JsRender.NodeProp)sm.get_item(i);
+ if (r.equals(prop)) {
+ sr = i;
+ break;
+ }
+ }
+ if (sr < 0) {
+ GLib.debug("finding node - cant find it");
+
+ return;
+ }
+ var r = this.getWidgetAtRow(sr);
+ GLib.debug("r = %s", r.get_type().name());
+ var ca = r.get_first_child();
+ var ll = (Gtk.Label)ca.get_first_child();
+ var cb = ca.get_next_sibling();
+ var b = cb.get_first_child();
+ var e = (Gtk.Entry) b.get_first_child();
+ var l = (Gtk.Label) e.get_next_sibling();
+ var d = (Gtk.DropDown) l.get_next_sibling();
+
+ GLib.debug("row key = %s", ll.label);
+ if (e.get_visible()) {
+ _this.stop_editor();
+ e.grab_focus_without_selecting();
+ return;
+ }
+ if (d.get_visible()) {
+ _this.stop_editor();
+ d.activate();
+ return;
+ }
+ if (l.get_visible()) {
+ _this.stop_editor();
+ _this.show_editor(_this.file, prop.parent, prop);
+
+ }
+
+
+
+ //gtkcolumnviewrowwidget
+ // cell widet
+ // cell widget
+ // box
+ // entry / label / dropdown
+
+
+ }
+ public int getColAt (double x, double y) {
+ /*
+
+ from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
+
+ */
+ //Gtk.Allocation alloc = { 0, 0, 0, 0 };
+ var child = this.el.get_first_child();
+
+ var col = 0;
+ var offx = 0;
+ while (child != null) {
+ GLib.debug("Got %s", child.get_type().name());
+
+ if (child.get_type().name() == "GtkColumnViewRowWidget") {
+ child = child.get_first_child();
+ continue;
+ }
+
+ //child.get_allocation(out alloc);
+ if (x < (child.get_width() + offx)) {
+ return col;
+ }
+ offx += child.get_width();
+ col++;
+ child = child.get_next_sibling();
+ }
+
+
+ return -1;
+
+ }
+ public int getRowAt (double x, double in_y, out string pos) {
+
+
+
+
+ /*
+
+ from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
+ var colview = gesture.widget;
+ var line_no = check_list_widget(colview, x,y);
+ if (line_no > -1) {
+ var item = colview.model.get_item(line_no);
+
+ }
+ */
+
+
+ //GLib.debug("offset = %d y = %d", (int) voff, (int) in_y);
+ var y = in_y + _this.EditProps.el.vadjustment.value;
+ var child = this.el.get_first_child();
+ //Gtk.Allocation alloc = { 0, 0, 0, 0 };
+ var line_no = -1;
+ var reading_header = true;
+ var real_y = 0;
+ var header_height = 0;
+ pos = "none";
+ var h = 0;
+ while (child != null) {
+ //GLib.debug("Got %s", child.get_type().name());
+ if (reading_header) {
+
+
+ if (child.get_type().name() != "GtkColumnListView") {
+ h += child.get_height();
+ child = child.get_next_sibling();
+ continue;
+ }
+ // should be columnlistview
+ child = child.get_first_child();
+ GLib.debug("header height=%d", h);
+ header_height = h;
+
+ reading_header = false;
+
+ }
+
+ if (child.get_type().name() != "GtkColumnViewRowWidget") {
+ child = child.get_next_sibling();
+ continue;
+ }
+
+ if (y < header_height) {
+ return -1;
+ }
+
+ line_no++;
+ var hh = child.get_height();
+ //child.get_allocation(out alloc);
+ //GLib.debug("got cell xy = %d,%d w,h= %d,%d", alloc.x, alloc.y, alloc.width, alloc.height);
+ //GLib.debug("row %d y= %d %s", line_no, (int) (header_height + alloc.y),
+
+ // child.visible ? "VIS" : "hidden");
+
+ if (y > (header_height + real_y) && y <= (header_height + real_y + hh) ) {
+ if (y > ( header_height + real_y + (hh * 0.8))) {
+ pos = "below";
+ } else if (y > ( header_height + real_y + (hh * 0.2))) {
+ pos = "over";
+ } else {
+ pos = "above";
+ }
+ GLib.debug("getRowAt return : %d, %s", line_no, pos);
+ return line_no;
+ }
+
+
+ if (real_y + hh > y) {
+ return -1;
+ }
+ real_y += hh;
+ child = child.get_next_sibling();
+ }
+ return -1;
+
+ }
+ }
+ public class Xcls_deletemenu : Object
+ {
+ public Gtk.Popover el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_deletemenu(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.deletemenu = this;
+ this.el = new Gtk.Popover();
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Box29( _this );
+ this.el.child = child_1.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Box29 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box29(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Button30( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Button30 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button30(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "Delete";
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+
+ var n = (JsRender.NodeProp) _this.selmodel.el.selected_item;
+
+ _this.deletemenu.el.hide();
+ _this.node.remove_prop(n);
+ });
+ }
+
+ // user defined functions
+ }
+
+
+
+ public class Xcls_GestureClick31 : Object
+ {
+ public Gtk.GestureClick el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_GestureClick31(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.GestureClick();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.pressed.connect( (n_press, in_x, in_y) => {
+
+ GLib.debug("Prssed %d", (int) this.el.get_current_button());
+
+ var col = _this.view.getColAt(in_x, in_y);
+ if (col != 0) {
+ return;
+ }
+ string pos;
+ var row = _this.view.getRowAt(in_x, in_y, out pos);
+
+ if (row < 0) {
+ return;
+
+ }
+ GLib.debug("hit row %d", row);
+ var prop = _this.selmodel.getPropAt(row);
+ _this.selmodel.selectProp(prop);
+
+ //var point_at = _this.view.getWidgetAtRow(row);
+
+ // need to shift down, as ev.y does not inclucde header apparently..
+ // or popover might be trying to do a central?
+ // _this.view.editPropertyDetails(prop, (int) in_y + 12);
+ _this.stop_editor();
+ _this.view.popover.show(
+ _this.view.el,
+ _this.node, prop,
+ (int)in_y);
+
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_GestureClick32 : Object
+ {
+ public Gtk.GestureClick el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_GestureClick32(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.GestureClick();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.button = 3;
+
+ //listeners
+ this.el.pressed.connect( (n_press, in_x, in_y) => {
+
+
+
+ string pos;
+ var row = _this.view.getRowAt(in_x, in_y, out pos);
+
+ if (row < 0) {
+ return;
+
+ }
+
+ _this.stop_editor();
+ GLib.debug("hit row %d", row);
+ var prop = _this.selmodel.getPropAt(row);
+ _this.selmodel.selectProp(prop);
+
+
+
+ GLib.debug("Prssed %d", (int) this.el.get_current_button());
+ //_this.deletemenu.el.set_parent(_this.view.el);
+ _this.deletemenu.el.set_parent(_this.main_window.el);
+
+
+
+ _this.deletemenu.el.set_offset(
+ (int)in_x - _this.view.el.get_width() ,
+ (int)in_y - _this.view.el.get_height()
+ );
+ _this.deletemenu.el.set_position(Gtk.PositionType.BOTTOM);
+ _this.deletemenu.el.popup();
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_selmodel : Object
+ {
+ public Gtk.SingleSelection el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_selmodel(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.selmodel = this;
+ new Xcls_model( _this );
+ this.el = new Gtk.SingleSelection( _this.model.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.can_unselect = true;
+ }
+
+ // user defined functions
+ public void startEditing (JsRender.NodeProp prop) {
+ // should we call select?? - caller does int (from windowstate)
+
+ }
+ public void selectProp (JsRender.NodeProp prop) {
+ for (var i = 0 ; i < this.el.n_items; i++) {
+ var r = (JsRender.NodeProp)this.el.get_item(i);
+ if (r.equals(prop)) {
+ this.el.selected = i;
+ return;
+ }
+ }
+
+ }
+ public JsRender.NodeProp getPropAt (uint row) {
+
+ return (JsRender.NodeProp) this.el.get_item(row);
+
+
+ }
+ }
+ public class Xcls_model : Object
+ {
+ public GLib.ListStore el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_model(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.model = this;
+ this.el = new GLib.ListStore(typeof(JsRender.NodeProp));
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_keycol : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_keycol(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.keycol = this;
+ var child_1 = new Xcls_SignalListItemFactory36( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Property", child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.id = "keycol";
+ this.el.expand = true;
+ this.el.resizable = true;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory36 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_SignalListItemFactory36(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (listitem) => {
+ var lbl = new Gtk.Label("");
+ ((Gtk.ListItem)listitem).set_child(lbl);
+ lbl.justify = Gtk.Justification.LEFT;
+ lbl.xalign = 1;
+ lbl.use_markup = true;
+ lbl.ellipsize = Pango.EllipsizeMode.START;
+ /*lbl.changed.connect(() => {
+ // notify and save the changed value...
+ //var prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem.get_item());
+
+ //prop.val = lbl.text;
+ //_this.updateIter(iter,prop);
+ _this.changed();
+ });
+ */
+ ((Gtk.ListItem)listitem).activatable = true;
+ });
+ this.el.bind.connect( (listitem) => {
+ var lb = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();
+ var item = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();
+
+
+ item.bind_property("to_display_name_prop",
+ lb, "label",
+ GLib.BindingFlags.SYNC_CREATE);
+ item.bind_property("to_tooltip_name_prop",
+ lb, "tooltip_markup",
+ GLib.BindingFlags.SYNC_CREATE);
+ // was item (1) in old layout
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_valcol : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_valcol(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.valcol = this;
+ var child_1 = new Xcls_SignalListItemFactory38( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Value", child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.id = "valcol";
+ this.el.expand = true;
+ this.el.resizable = true;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory38 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+ public bool is_setting;
+
+ // ctor
+ public Xcls_SignalListItemFactory38(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+ this.is_setting = false;
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (listitem) => {
+ var hb = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);
+ var elbl = new Gtk.EditableLabel("");
+ elbl.hexpand = true;
+ hb.append(elbl);
+ var lbl = new Gtk.Label("");
+ hb.append(lbl);
+ lbl.hexpand = true;
+ lbl.use_markup = true;
+ lbl.xalign =0;
+ lbl.ellipsize = Pango.EllipsizeMode.END;
+ var cb = new Gtk.DropDown(new Gtk.StringList({}), null);
+ cb.hexpand = true;
+
+ hb.append(cb);
+ ((Gtk.ListItem)listitem).set_child(hb);
+
+ var ef = new Gtk.EventControllerFocus();
+ ef.enter.connect(() => {
+ _this.stop_editor();
+ var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
+ _this.selmodel.selectProp(prop);
+ });
+ elbl.add_controller(ef);
+
+
+ // dropdown??? - stop editing, and highliht node
+ var tb = (Gtk.ToggleButton) cb.get_first_child();
+ tb.clicked.connect(() => {
+ var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
+
+ _this.stop_editor();
+ _this.selmodel.selectProp(prop);
+
+ });
+ elbl.changed.connect(() => {
+ // notify and save the changed value...
+
+ //_this.updateIter(iter,prop);
+ // this should happen automatically
+
+ if (!_this.loading && !this.is_setting) {
+ var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
+
+
+ prop.val = elbl.text;
+ GLib.debug("calling changed");
+ _this.changed();
+
+ }
+
+ });
+
+
+ cb.notify["selected"].connect(() => {
+ // dropdown selection changed.
+
+
+
+ //_this.updateIter(iter,prop);
+ if (!_this.loading && !this.is_setting) {
+ var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
+ var model = (Gtk.StringList)cb.model;
+ prop.val = model.get_string(cb.selected);
+ GLib.debug("property set to %s", prop.val);
+ GLib.debug("calling changed");
+ _this.changed();
+
+ }
+
+
+ });
+ var gc = new Gtk.GestureClick();
+ lbl.add_controller(gc);
+ gc.pressed.connect(() => {
+ var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
+ _this.stop_editor();
+ _this.show_editor(_this.file, prop.parent, prop);
+ });
+
+
+
+ });
+ this.el.bind.connect( (listitem) => {
+ this.is_setting = true;
+
+
+ var bx = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();
+
+
+
+
+ var elbl = (Gtk.EditableLabel)bx.get_first_child();
+ var lbl = (Gtk.Label) elbl.get_next_sibling();
+ var cb = (Gtk.DropDown) lbl.get_next_sibling();
+ // decide if it's a combo or editable text..
+ var model = (Gtk.StringList) cb.model;
+
+ elbl.hide();
+ lbl.hide();
+ cb.hide();
+
+ var prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();
+ //GLib.debug("prop = %s", prop.get_type().name());
+ //GLib.debug("prop.val = %s", prop.val);
+ //GLib.debug("prop.key = %s", prop.to_display_name());
+
+ var use_textarea = prop.useTextArea();
+
+
+ var pal = _this.file.project.palete;
+
+ string[] opts;
+ var has_opts = pal.typeOptions(_this.node.fqn(), prop.name, prop.rtype, out opts);
+
+ if (!has_opts && prop.ptype == JsRender.NodePropType.RAW) {
+ use_textarea = true;
+ }
+
+
+ if (use_textarea) {
+ prop.bind_property("val_short",
+ lbl, "label",
+ GLib.BindingFlags.SYNC_CREATE);
+ prop.bind_property("val_tooltip",
+ lbl, "tooltip_markup",
+ GLib.BindingFlags.SYNC_CREATE);
+ lbl.show();
+ this.is_setting = false;
+ return;
+
+ }
+
+
+
+
+
+ // others... - fill in options for true/false?
+ // GLib.debug (ktype.up());
+ if (has_opts) {
+
+ while(model.get_n_items() > 0) {
+ model.remove(0);
+ }
+ cb.show();
+ // can not remove - hopefully always empty.
+ var sel = -1;
+ for(var i = 0; i < opts.length; i ++) {
+ model.append( opts[i]);
+ // not sure this is a great idea...
+ if (opts[i].down() == prop.val.down()) {
+ sel = i;
+ }
+ }
+ GLib.debug("Set selected item to %d", sel);
+ cb.set_selected(sel > -1 ? sel : Gtk.INVALID_LIST_POSITION);
+ this.is_setting = false;
+ return ;
+ }
+
+ // see if type is a Enum.
+ // triggers a changed event
+
+ elbl.set_text(prop.val);
+
+ elbl.show();
+ this.is_setting = false;
+
+
+
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_ContextMenu : Object
+ {
+ public Gtk.Popover el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_ContextMenu(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.ContextMenu = this;
+ this.el = new Gtk.Popover();
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Box40( _this );
+ this.el.child = child_1.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Box40 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box40(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Button41( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Button41 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button41(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "Delete";
+
+ //listeners
+ this.el.activate.connect( ( ) =>{
+ _this.deleteSelected();
+
+ });
+ }
- // user defined functions
- }
+ // user defined functions
+ }
-}
+ }
"#left-tree-view indent {",
"-gtk-icon-size : 2px;",
"}",
- "#left-tree-view indent:nth-last-child(2) {",
- "min-width: 24px;",
- "}",
"\");",
"",
"\tGtk.StyleContext.add_provider_for_display(",
"\t}",
"\tGLib.debug(\"Select %d\", row);",
"\ts.set_selected(row);",
- "\t_this.view.el.scroll_to(row, null, Gtk.ListScrollFlags.SELECT, null);",
- "\t//_this.node_selected(node);\t\t\t",
+ "\t_this.node_selected(node);\t\t\t",
"\t",
"",
"}"
-static Xcls_WindowLeftTree _WindowLeftTree;
-
-public class Xcls_WindowLeftTree : Object
-{
- public Gtk.Box el;
- private Xcls_WindowLeftTree _this;
-
- public static Xcls_WindowLeftTree singleton()
- {
- if (_WindowLeftTree == null) {
- _WindowLeftTree= new Xcls_WindowLeftTree();
- }
- return _WindowLeftTree;
- }
- public Xcls_viewwin viewwin;
- public Xcls_view view;
- public Xcls_drop drop;
- public Xcls_selmodel selmodel;
- public Xcls_model model;
- public Xcls_maincol maincol;
- public Xcls_LeftTreeMenu LeftTreeMenu;
-
- // my vars (def)
- public signal bool before_node_change ();
- public Xcls_MainWindow main_window;
- public signal void changed ();
- public signal void node_selected (JsRender.Node? node);
-
- // ctor
- public Xcls_WindowLeftTree()
- {
- _this = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
- this.main_window = null;
-
- // set gobject values
- this.el.hexpand = true;
- this.el.vexpand = true;
- var child_1 = new Xcls_ListView2( _this );
- child_1.ref();
- this.el.append( child_1.el );
- new Xcls_viewwin( _this );
- this.el.append( _this.viewwin.el );
- }
-
- // user defined functions
- public void onresize () {
-
-
- //GLib.debug("Got allocation width of scrolled view %d", allocation.width );
- // _this.maincol.el.set_max_width( _this.viewwin.el.get_width() - 32 );
- }
- public JsRender.Node? getActiveElement () { // return path to actie node.
-
-
- return _this.selmodel.getSelectedNode();
-
-
- }
- public JsRender.JsRender getActiveFile () {
- return this.main_window.windowstate.file;
- }
- public class Xcls_ListView2 : Object
- {
- public Gtk.ListView el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ListView2(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_SignalListItemFactory3( _this );
- child_1.ref();
- this.el = new Gtk.ListView( null, child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
- public class Xcls_SignalListItemFactory3 : Object
- {
- public Gtk.SignalListItemFactory el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SignalListItemFactory3(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- this.el = new Gtk.SignalListItemFactory();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
- public class Xcls_viewwin : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_viewwin(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- _this.viewwin = this;
- this.el = new Gtk.ScrolledWindow();
-
- // my vars (dec)
-
- // set gobject values
- this.el.has_frame = true;
- this.el.hexpand = true;
- this.el.vexpand = true;
- new Xcls_view( _this );
- this.el.child = _this.view.el;
- new Xcls_LeftTreeMenu( _this );
-
- // init method
-
- this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
- }
-
- // user defined functions
- }
- public class Xcls_view : Object
- {
- public Gtk.ColumnView el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
- public bool blockChanges;
- public bool headers_visible;
- public string lastEventSource;
- public bool button_is_pressed;
- public Gtk.CssProvider css;
-
- // ctor
- public Xcls_view(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- _this.view = this;
- new Xcls_selmodel( _this );
- this.el = new Gtk.ColumnView( _this.selmodel.el );
-
- // my vars (dec)
- this.blockChanges = false;
- this.headers_visible = false;
- this.lastEventSource = "";
- this.button_is_pressed = false;
-
- // set gobject values
- this.el.name = "left-tree-view";
- this.el.hexpand = false;
- this.el.vexpand = true;
- var child_2 = new Xcls_GestureClick6( _this );
- child_2.ref();
- this.el.add_controller( child_2.el );
- var child_3 = new Xcls_GestureClick7( _this );
- child_3.ref();
- this.el.add_controller( child_3.el );
- var child_4 = new Xcls_DragSource8( _this );
- child_4.ref();
- this.el.add_controller( child_4.el );
- var child_5 = new Xcls_EventControllerKey9( _this );
- child_5.ref();
- this.el.add_controller( child_5.el );
- new Xcls_drop( _this );
- this.el.add_controller( _this.drop.el );
- new Xcls_maincol( _this );
- this.el.append_column ( _this.maincol.el );
- var child_8 = new Xcls_ColumnViewColumn15( _this );
- child_8.ref();
- this.el.append_column ( child_8.el );
-
- // init method
-
- {
-
- this.css = new Gtk.CssProvider();
- // try {
- this.css.load_from_string("
- #left-tree-view { font-size: 12px;}
- .drag-over { background-color:#88a3bc; }
- .drag-below {
- border-bottom-width: 5px;
- border-bottom-style: solid;
- border-bottom-color: #88a3bc;
- }
- .drag-above {
- border-top-width: 5px;
- border-top-style: solid;
- border-top-color: #88a3bc;
- }
- #left-tree-view indent {
- -gtk-icon-size : 2px;
- }
- #left-tree-view indent:nth-last-child(2) {
- min-width: 24px;
- }
- ");
-
- Gtk.StyleContext.add_provider_for_display(
- this.el.get_display(),
- this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
- );
-
-
- }
- }
-
- // user defined functions
- public Gtk.Widget? getWidgetAtRow (uint row) {
- /*
-
- from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
- var colview = gesture.widget;
- var line_no = check_list_widget(colview, x,y);
- if (line_no > -1) {
- var item = colview.model.get_item(line_no);
-
- }
- */
- //GLib.debug("Get Widget At Row %d", (int)row);
- var child = this.el.get_first_child();
- var line_no = -1;
- var reading_header = true;
-
- while (child != null) {
- GLib.debug("Got %s", child.get_type().name());
-
- if (reading_header) {
-
-
- if (child.get_type().name() != "GtkColumnListView") {
-
- child = child.get_next_sibling();
- continue;
- }
- // should be columnlistview
- child = child.get_first_child();
-
-
-
- reading_header = false;
-
- }
-
-
-
- line_no++;
- if (line_no == row) {
- //GLib.debug("Returning widget %s", child.get_type().name());
- return (Gtk.Widget)child;
- }
- child = child.get_next_sibling();
- }
- //GLib.debug("Rturning null");
- return null;
-
- }
- public int getColAt (double x, double y) {
- /*
-
- from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
-
- */
- //Gtk.Allocation alloc = { 0, 0, 0, 0 };
- //GLib.debug("Cehck %d, %d", x,y);
- var child = this.el.get_first_child();
-
- var col = 0;
- var offx = 0;
- while (child != null) {
-
- if (child.get_type().name() == "GtkColumnViewRowWidget") {
- child = child.get_first_child();
- continue;
- }
-
- //child.get_allocation(out alloc);
- if (x < (child.get_width() + offx)) {
- return col;
- }
- return 1;
- //offx += child.get_width();
- //col++;
- //child = child.get_next_sibling();
- }
-
-
- return -1;
-
- }
- public int getRowAt (double x, double in_y, out string pos) {
-
-
-
-
- /*
-
- from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
- var colview = gesture.widget;
- var line_no = check_list_widget(colview, x,y);
- if (line_no > -1) {
- var item = colview.model.get_item(line_no);
-
- }
- */
-
-
- //GLib.debug("offset = %d y = %d", (int) voff, (int) in_y);
- var y = in_y + _this.viewwin.el.vadjustment.value;
- var child = this.el.get_first_child();
- //Gtk.Allocation alloc = { 0, 0, 0, 0 };
- var line_no = -1;
- var reading_header = true;
- var real_y = 0;
- var header_height = 0;
- pos = "none";
- var h = 0;
- while (child != null) {
- //GLib.debug("Got %s", child.get_type().name());
- if (reading_header) {
-
-
- if (child.get_type().name() != "GtkColumnListView") {
- h += child.get_height();
- child = child.get_next_sibling();
- continue;
- }
- // should be columnlistview
- child = child.get_first_child();
- GLib.debug("header height=%d", h);
- header_height = h;
-
- reading_header = false;
-
- }
-
- if (child.get_type().name() != "GtkColumnViewRowWidget") {
- child = child.get_next_sibling();
- continue;
- }
-
- if (y < header_height) {
- return -1;
- }
-
- line_no++;
- var hh = child.get_height();
- //child.get_allocation(out alloc);
- //GLib.debug("got cell xy = %d,%d w,h= %d,%d", alloc.x, alloc.y, alloc.width, alloc.height);
- //GLib.debug("row %d y= %d %s", line_no, (int) (header_height + alloc.y),
-
- // child.visible ? "VIS" : "hidden");
-
- if (y > (header_height + real_y) && y <= (header_height + real_y + hh) ) {
- if (y > ( header_height + real_y + (hh * 0.8))) {
- pos = "below";
- } else if (y > ( header_height + real_y + (hh * 0.2))) {
- pos = "over";
- } else {
- pos = "above";
- }
- GLib.debug("getRowAt return : %d, %s", line_no, pos);
- return line_no;
- }
-
-
- if (real_y + hh > y) {
- return -1;
- }
- real_y += hh;
- child = child.get_next_sibling();
- }
- return -1;
-
- }
- public Gtk.Widget? getWidgetAt (double x, double in_y) {
- /*
-
- from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
- var colview = gesture.widget;
- var line_no = check_list_widget(colview, x,y);
- if (line_no > -1) {
- var item = colview.model.get_item(line_no);
-
- }
- */
- var y = in_y + _this.viewwin.el.vadjustment.value;
- var child = this.el.get_first_child();
- //Gtk.Allocation alloc = { 0, 0, 0, 0 };
- var line_no = -1;
- var reading_header = true;
- var curr_y = 0;
- var header_height = 0;
- var h = 0;
- while (child != null) {
- //GLib.debug("Got %s", child.get_type().name());
- if (reading_header) {
-
-
- if (child.get_type().name() != "GtkColumnListView") {
- h += child.get_height();
- child = child.get_next_sibling();
- continue;
- }
- // should be columnlistview
- child = child.get_first_child();
- GLib.debug("header height=%d", h);
- header_height = h;
-
- reading_header = false;
-
- }
- line_no++;
-
- if (y < header_height) {
- return null;
- }
-
- var hh = child.get_height();
- //GLib.debug("got cell xy = %d,%d w,h= %d,%d", alloc.x, alloc.y, alloc.width, alloc.height);
-
- if (y > curr_y && y <= header_height + hh + curr_y ) {
- return (Gtk.Widget)child;
- }
- curr_y += hh ;
-
- if (curr_y > y) {
- return null;
- }
- child = child.get_next_sibling();
- }
- return null;
-
- }
- }
- public class Xcls_GestureClick6 : Object
- {
- public Gtk.GestureClick el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_GestureClick6(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- this.el = new Gtk.GestureClick();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.released.connect( (n_press, x, y) => {
-
- _this.view.button_is_pressed = false;
-
-
- });
- this.el.pressed.connect( (n_press, x, y) => {
-
- //console.log("button press?");
-
- //this.el.set_state(Gtk.EventSequenceState.CLAIMED);
-
-
-
- _this.view.button_is_pressed = true;
-
- _this.view.lastEventSource = "tree";
- if (! _this.before_node_change() ) {
- GLib.debug("before_node_change return false");
- return ;
- }
-
- // nothing there -show dialog
- if (_this.model.el.get_n_items() < 1) {
- _this.main_window.windowstate.showAddObject(_this.view.el, null);
- GLib.debug("no items");
- return ;
- }
- string pos;
- var row = _this.view.getRowAt(x,y, out pos );
- if (row < 0) {
- GLib.debug("no row selected items");
- return;
- }
-
- var node = _this.selmodel.getNodeAt(row);
- if (node == null) {
- GLib.warning("No node found at row %d", row);
- return;
- }
-
-
-
- if (_this.view.getColAt(x,y) > 0 ) {
- GLib.debug("add colum clicked.");
- var fqn = node.fqn();
- var cn = _this.main_window.windowstate.project.palete.getChildList(fqn, false);
- if (cn.size < 1) {
- return ;
- }
-
- _this.main_window.windowstate.leftTreeBeforeChange();
- //_this.view.el.get_selection().select_path(res);
- GLib.debug("Button Pressed - start show window");
- _this.main_window.windowstate.showAddObject(_this.view.el, node);
- GLib.debug("Button Pressed - finsihed show window");
- return ;
- }
-
-
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_GestureClick7 : Object
- {
- public Gtk.GestureClick el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_GestureClick7(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- this.el = new Gtk.GestureClick();
-
- // my vars (dec)
-
- // set gobject values
- this.el.button = 3;
-
- //listeners
- this.el.pressed.connect( (n_press, x, y) => {
-
-
-
-
- if (_this.model.el.get_n_items() < 1) {
-
- GLib.debug("no items");
- return ;
- }
- string pos;
- var row = _this.view.getRowAt(x,y, out pos );
- if (row < 0) {
- GLib.debug("no row selected items");
- return;
- }
-
- var node = _this.selmodel.getNodeAt(row);
- if (node == null) {
- GLib.warning("No node found at row %d", row);
- return;
- }
- _this.model.selectNode(node);
-
-
-
- GLib.debug("Prssed %d", (int) this.el.get_current_button());
- //_this.deletemenu.el.set_parent(_this.view.el);
- _this.LeftTreeMenu.el.set_parent(_this.view.el);
-
-
- //Gtk.Allocation rect;
- //_this.view.el.get_allocation(out rect);
- //_this.deletemenu.el.set_has_arrow(false);
- _this.LeftTreeMenu.el.set_position(Gtk.PositionType.BOTTOM);
-
-
- _this.LeftTreeMenu.el.set_offset(
- (int)x ,
- (int)y - (int)_this.view.el.get_height());
-
- _this.LeftTreeMenu.el.popup();
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_DragSource8 : Object
- {
- public Gtk.DragSource el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_DragSource8(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- this.el = new Gtk.DragSource();
-
- // my vars (dec)
-
- // set gobject values
- this.el.actions = Gdk.DragAction.COPY | Gdk.DragAction.MOVE ;
-
- //listeners
- this.el.prepare.connect( (x, y) => {
-
-
-
- /// ( drag_context, data, info, time) => {
-
-
- //print("drag-data-get");
- var ndata = _this.selmodel.getSelectedNode();
- if (ndata == null) {
- GLib.debug("return empty string - no selection..");
- return null;
-
- }
-
-
- //data.set_text(tp,tp.length);
-
- var str = ndata.toJsonString();
- GLib.debug("prepare store: %s", str);
- GLib.Value ov = GLib.Value(typeof(string));
- ov.set_string(str);
- var cont = new Gdk.ContentProvider.for_value(ov);
- /*
- GLib.Value v = GLib.Value(typeof(string));
- //var str = drop.read_text( [ "text/plain" ] 0);
-
- cont.get_value(ref v);
-
- }
- GLib.debug("set %s", v.get_string());
- */
- return cont;
-
-
- });
- this.el.drag_begin.connect( ( drag ) => {
- GLib.debug("SOURCE: drag-begin");
-
- // find what is selected in our tree...
- var data = _this.selmodel.getSelectedNode();
- if (data == null) {
- return ;
- }
-
- var xname = data.fqn();
- GLib.debug ("XNAME IS %s", xname);
-
- var widget = _this.view.getWidgetAtRow(_this.selmodel.el.selected);
-
-
- var paintable = new Gtk.WidgetPaintable(widget);
- this.el.set_icon(paintable, 0,0);
-
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_EventControllerKey9 : Object
- {
- public Gtk.EventControllerKey el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_EventControllerKey9(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- this.el = new Gtk.EventControllerKey();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.key_pressed.connect( (keyval, keycode, state) => {
-
-
-
- if (keyval != Gdk.Key.Delete && keyval != Gdk.Key.BackSpace) {
- return true;
- }
-
- _this.model.deleteSelected();
- return true;
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_drop : Object
- {
- public Gtk.DropTarget el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
- public Gtk.Widget? highlightWidget;
- public JsRender.Node? lastDragNode;
- public string lastDragString;
-
- // ctor
- public Xcls_drop(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- _this.drop = this;
- this.el = new Gtk.DropTarget ( typeof(string) ,
+ static Xcls_WindowLeftTree _WindowLeftTree;
+
+ public class Xcls_WindowLeftTree : Object
+ {
+ public Gtk.Box el;
+ private Xcls_WindowLeftTree _this;
+
+ public static Xcls_WindowLeftTree singleton()
+ {
+ if (_WindowLeftTree == null) {
+ _WindowLeftTree= new Xcls_WindowLeftTree();
+ }
+ return _WindowLeftTree;
+ }
+ public Xcls_viewwin viewwin;
+ public Xcls_view view;
+ public Xcls_drop drop;
+ public Xcls_selmodel selmodel;
+ public Xcls_model model;
+ public Xcls_maincol maincol;
+ public Xcls_LeftTreeMenu LeftTreeMenu;
+
+ // my vars (def)
+ public signal bool before_node_change ();
+ public Xcls_MainWindow main_window;
+ public signal void changed ();
+ public signal void node_selected (JsRender.Node? node);
+
+ // ctor
+ public Xcls_WindowLeftTree()
+ {
+ _this = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+ this.main_window = null;
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ var child_1 = new Xcls_ListView2( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ new Xcls_viewwin( _this );
+ this.el.append( _this.viewwin.el );
+ }
+
+ // user defined functions
+ public void onresize () {
+
+
+ //GLib.debug("Got allocation width of scrolled view %d", allocation.width );
+ // _this.maincol.el.set_max_width( _this.viewwin.el.get_width() - 32 );
+ }
+ public JsRender.Node? getActiveElement () { // return path to actie node.
+
+
+ return _this.selmodel.getSelectedNode();
+
+
+ }
+ public JsRender.JsRender getActiveFile () {
+ return this.main_window.windowstate.file;
+ }
+ public class Xcls_ListView2 : Object
+ {
+ public Gtk.ListView el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_ListView2(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_SignalListItemFactory3( _this );
+ child_1.ref();
+ this.el = new Gtk.ListView( null, child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory3 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_SignalListItemFactory3(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_viewwin : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_viewwin(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ _this.viewwin = this;
+ this.el = new Gtk.ScrolledWindow();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.has_frame = true;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ new Xcls_view( _this );
+ this.el.child = _this.view.el;
+ new Xcls_LeftTreeMenu( _this );
+
+ // init method
+
+ this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+ }
+
+ // user defined functions
+ }
+ public class Xcls_view : Object
+ {
+ public Gtk.ColumnView el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+ public bool blockChanges;
+ public bool headers_visible;
+ public string lastEventSource;
+ public bool button_is_pressed;
+ public Gtk.CssProvider css;
+
+ // ctor
+ public Xcls_view(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ _this.view = this;
+ new Xcls_selmodel( _this );
+ this.el = new Gtk.ColumnView( _this.selmodel.el );
+
+ // my vars (dec)
+ this.blockChanges = false;
+ this.headers_visible = false;
+ this.lastEventSource = "";
+ this.button_is_pressed = false;
+
+ // set gobject values
+ this.el.name = "left-tree-view";
+ this.el.hexpand = false;
+ this.el.vexpand = true;
+ var child_2 = new Xcls_GestureClick6( _this );
+ child_2.ref();
+ this.el.add_controller( child_2.el );
+ var child_3 = new Xcls_GestureClick7( _this );
+ child_3.ref();
+ this.el.add_controller( child_3.el );
+ var child_4 = new Xcls_DragSource8( _this );
+ child_4.ref();
+ this.el.add_controller( child_4.el );
+ var child_5 = new Xcls_EventControllerKey9( _this );
+ child_5.ref();
+ this.el.add_controller( child_5.el );
+ new Xcls_drop( _this );
+ this.el.add_controller( _this.drop.el );
+ new Xcls_maincol( _this );
+ this.el.append_column ( _this.maincol.el );
+ var child_8 = new Xcls_ColumnViewColumn15( _this );
+ child_8.ref();
+ this.el.append_column ( child_8.el );
+
+ // init method
+
+ {
+
+ this.css = new Gtk.CssProvider();
+ // try {
+ this.css.load_from_string("
+ #left-tree-view { font-size: 12px;}
+ .drag-over { background-color:#88a3bc; }
+ .drag-below {
+ border-bottom-width: 5px;
+ border-bottom-style: solid;
+ border-bottom-color: #88a3bc;
+ }
+ .drag-above {
+ border-top-width: 5px;
+ border-top-style: solid;
+ border-top-color: #88a3bc;
+ }
+ #left-tree-view indent {
+ -gtk-icon-size : 2px;
+ }
+ ");
+
+ Gtk.StyleContext.add_provider_for_display(
+ this.el.get_display(),
+ this.css,
+ Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
+ );
+
+
+ }
+ }
+
+ // user defined functions
+ public Gtk.Widget? getWidgetAtRow (uint row) {
+ /*
+
+ from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
+ var colview = gesture.widget;
+ var line_no = check_list_widget(colview, x,y);
+ if (line_no > -1) {
+ var item = colview.model.get_item(line_no);
+
+ }
+ */
+ //GLib.debug("Get Widget At Row %d", (int)row);
+ var child = this.el.get_first_child();
+ var line_no = -1;
+ var reading_header = true;
+
+ while (child != null) {
+ GLib.debug("Got %s", child.get_type().name());
+
+ if (reading_header) {
+
+
+ if (child.get_type().name() != "GtkColumnListView") {
+
+ child = child.get_next_sibling();
+ continue;
+ }
+ // should be columnlistview
+ child = child.get_first_child();
+
+
+
+ reading_header = false;
+
+ }
+
+
+
+ line_no++;
+ if (line_no == row) {
+ //GLib.debug("Returning widget %s", child.get_type().name());
+ return (Gtk.Widget)child;
+ }
+ child = child.get_next_sibling();
+ }
+ //GLib.debug("Rturning null");
+ return null;
+
+ }
+ public int getColAt (double x, double y) {
+ /*
+
+ from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
+
+ */
+ //Gtk.Allocation alloc = { 0, 0, 0, 0 };
+ //GLib.debug("Cehck %d, %d", x,y);
+ var child = this.el.get_first_child();
+
+ var col = 0;
+ var offx = 0;
+ while (child != null) {
+
+ if (child.get_type().name() == "GtkColumnViewRowWidget") {
+ child = child.get_first_child();
+ continue;
+ }
+
+ //child.get_allocation(out alloc);
+ if (x < (child.get_width() + offx)) {
+ return col;
+ }
+ return 1;
+ //offx += child.get_width();
+ //col++;
+ //child = child.get_next_sibling();
+ }
+
+
+ return -1;
+
+ }
+ public int getRowAt (double x, double in_y, out string pos) {
+
+
+
+
+ /*
+
+ from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
+ var colview = gesture.widget;
+ var line_no = check_list_widget(colview, x,y);
+ if (line_no > -1) {
+ var item = colview.model.get_item(line_no);
+
+ }
+ */
+
+
+ //GLib.debug("offset = %d y = %d", (int) voff, (int) in_y);
+ var y = in_y + _this.viewwin.el.vadjustment.value;
+ var child = this.el.get_first_child();
+ //Gtk.Allocation alloc = { 0, 0, 0, 0 };
+ var line_no = -1;
+ var reading_header = true;
+ var real_y = 0;
+ var header_height = 0;
+ pos = "none";
+ var h = 0;
+ while (child != null) {
+ //GLib.debug("Got %s", child.get_type().name());
+ if (reading_header) {
+
+
+ if (child.get_type().name() != "GtkColumnListView") {
+ h += child.get_height();
+ child = child.get_next_sibling();
+ continue;
+ }
+ // should be columnlistview
+ child = child.get_first_child();
+ GLib.debug("header height=%d", h);
+ header_height = h;
+
+ reading_header = false;
+
+ }
+
+ if (child.get_type().name() != "GtkColumnViewRowWidget") {
+ child = child.get_next_sibling();
+ continue;
+ }
+
+ if (y < header_height) {
+ return -1;
+ }
+
+ line_no++;
+ var hh = child.get_height();
+ //child.get_allocation(out alloc);
+ //GLib.debug("got cell xy = %d,%d w,h= %d,%d", alloc.x, alloc.y, alloc.width, alloc.height);
+ //GLib.debug("row %d y= %d %s", line_no, (int) (header_height + alloc.y),
+
+ // child.visible ? "VIS" : "hidden");
+
+ if (y > (header_height + real_y) && y <= (header_height + real_y + hh) ) {
+ if (y > ( header_height + real_y + (hh * 0.8))) {
+ pos = "below";
+ } else if (y > ( header_height + real_y + (hh * 0.2))) {
+ pos = "over";
+ } else {
+ pos = "above";
+ }
+ GLib.debug("getRowAt return : %d, %s", line_no, pos);
+ return line_no;
+ }
+
+
+ if (real_y + hh > y) {
+ return -1;
+ }
+ real_y += hh;
+ child = child.get_next_sibling();
+ }
+ return -1;
+
+ }
+ public Gtk.Widget? getWidgetAt (double x, double in_y) {
+ /*
+
+ from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
+ var colview = gesture.widget;
+ var line_no = check_list_widget(colview, x,y);
+ if (line_no > -1) {
+ var item = colview.model.get_item(line_no);
+
+ }
+ */
+ var y = in_y + _this.viewwin.el.vadjustment.value;
+ var child = this.el.get_first_child();
+ //Gtk.Allocation alloc = { 0, 0, 0, 0 };
+ var line_no = -1;
+ var reading_header = true;
+ var curr_y = 0;
+ var header_height = 0;
+ var h = 0;
+ while (child != null) {
+ //GLib.debug("Got %s", child.get_type().name());
+ if (reading_header) {
+
+
+ if (child.get_type().name() != "GtkColumnListView") {
+ h += child.get_height();
+ child = child.get_next_sibling();
+ continue;
+ }
+ // should be columnlistview
+ child = child.get_first_child();
+ GLib.debug("header height=%d", h);
+ header_height = h;
+
+ reading_header = false;
+
+ }
+ line_no++;
+
+ if (y < header_height) {
+ return null;
+ }
+
+ var hh = child.get_height();
+ //GLib.debug("got cell xy = %d,%d w,h= %d,%d", alloc.x, alloc.y, alloc.width, alloc.height);
+
+ if (y > curr_y && y <= header_height + hh + curr_y ) {
+ return (Gtk.Widget)child;
+ }
+ curr_y += hh ;
+
+ if (curr_y > y) {
+ return null;
+ }
+ child = child.get_next_sibling();
+ }
+ return null;
+
+ }
+ }
+ public class Xcls_GestureClick6 : Object
+ {
+ public Gtk.GestureClick el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_GestureClick6(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.GestureClick();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.released.connect( (n_press, x, y) => {
+
+ _this.view.button_is_pressed = false;
+
+
+ });
+ this.el.pressed.connect( (n_press, x, y) => {
+
+ //console.log("button press?");
+
+ //this.el.set_state(Gtk.EventSequenceState.CLAIMED);
+
+
+
+ _this.view.button_is_pressed = true;
+
+ _this.view.lastEventSource = "tree";
+ if (! _this.before_node_change() ) {
+ GLib.debug("before_node_change return false");
+ return ;
+ }
+
+ // nothing there -show dialog
+ if (_this.model.el.get_n_items() < 1) {
+ _this.main_window.windowstate.showAddObject(_this.view.el, null);
+ GLib.debug("no items");
+ return ;
+ }
+ string pos;
+ var row = _this.view.getRowAt(x,y, out pos );
+ if (row < 0) {
+ GLib.debug("no row selected items");
+ return;
+ }
+
+ var node = _this.selmodel.getNodeAt(row);
+ if (node == null) {
+ GLib.warning("No node found at row %d", row);
+ return;
+ }
+
+
+
+ if (_this.view.getColAt(x,y) > 0 ) {
+ GLib.debug("add colum clicked.");
+ var fqn = node.fqn();
+ var cn = _this.main_window.windowstate.project.palete.getChildList(fqn, false);
+ if (cn.size < 1) {
+ return ;
+ }
+
+ _this.main_window.windowstate.leftTreeBeforeChange();
+ //_this.view.el.get_selection().select_path(res);
+ GLib.debug("Button Pressed - start show window");
+ _this.main_window.windowstate.showAddObject(_this.view.el, node);
+ GLib.debug("Button Pressed - finsihed show window");
+ return ;
+ }
+
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_GestureClick7 : Object
+ {
+ public Gtk.GestureClick el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_GestureClick7(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.GestureClick();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.button = 3;
+
+ //listeners
+ this.el.pressed.connect( (n_press, x, y) => {
+
+
+
+
+ if (_this.model.el.get_n_items() < 1) {
+
+ GLib.debug("no items");
+ return ;
+ }
+ string pos;
+ var row = _this.view.getRowAt(x,y, out pos );
+ if (row < 0) {
+ GLib.debug("no row selected items");
+ return;
+ }
+
+ var node = _this.selmodel.getNodeAt(row);
+ if (node == null) {
+ GLib.warning("No node found at row %d", row);
+ return;
+ }
+ _this.model.selectNode(node);
+
+
+
+ GLib.debug("Prssed %d", (int) this.el.get_current_button());
+ //_this.deletemenu.el.set_parent(_this.view.el);
+ _this.LeftTreeMenu.el.set_parent(_this.view.el);
+
+
+ //Gtk.Allocation rect;
+ //_this.view.el.get_allocation(out rect);
+ //_this.deletemenu.el.set_has_arrow(false);
+ _this.LeftTreeMenu.el.set_position(Gtk.PositionType.BOTTOM);
+
+
+ _this.LeftTreeMenu.el.set_offset(
+ (int)x ,
+ (int)y - (int)_this.view.el.get_height());
+
+ _this.LeftTreeMenu.el.popup();
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_DragSource8 : Object
+ {
+ public Gtk.DragSource el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_DragSource8(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.DragSource();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.actions = Gdk.DragAction.COPY | Gdk.DragAction.MOVE ;
+
+ //listeners
+ this.el.prepare.connect( (x, y) => {
+
+
+
+ /// ( drag_context, data, info, time) => {
+
+
+ //print("drag-data-get");
+ var ndata = _this.selmodel.getSelectedNode();
+ if (ndata == null) {
+ GLib.debug("return empty string - no selection..");
+ return null;
+
+ }
+
+
+ //data.set_text(tp,tp.length);
+
+ var str = ndata.toJsonString();
+ GLib.debug("prepare store: %s", str);
+ GLib.Value ov = GLib.Value(typeof(string));
+ ov.set_string(str);
+ var cont = new Gdk.ContentProvider.for_value(ov);
+ /*
+ GLib.Value v = GLib.Value(typeof(string));
+ //var str = drop.read_text( [ "text/plain" ] 0);
+
+ cont.get_value(ref v);
+
+ }
+ GLib.debug("set %s", v.get_string());
+ */
+ return cont;
+
+
+ });
+ this.el.drag_begin.connect( ( drag ) => {
+ GLib.debug("SOURCE: drag-begin");
+
+ // find what is selected in our tree...
+ var data = _this.selmodel.getSelectedNode();
+ if (data == null) {
+ return ;
+ }
+
+ var xname = data.fqn();
+ GLib.debug ("XNAME IS %s", xname);
+
+ var widget = _this.view.getWidgetAtRow(_this.selmodel.el.selected);
+
+
+ var paintable = new Gtk.WidgetPaintable(widget);
+ this.el.set_icon(paintable, 0,0);
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_EventControllerKey9 : Object
+ {
+ public Gtk.EventControllerKey el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_EventControllerKey9(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.EventControllerKey();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.key_pressed.connect( (keyval, keycode, state) => {
+
+
+
+ if (keyval != Gdk.Key.Delete && keyval != Gdk.Key.BackSpace) {
+ return true;
+ }
+
+ _this.model.deleteSelected();
+ return true;
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_drop : Object
+ {
+ public Gtk.DropTarget el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+ public Gtk.Widget? highlightWidget;
+ public JsRender.Node? lastDragNode;
+ public string lastDragString;
+
+ // ctor
+ public Xcls_drop(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ _this.drop = this;
+ this.el = new Gtk.DropTarget ( typeof(string) ,
Gdk.DragAction.COPY | Gdk.DragAction.MOVE );
- // my vars (dec)
- this.highlightWidget = null;
- this.lastDragNode = null;
- this.lastDragString = "";
-
- // set gobject values
-
- //listeners
- this.el.accept.connect( (drop) => {
-
- GLib.debug("got DropTarget:accept");
-
- // NOT REALLY NEEDED? = put stuff in drop?
-
-
- /* ( ctx, x, y, time) => {
- //Seed.print("TARGET: drag-drop");
-
-
- var src = Gtk.drag_get_source_widget(ctx);
-
- if (src != this.el) {
-
-
-
- this.drag_in_motion = false;
- // request data that will be recieved by the recieve...
- Gtk.drag_get_data
- (
- this.el, // will receive 'drag-data-received' signal
- ctx, // represents the current state of the DnD
- Gdk.Atom.intern("application/json",true), // the target type we want
- time // time stamp
- );
-
-
- // No target offered by source => error
-
-
- return false;
- }
-
- // handle drop around self..
-
-
-
- //print("GETTING POS");
- var targetData = "";
-
- Gtk.TreePath path;
- Gtk.TreeViewDropPosition pos;
- var isOver = _this.view.el.get_dest_row_at_pos(this.drag_x,this.drag_y, out path, out pos);
-
- // if there are not items in the tree.. the we have to set isOver to true for anything..
- var isEmpty = false;
- if (_this.model.el.iter_n_children(null) < 1) {
- print("got NO children?\n");
- isOver = true; //???
- isEmpty = true;
- pos = Gtk.TreeViewDropPosition.INTO_OR_AFTER;
- }
-
-
-
- //var action = Gdk.DragAction.COPY;
- // unless we are copying!!! ctl button..
-
- var action = (ctx.get_actions() & Gdk.DragAction.MOVE) > 0 ?
- Gdk.DragAction.COPY : Gdk.DragAction.MOVE ;
- // Gdk.DragAction.MOVE : Gdk.DragAction.COPY ;
-
-
- if (_this.model.el.iter_n_children(null) < 1) {
- // no children.. -- asume it's ok..
-
- targetData = "|%d|".printf((int)Gtk.TreeViewDropPosition.INTO_OR_AFTER);
-
- // continue through to allow drop...
-
- } else {
-
-
-
-
-
- //print("ISOVER? " + isOver);
- if (!isOver) {
-
- Gtk.drag_finish (ctx, false, false, time); // drop failed..
- return true; // not over apoint!?! - no action on drop or motion..
- }
-
- // drag node is parent of child..
- //console.log("SRC TREEPATH: " + src.treepath);
- //console.log("TARGET TREEPATH: " + data.path.to_string());
-
- // nned to check a few here..
- //Gtk.TreeViewDropPosition.INTO_OR_AFTER
- //Gtk.TreeViewDropPosition.INTO_OR_BEFORE
- //Gtk.TreeViewDropPosition.AFTER
- //Gtk.TreeViewDropPosition.BEFORE
-
- // locally dragged items to not really use the
- var selection_text = this.dragData;
-
-
-
- if (selection_text == null || selection_text.length < 1) {
- //print("Error - drag selection text returned NULL");
-
- Gtk.drag_finish (ctx, false, false, time); // drop failed..
- return true; /// -- fixme -- this is not really correct..
- }
-
- // see if we are dragging into ourself?
- print ("got selection text of " + selection_text);
-
- var target_path = path.to_string();
- //print("target_path="+target_path);
-
- //
- if (selection_text == target_path) {
- print("self drag ?? == we should perhaps allow copy onto self..\n");
-
- Gtk.drag_finish (ctx, false, false, time); // drop failed..
-
- return true; /// -- fixme -- this is not really correct..
-
- }
-
- // check that
- //print("DUMPING DATA");
- //console.dump(data);
- // path, pos
-
- //print(data.path.to_string() +' => '+ data.pos);
-
- // dropList is a list of xtypes that this node could be dropped on.
- // it is set up when we start to drag..
-
-
- targetData = _this.model.findDropNodeByPath( path.to_string(), this.dropList, pos);
-
- print("targetDAta: " + targetData +"\n");
-
- if (targetData.length < 1) {
- //print("Can not find drop node path");
-
- Gtk.drag_finish (ctx, false, false, time); // drop failed..
- return true;
- }
-
-
-
- // continue on to allow drop..
- }
- // at this point, drag is not in motion... -- as checked above... - so it's a real drop event..
-
-
- var delete_selection_data = false;
-
- if (action == Gdk.DragAction.ASK) {
- // Ask the user to move or copy, then set the ctx action.
- }
-
- if (action == Gdk.DragAction.MOVE) {
- delete_selection_data = true;
- }
-
- // drag around.. - reorder..
- _this.model.moveNode(targetData, action);
-
-
-
-
-
- // we can send stuff to souce here...
-
-
- // do we always say failure, so we handle the reall drop?
- Gtk.drag_finish (ctx, false, false,time); //delete_selection_data, time);
-
- return true;
-
-
-
-
-
-
- }
- */
- return true;
- });
- this.el.motion.connect( ( x, y) => {
-
- string pos; // over / before / after..
-
- GLib.debug("got drag motion");
-
- GLib.Value v = GLib.Value(typeof(string));
- //var str = drop.read_text( [ "text/plain" ] 0);
- var cont = this.el.current_drop.get_drag().content ;
- try {
- cont.get_value(ref v);
- } catch (GLib.Error e) {
- GLib.debug("failed to get drag value");
- return Gdk.DragAction.COPY;
-
- }
-
- GLib.debug("got %s", v.get_string());
-
- if (this.lastDragString != v.get_string() || this.lastDragNode == null) {
- // still dragging same node
-
- this.lastDragNode = new JsRender.Node();
- this.lastDragNode.loadFromJsonString(v.get_string(), 1);
- }
-
-
- var drop_on_to = _this.main_window.windowstate.file.palete().getDropList(
- this.lastDragNode.fqn());
-
- string[] str = {};
- foreach(var dp in drop_on_to) {
- str += dp;
- }
- GLib.debug("droplist: %s", string.joinv(", ", str));
-
-
- // if there are not items in the tree.. the we have to set isOver to true for anything..
-
- if (_this.model.el.n_items < 1) {
- // FIXME check valid drop types?
- if (drop_on_to.contains("*top")) {
- this.addHighlight(_this.view.el, "over");
- } else {
- this.addHighlight(null, "");
- }
-
- return Gdk.DragAction.COPY; // no need to highlight?
-
- }
-
-
- GLib.debug("check is over");
-
- // if path of source and dest are inside each other..
- // need to add source info to drag?
- // the fail();
- var row = _this.view.getRowAt(x,y, out pos);
-
- if (row < 0) {
- this.addHighlight(null, "");
- return Gdk.DragAction.COPY;
- }
- var tr = (Gtk.TreeListRow)_this.view.el.model.get_object(row);
-
- var node = (JsRender.Node)tr.get_item();
-
- GLib.debug("Drop over node: %s", node.fqn());
-
-
- if (pos == "above" || pos == "below") {
- if (node.parent == null) {
- GLib.debug("no parent try center");
- pos = "over";
- } else {
-
- if (!drop_on_to.contains(node.parent.fqn())) {
- GLib.debug("drop on does not contain %s - try center" , node.parent.fqn());
- pos = "over";
- } else {
- GLib.debug("drop contains %s - using %s" , node.parent.fqn(), pos);
- }
- }
-
- }
- if (pos == "over") {
- if (!drop_on_to.contains(node.fqn())) {
- GLib.debug("drop on does not contain %s - try center" , node.fqn());
- this.addHighlight(null, "");
- return Gdk.DragAction.COPY;
- }
- }
-
-
- // _this.view.highlightDropPath("", (Gtk.TreeViewDropPosition)0);
- var w = _this.view.getWidgetAt(x,y);
- this.addHighlight(w, pos);
- return Gdk.DragAction.COPY;
- });
- this.el.leave.connect( ( ) => {
- this.addHighlight(null,"");
-
- });
- this.el.drop.connect( (v, x, y) => {
-
- this.addHighlight(null,"");
-
-
-
- var pos = "";
- // -- get position..
- if (this.lastDragString != v.get_string() || this.lastDragNode == null) {
- // still dragging same node
-
- this.lastDragNode = new JsRender.Node();
- this.lastDragNode.loadFromJsonString(v.get_string(), 1);
- }
-
-
-
- var dropNode = new JsRender.Node();
- dropNode.loadFromJsonString(v.get_string(), 1);
- var drop_on_to = _this.main_window.windowstate.file.palete().getDropList(dropNode.fqn());
-
- // if there are not items in the tree.. the we have to set isOver to true for anything..
-
- if (_this.model.el.n_items < 1) {
- // FIXME check valid drop types?
- if (!drop_on_to.contains("*top")) {
- GLib.debug("drop on to list does not contain top?");
- return false;
- }
- // add new node to top..
-
-
- var m = (GLib.ListStore) _this.model.el.model;
- _this.main_window.windowstate.file.tree = dropNode;
-
-
- m.append(dropNode);
- _this.model.selectNode(dropNode);
- _this.changed();
- return true; // no need to highlight?
-
- }
-
-
-
- var row = _this.view.getRowAt(x,y, out pos);
- if (row < 0) {
- return false; //Gdk.DragAction.COPY;
- }
- var tr = (Gtk.TreeListRow)_this.view.el.model.get_object(row);
-
- var node = (JsRender.Node)tr.get_item();
-
- if (pos == "above" || pos == "below") {
- if (node.parent == null) {
- pos = "over";
- } else {
- if (!drop_on_to.contains(node.parent.fqn())) {
- pos = "over";
- } else {
- GLib.debug("drop contains %s - using %s" , node.parent.fqn(), pos);
- }
- }
-
- }
- if (pos == "over") {
- if (!drop_on_to.contains(node.fqn())) {
- GLib.debug("drop on does not contain %s - try center" , node.fqn());
- return false;
-
- }
- }
-
- switch(pos) {
- case "over":
- node.appendChild(dropNode);
- _this.model.selectNode(dropNode);
- _this.changed();
- return true;
-
- case "above":
- GLib.debug("Above - insertBefore");
-
- node.parent.insertBefore(dropNode, node);
- _this.model.selectNode(dropNode);
- _this.changed();
- return true;
-
- case "below":
- GLib.debug("Below - insertAfter");
- node.parent.insertAfter(dropNode, node);
- _this.model.selectNode(dropNode);
- _this.changed();
- // select it
- return true;
-
- default:
- // should not happen
- return false;
- }
-
-
-
-
-
-
- });
- }
-
- // user defined functions
- public void addHighlight (Gtk.Widget? w, string hl) {
- if (this.highlightWidget != null) {
- var ww = this.highlightWidget;
- GLib.debug("clear drag from previous highlight");
- if (ww.has_css_class("drag-below")) {
- ww.remove_css_class("drag-below");
- }
- if (ww.has_css_class("drag-above")) {
- ww.remove_css_class("drag-above");
- }
- if (ww.has_css_class("drag-over")) {
- ww.remove_css_class("drag-over");
- }
- }
- if (w != null) {
- GLib.debug("add drag=%s to widget", hl);
- if (!w.has_css_class("drag-" + hl)) {
- w.add_css_class("drag-" + hl);
- }
- }
- this.highlightWidget = w;
- }
- }
-
- public class Xcls_selmodel : Object
- {
- public Gtk.SingleSelection el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_selmodel(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- _this.selmodel = this;
- new Xcls_model( _this );
- this.el = new Gtk.SingleSelection( _this.model.el );
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.selection_changed.connect( (position, n_items) => {
-
-
-
- //if (!this.button_is_pressed && !this.key_is_pressed) {
- // then event was started by some other action
- // which should manually trigger all the events..
- // print("SKIPPING select - no button or key pressed\n");
- // return;
- //}
-
-
- if (_this.view.blockChanges) { // probably not needed..
- GLib.debug("SKIPPING select - blockchanges set..");
- return ;
- }
-
- if (!_this.before_node_change( ) ) {
- _this.view.blockChanges = true;
- _this.selmodel.el.unselect_all();
- _this.view.blockChanges = false;
-
- return;
- }
- if (_this.main_window.windowstate.file == null) {
- GLib.debug("SKIPPING select windowstate file is not set...");
- return;
- }
-
- //var render = this.get('/LeftTree').getRenderer();
- GLib.debug("LEFT TREE -> view -> selection changed called");
-
-
- // -- it appears that the selection is not updated.
- // select the node...
- //_this.selmodel.el.set_selected(row);
-
- GLib.debug("LEFT TREE -> view -> selection changed TIMEOUT CALLED");
-
- var snode = _this.selmodel.getSelectedNode();
- if (snode == null) {
-
- GLib.debug("selected rows < 1");
- //??this.model.load( false);
- _this.node_selected(null);
-
- return ;
- }
-
- // why dup_?
-
-
- GLib.debug ("calling left_tree.node_selected");
- _this.node_selected(snode);
-
-
-
-
- // no need to scroll. it's in the view as we clicked on it.
- // _this.view.el.scroll_to_cell(new Gtk.TreePath.from_string(_this.model.activePath), null, true, 0.1f,0.0f);
-
- return ;
- });
- }
-
- // user defined functions
- public JsRender.Node? getSelectedNode () {
- if (this.el.selected_item == null) {
- return null;
- }
- var tr = (Gtk.TreeListRow)this.el.selected_item;
- return (JsRender.Node)tr.get_item();
-
- }
- public JsRender.Node getNodeAt (uint row) {
-
- var tr = (Gtk.TreeListRow)this.el.get_item(row);
-
- var a = tr.get_item();;
- GLib.debug("get_item (2) = %s", a.get_type().name());
-
-
- return (JsRender.Node)tr.get_item();
-
- }
- }
- public class Xcls_model : Object
- {
- public Gtk.TreeListModel el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_model(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- _this.model = this;
- this.el = this.updateModel(null);
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- public void loadFile (JsRender.JsRender f) {
- //console.dump(f);
-
- _this.drop.highlightWidget = null;
-
- var m = (GLib.ListStore) this.el.model;
- m.remove_all();
- _this.main_window.windowstate.leftTreeNodeSelected(null);
- // needed???
- _this.main_window.windowstate.file = f;
-
-
- if (f.tree == null) {
- try {
- f.loadItems( );
- } catch (Error e) {
- return;
- }
- }
- // if it's still null?
- if (f.tree == null) {
- _this.main_window.windowstate.showAddObject(_this.view.el, null);
-
- return;
- }
- m.append(f.tree);
- // expand???
-
- /*
- if (f.tree.readItems().size < 1) {
- // single item..
-
- //this.get('/Window.leftvpaned').el.set_position(80);
- // select first...
- _this.view.el.set_cursor(
- new Gtk.TreePath.from_string("0"), null, false);
-
-
- } else {
- //this.get('/Window.leftvpaned').el.set_position(200);
- }
- */
-
-
-
- //_this.maincol.el.set_max_width(_this.viewwin.el.get_allocated_width() - 32);
-
- _this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);
-
- return;
-
-
- }
- public void deleteSelected () {
-
-
-
- var node = _this.selmodel.getSelectedNode();
-
-
- if (node == null) {
- GLib.debug("delete Selected - no node slected?");
- return;
- }
- _this.selmodel.el.unselect_all();
-
- node.remove();
- GLib.debug("delete Selected - done");
- _this.changed();
- /*
- print("DELETE SELECTED?");
- //_this.view.blockChanges = true;
- print("GET SELECTION?");
-
- var s = _this.view.el.get_selection();
-
- print("GET SELECTED?");
- Gtk.TreeIter iter;
- Gtk.TreeModel mod;
-
-
- if (!s.get_selected(out mod, out iter)) {
- return; // nothing seleted..
- }
-
-
-
- this.activePath= "";
- print("GET vnode value?");
-
- GLib.Value value;
- this.el.get_value(iter, 2, out value);
- var data = (JsRender.Node)(value.get_object());
- print("removing node from Render\n");
- if (data.parent == null) {
- _this.main_window.windowstate.file.tree = null;
- } else {
- data.remove();
- }
- print("removing node from Tree\n");
- s.unselect_all();
- this.el.remove(ref iter);
-
-
-
-
- //
-
-
-
-
- this.activePath= ""; // again!?!?
- //this.changed(null,true);
-
- _this.changed();
-
- _this.view.blockChanges = false;
- */
- }
- public Gtk.TreeListModel updateModel (GLib.ListStore? m) {
- this.el = new Gtk.TreeListModel(
- m != null ? m : new GLib.ListStore(typeof(JsRender.Node)), //..... << that's our store..
- false, // passthru
- true, // autexpand
- (item) => {
- return ((JsRender.Node)item).childstore;
-
- }
- );
- if (_this.selmodel.el == null) {
- return this.el;
- }
- _this.selmodel.el.set_model(this.el);
- return this.el;
- }
- public void selectNode (JsRender.Node node)
- {
- var row = -1;
- var s = (Gtk.SingleSelection)_this.view.el.model;
- for (var i = 0; i < s.n_items; i++) {
- //GLib.debug("check node %s", s.get_item(i).get_type().name());
- var lr = (Gtk.TreeListRow)s.get_item(i);
- GLib.debug("check node %s", lr.get_item().get_type().name());
- if (((JsRender.Node)lr.get_item()).oid == node.oid) {
- row = i;
- break;
- }
- }
- if (row < 0) {
- // select none?
- GLib.debug("Could not find node");
- return;
- }
- GLib.debug("Select %d", row);
- s.set_selected(row);
- _this.view.el.scroll_to(row, null, Gtk.ListScrollFlags.SELECT, null);
- //_this.node_selected(node);
-
-
- }
- }
-
-
- public class Xcls_maincol : Object
- {
- public Gtk.ColumnViewColumn el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_maincol(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- _this.maincol = this;
- var child_1 = new Xcls_SignalListItemFactory14( _this );
- child_1.ref();
- this.el = new Gtk.ColumnViewColumn( "Property", child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.id = "maincol";
- this.el.expand = true;
- this.el.resizable = true;
- }
-
- // user defined functions
- }
- public class Xcls_SignalListItemFactory14 : Object
- {
- public Gtk.SignalListItemFactory el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SignalListItemFactory14(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- this.el = new Gtk.SignalListItemFactory();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.setup.connect( (listitem) => {
-
- var expand = new Gtk.TreeExpander();
-
- expand.set_indent_for_depth(true);
- expand.set_indent_for_icon(true);
- var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);
- var icon = new Gtk.Image();
- var lbl = new Gtk.Label("");
- lbl.use_markup = true;
- lbl.ellipsize = Pango.EllipsizeMode.END;
-
- icon.margin_end = 4;
- lbl.justify = Gtk.Justification.LEFT;
- lbl.xalign = 0;
-
- // listitem.activatable = true; ??
-
- hbox.append(icon);
- hbox.append(lbl);
- expand.set_child(hbox);
- ((Gtk.ListItem)listitem).set_child(expand);
-
- });
- this.el.bind.connect( (listitem) => {
- GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
-
- //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
- var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
-
-
- var hbox = (Gtk.Box) expand.child;
-
-
- var img = (Gtk.Image) hbox.get_first_child();
- var lbl = (Gtk.Label) img.get_next_sibling();
-
- var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
- var node = (JsRender.Node) lr.get_item();
-
- GLib.debug("node is %s", node.get_type().name());
- // was item (1) in old layout
-
-
-
- /*
- var ic = Gtk.IconTheme.get_for_display(_this.el.get_display());
- var clsname = node.fqn();
-
- var clsb = clsname.split(".");
- var sub = clsb.length > 1 ? clsb[1].down() : "";
-
- var fn = "/usr/share/glade/pixmaps/hicolor/16x16/actions/widget-gtk-" + sub + ".png";
- try {
-
-
- if (FileUtils.test (fn, FileTest.IS_REGULAR)) {
- img.set_from_file(fn);
-
- } else {
- img.set_from_paintable(
- ic.lookup_icon (
- "media-playback-stop", null, 16,1,
- Gtk.TextDirection.NONE, 0
- )
- );
- }
- } catch (GLib.Error e) {}
- */
- expand.set_hide_expander( !node.hasChildren() );
- expand.set_list_row(lr);
-
- node.bind_property("iconFilename",
- img, "file",
- GLib.BindingFlags.SYNC_CREATE);
-
- node.bind_property("nodeTitleProp",
- lbl, "label",
- GLib.BindingFlags.SYNC_CREATE);
- node.bind_property("nodeTipProp",
- lbl, "tooltip_markup",
- GLib.BindingFlags.SYNC_CREATE);
- // bind image...
-
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_ColumnViewColumn15 : Object
- {
- public Gtk.ColumnViewColumn el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ColumnViewColumn15(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- var child_1 = new Xcls_SignalListItemFactory16( _this );
- child_1.ref();
- this.el = new Gtk.ColumnViewColumn( "Add", child_1.el );
-
- // my vars (dec)
-
- // set gobject values
- this.el.fixed_width = 25;
- }
-
- // user defined functions
- }
- public class Xcls_SignalListItemFactory16 : Object
- {
- public Gtk.SignalListItemFactory el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SignalListItemFactory16(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- this.el = new Gtk.SignalListItemFactory();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.setup.connect( (listitem) => {
-
-
- var icon = new Gtk.Image();
-
- ((Gtk.ListItem)listitem).set_child(icon);
- });
- this.el.bind.connect( (listitem) => {
-
- var img = (Gtk.Image) ((Gtk.ListItem)listitem).get_child();
- var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
- var node = (JsRender.Node) lr.get_item();
-
-
- var ic = Gtk.IconTheme.get_for_display(_this.el.get_display());
- img.set_from_paintable(
- ic.lookup_icon (
- "list-add", null, 16,1,
- Gtk.TextDirection.NONE, 0
- )
- );
-
- var fqn = node.fqn();
- var cn = _this.main_window.windowstate.project.palete.getChildList(fqn, false);
-
- img.set_visible(cn.size > 0 ? true : false);
-
- });
- }
-
- // user defined functions
- }
-
-
-
- public class Xcls_LeftTreeMenu : Object
- {
- public Gtk.Popover el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_LeftTreeMenu(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- _this.LeftTreeMenu = this;
- this.el = new Gtk.Popover();
-
- // my vars (dec)
-
- // set gobject values
- var child_1 = new Xcls_Box18( _this );
- this.el.child = child_1.el;
- }
-
- // user defined functions
- }
- public class Xcls_Box18 : Object
- {
- public Gtk.Box el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box18(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- var child_1 = new Xcls_Button19( _this );
- child_1.ref();
- this.el.append( child_1.el );
- var child_2 = new Xcls_Button20( _this );
- child_2.ref();
- this.el.append( child_2.el );
- var child_3 = new Xcls_Button21( _this );
- child_3.ref();
- this.el.append( child_3.el );
- }
-
- // user defined functions
- }
- public class Xcls_Button19 : Object
- {
- public Gtk.Button el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button19(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Delete Element";
-
- //listeners
- this.el.clicked.connect( ( ) => {
- _this.LeftTreeMenu.el.hide();
- _this.model.deleteSelected();
- _this.changed();
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Button20 : Object
- {
- public Gtk.Button el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button20(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Save as Template";
-
- //listeners
- this.el.clicked.connect( () => {
- _this.LeftTreeMenu.el.hide();
- DialogSaveTemplate.singleton().showIt(
- (Gtk.Window) _this.el.get_root (),
- _this.main_window.windowstate.file.palete(),
- _this.getActiveElement()
- );
-
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Button21 : Object
- {
- public Gtk.Button el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button21(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Save as Module";
-
- //listeners
- this.el.clicked.connect( () => {
-
- _this.LeftTreeMenu.el.hide();
- var node = _this.getActiveElement();
-
-
- var sm = DialogSaveModule.singleton();
-
-
- sm.showIt(
- (Gtk.Window) _this.el.get_root (),
- _this.main_window.windowstate.project,
- node
- );
- /*
- gtk4 migration - disabled this part.. probably not used muchanyway
-
-
- if (name.length < 1) {
- return;
-
- }
- node.set_prop( new JsRender.NodeProp.special("xinclude", name));
- node.items.clear();
-
-
- var s = _this.view.el.get_selection();
-
- print("GET SELECTED?");
- Gtk.TreeIter iter;
- Gtk.TreeModel mod;
-
-
- if (!s.get_selected(out mod, out iter)) {
- return; // nothing seleted..
- }
- Gtk.TreeIter citer;
- var n_cn = mod.iter_n_children(iter) -1;
- for (var i = n_cn; i > -1; i--) {
- mod.iter_nth_child(out citer, iter, i);
-
-
- print("removing node from Tree\n");
-
- _this.model.el.remove(ref citer);
- }
- _this.changed();
- _this.node_selected(node, "tree");
- */
-
- });
- }
-
- // user defined functions
- }
-
-
-
-
-}
+ // my vars (dec)
+ this.highlightWidget = null;
+ this.lastDragNode = null;
+ this.lastDragString = "";
+
+ // set gobject values
+
+ //listeners
+ this.el.accept.connect( (drop) => {
+
+ GLib.debug("got DropTarget:accept");
+
+ // NOT REALLY NEEDED? = put stuff in drop?
+
+
+ /* ( ctx, x, y, time) => {
+ //Seed.print("TARGET: drag-drop");
+
+
+ var src = Gtk.drag_get_source_widget(ctx);
+
+ if (src != this.el) {
+
+
+
+ this.drag_in_motion = false;
+ // request data that will be recieved by the recieve...
+ Gtk.drag_get_data
+ (
+ this.el, // will receive 'drag-data-received' signal
+ ctx, // represents the current state of the DnD
+ Gdk.Atom.intern("application/json",true), // the target type we want
+ time // time stamp
+ );
+
+
+ // No target offered by source => error
+
+
+ return false;
+ }
+
+ // handle drop around self..
+
+
+
+ //print("GETTING POS");
+ var targetData = "";
+
+ Gtk.TreePath path;
+ Gtk.TreeViewDropPosition pos;
+ var isOver = _this.view.el.get_dest_row_at_pos(this.drag_x,this.drag_y, out path, out pos);
+
+ // if there are not items in the tree.. the we have to set isOver to true for anything..
+ var isEmpty = false;
+ if (_this.model.el.iter_n_children(null) < 1) {
+ print("got NO children?\n");
+ isOver = true; //???
+ isEmpty = true;
+ pos = Gtk.TreeViewDropPosition.INTO_OR_AFTER;
+ }
+
+
+
+ //var action = Gdk.DragAction.COPY;
+ // unless we are copying!!! ctl button..
+
+ var action = (ctx.get_actions() & Gdk.DragAction.MOVE) > 0 ?
+ Gdk.DragAction.COPY : Gdk.DragAction.MOVE ;
+ // Gdk.DragAction.MOVE : Gdk.DragAction.COPY ;
+
+
+ if (_this.model.el.iter_n_children(null) < 1) {
+ // no children.. -- asume it's ok..
+
+ targetData = "|%d|".printf((int)Gtk.TreeViewDropPosition.INTO_OR_AFTER);
+
+ // continue through to allow drop...
+
+ } else {
+
+
+
+
+
+ //print("ISOVER? " + isOver);
+ if (!isOver) {
+
+ Gtk.drag_finish (ctx, false, false, time); // drop failed..
+ return true; // not over apoint!?! - no action on drop or motion..
+ }
+
+ // drag node is parent of child..
+ //console.log("SRC TREEPATH: " + src.treepath);
+ //console.log("TARGET TREEPATH: " + data.path.to_string());
+
+ // nned to check a few here..
+ //Gtk.TreeViewDropPosition.INTO_OR_AFTER
+ //Gtk.TreeViewDropPosition.INTO_OR_BEFORE
+ //Gtk.TreeViewDropPosition.AFTER
+ //Gtk.TreeViewDropPosition.BEFORE
+
+ // locally dragged items to not really use the
+ var selection_text = this.dragData;
+
+
+
+ if (selection_text == null || selection_text.length < 1) {
+ //print("Error - drag selection text returned NULL");
+
+ Gtk.drag_finish (ctx, false, false, time); // drop failed..
+ return true; /// -- fixme -- this is not really correct..
+ }
+
+ // see if we are dragging into ourself?
+ print ("got selection text of " + selection_text);
+
+ var target_path = path.to_string();
+ //print("target_path="+target_path);
+
+ //
+ if (selection_text == target_path) {
+ print("self drag ?? == we should perhaps allow copy onto self..\n");
+
+ Gtk.drag_finish (ctx, false, false, time); // drop failed..
+
+ return true; /// -- fixme -- this is not really correct..
+
+ }
+
+ // check that
+ //print("DUMPING DATA");
+ //console.dump(data);
+ // path, pos
+
+ //print(data.path.to_string() +' => '+ data.pos);
+
+ // dropList is a list of xtypes that this node could be dropped on.
+ // it is set up when we start to drag..
+
+
+ targetData = _this.model.findDropNodeByPath( path.to_string(), this.dropList, pos);
+
+ print("targetDAta: " + targetData +"\n");
+
+ if (targetData.length < 1) {
+ //print("Can not find drop node path");
+
+ Gtk.drag_finish (ctx, false, false, time); // drop failed..
+ return true;
+ }
+
+
+
+ // continue on to allow drop..
+ }
+ // at this point, drag is not in motion... -- as checked above... - so it's a real drop event..
+
+
+ var delete_selection_data = false;
+
+ if (action == Gdk.DragAction.ASK) {
+ // Ask the user to move or copy, then set the ctx action.
+ }
+
+ if (action == Gdk.DragAction.MOVE) {
+ delete_selection_data = true;
+ }
+
+ // drag around.. - reorder..
+ _this.model.moveNode(targetData, action);
+
+
+
+
+
+ // we can send stuff to souce here...
+
+
+ // do we always say failure, so we handle the reall drop?
+ Gtk.drag_finish (ctx, false, false,time); //delete_selection_data, time);
+
+ return true;
+
+
+
+
+
+
+ }
+ */
+ return true;
+ });
+ this.el.motion.connect( ( x, y) => {
+
+ string pos; // over / before / after..
+
+ GLib.debug("got drag motion");
+
+ GLib.Value v = GLib.Value(typeof(string));
+ //var str = drop.read_text( [ "text/plain" ] 0);
+ var cont = this.el.current_drop.get_drag().content ;
+ try {
+ cont.get_value(ref v);
+ } catch (GLib.Error e) {
+ GLib.debug("failed to get drag value");
+ return Gdk.DragAction.COPY;
+
+ }
+
+ GLib.debug("got %s", v.get_string());
+
+ if (this.lastDragString != v.get_string() || this.lastDragNode == null) {
+ // still dragging same node
+
+ this.lastDragNode = new JsRender.Node();
+ this.lastDragNode.loadFromJsonString(v.get_string(), 1);
+ }
+
+
+ var drop_on_to = _this.main_window.windowstate.file.palete().getDropList(
+ this.lastDragNode.fqn());
+
+ string[] str = {};
+ foreach(var dp in drop_on_to) {
+ str += dp;
+ }
+ GLib.debug("droplist: %s", string.joinv(", ", str));
+
+
+ // if there are not items in the tree.. the we have to set isOver to true for anything..
+
+ if (_this.model.el.n_items < 1) {
+ // FIXME check valid drop types?
+ if (drop_on_to.contains("*top")) {
+ this.addHighlight(_this.view.el, "over");
+ } else {
+ this.addHighlight(null, "");
+ }
+
+ return Gdk.DragAction.COPY; // no need to highlight?
+
+ }
+
+
+ GLib.debug("check is over");
+
+ // if path of source and dest are inside each other..
+ // need to add source info to drag?
+ // the fail();
+ var row = _this.view.getRowAt(x,y, out pos);
+
+ if (row < 0) {
+ this.addHighlight(null, "");
+ return Gdk.DragAction.COPY;
+ }
+ var tr = (Gtk.TreeListRow)_this.view.el.model.get_object(row);
+
+ var node = (JsRender.Node)tr.get_item();
+
+ GLib.debug("Drop over node: %s", node.fqn());
+
+
+ if (pos == "above" || pos == "below") {
+ if (node.parent == null) {
+ GLib.debug("no parent try center");
+ pos = "over";
+ } else {
+
+ if (!drop_on_to.contains(node.parent.fqn())) {
+ GLib.debug("drop on does not contain %s - try center" , node.parent.fqn());
+ pos = "over";
+ } else {
+ GLib.debug("drop contains %s - using %s" , node.parent.fqn(), pos);
+ }
+ }
+
+ }
+ if (pos == "over") {
+ if (!drop_on_to.contains(node.fqn())) {
+ GLib.debug("drop on does not contain %s - try center" , node.fqn());
+ this.addHighlight(null, "");
+ return Gdk.DragAction.COPY;
+ }
+ }
+
+
+ // _this.view.highlightDropPath("", (Gtk.TreeViewDropPosition)0);
+ var w = _this.view.getWidgetAt(x,y);
+ this.addHighlight(w, pos);
+ return Gdk.DragAction.COPY;
+ });
+ this.el.leave.connect( ( ) => {
+ this.addHighlight(null,"");
+
+ });
+ this.el.drop.connect( (v, x, y) => {
+
+ this.addHighlight(null,"");
+
+
+
+ var pos = "";
+ // -- get position..
+ if (this.lastDragString != v.get_string() || this.lastDragNode == null) {
+ // still dragging same node
+
+ this.lastDragNode = new JsRender.Node();
+ this.lastDragNode.loadFromJsonString(v.get_string(), 1);
+ }
+
+
+
+ var dropNode = new JsRender.Node();
+ dropNode.loadFromJsonString(v.get_string(), 1);
+ var drop_on_to = _this.main_window.windowstate.file.palete().getDropList(dropNode.fqn());
+
+ // if there are not items in the tree.. the we have to set isOver to true for anything..
+
+ if (_this.model.el.n_items < 1) {
+ // FIXME check valid drop types?
+ if (!drop_on_to.contains("*top")) {
+ GLib.debug("drop on to list does not contain top?");
+ return false;
+ }
+ // add new node to top..
+
+
+ var m = (GLib.ListStore) _this.model.el.model;
+ _this.main_window.windowstate.file.tree = dropNode;
+
+
+ m.append(dropNode);
+ _this.model.selectNode(dropNode);
+ _this.changed();
+ return true; // no need to highlight?
+
+ }
+
+
+
+ var row = _this.view.getRowAt(x,y, out pos);
+ if (row < 0) {
+ return false; //Gdk.DragAction.COPY;
+ }
+ var tr = (Gtk.TreeListRow)_this.view.el.model.get_object(row);
+
+ var node = (JsRender.Node)tr.get_item();
+
+ if (pos == "above" || pos == "below") {
+ if (node.parent == null) {
+ pos = "over";
+ } else {
+ if (!drop_on_to.contains(node.parent.fqn())) {
+ pos = "over";
+ } else {
+ GLib.debug("drop contains %s - using %s" , node.parent.fqn(), pos);
+ }
+ }
+
+ }
+ if (pos == "over") {
+ if (!drop_on_to.contains(node.fqn())) {
+ GLib.debug("drop on does not contain %s - try center" , node.fqn());
+ return false;
+
+ }
+ }
+
+ switch(pos) {
+ case "over":
+ node.appendChild(dropNode);
+ _this.model.selectNode(dropNode);
+ _this.changed();
+ return true;
+
+ case "above":
+ GLib.debug("Above - insertBefore");
+
+ node.parent.insertBefore(dropNode, node);
+ _this.model.selectNode(dropNode);
+ _this.changed();
+ return true;
+
+ case "below":
+ GLib.debug("Below - insertAfter");
+ node.parent.insertAfter(dropNode, node);
+ _this.model.selectNode(dropNode);
+ _this.changed();
+ // select it
+ return true;
+
+ default:
+ // should not happen
+ return false;
+ }
+
+
+
+
+
+
+ });
+ }
+
+ // user defined functions
+ public void addHighlight (Gtk.Widget? w, string hl) {
+ if (this.highlightWidget != null) {
+ var ww = this.highlightWidget;
+ GLib.debug("clear drag from previous highlight");
+ if (ww.has_css_class("drag-below")) {
+ ww.remove_css_class("drag-below");
+ }
+ if (ww.has_css_class("drag-above")) {
+ ww.remove_css_class("drag-above");
+ }
+ if (ww.has_css_class("drag-over")) {
+ ww.remove_css_class("drag-over");
+ }
+ }
+ if (w != null) {
+ GLib.debug("add drag=%s to widget", hl);
+ if (!w.has_css_class("drag-" + hl)) {
+ w.add_css_class("drag-" + hl);
+ }
+ }
+ this.highlightWidget = w;
+ }
+ }
+
+ public class Xcls_selmodel : Object
+ {
+ public Gtk.SingleSelection el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_selmodel(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ _this.selmodel = this;
+ new Xcls_model( _this );
+ this.el = new Gtk.SingleSelection( _this.model.el );
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.selection_changed.connect( (position, n_items) => {
+
+
+
+ //if (!this.button_is_pressed && !this.key_is_pressed) {
+ // then event was started by some other action
+ // which should manually trigger all the events..
+ // print("SKIPPING select - no button or key pressed\n");
+ // return;
+ //}
+
+
+ if (_this.view.blockChanges) { // probably not needed..
+ GLib.debug("SKIPPING select - blockchanges set..");
+ return ;
+ }
+
+ if (!_this.before_node_change( ) ) {
+ _this.view.blockChanges = true;
+ _this.selmodel.el.unselect_all();
+ _this.view.blockChanges = false;
+
+ return;
+ }
+ if (_this.main_window.windowstate.file == null) {
+ GLib.debug("SKIPPING select windowstate file is not set...");
+ return;
+ }
+
+ //var render = this.get('/LeftTree').getRenderer();
+ GLib.debug("LEFT TREE -> view -> selection changed called");
+
+
+ // -- it appears that the selection is not updated.
+ // select the node...
+ //_this.selmodel.el.set_selected(row);
+
+ GLib.debug("LEFT TREE -> view -> selection changed TIMEOUT CALLED");
+
+ var snode = _this.selmodel.getSelectedNode();
+ if (snode == null) {
+
+ GLib.debug("selected rows < 1");
+ //??this.model.load( false);
+ _this.node_selected(null);
+
+ return ;
+ }
+
+ // why dup_?
+
+
+ GLib.debug ("calling left_tree.node_selected");
+ _this.node_selected(snode);
+
+
+
+
+ // no need to scroll. it's in the view as we clicked on it.
+ // _this.view.el.scroll_to_cell(new Gtk.TreePath.from_string(_this.model.activePath), null, true, 0.1f,0.0f);
+
+ return ;
+ });
+ }
+
+ // user defined functions
+ public JsRender.Node? getSelectedNode () {
+ if (this.el.selected_item == null) {
+ return null;
+ }
+ var tr = (Gtk.TreeListRow)this.el.selected_item;
+ return (JsRender.Node)tr.get_item();
+
+ }
+ public JsRender.Node getNodeAt (uint row) {
+
+ var tr = (Gtk.TreeListRow)this.el.get_item(row);
+
+ var a = tr.get_item();;
+ GLib.debug("get_item (2) = %s", a.get_type().name());
+
+
+ return (JsRender.Node)tr.get_item();
+
+ }
+ }
+ public class Xcls_model : Object
+ {
+ public Gtk.TreeListModel el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_model(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ _this.model = this;
+ this.el = this.updateModel(null);
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ public void loadFile (JsRender.JsRender f) {
+ //console.dump(f);
+
+ _this.drop.highlightWidget = null;
+
+ var m = (GLib.ListStore) this.el.model;
+ m.remove_all();
+ _this.main_window.windowstate.leftTreeNodeSelected(null);
+ // needed???
+ _this.main_window.windowstate.file = f;
+
+
+ if (f.tree == null) {
+ try {
+ f.loadItems( );
+ } catch (Error e) {
+ return;
+ }
+ }
+ // if it's still null?
+ if (f.tree == null) {
+ _this.main_window.windowstate.showAddObject(_this.view.el, null);
+
+ return;
+ }
+ m.append(f.tree);
+ // expand???
+
+ /*
+ if (f.tree.readItems().size < 1) {
+ // single item..
+
+ //this.get('/Window.leftvpaned').el.set_position(80);
+ // select first...
+ _this.view.el.set_cursor(
+ new Gtk.TreePath.from_string("0"), null, false);
+
+
+ } else {
+ //this.get('/Window.leftvpaned').el.set_position(200);
+ }
+ */
+
+
+
+ //_this.maincol.el.set_max_width(_this.viewwin.el.get_allocated_width() - 32);
+
+ _this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);
+
+ return;
+
+
+ }
+ public void deleteSelected () {
+
+
+
+ var node = _this.selmodel.getSelectedNode();
+
+
+ if (node == null) {
+ GLib.debug("delete Selected - no node slected?");
+ return;
+ }
+ _this.selmodel.el.unselect_all();
+
+ node.remove();
+ GLib.debug("delete Selected - done");
+ _this.changed();
+ /*
+ print("DELETE SELECTED?");
+ //_this.view.blockChanges = true;
+ print("GET SELECTION?");
+
+ var s = _this.view.el.get_selection();
+
+ print("GET SELECTED?");
+ Gtk.TreeIter iter;
+ Gtk.TreeModel mod;
+
+
+ if (!s.get_selected(out mod, out iter)) {
+ return; // nothing seleted..
+ }
+
+
+
+ this.activePath= "";
+ print("GET vnode value?");
+
+ GLib.Value value;
+ this.el.get_value(iter, 2, out value);
+ var data = (JsRender.Node)(value.get_object());
+ print("removing node from Render\n");
+ if (data.parent == null) {
+ _this.main_window.windowstate.file.tree = null;
+ } else {
+ data.remove();
+ }
+ print("removing node from Tree\n");
+ s.unselect_all();
+ this.el.remove(ref iter);
+
+
+
+
+ //
+
+
+
+
+ this.activePath= ""; // again!?!?
+ //this.changed(null,true);
+
+ _this.changed();
+
+ _this.view.blockChanges = false;
+ */
+ }
+ public Gtk.TreeListModel updateModel (GLib.ListStore? m) {
+ this.el = new Gtk.TreeListModel(
+ m != null ? m : new GLib.ListStore(typeof(JsRender.Node)), //..... << that's our store..
+ false, // passthru
+ true, // autexpand
+ (item) => {
+ return ((JsRender.Node)item).childstore;
+
+ }
+ );
+ if (_this.selmodel.el == null) {
+ return this.el;
+ }
+ _this.selmodel.el.set_model(this.el);
+ return this.el;
+ }
+ public void selectNode (JsRender.Node node)
+ {
+ var row = -1;
+ var s = (Gtk.SingleSelection)_this.view.el.model;
+ for (var i = 0; i < s.n_items; i++) {
+ //GLib.debug("check node %s", s.get_item(i).get_type().name());
+ var lr = (Gtk.TreeListRow)s.get_item(i);
+ GLib.debug("check node %s", lr.get_item().get_type().name());
+ if (((JsRender.Node)lr.get_item()).oid == node.oid) {
+ row = i;
+ break;
+ }
+ }
+ if (row < 0) {
+ // select none?
+ GLib.debug("Could not find node");
+ return;
+ }
+ GLib.debug("Select %d", row);
+ s.set_selected(row);
+ _this.node_selected(node);
+
+
+ }
+ }
+
+
+ public class Xcls_maincol : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_maincol(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ _this.maincol = this;
+ var child_1 = new Xcls_SignalListItemFactory14( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Property", child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.id = "maincol";
+ this.el.expand = true;
+ this.el.resizable = true;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory14 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_SignalListItemFactory14(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (listitem) => {
+
+ var expand = new Gtk.TreeExpander();
+
+ expand.set_indent_for_depth(true);
+ expand.set_indent_for_icon(true);
+ var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);
+ var icon = new Gtk.Image();
+ var lbl = new Gtk.Label("");
+ lbl.use_markup = true;
+ lbl.ellipsize = Pango.EllipsizeMode.END;
+
+ icon.margin_end = 4;
+ lbl.justify = Gtk.Justification.LEFT;
+ lbl.xalign = 0;
+
+ // listitem.activatable = true; ??
+
+ hbox.append(icon);
+ hbox.append(lbl);
+ expand.set_child(hbox);
+ ((Gtk.ListItem)listitem).set_child(expand);
+
+ });
+ this.el.bind.connect( (listitem) => {
+ GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
+
+ //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
+ var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
+
+
+ var hbox = (Gtk.Box) expand.child;
+
+
+ var img = (Gtk.Image) hbox.get_first_child();
+ var lbl = (Gtk.Label) img.get_next_sibling();
+
+ var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
+ var node = (JsRender.Node) lr.get_item();
+
+ GLib.debug("node is %s", node.get_type().name());
+ // was item (1) in old layout
+
+
+
+ /*
+ var ic = Gtk.IconTheme.get_for_display(_this.el.get_display());
+ var clsname = node.fqn();
+
+ var clsb = clsname.split(".");
+ var sub = clsb.length > 1 ? clsb[1].down() : "";
+
+ var fn = "/usr/share/glade/pixmaps/hicolor/16x16/actions/widget-gtk-" + sub + ".png";
+ try {
+
+
+ if (FileUtils.test (fn, FileTest.IS_REGULAR)) {
+ img.set_from_file(fn);
+
+ } else {
+ img.set_from_paintable(
+ ic.lookup_icon (
+ "media-playback-stop", null, 16,1,
+ Gtk.TextDirection.NONE, 0
+ )
+ );
+ }
+ } catch (GLib.Error e) {}
+ */
+ expand.set_hide_expander( !node.hasChildren() );
+ expand.set_list_row(lr);
+
+ node.bind_property("iconFilename",
+ img, "file",
+ GLib.BindingFlags.SYNC_CREATE);
+
+ node.bind_property("nodeTitleProp",
+ lbl, "label",
+ GLib.BindingFlags.SYNC_CREATE);
+ node.bind_property("nodeTipProp",
+ lbl, "tooltip_markup",
+ GLib.BindingFlags.SYNC_CREATE);
+ // bind image...
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_ColumnViewColumn15 : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_ColumnViewColumn15(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_SignalListItemFactory16( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Add", child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.fixed_width = 25;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory16 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_SignalListItemFactory16(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (listitem) => {
+
+
+ var icon = new Gtk.Image();
+
+ ((Gtk.ListItem)listitem).set_child(icon);
+ });
+ this.el.bind.connect( (listitem) => {
+
+ var img = (Gtk.Image) ((Gtk.ListItem)listitem).get_child();
+ var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
+ var node = (JsRender.Node) lr.get_item();
+
+
+ var ic = Gtk.IconTheme.get_for_display(_this.el.get_display());
+ img.set_from_paintable(
+ ic.lookup_icon (
+ "list-add", null, 16,1,
+ Gtk.TextDirection.NONE, 0
+ )
+ );
+
+ var fqn = node.fqn();
+ var cn = _this.main_window.windowstate.project.palete.getChildList(fqn, false);
+
+ img.set_visible(cn.size > 0 ? true : false);
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+
+ public class Xcls_LeftTreeMenu : Object
+ {
+ public Gtk.Popover el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_LeftTreeMenu(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ _this.LeftTreeMenu = this;
+ this.el = new Gtk.Popover();
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Box18( _this );
+ this.el.child = child_1.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Box18 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box18(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Button19( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Button20( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ var child_3 = new Xcls_Button21( _this );
+ child_3.ref();
+ this.el.append( child_3.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Button19 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button19(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "Delete Element";
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+ _this.LeftTreeMenu.el.hide();
+ _this.model.deleteSelected();
+ _this.changed();
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button20 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button20(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "Save as Template";
+
+ //listeners
+ this.el.clicked.connect( () => {
+ _this.LeftTreeMenu.el.hide();
+ DialogSaveTemplate.singleton().showIt(
+ (Gtk.Window) _this.el.get_root (),
+ _this.main_window.windowstate.file.palete(),
+ _this.getActiveElement()
+ );
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button21 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button21(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "Save as Module";
+
+ //listeners
+ this.el.clicked.connect( () => {
+
+ _this.LeftTreeMenu.el.hide();
+ var node = _this.getActiveElement();
+
+
+ var sm = DialogSaveModule.singleton();
+
+
+ sm.showIt(
+ (Gtk.Window) _this.el.get_root (),
+ _this.main_window.windowstate.project,
+ node
+ );
+ /*
+ gtk4 migration - disabled this part.. probably not used muchanyway
+
+
+ if (name.length < 1) {
+ return;
+
+ }
+ node.set_prop( new JsRender.NodeProp.special("xinclude", name));
+ node.items.clear();
+
+
+ var s = _this.view.el.get_selection();
+
+ print("GET SELECTED?");
+ Gtk.TreeIter iter;
+ Gtk.TreeModel mod;
+
+
+ if (!s.get_selected(out mod, out iter)) {
+ return; // nothing seleted..
+ }
+ Gtk.TreeIter citer;
+ var n_cn = mod.iter_n_children(iter) -1;
+ for (var i = n_cn; i > -1; i--) {
+ mod.iter_nth_child(out citer, iter, i);
+
+
+ print("removing node from Tree\n");
+
+ _this.model.el.remove(ref citer);
+ }
+ _this.changed();
+ _this.node_selected(node, "tree");
+ */
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+
+
+ }
"$ xns" : "GtkSource",
"* pack" : "set_buffer",
"bool dirty" : false,
- "bool in_cursor_change" : false,
"id" : "buffer",
"int error_line" : "-1",
- "int last_line" : "-1",
"listeners" : {
"changed" : [
" () => {",
"",
" ",
""
- ],
- "cursor_moved" : [
- "( ) => {",
- "GLib.debug(\"cursor moved called\");",
- "",
- "",
- " \tif (this.in_cursor_change ) {",
- " GLib.debug(\"cursor changed : %d [ignoring nested call)\", this.el.cursor_position);",
- " return;",
- " }",
- " ",
- " GLib.debug(\"cursor changed : %d\", this.el.cursor_position);",
- " Gtk.TextIter cpos;",
- " this.el.get_iter_at_offset(out cpos, this.el.cursor_position);",
- " ",
- " var ln = cpos.get_line();",
- " if (this.last_line == ln ){",
- " \treturn;",
- "\t}",
- "\tthis.last_line = ln;",
- " var node = _this.file.lineToNode(ln);",
- "",
- " if (node == null) {",
- " print(\"can not find node\\n\");",
- " return;",
- " }",
- " this.in_cursor_change = true;",
- " var ltree = _this.main_window.windowstate.left_tree;",
- " ltree.model.selectNode(node);",
- " this.in_cursor_change = false;",
- "}",
- ""
]
},
"xtype" : "Buffer",
]
},
"xtype" : "EventControllerKey"
+ },
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "released" : [
+ "(n_press, x, y) => {",
+ "",
+ "\tprint(\"BUTTON RELEASE EVENT\\n\");",
+ "\t_this.sourceview.onCursorChanged();",
+ "\t//this.button_is_pressed = false;",
+ "\t ",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "GestureClick"
}
],
"listeners" : {
" ",
" _this.main_window.windowstate.updateErrorMarksAll();",
" ",
- " // restore the cursor position?",
- " // after reloading the contents.",
+ " // what does this do?",
" GLib.Timeout.add(500, () => {",
- "\t\t_this.buffer.in_cursor_change = true;",
+ "",
" print(\"RESORTING cursor to = %d\\n\", cpos);",
"\t\tGtk.TextIter cpos_iter;",
"\t\tbuf.get_iter_at_offset(out cpos_iter, cpos);",
"\t\tbuf.place_cursor(cpos_iter); ",
"\t\t",
"\t\tthis.el.get_vadjustment().set_value(vadj_pos);;",
- "\t\t_this.buffer.in_cursor_change = false;",
- " ",
+ "\t\t",
+ "",
+ "\t\tthis.onCursorChanged();",
"\t\t",
"\t\t",
"\t\t//_this.buffer.checkSyntax();",
""
],
"| void nodeSelected" : [
- "(JsRender.Node? sel, bool scroll) {",
+ "(JsRender.Node? sel, bool scroll ) {",
" ",
" ",
- " if (this.loading) {",
- " \treturn;",
- "\t}",
+ "\t",
" // this is connected in widnowstate",
- " print(\"Roo-view - node selected\\n\");",
- " var buf = this.el.get_buffer();",
- " ",
- " var sbuf = (GtkSource.Buffer) buf;",
"",
+ "",
+ "\t// not sure why.... ",
+ " // while(Gtk.events_pending()) {",
+ " // Gtk.main_iteration();",
+ " // }",
" ",
+ " this.node_selected = sel;",
" ",
- " ",
- " // clear all the marks..",
- " Gtk.TextIter start;",
- " Gtk.TextIter end; ",
- " ",
- " sbuf.get_bounds (out start, out end);",
- " sbuf.remove_source_marks (start, end, \"grey\");",
- " ",
- " this.node_selected = sel;",
- " if (sel == null) {",
- " // no highlighting..",
- " return;",
- " }",
- " Gtk.TextIter iter; ",
- " sbuf.get_iter_at_line(out iter, sel.line_start);",
- " ",
- " ",
- " Gtk.TextIter cur_iter;",
- " sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);",
- " ",
- " //var cur_line = cur_iter.get_line();",
- " //if (cur_line > sel.line_start && cur_line < sel.line_end) {",
+ " // this.updateGreySelection(scroll);",
" ",
- " //} else {",
- " if (! _this.buffer.in_cursor_change) {",
- " \tthis.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);",
- "\t}",
" ",
- " ",
" ",
- " for (var i = 0; i < buf.get_line_count();i++) {",
- " if (i < sel.line_start || i > sel.line_end) {",
- " ",
- " sbuf.get_iter_at_line(out iter, i);",
- " sbuf.create_source_mark(null, \"grey\", iter);",
- " ",
+ "}",
+ "",
+ " ",
+ ""
+ ],
+ "| void onCursorChanged" : [
+ "(/*ParamSpec ps*/) {",
+ "",
+ "\t\tif (!this.key_is_pressed && !this.button_is_pressed) {",
+ "\t\t\treturn;",
+ "\t\t}",
+ "",
+ "\t if (this.loading) {",
+ " return;",
" }",
- " ",
- " }",
- " ",
+ " // if (ps.name != \"cursor-position\") {",
+ " // return;",
+ " // }",
+ "",
+ " var buf = this.el.get_buffer();",
+ " //print(\"cursor changed : %d\\n\", buf.cursor_position);",
+ " Gtk.TextIter cpos;",
+ " buf.get_iter_at_offset(out cpos, buf.cursor_position);",
+ " ",
+ " var ln = cpos.get_line();",
+ " ",
+ " ",
+ " // --- select node at line....",
+ " ",
+ " var node = _this.file.lineToNode(ln+1);",
+ " ",
+ " if (node == null) {",
+ " print(\"can not find node\\n\");",
+ " return;",
+ " }",
+ " var prop = node.lineToProp(ln+1);",
+ " print(\"prop : %s\", prop == null ? \"???\" : prop.name);",
+ " ",
+ " ",
+ " // ---------- this selects the tree's node...",
+ " ",
+ " var ltree = _this.main_window.windowstate.left_tree;",
+ " ltree.model.selectNode(node);",
+ " ",
+ "\t ",
+ " //print(\"changing cursor on tree..\\n\");",
+ " ",
"",
+ " ",
+ " // let's try allowing editing on the methods.",
+ " // a little klunky at present..",
+ " this.prop_selected = \"\";",
+ " /*",
+ " if (prop != null) {",
+ " \t\t//see if we can find it..",
+ " \t\tvar kv = prop.split(\":\");",
+ " \t\tif (kv[0] == \"p\") {",
+ " \t\t",
+ " \t\t//var k = prop.get_key(kv[1]);",
+ " \t\t// fixme -- need to determine if it's an editable property...",
+ " \t\tthis.prop_selected = prop;",
+ " \t\t",
+ " \t\t} else if (kv[0] == \"l\") {",
+ " \t\t\t this.prop_selected = prop;",
+ " \t\t\t",
+ " \t\t}",
+ " }",
+ " */",
+ " // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false); ",
+ " //this.nodeSelected(node,false);",
+ " ",
+ " // scrolling is disabled... as node selection calls scroll 10ms after it changes.",
+ " ",
+ " ",
+ " // highlight the node..",
"}",
- ""
+ " "
],
"| void updateGreySelection" : [
"(bool scroll) { ",
-static Xcls_WindowRooView _WindowRooView;
-
-public class Xcls_WindowRooView : Object
-{
- public Gtk.Box el;
- private Xcls_WindowRooView _this;
-
- public static Xcls_WindowRooView singleton()
- {
- if (_WindowRooView == null) {
- _WindowRooView= new Xcls_WindowRooView();
- }
- return _WindowRooView;
- }
- public Xcls_notebook notebook;
- public Xcls_label_preview label_preview;
- public Xcls_label_code label_code;
- public Xcls_paned paned;
- public Xcls_viewbox viewbox;
- public Xcls_AutoRedraw AutoRedraw;
- public Xcls_view view;
- public Xcls_inspectorcontainer inspectorcontainer;
- public Xcls_sourceviewscroll sourceviewscroll;
- public Xcls_sourceview sourceview;
- public Xcls_buffer buffer;
- public Xcls_search_entry search_entry;
- public Xcls_search_results search_results;
- public Xcls_nextBtn nextBtn;
- public Xcls_backBtn backBtn;
- public Xcls_search_settings search_settings;
- public Xcls_case_sensitive case_sensitive;
- public Xcls_regex regex;
- public Xcls_multiline multiline;
-
- // my vars (def)
- public Gtk.Widget lastObj;
- public Xcls_MainWindow main_window;
- public int last_search_end;
- public GtkSource.SearchContext searchcontext;
- public JsRender.JsRender file;
-
- // ctor
- public Xcls_WindowRooView()
- {
- _this = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
- this.lastObj = null;
- this.last_search_end = 0;
- this.file = null;
-
- // set gobject values
- this.el.hexpand = true;
- this.el.vexpand = true;
- new Xcls_notebook( _this );
- this.el.append( _this.notebook.el );
- }
-
- // user defined functions
- public void loadFile (JsRender.JsRender file)
- {
- this.file = file;
- this.view.renderJS(true);
- this.notebook.el.page = 0;// gtk preview
- this.sourceview.loadFile();
- }
- public void highlightNodeAtLine (int ln) {
-
-
-
- // highlight node...
-
-
- var node = _this.file.lineToNode(ln+1);
-
- if (node == null) {
- //print("can not find node\n");
- return;
- }
- var prop = node.lineToProp(ln+1);
- print("prop : %s", prop == null ? "???" : prop.name);
-
-
- // ---------- this selects the tree's node...
-
- var ltree = _this.main_window.windowstate.left_tree;
- ltree.model.selectNode(node);
-
- //_this.sourceview.allow_node_scroll = false; /// block node scrolling..
-
-
- //print("changing cursor on tree..\n");
-
-
-
- // let's try allowing editing on the methods.
- // a little klunky at present..
- _this.sourceview.prop_selected = "";
- /*
- if (prop != null) {
- //see if we can find it..
- var kv = prop.split(":");
- if (kv[0] == "p") {
-
- //var k = prop.get_key(kv[1]);
- // fixme -- need to determine if it's an editable property...
- _this.sourceview.prop_selected = prop;
-
- } else if (kv[0] == "l") {
- _this.sourceview.prop_selected = prop;
-
- }
- }
- */
- // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false);
- _this.sourceview.nodeSelected(node,false);
-
- // scrolling is disabled... as node selection calls scroll 10ms after it changes.
- // GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
- // this.allow_node_scroll = true;
- // return false;
- // });
- // }
-
-
-
-
-
-
-
-
-
-
-
- }
- public void requestRedraw () {
- this.view.renderJS(false);
- this.sourceview.loadFile();
- }
- public void forwardSearch (bool change_focus) {
-
- if (this.searchcontext == null) {
- return;
- }
- this.notebook.el.page = 1;
- Gtk.TextIter beg, st,en;
- bool has_wrapped_around;
- var buf = this.sourceview.el.get_buffer();
- buf.get_iter_at_offset(out beg, this.last_search_end);
- if (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {
- this.last_search_end = 0;
- return;
- }
- this.last_search_end = en.get_offset();
- if (change_focus) {
- this.sourceview.el.grab_focus();
- }
- buf.place_cursor(st);
-
-
-
- this.sourceview.el.scroll_to_iter(st, 0.0f, true, 0.0f, 0.5f);
-
-
- var ln = st.get_line();
-
- this.highlightNodeAtLine(ln);
- }
- public void backSearch (bool change_focus) {
-
- if (this.searchcontext == null) {
- return;
- }
-
- Gtk.TextIter beg, st,en;
- bool has_wrapped_around;
- this.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );
-
- if (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {
-
- this.last_search_end = 0;
- return;
- }
- this.last_search_end = en.get_offset();
- if (change_focus) {
- this.sourceview.el.grab_focus();
- }
- this.buffer.el.place_cursor(st);
- this.sourceview.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);
- var ln = st.get_line();
- this.highlightNodeAtLine(ln);
-
-
- }
- public int search (string in_txt) {
- this.notebook.el.page = 1;
-
-
-
- var s = new GtkSource.SearchSettings();
- s.case_sensitive = _this.case_sensitive.el.active;
- s.regex_enabled = _this.regex.el.active;
- s.wrap_around = false;
-
- this.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);
- this.searchcontext.set_highlight(true);
- var txt = in_txt;
-
- if (_this.multiline.el.active) {
- txt = in_txt.replace("\\n", "\n");
- }
-
- s.set_search_text(txt);
- Gtk.TextIter beg, st,en;
- bool has_wrapped_around;
- this.buffer.el.get_start_iter(out beg);
- this.searchcontext.forward(beg, out st, out en, out has_wrapped_around);
- this.last_search_end = 0;
-
- return this.searchcontext.get_occurrences_count();
-
-
-
-
- }
- public void createThumb () {
-
-
- if (this.file == null) {
- return;
- }
-
- if (this.notebook.el.page > 0 ) {
- return;
- }
-
- this.file.widgetToIcon(this.view.el);
-
-
-
-
-
- }
- public void updateErrorMarks (string category) {
-
-
-
- var buf = _this.buffer.el;
- Gtk.TextIter start;
- Gtk.TextIter end;
- buf.get_bounds (out start, out end);
-
- buf.remove_source_marks (start, end, category);
-
- GLib.debug("highlight errors");
-
- // we should highlight other types of errors..
-
-
-
-
- if (_this.file == null) {
- GLib.debug("file is null?");
- return;
-
- }
- var ar = this.file.getErrors(category);
- if (ar == null || ar.get_n_items() < 1) {
- GLib.debug("higjlight %s has no errors", category);
- return;
- }
-
-
-
-
- var offset = 0;
-
-
- var tlines = buf.get_line_count () +1;
-
-
-
- for (var i = 0; i < ar.get_n_items();i++) {
- var err = (Palete.CompileError) ar.get_item(i);
-
- Gtk.TextIter iter;
- // print("get inter\n");
- var eline = err.line - offset;
- GLib.debug("GOT ERROR on line %d -- converted to %d (offset = %d)",
- err.line ,eline, offset);
-
-
- if (eline > tlines || eline < 0) {
- return;
- }
-
-
- buf.get_iter_at_line( out iter, eline);
-
-
- var msg = "Line: %d %s : %s".printf(eline+1, err.category, err.msg);
- buf.create_source_mark( msg, err.category, iter);
- GLib.debug("set line %d to %s", eline, msg);
- //this.marks.set(eline, msg);
- }
- return ;
-
-
-
-
-
- }
- public void scroll_to_line (int line) {
- // code preview...
-
- GLib.Timeout.add(100, () => {
-
- this.notebook.el.set_current_page( 1 );
-
-
- var buf = this.sourceview.el.get_buffer();
-
- var sbuf = (GtkSource.Buffer) buf;
-
-
- Gtk.TextIter iter;
- sbuf.get_iter_at_line(out iter, line);
- this.sourceview.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
- return false;
- });
-
-
- }
- public class Xcls_notebook : Object
- {
- public Gtk.Notebook el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_notebook(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.notebook = this;
- this.el = new Gtk.Notebook();
-
- // my vars (dec)
-
- // set gobject values
- this.el.vexpand = true;
- new Xcls_label_preview( _this );
- new Xcls_label_code( _this );
- new Xcls_paned( _this );
- this.el.append_page ( _this.paned.el , _this.label_preview.el );
- var child_4 = new Xcls_Box13( _this );
- child_4.ref();
- this.el.append_page ( child_4.el , _this.label_code.el );
- }
-
- // user defined functions
- }
- public class Xcls_label_preview : Object
- {
- public Gtk.Label el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_label_preview(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.label_preview = this;
- this.el = new Gtk.Label( "Preview" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_label_code : Object
- {
- public Gtk.Label el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_label_code(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.label_code = this;
- this.el = new Gtk.Label( "Preview Generated Code" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_paned : Object
- {
- public Gtk.Paned el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_paned(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.paned = this;
- this.el = new Gtk.Paned( Gtk.Orientation.VERTICAL );
-
- // my vars (dec)
-
- // set gobject values
- this.el.vexpand = true;
- new Xcls_viewbox( _this );
- this.el.set_start_child ( _this.viewbox.el );
- new Xcls_inspectorcontainer( _this );
- this.el.set_end_child ( _this.inspectorcontainer.el );
- }
-
- // user defined functions
- }
- public class Xcls_viewbox : Object
- {
- public Gtk.Box el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_viewbox(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.viewbox = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- this.el.vexpand = true;
- var child_1 = new Xcls_Box7( _this );
- child_1.ref();
- this.el.append( child_1.el );
- new Xcls_view( _this );
- this.el.append( _this.view.el );
- }
+ static Xcls_WindowRooView _WindowRooView;
+
+ public class Xcls_WindowRooView : Object
+ {
+ public Gtk.Box el;
+ private Xcls_WindowRooView _this;
+
+ public static Xcls_WindowRooView singleton()
+ {
+ if (_WindowRooView == null) {
+ _WindowRooView= new Xcls_WindowRooView();
+ }
+ return _WindowRooView;
+ }
+ public Xcls_notebook notebook;
+ public Xcls_label_preview label_preview;
+ public Xcls_label_code label_code;
+ public Xcls_paned paned;
+ public Xcls_viewbox viewbox;
+ public Xcls_AutoRedraw AutoRedraw;
+ public Xcls_view view;
+ public Xcls_inspectorcontainer inspectorcontainer;
+ public Xcls_sourceviewscroll sourceviewscroll;
+ public Xcls_sourceview sourceview;
+ public Xcls_buffer buffer;
+ public Xcls_search_entry search_entry;
+ public Xcls_search_results search_results;
+ public Xcls_nextBtn nextBtn;
+ public Xcls_backBtn backBtn;
+ public Xcls_search_settings search_settings;
+ public Xcls_case_sensitive case_sensitive;
+ public Xcls_regex regex;
+ public Xcls_multiline multiline;
+
+ // my vars (def)
+ public Gtk.Widget lastObj;
+ public Xcls_MainWindow main_window;
+ public int last_search_end;
+ public GtkSource.SearchContext searchcontext;
+ public JsRender.JsRender file;
+
+ // ctor
+ public Xcls_WindowRooView()
+ {
+ _this = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+ this.lastObj = null;
+ this.last_search_end = 0;
+ this.file = null;
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ new Xcls_notebook( _this );
+ this.el.append( _this.notebook.el );
+ }
+
+ // user defined functions
+ public void loadFile (JsRender.JsRender file)
+ {
+ this.file = file;
+ this.view.renderJS(true);
+ this.notebook.el.page = 0;// gtk preview
+ this.sourceview.loadFile();
+ }
+ public void highlightNodeAtLine (int ln) {
+
+
+
+ // highlight node...
+
+
+ var node = _this.file.lineToNode(ln+1);
+
+ if (node == null) {
+ //print("can not find node\n");
+ return;
+ }
+ var prop = node.lineToProp(ln+1);
+ print("prop : %s", prop == null ? "???" : prop.name);
+
+
+ // ---------- this selects the tree's node...
+
+ var ltree = _this.main_window.windowstate.left_tree;
+ ltree.model.selectNode(node);
+
+ //_this.sourceview.allow_node_scroll = false; /// block node scrolling..
+
+
+ //print("changing cursor on tree..\n");
+
+
+
+ // let's try allowing editing on the methods.
+ // a little klunky at present..
+ _this.sourceview.prop_selected = "";
+ /*
+ if (prop != null) {
+ //see if we can find it..
+ var kv = prop.split(":");
+ if (kv[0] == "p") {
+
+ //var k = prop.get_key(kv[1]);
+ // fixme -- need to determine if it's an editable property...
+ _this.sourceview.prop_selected = prop;
+
+ } else if (kv[0] == "l") {
+ _this.sourceview.prop_selected = prop;
+
+ }
+ }
+ */
+ // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false);
+ _this.sourceview.nodeSelected(node,false);
+
+ // scrolling is disabled... as node selection calls scroll 10ms after it changes.
+ // GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
+ // this.allow_node_scroll = true;
+ // return false;
+ // });
+ // }
+
+
+
+
+
+
+
+
+
+
+
+ }
+ public void requestRedraw () {
+ this.view.renderJS(false);
+ this.sourceview.loadFile();
+ }
+ public void forwardSearch (bool change_focus) {
+
+ if (this.searchcontext == null) {
+ return;
+ }
+ this.notebook.el.page = 1;
+ Gtk.TextIter beg, st,en;
+ bool has_wrapped_around;
+ var buf = this.sourceview.el.get_buffer();
+ buf.get_iter_at_offset(out beg, this.last_search_end);
+ if (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {
+ this.last_search_end = 0;
+ return;
+ }
+ this.last_search_end = en.get_offset();
+ if (change_focus) {
+ this.sourceview.el.grab_focus();
+ }
+ buf.place_cursor(st);
+
+
+
+ this.sourceview.el.scroll_to_iter(st, 0.0f, true, 0.0f, 0.5f);
+
+
+ var ln = st.get_line();
+
+ this.highlightNodeAtLine(ln);
+ }
+ public void backSearch (bool change_focus) {
+
+ if (this.searchcontext == null) {
+ return;
+ }
+
+ Gtk.TextIter beg, st,en;
+ bool has_wrapped_around;
+ this.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );
+
+ if (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {
+
+ this.last_search_end = 0;
+ return;
+ }
+ this.last_search_end = en.get_offset();
+ if (change_focus) {
+ this.sourceview.el.grab_focus();
+ }
+ this.buffer.el.place_cursor(st);
+ this.sourceview.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);
+ var ln = st.get_line();
+ this.highlightNodeAtLine(ln);
+
+
+ }
+ public int search (string in_txt) {
+ this.notebook.el.page = 1;
+
+
+
+ var s = new GtkSource.SearchSettings();
+ s.case_sensitive = _this.case_sensitive.el.active;
+ s.regex_enabled = _this.regex.el.active;
+ s.wrap_around = false;
+
+ this.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);
+ this.searchcontext.set_highlight(true);
+ var txt = in_txt;
+
+ if (_this.multiline.el.active) {
+ txt = in_txt.replace("\\n", "\n");
+ }
+
+ s.set_search_text(txt);
+ Gtk.TextIter beg, st,en;
+ bool has_wrapped_around;
+ this.buffer.el.get_start_iter(out beg);
+ this.searchcontext.forward(beg, out st, out en, out has_wrapped_around);
+ this.last_search_end = 0;
+
+ return this.searchcontext.get_occurrences_count();
+
+
+
+
+ }
+ public void createThumb () {
+
+
+ if (this.file == null) {
+ return;
+ }
+
+ if (this.notebook.el.page > 0 ) {
+ return;
+ }
+
+ this.file.widgetToIcon(this.view.el);
+
+
+
+
+
+ }
+ public void updateErrorMarks (string category) {
+
+
+
+ var buf = _this.buffer.el;
+ Gtk.TextIter start;
+ Gtk.TextIter end;
+ buf.get_bounds (out start, out end);
+
+ buf.remove_source_marks (start, end, category);
+
+ GLib.debug("highlight errors");
+
+ // we should highlight other types of errors..
+
+
+
+
+ if (_this.file == null) {
+ GLib.debug("file is null?");
+ return;
+
+ }
+ var ar = this.file.getErrors(category);
+ if (ar == null || ar.get_n_items() < 1) {
+ GLib.debug("higjlight %s has no errors", category);
+ return;
+ }
+
+
+
+
+ var offset = 0;
+
+
+ var tlines = buf.get_line_count () +1;
+
+
+
+ for (var i = 0; i < ar.get_n_items();i++) {
+ var err = (Palete.CompileError) ar.get_item(i);
+
+ Gtk.TextIter iter;
+ // print("get inter\n");
+ var eline = err.line - offset;
+ GLib.debug("GOT ERROR on line %d -- converted to %d (offset = %d)",
+ err.line ,eline, offset);
+
+
+ if (eline > tlines || eline < 0) {
+ return;
+ }
+
+
+ buf.get_iter_at_line( out iter, eline);
+
+
+ var msg = "Line: %d %s : %s".printf(eline+1, err.category, err.msg);
+ buf.create_source_mark( msg, err.category, iter);
+ GLib.debug("set line %d to %s", eline, msg);
+ //this.marks.set(eline, msg);
+ }
+ return ;
+
+
+
+
+
+ }
+ public void scroll_to_line (int line) {
+ // code preview...
+
+ GLib.Timeout.add(100, () => {
+
+ this.notebook.el.set_current_page( 1 );
+
+
+ var buf = this.sourceview.el.get_buffer();
+
+ var sbuf = (GtkSource.Buffer) buf;
+
+
+ Gtk.TextIter iter;
+ sbuf.get_iter_at_line(out iter, line);
+ this.sourceview.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
+ return false;
+ });
+
+
+ }
+ public class Xcls_notebook : Object
+ {
+ public Gtk.Notebook el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_notebook(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.notebook = this;
+ this.el = new Gtk.Notebook();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.vexpand = true;
+ new Xcls_label_preview( _this );
+ new Xcls_label_code( _this );
+ new Xcls_paned( _this );
+ this.el.append_page ( _this.paned.el , _this.label_preview.el );
+ var child_4 = new Xcls_Box13( _this );
+ child_4.ref();
+ this.el.append_page ( child_4.el , _this.label_code.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_label_preview : Object
+ {
+ public Gtk.Label el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_label_preview(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.label_preview = this;
+ this.el = new Gtk.Label( "Preview" );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_label_code : Object
+ {
+ public Gtk.Label el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_label_code(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.label_code = this;
+ this.el = new Gtk.Label( "Preview Generated Code" );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_paned : Object
+ {
+ public Gtk.Paned el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_paned(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.paned = this;
+ this.el = new Gtk.Paned( Gtk.Orientation.VERTICAL );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.vexpand = true;
+ new Xcls_viewbox( _this );
+ this.el.set_start_child ( _this.viewbox.el );
+ new Xcls_inspectorcontainer( _this );
+ this.el.set_end_child ( _this.inspectorcontainer.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_viewbox : Object
+ {
+ public Gtk.Box el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_viewbox(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.viewbox = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.homogeneous = false;
+ this.el.vexpand = true;
+ var child_1 = new Xcls_Box7( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ new Xcls_view( _this );
+ this.el.append( _this.view.el );
+ }
- // user defined functions
- }
- public class Xcls_Box7 : Object
- {
- public Gtk.Box el;
- private Xcls_WindowRooView _this;
+ // user defined functions
+ }
+ public class Xcls_Box7 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_WindowRooView _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Box7(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+ // ctor
+ public Xcls_Box7(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = true;
- this.el.height_request = 20;
- this.el.vexpand = false;
- var child_1 = new Xcls_Button8( _this );
- child_1.ref();
- this.el.append( child_1.el );
- new Xcls_AutoRedraw( _this );
- this.el.append( _this.AutoRedraw.el );
- var child_3 = new Xcls_Button10( _this );
- child_3.ref();
- this.el.append( child_3.el );
- }
-
- // user defined functions
- }
- public class Xcls_Button8 : Object
- {
- public Gtk.Button el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button8(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Redraw";
-
- //listeners
- this.el.clicked.connect( ( ) => {
- _this.view.renderJS( true);
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_AutoRedraw : Object
- {
- public Gtk.CheckButton el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_AutoRedraw(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.AutoRedraw = this;
- this.el = new Gtk.CheckButton();
-
- // my vars (dec)
-
- // set gobject values
- this.el.active = true;
- this.el.label = "Auto Redraw On";
-
- //listeners
- this.el.toggled.connect( (state) => {
- this.el.set_label(this.el.active ? "Auto Redraw On" : "Auto Redraw Off");
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Button10 : Object
- {
- public Gtk.Button el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button10(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Full Redraw";
-
- //listeners
- this.el.clicked.connect( () => {
- _this.view.redraws = 99;
- // _this.view.el.web_context.clear_cache();
- //_this.view.renderJS(true);
- FakeServerCache.clear();
- _this.view.reInit();
-
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_view : Object
- {
- public WebKit.WebView el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
- public WebKit.WebInspector inspector;
- public bool pendingRedraw;
- public int redraws;
- public bool refreshRequired;
- public string runjs;
- public string runhtml;
- public string renderedData;
- public GLib.DateTime lastRedraw;
-
- // ctor
- public Xcls_view(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.view = this;
- this.el = new WebKit.WebView();
-
- // my vars (dec)
- this.pendingRedraw = false;
- this.redraws = 0;
- this.refreshRequired = false;
- this.runjs = "";
- this.runhtml = "";
- this.renderedData = "";
- this.lastRedraw = null;
-
- // set gobject values
- this.el.vexpand = true;
-
- // init method
-
- {
- // this may not work!?
- var settings = this.el.get_settings();
- settings.enable_developer_extras = true;
-
-
- var fs= new FakeServer(this.el);
- fs.ref();
- // this was an attempt to change the url perms.. did not work..
- // settings.enable_file_access_from_file_uris = true;
- // settings.enable_offline_web_application_cache - true;
- // settings.enable_universal_access_from_file_uris = true;
-
-
-
-
-
-
- // FIXME - base url of script..
- // we need it so some of the database features work.
- this.el.load_html( "Render not ready" ,
- //fixme - should be a config option!
- // or should we catch stuff and fix it up..
- "http://localhost/app.Builder/"
- );
-
-
- //this.el.open('file:///' + __script_path__ + '/../builder.html');
- /*
- Gtk.drag_dest_set
- (
- this.el, //
- Gtk.DestDefaults.MOTION | Gtk.DestDefaults.HIGHLIGHT,
- null, // list of targets
- Gdk.DragAction.COPY // what to do with data after dropped
- );
-
- // print("RB: TARGETS : " + LeftTree.atoms["STRING"]);
- Gtk.drag_dest_set_target_list(this.el, this.get('/Window').targetList);
- */
- GLib.Timeout.add_seconds(1, () =>{
- //print("run refresh?");
- if (this.el == null) {
- return false;
- }
- this.runRefresh();
- return true;
- });
-
-
- }
-
- //listeners
- this.el.script_dialog.connect( (dialog) => {
-
-
- if (this.el == null) {
- return true;
- }
-
- var msg = dialog.get_message();
- if (msg.length < 4) {
- return false;
- }
-
- GLib.debug("script dialog got %s", msg);
-
- if (msg.substring(0,4) != "IPC:") {
- return false;
- }
- var ar = msg.split(":", 3);
- if (ar.length < 3) {
- return false;
- }
-
- switch(ar[1]) {
- case "SAVEHTML":
- GLib.debug("GOT saveHTML %d", ar[2].length);
- _this.file.saveHTML(ar[2]);
- _this.createThumb();
- return true;
- default:
- return false;
- }
-
- });
- this.el.ready_to_show.connect( ( ) => {
- this.initInspector();
-
- });
- this.el.load_changed.connect( (le) => {
- if (le != WebKit.LoadEvent.FINISHED) {
- return;
- }
- if (this.runjs.length < 1) {
- return;
- }
- // this.el.run_javascript(this.runjs, null);
- FakeServerCache.remove( this.runjs);
- this.runjs = "";
- });
- }
-
- // user defined functions
- public void initInspector () {
-
-
-
- // this.inspector.open_window.connect(() => {
- this.inspector = this.el.get_inspector();
-
- this.inspector.open_window.connect(() => {
- print("inspector attach\n");
- var wv = this.inspector.get_web_view();
- if (wv != null) {
- print("got inspector web view\n");
-
- var cn = _this.inspectorcontainer.el.get_first_child();
- if (cn != null) {
- _this.inspectorcontainer.el.remove(cn);
- }
-
- _this.inspectorcontainer.el.append(wv);
- wv.show();
- } else {
- print("got inspector web view FAILED\n");
- //this.inspector.close();
-
- //this.inspector = null;
-
-
- }
- return true;
-
- });
- this.inspector.show();
-
-
-
- }
- public void renderJS (bool force) {
-
- // this is the public redraw call..
- // we refresh in a loop privately..
- var autodraw = _this.AutoRedraw.el.active;
- if (!autodraw && !force) {
- print("Skipping redraw - no force, and autodraw off");
- return;
- }
-
- this.refreshRequired = true;
- }
- public void reInit () {
- print("reInit?");
- // if this happens destroy the webkit..
- // recreate it..
- this.el.stop_loading();
-
- if (_this.viewbox.el.get_parent() == null) {
- return;
- }
-
- /*
- _this.viewbox.el.remove(_this.viewcontainer.el);
- //_this.paned.el.remove(_this.inspectorcontainer.el);
-
- // destory seems to cause problems.
- //this.el.destroy();
- //_this.viewcontainer.el.destroy();
- //_this.inspectorcontainer.el.destroy();
- var inv =new Xcls_inspectorcontainer(_this);
-
- _this.paned.el.set_end_child(inv.el);
- _this.inspectorcontainer = inv;
-
- this.el = null;
- var nv =new Xcls_viewcontainer(_this);
- // nv.ref();
- _this.viewbox.el.append(nv.el);
-
- _this.viewcontainer = nv;
- inv.el.show();
- nv.el.show();
- //while(Gtk.events_pending ()) Gtk.main_iteration ();
- //_this.view.renderJS(true);
- _this.view.refreshRequired = true;
-
- */
- }
- public void runRefresh ()
- {
- // this is run every 2 seconds from the init..
-
-
-
- if (!this.refreshRequired) {
- // print("no refresh required");
- return;
- }
-
- if (this.lastRedraw != null) {
- // do not redraw if last redraw was less that 5 seconds ago.
- if ((int64)(new DateTime.now_local()).difference(this.lastRedraw) < 5000 ) {
- return;
- }
- }
-
- if (_this.file == null) {
- return;
- }
-
-
- this.refreshRequired = false;
- // print("HTML RENDERING");
-
-
- //this.get('/BottomPane').el.show();
- //this.get('/BottomPane').el.set_current_page(2);// webkit inspector
- _this.file.webkit_page_id = this.el.get_page_id();
-
- var js = _this.file.toSourcePreview();
-
- if (js.length < 1) {
- print("no data");
- return;
- }
- // var data = js[0];
- this.redraws++;
-
- var project = (Project.Roo) _this.file.project;
-
- //print (project.fn);
- // set it to non-empty.
-
- // runhtml = runhtml.length ? runhtml : '<script type="text/javascript"></script>';
-
-
- // this.runhtml = this.runhtml || '';
-
-
- // then we need to reload the browser using
- // load_html_string..
-
- // then trigger a redraw once it's loaded..
- this.pendingRedraw = true;
-
- var runhtml = "<script type=\"text/javascript\">\n" ;
- string builderhtml;
-
- try {
- GLib.FileUtils.get_contents(BuilderApplication.configDirectory() + "/resources/roo.builder.js", out builderhtml);
- } catch (Error e) {
- builderhtml = "";
- }
-
- runhtml += builderhtml + "\n";
- runhtml += "</script>\n" ;
-
- // fix to make sure they are the same..
- this.runhtml = project.runhtml;
- // need to modify paths
-
- string inhtml;
- var base_template = project.base_template;
-
- if (base_template.length > 0 && !FileUtils.test(
- BuilderApplication.configDirectory() + "/resources/" + base_template, FileTest.EXISTS)
- ) {
- print("invalid base_template name - using default: %s\n", base_template);
- base_template = "";
-
- }
- try {
- GLib.FileUtils.get_contents(
- BuilderApplication.configDirectory() + "/resources/" +
- (base_template.length > 0 ? base_template : "roo.builder.html")
- , out inhtml);
-
- } catch (Error e) {
- inhtml = "";
- }
- this.renderedData = js;
-
-
- string js_src = js + "
- Roo.onReady(function() {
- if (" + _this.file.name +".show) {
- " + _this.file.name +".show({});
- (function() {
- Builder.saveHTML.defer(100, Builder);
- }).defer(100);
- }
- Roo.XComponent.build();
- });\n";
-
- // print("render js: " + js);
- //if (!this.ready) {
- // console.log('not loaded yet');
- //}
- this.lastRedraw = new DateTime.now_local();
-
-
- //this.runjs = js_src;
- var fc = FakeServerCache.factory_with_data(js_src);
- this.runjs = fc.fname;
-
- var html = inhtml.replace("</head>", runhtml + this.runhtml +
- "<script type=\"text/javascript\" src=\"xhttp://localhost" + fc.fname + "\"></script>" +
- // "<script type=\"text/javascript\">\n" +
- // js_src + "\n" +
- // "</script>" +
-
- "</head>");
- //print("LOAD HTML " + html);
-
- var rootURL = project.rootURL;
-
-
-
- this.el.load_html( html ,
- //fixme - should be a config option!
- (rootURL.length > 0 ? rootURL : "xhttp://localhost/roobuilder/")
- );
- this.initInspector();
- // force the inspector...
- // this.initInspector();
-
- // - no need for this, the builder javascript will call it when build is complete
- //GLib.Timeout.add_seconds(1, () => {
- // this.el.run_javascript("Builder.saveHTML()",null);
- // return false;
- //});
- // print( "before render" + this.lastRedraw);
- // print( "after render" + (new Date()));
-
- }
- }
-
-
- public class Xcls_inspectorcontainer : Object
- {
- public Gtk.Box el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_inspectorcontainer(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.inspectorcontainer = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.vexpand = true;
- }
-
- // user defined functions
- }
-
-
- public class Xcls_Box13 : Object
- {
- public Gtk.Box el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box13(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.vexpand = true;
- new Xcls_sourceviewscroll( _this );
- this.el.append( _this.sourceviewscroll.el );
- var child_2 = new Xcls_Box18( _this );
- child_2.ref();
- this.el.append( child_2.el );
- }
-
- // user defined functions
- }
- public class Xcls_sourceviewscroll : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_sourceviewscroll(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.sourceviewscroll = this;
- this.el = new Gtk.ScrolledWindow();
-
- // my vars (dec)
-
- // set gobject values
- this.el.vexpand = true;
- new Xcls_sourceview( _this );
- this.el.set_child ( _this.sourceview.el );
- }
-
- // user defined functions
- }
- public class Xcls_sourceview : Object
- {
- public GtkSource.View el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
- public int editable_start_pos;
- public bool loading;
- public bool button_is_pressed;
- public string prop_selected;
- public bool key_is_pressed;
- public Gtk.CssProvider css;
- public JsRender.Node? node_selected;
-
- // ctor
- public Xcls_sourceview(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.sourceview = this;
- this.el = new GtkSource.View();
-
- // my vars (dec)
- this.editable_start_pos = -1;
- this.loading = true;
- this.button_is_pressed = false;
- this.prop_selected = "";
- this.key_is_pressed = false;
- this.node_selected = null;
-
- // set gobject values
- this.el.name = "roo-view";
- this.el.editable = false;
- this.el.show_line_marks = true;
- this.el.show_line_numbers = true;
- new Xcls_buffer( _this );
- this.el.set_buffer ( _this.buffer.el );
- var child_2 = new Xcls_EventControllerKey17( _this );
- child_2.ref();
- this.el.add_controller ( child_2.el );
-
- // init method
-
- {
-
- this.css = new Gtk.CssProvider();
-
- this.css.load_from_string(
- "#roo-view { font: 10px monospace; }"
- );
-
- Gtk.StyleContext.add_provider_for_display(
- this.el.get_display(),
- this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
- );
-
-
-
- this.loading = true;
- //var buf = this.el.get_buffer();
- //buf.notify.connect(this.onCursorChanged);
-
-
- var attrs = new GtkSource.MarkAttributes();
- var pink = Gdk.RGBA();
- pink.parse ( "pink");
- attrs.set_background ( pink);
- attrs.set_icon_name ( "process-stop");
- attrs.query_tooltip_text.connect(( mark) => {
- //print("tooltip query? %s\n", mark.name);
- return mark.name;
- });
-
- this.el.set_mark_attributes ("ERR", attrs, 1);
-
- var wattrs = new GtkSource.MarkAttributes();
- var blue = Gdk.RGBA();
- blue.parse ( "#ABF4EB");
- wattrs.set_background ( blue);
- wattrs.set_icon_name ( "process-stop");
- wattrs.query_tooltip_text.connect(( mark) => {
- //print("tooltip query? %s\n", mark.name);
- return mark.name;
- });
-
- this.el.set_mark_attributes ("WARN", wattrs, 1);
-
-
-
- var dattrs = new GtkSource.MarkAttributes();
- var purple = Gdk.RGBA();
- purple.parse ( "#EEA9FF");
- dattrs.set_background ( purple);
- dattrs.set_icon_name ( "process-stop");
- dattrs.query_tooltip_text.connect(( mark) => {
- //print("tooltip query? %s\n", mark.name);
- return mark.name;
- });
-
- this.el.set_mark_attributes ("DEPR", dattrs, 1);
-
-
- var gattrs = new GtkSource.MarkAttributes();
- var grey = Gdk.RGBA();
- grey.parse ( "#ccc");
- gattrs.set_background ( grey);
-
-
- this.el.set_mark_attributes ("grey", gattrs, 1);
-
-
-
-
-
-
- }
-
- //listeners
- this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
-
- //GLib.debug("query tooltip");
- Gtk.TextIter iter;
- int trailing;
-
- var yoff = (int) _this.sourceviewscroll.el.vadjustment.value;
-
- this.el.get_iter_at_position (out iter, out trailing, x, y + yoff);
-
- var l = iter.get_line();
- //GLib.debug("query tooltip line %d", (int) l);
- var marks = _this.buffer.el.get_source_marks_at_line(l, null);
- //GLib.debug("query tooltip line marks %d", (int) marks.length());
- var str = "";
- marks.@foreach((m) => {
- //GLib.debug("got mark %s", m.name);
- str += (str.length > 0 ? "\n" : "") + m.name;
- });
- // true if there is a mark..
- if (str.length > 0 ) {
- tooltip.set_text( str);
- }
- return str.length > 0 ? true : false;
-
- });
- }
-
- // user defined functions
- public void loadFile ( ) {
- this.loading = true;
-
-
- // get the cursor and scroll position....
- var buf = this.el.get_buffer();
- var cpos = buf.cursor_position;
-
- print("BEFORE LOAD cursor = %d\n", cpos);
-
- var vadj_pos = this.el.get_vadjustment().get_value();
-
-
-
- buf.set_text("",0);
- var sbuf = (GtkSource.Buffer) buf;
-
-
-
- if (_this.file == null || _this.file.xtype != "Roo") {
- print("xtype != Roo");
- this.loading = false;
- return;
- }
-
- // get the string from the rendered tree...
-
- var str = _this.file.toSource();
-
- // print("setting str %d\n", str.length);
- buf.set_text(str, str.length);
- var lm = GtkSource.LanguageManager.get_default();
-
- //?? is javascript going to work as js?
-
- ((GtkSource.Buffer)(buf)) .set_language(lm.get_language(_this.file.language));
-
-
- _this.main_window.windowstate.updateErrorMarksAll();
-
- // restore the cursor position?
- // after reloading the contents.
- GLib.Timeout.add(500, () => {
- _this.buffer.in_cursor_change = true;
- print("RESORTING cursor to = %d\n", cpos);
- Gtk.TextIter cpos_iter;
- buf.get_iter_at_offset(out cpos_iter, cpos);
- buf.place_cursor(cpos_iter);
-
- this.el.get_vadjustment().set_value(vadj_pos);;
- _this.buffer.in_cursor_change = false;
-
-
-
- //_this.buffer.checkSyntax();
- return false;
- });
-
- this.loading = false;
- _this.buffer.dirty = false;
- }
- public void nodeSelected (JsRender.Node? sel, bool scroll) {
-
-
- if (this.loading) {
- return;
- }
- // this is connected in widnowstate
- print("Roo-view - node selected\n");
- var buf = this.el.get_buffer();
-
- var sbuf = (GtkSource.Buffer) buf;
-
-
-
-
- // clear all the marks..
- Gtk.TextIter start;
- Gtk.TextIter end;
-
- sbuf.get_bounds (out start, out end);
- sbuf.remove_source_marks (start, end, "grey");
-
- this.node_selected = sel;
- if (sel == null) {
- // no highlighting..
- return;
- }
- Gtk.TextIter iter;
- sbuf.get_iter_at_line(out iter, sel.line_start);
-
-
- Gtk.TextIter cur_iter;
- sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);
-
- //var cur_line = cur_iter.get_line();
- //if (cur_line > sel.line_start && cur_line < sel.line_end) {
-
- //} else {
- if (! _this.buffer.in_cursor_change) {
- this.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
- }
-
-
-
- for (var i = 0; i < buf.get_line_count();i++) {
- if (i < sel.line_start || i > sel.line_end) {
-
- sbuf.get_iter_at_line(out iter, i);
- sbuf.create_source_mark(null, "grey", iter);
-
- }
-
- }
-
-
- }
- public void updateGreySelection (bool scroll) {
- var sel = this.node_selected;
- print("node selected\n");
- var buf = this.el.get_buffer();
- var sbuf = (GtkSource.Buffer) buf;
-
-
- this.clearGreySelection();
-
-
-
- if (sel == null) {
- print("no selected node\n");
- // no highlighting..
- return;
- }
-
- print("highlight region %d to %d\n", sel.line_start,sel.line_end);
- Gtk.TextIter iter;
- sbuf.get_iter_at_line(out iter, sel.line_start);
-
-
- Gtk.TextIter cur_iter;
- sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);
-
- var cursor_at_line = cur_iter.get_line();
-
-
- //var cur_line = cur_iter.get_line();
- //if (cur_line > sel.line_start && cur_line < sel.line_end) {
-
- //} else {
- if (scroll) {
- print("scrolling to node -- should occur on node picking.\n");
- this.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
- }
-
- var start_line = sel.line_start;
- var end_line = sel.line_end;
-
-
- this.el.editable = false;
-
- //var colon_pos = 0;
-
- this.editable_start_pos = -1;
-
- // now if we have selected a property...
- if (this.prop_selected.length> 0 ) {
-
- int nstart, nend;
- if (sel.getPropertyRange(this.prop_selected, out nstart, out nend) && nend > nstart) {
- start_line = nstart;
- end_line = nend;
- // this.el.editable = true; << cant do this!!?
- print("start line = %d, end line = %d\n", start_line, end_line);
-
- // see if we are 'right of ':'
- // get an iter for the start of the line.
- Gtk.TextIter start_first_line_iter,end_first_line_iter;
- this.el.buffer.get_iter_at_line(out start_first_line_iter, start_line -1);
- this.el.buffer.get_iter_at_line(out end_first_line_iter, start_line -1);
-
-
-
-
- if (end_first_line_iter.forward_to_line_end()) {
- var first_line = this.el.buffer.get_text(start_first_line_iter, end_first_line_iter, false);
-
- print("first line = %s\n", first_line);
- if (first_line.contains(":")) {
- this.editable_start_pos = start_first_line_iter.get_offset() + first_line.index_of(":") + 1;
- print("colon_pos = %d\n", this.editable_start_pos);
- }
-
-
- //Gtk.TextIter colon_iter;
- //sbuf.get_iter_at_offset (out colon_iter, colon_pos);
- //sbuf.create_source_mark(null, "active_text", colon_iter);
- }
-
-
-
- //print("is cursor at line? %d ?= %d\n", start_line -1 , cursor_at_line);
- //if (start_line - 1 == cursor_at_line) {
- // should be ok - current_posssion can not be less than '-1'...
- if (sbuf.cursor_position < this.editable_start_pos) {
-
- print("cursor is before start pos.. - turn off editable...\n");
- //var before_cursor_string = this.el.buffer.get_text(start_line_iter, cur_iter, false);
- //print("before cursor string = %s\n", before_cursor_string);
- //if (!before_cursor_string.contains(":")) {
- this.el.editable = false;
- //}
-
- }
-
-
-
-
- }
- print("propSelected = %s range %d -> %d\n", this.prop_selected, start_line, end_line);
-
-
- }
-
- print("checking selection\n");
-
-
- // check selection - if it's out of 'bounds'
- if (this.el.editable && sbuf.get_has_selection()) {
- Gtk.TextIter sel_start_iter, sel_end_iter;
- sbuf.get_selection_bounds(out sel_start_iter, out sel_end_iter);
-
- if (sel_start_iter.get_line() < start_line || sel_end_iter.get_line() > end_line ||
- sel_start_iter.get_line() > end_line || sel_end_iter.get_line() < start_line ) {
- // save?
- this.el.editable = false;
- }
- if (this.editable_start_pos > 0 &&
- (sel_start_iter.get_offset() < this.editable_start_pos || sel_end_iter.get_offset() < this.editable_start_pos)
-
- ) {
- this.el.editable = false;
- }
-
-
-
- }
-
-
-
-
- for (var i = 0; i < buf.get_line_count();i++) {
- if (i < (start_line -1) || i > (end_line -1)) {
-
- sbuf.get_iter_at_line(out iter, i);
- sbuf.create_source_mark(null, "grey", iter);
-
- }
-
- }
- if (scroll && (cursor_at_line > end_line || cursor_at_line < start_line)) {
- Gtk.TextIter cpos_iter;
- buf.get_iter_at_line(out cpos_iter, start_line);
-
- buf.place_cursor(cpos_iter);
- }
-
-
- }
- public void highlightErrorsJson (string type, Json.Object obj) {
- // this is a hook for the vala code - it has no value in javascript
- // as we only have one error ususally....
- return ;
-
-
-
-
- }
- public void clearGreySelection () {
- // clear all the marks..
- var sbuf = (GtkSource.Buffer)this.el.buffer;
-
- Gtk.TextIter start;
- Gtk.TextIter end;
-
- sbuf.get_bounds (out start, out end);
- sbuf.remove_source_marks (start, end, "grey");
-
-
- }
- 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 class Xcls_buffer : Object
- {
- public GtkSource.Buffer el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
- public int error_line;
- public bool in_cursor_change;
- public bool dirty;
- public int last_line;
-
- // ctor
- public Xcls_buffer(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.buffer = this;
- this.el = new GtkSource.Buffer( null );
-
- // my vars (dec)
- this.error_line = -1;
- this.in_cursor_change = false;
- this.dirty = false;
- this.last_line = -1;
-
- // set gobject values
-
- //listeners
- this.el.cursor_moved.connect( ( ) => {
- GLib.debug("cursor moved called");
-
-
- if (this.in_cursor_change ) {
- GLib.debug("cursor changed : %d [ignoring nested call)", this.el.cursor_position);
- return;
- }
-
- GLib.debug("cursor changed : %d", this.el.cursor_position);
- Gtk.TextIter cpos;
- this.el.get_iter_at_offset(out cpos, this.el.cursor_position);
-
- var ln = cpos.get_line();
- if (this.last_line == ln ){
- return;
- }
- this.last_line = ln;
- var node = _this.file.lineToNode(ln);
-
- if (node == null) {
- print("can not find node\n");
- return;
- }
- this.in_cursor_change = true;
- var ltree = _this.main_window.windowstate.left_tree;
- ltree.model.selectNode(node);
- this.in_cursor_change = false;
- });
- this.el.changed.connect( () => {
-
- // check syntax??
- // ??needed..??
- // _this.save_button.el.sensitive = true;
- ///?? has changed occured during loading?
-
- // only trigger this if
-
-
-
-
- if (_this.sourceview.loading) {
- return;
- }
-
-
-
- print("- PREVIEW EDITOR CHANGED--");
-
- this.dirty = true;
- // this.checkSyntax(); // this calls backs and highlights errors.. in theory...
-
-
-
- if (!_this.sourceview.button_is_pressed && !_this.sourceview.key_is_pressed) {
- print("button or key not pressed to generate change?!\n");
- return;
- }
-
-
- // what are we editing??
- if (null == _this.sourceview.node_selected || _this.sourceview.prop_selected.length < 1) {
- return;
- }
-
- // find the colon on the first line...
-
- if (_this.sourceview.editable_start_pos > -1) {
-
- var buf = (GtkSource.Buffer)_this.sourceview.el.get_buffer();
-
- //print("cursor changed : %d\n", buf.cursor_position);
- Gtk.TextIter spos,epos;
- buf.get_iter_at_offset(out spos, _this.sourceview.editable_start_pos);
- buf.get_iter_at_offset(out epos, _this.sourceview.editable_start_pos); // initialize epos..
-
- var gotit= false;
- var line = spos.get_line();
- var endline = buf.get_line_count();
- while (line < endline) {
- line++;
- buf.get_iter_at_line(out epos, line);
- if (buf.get_source_marks_at_line(line, "grey").length() > 0) {
- buf.get_iter_at_line(out epos, line);
- gotit=true;
- break;
- }
- }
-
- if (gotit) {
- print("End Offset = %d/%d\n", epos.get_line(), epos.get_offset());
- // get the pos...
- // in theory the last char will be '}' or '},' .. or ','
- // we should chop the ',' of the end...
- var str = buf.get_text(spos, epos, false);
- print("got string\n%s\n", str);
-
- }
- }
- return ;
- });
- }
-
- // user defined functions
- public bool highlightErrors ( Gee.HashMap<int,string> validate_res) {
-
- this.error_line = validate_res.size;
-
- if (this.error_line < 1) {
- return true;
- }
- var tlines = this.el.get_line_count ();
- Gtk.TextIter iter;
- var valiter = validate_res.map_iterator();
- while (valiter.next()) {
-
- // print("get inter\n");
- var eline = valiter.get_key();
- if (eline > tlines) {
- continue;
- }
- this.el.get_iter_at_line( out iter, eline);
- //print("mark line\n");
- this.el.create_source_mark(valiter.get_value(), "ERR", iter);
- }
- return false;
- }
- public string toString () {
-
- Gtk.TextIter s;
- Gtk.TextIter e;
- this.el.get_start_iter(out s);
- this.el.get_end_iter(out e);
- var ret = this.el.get_text(s,e,true);
- //print("TO STRING? " + ret);
- return ret;
- }
- }
-
- public class Xcls_EventControllerKey17 : Object
- {
- public Gtk.EventControllerKey el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_EventControllerKey17(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- this.el = new Gtk.EventControllerKey();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.key_pressed.connect( (keyval, keycode, state) => {
-
-
-
- if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-g pressed");
- _this.forwardSearch(true);
- return false;
- }
- if (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-f pressed");
- _this.search_entry.el.grab_focus();
- return false ;
- }
-
- //this.button_is_pressed = true;
- //return false;
- // print(event.key.keyval)
-
- return false;
-
-
- });
- }
-
- // user defined functions
- }
-
-
-
- public class Xcls_Box18 : Object
- {
- public Gtk.Box el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box18(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- this.el.vexpand = false;
- new Xcls_search_entry( _this );
- this.el.append( _this.search_entry.el );
- new Xcls_search_results( _this );
- this.el.append( _this.search_results.el );
- new Xcls_nextBtn( _this );
- this.el.append( _this.nextBtn.el );
- new Xcls_backBtn( _this );
- this.el.append( _this.backBtn.el );
- var child_5 = new Xcls_MenuButton24( _this );
- child_5.ref();
- this.el.append( child_5.el );
- }
-
- // user defined functions
- }
- public class Xcls_search_entry : Object
- {
- public Gtk.SearchEntry el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
- public Gtk.CssProvider css;
-
- // ctor
- public Xcls_search_entry(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.search_entry = this;
- this.el = new Gtk.SearchEntry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.name = "roo-search-entry";
- this.el.hexpand = true;
- this.el.placeholder_text = "Press enter to search";
- var child_1 = new Xcls_EventControllerKey20( _this );
- child_1.ref();
- this.el.add_controller( child_1.el );
-
- // init method
-
- this.css = new Gtk.CssProvider();
-
- this.css.load_from_string(
- "#roo-search-entry { background-color: #ccc; }"
- );
-
- Gtk.StyleContext.add_provider_for_display(
- this.el.get_display(),
- this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
- );
-
- //listeners
- this.el.search_changed.connect( ( ) => {
-
- _this.search(_this.search_entry.el.text);
- _this.search_results.updateResults();
-
- GLib.Timeout.add_seconds(1,() => {
- _this.search_results.updateResults();
- return false;
- });
- });
- }
-
- // user defined functions
- public void forwardSearch (bool change_focus) {
-
-
- _this.forwardSearch(change_focus);
-
- /*
-
- switch(_this.windowstate.state) {
- case WindowState.State.CODEONLY:
- //case WindowState.State.CODE:
- // search the code being edited..
- _this.windowstate.code_editor_tab.forwardSearch(change_focus);
-
- break;
- case WindowState.State.PREVIEW:
- if (_this.windowstate.file.xtype == "Gtk") {
- _this.windowstate.window_gladeview.forwardSearch(change_focus);
- } else {
- _this.windowstate.window_rooview.forwardSearch(change_focus);
- }
-
- break;
- }
- */
-
- }
- }
- public class Xcls_EventControllerKey20 : Object
- {
- public Gtk.EventControllerKey el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_EventControllerKey20(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- this.el = new Gtk.EventControllerKey();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.key_pressed.connect( (keyval, keycode, state) => {
-
- if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-g pressed");
- _this.forwardSearch(true);
- return true;
- }
-
-
- if (keyval == Gdk.Key.Return) {
- _this.forwardSearch(true);
-
-
- return true;
-
- }
- // print(event.key.keyval)
-
- return false;
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_search_results : Object
- {
- public Gtk.Label el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_search_results(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.search_results = this;
- this.el = new Gtk.Label( "No Results" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.margin_end = 4;
- this.el.margin_start = 4;
- }
-
- // user defined functions
- public void updateResults () {
- this.el.visible = true;
-
- var res = _this.searchcontext.get_occurrences_count();
- if (res < 0) {
- _this.search_results.el.label = "??? Matches";
- return;
- }
-
- _this.nextBtn.el.sensitive = false;
- _this.backBtn.el.sensitive = false;
-
- if (res > 0) {
- _this.search_results.el.label = "%d Matches".printf(res);
- _this.nextBtn.el.sensitive = true;
- _this.backBtn.el.sensitive = true;
- return;
- }
- _this.search_results.el.label = "No Matches";
-
- }
- }
-
- public class Xcls_nextBtn : Object
- {
- public Gtk.Button el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
- public bool always_show_image;
-
- // ctor
- public Xcls_nextBtn(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.nextBtn = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
- this.always_show_image = true;
-
- // set gobject values
- this.el.icon_name = "go-down";
- this.el.sensitive = false;
-
- //listeners
- this.el.clicked.connect( (event) => {
-
- _this.forwardSearch(true);
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_backBtn : Object
- {
- public Gtk.Button el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
- public bool always_show_image;
-
- // ctor
- public Xcls_backBtn(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.backBtn = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
- this.always_show_image = true;
-
- // set gobject values
- this.el.icon_name = "go-up";
- this.el.sensitive = false;
-
- //listeners
- this.el.clicked.connect( (event) => {
-
- _this.backSearch(true);
-
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_MenuButton24 : Object
- {
- public Gtk.MenuButton el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
- public bool always_show_image;
-
- // ctor
- public Xcls_MenuButton24(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuButton();
-
- // my vars (dec)
- this.always_show_image = true;
-
- // set gobject values
- this.el.icon_name = "emblem-system";
- new Xcls_search_settings( _this );
- this.el.popover = _this.search_settings.el;
- }
-
- // user defined functions
- }
- public class Xcls_search_settings : Object
- {
- public Gtk.Popover el;
- private Xcls_WindowRooView _this;
+ // my vars (dec)
+
+ // set gobject values
+ this.el.homogeneous = true;
+ this.el.height_request = 20;
+ this.el.vexpand = false;
+ var child_1 = new Xcls_Button8( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ new Xcls_AutoRedraw( _this );
+ this.el.append( _this.AutoRedraw.el );
+ var child_3 = new Xcls_Button10( _this );
+ child_3.ref();
+ this.el.append( child_3.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Button8 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button8(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "Redraw";
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+ _this.view.renderJS( true);
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_AutoRedraw : Object
+ {
+ public Gtk.CheckButton el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_AutoRedraw(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.AutoRedraw = this;
+ this.el = new Gtk.CheckButton();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.active = true;
+ this.el.label = "Auto Redraw On";
+
+ //listeners
+ this.el.toggled.connect( (state) => {
+ this.el.set_label(this.el.active ? "Auto Redraw On" : "Auto Redraw Off");
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button10 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button10(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "Full Redraw";
+
+ //listeners
+ this.el.clicked.connect( () => {
+ _this.view.redraws = 99;
+ // _this.view.el.web_context.clear_cache();
+ //_this.view.renderJS(true);
+ FakeServerCache.clear();
+ _this.view.reInit();
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_view : Object
+ {
+ public WebKit.WebView el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+ public WebKit.WebInspector inspector;
+ public bool pendingRedraw;
+ public int redraws;
+ public bool refreshRequired;
+ public string runjs;
+ public string runhtml;
+ public string renderedData;
+ public GLib.DateTime lastRedraw;
+
+ // ctor
+ public Xcls_view(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.view = this;
+ this.el = new WebKit.WebView();
+
+ // my vars (dec)
+ this.pendingRedraw = false;
+ this.redraws = 0;
+ this.refreshRequired = false;
+ this.runjs = "";
+ this.runhtml = "";
+ this.renderedData = "";
+ this.lastRedraw = null;
+
+ // set gobject values
+ this.el.vexpand = true;
+
+ // init method
+
+ {
+ // this may not work!?
+ var settings = this.el.get_settings();
+ settings.enable_developer_extras = true;
+
+
+ var fs= new FakeServer(this.el);
+ fs.ref();
+ // this was an attempt to change the url perms.. did not work..
+ // settings.enable_file_access_from_file_uris = true;
+ // settings.enable_offline_web_application_cache - true;
+ // settings.enable_universal_access_from_file_uris = true;
+
+
+
+
+
+
+ // FIXME - base url of script..
+ // we need it so some of the database features work.
+ this.el.load_html( "Render not ready" ,
+ //fixme - should be a config option!
+ // or should we catch stuff and fix it up..
+ "http://localhost/app.Builder/"
+ );
+
+
+ //this.el.open('file:///' + __script_path__ + '/../builder.html');
+ /*
+ Gtk.drag_dest_set
+ (
+ this.el, //
+ Gtk.DestDefaults.MOTION | Gtk.DestDefaults.HIGHLIGHT,
+ null, // list of targets
+ Gdk.DragAction.COPY // what to do with data after dropped
+ );
+
+ // print("RB: TARGETS : " + LeftTree.atoms["STRING"]);
+ Gtk.drag_dest_set_target_list(this.el, this.get('/Window').targetList);
+ */
+ GLib.Timeout.add_seconds(1, () =>{
+ //print("run refresh?");
+ if (this.el == null) {
+ return false;
+ }
+ this.runRefresh();
+ return true;
+ });
+
+
+ }
+
+ //listeners
+ this.el.script_dialog.connect( (dialog) => {
+
+
+ if (this.el == null) {
+ return true;
+ }
+
+ var msg = dialog.get_message();
+ if (msg.length < 4) {
+ return false;
+ }
+
+ GLib.debug("script dialog got %s", msg);
+
+ if (msg.substring(0,4) != "IPC:") {
+ return false;
+ }
+ var ar = msg.split(":", 3);
+ if (ar.length < 3) {
+ return false;
+ }
+
+ switch(ar[1]) {
+ case "SAVEHTML":
+ GLib.debug("GOT saveHTML %d", ar[2].length);
+ _this.file.saveHTML(ar[2]);
+ _this.createThumb();
+ return true;
+ default:
+ return false;
+ }
+
+ });
+ this.el.ready_to_show.connect( ( ) => {
+ this.initInspector();
+
+ });
+ this.el.load_changed.connect( (le) => {
+ if (le != WebKit.LoadEvent.FINISHED) {
+ return;
+ }
+ if (this.runjs.length < 1) {
+ return;
+ }
+ // this.el.run_javascript(this.runjs, null);
+ FakeServerCache.remove( this.runjs);
+ this.runjs = "";
+ });
+ }
+
+ // user defined functions
+ public void initInspector () {
+
+
+
+ // this.inspector.open_window.connect(() => {
+ this.inspector = this.el.get_inspector();
+
+ this.inspector.open_window.connect(() => {
+ print("inspector attach\n");
+ var wv = this.inspector.get_web_view();
+ if (wv != null) {
+ print("got inspector web view\n");
+
+ var cn = _this.inspectorcontainer.el.get_first_child();
+ if (cn != null) {
+ _this.inspectorcontainer.el.remove(cn);
+ }
+
+ _this.inspectorcontainer.el.append(wv);
+ wv.show();
+ } else {
+ print("got inspector web view FAILED\n");
+ //this.inspector.close();
+
+ //this.inspector = null;
+
+
+ }
+ return true;
+
+ });
+ this.inspector.show();
+
+
+
+ }
+ public void renderJS (bool force) {
+
+ // this is the public redraw call..
+ // we refresh in a loop privately..
+ var autodraw = _this.AutoRedraw.el.active;
+ if (!autodraw && !force) {
+ print("Skipping redraw - no force, and autodraw off");
+ return;
+ }
+
+ this.refreshRequired = true;
+ }
+ public void reInit () {
+ print("reInit?");
+ // if this happens destroy the webkit..
+ // recreate it..
+ this.el.stop_loading();
+
+ if (_this.viewbox.el.get_parent() == null) {
+ return;
+ }
+
+ /*
+ _this.viewbox.el.remove(_this.viewcontainer.el);
+ //_this.paned.el.remove(_this.inspectorcontainer.el);
+
+ // destory seems to cause problems.
+ //this.el.destroy();
+ //_this.viewcontainer.el.destroy();
+ //_this.inspectorcontainer.el.destroy();
+ var inv =new Xcls_inspectorcontainer(_this);
+
+ _this.paned.el.set_end_child(inv.el);
+ _this.inspectorcontainer = inv;
+
+ this.el = null;
+ var nv =new Xcls_viewcontainer(_this);
+ // nv.ref();
+ _this.viewbox.el.append(nv.el);
+
+ _this.viewcontainer = nv;
+ inv.el.show();
+ nv.el.show();
+ //while(Gtk.events_pending ()) Gtk.main_iteration ();
+ //_this.view.renderJS(true);
+ _this.view.refreshRequired = true;
+
+ */
+ }
+ public void runRefresh ()
+ {
+ // this is run every 2 seconds from the init..
+
+
+
+ if (!this.refreshRequired) {
+ // print("no refresh required");
+ return;
+ }
+
+ if (this.lastRedraw != null) {
+ // do not redraw if last redraw was less that 5 seconds ago.
+ if ((int64)(new DateTime.now_local()).difference(this.lastRedraw) < 5000 ) {
+ return;
+ }
+ }
+
+ if (_this.file == null) {
+ return;
+ }
+
+
+ this.refreshRequired = false;
+ // print("HTML RENDERING");
+
+
+ //this.get('/BottomPane').el.show();
+ //this.get('/BottomPane').el.set_current_page(2);// webkit inspector
+ _this.file.webkit_page_id = this.el.get_page_id();
+
+ var js = _this.file.toSourcePreview();
+
+ if (js.length < 1) {
+ print("no data");
+ return;
+ }
+ // var data = js[0];
+ this.redraws++;
+
+ var project = (Project.Roo) _this.file.project;
+
+ //print (project.fn);
+ // set it to non-empty.
+
+ // runhtml = runhtml.length ? runhtml : '<script type="text/javascript"></script>';
+
+
+ // this.runhtml = this.runhtml || '';
+
+
+ // then we need to reload the browser using
+ // load_html_string..
+
+ // then trigger a redraw once it's loaded..
+ this.pendingRedraw = true;
+
+ var runhtml = "<script type=\"text/javascript\">\n" ;
+ string builderhtml;
+
+ try {
+ GLib.FileUtils.get_contents(BuilderApplication.configDirectory() + "/resources/roo.builder.js", out builderhtml);
+ } catch (Error e) {
+ builderhtml = "";
+ }
+
+ runhtml += builderhtml + "\n";
+ runhtml += "</script>\n" ;
+
+ // fix to make sure they are the same..
+ this.runhtml = project.runhtml;
+ // need to modify paths
+
+ string inhtml;
+ var base_template = project.base_template;
+
+ if (base_template.length > 0 && !FileUtils.test(
+ BuilderApplication.configDirectory() + "/resources/" + base_template, FileTest.EXISTS)
+ ) {
+ print("invalid base_template name - using default: %s\n", base_template);
+ base_template = "";
+
+ }
+ try {
+ GLib.FileUtils.get_contents(
+ BuilderApplication.configDirectory() + "/resources/" +
+ (base_template.length > 0 ? base_template : "roo.builder.html")
+ , out inhtml);
+
+ } catch (Error e) {
+ inhtml = "";
+ }
+ this.renderedData = js;
+
+
+ string js_src = js + "
+ Roo.onReady(function() {
+ if (" + _this.file.name +".show) {
+ " + _this.file.name +".show({});
+ (function() {
+ Builder.saveHTML.defer(100, Builder);
+ }).defer(100);
+ }
+ Roo.XComponent.build();
+ });\n";
+
+ // print("render js: " + js);
+ //if (!this.ready) {
+ // console.log('not loaded yet');
+ //}
+ this.lastRedraw = new DateTime.now_local();
+
+
+ //this.runjs = js_src;
+ var fc = FakeServerCache.factory_with_data(js_src);
+ this.runjs = fc.fname;
+
+ var html = inhtml.replace("</head>", runhtml + this.runhtml +
+ "<script type=\"text/javascript\" src=\"xhttp://localhost" + fc.fname + "\"></script>" +
+ // "<script type=\"text/javascript\">\n" +
+ // js_src + "\n" +
+ // "</script>" +
+
+ "</head>");
+ //print("LOAD HTML " + html);
+
+ var rootURL = project.rootURL;
+
+
+
+ this.el.load_html( html ,
+ //fixme - should be a config option!
+ (rootURL.length > 0 ? rootURL : "xhttp://localhost/roobuilder/")
+ );
+ this.initInspector();
+ // force the inspector...
+ // this.initInspector();
+
+ // - no need for this, the builder javascript will call it when build is complete
+ //GLib.Timeout.add_seconds(1, () => {
+ // this.el.run_javascript("Builder.saveHTML()",null);
+ // return false;
+ //});
+ // print( "before render" + this.lastRedraw);
+ // print( "after render" + (new Date()));
+
+ }
+ }
+
+
+ public class Xcls_inspectorcontainer : Object
+ {
+ public Gtk.Box el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_inspectorcontainer(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.inspectorcontainer = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.vexpand = true;
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_Box13 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box13(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.vexpand = true;
+ new Xcls_sourceviewscroll( _this );
+ this.el.append( _this.sourceviewscroll.el );
+ var child_2 = new Xcls_Box19( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_sourceviewscroll : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_sourceviewscroll(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.sourceviewscroll = this;
+ this.el = new Gtk.ScrolledWindow();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.vexpand = true;
+ new Xcls_sourceview( _this );
+ this.el.set_child ( _this.sourceview.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_sourceview : Object
+ {
+ public GtkSource.View el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+ public int editable_start_pos;
+ public bool loading;
+ public bool button_is_pressed;
+ public string prop_selected;
+ public bool key_is_pressed;
+ public Gtk.CssProvider css;
+ public JsRender.Node? node_selected;
+
+ // ctor
+ public Xcls_sourceview(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.sourceview = this;
+ this.el = new GtkSource.View();
+
+ // my vars (dec)
+ this.editable_start_pos = -1;
+ this.loading = true;
+ this.button_is_pressed = false;
+ this.prop_selected = "";
+ this.key_is_pressed = false;
+ this.node_selected = null;
+
+ // set gobject values
+ this.el.name = "roo-view";
+ this.el.editable = false;
+ this.el.show_line_marks = true;
+ this.el.show_line_numbers = true;
+ new Xcls_buffer( _this );
+ this.el.set_buffer ( _this.buffer.el );
+ var child_2 = new Xcls_EventControllerKey17( _this );
+ child_2.ref();
+ this.el.add_controller ( child_2.el );
+ var child_3 = new Xcls_GestureClick18( _this );
+ child_3.ref();
+ this.el.add_controller( child_3.el );
+
+ // init method
+
+ {
+
+ this.css = new Gtk.CssProvider();
+
+ this.css.load_from_string(
+ "#roo-view { font: 10px monospace; }"
+ );
+
+ Gtk.StyleContext.add_provider_for_display(
+ this.el.get_display(),
+ this.css,
+ Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
+ );
+
+
+
+ this.loading = true;
+ //var buf = this.el.get_buffer();
+ //buf.notify.connect(this.onCursorChanged);
+
+
+ var attrs = new GtkSource.MarkAttributes();
+ var pink = Gdk.RGBA();
+ pink.parse ( "pink");
+ attrs.set_background ( pink);
+ attrs.set_icon_name ( "process-stop");
+ attrs.query_tooltip_text.connect(( mark) => {
+ //print("tooltip query? %s\n", mark.name);
+ return mark.name;
+ });
+
+ this.el.set_mark_attributes ("ERR", attrs, 1);
+
+ var wattrs = new GtkSource.MarkAttributes();
+ var blue = Gdk.RGBA();
+ blue.parse ( "#ABF4EB");
+ wattrs.set_background ( blue);
+ wattrs.set_icon_name ( "process-stop");
+ wattrs.query_tooltip_text.connect(( mark) => {
+ //print("tooltip query? %s\n", mark.name);
+ return mark.name;
+ });
+
+ this.el.set_mark_attributes ("WARN", wattrs, 1);
+
+
+
+ var dattrs = new GtkSource.MarkAttributes();
+ var purple = Gdk.RGBA();
+ purple.parse ( "#EEA9FF");
+ dattrs.set_background ( purple);
+ dattrs.set_icon_name ( "process-stop");
+ dattrs.query_tooltip_text.connect(( mark) => {
+ //print("tooltip query? %s\n", mark.name);
+ return mark.name;
+ });
+
+ this.el.set_mark_attributes ("DEPR", dattrs, 1);
+
+
+ var gattrs = new GtkSource.MarkAttributes();
+ var grey = Gdk.RGBA();
+ grey.parse ( "#ccc");
+ gattrs.set_background ( grey);
+
+
+ this.el.set_mark_attributes ("grey", gattrs, 1);
+
+
+
+
+
+
+ }
+
+ //listeners
+ this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
+
+ //GLib.debug("query tooltip");
+ Gtk.TextIter iter;
+ int trailing;
+
+ var yoff = (int) _this.sourceviewscroll.el.vadjustment.value;
+
+ this.el.get_iter_at_position (out iter, out trailing, x, y + yoff);
+
+ var l = iter.get_line();
+ //GLib.debug("query tooltip line %d", (int) l);
+ var marks = _this.buffer.el.get_source_marks_at_line(l, null);
+ //GLib.debug("query tooltip line marks %d", (int) marks.length());
+ var str = "";
+ marks.@foreach((m) => {
+ //GLib.debug("got mark %s", m.name);
+ str += (str.length > 0 ? "\n" : "") + m.name;
+ });
+ // true if there is a mark..
+ if (str.length > 0 ) {
+ tooltip.set_text( str);
+ }
+ return str.length > 0 ? true : false;
+
+ });
+ }
+
+ // user defined functions
+ public void loadFile ( ) {
+ this.loading = true;
+
+
+ // get the cursor and scroll position....
+ var buf = this.el.get_buffer();
+ var cpos = buf.cursor_position;
+
+ print("BEFORE LOAD cursor = %d\n", cpos);
+
+ var vadj_pos = this.el.get_vadjustment().get_value();
+
+
+
+ buf.set_text("",0);
+ var sbuf = (GtkSource.Buffer) buf;
+
+
+
+ if (_this.file == null || _this.file.xtype != "Roo") {
+ print("xtype != Roo");
+ this.loading = false;
+ return;
+ }
+
+ // get the string from the rendered tree...
+
+ var str = _this.file.toSource();
+
+ // print("setting str %d\n", str.length);
+ buf.set_text(str, str.length);
+ var lm = GtkSource.LanguageManager.get_default();
+
+ //?? is javascript going to work as js?
+
+ ((GtkSource.Buffer)(buf)) .set_language(lm.get_language(_this.file.language));
+
+
+ _this.main_window.windowstate.updateErrorMarksAll();
+
+ // what does this do?
+ GLib.Timeout.add(500, () => {
+
+ print("RESORTING cursor to = %d\n", cpos);
+ Gtk.TextIter cpos_iter;
+ buf.get_iter_at_offset(out cpos_iter, cpos);
+ buf.place_cursor(cpos_iter);
+
+ this.el.get_vadjustment().set_value(vadj_pos);;
+
+
+ this.onCursorChanged();
+
+
+ //_this.buffer.checkSyntax();
+ return false;
+ });
+
+ this.loading = false;
+ _this.buffer.dirty = false;
+ }
+ public void onCursorChanged (/*ParamSpec ps*/) {
+
+ if (!this.key_is_pressed && !this.button_is_pressed) {
+ return;
+ }
+
+ if (this.loading) {
+ return;
+ }
+ // if (ps.name != "cursor-position") {
+ // return;
+ // }
+
+ var buf = this.el.get_buffer();
+ //print("cursor changed : %d\n", buf.cursor_position);
+ Gtk.TextIter cpos;
+ buf.get_iter_at_offset(out cpos, buf.cursor_position);
+
+ var ln = cpos.get_line();
+
+
+ // --- select node at line....
+
+ var node = _this.file.lineToNode(ln+1);
+
+ if (node == null) {
+ print("can not find node\n");
+ return;
+ }
+ var prop = node.lineToProp(ln+1);
+ print("prop : %s", prop == null ? "???" : prop.name);
+
+
+ // ---------- this selects the tree's node...
+
+ var ltree = _this.main_window.windowstate.left_tree;
+ ltree.model.selectNode(node);
+
+
+ //print("changing cursor on tree..\n");
+
+
+
+ // let's try allowing editing on the methods.
+ // a little klunky at present..
+ this.prop_selected = "";
+ /*
+ if (prop != null) {
+ //see if we can find it..
+ var kv = prop.split(":");
+ if (kv[0] == "p") {
+
+ //var k = prop.get_key(kv[1]);
+ // fixme -- need to determine if it's an editable property...
+ this.prop_selected = prop;
+
+ } else if (kv[0] == "l") {
+ this.prop_selected = prop;
+
+ }
+ }
+ */
+ // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false);
+ //this.nodeSelected(node,false);
+
+ // scrolling is disabled... as node selection calls scroll 10ms after it changes.
+
+
+ // highlight the node..
+ }
+ public void nodeSelected (JsRender.Node? sel, bool scroll ) {
+
+
+
+ // this is connected in widnowstate
+
+
+ // not sure why....
+ // while(Gtk.events_pending()) {
+ // Gtk.main_iteration();
+ // }
+
+ this.node_selected = sel;
+
+ // this.updateGreySelection(scroll);
+
+
+
+ }
+ public void updateGreySelection (bool scroll) {
+ var sel = this.node_selected;
+ print("node selected\n");
+ var buf = this.el.get_buffer();
+ var sbuf = (GtkSource.Buffer) buf;
+
+
+ this.clearGreySelection();
+
+
+
+ if (sel == null) {
+ print("no selected node\n");
+ // no highlighting..
+ return;
+ }
+
+ print("highlight region %d to %d\n", sel.line_start,sel.line_end);
+ Gtk.TextIter iter;
+ sbuf.get_iter_at_line(out iter, sel.line_start);
+
+
+ Gtk.TextIter cur_iter;
+ sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);
+
+ var cursor_at_line = cur_iter.get_line();
+
+
+ //var cur_line = cur_iter.get_line();
+ //if (cur_line > sel.line_start && cur_line < sel.line_end) {
+
+ //} else {
+ if (scroll) {
+ print("scrolling to node -- should occur on node picking.\n");
+ this.el.scroll_to_iter(iter, 0.1f, true, 0.0f, 0.5f);
+ }
+
+ var start_line = sel.line_start;
+ var end_line = sel.line_end;
+
+
+ this.el.editable = false;
+
+ //var colon_pos = 0;
+
+ this.editable_start_pos = -1;
+
+ // now if we have selected a property...
+ if (this.prop_selected.length> 0 ) {
+
+ int nstart, nend;
+ if (sel.getPropertyRange(this.prop_selected, out nstart, out nend) && nend > nstart) {
+ start_line = nstart;
+ end_line = nend;
+ // this.el.editable = true; << cant do this!!?
+ print("start line = %d, end line = %d\n", start_line, end_line);
+
+ // see if we are 'right of ':'
+ // get an iter for the start of the line.
+ Gtk.TextIter start_first_line_iter,end_first_line_iter;
+ this.el.buffer.get_iter_at_line(out start_first_line_iter, start_line -1);
+ this.el.buffer.get_iter_at_line(out end_first_line_iter, start_line -1);
+
+
+
+
+ if (end_first_line_iter.forward_to_line_end()) {
+ var first_line = this.el.buffer.get_text(start_first_line_iter, end_first_line_iter, false);
+
+ print("first line = %s\n", first_line);
+ if (first_line.contains(":")) {
+ this.editable_start_pos = start_first_line_iter.get_offset() + first_line.index_of(":") + 1;
+ print("colon_pos = %d\n", this.editable_start_pos);
+ }
+
+
+ //Gtk.TextIter colon_iter;
+ //sbuf.get_iter_at_offset (out colon_iter, colon_pos);
+ //sbuf.create_source_mark(null, "active_text", colon_iter);
+ }
+
+
+
+ //print("is cursor at line? %d ?= %d\n", start_line -1 , cursor_at_line);
+ //if (start_line - 1 == cursor_at_line) {
+ // should be ok - current_posssion can not be less than '-1'...
+ if (sbuf.cursor_position < this.editable_start_pos) {
+
+ print("cursor is before start pos.. - turn off editable...\n");
+ //var before_cursor_string = this.el.buffer.get_text(start_line_iter, cur_iter, false);
+ //print("before cursor string = %s\n", before_cursor_string);
+ //if (!before_cursor_string.contains(":")) {
+ this.el.editable = false;
+ //}
+
+ }
+
+
+
+
+ }
+ print("propSelected = %s range %d -> %d\n", this.prop_selected, start_line, end_line);
+
+
+ }
+
+ print("checking selection\n");
+
+
+ // check selection - if it's out of 'bounds'
+ if (this.el.editable && sbuf.get_has_selection()) {
+ Gtk.TextIter sel_start_iter, sel_end_iter;
+ sbuf.get_selection_bounds(out sel_start_iter, out sel_end_iter);
+
+ if (sel_start_iter.get_line() < start_line || sel_end_iter.get_line() > end_line ||
+ sel_start_iter.get_line() > end_line || sel_end_iter.get_line() < start_line ) {
+ // save?
+ this.el.editable = false;
+ }
+ if (this.editable_start_pos > 0 &&
+ (sel_start_iter.get_offset() < this.editable_start_pos || sel_end_iter.get_offset() < this.editable_start_pos)
+
+ ) {
+ this.el.editable = false;
+ }
+
+
+
+ }
+
+
+
+
+ for (var i = 0; i < buf.get_line_count();i++) {
+ if (i < (start_line -1) || i > (end_line -1)) {
+
+ sbuf.get_iter_at_line(out iter, i);
+ sbuf.create_source_mark(null, "grey", iter);
+
+ }
+
+ }
+ if (scroll && (cursor_at_line > end_line || cursor_at_line < start_line)) {
+ Gtk.TextIter cpos_iter;
+ buf.get_iter_at_line(out cpos_iter, start_line);
+
+ buf.place_cursor(cpos_iter);
+ }
+
+
+ }
+ public void highlightErrorsJson (string type, Json.Object obj) {
+ // this is a hook for the vala code - it has no value in javascript
+ // as we only have one error ususally....
+ return ;
+
+
+
+
+ }
+ public void clearGreySelection () {
+ // clear all the marks..
+ var sbuf = (GtkSource.Buffer)this.el.buffer;
+
+ Gtk.TextIter start;
+ Gtk.TextIter end;
+
+ sbuf.get_bounds (out start, out end);
+ sbuf.remove_source_marks (start, end, "grey");
+
+
+ }
+ 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 class Xcls_buffer : Object
+ {
+ public GtkSource.Buffer el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+ public int error_line;
+ public bool dirty;
+
+ // ctor
+ public Xcls_buffer(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.buffer = this;
+ this.el = new GtkSource.Buffer( null );
+
+ // my vars (dec)
+ this.error_line = -1;
+ this.dirty = false;
+
+ // set gobject values
+
+ //listeners
+ this.el.changed.connect( () => {
+
+ // check syntax??
+ // ??needed..??
+ // _this.save_button.el.sensitive = true;
+ ///?? has changed occured during loading?
+
+ // only trigger this if
+
+
+
+
+ if (_this.sourceview.loading) {
+ return;
+ }
+
+
+
+ print("- PREVIEW EDITOR CHANGED--");
+
+ this.dirty = true;
+ // this.checkSyntax(); // this calls backs and highlights errors.. in theory...
+
+
+
+ if (!_this.sourceview.button_is_pressed && !_this.sourceview.key_is_pressed) {
+ print("button or key not pressed to generate change?!\n");
+ return;
+ }
+
+
+ // what are we editing??
+ if (null == _this.sourceview.node_selected || _this.sourceview.prop_selected.length < 1) {
+ return;
+ }
+
+ // find the colon on the first line...
+
+ if (_this.sourceview.editable_start_pos > -1) {
+
+ var buf = (GtkSource.Buffer)_this.sourceview.el.get_buffer();
+
+ //print("cursor changed : %d\n", buf.cursor_position);
+ Gtk.TextIter spos,epos;
+ buf.get_iter_at_offset(out spos, _this.sourceview.editable_start_pos);
+ buf.get_iter_at_offset(out epos, _this.sourceview.editable_start_pos); // initialize epos..
+
+ var gotit= false;
+ var line = spos.get_line();
+ var endline = buf.get_line_count();
+ while (line < endline) {
+ line++;
+ buf.get_iter_at_line(out epos, line);
+ if (buf.get_source_marks_at_line(line, "grey").length() > 0) {
+ buf.get_iter_at_line(out epos, line);
+ gotit=true;
+ break;
+ }
+ }
+
+ if (gotit) {
+ print("End Offset = %d/%d\n", epos.get_line(), epos.get_offset());
+ // get the pos...
+ // in theory the last char will be '}' or '},' .. or ','
+ // we should chop the ',' of the end...
+ var str = buf.get_text(spos, epos, false);
+ print("got string\n%s\n", str);
+
+ }
+ }
+ return ;
+ });
+ }
+
+ // user defined functions
+ public bool highlightErrors ( Gee.HashMap<int,string> validate_res) {
+
+ this.error_line = validate_res.size;
+
+ if (this.error_line < 1) {
+ return true;
+ }
+ var tlines = this.el.get_line_count ();
+ Gtk.TextIter iter;
+ var valiter = validate_res.map_iterator();
+ while (valiter.next()) {
+
+ // print("get inter\n");
+ var eline = valiter.get_key();
+ if (eline > tlines) {
+ continue;
+ }
+ this.el.get_iter_at_line( out iter, eline);
+ //print("mark line\n");
+ this.el.create_source_mark(valiter.get_value(), "ERR", iter);
+ }
+ return false;
+ }
+ public string toString () {
+
+ Gtk.TextIter s;
+ Gtk.TextIter e;
+ this.el.get_start_iter(out s);
+ this.el.get_end_iter(out e);
+ var ret = this.el.get_text(s,e,true);
+ //print("TO STRING? " + ret);
+ return ret;
+ }
+ }
+
+ public class Xcls_EventControllerKey17 : Object
+ {
+ public Gtk.EventControllerKey el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_EventControllerKey17(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.EventControllerKey();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.key_pressed.connect( (keyval, keycode, state) => {
+
+
+
+ if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
+ GLib.debug("SAVE: ctrl-g pressed");
+ _this.forwardSearch(true);
+ return false;
+ }
+ if (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
+ GLib.debug("SAVE: ctrl-f pressed");
+ _this.search_entry.el.grab_focus();
+ return false ;
+ }
+
+ //this.button_is_pressed = true;
+ //return false;
+ // print(event.key.keyval)
+
+ return false;
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_GestureClick18 : Object
+ {
+ public Gtk.GestureClick el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_GestureClick18(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.GestureClick();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.released.connect( (n_press, x, y) => {
+
+ print("BUTTON RELEASE EVENT\n");
+ _this.sourceview.onCursorChanged();
+ //this.button_is_pressed = false;
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+
+ public class Xcls_Box19 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box19(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.homogeneous = false;
+ this.el.vexpand = false;
+ new Xcls_search_entry( _this );
+ this.el.append( _this.search_entry.el );
+ new Xcls_search_results( _this );
+ this.el.append( _this.search_results.el );
+ new Xcls_nextBtn( _this );
+ this.el.append( _this.nextBtn.el );
+ new Xcls_backBtn( _this );
+ this.el.append( _this.backBtn.el );
+ var child_5 = new Xcls_MenuButton25( _this );
+ child_5.ref();
+ this.el.append( child_5.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_search_entry : Object
+ {
+ public Gtk.SearchEntry el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+ public Gtk.CssProvider css;
+
+ // ctor
+ public Xcls_search_entry(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.search_entry = this;
+ this.el = new Gtk.SearchEntry();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.name = "roo-search-entry";
+ this.el.hexpand = true;
+ this.el.placeholder_text = "Press enter to search";
+ var child_1 = new Xcls_EventControllerKey21( _this );
+ child_1.ref();
+ this.el.add_controller( child_1.el );
+
+ // init method
+
+ this.css = new Gtk.CssProvider();
+
+ this.css.load_from_string(
+ "#roo-search-entry { background-color: #ccc; }"
+ );
+
+ Gtk.StyleContext.add_provider_for_display(
+ this.el.get_display(),
+ this.css,
+ Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
+ );
+
+ //listeners
+ this.el.search_changed.connect( ( ) => {
+
+ _this.search(_this.search_entry.el.text);
+ _this.search_results.updateResults();
+
+ GLib.Timeout.add_seconds(1,() => {
+ _this.search_results.updateResults();
+ return false;
+ });
+ });
+ }
+
+ // user defined functions
+ public void forwardSearch (bool change_focus) {
+
+
+ _this.forwardSearch(change_focus);
+
+ /*
+
+ switch(_this.windowstate.state) {
+ case WindowState.State.CODEONLY:
+ //case WindowState.State.CODE:
+ // search the code being edited..
+ _this.windowstate.code_editor_tab.forwardSearch(change_focus);
+
+ break;
+ case WindowState.State.PREVIEW:
+ if (_this.windowstate.file.xtype == "Gtk") {
+ _this.windowstate.window_gladeview.forwardSearch(change_focus);
+ } else {
+ _this.windowstate.window_rooview.forwardSearch(change_focus);
+ }
+
+ break;
+ }
+ */
+
+ }
+ }
+ public class Xcls_EventControllerKey21 : Object
+ {
+ public Gtk.EventControllerKey el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_EventControllerKey21(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.EventControllerKey();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.key_pressed.connect( (keyval, keycode, state) => {
+
+ if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
+ GLib.debug("SAVE: ctrl-g pressed");
+ _this.forwardSearch(true);
+ return true;
+ }
+
+
+ if (keyval == Gdk.Key.Return) {
+ _this.forwardSearch(true);
+
+
+ return true;
+
+ }
+ // print(event.key.keyval)
+
+ return false;
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_search_results : Object
+ {
+ public Gtk.Label el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_search_results(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.search_results = this;
+ this.el = new Gtk.Label( "No Results" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.margin_end = 4;
+ this.el.margin_start = 4;
+ }
+
+ // user defined functions
+ public void updateResults () {
+ this.el.visible = true;
+
+ var res = _this.searchcontext.get_occurrences_count();
+ if (res < 0) {
+ _this.search_results.el.label = "??? Matches";
+ return;
+ }
+
+ _this.nextBtn.el.sensitive = false;
+ _this.backBtn.el.sensitive = false;
+
+ if (res > 0) {
+ _this.search_results.el.label = "%d Matches".printf(res);
+ _this.nextBtn.el.sensitive = true;
+ _this.backBtn.el.sensitive = true;
+ return;
+ }
+ _this.search_results.el.label = "No Matches";
+
+ }
+ }
+
+ public class Xcls_nextBtn : Object
+ {
+ public Gtk.Button el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+ public bool always_show_image;
+
+ // ctor
+ public Xcls_nextBtn(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.nextBtn = this;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+ this.always_show_image = true;
+
+ // set gobject values
+ this.el.icon_name = "go-down";
+ this.el.sensitive = false;
+
+ //listeners
+ this.el.clicked.connect( (event) => {
+
+ _this.forwardSearch(true);
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_backBtn : Object
+ {
+ public Gtk.Button el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+ public bool always_show_image;
+
+ // ctor
+ public Xcls_backBtn(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.backBtn = this;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+ this.always_show_image = true;
+
+ // set gobject values
+ this.el.icon_name = "go-up";
+ this.el.sensitive = false;
+
+ //listeners
+ this.el.clicked.connect( (event) => {
+
+ _this.backSearch(true);
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_MenuButton25 : Object
+ {
+ public Gtk.MenuButton el;
+ private Xcls_WindowRooView _this;
+
+
+ // my vars (def)
+ public bool always_show_image;
+
+ // ctor
+ public Xcls_MenuButton25(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.MenuButton();
+
+ // my vars (dec)
+ this.always_show_image = true;
+
+ // set gobject values
+ this.el.icon_name = "emblem-system";
+ new Xcls_search_settings( _this );
+ this.el.popover = _this.search_settings.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_search_settings : Object
+ {
+ public Gtk.Popover el;
+ private Xcls_WindowRooView _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_search_settings(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.search_settings = this;
- this.el = new Gtk.Popover();
-
- // my vars (dec)
+ // ctor
+ public Xcls_search_settings(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.search_settings = this;
+ this.el = new Gtk.Popover();
+
+ // my vars (dec)
- // set gobject values
- var child_1 = new Xcls_Box26( _this );
- this.el.child = child_1.el;
- }
+ // set gobject values
+ var child_1 = new Xcls_Box27( _this );
+ this.el.child = child_1.el;
+ }
- // user defined functions
- }
- public class Xcls_Box26 : Object
- {
- public Gtk.Box el;
- private Xcls_WindowRooView _this;
+ // user defined functions
+ }
+ public class Xcls_Box27 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_WindowRooView _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Box26(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ // ctor
+ public Xcls_Box27(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- new Xcls_case_sensitive( _this );
- this.el.append( _this.case_sensitive.el );
- new Xcls_regex( _this );
- this.el.append( _this.regex.el );
- new Xcls_multiline( _this );
- this.el.append( _this.multiline.el );
- }
+ // set gobject values
+ new Xcls_case_sensitive( _this );
+ this.el.append( _this.case_sensitive.el );
+ new Xcls_regex( _this );
+ this.el.append( _this.regex.el );
+ new Xcls_multiline( _this );
+ this.el.append( _this.multiline.el );
+ }
- // user defined functions
- }
- public class Xcls_case_sensitive : Object
- {
- public Gtk.CheckButton el;
- private Xcls_WindowRooView _this;
+ // user defined functions
+ }
+ public class Xcls_case_sensitive : Object
+ {
+ public Gtk.CheckButton el;
+ private Xcls_WindowRooView _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_case_sensitive(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.case_sensitive = this;
- this.el = new Gtk.CheckButton();
+ // ctor
+ public Xcls_case_sensitive(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.case_sensitive = this;
+ this.el = new Gtk.CheckButton();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.label = "Case Sensitive";
+ // set gobject values
+ this.el.label = "Case Sensitive";
- // init method
+ // init method
- {
- this.el.show();
- }
- }
+ {
+ this.el.show();
+ }
+ }
- // user defined functions
- }
+ // user defined functions
+ }
- public class Xcls_regex : Object
- {
- public Gtk.CheckButton el;
- private Xcls_WindowRooView _this;
+ public class Xcls_regex : Object
+ {
+ public Gtk.CheckButton el;
+ private Xcls_WindowRooView _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_regex(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.regex = this;
- this.el = new Gtk.CheckButton();
+ // ctor
+ public Xcls_regex(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.regex = this;
+ this.el = new Gtk.CheckButton();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.label = "Regex";
+ // set gobject values
+ this.el.label = "Regex";
- // init method
+ // init method
- {
- this.el.show();
- }
- }
+ {
+ this.el.show();
+ }
+ }
- // user defined functions
- }
+ // user defined functions
+ }
- public class Xcls_multiline : Object
- {
- public Gtk.CheckButton el;
- private Xcls_WindowRooView _this;
+ public class Xcls_multiline : Object
+ {
+ public Gtk.CheckButton el;
+ private Xcls_WindowRooView _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_multiline(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.multiline = this;
- this.el = new Gtk.CheckButton();
+ // ctor
+ public Xcls_multiline(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.multiline = this;
+ this.el = new Gtk.CheckButton();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.label = "Multi-line (add \\n)";
+ // set gobject values
+ this.el.label = "Multi-line (add \\n)";
- // init method
+ // init method
- {
- this.el.show();
- }
- }
+ {
+ this.el.show();
+ }
+ }
- // user defined functions
- }
+ // user defined functions
+ }
-}
+ }
BuilderApplication.updateWindows();
file.getLanguageServer().document_open(file);
- BuilderApplication.showSpinner("spinner", "document open sent");
+
if (file.xtype == "PlainFile") {
this.win.codeeditviewbox.el.show();
}
-
+
+
+
+
this.gotoLine(line);
return;
}
this.rightpalete.hide();
- if (this.add_props.el.parent == null) {
- this.add_props.el.set_parent(btn);
- }
+ this.add_props.el.set_parent(btn);
this.add_props.el.set_position(Gtk.PositionType.RIGHT);
this.add_props.show(
}
public override void setSource(string str) {}
- int last_source_version = -2;
- string last_source;
public override string toSourceCode() // no seed support currently.
{
- if (this.version == this.last_source_version) {
- return this.last_source;
- }
- this.last_source = NodeToVala.mungeFile(this);
- this.last_source_version = this.version;
- return this.last_source;
-
+ return NodeToVala.mungeFile(this);
}
// this is only used by dumping code...
public override string toSource() // no seed support currently.
{
- return this.toSourceCode();
+ return NodeToVala.mungeFile(this);
}
// this.saveJS(); - disabled at present.. project settings will probably enable this later..
this.saveVala();
-
this.getLanguageServer().document_save(this);
- BuilderApplication.showSpinner("spinner", "document save send");
}
// ignore these calls.
public override void saveHTML ( string html ) {}
private int _version = 1; // should we increment this based on the node..?
public int version {
get {
- if (this.tree != null) {
- return this.tree.updated_count;
- }
return ++this._version; // increased on every call? - bit of a kludge until we do real versioning
}
private set {
public signal void compile_notice(string type, string file, int line, string message);
- private GLib.Icon? _icon = null;
-
- public GLib.Icon? icon {
- private set {}
- get {
- if (this._icon != null) {
- return this._icon;
- }
-
- if (this.path == "") {
- return null;
- }
- if (!GLib.FileUtils.test(this.path, GLib.FileTest.EXISTS)) {
- return null;
- }
- this._icon = File.new_for_path(this.path).query_info("standard::icon",GLib.FileQueryInfoFlags.NONE).get_icon();
- return this._icon;
- }
- }
+
/**
* UI componenets
this.doubleStringProps = new Gee.ArrayList<string>();
this.childfiles = new GLib.ListStore(typeof(JsRender));
this.errorsByType = new Gee.HashMap<string, GLib.ListStore>();
-
-
+ if (this.relpath == "src/Lsp.vala") {
+ GLib.debug("got testing lsp");
+ }
}
GLib.debug("Width %d, Height %d", widget.get_width(), widget.get_height());
p.snapshot(s, widget.get_width(), widget.get_height());
var n = s.free_to_node();
- if (n == null) {
- return;
- }
var r = new Gsk.CairoRenderer();
r.realize(null);
var t = r.render_texture(n,null);
GLib.debug("write to %s", filename);
- t.save_to_png(filename);
+ t.save_to_png(filename);
r.unrealize();
set {
this.nodeTitleProp = ""; // ?? should trigger set?
this.iconFilename = "";
- this._updated_count = value;
- if (this.parent != null) {
- this.parent.updated_count++;
- }
+ this. _updated_count = value;
}
} // changes to this trigger updates on the tree..
switch(prop.ptype) {
case PROP:
case RAW: // should they be the same?
-
+
props += "\n\t" + GLib.Markup.escape_text(prop.rtype) +
" <b>" + GLib.Markup.escape_text(i) +"</b> : " +
- GLib.Markup.escape_text(val == "" ? "" : val.split("\n")[0]);
+ GLib.Markup.escape_text(val.split("\n")[0]);
break;
case METHOD :
-
funcs += "\n\t" + GLib.Markup.escape_text(prop.rtype) +
" <b>" + GLib.Markup.escape_text(i) +"</b> : " +
- GLib.Markup.escape_text(val == "" ? "" : val.split("\n")[0]);
+ GLib.Markup.escape_text(val.split("\n")[0]);
break;
case USER : // user defined.
-
uprops += "\n\t<b>" +
GLib.Markup.escape_text(i) +"</b> : " +
- GLib.Markup.escape_text(val == "" ? "" : val.split("\n")[0]);
+ GLib.Markup.escape_text(val.split("\n")[0]);
break;
case SPECIAL : // * prop| args | ctor | init
-
-
spec += "\n\t<b>" +
GLib.Markup.escape_text(i) +"</b> : " +
- GLib.Markup.escape_text(val == "" ? "" : val.split("\n")[0]);
+ GLib.Markup.escape_text(val.split("\n")[0]);
break;
case LISTENER : return ""; // always raw...
public void add_prop(NodeProp prop)
{
- if (this.has_prop_key(prop) && !prop.to_index_key().has_suffix("[]")) {
- GLib.warning("duplicate key' %s'- can not add - call has_prop_key first", prop.to_index_key());
- return;
+ if (this.has_prop_key(prop)) {
+ GLib.error("duplicate key - can not add - call has_prop_key first");
}
prop.parent = this;
this.propstore.append(prop);
this.rtype = rtype;
this.val = val;
this.childstore = new GLib.ListStore( typeof(NodeProp));
-
}
var pviter = props.map_iterator();
while (!skip_props && pviter.next()) {
- //GLib.debug ("Check: " +cls + "::(" + pviter.get_value().propertyof + ")" + pviter.get_key() + " " );
+ GLib.debug ("Check: " +cls + "::(" + pviter.get_value().propertyof + ")" + pviter.get_key() + " " );
// skip items we have already handled..
if (!this.node.has(pviter.get_key())) {
this.node = node;
this.depth = depth;
if (file.name.contains(".")) { // namespaced..
- this.inpad = string.nfill(depth > 0 ? 2 : 1, '\t');
+ this.inpad = string.nfill(depth > 0 ? 8 : 4, ' ');
} else {
- this.inpad = string.nfill(depth > 0 ? 1 : 0, '\t');
+ this.inpad = string.nfill(depth > 0 ? 8 : 4, ' ');
}
- this.pad = this.inpad + "\t";
- this.ipad = this.inpad + "\t\t";
+ this.pad = this.inpad + " ";
+ this.ipad = this.inpad + " ";
this.cls = node.xvala_cls;
this.xcls = node.xvala_xcls;
if (depth == 0 && this.xcls.contains(".")) {
}
public void addLine(string str= "")
{
-
- if (str.contains("\n")) {
- this.addMultiLine(str);
- return;
- }
this.cur_line++;
- if (BuilderApplication.opt_bjs_compile != null) {
- this.ret += "/*%d*/ ".printf(this.cur_line) + str + "\n";
- } else {
- this.ret += str + "\n";
- }
+ //this.ret += "/*%d*/ ".printf(this.cur_line-1) + str + "\n";
+ this.ret += str + "\n";
}
public void addMultiLine(string str= "")
{
return node;
}
- public bool deserialize_property (string property_name, out Value value, ParamSpec pspec, Json.Node property_node)
- {
-
- if (property_name != "children") {
- return default_deserialize_property (property_name, out value, pspec, property_node);
- }
- value = GLib.Value (GLib.Type.BOXED);
- if (property_node.get_node_type () != Json.NodeType.ARRAY) {
- warning ("unexpected property node type for 'arguments' %s", property_node.get_node_type ().to_string ());
- return false;
- }
-
- var arguments = new Gee.ArrayList<DocumentSymbol>();
-
- property_node.get_array ().foreach_element ((array, index, element) => {
-
- var add= Json.gobject_deserialize ( typeof (DocumentSymbol), array.get_element(index)) as DocumentSymbol;
- arguments.add( add);
-
-
- });
-
- value.set_boxed (arguments);
- return true;
- }
+ public bool deserialize_property (string property_name, out Value value, ParamSpec pspec, Json.Node property_node) {
+ error ("deserialization not supported");
+ }
}
public class SymbolInformation : Object {
if (property_name != "tags") {
return default_deserialize_property (property_name, out value, pspec, property_node);
}
- value = GLib.Value (GLib.Type.BOXED);
if (property_node.get_node_type () != Json.NodeType.ARRAY) {
warning ("unexpected property node type for 'arguments' %s", property_node.get_node_type ().to_string ());
return false;
return node;
}
- public bool deserialize_property (string property_name, out GLib.Value value, GLib.ParamSpec pspec, Json.Node property_node)
- {
+ public bool deserialize_property (string property_name, out GLib.Value value, GLib.ParamSpec pspec, Json.Node property_node) {
if (property_name == "arguments") {
- value = GLib.Value (GLib.Type.BOXED);
+ value = Value (typeof (Array));
if (property_node.get_node_type () != Json.NodeType.ARRAY) {
warning ("unexpected property node type for 'arguments' %s", property_node.get_node_type ().to_string ());
return false;
Palete/RooDatabase.vala \
Palete/Palete.vala \
Palete/Roo.vala \
+ Palete/ValaSource.vala \
Palete/ValaSourceCompiler.vala \
Palete/CompletionProvider.vala \
Palete/CompileError.vala \
this.msg = msg;
this.file = file;
this.category = category;
-
+
}
this.line = (int) diag.range.start.line;
this.msg = diag.message;
this.lines = new GLib.ListStore(typeof(CompileError));
- //GLib.debug("new error %s : %d %s %s", file.path, this.line, this.category, this.msg);
+ GLib.debug("new error %s : %d %s %s", file.path, this.line, this.category, this.msg);
public void activate (GtkSource.CompletionContext context, GtkSource.CompletionProposal proposal)
{
GLib.debug("compelte activate");
-
var p = (CompletionProposal) proposal;
- GLib.debug("lsp says use %s", p.ci.insertText);
-
-
global::Gtk.TextMark end_mark = null;
global::Gtk.TextIter begin, end;
var buffer = begin.get_buffer();
var word = p.label;
- if (p.ci.kind == Lsp.CompletionItemKind.Method || p.ci.kind == Lsp.CompletionItemKind.Function) {
- var bits = p.text.split("(");
- var abits = bits[1].split(")");
- var args = abits[0].split(",");
-
- word += "(";
- for(var i = 0 ; i < args.length; i++) {
- word += i > 0 ? ", " : " ";
- var wbit = args[i].strip().split(" ");
- var ty = wbit[wbit.length - 2];
- ty = ty.has_suffix("?") ? "?" : "";
- word += ty + wbit[wbit.length-1]; // property type..?
- }
- word += args.length > 0 ? " )" : ")";
- }
-
var len = -1;
public void display (GtkSource.CompletionContext context, GtkSource.CompletionProposal proposal, GtkSource.CompletionCell cell)
{
- //GLib.debug("compelte display");
+ GLib.debug("compelte display");
var col = cell.get_column();
var p = (CompletionProposal) proposal;
cell.set_text(p.label);
break;
case GtkSource.CompletionColumn.ICON:
-//cell.set_icon_name("lang-define-symbolic");return;
-//cell.set_icon_name("lang-include-symbolic");return;
-//cell.set_icon_name("lang-typedef-symbolic");return;
-//cell.set_icon_name("lang-union-symbolic");return;
- switch (p.ci.kind) {
-
- case Lsp.CompletionItemKind.Text: cell.set_icon_name("completion-snippet-symbolic");return;
- case Lsp.CompletionItemKind.Method: cell.set_icon_name("lang-method-symbolic");return;
- case Lsp.CompletionItemKind.Function: cell.set_icon_name("lang-function-symbolic");return;
- case Lsp.CompletionItemKind.Constructor: cell.set_icon_name("lang-method-symbolic");return;
- case Lsp.CompletionItemKind.Field: cell.set_icon_name("lang-struct-field-symbolic");return;
- case Lsp.CompletionItemKind.Variable: cell.set_icon_name("lang-variable-symbolic");return;
- case Lsp.CompletionItemKind.Class: cell.set_icon_name("lang-class-symbolic");return;
- case Lsp.CompletionItemKind.Interface: cell.set_icon_name("lang-class-symbolic");return;
- case Lsp.CompletionItemKind.Module: cell.set_icon_name("lang-namespace-symbolic");return;
- case Lsp.CompletionItemKind.Property:cell.set_icon_name("lang-struct-field-symbolic");return;
- case Lsp.CompletionItemKind.Unit: cell.set_icon_name("lang-variable-symbolic");return;
- case Lsp.CompletionItemKind.Value: cell.set_icon_name("lang-variable-symbolic");return;
- case Lsp.CompletionItemKind.Enum: cell.set_icon_name("lang-enum-symbolic");return;
- case Lsp.CompletionItemKind.Keyword: cell.set_icon_name("completion-word-symbolic");return;
- case Lsp.CompletionItemKind.Snippet: cell.set_icon_name("completion-snippet-symbolic");return;
-
- case Lsp.CompletionItemKind.Color: cell.set_icon_name("lang-typedef-symbolic");return;
- case Lsp.CompletionItemKind.File:cell.set_icon_name("lang-typedef-symbolic");return;
- case Lsp.CompletionItemKind.Reference: cell.set_icon_name("lang-typedef-symbolic");return;
- case Lsp.CompletionItemKind.Folder:cell.set_icon_name("lang-typedef-symbolic");return;
- case Lsp.CompletionItemKind.EnumMember: cell.set_icon_name("lang-typedef-symbolic");return;
- case Lsp.CompletionItemKind.Constant:cell.set_icon_name("lang-typedef-symbolic");return;
- case Lsp.CompletionItemKind.Struct: cell.set_icon_name("lang-struct-symbolic");return;
- case Lsp.CompletionItemKind.Event:cell.set_icon_name("lang-typedef-symbolic");return;
- case Lsp.CompletionItemKind.Operator:cell.set_icon_name("lang-typedef-symbolic");return;
- case Lsp.CompletionItemKind.TypeParameter:cell.set_icon_name("lang-typedef-symbolic");return;
- default:
-
-
-
-
- cell.set_icon_name("completion-snippet-symbolic");
- return;
- }
-
-
+ cell.set_icon_name("completion-snippet-symbolic");
+ break;
case GtkSource.CompletionColumn.COMMENT:
- cell.set_text(p.text);
+ cell.set_text(p.info);
break;
case GtkSource.CompletionColumn.DETAILS:
- if (p.ci.documentation != null) {
- cell.set_text(p.ci.documentation.value);
- return;
- }
-
cell.set_text(p.text);
break;
default:
}
}
- bool in_populate = false;
+
- internal async GLib.ListModel populate_async (GtkSource.CompletionContext context, GLib.Cancellable? cancellable)
+ internal async GLib.ListModel populate_async (GtkSource.CompletionContext context, GLib.Cancellable? cancellable)
{
GLib.debug("pupoulate async");
- /*if (!this.in_populate) {
- GLib.debug("pupoulate async - skipped waiting for reply");
- return null;
- }
- this.in_populate = true;
-*/
+
global::Gtk.TextIter begin, end;
Lsp.CompletionList res;
if (context.get_bounds (out begin, out end)) {
- var line = end.get_line();
- var offset = end.get_line_offset();
- if (this.editor.prop != null) {
- // tried line -1 (does not work)
-
- line += this.editor.prop.start_line ;
- // this is based on Gtk using tabs (hence 1/2 chars);
- offset += this.editor.file.file_namespace == "" ? 1 : 2;
- }
-
- this.file.getLanguageServer().document_change_real(this.file, this.editor.tempFileContents());
- try {
- res = yield this.file.getLanguageServer().completion(this.file, line, offset, 1);
- } catch (GLib.Error e) {
- GLib.debug("got error %s", e.message);
- res = null;
- }
-
+ yield this.file.getLanguageServer().completion(this.file, end.get_line(), end.get_line_offset(), 1, out res);
} else {
res = null;
}
-
- GLib.debug("pupoulate async - got reply");
this.model = new CompletionModel(this, context, res, cancellable);
var word = context.get_word();
var filter_model = new global::Gtk.FilterListModel(this.model, this.filter);
filter.match_mode = global::Gtk.StringFilterMatchMode.PREFIX;
filter_model.set_incremental(true);
- this.in_populate = false;
return filter_model;
internal void refilter (GtkSource.CompletionContext context, GLib.ListModel in_model)
{
- //GLib.debug("pupoulate refilter");
+ GLib.debug("pupoulate refilter");
var word = context.get_word();
}
items.sort((a, b) => {
- return ((string)(a.label)).collate((string)(b.label));
+ return ((string)(a.text)).collate((string)(b.text));
});
}
public string text { get; set; default = ""; }
public string info { get; set; default = ""; }
-
- public Lsp.CompletionItem ci;
-
public CompletionProposal(Lsp.CompletionItem ci) //string label, string text, string info)
{
- this.ci = ci;
+
this.text = ci.detail == null ? "" : ci.detail ;
this.label = ci.label;
this.info = ci.documentation == null ? "": ci.documentation.value;
- //GLib.debug("SET: detail =%s, label = %s; info =%s", ci.detail, ci.label, "to long..");
+ GLib.debug("SET: text=%s, label = %s; info =%s", ci.detail, ci.label, "to long..");
}
}
namespace Palete {
- public enum LanguageClientAction {
- INIT,
- LAUNCH,
- ACCEPT,
-
- DIAG,
- OPEN,
- SAVE,
- CLOSE,
- CHANGE,
- TERM,
- COMPLETE,
- COMPLETE_REPLY,
-
- RESTART,
- ERROR,
- ERROR_START,
- ERROR_RPC,
- ERROR_REPLY,
-
- EXIT,
- }
+
public abstract class LanguageClient : Jsonrpc.Server {
public Project.Project project;
- private GLib.SubprocessLauncher launcher = null;
- private GLib.Subprocess? subprocess = null;
- private IOStream? subprocess_stream = null;
+ private GLib.SubprocessLauncher launcher;
+ private GLib.Subprocess subprocess;
+ private IOStream subprocess_stream;
public Jsonrpc.Client? jsonrpc_client = null;
- Gee.ArrayList<JsRender.JsRender> open_files;
- private JsRender.JsRender? _change_queue_file = null;
- private string change_queue_file_source = "";
-
- JsRender.JsRender? change_queue_file {
- set {
- this.change_queue_file_source = value == null ? "" : value.toSource();
- this._change_queue_file = value;
- }
- get {
- return this._change_queue_file;
- }
- }
-
- uint change_queue_id = 0;
- int countdown = 0;
- protected bool initialized = false;
- bool sent_shutdown = false;
- private bool _closed = false;
- private bool closed {
- get { return this._closed ; }
- set {
- GLib.debug("closed has been set? to %s" , value ? "TRUE" : "FALSE" );
- this._closed = value;
- }
- }
-
- public signal void log(LanguageClientAction action, string message);
-
-
protected LanguageClient(Project.Project project)
{
// extend versions will proably call initialize to start and connect to server.
this.project = project;
- this.open_files = new Gee.ArrayList<JsRender.JsRender>();
- this.change_queue_id = GLib.Timeout.add_seconds(1, () => {
- if (this.change_queue_file == null) {
- return true;
- }
- this.countdown--;
- if (this.countdown < 0){
- this.document_change_real(this.change_queue_file, this.change_queue_file_source);
- this.change_queue_file = null;
-
- }
- return true;
- });
+
}
public bool initProcess(string process_path)
{
- this.onClose();
- this.log(LanguageClientAction.LAUNCH, process_path);
- GLib.debug("Launching %s", process_path);
this.launcher = new GLib.SubprocessLauncher (SubprocessFlags.STDIN_PIPE | SubprocessFlags.STDOUT_PIPE);
this.launcher.set_environ(GLib.Environ.get());
try {
-
-
this.subprocess = launcher.spawnv ({ process_path });
-
- this.subprocess.wait_async.begin( null, ( obj,res ) => {
- try {
- this.subprocess.wait_async.end(res);
- } catch (GLib.Error e) {
- this.log(LanguageClientAction.ERROR_START, e.message);
- GLib.debug("subprocess startup error %s", e.message);
- }
- this.log(LanguageClientAction.EXIT, "process ended");
- GLib.debug("Subprocess ended %s", process_path);
- this.onClose();
-
- });
var input_stream = this.subprocess.get_stdout_pipe ();
var output_stream = this.subprocess.get_stdin_pipe ();
if (!GLib.Unix.set_fd_nonblocking(((GLib.UnixInputStream)input_stream).fd, true)
|| !GLib.Unix.set_fd_nonblocking (((GLib.UnixOutputStream)output_stream).fd, true))
{
- GLib.debug("could not set pipes to nonblocking");
- this.onClose();
+ GLib.debug("could not set pipes to nonblocking");
return false;
}
}
- this.subprocess_stream = new GLib.SimpleIOStream (input_stream, output_stream);
+ this.subprocess_stream = new SimpleIOStream (input_stream, output_stream);
this.accept_io_stream ( this.subprocess_stream);
} catch (GLib.Error e) {
- this.log(LanguageClientAction.ERROR_START, e.message);
- GLib.debug("subprocess startup error %s", e.message);
- this.onClose();
+ GLib.debug("subprocess startup error %s", e.message);
return false;
}
return true;
}
- bool in_close = false;
- protected void onClose()
- {
- if (this.in_close) {
- return;
- }
- if (this.launcher == null) {
- return;
- }
- this.in_close = true;
- GLib.debug("onClose called");
-
- if (this.jsonrpc_client != null) {
- try {
- this.jsonrpc_client.close();
- } catch (GLib.Error e) {
- GLib.debug("rpc Error close error %s", e.message);
- }
- }
- if (this.subprocess_stream != null) {
- try {
- this.subprocess_stream.close();
- } catch (GLib.Error e) {
- GLib.debug("stream Error close %s", e.message);
- }
- }
- if (this.subprocess != null) {
- this.subprocess.force_exit();
- }
- if (this.launcher != null) {
- this.launcher.close();
- }
-
- this.launcher = null;
- this.subprocess = null;
- this.jsonrpc_client = null;
- this.closed = true;
- this.in_close = false;
- }
+
/**
utility method to build variant based queries
*/
this.jsonrpc_client = client;
GLib.debug("client accepted connection - calling init server");
- this.log(LanguageClientAction.ACCEPT, "client accepted");
+
this.jsonrpc_client.notification.connect((method, paramz) => {
this.onNotification(method, paramz);
});
this.jsonrpc_client.failed.connect(() => {
- this.log(LanguageClientAction.ERROR_RPC, "client failed");
- this.onClose();
-
GLib.debug("language server server has failed");
});
}
public bool isReady()
{
- if (this.closed) {
- this.log(LanguageClientAction.RESTART,"closed is set - restarting");
- GLib.debug("server stopped = restarting");
- this.initialized = false;
- this.closed = false;
- this.startServer();
- foreach(var f in this.open_files) {
- this.document_open(f);
- }
- return false; // can't do an operation yet?
-
- }
-
if (!this.initialized) {
GLib.debug("Server has not been initialized");
return false;
GLib.debug("Server has been started its shutting down process");
return false;
}
- // restart server..
-
-
-
return true;
}
public abstract void initialize_server();
- public abstract void startServer();
+
//public abstract void initialize_server() ;
-
+ protected bool initialized = false;
+ bool sent_shutdown = false;
public void onNotification(string method, Variant? return_value)
*/
public void onDiagnostic(Variant? return_value)
{
-
var dg = Json.gobject_deserialize (typeof (Lsp.Diagnostics), Json.gvariant_serialize (return_value)) as Lsp.Diagnostics;
- this.log(LanguageClientAction.DIAG, dg.filename);
var f = this.project.getByPath(dg.filename);
if (f == null) {
- //GLib.debug("no file %s", dg.uri);
- this.project.updateErrorsforFile(null);
+ GLib.debug("no file %s", dg.uri);
return;
}
foreach(var v in f.errorsByType.values) {
if (!this.isReady()) {
return;
}
- if (!this.open_files.contains(file)) {
- this.open_files.add(file);
- }
-
GLib.debug ("LS sent open");
try {
this.jsonrpc_client.send_notification (
),
null
);
- this.log(LanguageClientAction.OPEN, file.path);
} catch( GLib.Error e) {
- this.log(LanguageClientAction.ERROR_RPC, e.message);
- this.onClose();
GLib.debug ("LS sent open err %s", e.message);
}
if (!this.isReady()) {
return;
}
- this.change_queue_file = null;
- GLib.debug ("LS send save");
+ GLib.debug ("LS send save");
try {
this.jsonrpc_client.send_notification (
"textDocument/didChange",
this.buildDict (
textDocument : this.buildDict ( ///TextDocumentItem;
- uri: new GLib.Variant.string (file.to_url()),
- version : new GLib.Variant.uint64 ( (uint64) file.version)
+ uri: new GLib.Variant.string (file.to_url())
+
)
),
null
);
- this.log(LanguageClientAction.SAVE, file.path);
} catch( GLib.Error e) {
- this.log(LanguageClientAction.ERROR_RPC, e.message);
- GLib.debug ("LS save err %s", e.message);
- this.onClose();
+ GLib.debug ("LS sent save err %s", e.message);
}
if (!this.isReady()) {
return;
}
- this.change_queue_file = null;
-
- if (this.open_files.contains(file)) {
- this.open_files.remove(file);
- }
- this.log(LanguageClientAction.CLOSE, file.path);
- GLib.debug ("LS send close");
+ GLib.debug ("LS send close");
try {
this.jsonrpc_client.send_notification (
"textDocument/didChange",
null
);
} catch( GLib.Error e) {
- this.log(LanguageClientAction.ERROR_RPC, e.message);
- GLib.debug ("LS close err %s", e.message);
- this.onClose();
+ GLib.debug ("LS sent close err %s", e.message);
}
}
-
-
- public void document_change (JsRender.JsRender file )
- {
- if (this.change_queue_file != null && this.change_queue_file.path != file.path) {
- this.document_change_real(this.change_queue_file, this.change_queue_file_source);
- }
-
- this.countdown = 3;
- this.change_queue_file = file;
-
-
-
- }
-
-
- public void document_change_real (JsRender.JsRender file, string contents)
+ public void document_change (JsRender.JsRender file)
{
if (!this.isReady()) {
return;
}
-
-
GLib.debug ("LS send change");
var ar = new Json.Array();
var obj = new Json.Object();
- obj.set_string_member("text", contents);
+ obj.set_string_member("text", file.toSource());
ar.add_object_element(obj);
var node = new Json.Node(Json.NodeType.ARRAY);
node.set_array(ar);
- this.log(LanguageClientAction.CHANGE, file.path);
try {
this.jsonrpc_client.send_notification (
"textDocument/didChange",
null
);
} catch( GLib.Error e) {
- this.log(LanguageClientAction.ERROR_RPC, e.message);
- GLib.debug ("LS change err %s", e.message);
- this.onClose();
+ GLib.debug ("LS sent close err %s", e.message);
}
}
- // called by close window (on last window)...
public void exit () throws GLib.Error
{
if (!this.isReady()) {
-
return;
}
- this.log(LanguageClientAction.TERM, "SEND exit");
+ this.sent_shutdown = true;
- this.jsonrpc_client.send_notification (
+ this.jsonrpc_client.send_notification_async (
"exit",
null,
null
);
- this.onClose();
-
- }
- // not used currently..
+
+ }
public async void shutdown () throws GLib.Error
{
if (!this.isReady()) {
return;
}
- this.log(LanguageClientAction.TERM, "SEND shutodwn");
this.sent_shutdown = true;
Variant? return_value;
yield this.jsonrpc_client.call_async (
@triggerType 1 = typing or ctl-spac, 2 = tiggercharactres? 3= inside completion?
*/
- public async Lsp.CompletionList? completion(JsRender.JsRender file, int line, int offset , int triggerType = 1) throws GLib.Error
+ public async void completion (JsRender.JsRender file, int line, int offset , int triggerType = 1, out Lsp.CompletionList? ret) throws GLib.Error
{
/* partial_result_token , work_done_token context = null) */
GLib.debug("get completion %s @ %d:%d", file.relpath, line, offset);
- var ret = new Lsp.CompletionList();
-
+ ret = null;
if (!this.isReady()) {
- GLib.debug("completion - language server not ready");
- return ret;
+ return;
}
- // make sure completion has the latest info..
- //if (this.change_queue_file != null && this.change_queue_file.path != file.path) {
- // this.document_change_real(this.change_queue_file, this.change_queue_file_source);
- // this.change_queue_file != null;
- //}
- this.log(LanguageClientAction.COMPLETE, "SEND complete %s @ %d:%d".printf(file.relpath, line, offset) );
-
Variant? return_value;
-
- var args = this.buildDict (
+ yield this.jsonrpc_client.call_async (
+ "textDocument/completion",
+ this.buildDict (
context : this.buildDict ( ///CompletionContext;
triggerKind: new GLib.Variant.int32 (triggerType)
// triggerCharacter : new GLib.Variant.string ("")
version : new GLib.Variant.uint64 ( (uint64) file.version)
),
position : this.buildDict (
- line : new GLib.Variant.uint64 ( (uint) line) ,
- character : new GLib.Variant.uint64 ( uint.max(0, (offset -1)))
+ line : new GLib.Variant.uint64 ( (uint64) line) ,
+ character : new GLib.Variant.uint64 ( (uint64) offset)
)
- );
-
- GLib.debug ("textDocument/completion send with %s", Json.to_string (Json.gvariant_serialize (args), true));
-
- yield this.jsonrpc_client.call_async (
- "textDocument/completion",
- args,
+ ),
null,
out return_value
);
//GLib.debug ("LS replied with %s", Json.to_string (Json.gvariant_serialize (return_value), true));
var json = Json.gvariant_serialize (return_value);
+ var ar = json.get_array();
-
- if (json.get_node_type() == Json.NodeType.OBJECT) {
+ if (ar == null) {
ret = Json.gobject_deserialize (typeof (Lsp.CompletionList), json) as Lsp.CompletionList;
- this.log(LanguageClientAction.COMPLETE_REPLY, "GOT complete %d items".printf(ret.items.size) );
- GLib.debug ("LS replied with Object");
- return ret;
+ return;
}
-
- if (json.get_node_type() != Json.NodeType.ARRAY) {
- GLib.debug ("LS replied with %s", Json.to_string (Json.gvariant_serialize (return_value), true));
- this.log(LanguageClientAction.ERROR_REPLY, "GOT something else??");
- return ret;
-
- }
- var ar = json.get_array();
-
+ ret = new Lsp.CompletionList();
for(var i = 0; i < ar.get_length(); i++ ) {
var add= Json.gobject_deserialize ( typeof (Lsp.CompletionItem), ar.get_element(i)) as Lsp.CompletionItem;
ret.items.add( add);
}
- this.log(LanguageClientAction.COMPLETE_REPLY, "GOT array %d items".printf(ret.items.size) );
- GLib.debug ("LS replied with Array");
- return ret;
+
+
}
//CompletionListInfo.itmems.parse_varient or CompletionListInfo.parsevarient
- public async Gee.ArrayList<Lsp.DocumentSymbol> syntax (JsRender.JsRender file) throws GLib.Error
- {
- /* partial_result_token , work_done_token context = null) */
- GLib.debug("get syntax %s", file.relpath);
- var ret = new Gee.ArrayList<Lsp.DocumentSymbol>();
- //ret = null;
- if (!this.isReady()) {
- return ret;
- }
- Variant? return_value;
- yield this.jsonrpc_client.call_async (
- "textDocument/documentSymbol",
- this.buildDict (
-
- textDocument : this.buildDict ( ///TextDocumentItem;
- uri: new GLib.Variant.string (file.to_url()),
- version : new GLib.Variant.uint64 ( (uint64) file.version)
- )
-
- ),
- null,
- out return_value
- );
-
-
- GLib.debug ("LS replied with %s", Json.to_string (Json.gvariant_serialize (return_value), true));
- var json = Json.gvariant_serialize (return_value);
-
-
- var ar = json.get_array();
- for(var i = 0; i < ar.get_length(); i++ ) {
- var add= Json.gobject_deserialize ( typeof (Lsp.DocumentSymbol), ar.get_element(i)) as Lsp.DocumentSymbol;
- ret.add( add);
-
- }
- return ret ;
-
-
- }
}
}
public override void initialize_server() {
GLib.debug("initialize dummy server");
}
- public override void startServer()
- {
- }
- public new bool isReady()
- {
- return false;
- }
+
}
}
\ No newline at end of file
+++ /dev/null
-
-namespace Palete {
- public class LanguageClientJavascript : LanguageClient {
-
-
- public LanguageClientJavascript(Project.Project project)
- {
- // extend versions will proably call initialize to start and connect to server.
- base(project);
-
-
- }
- public override void initialize_server() {
- GLib.debug("initialize javascript server");
- }
- public override void startServer()
- {
- }
-
-
-
-
- public new bool isReady()
- {
- return false;
- }
- public new void document_open (JsRender.JsRender file)
- {
-
- Javascript.singleton().validate(file.toSourceCode(), file );
- BuilderApplication.updateCompileResults();
-
- }
- public new void document_save (JsRender.JsRender file)
- {
- Javascript.singleton().validate(file.toSourceCode(), file );
- BuilderApplication.updateCompileResults();
- }
- public new void document_change (JsRender.JsRender file )
- {
- Javascript.singleton().validate(file.toSourceCode(), file );
- BuilderApplication.updateCompileResults();
- }
- }
-
-}
\ No newline at end of file
// extend versions will proably call initialize to start and connect to server.
base(project);
- this.startServer();
-
-
- }
- public override void startServer()
- {
this.initProcess("/usr/bin/vala-language-server");
+
}
-
public override void initialize_server() {
try {
Variant? return_value;
);
GLib.debug ("LS replied with %s", Json.to_string (Json.gvariant_serialize (return_value), true));
this.initialized = true;
- return;
} catch (GLib.Error e) {
GLib.debug ("LS replied with error %s", e.message);
- this.onClose();
}
}
namespace Palete {
-
+ public enum ValaCompileRequestType {
+ PROP_CHANGE,
+ FILE_CHANGE,
+ PROJECT,
+ RUN
+ }
public class ValaCompileRequest : Object
{
- Project.Gtk project;
- string target;
- Spawn? spawn = null;
+ ValaCompileRequestType requestType;
+
+ public JsRender.JsRender? file = null;
+ JsRender.Node? node = null;
+ JsRender.NodeProp? prop = null;
+ string alt_code = "";
+ string tmpfile = "";
+ Spawn? compiler = null;
+ /// ValaCompileQueue? queue = null;
+
- public signal void onOutput(string str);
public Gee.HashMap<string,GLib.ListStore>? errorByType = null;
public Gee.HashMap<string,GLib.ListStore>? errorByFile = null;
public ValaCompileRequest (
- Project.Gtk project,
- string target
+ ValaCompileRequestType requestType,
+ JsRender.JsRender file ,
+ JsRender.Node? node,
+ JsRender.NodeProp? prop,
+ string alt_code = ""
) {
- this.project = project;
- this.target = target;
+ this.requestType = requestType;
+ this.file = file;
+ this.node = node;
+ this.prop = prop;
+ this.alt_code = alt_code;
}
-
-
+ public bool eq(ValaCompileRequest c) {
+ var neq = false;
+ if (this.node == null && c.node == null) {
+ neq = true;
+ } else if (this.node == null || c.node == null) {
+ neq = false;
+ } else {
+ neq = this.node.oid == c.node.oid ;
+ }
+
+ var peq = false;
+ if (this.prop == null && c.prop == null) {
+ peq = true;
+ } else if (this.prop == null || c.prop == null) {
+ peq = false;
+ } else {
+ peq = this.prop.name == c.prop.name ;
+ }
+
+
+ return
+ this.requestType == c.requestType &&
+ this.file.path == c.file.path &&
+ neq && peq &&
+ this.alt_code == c.alt_code;
+
+
-
+ }
+ public string target()
+ {
+ var pr = (Project.Gtk) this.file.project;
+ return pr.firstBuildModuleWith(this.file);
+
+ }
- public async bool run()
+ string generateTempContents() {
+
+ var oldcode = "";
+ var contents = this.alt_code;
+ if (this.requestType == ValaCompileRequestType.PROP_CHANGE) {
+ oldcode = this.prop.val;
+ this.prop.val = this.alt_code;
+ contents = this.file.toSourceCode();
+ this.prop.val = oldcode;
+ }
+ return contents;
+ }
+
+
+ bool generateTempFile() {
+
+ var contents = this.generateTempContents();
+
+ var pr = this.file.project;
+
+ this.tmpfile = pr.path + "/build/tmp-%u.vala".printf( (uint) GLib.get_real_time()) ;
+ try {
+ GLib.FileUtils.set_contents(this.tmpfile,contents);
+ } catch (GLib.FileError e) {
+ GLib.debug("Error creating temp build file %s : %s", tmpfile, e.message);
+ return false;
+ }
+ return true;
+ }
+
+ public bool run()
{
//this.queue = queue;
-
- if ( this.target == "") {
+ if ( this.target() == "") {
GLib.debug("missing target");
-
+ this.onCompileFail();
return false;
}
- BuilderApplication.showSpinner("spinner", "running meson");
+ string[] args = {};
+ args += BuilderApplication._self;
+ if (this.requestType != ValaCompileRequestType.RUN) {
+ args += "--skip-linking";
+ }
+ args += "--project";
+ args += this.file.project.path;
+ args += "--target";
+ args += this.target();
+ if (this.requestType == ValaCompileRequestType.PROP_CHANGE || this.requestType == ValaCompileRequestType.FILE_CHANGE) {
+
+ if (!this.generateTempFile()) {
+ GLib.debug("failed to make temp file");
+ this.onCompileFail();
+ return false;
+ }
+ args += "--add-file";
+ args += this.tmpfile;
+ args += "--skip-file";
+ args += this.file.targetName(); // ?? bjs???
+ }
+ var pr = (Project.Gtk)(file.project);
+ try {
+ pr.makeProjectSubdir("build");
+ this.compiler = new Spawn(pr.path + "/build", args);
+ } catch (GLib.Error e) {
+ GLib.debug("Spawn failed: %s", e.message);
- var res = yield this.runMeson();
-
- if (0 != res) {
- GLib.debug("Failed to run Meson");
- BuilderApplication.showSpinner("");
+ this.onCompileFail();
return false;
}
- BuilderApplication.showSpinner("spinner", "running ninja");
- res = yield this.runNinja();
- if (0 != res) {
- GLib.debug("Failed to run ninja");
+ this.compiler.output_line.connect(this.onOutput);
+ this.compiler.complete.connect(this.onCompileComplete);
+ try {
+ this.compiler.run();
+ } catch (GLib.Error e) {
+ GLib.debug("Spawn error %s", e.message);
+ this.onCompileFail();
return false;
}
-
- BuilderApplication.showSpinner("");
- return this.execResult();
-
+ return true; // it's running..
+ }
+ void onCompileFail() // only called before we start (assumes spinner has nto started etc..
+ {
+ this.compiler = null;
+ this.deleteTemp();
}
- async int runMeson() {
- if (GLib.FileUtils.test(this.project.path + "/build", GLib.FileTest.EXISTS)) {
- return 0; //assume it's been set up.
- }
- string[] args = { "/usr/bin/meson" ,"setup","build", "--prefix=/" };
-
- this.spawn = new Spawn(this.project.path , args);
- this.spawn.output_line.connect(( str) => {
- this.onOutput(str);
- });
- var res = yield this.spawn.run_async();
- return res;
+ public void cancel() {
+ Posix.kill(this.compiler.pid, 9);
+ this.compiler = null;
+ this.deleteTemp();
}
-
- async int runNinja()
+
+ public void deleteTemp()
{
- if (!GLib.FileUtils.test(this.project.path + "/build", GLib.FileTest.EXISTS)) {
- GLib.debug("build is missing");
- return -1; //assume it's been set up.
+ if (this.tmpfile == "") {
+ return;
+ }
+ if (GLib.FileUtils.test(this.tmpfile, GLib.FileTest.EXISTS)) {
+ GLib.FileUtils.unlink(this.tmpfile);
}
- string[] args = { "/usr/bin/ninja"};
+ var cf = this.tmpfile.substring(0, this.tmpfile.length-4) + "c";
+ GLib.debug("try remove %s",cf);
+ if (GLib.FileUtils.test(cf, GLib.FileTest.EXISTS)) {
+ GLib.FileUtils.unlink(cf);
+ }
+ var ccf = GLib.Path.get_dirname(cf) + "/build/" + GLib.Path.get_basename(cf);
+ GLib.debug("try remove %s",ccf);
+ if (GLib.FileUtils.test(ccf, GLib.FileTest.EXISTS)) {
+ GLib.FileUtils.unlink(ccf);
+ }
+ this.tmpfile = "";
+ }
+ public void onCompileComplete(int res, string output, string stderr)
+ {
+ this.deleteTemp();
+ this.compiler.isZombie();
+ GLib.debug("compile got %s", output);
+ if (output == "") {
+ BuilderApplication.showSpinner(false);
+ return;
+ }
+
+ try {
+ //GLib.debug("GOT output %s", output);
+
+ var pa = new Json.Parser();
+ pa.load_from_data(output);
+ var node = pa.get_root();
- this.spawn = new Spawn(this.project.path + "/build" , args);
- this.spawn.output_line.connect(( str) => {
- this.onOutput(str);
- });
- var res = yield this.spawn.run_async();
- return res;
-
- }
- public void cancel() {
- if (this.spawn != null && this.spawn.pid > 0) {
- Posix.kill(this.spawn.pid, 9);
+ if (node.get_node_type () != Json.NodeType.OBJECT) {
+ BuilderApplication.showSpinner(false);
+ return;
+ }
+ var ret = node.get_object ();
+ //CompileError.parseCompileResults(this,ret);
+ BuilderApplication.showSpinner(false);
+
+
+
+
+
+ } catch (GLib.Error e) {
+ GLib.debug("parsing output got error %s", e.message);
+ BuilderApplication.showSpinner(false);
+ return;
+
}
- this.spawn = null;
-
- }
-
+ if (this.requestType == ValaCompileRequestType.RUN) {
+ this.execResult();
+ }
+ }
- /*
-
+ public void onOutput(string line)
+ {
+ // pass it to UI?
+
+ }
public int totalErrors(string type, JsRender.JsRender? file=null)
{
var ar = this.errorByType.get(type);
}
return ret;
}
- */
-
+ public void runJavascript( )
+ {
+ //this.queue = queue;
+
+ var contents = this.alt_code == "" ? this.file.toSourceCode() : this.generateTempContents();
+
+ Javascript.singleton().validate(contents, this.file );
+
+
+
+ BuilderApplication.showSpinner(false);
+ BuilderApplication.updateCompileResults();
+
+ //this.queue.onCompileComplete(this);
+
+
+ // see pack file (from palete/palete..palete_palete_javascriptHasCompressionErrors.)
+ }
public void killChildren(int pid)
{
if (pid < 1) {
var cn = "/proc/%d/task/%d/children".printf(pid,pid);
if (!FileUtils.test(cn, GLib.FileTest.EXISTS)) {
GLib.debug("%s doesnt exist - killing %d", cn, pid);
- Posix.kill(pid, 9);
+ Posix.kill(pid, 9);
return;
}
string cpids = "";
// skip
}
GLib.debug("killing %d", pid);
- //Posix.kill(pid, 9);
+ Posix.kill(pid, 9);
}
- public int terminal_pid = 0;
- public bool execResult()
+ int terminal_pid = 0;
+ public void execResult()
{
this.killChildren(this.terminal_pid);
this.terminal_pid = 0;
- var exe = this.target;
- var pr = (Project.Gtk) this.project;
+ var exe = this.target();
+ var pr = (Project.Gtk) this.file.project;
var cg = pr.compilegroups.get(exe);
- var exbin = pr.path + "/build/" + exe;
- if (!GLib.FileUtils.test(exbin, GLib.FileTest.EXISTS)) {
- GLib.debug("Missing output file: %s\n",exbin);
- return false;
+ if (!GLib.FileUtils.test(exe, GLib.FileTest.EXISTS)) {
+ print("Missing output file: %s\n",exe);
+ return;
}
- var gdb_cfg = pr.path + "/build/.gdb-script";
+ var gdb_cfg= pr.path + "/build/.gdb-script";
if (!GLib.FileUtils.test(gdb_cfg, GLib.FileTest.EXISTS)) {
pr.writeFile("build/.gdb-script", "set debuginfod enabled off\nr");
}
-
+
+
string[] args = "/usr/bin/gnome-terminal --disable-factory --wait -- /usr/bin/gdb -x".split(" ");
args+= gdb_cfg;
- args += exbin;
+ args += exe;
if (cg.execute_args.length > 0) {
args+= "--args";
var aa = cg.execute_args.split(" ");
} catch(GLib.Error e) {
GLib.debug("Failed to spawn: %s", e.message);
- return false;
+ return;
}
- return true;
}
* x = new ValaSource();
* x.connect.compiled(... do something with results... );
*
-
- THIS IS NOT USED ?? - replaced with valacompilerequest
*
*/
return false;
}
this.compiler.complete.connect(spawnResult);
- BuilderApplication.showSpinner("spinner", "compiling file");
+ this.spinner(true);
try {
this.compiler.run();
} catch (GLib.Error e) {
GLib.debug("Error %s",e.message);
- BuilderApplication.showSpinner("face-sad", "compile failed %s".printf(e.message));
+ this.spinner(false);
this.compiler = null;
this.deleteTemp();
return false;
}
-
+ public void spinner(bool state)
+ {
+ foreach (var win in BuilderApplication.windows) {
+ if (state) {
+ win.statusbar_compile_spinner.start();
+ } else {
+ win.statusbar_compile_spinner.stop();
+ }
+ }
+ }
public bool checkFileSpawn(JsRender.JsRender file )
public override void onSave()
{
this.meson.save();
- var vl = this.language_servers.get("vala");
- if (vl != null) {
- vl.initialize_server(); // hopefully better than exit?
- }
}
/**
}
switch( lang ) {
case "vala":
- var ls = new Palete.LanguageClientVala(this);
- ls.log.connect((act, msg) => {
- //GLib.debug("log %s: %s", act.to_string(), msg);
- BuilderApplication.showSpinnerLspLog(act,msg);
- });
- this.language_servers.set(lang, ls);
+ this.language_servers.set(lang, new Palete.LanguageClientVala(this));
break;
default :
return this.language_servers.get("dummy");
this.makeMain();
this.makeApplication();
this.makeWindow();
- this.makeGitIgnore();
+
var cg = new GtkValaSettings(this, this.name);
this.compilegroups.set(this.name, cg);
}
""");
}
- void makeGitIgnore()
- {
- this.writeFile(".gitignore", """
-build/
-""");
- }
+
+
public override void initDatabase()
this.execute_args = "";
}
// sources and packages.
- this.sources = this.filterFiles(this.project.readArray(el.get_array_member("sources")));
-
+ this.sources = this.project.readArray(el.get_array_member("sources")) ;
+
}
ret.set_string_member("name", this.name);
ret.set_string_member("execute_args", this.execute_args);
- ret.set_array_member("sources", this.writeArray( this.filterFiles(this.sources)));
+ ret.set_array_member("sources", this.writeArray(this.sources));
return ret;
public bool has_file(JsRender.JsRender file)
{
- //GLib.debug("Checking %s has file %s", this.name, file.path);
+ GLib.debug("Checking %s has file %s", this.name, file.path);
var pr = (Gtk) file.project;
for(var i = 0; i < this.sources.size;i++) {
var path = pr.path + "/" + this.sources.get(i);
- //GLib.debug("check %s =%s or %s", path , file.path, file.targetName());
+ GLib.debug("check %s", path);
- if (path == file.path || path == file.targetName()) {
- //GLib.debug("GOT IT");
+ if (path == file.path) {
+ GLib.debug("GOT IT");
return true;
}
}
- //GLib.debug("CANT FIND IT");
+ GLib.debug("CANT FIND IT");
return false;
}
- public Gee.ArrayList<string> filterFiles( Gee.ArrayList<string> ar)
- {
- var ret = new Gee.ArrayList<string>();
- foreach(var f in ar) {
- if (null == this.project.getByRelPath(f)) {
- continue;
- }
- ret.add(f);
- }
- return ret;
- }
-
}
}
\ No newline at end of file
}
GLib.debug("load is_scanned = false");
-
- // used to load paths..
- this.sub_paths = new Gee.ArrayList<JsRender.JsRender>();
- this.files = new Gee.HashMap<string,JsRender.JsRender>();
- this.loadSubDirectories("", 0); // must happend before loadJson! (as compile groups checks if file exists.
-
-
-
if (FileUtils.test(this.path + "/.roobuilder.jcfg", FileTest.EXISTS)) {
var pa = new Json.Parser();
this.loadJson(obj);
}
- this.initDatabase();
+ // used to load paths..
+ this.sub_paths = new Gee.ArrayList<JsRender.JsRender>();
+ this.files = new Gee.HashMap<string,JsRender.JsRender>();
+ this.loadSubDirectories("", 0);
+
+ this.initDatabase();
this.is_scanned = true; // loaded.. dont need to do it again..
GLib.debug("load is_scanned = true");
file.remove();
- this.save();
-
// remove it from
return ret;
}
- public void updateErrorsforFile(JsRender.JsRender? f)
+ public void updateErrorsforFile(JsRender.JsRender f)
{
- if (f != null) {
- var n = this.updateErrorsByType(f, "WARN");
- n += this.updateErrorsByType(f, "ERR");
- n += this.updateErrorsByType(f, "DEPR");
- }
-
- BuilderApplication.updateCompileResults();
+ var n = this.updateErrorsByType(f, "WARN");
+ n += this.updateErrorsByType(f, "ERR");
+ n += this.updateErrorsByType(f, "DEPR");
+ if (n > 0) {
+ BuilderApplication.updateCompileResults();
+ }
}
public int updateErrorsByType(JsRender.JsRender f, string n)
Process.spawn_async (
this.cwd,
this.args,
- this.env.length > 0 ? this.env : GLib.Environ.get (),
+ this.env.length > 0 ? this.env : null,
SpawnFlags.SEARCH_PATH | SpawnFlags.DO_NOT_REAP_CHILD,
null,
out pid);
this.ctx.quit();
this.ctx = null;
}
- // since it's closed - we might not need to remove the watches?
-
- this.err_src = -1;
- this.out_src = -1;
this.tidyup();
- GLib.debug("DONE TIDYUP - calling complete");
+ //print("DONE TIDYUP");
this.complete(this.result, this.output, this.stderr);
}
- public async int run_async()
- {
- GLib.MainLoop loop = new GLib.MainLoop ();
- this.complete.connect( (res, str, stderr) => {
- loop.quit ();
- });
-
- this.run();
-
- loop.run ();
- return this.result;
-
-
-
- }
-
-
public void tidyup() // or kill