src/ccode/*.o
src/codegen/*.c
src/codegen/*.o
-
+build/
Makecache
--- /dev/null
+{
+ "xtype" : "Gtk",
+ "compilegroups" : [
+ {
+ "name" : "builder",
+ "execute_args" : "",
+ "sources" : [
+ "src/Builder4/About.bjs",
+ "src/Builder4/DialogConfirm.bjs",
+ "src/Builder4/DialogFiles.bjs",
+ "src/Builder4/DialogSaveModule.bjs",
+ "src/Builder4/DialogSaveTemplate.bjs",
+ "src/Builder4/DialogTemplateSelect.bjs",
+ "src/Builder4/Editor.bjs",
+ "src/Builder4/EditProject.bjs",
+ "src/Builder4/FakeServer.vala",
+ "src/Builder4/GtkView.bjs",
+ "src/Builder4/MainWindow.bjs",
+ "src/Builder4/PopoverAddObject.bjs",
+ "src/Builder4/PopoverProperty.bjs",
+ "src/Builder4/StandardErrorDialog.bjs",
+ "src/Builder4/RooProjectSettings.bjs",
+ "src/Builder4/ValaCompileErrors.bjs",
+ "src/Builder4/ValaCompileResults.bjs",
+ "src/Builder4/ValaProjectSettingsPopover.bjs",
+ "src/Builder4/WindowLeftProps.bjs",
+ "src/Builder4/WindowRooView.bjs",
+ "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/JsRender/JsRender.vala",
+ "src/JsRender/Lang.vala",
+ "src/JsRender/NodeProp.vala",
+ "src/JsRender/NodeToGlade.vala",
+ "src/JsRender/Roo.vala",
+ "src/JsRender/Node.vala",
+ "src/JsRender/PlainFile.vala",
+ "src/JsRender/NodeToVala.vala",
+ "src/JsRender/NodeToJs.vala",
+ "src/Palete/CompileError.vala",
+ "src/Palete/CompletionProvider.vala",
+ "src/Palete/Gtk.vala",
+ "src/Palete/Palete.vala",
+ "src/Palete/RooDatabase.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/Project/Roo.vala",
+ "src/Project/VapiSelection.vala",
+ "src/Main.vala",
+ "src/Resources.vala",
+ "src/Spawn.vala",
+ "src/Application.vala",
+ "src/Palete/ValalCompileQueue.vala",
+ "src/Palete/ValaCompileRequest.vala",
+ "src/Palete/ValaCompileQueue.vala",
+ "src/Palete/Javascript.vala"
+ ],
+ "hidden" : [
+ "src/Builder4/About.bjs",
+ "src/Builder4/DialogConfirm.bjs",
+ "src/Builder4/DialogFiles.bjs",
+ "src/Builder4/DialogSaveModule.bjs",
+ "src/Builder4/DialogSaveTemplate.bjs",
+ "src/Builder4/DialogTemplateSelect.bjs",
+ "src/Builder4/Editor.bjs",
+ "src/Builder4/EditProject.bjs",
+ "src/Builder4/FakeServer.vala",
+ "src/Builder4/GtkView.bjs",
+ "src/Builder4/MainWindow.bjs",
+ "src/Builder4/PopoverAddObject.bjs",
+ "src/Builder4/PopoverProperty.bjs",
+ "src/Builder4/StandardErrorDialog.bjs",
+ "src/Builder4/RooProjectSettings.bjs",
+ "src/Builder4/ValaCompileErrors.bjs",
+ "src/Builder4/ValaCompileResults.bjs",
+ "src/Builder4/ValaProjectSettingsPopover.bjs",
+ "src/Builder4/WindowLeftProps.bjs",
+ "src/Builder4/WindowRooView.bjs",
+ "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/JsRender/JsRender.vala",
+ "src/JsRender/Lang.vala",
+ "src/JsRender/NodeProp.vala",
+ "src/JsRender/NodeToGlade.vala",
+ "src/JsRender/Roo.vala",
+ "src/JsRender/Node.vala",
+ "src/JsRender/PlainFile.vala",
+ "src/JsRender/NodeToVala.vala",
+ "src/JsRender/NodeToJs.vala",
+ "src/Palete/CompileError.vala",
+ "src/Palete/CompletionProvider.vala",
+ "src/Palete/Gtk.vala",
+ "src/Palete/Palete.vala",
+ "src/Palete/RooDatabase.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/Project/Roo.vala",
+ "src/Project/VapiSelection.vala",
+ "src/Main.vala",
+ "src/Resources.vala",
+ "src/Spawn.vala",
+ "src/Application.vala",
+ "src/Palete/ValalCompileQueue.vala",
+ "src/Palete/ValaCompileRequest.vala",
+ "src/Palete/ValaCompileQueue.vala",
+ "src/Palete/Javascript.vala"
+ ]
+ }
+ ],
+ "compile_flags" : "",
+ "packages" : [
+ "gtk4",
+ "gee-0.8",
+ "gio-2.0",
+ "webkitgtk-6.0",
+ "libgda-5.0",
+ "glib-2.0",
+ "gobject-2.0",
+ "json-glib-1.0",
+ "gobject-introspection-1.0",
+ "libvala-0.56",
+ "libadwaita-1",
+ "libxml-2.0",
+ "posix",
+ "roojspacker-1.4",
+ "gtksourceview-5",
+ "javascriptcore"
+ ]
+}
\ No newline at end of file
PKG_CHECK_MODULES(ROOBUILDER, [ zlib
glib-2.0 >= 2.24.1
gobject-2.0 >= 2.24.1
- gtk+-3.0 >= 3.11.3
- gtksourceview-3.0
+ gtk4 >= 3.11.3
+ gtksourceview-5
json-glib-1.0
gee-0.8
libxml-2.0
- libsoup-2.4
+ libsoup-3.0
roojspacker-1.4
])
dnl -- webkit-4.0
-PKG_CHECK_MODULES(WEBKIT, [webkit2gtk-4.0],
- [webkit_4_0_enabled=yes],
- [webkit_4_0_enabled=no])
+PKG_CHECK_MODULES(WEBKIT, [webkitgtk-6.0],
+ [webkit_6_0_enabled=yes],
+ [webkit_6_0_enabled=no])
-if test $webkit_4_0_enabled = yes; then
- AC_DEFINE(HAVE_WEBKIT4,1,[webkit 4.0 support])
-else
- PKG_CHECK_MODULES(WEBKIT, [webkit2gtk-3.0],
- [webkit_3_0_enabled=yes] )
- AC_DEFINE(HAVE_WEBKIT3,1,[webkit 3.0 support])
+if test $webkit_6_0_enabled = yes; then
+ AC_DEFINE(HAVE_WEBKIT6,1,[webkit 6.0 support])
fi
-AM_CONDITIONAL(HAVE_WEBKIT3, test "$webkit_3_0_enabled" = "yes")
-AM_CONDITIONAL(HAVE_WEBKIT4, test "$webkit_4_0_enabled" = "yes")
+AM_CONDITIONAL(HAVE_WEBKIT6, test "$webkit_6_0_enabled" = "yes")
-dnl -- javascriptcoregtk-4.0 ** not sure if this is needed....
+dnl -- javascriptcoregtk-6.0 ** not sure if this is needed....
-PKG_CHECK_MODULES(JAVASCRIPTCOREGTK, [javascriptcoregtk-4.0],
- [javascriptcoregtk_4_0_enabled=yes],
- [javascriptcoregtk_4_0_enabled=no])
-if test $javascriptcoregtk_4_0_enabled = yes; then
- AC_DEFINE(HAVE_JAVASCRIPTCOREGTK4,1,[javascriptcoregtk 4.0 support])
-else
- PKG_CHECK_MODULES(JAVASCRIPTCOREGTK, [javascriptcoregtk-3.0],
- [javascriptcoregtk_3_0_enabled=yes] )
- AC_DEFINE(HAVE_JAVASCRIPTCOREGTK3,1,[javascriptcoregtk 3.0 support])
-
+PKG_CHECK_MODULES(JAVASCRIPTCOREGTK, [javascriptcoregtk-6.0],
+ [javascriptcoregtk_6_0_enabled=yes],
+ [javascriptcoregtk_6_0_enabled=no])
+
+if test $javascriptcoregtk_6_0_enabled = yes; then
+ AC_DEFINE(HAVE_JAVASCRIPTCOREGTK6,1,[javascriptcoregtk 6.0 support])
fi
-AM_CONDITIONAL(HAVE_JAVASCRIPTCOREGTK3, test "$javascriptcoregtk_3_0_enabled" = "yes")
-AM_CONDITIONAL(HAVE_JAVASCRIPTCOREGTK4, test "$javascriptcoregtk_4_0_enabled" = "yes")
+
+AM_CONDITIONAL(HAVE_JAVASCRIPTCOREGTK6, test "$javascriptcoregtk_6_0_enabled" = "yes")
const OptionEntry[] options = {
- { "project", 0, 0, OptionArg.STRING, ref opt_compile_project, "Compile a project", null },
+ { "project", 0, 0, OptionArg.STRING, ref opt_compile_project, "select a project", null },
{ "target", 0, 0, OptionArg.STRING, ref opt_compile_target, "Target to build", null },
+ { "skip-linking", 0, 0, OptionArg.NONE, ref opt_skip_linking, "Do not link the files and make a binary - used to do syntax checking", null },
{ "skip-file", 0, 0, OptionArg.STRING, ref opt_compile_skip ,"For test compiles do not add this (usually used in conjunction with add-file ", null },
{ "add-file", 0, 0, OptionArg.STRING, ref opt_compile_add, "Add this file to compile list", null },
{ "output", 0, 0, OptionArg.STRING, ref opt_compile_output, "output binary file path", null },
{ "bjs-target", 0, 0, OptionArg.STRING, ref opt_bjs_compile_target, "convert bjs file to tareet : vala / js", null },
{ "test", 0, 0, OptionArg.STRING, ref opt_test, "run a test use 'help' to list the available tests", null },
+ { "drop-list", 0, 0, OptionArg.STRING, ref opt_drop_list, "show droplist / children for a Gtk type (eg. Gtk.Widget)", null },
+
+
{ null }
};
public static string opt_compile_project;
public static string opt_compile_add;
public static string opt_compile_output;
public static string opt_bjs_compile;
-
public static string opt_bjs_compile_target;
- public static string opt_test;
+ public static string opt_test;
+ public static string opt_drop_list;
+
+
+ public static bool opt_skip_linking = false;
public static bool opt_debug = false;
public static bool opt_list_projects = false;
public static bool opt_list_files = false;
ROOTWIN
}
-
+/*
public const Gtk.TargetEntry[] targetList = {
{ "INTEGER", 0, Target.INT32 },
{ "STRING", 0, Target.STRING },
{ "text/plain", 0, Target.STRING },
{ "application/x-rootwindow-drop", 0, Target.ROOTWIN }
};
+ */
public AppSettings settings = null;
- public static Palete.ValaSource valasource;
+ public static Palete.ValaCompileQueue valacompilequeue;
public BuilderApplication ( string[] args)
GLib.error("could not read /proc/self/exe");
}
GLib.debug("SELF = %s", _self);
+ var f = File.new_for_path(_self);
+ var dt = "0000";
+ try {
+ var fi = f.query_info("*",0);
+ dt = fi.get_creation_date_time().to_unix().to_string();
+ } catch (GLib.Error e) {
+ // skip.
+ }
Object(
- application_id: "org.roojs.app-builder",
+ application_id: "org.roojs.%s.ver%s".printf( GLib.Path.get_basename(_self),dt),
flags: ApplicationFlags.FLAGS_NONE
);
BuilderApplication.windows = new Gee.ArrayList<Xcls_MainWindow>();
- BuilderApplication.valasource = new Palete.ValaSource();
+ BuilderApplication.valacompilequeue = new Palete.ValaCompileQueue();
configDirectory();
Project.Project.loadAll();
this.listProjects();
var cur_project = this.compileProject();
+ this.dropList(cur_project);
this.listFiles(cur_project);
this.testBjs(cur_project);
this.compileBjs(cur_project);
- public static BuilderApplication singleton( string[] args)
+ public static BuilderApplication singleton( string[]? args)
{
- if (application==null) {
+ if (application==null && args != null) {
application = new BuilderApplication( args);
if (BuilderApplication.opt_debug || BuilderApplication.opt_compile_project == null) {
GLib.Log.set_handler(null,
- GLib.LogLevelFlags.LEVEL_DEBUG | GLib.LogLevelFlags.LEVEL_WARNING,
+ GLib.LogLevelFlags.LEVEL_DEBUG | GLib.LogLevelFlags.LEVEL_WARNING | GLib.LogLevelFlags.LEVEL_CRITICAL,
(dom, lvl, msg) => {
- print("%s: %s\n", dom, msg);
+ print("%s: %s\n", (new DateTime.now_local()).format("%H:%M:%S.%f"), msg);
});
}
return null;
}
Project.Project cur_project = null;
- cur_project = Project.Project.getProjectByHash( BuilderApplication.opt_compile_project);
+ cur_project = Project.Project.getProjectByPath( BuilderApplication.opt_compile_project);
+
+
if (cur_project == null) {
GLib.error("invalid project %s, use --list-projects to show project ids",BuilderApplication.opt_compile_project);
}
- cur_project.scanDirs();
-
+ cur_project.load();
+
+
+
return cur_project;
}
+
+ void dropList(Project.Project? cur_project) {
+
+
+ if (cur_project== null || BuilderApplication.opt_drop_list == null) {
+ return;
+ }
+
+ if (BuilderApplication.opt_compile_project == null) {
+ GLib.error("need a project %s, to use --drop-list",BuilderApplication.opt_compile_project);
+ }
+ if (cur_project.xtype != "Gtk") {
+ GLib.error("need a Gtk project %s, to use --drop-list",BuilderApplication.opt_compile_project);
+ }
+ var p = (Palete.Gtk) cur_project.palete;
+
+ print("\n\nDropList:\n%s", geeArrayToString(p.getDropList(BuilderApplication.opt_drop_list)));
+ print("\n\nChildList:\n%s", geeArrayToString(p.getChildList(BuilderApplication.opt_drop_list, false)));
+ print("\n\nChildList \n(with props): %s", geeArrayToString(p.getChildList(BuilderApplication.opt_drop_list, true)));
+
+
+ print("\n\nPropsList: %s", this.girArrayToString(p.getPropertiesFor( BuilderApplication.opt_drop_list, JsRender.NodePropType.PROP)));
+ print("\n\nSignalList: %s", this.girArrayToString(p.getPropertiesFor( BuilderApplication.opt_drop_list, JsRender.NodePropType.LISTENER)));
+
+ // ctor.
+ print("\n\nCtor Values: %s", p.fqnToNode(BuilderApplication.opt_drop_list).toJsonString());
+
+ GLib.Process.exit(Posix.EXIT_SUCCESS);
+
+ }
+ string geeArrayToString(Gee.ArrayList<string> ar)
+ {
+ var ret = "";
+ foreach(var n in ar) {
+ ret += n + "\n";
+ }
+ return ret;
+ }
+ string girArrayToString(Gee.HashMap<string,Palete.GirObject> map)
+ {
+ var ret = "";
+ foreach(var gi in map.values) {
+ ret += "%s %s (%s)\n".printf(gi.type, gi.name, gi.propertyof);
+
+ }
+ return ret;
+
+ }
+
+
void listFiles(Project.Project? cur_project)
{
if (!BuilderApplication.opt_list_files) {
var prop = node == null ? null : node.lineToProp(i+1);
print("%d: %s : %s\n",
i+1,
- node == null ? "......" : (prop == null ? "????????" : prop),
+ node == null ? "......" : (prop == null ? "????????" : prop.name),
str_ar[i]
);
}
GLib.Process.exit(Posix.EXIT_SUCCESS);
}
+
+ // move to 'window colletction?
public static Gee.ArrayList<Xcls_MainWindow> windows;
public static void addWindow(Xcls_MainWindow w)
BuilderApplication.windows.remove(w);
BuilderApplication.updateWindows();
- BuilderApplication.valasource.compiled.disconnect(w.windowstate.showCompileResult);
- BuilderApplication.valasource.compile_output.disconnect(w.windowstate.compile_results.addLine);
+
+ w.el.hide();
+ w.el.close();
+ w.el.destroy();
}
var w = new Xcls_MainWindow();
w.ref();
BuilderApplication.addWindow(w);
- w.el.show_all();
w.initChildren();
- w.windowstate. fileViewOpen(file, false, line);
+ w.windowstate.fileViewOpen(file, false, line);
+ w.el.present();
}
+ public static void updateCompileResults( )
+ {
+ foreach(var ww in BuilderApplication.windows) {
+ if (ww == null || ww.windowstate == null || ww.windowstate.project ==null) {
+ continue;
+ }
+ if (ww.windowstate.project.last_request == null) {
+ ww.updateErrors(null);
+ return;
+ }
+ var req = ww.windowstate.project.last_request;
+ GLib.debug("checking errors editor for %s", ww.windowstate.file.targetName());
+
+ if (req.errorByFile.has_key(ww.windowstate.file.targetName())) {
+ GLib.debug("calling update Error margs for %s", ww.windowstate.file.targetName());
+ ww.windowstate.code_editor_tab.updateErrorMarks(req.errorByFile.get(ww.windowstate.file.targetName()));
+ } else {
+ ww.windowstate.code_editor_tab.updateErrorMarks(null);
+
+ GLib.debug("no errors in errrobyfile for %s", ww.windowstate.file.targetName());
+ }
+
+ GLib.debug("calling udate Errors of window %s", ww.windowstate.file.targetName());
+ ww.updateErrors(req);
+
+
+ }
+
+ }
+
}
--- /dev/null
+{
+ "name" : "Builder4",
+ "xtype" : "Gtk",
+ "compilegroups" : [],
+ "compile_flags" : "",
+ "packages" : [
+ "gtk4",
+ "javascriptcoregtk-6.0",
+ "gtksourceview-5",
+ "webkitgtk-6.0",
+ "libxml-2.0"
+ ]
+}
\ No newline at end of file
{
"build_module" : "builder",
+ "gen_extended" : true,
"items" : [
{
"$ authors" : "{ \"Alan Knowles\" }",
- "$ modal" : true,
"$ xns" : "Gtk",
- "listeners" : {
- "response" : [
- "(rid) => {",
- " this.el.hide();",
- "}"
- ]
- },
+ "bool modal" : true,
"program_name" : "roobuilder",
"string copyright" : "LGPL",
"string license" : "LGPL",
"xtype" : "AboutDialog",
"| void show" : [
"(Gtk.Window parent) {",
+ "\tthis.el.application = parent.application;",
" this.el.set_transient_for(parent);",
- " this.el.modal = true;",
" this.el.show();",
"}"
]
}
],
- "modOrder" : "",
- "name" : "About",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/About.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "About"
}
\ No newline at end of file
-static About _About;
+ static About _About;
-public class About : Object
-{
- public Gtk.AboutDialog el;
- private About _this;
-
- public static About singleton()
+ public class About : Object
{
- if (_About == null) {
- _About= new About();
+ public Gtk.AboutDialog el;
+ private About _this;
+
+ public static About singleton()
+ {
+ if (_About == null) {
+ _About= new About();
+ }
+ return _About;
}
- return _About;
- }
- // my vars (def)
-
- // ctor
- public About()
- {
- _this = this;
- this.el = new Gtk.AboutDialog();
+ // my vars (def)
- // my vars (dec)
+ // ctor
+ public About()
+ {
+ _this = this;
+ this.el = new Gtk.AboutDialog();
- // 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";
+ // my vars (dec)
- //listeners
- this.el.response.connect( (rid) => {
- this.el.hide();
- });
- }
+ // 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.set_transient_for(parent);
- this.el.modal = true;
- 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();
+ }
}
-}
+++ /dev/null
-/**
- * handle the compile state
- *
- * when the app tries to compile the application, it will output information
- * about errors/warnings and depricated information.
- *
- * This has a number of effects..
- *
- * - when it compiles
- * -- if any of the errors// etc.. are affecting the current open file
- * then we should flag the tree indicating which node has a problem
- *
- * -- update the footer bar to show stats (eg. how many errors etc..)
- *
- *
- *
- * - when you open a file
- * - if there are any notices for that file, then we should flag the tree
- * to show the errors.
- *
- *
- *
- */
-public class CompileState : Object
-{
- public Xcls_MainWindow win;
-
- public enum State {
- NONE,
- PREVIEW,
- OBJECT,
- PROP,
- LISTENER,
- CODE,
- FILES,
- PROJECT // project settings..
- }
-
- public State state = State.NONE;
-
- public bool children_loaded = false;
-
-
- public X
{
"build_module" : "builder",
+ "gen_extended" : true,
"items" : [
{
"$ buttons" : "Gtk.ButtonsType.YES_NO",
"$ xns" : "Gtk",
"flags" : "Gtk.DialogFlags.MODAL",
"listeners" : {
- "delete_event" : [
+ "close_request" : [
" (event) => {",
- " this.el.response(Gtk.ResponseType.CANCEL);",
+ " this.el.response(Gtk.ResponseType.CANCEL);",
" this.el.hide();",
" return true;",
- " ",
+ " ",
"}",
""
]
"text" : "Test",
"title" : "Please Confirm ",
"xtype" : "MessageDialog",
- "| int show" : [
+ "| 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_all();",
- " var ret = this.el.run();",
- " //print(\"ret got %d\", ret);",
- " this.el.hide();",
- " return ret;",
- " ",
+ " this.el.show();",
+ " ",
+ " ",
"}",
" "
]
}
],
- "modOrder" : "",
- "name" : "DialogConfirm",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/DialogConfirm.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "DialogConfirm"
}
\ No newline at end of file
-static DialogConfirm _DialogConfirm;
+ static DialogConfirm _DialogConfirm;
-public class DialogConfirm : Object
-{
- public Gtk.MessageDialog el;
- private DialogConfirm _this;
-
- public static DialogConfirm singleton()
+ public class DialogConfirm : Object
{
- if (_DialogConfirm == null) {
- _DialogConfirm= new DialogConfirm();
+ public Gtk.MessageDialog el;
+ private DialogConfirm _this;
+
+ public static DialogConfirm singleton()
+ {
+ if (_DialogConfirm == null) {
+ _DialogConfirm= new DialogConfirm();
+ }
+ return _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.delete_event.connect( (event) => {
- this.el.response(Gtk.ResponseType.CANCEL);
- this.el.hide();
- return true;
-
- });
- }
+ // 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 int show (string title, string msg) {
- //if (!this.el) { this.init(); }
- //this.success = success;
- this.el.title = title;
- this.el.text = msg;
- this.el.show_all();
- var ret = this.el.run();
- //print("ret got %d", ret);
- this.el.hide();
- return ret;
-
+ // 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();
+
+
+ }
}
-}
--- /dev/null
+{
+ "build_module" : "builder",
+ "gen_extended" : false,
+ "items" : [
+ {
+ "# Xcls_MainWindow win" : "",
+ "$ xns" : "Gtk",
+ "Gdk.Pixbuf missing_thumb_pixbuf" : "",
+ "Gee.HashMap<string,Gdk.Pixbuf> image_cache" : "",
+ "Project.Project selectedProject" : "",
+ "bool in_onprojectselected" : false,
+ "bool is_loading" : false,
+ "bool modal" : true,
+ "bool new_window" : false,
+ "int default_height" : 550,
+ "int default_width" : 1000,
+ "items" : [
+ {
+ "$ homogeneous" : false,
+ "$ xns" : "Gtk",
+ "* prop" : "child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool expand" : true,
+ "int margin_bottom" : 10,
+ "int margin_end" : 10,
+ "int margin_start" : 10,
+ "int margin_top" : 10,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool hexpand" : true,
+ "int spacing" : 0,
+ "xtype" : "Box"
+ },
+ {
+ "$ xns" : "Gtk",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "bool hexpand" : true,
+ "bool homogeneous" : false,
+ "bool vexpand" : true,
+ "id" : "mainpane",
+ "int position" : 200,
+ "int spacing" : 0,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* init" : [
+ " this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
+ " "
+ ],
+ "* prop" : "start_child",
+ "bool expand" : true,
+ "bool has_frame" : true,
+ "bool hexpand" : true,
+ "bool vexpand" : true,
+ "id" : "projectscroll",
+ "int width_request" : 150,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ " ",
+ "\tthis.css = new Gtk.CssProvider();",
+ " ",
+ "\tthis.css.load_from_string(\"#project-list { font-size: 12px;}\");",
+ "",
+ "\tGtk.StyleContext.add_provider_for_display(",
+ "\t\tthis.el.get_display(),",
+ "\t\tthis.css,",
+ "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
+ "\t);",
+ "\t\t",
+ " ",
+ "}",
+ ""
+ ],
+ "* prop" : "child",
+ "Gtk.CssProvider css" : "",
+ "id" : "project_list",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "bool can_unselect" : true,
+ "id" : "projectselection",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "bool incremental" : true,
+ "id" : "projectsort",
+ "items" : [
+ {
+ "$ xns" : "GLib",
+ "* prop" : "model",
+ "GLib.Type item_type" : "typeof(Project.Project)",
+ "id" : "projectmodel",
+ "xtype" : "ListStore",
+ "| void remove" : [
+ "(Project.Project p) {",
+ "",
+ "\tfor (var i =0;i < this.el.n_items; i++ ) {",
+ "\t\tvar pr = (Project.Project) this.el.get_item(i);",
+ "\t\tif (p.path == pr.path) {",
+ "\t\t\tthis.el.remove(i);",
+ "\t\t\treturn;",
+ "\t\t}",
+ "\t}",
+ "",
+ "",
+ "}"
+ ]
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "sorter",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "expression",
+ "GLib.Type this_type" : "typeof(Project.Project)",
+ "string property_name" : "name",
+ "xtype" : "PropertyExpression"
+ }
+ ],
+ "xtype" : "StringSorter"
+ }
+ ],
+ "xtype" : "SortListModel"
+ }
+ ],
+ "listeners" : {
+ "notify[\"selected\"]" : [
+ "(position, n_items) => {",
+ "",
+ " if (_this.is_loading) {",
+ " \treturn;",
+ "\t}",
+ " ",
+ "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
+ "\t\t_this.btn_delproj.el.hide();",
+ "\t\t_this.btn_projprop.el.hide();",
+ "\t\t_this.btn_addfile.el.hide();",
+ "\t\t//_this.btn_delfile.el.hide();",
+ "\t\t ",
+ "\t} else {",
+ "\t\t_this.btn_delproj.el.show();",
+ "\t\t_this.btn_projprop.el.show();",
+ "\t\t_this.btn_addfile.el.show();",
+ "\t\t//_this.btn_delfile.el.show(); // ??",
+ "\t}",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " if (_this.is_loading) {",
+ " return;",
+ " }",
+ "\t ",
+ "\t Project.Project project = this.el.selected == Gtk.INVALID_LIST_POSITION ? null :",
+ "\t\t \t(Project.Project) _this.projectsort.el.get_item(this.el.selected);",
+ "\t ",
+ "\t GLib.debug(\"selection changed to %s\", project == null ? \"none\" : project.name);",
+ " ",
+ " _this.onProjectSelected(project);",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "SingleSelection"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "append_column",
+ "bool expand" : true,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "factory",
+ "listeners" : {
+ "bind" : [
+ "(listitem) => {",
+ " ",
+ "\tvar lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();",
+ "\t ",
+ "\tvar item = (JsRender.JsRender) ((Gtk.ListItem)listitem).get_item();",
+ "",
+ "\titem.bind_property(\"name\",",
+ " lbl, \"label\",",
+ " GLib.BindingFlags.SYNC_CREATE);",
+ "",
+ "\t ",
+ "}",
+ ""
+ ],
+ "setup" : [
+ "(item) => {",
+ "\t//var j = (JsRender.JsRender) item;",
+ "\tvar gi = (Gtk.ListItem)item;",
+ "\t ",
+ "\tvar lbl = new Gtk.Label(\"\");",
+ "\tlbl.halign = Gtk.Align.START;",
+ "\tgi.set_child(lbl);",
+ "",
+ "",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "SignalListItemFactory"
+ }
+ ],
+ "string title" : "Project",
+ "xtype" : "ColumnViewColumn"
+ }
+ ],
+ "string name" : "project-list",
+ "xtype" : "ColumnView"
+ }
+ ],
+ "xtype" : "ScrolledWindow"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "end_child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "bool visible" : false,
+ "id" : "filepane",
+ "int position" : 200,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "end_child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool hexpand" : true,
+ "bool vexpand" : true,
+ "int spacing" : 0,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "bool hexpand" : true,
+ "int spacing" : 0,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* init" : [
+ " ",
+ "/*",
+ "this.css = new Gtk.CssProvider();",
+ "try {",
+ "\tthis.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);",
+ " ",
+ " ",
+ "*/"
+ ],
+ "Gtk.CssProvider css" : "",
+ "bool hexpand" : true,
+ "id" : "searchbox",
+ "listeners" : {
+ "search_changed" : [
+ "( ) => {",
+ "",
+ "\t_this.treefilter.el.changed(Gtk.FilterChange.DIFFERENT);",
+ "\t_this.iconsearch.el.set_search(this.el.text);",
+ "}",
+ ""
+ ]
+ },
+ "string name" : "popover-files-iconsearch",
+ "string placeholder_text" : "type to filter results",
+ "uint search_delay" : 1000,
+ "xtype" : "SearchEntry"
+ }
+ ],
+ "xtype" : "Box"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* init" : [
+ " this.el.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);",
+ " "
+ ],
+ "bool has_frame" : true,
+ "bool hexpand" : true,
+ "bool vexpand" : true,
+ "id" : "iconscroll",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "child",
+ "id" : "gridview",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "pressed" : [
+ "(n_press, x, y) => {",
+ "\tif (n_press == 2) {",
+ "\t\tGLib.debug(\"double cliced\");",
+ "\t} else {",
+ "\t\treturn;",
+ "\t}",
+ "\tvar f = (JsRender.JsRender)_this.iconsel.el.selected_item;",
+ "\t ",
+ "\tGLib.debug(\"Click %s\", f.name);",
+ "\tif (f.xtype == \"Dir\") {",
+ "\t\treturn;",
+ "\t}",
+ "\t",
+ "\t",
+ " \t_this.win.windowstate.fileViewOpen(f, _this.new_window);",
+ "\t_this.el.hide();",
+ "\t",
+ "\t",
+ "\t",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "GestureClick"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "bool can_unselect" : true,
+ "id" : "iconsel",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "id" : "gridsort",
+ "items" : [
+ {
+ "$ xns" : "GLib",
+ "* prop" : "model",
+ "GLib.Type item_type" : "typeof(JsRender.JsRender)",
+ "id" : "gridmodel",
+ "xtype" : "ListStore",
+ "| void remove" : [
+ "(JsRender.JsRender p) {",
+ "",
+ "\tfor (var i =0;i < this.el.n_items; i++ ) {",
+ "\t\tvar pr = (JsRender.JsRender) this.el.get_item(i);",
+ "\t\tif (p.path == pr.path) {",
+ "\t\t\tthis.el.remove(i);",
+ "\t\t\treturn;",
+ "\t\t}",
+ "\t}",
+ " ",
+ "}"
+ ]
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "sorter",
+ "bool ignore_case" : true,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "expression",
+ "GLib.Type this_type" : "typeof(JsRender.JsRender)",
+ "string property_name" : "name",
+ "xtype" : "PropertyExpression"
+ }
+ ],
+ "xtype" : "StringSorter"
+ }
+ ],
+ "xtype" : "SortListModel"
+ },
+ {
+ "$ Gtk.StringFilterMatchMode match_mode" : "Gtk.StringFilterMatchMode.SUBSTRING",
+ "$ xns" : "Gtk",
+ "* prop" : "filter",
+ "bool ignore_case" : true,
+ "id" : "iconsearch",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "expression",
+ "GLib.Type this_type" : "typeof(JsRender.JsRender)",
+ "string property_name" : "name",
+ "xtype" : "PropertyExpression"
+ }
+ ],
+ "xtype" : "StringFilter"
+ }
+ ],
+ "xtype" : "FilterListModel"
+ }
+ ],
+ "listeners" : {
+ "notify[\"selected\"]" : [
+ "() => {",
+ "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
+ "\t\tif (_this.treeselmodel.el.selected == Gtk.INVALID_LIST_POSITION) {",
+ "\t\t\t_this.btn_delfile.el.hide();",
+ "\t\t}",
+ "\t",
+ "\t\treturn;",
+ "\t}",
+ "\t_this.btn_delfile.el.show();",
+ "\t_this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;",
+ "",
+ "",
+ "}",
+ " ",
+ " ",
+ " "
+ ]
+ },
+ "xtype" : "SingleSelection",
+ "| JsRender.JsRender? selectedFile" : [
+ "() {",
+ "",
+ "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
+ "\t\treturn null;",
+ "\t}",
+ "\treturn (JsRender.JsRender)this.el.get_item(this.el.selected); ",
+ "\t",
+ " ",
+ "}"
+ ]
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "factory",
+ "listeners" : {
+ "bind" : [
+ "(listitem) => {",
+ " ",
+ "\tvar box = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();",
+ "\t ",
+ "\tvar img = (Gtk.Image) box.get_first_child();",
+ "\tvar lbl = (Gtk.Label)img.get_next_sibling();",
+ "",
+ "\tvar item = (JsRender.JsRender) ((Gtk.ListItem)listitem).get_item();",
+ "\t//GLib.debug(\"set label name to %s\", item.name);",
+ "\t ",
+ "\tvar ns = item.name.split(\".\");",
+ "\tif (ns.length < 2) {",
+ "\t\tlbl.label = item.name;",
+ "\t} else {",
+ "\t\tlbl.label = ",
+ "\t\t\titem.name.substring(0, item.name.length - ns[ns.length-1].length)",
+ "\t\t \t + \"\\n\"+ ns[ns.length-1];",
+ "\t}",
+ "",
+ "/*",
+ "\titem.bind_property(\"name\",",
+ " lbl, \"label\",",
+ " GLib.BindingFlags.SYNC_CREATE);",
+ "",
+ "\t*/",
+ " img.set_from_file(item.getIconFileName());",
+ " ",
+ "\t ",
+ "}",
+ ""
+ ],
+ "setup" : [
+ "(item) => {",
+ "\t//var j = (JsRender.JsRender) item;",
+ "\tvar gi = (Gtk.ListItem)item;",
+ "\tvar b = new Gtk.Box(Gtk.Orientation.VERTICAL,4);",
+ "\tvar i = new Gtk.Image();",
+ "\ti.pixel_size = 96;",
+ "\tvar t = new Gtk.Label(\"\");",
+ "\tb.append(i);",
+ "\tb.append(t);",
+ "\t",
+ "\tgi.set_child(b);",
+ "\tb.has_tooltip = true;",
+ "\tb.query_tooltip.connect((x, y, keyboard_tooltip, tooltip) => {",
+ "\t\tvar j = (JsRender.JsRender) gi.get_item();",
+ "\t\t",
+ "\t\tvar ti = new Gtk.Image.from_file ( j.getIconFileName());",
+ "\t\tti.pixel_size = 368;",
+ "\t\ttooltip.set_custom( ti );",
+ "\t\treturn true;",
+ "\t});",
+ "",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "SignalListItemFactory"
+ }
+ ],
+ "xtype" : "GridView"
+ }
+ ],
+ "xtype" : "ScrolledWindow"
+ }
+ ],
+ "xtype" : "Box"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* init" : " this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
+ "* prop" : "start_child",
+ "bool has_frame" : true,
+ "bool hexpand" : true,
+ "bool vexpand" : true,
+ "bool visible" : true,
+ "id" : "treescroll",
+ "int width_request" : 200,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ " ",
+ "\tthis.css = new Gtk.CssProvider();",
+ " ",
+ "\tthis.css.load_from_string(\"#file-list { font-size: 12px;}\");",
+ "",
+ "\tGtk.StyleContext.add_provider_for_display(",
+ "\t\tthis.el.get_display(),",
+ "\t\tthis.css,",
+ "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
+ "\t);",
+ "\t\t ",
+ "}",
+ ""
+ ],
+ "* prop" : "child",
+ "Gtk.CssProvider css" : "",
+ "id" : "treeview",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "pressed" : [
+ "(n_press, x, y) => {",
+ "\tif (n_press == 2) {",
+ "\t\tGLib.debug(\"double cliced\");",
+ "\t} else {",
+ "\t\treturn;",
+ "\t}",
+ "\tvar tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;",
+ "\tGLib.debug(\"SELECTED = %s\", tr.item.get_type().name());",
+ "\tvar f = (JsRender.JsRender) tr.item;",
+ "\tGLib.debug(\"Click %s\", f.name);",
+ "\tif (f.xtype == \"Dir\") {",
+ "\t\treturn;",
+ "\t}",
+ "\t",
+ "\t",
+ " \t_this.win.windowstate.fileViewOpen(f, _this.new_window);",
+ "\t",
+ "\t_this.el.hide();",
+ "\t",
+ "\t",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "GestureClick"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "bool can_unselect" : true,
+ "id" : "treeselmodel",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "bool incremental" : true,
+ "id" : "treelistsort",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "Gtk.TreeListModelCreateModelFunc create_func" : [
+ "(item) => {",
+ "\t//GLib.debug(\"liststore got %s\", item.get_type().name());",
+ "\treturn ((JsRender.JsRender)item).childfiles;",
+ "} "
+ ],
+ "bool autoexpand" : true,
+ "bool passthrough" : false,
+ "id" : "treelistmodel",
+ "items" : [
+ {
+ "$ xns" : "GLib",
+ "* prop" : "root",
+ "GLib.Type item_type" : "typeof(JsRender.JsRender)",
+ "id" : "treemodel",
+ "xtype" : "ListStore"
+ }
+ ],
+ "xtype" : "TreeListModel"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "sorter",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "sorter",
+ "bool ignore_case" : true,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "expression",
+ "GLib.Type this_type" : "typeof(JsRender.JsRender) ",
+ "string property_name" : "name",
+ "xtype" : "PropertyExpression"
+ }
+ ],
+ "xtype" : "StringSorter"
+ }
+ ],
+ "xtype" : "TreeListRowSorter"
+ }
+ ],
+ "xtype" : "SortListModel"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "filter",
+ "Gtk.CustomFilterFunc match_func" : [
+ "(item) => { ",
+ "\tvar tr = ((Gtk.TreeListRow)item).get_item();",
+ "\t//GLib.debug(\"filter %s\", tr.get_type().name());",
+ "\tvar j = (JsRender.JsRender) tr;",
+ "\tif (j.xtype == \"Dir\" && j.childfiles.n_items < 1) {",
+ "\t\treturn false;",
+ "\t}",
+ "\tvar str = _this.searchbox.el.text.down();\t",
+ "\tif (j.xtype == \"Dir\") {",
+ "\t",
+ "\t\tif (str.length < 1) {",
+ "\t\t\treturn true;",
+ "\t\t}",
+ "\t\tfor (var i =0 ; i < j.childfiles.n_items; i++) {",
+ "\t\t\tvar f = (JsRender.JsRender) j.childfiles.get_item(i);",
+ "\t\t\tif (f.xtype != \"PlainFile\") {",
+ "\t\t\t\tcontinue;",
+ "\t\t\t}",
+ "\t\t\tif (f.name.down().contains(str)) {",
+ "\t\t\t\treturn true;",
+ "\t\t\t}",
+ "\t\t}",
+ "\t\treturn false;",
+ "\t}",
+ "\tif (j.xtype != \"PlainFile\") {",
+ "\t\treturn false;",
+ "\t}",
+ "",
+ "\tif (str.length < 1) {",
+ "\t\treturn true;",
+ "\t}",
+ "\tif (j.name.down().contains(str)) {",
+ "\t\treturn true;",
+ "\t}",
+ "\treturn false; ",
+ "",
+ "}"
+ ],
+ "id" : "treefilter",
+ "xtype" : "CustomFilter"
+ }
+ ],
+ "xtype" : "FilterListModel"
+ }
+ ],
+ "listeners" : {
+ "notify[\"selected\"]" : [
+ "() => {",
+ "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
+ "\t\tif (_this.iconsel.el.selected == Gtk.INVALID_LIST_POSITION) {",
+ "\t\t\t_this.btn_delfile.el.hide();",
+ "\t\t}",
+ "\t\treturn;",
+ "\t}",
+ "\t",
+ "\tvar tr = (Gtk.TreeListRow)_this.treeselmodel.el.selected_item;",
+ "\tGLib.debug(\"SELECTED = %s\", tr.item.get_type().name());",
+ "\tvar f = (JsRender.JsRender) tr.item;",
+ "\tif (f.xtype == \"Dir\") {",
+ "\t\t_this.btn_delfile.el.hide();\t",
+ "\t} else {",
+ "\t\t_this.btn_delfile.el.show();",
+ "\t}",
+ "",
+ "\t_this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;",
+ "",
+ "",
+ "}",
+ " ",
+ " ",
+ " "
+ ]
+ },
+ "xtype" : "SingleSelection",
+ "| JsRender.JsRender? selectedFile" : [
+ "() {",
+ "",
+ "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
+ "\t\treturn null;",
+ "\t}",
+ "\tvar tr = (Gtk.TreeListRow) this.el.selected_item;",
+ "",
+ "\treturn (JsRender.JsRender) tr.item;",
+ "}"
+ ]
+ },
+ {
+ "$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ "\t// this.el.set_sorter( new Gtk.StringSorter(",
+ "\t// \tnew Gtk.PropertyExpression(typeof(JsRender.NodeProp), null, \"name\")",
+ " //\t));",
+ "\t\t",
+ "}",
+ ""
+ ],
+ "* pack" : "append_column",
+ "bool expand" : true,
+ "bool resizable" : true,
+ "id" : "name",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "factory",
+ "listeners" : {
+ "bind" : [
+ "(listitem) => {",
+ "\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 lbl = (Gtk.Label) expand.child;",
+ "\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//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...",
+ " \t",
+ "}",
+ "",
+ "",
+ ""
+ ],
+ "setup" : [
+ "(listitem) => {",
+ "\t",
+ "\tvar expand = new Gtk.TreeExpander();",
+ "\t ",
+ "\texpand.set_indent_for_depth(true);",
+ "\texpand.set_indent_for_icon(true);",
+ "\t ",
+ "\tvar lbl = new Gtk.Label(\"\");",
+ "\tlbl.use_markup = true;",
+ "\t",
+ "\t",
+ " \tlbl.justify = Gtk.Justification.LEFT;",
+ " \tlbl.xalign = 0;",
+ "",
+ " ",
+ "\texpand.set_child(lbl);",
+ "\t((Gtk.ListItem)listitem).set_child(expand);",
+ "\t((Gtk.ListItem)listitem).activatable = false;",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "SignalListItemFactory"
+ }
+ ],
+ "string title" : "General Files",
+ "xtype" : "ColumnViewColumn"
+ }
+ ],
+ "string name" : "file-list",
+ "xtype" : "ColumnView"
+ }
+ ],
+ "xtype" : "ScrolledWindow"
+ }
+ ],
+ "xtype" : "Paned"
+ }
+ ],
+ "xtype" : "Paned"
+ }
+ ],
+ "xtype" : "Box"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "titlebar",
+ "* title" : "Select Project / File",
+ "bool show_title_buttons" : false,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "pack_end",
+ "listeners" : {
+ "clicked" : [
+ "( ) => {",
+ "\tif (BuilderApplication.windows.size < 2 && ",
+ "\t\t_this.win.windowstate.file == null",
+ "\t) { ",
+ "\t\tBuilderApplication.singleton(null).quit();",
+ "\t\treturn;",
+ "\t}",
+ "",
+ "\t_this.el.hide();",
+ "\t",
+ "\t if (_this.win.windowstate.file == null) {\t\t ",
+ "\t\tBuilderApplication.removeWindow(_this.win);",
+ "\t\t ",
+ "\t\t ",
+ "\t\t",
+ "\t}",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "string label" : "Close / Cancel",
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start",
+ "id" : "btn_newproj",
+ "items" : [
+ {
+ "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "$ xns" : "Gtk",
+ "* prop" : "child",
+ "items" : [
+ {
+ "$ Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
+ "$ xns" : "Gtk",
+ "int margin_end" : 4,
+ "string icon_name" : "folder-new",
+ "xtype" : "Image"
+ },
+ {
+ "$ Gtk.Align halign" : "Gtk.Align.START",
+ "$ xns" : "Gtk",
+ "string label" : "New Project",
+ "xtype" : "Label"
+ }
+ ],
+ "xtype" : "Box"
+ }
+ ],
+ "listeners" : {
+ "clicked" : [
+ " ( ) => {",
+ " ",
+ " // 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 );",
+ " ",
+ " ",
+ " pe.selected.connect((pr) => {",
+ " \t ",
+ "\t _this.show( pr, _this.new_window);",
+ "",
+ " });",
+ " ",
+ " ",
+ " pe.show();",
+ " ",
+ "",
+ "}"
+ ]
+ },
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start",
+ "id" : "btn_projprop",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "int spacing" : 0,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "int margin_end" : 4,
+ "string icon_name" : "emblem-system",
+ "xtype" : "Image"
+ },
+ {
+ "$ xns" : "Gtk",
+ "string label" : "Project Properties",
+ "xtype" : "Label"
+ }
+ ],
+ "xtype" : "Box"
+ }
+ ],
+ "listeners" : {
+ "clicked" : [
+ " ( ) => {",
+ " // should disable the button really.",
+ " if (_this.selectedProject == null) {",
+ "\t return;",
+ " }",
+ "\t_this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject);",
+ " }"
+ ]
+ },
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start",
+ "DialogConfirm confirm" : "null",
+ "id" : "btn_delproj",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "int spacing" : 0,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "string icon_name" : "user-trash",
+ "xtype" : "Image"
+ },
+ {
+ "$ xns" : "Gtk",
+ "string label" : "Delete Project",
+ "xtype" : "Label"
+ }
+ ],
+ "xtype" : "Box"
+ }
+ ],
+ "listeners" : {
+ "clicked" : [
+ " ( ) => {",
+ " ",
+ " ",
+ " \tif (this.confirm == null) {",
+ " \t\tthis.confirm = new DialogConfirm();",
+ " \t\tthis.confirm.el.set_transient_for(_this.el);",
+ "\t}",
+ "\t",
+ "\tvar project = (Project.Project) _this.projectsort.el.get_item(",
+ "\t\t_this.projectselection.el.selected",
+ "\t\t);",
+ "\t",
+ "\tthis.confirm.el.response.connect((res) => {",
+ "\t\tthis.confirm.el.hide();",
+ "\t\tif (res == Gtk.ResponseType.CANCEL) {",
+ "\t\t\treturn;",
+ "\t\t}",
+ "\t project = (Project.Project) _this.projectsort.el.get_item(",
+ "\t\t\t_this.projectselection.el.selected",
+ "\t\t);",
+ "\t\tProject.Project.remove(project);",
+ "\t _this.projectmodel.remove(project);",
+ "\t\t_this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;",
+ "\t",
+ "\t});",
+ " \tthis.confirm.showIt(\"Confirm Delete Project\", \"Are you sure you want to delete this project?\");",
+ "}"
+ ]
+ },
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start",
+ "id" : "btn_addfile",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "int spacing" : 0,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "int margin_end" : 4,
+ "string icon_name" : "document-new",
+ "xtype" : "Image"
+ },
+ {
+ "$ xns" : "Gtk",
+ "string label" : "New File",
+ "xtype" : "Label"
+ }
+ ],
+ "xtype" : "Box"
+ }
+ ],
+ "listeners" : {
+ "clicked" : [
+ " () => {",
+ " // create a new file in project..",
+ " print(\"add file selected\\n\");",
+ " ",
+ " if (_this.selectedProject == null) {",
+ " \treturn;",
+ " }",
+ " try {",
+ " \tvar f = JsRender.JsRender.factory(_this.selectedProject.xtype, _this.selectedProject, \"\");",
+ " \t_this.win.windowstate.file_details.show( f, _this.el, _this.new_window );",
+ " } catch (JsRender.Error e) {}",
+ "",
+ "}"
+ ]
+ },
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start",
+ "DialogConfirm confirm" : "null",
+ "id" : "btn_delfile",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "int spacing" : 0,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "string icon_name" : "user-trash",
+ "xtype" : "Image"
+ },
+ {
+ "$ xns" : "Gtk",
+ "string label" : "Delete File",
+ "xtype" : "Label"
+ }
+ ],
+ "xtype" : "Box"
+ }
+ ],
+ "listeners" : {
+ "clicked" : [
+ " ( ) => {",
+ " ",
+ " \tif (this.confirm == null) {",
+ " \t\tthis.confirm = new DialogConfirm();",
+ " \t\tthis.confirm.el.set_transient_for(_this.el);",
+ " ",
+ "\t}",
+ "\tGLib.debug(\"DELETE\");",
+ "\tvar is_icon = true;",
+ " \tvar isel = _this.iconsel.selectedFile();",
+ " \t ",
+ " \tif (isel == null) {",
+ " \t\tGLib.debug(\"DELETE - no icons selected\");",
+ "\t \tis_icon = false;",
+ "\t \tisel = _this.treeselmodel.selectedFile();",
+ " \t}",
+ " \tif (isel == null) {",
+ " \t \t\tGLib.debug(\"DELETE - no tree item selected\");",
+ " \t\treturn; // should nto happen..",
+ "\t}",
+ "\t",
+ "\tGLib.debug(\"DELETE - calling confirm.\");",
+ "\tthis.confirm.el.response.connect((res) => {",
+ "\t\tthis.confirm.el.hide();",
+ "\t\tif (res == Gtk.ResponseType.CANCEL) {",
+ "\t\t\treturn;",
+ "\t\t}",
+ "\t\tis_icon = true;",
+ "\t \tisel = _this.iconsel.selectedFile();",
+ "\t \tif (isel == null) {",
+ "\t\t \tis_icon = false;",
+ "\t\t \tisel = _this.treeselmodel.selectedFile();",
+ "\t \t}",
+ "\t \tif (isel == null) {",
+ "\t \t\treturn; // should nto happen..",
+ "\t\t}",
+ "\t\t",
+ "\t \tif (is_icon) {",
+ "\t\t \tisel.project.deleteFile(isel);",
+ "\t \t\t_this.gridmodel.remove(isel);",
+ "\t \t\treturn;",
+ " \t\t}",
+ " \t\tisel.project.deleteFile(isel); \t\t",
+ "\t",
+ "\t});",
+ "\t \tthis.confirm.showIt(\"Confirm Delete File\",",
+ "\t \t\t\"Are you sure you want to delete this file?\");",
+ " \t",
+ " ",
+ "",
+ "} "
+ ]
+ },
+ "xtype" : "Button"
+ }
+ ],
+ "xtype" : "HeaderBar"
+ }
+ ],
+ "name" : "DialogFiles",
+ "string lastfilter" : "",
+ "title" : "Select Project / File",
+ "xtype" : "Window",
+ "| 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);",
+ "",
+ "\t_this.project_list.el.set_model(_this.projectselection.el);",
+ "\t",
+ "\t_this.is_loading = false;",
+ " ",
+ " _this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION; ",
+ "\t_this.btn_delfile.el.hide();",
+ "\t",
+ " ",
+ "}",
+ ""
+ ],
+ "| void onProjectSelected" : [
+ "(Project.Project? project) ",
+ "{",
+ "\tif (this.in_onprojectselected) { ",
+ "\t\treturn;",
+ "\t}",
+ "\tthis.selectedProject = project;",
+ "\t",
+ "\tif (project == null) {",
+ "\t\tGLib.debug(\"Hide project files\");",
+ "\t\t_this.mainpane.el.set_end_child(null);",
+ "\t\t_this.filepane.el.hide();",
+ "\t\treturn;",
+ "\t\t",
+ "\t}",
+ "\t",
+ "\tGLib.debug(\"Show project files\");",
+ "\t_this.mainpane.el.set_end_child(_this.filepane.el);",
+ "\t",
+ "\t_this.filepane.el.show();\t",
+ "\tthis.in_onprojectselected = true;",
+ "\t",
+ "\t",
+ "",
+ "\tproject.load();",
+ "\t ",
+ "\t",
+ "\t_this.searchbox.el.text = \"\";",
+ "\t _this.gridview.el.set_model(new Gtk.SingleSelection(null));",
+ "\t _this.selectedProject.loadFilesIntoStore(_this.gridmodel.el);",
+ "\t _this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;",
+ " \t \t",
+ "\t _this.gridview.el.set_model(_this.iconsel.el);",
+ "\t ",
+ " \t ",
+ " \t GLib.Timeout.add(500, () => {",
+ " \t\t_this.iconsel.el.selected = Gtk.INVALID_LIST_POSITION;",
+ " \t \t _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;\t\t ",
+ "\t ",
+ "\t _this.searchbox.el.grab_focus();",
+ "\t\t return false;",
+ " });",
+ "\t _this.treeview.el.set_model(new Gtk.SingleSelection(null));",
+ " ",
+ " this.selectedProject.loadDirsIntoStore(_this.treemodel.el);",
+ " ",
+ " _this.treeview.el.set_model(_this.treeselmodel.el);",
+ " ",
+ " \t _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;",
+ " \tthis.treescroll.el.vadjustment.value = 0;",
+ "\tthis.in_onprojectselected = false;\t",
+ "}",
+ ""
+ ],
+ "| void selectProject" : [
+ "(Project.Project? project) {",
+ " ",
+ "\t",
+ "\t ",
+ "\tvar sm = this.projectselection.el;",
+ "\tif (project == null) {",
+ "\t\tsm.selected = Gtk.INVALID_LIST_POSITION;",
+ "\t\tthis.onProjectSelected(null);",
+ "\t\treturn;",
+ "\t}",
+ "",
+ "\t",
+ "\tfor (var i =0; i < sm.n_items; i++) {",
+ "\t\tvar p = (Project.Project) sm.get_item(i);",
+ "\t\tif (p.path == project.path) {",
+ "\t\t\tGLib.debug(\"Select Project %s => %d\", project.name, i);",
+ "\t\t\tsm.selected = i;",
+ "\t\t\tbreak;",
+ "\t\t}",
+ "\t} ",
+ "\t",
+ "}",
+ ""
+ ],
+ "| void show" : [
+ "(Project.Project? project, bool new_window) {",
+ " ",
+ " \tthis.new_window = new_window;",
+ "",
+ " this.projectscroll.el.vadjustment.value = 0; // scroll to top?",
+ " ",
+ " ",
+ "\t //var win = this.win.el;",
+ " //var w = win.get_width();",
+ " //var h = win.get_height();",
+ " ",
+ "\t",
+ "\t this.el.show();",
+ "\t \tthis.load();",
+ "\tthis.selectProject(project);",
+ "\tthis.onProjectSelected(project); //?? twice?",
+ "\t ",
+ "\t GLib.Timeout.add(500, () => {",
+ "\t \tif (project == null) {",
+ " \t \t\t_this.projectselection.el.selected = Gtk.INVALID_LIST_POSITION;",
+ "\t\t\t\tthis.onProjectSelected(null); ",
+ "\t",
+ "\t\t\t} ",
+ "\t this.el.set_size_request( 800 , 750); // ?? based on default ",
+ "\t return false;",
+ " });",
+ "\t ",
+ "}//"
+ ]
+ }
+ ],
+ "name" : "DialogFiles"
+}
\ No newline at end of file
--- /dev/null
+ 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 );
+ var child_2 = new Xcls_mainpane( _this );
+ this.el.append( child_2.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;
+ var child_1 = new Xcls_projectscroll( _this );
+ this.el.start_child = child_1.el;
+ var child_2 = new Xcls_filepane( _this );
+ this.el.end_child = child_2.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;
+ var child_1 = new Xcls_project_list( _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_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;
+ var child_1 = new Xcls_projectselection( _this );
+ this.el = new Gtk.ColumnView( child_1.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;
+ var child_1 = new Xcls_projectsort( _this );
+ 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( (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;
+ var child_1 = new Xcls_projectmodel( _this );
+ var child_2 = new Xcls_StringSorter10( _this );
+ child_2.ref();
+ this.el = new Gtk.SortListModel( child_1.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 = (JsRender.JsRender) ((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;
+ var child_2 = new Xcls_treescroll( _this );
+ this.el.start_child = child_2.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 );
+ var child_2 = new Xcls_iconscroll( _this );
+ this.el.append( child_2.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;
+ var child_1 = new Xcls_searchbox( _this );
+ this.el.append( child_1.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;
+ var child_1 = new Xcls_gridview( _this );
+ this.el.child = child_1.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;
+ var child_1 = new Xcls_iconsel( _this );
+ var child_2 = new Xcls_SignalListItemFactory29( _this );
+ child_2.ref();
+ this.el = new Gtk.GridView( child_1.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;
+ var child_1 = new Xcls_gridsort( _this );
+ var child_2 = new Xcls_iconsearch( _this );
+ this.el = new Gtk.FilterListModel( child_1.el, child_2.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;
+ var child_1 = new Xcls_gridmodel( _this );
+ var child_2 = new Xcls_StringSorter25( _this );
+ child_2.ref();
+ this.el = new Gtk.SortListModel( child_1.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
+ }
+
+
+
+
+ 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;
+ var child_1 = new Xcls_treeview( _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_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;
+ var child_1 = new Xcls_treeselmodel( _this );
+ this.el = new Gtk.ColumnView( child_1.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 );
+ var child_3 = new Xcls_name( _this );
+ this.el.append_column ( child_3.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;
+ var child_1 = new Xcls_treelistsort( _this );
+ var child_2 = new Xcls_treefilter( _this );
+ this.el = new Gtk.FilterListModel( child_1.el, child_2.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;
+ var child_1 = new Xcls_treelistmodel( _this );
+ var child_2 = new Xcls_TreeListRowSorter38( _this );
+ child_2.ref();
+ this.el = new Gtk.SortListModel( child_1.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;
+ var child_1 = new Xcls_treemodel( _this );
+ this.el = new Gtk.TreeListModel( child_1.el, false, true, (item) => {
+ //GLib.debug("liststore got %s", item.get_type().name());
+ return ((JsRender.JsRender)item).childfiles;
+} );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+ public class Xcls_treemodel : Object
+ {
+ public GLib.ListStore el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_treemodel(DialogFiles _owner )
+ {
+ _this = _owner;
+ _this.treemodel = this;
+ this.el = new GLib.ListStore( typeof(JsRender.JsRender) );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_TreeListRowSorter38 : Object
+ {
+ public Gtk.TreeListRowSorter el;
+ private DialogFiles _this;
+
+
+ // 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 );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+ public class Xcls_StringSorter39 : Object
+ {
+ public Gtk.StringSorter el;
+ private DialogFiles _this;
+
+
+ // 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 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.ignore_case = true;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_PropertyExpression40 : Object
+ {
+ public Gtk.PropertyExpression el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_PropertyExpression40(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_treefilter : Object
+ {
+ public Gtk.CustomFilter el;
+ private DialogFiles _this;
+
+
+ // my vars (def)
+
+ // 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;
+ if (j.xtype == "Dir" && j.childfiles.n_items < 1) {
+ return false;
+ }
+ var str = _this.searchbox.el.text.down();
+ if (j.xtype == "Dir") {
+
+ if (str.length < 1) {
+ return true;
+ }
+ for (var i =0 ; i < j.childfiles.n_items; i++) {
+ var f = (JsRender.JsRender) j.childfiles.get_item(i);
+ if (f.xtype != "PlainFile") {
+ continue;
+ }
+ if (f.name.down().contains(str)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ if (j.xtype != "PlainFile") {
+ return false;
+ }
+
+ if (str.length < 1) {
+ return true;
+ }
+ if (j.name.down().contains(str)) {
+ return true;
+ }
+ return false;
+
+} );
+
+ // 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 );
+ var child_2 = new Xcls_btn_newproj( _this );
+ this.el.pack_start ( child_2.el );
+ var child_3 = new Xcls_btn_projprop( _this );
+ this.el.pack_start ( child_3.el );
+ var child_4 = new Xcls_btn_delproj( _this );
+ this.el.pack_start ( child_4.el );
+ var child_5 = new Xcls_btn_addfile( _this );
+ this.el.pack_start ( child_5.el );
+ var child_6 = new Xcls_btn_delfile( _this );
+ this.el.pack_start ( child_6.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 );
+
+
+ pe.selected.connect((pr) => {
+
+ _this.show( pr, _this.new_window);
+
+ });
+
+
+ pe.show();
+
+
+ });
+ }
+
+ // user defined functions
+ }
+ 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);
+ });
+ }
+
+ // 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)
+
+ // 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
+ }
+
+
+
+
+ }
+++ /dev/null
-{
- "build_module" : "",
- "items" : [
- {
- "# JsRender.JsRender file" : "null",
- "# Project.Project project" : "",
- "$ deletable" : true,
- "$ modal" : true,
- "$ xns" : "Gtk",
- "@ void success" : "(Project.Project pr, JsRender.JsRender file)",
- "default_height" : 200,
- "default_width" : 500,
- "id" : "DialogNewComponent",
- "items" : [
- {
- "$ pack" : "get_content_area().add",
- "$ xns" : "Gtk",
- "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
- "items" : [
- {
- "$ homogeneous" : true,
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "attach,0,0",
- "Gtk.Justification justify" : "Gtk.Justification.RIGHT",
- "label" : "Component Name",
- "x_options" : 4,
- "xalign" : 0.90000000000000002,
- "xtype" : "Label"
- },
- {
- "$ visible" : true,
- "$ xns" : "Gtk",
- "* pack" : "attach,1,0",
- "id" : "name",
- "xtype" : "Entry"
- },
- {
- "$ visible" : true,
- "$ xns" : "Gtk",
- "* pack" : "attach,0,1",
- "Gtk.Justification justify" : "Gtk.Justification.RIGHT",
- "label" : "Title",
- "x_options" : 4,
- "xalign" : 0.90000000000000002,
- "xtype" : "Label"
- },
- {
- "$ visible" : true,
- "$ xns" : "Gtk",
- "* pack" : "attach,1,1",
- "id" : "title",
- "xtype" : "Entry"
- },
- {
- "$ justify" : "Gtk.Justification.RIGHT",
- "$ visible" : true,
- "$ xns" : "Gtk",
- "* pack" : "attach,0,2",
- "label" : "Region",
- "tooltip_text" : "center, north, south, east, west",
- "x_options" : 4,
- "xalign" : 0.90000000000000002,
- "xtype" : "Label"
- },
- {
- "$ visible" : true,
- "$ xns" : "Gtk",
- "* pack" : "attach,1,2",
- "id" : "region",
- "xtype" : "Entry"
- },
- {
- "$ justify" : "Gtk.Justification.RIGHT",
- "$ visible" : true,
- "$ xns" : "Gtk",
- "* pack" : "attach,0,3",
- "label" : "Parent Name",
- "x_options" : 4,
- "xalign" : 0.90000000000000002,
- "xtype" : "Label"
- },
- {
- "$ visible" : true,
- "$ xns" : "Gtk",
- "* pack" : "attach,1,3",
- "id" : "parent",
- "xtype" : "Entry"
- },
- {
- "$ justify" : "Gtk.Justification.RIGHT",
- "$ visible" : true,
- "$ xns" : "Gtk",
- "* pack" : "attach,0,4",
- "label" : "Permission Name",
- "x_options" : 4,
- "xalign" : 0.90000000000000002,
- "xtype" : "Label"
- },
- {
- "$ visible" : true,
- "$ xns" : "Gtk",
- "* pack" : "attach,1,4",
- "id" : "permname",
- "xtype" : "Entry"
- },
- {
- "$ justify" : "Gtk.Justification.RIGHT",
- "$ visible" : true,
- "$ xns" : "Gtk",
- "* pack" : "attach,0,6",
- "label" : "Order (for tabs)",
- "x_options" : 4,
- "xalign" : 0.90000000000000002,
- "xtype" : "Label"
- },
- {
- "$ visible" : true,
- "$ xns" : "Gtk",
- "* pack" : "attach,1,6",
- "id" : "modOrder",
- "xtype" : "Entry"
- },
- {
- "$ justify" : "Gtk.Justification.RIGHT",
- "$ visible" : true,
- "$ xns" : "Gtk",
- "* pack" : "attach,0,7",
- "label" : "Module to build (Vala only)",
- "x_options" : 4,
- "xalign" : 0.90000000000000002,
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* init" : "this.el.add_attribute(_this.dbcellrenderer.el , \"markup\", 1 );",
- "* pack" : "attach,1,7",
- "id" : "build_module",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "dbcellrenderer",
- "xtype" : "CellRendererText"
- },
- {
- "$ columns" : "typeof(string),typeof(string)",
- "$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "dbmodel",
- "n_columns" : 2,
- "xtype" : "ListStore",
- "| void loadData" : [
- " (Gee.ArrayList<string> data, string cur) {",
- " this.el.clear(); ",
- " Gtk.TreeIter iter;",
- " var el = this.el;",
- " ",
- " /// el.append(out iter);",
- " ",
- " ",
- " // el.set_value(iter, 0, \"\");",
- " // el.set_value(iter, 1, \"aaa - Just add Element - aaa\");",
- "",
- " el.append(out iter);",
- "",
- " ",
- " el.set_value(iter, 0, \"\");",
- " el.set_value(iter, 1, \"-- select a module --\");",
- " _this.build_module.el.set_active_iter(iter);",
- " ",
- " for (var i = 0; i < data.size;i++) {",
- " ",
- "",
- " el.append(out iter);",
- " ",
- " el.set_value(iter, 0, data.get(i));",
- " el.set_value(iter, 1, data.get(i));",
- " ",
- " if (data.get(i) == cur) {",
- " _this.build_module.el.set_active_iter(iter);",
- " }",
- " ",
- " }",
- " this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); ",
- " ",
- "}",
- ""
- ]
- }
- ],
- "xtype" : "ComboBox"
- }
- ],
- "n_columns" : 2,
- "n_rows" : 3,
- "xtype" : "Grid"
- }
- ],
- "xtype" : "Box"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add_action_widget,0",
- "label" : "Cancel",
- "xtype" : "Button"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add_action_widget,1",
- "label" : "OK",
- "xtype" : "Button"
- }
- ],
- "listeners" : {
- "delete_event" : [
- "(self, event) => {",
- " this.el.hide();",
- " return true; ",
- " //test ",
- "} "
- ],
- "response" : [
- " (self, response_id) => { ",
- " ",
- "\tif (response_id < 1) { // cancel!",
- " this.el.hide();",
- " return;",
- " }",
- "",
- "",
- "",
- " if (_this.name.el.get_text().length < 1) {",
- " Xcls_StandardErrorDialog.singleton().show(",
- " this.el,",
- " \"You have to set Component name \"",
- " );",
- " ",
- " return;",
- " }",
- " // what does this do?",
- " ",
- " var isNew = _this.file.name.length > 0 ? false : true;",
- " /*",
- " if (!isNew && this.file.name != _this.name.el.get_text()) {",
- " Xcls_StandardErrorDialog.singleton().show(",
- " this.el,",
- " \"Sorry changing names does not work yet. \"",
- " );",
- " ",
- " return;",
- " }",
- " */",
- " ",
- " ",
- " ",
- " // FIXME - this may be more complicated...",
- " //for (var i in this.def) {",
- " // this.file[i] = this.get(i).el.get_text();",
- " //}",
- "",
- " if (!isNew) {",
- " ",
- " this.updateFileFromEntry();",
- " ",
- " ",
- " _this.file.save();",
- " this.el.hide();",
- " return;",
- " }",
- " var fn = this.name.el.get_text();",
- " var dir = _this.project.firstPath();",
- " ",
- " if (GLib.FileUtils.test(dir + \"/\" + fn + \".bjs\", GLib.FileTest.EXISTS)) {",
- " Xcls_StandardErrorDialog.singleton().show(",
- " this.el,",
- " \"That file already exists\"",
- " ); ",
- " return;",
- " }",
- " try {",
- "\t\t var f = JsRender.JsRender.factory(",
- "\t\t _this.file.project.xtype, ",
- "\t\t _this.file.project, ",
- "\t\t dir + \"/\" + fn + \".bjs\");",
- "",
- "\t\t _this.file = f;",
- " ",
- "\t\t} catch (JsRender.Error e) {",
- "\t\t Xcls_StandardErrorDialog.singleton().show(",
- " this.el,",
- " \"Error creating file? \"",
- " );",
- " return;",
- "\t\t\t ",
- "\t\t}",
- " ",
- " this.updateFileFromEntry();",
- " _this.file.save();",
- " _this.file.project.addFile(_this.file);",
- " ",
- "\t ",
- " // what about .js ?",
- " ",
- " this.el.hide();",
- " ",
- " ",
- " //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());",
- " ",
- " //var nf = _this.project.create(dir + \"/\" + _this.file.name + \".bjs\");",
- " //for (var i in this.file) {",
- " // nf[i] = this.file[i];",
- " //}",
- " _this.success(_this.project, _this.file);",
- " /*",
- "",
- " -- fixme -- needs to be a signal..",
- " if (DialogNewComponent.success != null) {",
- " DialogNewComponent.success(_this.project, nf);",
- " }",
- " */",
- "}"
- ],
- "show" : [
- "(self) => {",
- " this.el.show_all();",
- " //test",
- "}"
- ]
- },
- "title" : "New Component",
- "xtype" : "Dialog",
- "| void show" : [
- "(JsRender.JsRender c) ",
- "{",
- " this.project = c.project;",
- " ",
- " //if (!this.el) {",
- " //this.init();",
- " //}",
- " ",
- " _this.name.el.set_text(c.name);",
- " _this.title.el.set_text(c.title);",
- " _this.parent.el.set_text(c.parent); ",
- " _this.region.el.set_text(c.region);",
- " _this.modOrder.el.set_text(c.modOrder);",
- " _this.permname.el.set_text(c.permname);",
- " ",
- " if (c.path.length > 0) {",
- " this.el.set_title(\"Edit File Details - \" + c.name);",
- " } else {",
- " this.el.set_title(\"Create New File\");",
- " }",
- " ",
- " var ar = new Gee.ArrayList<string>();",
- " _this.dbmodel.loadData(ar,\"\");",
- " // load the modules... if relivant..",
- " if (this.project.xtype == \"Gtk\") {",
- " var p = (Project.Gtk)c.project;",
- " var cg = p.compilegroups;",
- "",
- " var iter = cg.map_iterator();",
- " while(iter.next()) {",
- " var key = iter.get_key();",
- " if (key == \"_default_\") {",
- " continue;",
- " }",
- " ar.add(key);",
- " };",
- " _this.dbmodel.loadData(ar, c.build_module);",
- "",
- " } ",
- " ",
- " _this.file = c;",
- " //console.log('show all');",
- " this.el.show_all();",
- " ",
- " //this.success = c.success;",
- " ",
- " ",
- "}"
- ],
- "| void updateFileFromEntry" : [
- "() {",
- "",
- " _this.file.title = _this.title.el.get_text();",
- " _this.file.region = _this.region.el.get_text(); ",
- " _this.file.parent = _this.parent.el.get_text(); ",
- " _this.file.permname = _this.permname.el.get_text(); ",
- " _this.file.modOrder = _this.modOrder.el.get_text();",
- " ",
- " if (_this.file.name.length > 0 && _this.file.name != _this.name.el.get_text()) {",
- " try {",
- " \t_this.file.renameTo(_this.name.el.get_text());",
- " \t} catch (JsRender.Error e) {",
- " \t\treturn;",
- " \t}",
- " }",
- " // store the module...",
- " _this.file.build_module = \"\"; ",
- " Gtk.TreeIter iter; ",
- " if (_this.build_module.el.get_active_iter (out iter)) {",
- " Value vfname;",
- " this.dbmodel.el.get_value (iter, 0, out vfname);",
- " if (((string)vfname).length > 0) {",
- " _this.file.build_module = (string)vfname;",
- " }",
- " ",
- " }",
- " ",
- " ",
- "",
- " ",
- "} "
- ]
- }
- ],
- "modOrder" : "",
- "name" : "DialogNewComponent",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/DialogNewComponent.bjs",
- "permname" : "",
- "title" : ""
-}
\ No newline at end of file
+++ /dev/null
-static Xcls_DialogNewComponent _DialogNewComponent;
-
-public class Xcls_DialogNewComponent : Object
-{
- public Gtk.Dialog el;
- private Xcls_DialogNewComponent _this;
-
- public static Xcls_DialogNewComponent singleton()
- {
- if (_DialogNewComponent == null) {
- _DialogNewComponent= new Xcls_DialogNewComponent();
- }
- return _DialogNewComponent;
- }
- public Xcls_name name;
- public Xcls_title title;
- public Xcls_region region;
- public Xcls_parent parent;
- public Xcls_permname permname;
- public Xcls_modOrder modOrder;
- public Xcls_build_module build_module;
- public Xcls_dbcellrenderer dbcellrenderer;
- public Xcls_dbmodel dbmodel;
-
- // my vars (def)
- public signal void success (Project.Project pr, JsRender.JsRender file);
- public JsRender.JsRender file;
- public Project.Project project;
-
- // ctor
- public Xcls_DialogNewComponent()
- {
- _this = this;
- this.el = new Gtk.Dialog();
-
- // my vars (dec)
- this.file = null;
-
- // set gobject values
- this.el.title = "New Component";
- this.el.default_height = 200;
- this.el.default_width = 500;
- this.el.deletable = true;
- this.el.modal = true;
- var child_0 = new Xcls_Box2( _this );
- child_0.ref();
- this.el.get_content_area().add( child_0.el );
- var child_1 = new Xcls_Button20( _this );
- child_1.ref();
- this.el.add_action_widget ( child_1.el , 0 );
- var child_2 = new Xcls_Button21( _this );
- child_2.ref();
- this.el.add_action_widget ( child_2.el , 1 );
-
- //listeners
- this.el.delete_event.connect( (self, event) => {
- this.el.hide();
- return true;
- //test
- });
- this.el.response.connect( (self, response_id) => {
-
- if (response_id < 1) { // cancel!
- this.el.hide();
- return;
- }
-
-
-
- if (_this.name.el.get_text().length < 1) {
- Xcls_StandardErrorDialog.singleton().show(
- this.el,
- "You have to set Component name "
- );
-
- return;
- }
- // what does this do?
-
- var isNew = _this.file.name.length > 0 ? false : true;
- /*
- if (!isNew && this.file.name != _this.name.el.get_text()) {
- Xcls_StandardErrorDialog.singleton().show(
- this.el,
- "Sorry changing names does not work yet. "
- );
-
- return;
- }
- */
-
-
-
- // FIXME - this may be more complicated...
- //for (var i in this.def) {
- // this.file[i] = this.get(i).el.get_text();
- //}
-
- if (!isNew) {
-
- this.updateFileFromEntry();
-
-
- _this.file.save();
- this.el.hide();
- return;
- }
- var fn = this.name.el.get_text();
- var dir = _this.project.firstPath();
-
- if (GLib.FileUtils.test(dir + "/" + fn + ".bjs", GLib.FileTest.EXISTS)) {
- Xcls_StandardErrorDialog.singleton().show(
- this.el,
- "That file already exists"
- );
- return;
- }
- try {
- var f = JsRender.JsRender.factory(
- _this.file.project.xtype,
- _this.file.project,
- dir + "/" + fn + ".bjs");
-
- _this.file = f;
-
- } catch (JsRender.Error e) {
- Xcls_StandardErrorDialog.singleton().show(
- this.el,
- "Error creating file? "
- );
- return;
-
- }
-
- this.updateFileFromEntry();
- _this.file.save();
- _this.file.project.addFile(_this.file);
-
-
- // what about .js ?
-
- this.el.hide();
-
-
- //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());
-
- //var nf = _this.project.create(dir + "/" + _this.file.name + ".bjs");
- //for (var i in this.file) {
- // nf[i] = this.file[i];
- //}
- _this.success(_this.project, _this.file);
- /*
-
- -- fixme -- needs to be a signal..
- if (DialogNewComponent.success != null) {
- DialogNewComponent.success(_this.project, nf);
- }
- */
- });
- this.el.show.connect( (self) => {
- this.el.show_all();
- //test
- });
- }
-
- // user defined functions
- public void show (JsRender.JsRender c)
- {
- this.project = c.project;
-
- //if (!this.el) {
- //this.init();
- //}
-
- _this.name.el.set_text(c.name);
- _this.title.el.set_text(c.title);
- _this.parent.el.set_text(c.parent);
- _this.region.el.set_text(c.region);
- _this.modOrder.el.set_text(c.modOrder);
- _this.permname.el.set_text(c.permname);
-
- if (c.path.length > 0) {
- this.el.set_title("Edit File Details - " + c.name);
- } else {
- this.el.set_title("Create New File");
- }
-
- var ar = new Gee.ArrayList<string>();
- _this.dbmodel.loadData(ar,"");
- // load the modules... if relivant..
- if (this.project.xtype == "Gtk") {
- var p = (Project.Gtk)c.project;
- var cg = p.compilegroups;
-
- var iter = cg.map_iterator();
- while(iter.next()) {
- var key = iter.get_key();
- if (key == "_default_") {
- continue;
- }
- ar.add(key);
- };
- _this.dbmodel.loadData(ar, c.build_module);
-
- }
-
- _this.file = c;
- //console.log('show all');
- this.el.show_all();
-
- //this.success = c.success;
-
-
- }
- public void updateFileFromEntry () {
-
- _this.file.title = _this.title.el.get_text();
- _this.file.region = _this.region.el.get_text();
- _this.file.parent = _this.parent.el.get_text();
- _this.file.permname = _this.permname.el.get_text();
- _this.file.modOrder = _this.modOrder.el.get_text();
-
- if (_this.file.name.length > 0 && _this.file.name != _this.name.el.get_text()) {
- try {
- _this.file.renameTo(_this.name.el.get_text());
- } catch (JsRender.Error e) {
- return;
- }
- }
- // store the module...
- _this.file.build_module = "";
- Gtk.TreeIter iter;
- if (_this.build_module.el.get_active_iter (out iter)) {
- Value vfname;
- this.dbmodel.el.get_value (iter, 0, out vfname);
- if (((string)vfname).length > 0) {
- _this.file.build_module = (string)vfname;
- }
-
- }
-
-
-
-
- }
- public class Xcls_Box2 : Object
- {
- public Gtk.Box el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box2(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_Grid3( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,false,0 );
- }
-
- // user defined functions
- }
- public class Xcls_Grid3 : Object
- {
- public Gtk.Grid el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Grid3(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- this.el = new Gtk.Grid();
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_Label4( _this );
- child_0.ref();
- this.el.attach ( child_0.el , 0,0 );
- var child_1 = new Xcls_name( _this );
- child_1.ref();
- this.el.attach ( child_1.el , 1,0 );
- var child_2 = new Xcls_Label6( _this );
- child_2.ref();
- this.el.attach ( child_2.el , 0,1 );
- var child_3 = new Xcls_title( _this );
- child_3.ref();
- this.el.attach ( child_3.el , 1,1 );
- var child_4 = new Xcls_Label8( _this );
- child_4.ref();
- this.el.attach ( child_4.el , 0,2 );
- var child_5 = new Xcls_region( _this );
- child_5.ref();
- this.el.attach ( child_5.el , 1,2 );
- var child_6 = new Xcls_Label10( _this );
- child_6.ref();
- this.el.attach ( child_6.el , 0,3 );
- var child_7 = new Xcls_parent( _this );
- child_7.ref();
- this.el.attach ( child_7.el , 1,3 );
- var child_8 = new Xcls_Label12( _this );
- child_8.ref();
- this.el.attach ( child_8.el , 0,4 );
- var child_9 = new Xcls_permname( _this );
- child_9.ref();
- this.el.attach ( child_9.el , 1,4 );
- var child_10 = new Xcls_Label14( _this );
- child_10.ref();
- this.el.attach ( child_10.el , 0,6 );
- var child_11 = new Xcls_modOrder( _this );
- child_11.ref();
- this.el.attach ( child_11.el , 1,6 );
- var child_12 = new Xcls_Label16( _this );
- child_12.ref();
- this.el.attach ( child_12.el , 0,7 );
- var child_13 = new Xcls_build_module( _this );
- child_13.ref();
- this.el.attach ( child_13.el , 1,7 );
- }
-
- // user defined functions
- }
- public class Xcls_Label4 : Object
- {
- public Gtk.Label el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label4(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Component Name" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- }
-
- // user defined functions
- }
-
- public class Xcls_name : Object
- {
- public Gtk.Entry el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_name(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- _this.name = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_Label6 : Object
- {
- public Gtk.Label el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label6(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Title" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_title : Object
- {
- public Gtk.Entry el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_title(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- _this.title = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_Label8 : Object
- {
- public Gtk.Label el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label8(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Region" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.tooltip_text = "center, north, south, east, west";
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_region : Object
- {
- public Gtk.Entry el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_region(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- _this.region = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_Label10 : Object
- {
- public Gtk.Label el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label10(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Parent Name" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_parent : Object
- {
- public Gtk.Entry el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_parent(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- _this.parent = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_Label12 : Object
- {
- public Gtk.Label el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label12(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Permission Name" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_permname : Object
- {
- public Gtk.Entry el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_permname(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- _this.permname = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_Label14 : Object
- {
- public Gtk.Label el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label14(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Order (for tabs)" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_modOrder : Object
- {
- public Gtk.Entry el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_modOrder(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- _this.modOrder = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_Label16 : Object
- {
- public Gtk.Label el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label16(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Module to build (Vala only)" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.visible = true;
- }
-
- // user defined functions
- }
-
- public class Xcls_build_module : Object
- {
- public Gtk.ComboBox el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_build_module(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- _this.build_module = this;
- this.el = new Gtk.ComboBox();
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_dbcellrenderer( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
- var child_1 = new Xcls_dbmodel( _this );
- child_1.ref();
- this.el.set_model ( child_1.el );
-
- // init method
-
- this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
- }
-
- // user defined functions
- }
- public class Xcls_dbcellrenderer : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_dbcellrenderer(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- _this.dbcellrenderer = this;
- this.el = new Gtk.CellRendererText();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_dbmodel : Object
- {
- public Gtk.ListStore el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_dbmodel(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- _this.dbmodel = this;
- this.el = new Gtk.ListStore.newv( { typeof(string),typeof(string) } );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- public void loadData (Gee.ArrayList<string> data, string cur) {
- this.el.clear();
- Gtk.TreeIter iter;
- var el = this.el;
-
- /// el.append(out iter);
-
-
- // el.set_value(iter, 0, "");
- // el.set_value(iter, 1, "aaa - Just add Element - aaa");
-
- el.append(out iter);
-
-
- el.set_value(iter, 0, "");
- el.set_value(iter, 1, "-- select a module --");
- _this.build_module.el.set_active_iter(iter);
-
- for (var i = 0; i < data.size;i++) {
-
-
- el.append(out iter);
-
- el.set_value(iter, 0, data.get(i));
- el.set_value(iter, 1, data.get(i));
-
- if (data.get(i) == cur) {
- _this.build_module.el.set_active_iter(iter);
- }
-
- }
- this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
-
- }
- }
-
-
-
-
- public class Xcls_Button20 : Object
- {
- public Gtk.Button el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button20(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Cancel";
- }
-
- // user defined functions
- }
-
- public class Xcls_Button21 : Object
- {
- public Gtk.Button el;
- private Xcls_DialogNewComponent _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button21(Xcls_DialogNewComponent _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "OK";
- }
-
- // user defined functions
- }
-
-}
"items" : [
{
"$ xns" : "Gtk",
+ "@ void complete" : "(string result)",
"gboolean deletable" : true,
"gboolean modal" : true,
"gint default_height" : 500,
"id" : "DialogPluginWebkit",
"items" : [
{
- "$ pack" : "get_content_area().add",
"$ xns" : "Gtk",
+ "* pack" : "get_content_area().append",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
- "gboolean homogeneous" : false,
+ "bool homogeneous" : false,
"items" : [
{
"$ xns" : "Gtk",
" ",
""
],
- "* pack" : "pack_start,false,true,3",
- "gboolean expand" : true,
+ "* pack" : "append",
+ "bool hexpand" : true,
+ "bool vexpand" : true,
"items" : [
{
"$ xns" : "WebKit",
"}",
""
],
- "* pack" : "add",
+ "* pack" : "set_child",
"id" : "webview",
"listeners" : {
"script_dialog" : [
}
],
"listeners" : {
- "delete_event" : [
- "(self, event) => {",
- " this.el.hide();",
- " return true; ",
- " //test ",
- "} "
+ "response" : [
+ "(response_id) => {",
+ "",
+ " \t\t ",
+ "\t\t if (response_id == 1) { // OK...",
+ "\t\t var loop = new MainLoop();",
+ "\t\t // run toBJS to get the data... (calls back into alert handler)",
+ "\t\t _this.result_json = \"\";",
+ "\t\t this.webview.el.run_javascript.begin(\"Editor.\" + this.cls + \".panel.toBJS();\", null, (obj, res) => {",
+ "\t\t try {",
+ "\t\t this.webview.el.run_javascript.end(res);",
+ "\t\t } catch(Error e) {",
+ "\t\t ",
+ "\t\t }",
+ "\t\t loop.quit();",
+ "\t\t });",
+ "\t\t loop.run();",
+ "\t\t _this.complete(_this.result_json);",
+ "\t\t ",
+ "\t\t ",
+ "\t\t// print(\"LOOP END?\");",
+ "\t\t // try and get the resopse...",
+ "\t\t break;",
+ "\t\t }",
+ "\t\t if (response_id < 1) {",
+ "\t\t this.el.hide();",
+ "\t\t _this.complete(\"\");",
+ "\t\t }",
+ "\t\t // keep showing...?",
+ " \t\t}",
+ ""
]
},
+ "string cls" : "",
"string result_json" : "",
"string tmpjs" : "",
"utf8 title" : "Add / Edit Component",
"}",
""
],
- "| string show" : [
+ "| void showIt" : [
+ " // for result hook into complete",
+ " ",
" (Gtk.Window ?parent, Project.Project project, string cls, string tbl) {// JsRender.Node node) {",
" ",
+ " \tthis.cls = cls;",
+ " ",
" if (parent != null) {",
" this.el.set_transient_for(parent);",
" this.el.modal = true;",
" }",
" this.result_json = \"\";",
" var db = project.roo_database;",
- " ",
- " ",
- " this.el.show_all();",
- " var ret = \"\";",
- " while (true) {",
+ " ",
+ " this.el.show();",
+ " ",
+ " ",
" ",
" var runhtml = \"<script type=\\\"text/javascript\\\">\\n\" ;",
" string builderhtml;",
" \"xhttp://localhost/roobuilder/\"",
" );",
" ",
- " ",
- " ",
- " ",
- " var response_id = this.el.run();",
- " ",
- " if (response_id == 1) { // OK...",
- " var loop = new MainLoop();",
- " // run toBJS to get the data... (calls back into alert handler)",
- " _this.result_json = \"\";",
- " this.webview.el.run_javascript.begin(\"Editor.\" + cls + \".panel.toBJS();\", null, (obj, res) => {",
- " try {",
- " this.webview.el.run_javascript.end(res);",
- " } catch(Error e) {",
- " ",
- " }",
- " loop.quit();",
- " });",
- " loop.run();",
- " ret = _this.result_json;",
- " ",
- " ",
- " // print(\"LOOP END?\");",
- " // try and get the resopse...",
- " break;",
- " }",
- " if (response_id < 1) {",
- " this.el.hide();",
- " return \"\";",
- " }",
- " // keep showing...?",
- " continue;",
- " }",
- " ",
- " // now we save it..",
- " this.el.hide();",
- " ",
- " return ret;",
+ " ",
" ",
" ",
" ",
public Xcls_webview webview;
// my vars (def)
+ public signal void complete (string result);
+ public string cls;
public string tmpjs;
public string result_json;
this.el.modal = true;
var child_0 = new Xcls_Box2( _this );
child_0.ref();
- this.el.get_content_area().add ( child_0.el );
+ this.el.get_content_area().append ( child_0.el );
var child_1 = new Xcls_Button5( _this );
child_1.ref();
this.el.add_action_widget ( child_1.el , 3 );
this.el.add_action_widget ( child_3.el , 1 );
//listeners
- this.el.delete_event.connect( (self, event) => {
- this.el.hide();
- return true;
- //test
- });
+ this.el.response.connect( (response_id) => {
+
+
+ if (response_id == 1) { // OK...
+ var loop = new MainLoop();
+ // run toBJS to get the data... (calls back into alert handler)
+ _this.result_json = "";
+ this.webview.el.run_javascript.begin("Editor." + this.cls + ".panel.toBJS();", null, (obj, res) => {
+ try {
+ this.webview.el.run_javascript.end(res);
+ } catch(Error e) {
+
+ }
+ loop.quit();
+ });
+ loop.run();
+ _this.complete(_this.result_json);
+
+
+ // print("LOOP END?");
+ // try and get the resopse...
+ break;
+ }
+ if (response_id < 1) {
+ this.el.hide();
+ _this.complete("");
+ }
+ // keep showing...?
+ });
}
// user defined functions
- public string show (Gtk.Window ?parent, Project.Project project, string cls, string tbl) {// JsRender.Node node) {
+ public bool has_plugin (string cls) {
+
+ return GLib.FileUtils.test(
+ BuilderApplication.configDirectory() + "/resources/Editors/Editor." + cls + ".js",
+ GLib.FileTest.IS_REGULAR
+ );
+
+
+
+ }
+ public void showIt // for result hook into complete
+
+ (Gtk.Window ?parent, Project.Project project, string cls, string tbl) {// JsRender.Node node) {
+
+ this.cls = cls;
if (parent != null) {
this.el.set_transient_for(parent);
}
this.result_json = "";
var db = project.roo_database;
-
-
- this.el.show_all();
- var ret = "";
- while (true) {
+
+ this.el.show();
+
+
var runhtml = "<script type=\"text/javascript\">\n" ;
string builderhtml;
"xhttp://localhost/roobuilder/"
);
-
-
-
- var response_id = this.el.run();
-
- if (response_id == 1) { // OK...
- var loop = new MainLoop();
- // run toBJS to get the data... (calls back into alert handler)
- _this.result_json = "";
- this.webview.el.run_javascript.begin("Editor." + cls + ".panel.toBJS();", null, (obj, res) => {
- try {
- this.webview.el.run_javascript.end(res);
- } catch(Error e) {
-
- }
- loop.quit();
- });
- loop.run();
- ret = _this.result_json;
-
-
- // print("LOOP END?");
- // try and get the resopse...
- break;
- }
- if (response_id < 1) {
- this.el.hide();
- return "";
- }
- // keep showing...?
- continue;
- }
-
- // now we save it..
- this.el.hide();
-
- return ret;
-
+
- }
- public bool has_plugin (string cls) {
-
- return GLib.FileUtils.test(
- BuilderApplication.configDirectory() + "/resources/Editors/Editor." + cls + ".js",
- GLib.FileTest.IS_REGULAR
- );
-
-
}
public class Xcls_Box2 : Object
{
this.el.homogeneous = false;
var child_0 = new Xcls_ScrolledWindow3( _this );
child_0.ref();
- this.el.pack_start ( child_0.el , false,true,3 );
+ this.el.append ( child_0.el );
}
// user defined functions
public Xcls_ScrolledWindow3(Xcls_DialogPluginWebkit _owner )
{
_this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
+ this.el = new Gtk.ScrolledWindow();
// my vars (dec)
// set gobject values
- this.el.expand = true;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
var child_0 = new Xcls_webview( _this );
child_0.ref();
- this.el.add ( child_0.el );
+ this.el.set_child ( child_0.el );
// init method
{
"build_module" : "builder",
+ "gen_extended" : false,
"items" : [
{
"# JsRender.Node data" : "",
"# Project.Project project" : "",
"$ modal" : true,
"$ xns" : "Gtk",
+ "@ void complete" : "(string result)",
"default_height" : 200,
"default_width" : 400,
"items" : [
{
- "$ pack" : [
- " get_content_area().add",
- "",
- ""
- ],
"$ xns" : "Gtk",
+ "* pack" : " get_content_area().append",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
+ "* pack" : "append",
"label" : "Name",
"xtype" : "Label"
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
+ "* pack" : "append",
"id" : "name",
"xtype" : "Entry"
}
}
],
"listeners" : {
- "delete_event" : [
- " (self, event) => {",
- " this.el.response(Gtk.ResponseType.CANCEL);",
- " return true;",
- "} "
+ "response" : [
+ "(response_id) => {",
+ " \tif (response_id < 1) {",
+ " this.el.hide();",
+ " this.complete(\"\");",
+ " }",
+ " ",
+ " var name = _this.name.el.get_text();",
+ " if (name.length < 1) {",
+ " Xcls_StandardErrorDialog.singleton().show(",
+ " _this.el,",
+ " \"You must give the template a name. \"",
+ " );",
+ " return;",
+ " }",
+ " if (!Regex.match_simple (\"^[A-Za-z][A-Za-z0-9.]+$\", name) )",
+ " {",
+ " Xcls_StandardErrorDialog.singleton().show(",
+ " _this.el.transient_for,",
+ " \"Template Name must contain only letters dots\"",
+ " );",
+ " return;;",
+ " }",
+ " ",
+ " var targetfile = project.path + \"/templates/\" + name + \".bjs\";",
+ " ",
+ " ",
+ " if (GLib.FileUtils.test(targetfile, GLib.FileTest.EXISTS)) {",
+ "\t Xcls_StandardErrorDialog.singleton().show(",
+ "\t _this.el.transient_for,",
+ "\t \"That file already exists\"",
+ "\t ); ",
+ "\t return;",
+ "\t}",
+ "\tJsRender.JsRender f;",
+ " try {",
+ "\t f = JsRender.JsRender.factory(",
+ "\t\t\t project.xtype , ",
+ "\t\t\tproject, ",
+ "\t\t\ttargetfile);",
+ "\t} catch (JsRender.Error e) {",
+ "\t\tXcls_StandardErrorDialog.singleton().show(",
+ "\t _this.el.transient_for,",
+ "\t \"Error creating file\"",
+ "\t ); ",
+ "\t\treturn;",
+ "\t}",
+ " ",
+ "",
+ " f.tree = _this.data.deepClone();",
+ " f.save();",
+ " project.addFile(f);",
+ " // now we save it..",
+ " this.el.hide();",
+ " this.complete(name);",
+ " ",
+ "",
+ "}",
+ ""
]
},
"xtype" : "Dialog",
- "| string show" : [
+ "| void showIt" : [
" (Gtk.Window parent, Project.Project project, JsRender.Node data) {",
" ",
" ",
" this.data = data;",
" this.project = project;",
" this.name.el.set_text(\"\");",
- " this.el.show_all();",
- " var name = \"\";",
- " while (true) {",
- " var response_id = this.el.run();",
- " if (response_id < 1) {",
- " this.el.hide();",
- " return \"\";",
- " }",
- " ",
- " name = _this.name.el.get_text();",
- " if (name.length < 1) {",
- " Xcls_StandardErrorDialog.singleton().show(",
- " _this.el,",
- " \"You must give the template a name. \"",
- " );",
- " continue;",
- " }",
- " if (!Regex.match_simple (\"^[A-Za-z][A-Za-z0-9.]+$\", name) )",
- " {",
- " Xcls_StandardErrorDialog.singleton().show(",
- " _this.el,",
- " \"Template Name must contain only letters dots\"",
- " );",
- " continue;",
- " }",
- " break;",
- " }",
- " var f = project.newFile(name);",
- " f.tree = _this.data.deepClone();",
- " f.save();",
- " ",
- " // now we save it..",
- " this.el.hide();",
- " ",
- " return name;",
- " ",
- " ",
+ " this.el.show();",
+ "",
+ " ",
" ",
"}",
""
]
}
],
- "modOrder" : "",
- "name" : "DialogSaveModule",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/DialogSaveModule.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "DialogSaveModule"
}
\ No newline at end of file
-static DialogSaveModule _DialogSaveModule;
+ static DialogSaveModule _DialogSaveModule;
-public class DialogSaveModule : Object
-{
- public Gtk.Dialog el;
- private DialogSaveModule _this;
-
- public static DialogSaveModule singleton()
- {
- if (_DialogSaveModule == null) {
- _DialogSaveModule= new DialogSaveModule();
- }
- return _DialogSaveModule;
- }
- public Xcls_name name;
-
- // my vars (def)
- public JsRender.Node data;
- public Project.Project project;
-
- // ctor
- public DialogSaveModule()
+ public class DialogSaveModule : Object
{
- _this = this;
- this.el = new Gtk.Dialog();
-
- // my vars (dec)
-
- // set gobject values
- this.el.default_height = 200;
- this.el.default_width = 400;
- this.el.modal = true;
- var child_0 = new Xcls_Box2( _this );
- child_0.ref();
- this.el.get_content_area().add( child_0.el );
- var child_1 = new Xcls_Button5( _this );
- child_1.ref();
- this.el.add_action_widget ( child_1.el , 0 );
- var child_2 = new Xcls_Button6( _this );
- child_2.ref();
- this.el.add_action_widget ( child_2.el , 1 );
-
- //listeners
- this.el.delete_event.connect( (self, event) => {
- this.el.response(Gtk.ResponseType.CANCEL);
- return true;
- });
- }
+ public Gtk.Dialog el;
+ private DialogSaveModule _this;
- // user defined functions
- public string show (Gtk.Window parent, Project.Project project, JsRender.Node data) {
-
-
- this.el.set_transient_for(parent);
- this.el.modal = true;
-
- this.data = data;
- this.project = project;
- this.name.el.set_text("");
- this.el.show_all();
- var name = "";
- while (true) {
- var response_id = this.el.run();
- if (response_id < 1) {
- this.el.hide();
- return "";
- }
-
- name = _this.name.el.get_text();
- if (name.length < 1) {
- Xcls_StandardErrorDialog.singleton().show(
- _this.el,
- "You must give the template a name. "
- );
- continue;
- }
- if (!Regex.match_simple ("^[A-Za-z][A-Za-z0-9.]+$", name) )
- {
- Xcls_StandardErrorDialog.singleton().show(
- _this.el,
- "Template Name must contain only letters dots"
- );
- continue;
+ public static DialogSaveModule singleton()
+ {
+ if (_DialogSaveModule == null) {
+ _DialogSaveModule= new DialogSaveModule();
}
- break;
+ return _DialogSaveModule;
}
- var f = project.newFile(name);
- f.tree = _this.data.deepClone();
- f.save();
-
- // now we save it..
- this.el.hide();
-
- return name;
-
-
-
- }
- public class Xcls_Box2 : Object
- {
- public Gtk.Box el;
- private DialogSaveModule _this;
-
+ public Xcls_name name;
// my vars (def)
+ public signal void complete (string result);
+ public JsRender.Node data;
+ public Project.Project project;
// ctor
- public Xcls_Box2(DialogSaveModule _owner )
+ public DialogSaveModule()
{
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+ _this = this;
+ this.el = new Gtk.Dialog();
// my vars (dec)
// set gobject values
- var child_0 = new Xcls_Label3( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_name( _this );
+ this.el.default_height = 200;
+ this.el.default_width = 400;
+ this.el.modal = true;
+ var child_1 = new Xcls_Box2( _this );
child_1.ref();
- this.el.add ( child_1.el );
+ this.el.get_content_area().append ( child_1.el );
+ var child_2 = new Xcls_Button5( _this );
+ child_2.ref();
+ this.el.add_action_widget ( child_2.el , 0 );
+ var child_3 = new Xcls_Button6( _this );
+ child_3.ref();
+ this.el.add_action_widget ( child_3.el , 1 );
+
+ //listeners
+ this.el.response.connect( (response_id) => {
+ if (response_id < 1) {
+ this.el.hide();
+ this.complete("");
+ }
+
+ var name = _this.name.el.get_text();
+ if (name.length < 1) {
+ Xcls_StandardErrorDialog.singleton().show(
+ _this.el,
+ "You must give the template a name. "
+ );
+ return;
+ }
+ if (!Regex.match_simple ("^[A-Za-z][A-Za-z0-9.]+$", name) )
+ {
+ Xcls_StandardErrorDialog.singleton().show(
+ _this.el.transient_for,
+ "Template Name must contain only letters dots"
+ );
+ return;;
+ }
+
+ var targetfile = project.path + "/templates/" + name + ".bjs";
+
+
+ if (GLib.FileUtils.test(targetfile, GLib.FileTest.EXISTS)) {
+ Xcls_StandardErrorDialog.singleton().show(
+ _this.el.transient_for,
+ "That file already exists"
+ );
+ return;
+ }
+ JsRender.JsRender f;
+ try {
+ f = JsRender.JsRender.factory(
+ project.xtype ,
+ project,
+ targetfile);
+ } catch (JsRender.Error e) {
+ Xcls_StandardErrorDialog.singleton().show(
+ _this.el.transient_for,
+ "Error creating file"
+ );
+ return;
+ }
+
+
+ f.tree = _this.data.deepClone();
+ f.save();
+ project.addFile(f);
+ // now we save it..
+ this.el.hide();
+ this.complete(name);
+
+
+ });
}
// user defined functions
- }
- public class Xcls_Label3 : Object
- {
- public Gtk.Label el;
- private DialogSaveModule _this;
+ public void showIt (Gtk.Window parent, Project.Project project, JsRender.Node data) {
+
+
+ this.el.set_transient_for(parent);
+ this.el.modal = true;
+
+ this.data = data;
+ this.project = project;
+ this.name.el.set_text("");
+ this.el.show();
+
+
+
+ }
+ public class Xcls_Box2 : Object
+ {
+ public Gtk.Box el;
+ private DialogSaveModule _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Label3(DialogSaveModule _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Name" );
+ // ctor
+ public Xcls_Box2(DialogSaveModule _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
+ // set gobject values
+ var child_1 = new Xcls_Label3( _this );
+ child_1.ref();
+ this.el.append ( child_1.el );
+ new Xcls_name( _this );
+ this.el.append ( _this.name.el );
+ }
+
+ // user defined functions
}
+ public class Xcls_Label3 : Object
+ {
+ public Gtk.Label el;
+ private DialogSaveModule _this;
- // user defined functions
- }
- public class Xcls_name : Object
- {
- public Gtk.Entry el;
- private DialogSaveModule _this;
+ // my vars (def)
+ // ctor
+ public Xcls_Label3(DialogSaveModule _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Name" );
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_name(DialogSaveModule _owner )
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_name : Object
{
- _this = _owner;
- _this.name = this;
- this.el = new Gtk.Entry();
+ public Gtk.Entry el;
+ private DialogSaveModule _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_name(DialogSaveModule _owner )
+ {
+ _this = _owner;
+ _this.name = this;
+ this.el = new Gtk.Entry();
+ // my vars (dec)
- public class Xcls_Button5 : Object
- {
- public Gtk.Button el;
- private DialogSaveModule _this;
+ // set gobject values
+ }
+ // user defined functions
+ }
- // my vars (def)
- // ctor
- public Xcls_Button5(DialogSaveModule _owner )
+ public class Xcls_Button5 : Object
{
- _this = _owner;
- this.el = new Gtk.Button();
+ public Gtk.Button el;
+ private DialogSaveModule _this;
- // my vars (dec)
- // set gobject values
- this.el.label = "Cancel";
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_Button5(DialogSaveModule _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- public class Xcls_Button6 : Object
- {
- public Gtk.Button el;
- private DialogSaveModule _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.label = "Cancel";
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_Button6(DialogSaveModule _owner )
+ public class Xcls_Button6 : Object
{
- _this = _owner;
- this.el = new Gtk.Button();
+ public Gtk.Button el;
+ private DialogSaveModule _this;
- // my vars (dec)
- // set gobject values
- this.el.label = "OK";
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button6(DialogSaveModule _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "OK";
+ }
+
+ // user defined functions
}
- // user defined functions
}
-
-}
{
"# JsRender.Node data" : "",
"# Palete.Palete palete" : "",
- "$ modal" : true,
"$ xns" : "Gtk",
+ "bool modal" : true,
"default_height" : 200,
"default_width" : 400,
"items" : [
{
- "$ pack" : [
- " get_content_area().add",
- "",
- ""
- ],
"$ xns" : "Gtk",
+ "* pack" : " get_content_area().append",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
+ "* pack" : "append",
"label" : "Name",
"xtype" : "Label"
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
+ "* pack" : "append",
"id" : "name",
"xtype" : "Entry"
}
}
],
"listeners" : {
- "delete_event" : [
- " (self, event) => {",
- " this.el.response(Gtk.ResponseType.CANCEL);",
+ "close_request" : [
+ "( ) => {",
+ "",
+ "\t this.el.response(Gtk.ResponseType.CANCEL);",
" return true;",
" ",
- "}"
+ "}",
+ ""
+ ],
+ "response" : [
+ "(response_id) => {",
+ "\t ",
+ " if (response_id < 1) {",
+ "\t this.el.hide();",
+ "\t return;",
+ "\t}",
+ "\t",
+ "\tvar name = _this.name.el.get_text();",
+ "\tif (name.length < 1) {",
+ "\t Xcls_StandardErrorDialog.singleton().show(",
+ "\t _this.el,",
+ "\t \"You must give the template a name. \"",
+ "\t );",
+ "\t return;",
+ "\t}",
+ "\tif (!Regex.match_simple (\"^[A-Za-z][A-Za-z0-9. ]+$\", name) )",
+ "\t{",
+ "\t Xcls_StandardErrorDialog.singleton().show(",
+ "\t _this.el,",
+ "\t \"Template Name must contain only letters dots\"",
+ "\t );",
+ "\t return;",
+ "\t}",
+ "\t",
+ " this.palete.saveTemplate(name, data);",
+ " ",
+ " // now we save it..",
+ " this.el.hide();",
+ " ",
+ "",
+ "}",
+ ""
]
},
"xtype" : "Dialog",
- "| void show" : [
+ "| void showIt" : [
" (Gtk.Window parent, Palete.Palete palete, JsRender.Node data) {",
" ",
- " ",
+ " \tthis.palete = palete;",
" this.el.set_transient_for(parent);",
" this.el.modal = true;",
" ",
" this.name.el.set_text(\"\");",
- " this.el.show_all();",
- " var name = \"\";",
- " while (true) {",
- " var response_id = this.el.run();",
- " if (response_id < 1) {",
- " this.el.hide();",
- " return;",
- " }",
- " ",
- " name = _this.name.el.get_text();",
- " if (name.length < 1) {",
- " Xcls_StandardErrorDialog.singleton().show(",
- " _this.el,",
- " \"You must give the template a name. \"",
- " );",
- " continue;",
- " }",
- " if (!Regex.match_simple (\"^[A-Za-z][A-Za-z0-9. ]+$\", name) )",
- " {",
- " Xcls_StandardErrorDialog.singleton().show(",
- " _this.el,",
- " \"Template Name must contain only letters dots\"",
- " );",
- " continue;",
- " }",
- " break;",
- " }",
- " palete.saveTemplate(name, data);",
- " ",
- " // now we save it..",
- " this.el.hide();",
- " ",
+ " this.el.show();",
+ " ",
" ",
" ",
" ",
public Xcls_name name;
// my vars (def)
- public Palete.Palete palete;
public JsRender.Node data;
+ public Palete.Palete palete;
// ctor
public DialogSaveTemplate()
this.el.modal = true;
var child_0 = new Xcls_Box2( _this );
child_0.ref();
- this.el.get_content_area().add ( child_0.el );
+ this.el.get_content_area().append ( child_0.el );
var child_1 = new Xcls_Button5( _this );
child_1.ref();
this.el.add_action_widget ( child_1.el , 0 );
this.el.add_action_widget ( child_2.el , 1 );
//listeners
- this.el.delete_event.connect( (self, event) => {
- this.el.response(Gtk.ResponseType.CANCEL);
+ this.el.close_request.connect( ( ) => {
+
+ this.el.response(Gtk.ResponseType.CANCEL);
return true;
+ });
+ this.el.response.connect( (response_id) => {
+
+ if (response_id < 1) {
+ this.el.hide();
+ return;
+ }
+
+ var name = _this.name.el.get_text();
+ if (name.length < 1) {
+ Xcls_StandardErrorDialog.singleton().show(
+ _this.el,
+ "You must give the template a name. "
+ );
+ return;
+ }
+ if (!Regex.match_simple ("^[A-Za-z][A-Za-z0-9. ]+$", name) )
+ {
+ Xcls_StandardErrorDialog.singleton().show(
+ _this.el,
+ "Template Name must contain only letters dots"
+ );
+ return;
+ }
+
+ this.palete.saveTemplate(name, data);
+
+ // now we save it..
+ this.el.hide();
+
+
});
}
// user defined functions
- public void show (Gtk.Window parent, Palete.Palete palete, JsRender.Node data) {
+ public void showIt (Gtk.Window parent, Palete.Palete palete, JsRender.Node data) {
-
+ this.palete = palete;
this.el.set_transient_for(parent);
this.el.modal = true;
this.name.el.set_text("");
- this.el.show_all();
- var name = "";
- while (true) {
- var response_id = this.el.run();
- if (response_id < 1) {
- this.el.hide();
- return;
- }
-
- name = _this.name.el.get_text();
- if (name.length < 1) {
- Xcls_StandardErrorDialog.singleton().show(
- _this.el,
- "You must give the template a name. "
- );
- continue;
- }
- if (!Regex.match_simple ("^[A-Za-z][A-Za-z0-9. ]+$", name) )
- {
- Xcls_StandardErrorDialog.singleton().show(
- _this.el,
- "Template Name must contain only letters dots"
- );
- continue;
- }
- break;
- }
- palete.saveTemplate(name, data);
-
- // now we save it..
- this.el.hide();
-
+ this.el.show();
+
// set gobject values
var child_0 = new Xcls_Label3( _this );
child_0.ref();
- this.el.add ( child_0.el );
+ this.el.append ( child_0.el );
var child_1 = new Xcls_name( _this );
child_1.ref();
- this.el.add ( child_1.el );
+ this.el.append ( child_1.el );
}
// user defined functions
"build_module" : "builder",
"items" : [
{
+ "# JsRender.Node node" : "",
+ "# Palete.Palete palete" : "",
+ "# Project.Project project" : "",
+ "# Xcls_MainWindow window" : "",
"$ modal" : true,
"$ xns" : "Gtk",
+ "@ void complete" : "(JsRender.Node? node)",
"default_height" : 200,
"default_width" : 400,
"items" : [
{
- "$ pack" : "get_content_area().add ",
"$ xns" : "Gtk",
+ "* pack" : "get_content_area().append",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
+ "* pack" : "append",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "gint margin" : 3,
+ "int margin_end" : 3,
+ "int margin_start" : 3,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false",
+ "* pack" : "append",
"label" : "Select Template : ",
"xtype" : "Label"
},
{
"$ xns" : "Gtk",
"* init" : "this.el.add_attribute(_this.cellrenderer.el , \"markup\", 1 );",
- "* pack" : "add",
+ "* pack" : "append",
"id" : "combo",
"items" : [
{
},
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
+ "* pack" : "append",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "gint margin" : 3,
+ "int margin_end" : 3,
+ "int margin_start" : 3,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false",
+ "* pack" : "append",
"label" : "Select Database Table : ",
"xtype" : "Label"
},
{
"$ xns" : "Gtk",
"* init" : "this.el.add_attribute(_this.dbcellrenderer.el , \"markup\", 1 );",
- "* pack" : "add",
+ "* pack" : "append",
"id" : "dbcombo",
"items" : [
{
}
],
"listeners" : {
- "delete_event" : [
- " (self, event) =>{",
- " this.el.hide();",
- " return true;",
- "}"
+ "close_request" : [
+ "( ) => {",
+ "",
+ " this.el.hide();",
+ " return true;;",
+ "}",
+ ""
+ ],
+ "response" : [
+ "(res) => {",
+ "",
+ "\t//var node = _this.node;",
+ "\t//var project = _this.project;",
+ "\treturn;",
+ " /*",
+ " ",
+ " if (this.plugin == null) {",
+ "\t this.plugin = new Xcls_DialogPluginWebkit();",
+ "\t this.plugin.complete.connect((json_str) => {",
+ " \t\t\tprint(\"json_str = %s\\n\", json_str);",
+ " if (json_str.length < 1) {",
+ "\t\t\t\tthis.complete(_this.node);",
+ "\t\t\t\treturn; ",
+ " }",
+ " var pa = new Json.Parser();",
+ " try {",
+ "",
+ "\t \tpa.load_from_data(json_str);",
+ "\t\t\t} catch(Error e) {",
+ "\t\t\t this.complete(node);",
+ " \t\treturn; // 1 = just add it..",
+ " \t\t}",
+ " \t\tvar new_node = pa.get_root();",
+ "\t\t",
+ "\t\t\tif (new_node.get_node_type () != Json.NodeType.OBJECT) {",
+ "\t\t\t\t this.complete(node);",
+ "\t\t\t\t\t\treturn; ",
+ "\t\t\t}",
+ "\t\t\tvar obj = new_node.get_object ();",
+ "",
+ "\t\t\tvar ret = new JsRender.Node();",
+ "",
+ "\t\t\tret.loadFromJson(obj, 1);",
+ "\t \t\tthis.complete(ret);",
+ " \t\t});",
+ " ",
+ " }",
+ " ",
+ " ",
+ " ",
+ "\t",
+ " this.el.hide(); ",
+ " //var ix = _this.combo.el.get_active();",
+ " if (res < 1 ) {",
+ " \tthis.complete(null);",
+ " return; // 0 = cancel.",
+ " }",
+ " if (res < 2 ) {",
+ " this.complete(node);",
+ " return; // 1 = just add it..",
+ " }",
+ " ",
+ " ",
+ " // have they selected a table??",
+ " ",
+ " Gtk.TreeIter iter; ",
+ " Value vfname; ",
+ " if (_this.dbcombo.el.get_active_iter (out iter)) { ",
+ " this.dbmodel.el.get_value (iter, 0, out vfname);",
+ " if (((string)vfname).length > 0 && this.plugin.has_plugin(node.fqn())) {",
+ " this.plugin.showIt(this.window.el, project, node.fqn(), (string)vfname);",
+ " return;",
+ " }",
+ "\t this.complete(node);",
+ " return; // 1 = just add it..",
+ " ",
+ " ",
+ " }",
+ "",
+ " if (!_this.combo.el.get_active_iter (out iter)) {",
+ "",
+ " this.complete(node);",
+ " return; // 1 = just add it../ nothing selected...",
+ " }",
+ " ",
+ " this.model.el.get_value (iter, 0, out vfname);",
+ " ",
+ " this.complete(this.palete.loadTemplate((string)vfname));",
+ " return; // 1 = just add it..",
+ " ",
+ "*/",
+ "}",
+ ""
]
},
"title" : "Add an Object",
"xtype" : "Dialog",
- "| JsRender.Node? show" : [
- " (Xcls_MainWindow mwindow, Palete.Palete pal, JsRender.Node node, Project.Project project) {",
- " ",
- " this.el.show_all();",
- " var opts = pal.listTemplates(node);",
- " if (opts.length() < 1) {",
- " this.el.hide();",
- " return node;",
- " }",
- " this.el.set_attached_to( mwindow.el);",
- " this.el.set_transient_for( mwindow.el);",
- " ",
- " //opts.unshift({ path: '' , name :'Just add Element' });",
- " _this.model.loadData(opts);",
- " _this.combo.el.set_active(-1);",
- " ",
- " ",
- " var db = new Palete.RooDatabase.from_project(project);",
- " _this.dbmodel.loadData(db.readTablesGee());",
- " ",
- " var plug = mwindow.windowstate.webkit_plugin;",
- " ",
- " _this.dbcombo.el.set_active(-1);",
- " ",
- " ",
- " ",
- " var res = this.el.run();",
- " this.el.hide(); ",
- " //var ix = _this.combo.el.get_active();",
- " if (res < 1 ) {",
- " return null; // 0 = cancel.",
- " }",
- " if (res < 2 ) {",
- " return node; // 1 = just add it..",
- " }",
- " ",
- " // have they selected a table??",
- " ",
- " Gtk.TreeIter iter; ",
- " Value vfname; ",
- " if (_this.dbcombo.el.get_active_iter (out iter)) { ",
- " this.dbmodel.el.get_value (iter, 0, out vfname);",
- " if (((string)vfname).length > 0 && plug.has_plugin(node.fqn())) {",
- " var json_str = plug.show(mwindow.el, project, node.fqn(), (string)vfname);",
- " print(\"json_str = %s\\n\", json_str);",
- " if (json_str.length < 1) {",
+ "| void showIt" : [
+ " (",
+ " \tXcls_MainWindow mwindow, ",
+ " \tPalete.Palete pal, ",
+ "\t JsRender.Node node, ",
+ "\t Project.Project project",
+ " ) {",
"",
- " return node;",
- " }",
- " var pa = new Json.Parser();",
- " try {",
+ "\tthis.el.show();",
"",
- "\t pa.load_from_data(json_str);",
- "\t } catch(Error e) {",
- "\t return node;",
- "\t }",
- "\t var new_node = pa.get_root();",
- " ",
- "\t if (new_node.get_node_type () != Json.NodeType.OBJECT) {",
- "\t\t return node;",
- "\t }",
- "\t var obj = new_node.get_object ();",
+ "\tvar opts = pal.listTemplates(node);",
+ "\tif (opts.length() < 1) {",
+ "\tthis.el.hide();",
+ "\t\tthis.complete(node);",
+ "\t\treturn; ",
+ "\t}",
+ "\tthis.el.set_transient_for( mwindow.el);",
"",
- "\t var ret = new JsRender.Node();",
+ "\t//opts.unshift({ path: '' , name :'Just add Element' });",
+ "\t_this.model.loadData(opts);",
+ "\t_this.combo.el.set_active(-1);",
"",
- "\t ret.loadFromJson(obj, 1);",
- "\t return ret;",
- " }",
- " ",
- " }",
"",
- " if (!_this.combo.el.get_active_iter (out iter)) {",
+ "\tvar db = new Palete.RooDatabase.from_project((Project.Roo) project);",
+ "\t_this.dbmodel.loadData(db.readTablesGee());",
"",
- " return node; // nothing selected...",
- " }",
- " ",
- " this.model.el.get_value (iter, 0, out vfname);",
- " ",
- " ",
- " return pal.loadTemplate((string)vfname);",
"",
+ "\t_this.dbcombo.el.set_active(-1);",
+ "",
+ "\tthis.window = mwindow;",
+ "\tthis.palete = pal;",
+ "\tthis.node = node;",
+ "\tthis.project = project;",
+ " ",
"}",
""
]
public Xcls_dbmodel dbmodel;
// my vars (def)
+ public Xcls_MainWindow window;
+ public signal void complete (JsRender.Node? node);
+ public Palete.Palete palete;
+ public Project.Project project;
+ public JsRender.Node node;
// ctor
public DialogTemplateSelect()
this.el.modal = true;
var child_0 = new Xcls_Box2( _this );
child_0.ref();
- this.el.get_content_area().add ( child_0.el );
+ this.el.get_content_area().append ( child_0.el );
var child_1 = new Xcls_Button13( _this );
child_1.ref();
this.el.add_action_widget ( child_1.el , 0 );
this.el.add_action_widget ( child_3.el , 2 );
//listeners
- this.el.delete_event.connect( (self, event) =>{
- this.el.hide();
- return true;
+ this.el.close_request.connect( ( ) => {
+
+ this.el.hide();
+ return true;;
});
- }
-
- // user defined functions
- public JsRender.Node? show (Xcls_MainWindow mwindow, Palete.Palete pal, JsRender.Node node, Project.Project project) {
+ this.el.response.connect( (res) => {
- this.el.show_all();
- var opts = pal.listTemplates(node);
- if (opts.length() < 1) {
- this.el.hide();
- return node;
- }
- this.el.set_attached_to( mwindow.el);
- this.el.set_transient_for( mwindow.el);
+ //var node = _this.node;
+ //var project = _this.project;
+ return;
+ /*
+
+ if (this.plugin == null) {
+ this.plugin = new Xcls_DialogPluginWebkit();
+ this.plugin.complete.connect((json_str) => {
+ print("json_str = %s\n", json_str);
+ if (json_str.length < 1) {
+ this.complete(_this.node);
+ return;
+ }
+ var pa = new Json.Parser();
+ try {
- //opts.unshift({ path: '' , name :'Just add Element' });
- _this.model.loadData(opts);
- _this.combo.el.set_active(-1);
-
-
- var db = new Palete.RooDatabase.from_project(project);
- _this.dbmodel.loadData(db.readTablesGee());
-
- var plug = mwindow.windowstate.webkit_plugin;
-
- _this.dbcombo.el.set_active(-1);
-
-
-
- var res = this.el.run();
- this.el.hide();
- //var ix = _this.combo.el.get_active();
- if (res < 1 ) {
- return null; // 0 = cancel.
- }
- if (res < 2 ) {
- return node; // 1 = just add it..
- }
+ pa.load_from_data(json_str);
+ } catch(Error e) {
+ this.complete(node);
+ return; // 1 = just add it..
+ }
+ var new_node = pa.get_root();
+
+ if (new_node.get_node_type () != Json.NodeType.OBJECT) {
+ this.complete(node);
+ return;
+ }
+ var obj = new_node.get_object ();
- // have they selected a table??
+ var ret = new JsRender.Node();
- Gtk.TreeIter iter;
- Value vfname;
- if (_this.dbcombo.el.get_active_iter (out iter)) {
- this.dbmodel.el.get_value (iter, 0, out vfname);
- if (((string)vfname).length > 0 && plug.has_plugin(node.fqn())) {
- var json_str = plug.show(mwindow.el, project, node.fqn(), (string)vfname);
- print("json_str = %s\n", json_str);
- if (json_str.length < 1) {
-
- return node;
+ ret.loadFromJson(obj, 1);
+ this.complete(ret);
+ });
+
+ }
+
+
+
+
+ this.el.hide();
+ //var ix = _this.combo.el.get_active();
+ if (res < 1 ) {
+ this.complete(null);
+ return; // 0 = cancel.
+ }
+ if (res < 2 ) {
+ this.complete(node);
+ return; // 1 = just add it..
+ }
+
+
+ // have they selected a table??
+
+ Gtk.TreeIter iter;
+ Value vfname;
+ if (_this.dbcombo.el.get_active_iter (out iter)) {
+ this.dbmodel.el.get_value (iter, 0, out vfname);
+ if (((string)vfname).length > 0 && this.plugin.has_plugin(node.fqn())) {
+ this.plugin.showIt(this.window.el, project, node.fqn(), (string)vfname);
+ return;
}
- var pa = new Json.Parser();
- try {
-
- pa.load_from_data(json_str);
- } catch(Error e) {
- return node;
- }
- var new_node = pa.get_root();
+ this.complete(node);
+ return; // 1 = just add it..
+
+
+ }
- if (new_node.get_node_type () != Json.NodeType.OBJECT) {
- return node;
- }
- var obj = new_node.get_object ();
+ if (!_this.combo.el.get_active_iter (out iter)) {
+
+ this.complete(node);
+ return; // 1 = just add it../ nothing selected...
+ }
+
+ this.model.el.get_value (iter, 0, out vfname);
+
+ this.complete(this.palete.loadTemplate((string)vfname));
+ return; // 1 = just add it..
+
+ */
+ });
+ }
+
+ // user defined functions
+ public void showIt (
+ Xcls_MainWindow mwindow,
+ Palete.Palete pal,
+ JsRender.Node node,
+ Project.Project project
+ ) {
- var ret = new JsRender.Node();
+ this.el.show();
- ret.loadFromJson(obj, 1);
- return ret;
- }
-
- }
+ var opts = pal.listTemplates(node);
+ if (opts.length() < 1) {
+ this.el.hide();
+ this.complete(node);
+ return;
+ }
+ this.el.set_transient_for( mwindow.el);
- if (!_this.combo.el.get_active_iter (out iter)) {
+ //opts.unshift({ path: '' , name :'Just add Element' });
+ _this.model.loadData(opts);
+ _this.combo.el.set_active(-1);
- return node; // nothing selected...
- }
-
- this.model.el.get_value (iter, 0, out vfname);
-
-
- return pal.loadTemplate((string)vfname);
+ var db = new Palete.RooDatabase.from_project((Project.Roo) project);
+ _this.dbmodel.loadData(db.readTablesGee());
+
+
+ _this.dbcombo.el.set_active(-1);
+
+ this.window = mwindow;
+ this.palete = pal;
+ this.node = node;
+ this.project = project;
+
}
public class Xcls_Box2 : Object
{
// set gobject values
var child_0 = new Xcls_Box3( _this );
child_0.ref();
- this.el.pack_start ( child_0.el , false,false,0 );
+ this.el.append ( child_0.el );
var child_1 = new Xcls_Box8( _this );
child_1.ref();
- this.el.pack_start ( child_1.el , false,false,0 );
+ this.el.append ( child_1.el );
}
// user defined functions
// my vars (dec)
// set gobject values
- this.el.margin = 3;
+ this.el.margin_end = 3;
+ this.el.margin_start = 3;
var child_0 = new Xcls_Label4( _this );
child_0.ref();
- this.el.pack_start ( child_0.el , false,false );
+ this.el.append ( child_0.el );
var child_1 = new Xcls_combo( _this );
child_1.ref();
- this.el.add ( child_1.el );
+ this.el.append ( child_1.el );
}
// user defined functions
{
_this = _owner;
_this.model = this;
- this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
+ this.el = new Gtk.ListStore.newv( { typeof(string),typeof(string) } );
// my vars (dec)
// my vars (dec)
// set gobject values
- this.el.margin = 3;
+ this.el.margin_end = 3;
+ this.el.margin_start = 3;
var child_0 = new Xcls_Label9( _this );
child_0.ref();
- this.el.pack_start ( child_0.el , false,false );
+ this.el.append ( child_0.el );
var child_1 = new Xcls_dbcombo( _this );
child_1.ref();
- this.el.add ( child_1.el );
+ this.el.append ( child_1.el );
}
// user defined functions
{
_this = _owner;
_this.dbmodel = this;
- this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
+ this.el = new Gtk.ListStore.newv( { typeof(string),typeof(string) } );
// my vars (dec)
{
"build_module" : "builder",
+ "gen_extended" : false,
"items" : [
{
+ "# WindowState? windowstate" : "null",
"$ deletable" : true,
- "$ modal" : true,
"$ xns" : "Gtk",
- "border_width" : 3,
- "default_height" : 500,
+ "@ void canceled" : "()",
+ "@ void selected" : "(Project.Project? proj)",
+ "bool modal" : true,
"default_width" : 600,
"items" : [
{
- "$ homogeneous" : false,
- "$ pack" : [
- " get_content_area().add ",
- " ",
- ""
+ "$ xns" : "Gtk",
+ "* prop" : "titlebar",
+ "* title" : "New Project",
+ "bool show_title_buttons" : false,
+ "items" : [
+ {
+ "$ Gtk.Align halign" : "Gtk.Align.END",
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start",
+ "bool hexpand" : false,
+ "label" : "Cancel",
+ "listeners" : {
+ "clicked" : [
+ "( ) => {",
+ " ",
+ " _this.el.hide();",
+ "\t_this.canceled();",
+ " ",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "Button"
+ },
+ {
+ "$ Gtk.Align halign" : "Gtk.Align.START",
+ "$ css_classes" : "{ \"suggested-action\" }",
+ "$ xns" : "Gtk",
+ "* pack" : "pack_end",
+ "bool hexpand" : false,
+ "id" : "ok_btn",
+ "label" : "OK",
+ "listeners" : {
+ "clicked" : [
+ "( ) => {",
+ " var err_dialog = Xcls_StandardErrorDialog.singleton();",
+ " ",
+ " ",
+ " \tif (_this.ptype_dd.getValue().length < 1) {",
+ " err_dialog.show(_this.el,\"You have to set Project type\"); ",
+ " return;",
+ " }",
+ " var fn = _this.parent_dd.getValue();",
+ " var is_existing = false;",
+ " var is_new_folder = false;",
+ " switch (_this.type_dd.getValue()) {",
+ "\t \tcase \"Existing Folder\":",
+ "\t\t \tif (_this.folder_dd.getValue().length < 1) {",
+ "\t\t\t\terr_dialog.show(_this.el,\"You have to set Folder\"); ",
+ "\t\t\t\treturn;",
+ "\t\t\t}",
+ "\t\t\tfn += \"/\" + _this.folder_dd.getValue();",
+ "\t\t\tis_existing = true;",
+ "\t\t\tbreak;",
+ "\t \t",
+ "\t \tcase \"New Folder\":",
+ "\t\t \tif (_this.name_entry.getValue().length < 1) {",
+ "\t\t\t\terr_dialog.show(_this.el,\"You have enter a Project Name\"); ",
+ "\t\t\t\treturn;",
+ "\t\t\t}",
+ "\t\t\tfn += \"/\" + _this.name_entry.getValue();\t ",
+ "\t\t\t",
+ "\t\t\tif (FileUtils.test( fn ,FileTest.EXISTS)) {",
+ "\t\t\t\terr_dialog.show(_this.el,\"That folder already exists\"); ",
+ "\t\t\t\treturn;\t\t\t",
+ "\t\t\t}",
+ "\t\t\tvar dir = File.new_for_path(fn);",
+ "\t\t\ttry {",
+ "\t\t\t\tdir.make_directory();\t",
+ "\t\t\t} catch (Error e) {",
+ "\t\t\t\tGLib.error(\"Failed to make directory %s\", fn);",
+ "\t\t\t} ",
+ "\t\t\tis_new_folder = true;",
+ "\t\t\tbreak;",
+ "\t\t\t",
+ "\t \tdefault:",
+ "\t \t\treturn;",
+ " \t\t",
+ " }",
+ " ",
+ " ",
+ " ",
+ " ",
+ " _this.el.hide();",
+ " ",
+ " ",
+ "",
+ " ",
+ " GLib.debug(\"add %s\\n\" , fn);",
+ " try {",
+ "\t\tvar project = Project.Project.factory(_this.ptype_dd.getValue(), fn);",
+ "\t\tif (is_new_folder) {\t",
+ "\t\t\tproject.initialize();",
+ "\t\t\t",
+ "\t\t} else {",
+ "\t\t\tproject.load();",
+ "\t\t}",
+ "\t\t",
+ "\t\tproject.save();",
+ "\t\t Project.Project.saveProjectList();",
+ "\t\t_this.selected(project); // this should trigger a load()",
+ "\t\tif (is_new_folder || is_existing) {",
+ "\t \t _this.windowstate.projectPopoverShow(_this.el, project);",
+ " \t }",
+ "\t\t",
+ "\t\treturn;",
+ "\t} catch (Error e) {",
+ "\t\tGLib.debug(\"got error? %s\" , e.message);",
+ "\t}",
+ "\t ",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "Button"
+ }
],
+ "xtype" : "HeaderBar"
+ },
+ {
+ "$ homogeneous" : false,
"$ xns" : "Gtk",
+ "* prop" : "child",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
"bool expand" : true,
+ "int margin_bottom" : 10,
+ "int margin_end" : 10,
+ "int margin_start" : 10,
+ "int margin_top" : 10,
"items" : [
{
- "$ homogeneous" : false,
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,true,3",
- "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "* columns" : 2,
+ "int column_spacing" : 4,
+ "int margin_bottom" : 20,
+ "int row_spacing" : 4,
"items" : [
{
+ "$ Gtk.Align halign" : "Gtk.Align.START",
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,true,3",
- "label" : "Project type :",
+ "id" : "type_lbl",
+ "string label" : "Create a Project from:",
"xtype" : "Label"
},
{
+ "$ uint selected" : "Gtk.INVALID_LIST_POSITION",
"$ xns" : "Gtk",
"* init" : [
- " this.el.add_attribute(_this.cellrender.el , \"markup\", 1 ); ",
- " "
+ "{",
+ "",
+ "}",
+ ""
],
- "* pack" : "pack_end,true,true,3",
- "id" : "xtype",
+ "bool hexpand" : true,
+ "id" : "type_dd",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "cellrender",
- "xtype" : "CellRendererText"
- },
+ "* prop" : "model",
+ "strings" : "{ \"New Folder\", \"Existing Folder\" /*, \"Checkout from git\" */ }",
+ "xtype" : "StringList"
+ }
+ ],
+ "listeners" : {
+ "notify[\"selected\"]" : [
+ "( ) => {",
+ "\t ",
+ "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
+ "\t\treturn;",
+ "\t}",
+ "\tvar m = (Gtk.StringList) this.el.model;",
+ "\tGLib.debug(\"selected item: %s\", m.get_string(this.el.selected));",
+ "\t",
+ "\t_this.hideAll();",
+ "\t_this.parent_lbl.el.show();",
+ "\t_this.parent_dd.el.show();",
+ "\t_this.parent_dd.load();",
+ "\t/*",
+ "\t\t\t break;",
+ " \t",
+ " \tswitch (m.get_string(this.el.selected)) {",
+ "\t\tcase \"New Folder\":",
+ "\t\t _this.name_lbl.el.show(); ",
+ " \t\t_this.name_entry.el.show(); ",
+ "\t\t\t break;",
+ "\t\tcase \"Existing Folder\":",
+ "\t\t\t_this.folder_lbl.el.show();",
+ "\t\t\t _this.folder_dd.el.show(); \t",
+ "\t\t\t break;",
+ "\t\t\t ",
+ "\t\tcase \"Checkout from git\":",
+ "\t\t _this.name_lbl.el.show(); ",
+ "\t\t\t_this.name_entry.el.show(); ",
+ "\t\t\tbreak; ",
+ "\t\tdefault:",
+ "\t\t\t_this.hideAll();",
+ "\t\t\tbreak;",
+ "",
+ "\t}\t",
+ "\t",
+ "\t*/",
+ "\t ",
+ " ",
+ " ",
+ " ",
+ " ",
+ "\t\t",
+ "} ",
+ ""
+ ]
+ },
+ "xtype" : "DropDown",
+ "| string getValue" : [
+ "() {",
+ "\tvar m = (Gtk.StringList) this.el.model;",
+ "\treturn m.get_string(this.el.selected);",
+ "\t",
+ "}"
+ ]
+ },
+ {
+ "$ Gtk.Align halign" : "Gtk.Align.START",
+ "$ xns" : "Gtk",
+ "id" : "parent_lbl",
+ "string label" : "In Folder:",
+ "xtype" : "Label"
+ },
+ {
+ "$ xns" : "Gtk",
+ "bool hexpand" : true,
+ "id" : "parent_dd",
+ "items" : [
{
- "$ columns" : "typeof(string),typeof(string)",
"$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "model",
- "n_columns" : 2,
- "xtype" : "ListStore",
- "| void loadData" : [
- " ( ) {",
- " this.el.clear();",
- " ",
- " Gtk.TreeIter iter;",
- " ",
- " el.append(out iter);",
- " el.set_value(iter, 0, \"Roo\");",
- " el.set_value(iter, 1, \"Roo Project\");",
- " ",
- " el.append(out iter);",
- " el.set_value(iter, 0, \"Gtk\");",
- " el.set_value(iter, 1, \"Gtk Project\");",
- " ",
- " el.append(out iter);",
- " el.set_value(iter, 0, \"Flutter\");",
- " el.set_value(iter, 1, \"Flutter Project\");",
- " ",
- " ",
- "}",
- ""
- ]
+ "* prop" : "model",
+ "strings" : "{ \"gitlive\", \"Projects\", \"Select\" }",
+ "xtype" : "StringList"
}
],
- "xtype" : "ComboBox",
+ "listeners" : {
+ "notify[\"selected\"]" : [
+ "( ) => {",
+ "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
+ "\t\t_this.hideAll();",
+ "\t\t_this.parent_lbl.el.show();",
+ " \t_this.parent_dd.el.show(); ",
+ " \t",
+ "\t\treturn;",
+ "\t}",
+ "\t",
+ "\t",
+ "\t",
+ "\tif (this.getValue() == \"Select Folder\") {",
+ "\t\tvar fd = new Gtk.FileDialog();",
+ "\t\tfd.title = \"Select Folder\";",
+ "\t\tfd.modal = true;",
+ "\t\t",
+ "\t\tfd.select_folder.begin(_this.el, null, (obj, res) => {",
+ "\t\t\ttry {",
+ "\t\t \tvar f = fd.select_folder.end(res);",
+ "\t\t\t\tthis.extra_value = f.get_path();",
+ "\t\t\t\tvar sl = (Gtk.StringList) this.el.model;\t",
+ "\t\t\t\t",
+ "\t\t\t\tsl.remove(sl.get_n_items()-1);",
+ "\t\t\t\t",
+ "\t\t\t\tsl.append(this.extra_value);",
+ "\t\t\t\tsl.append(\"Select Folder\");",
+ "\t\t\t\tthis.el.selected = sl.get_n_items()-2;",
+ "\t\t\t} catch (GLib.Error e) {",
+ "\t\t\t\t// do nothing?",
+ "\t\t\t}",
+ "\t\t\t",
+ "\t\t});",
+ "\t\treturn;",
+ "",
+ "\t}",
+ "\t_this.hideAll();",
+ "\t_this.parent_lbl.el.show();",
+ " \t_this.parent_dd.el.show(); ",
+ " \t",
+ "\t",
+ " _this.ptype_lbl.el.show(); ",
+ " _this.ptype_dd.el.show(); ",
+ "\t// folder selected...",
+ "\tswitch(_this.type_dd.getValue()) {",
+ "\t\tcase \"New Folder\":",
+ "\t\t _this.name_lbl.el.show(); ",
+ " \t _this.name_entry.el.show(); ",
+ " \t _this.name_entry.el.text = \"\";",
+ "\t\t _this.ptype_lbl.el.show(); ",
+ "\t\t _this.ptype_dd.el.show(); ",
+ " \t break;",
+ " \t ",
+ "\t\tcase \"Existing Folder\":",
+ "\t\t\t_this.folder_lbl.el.show();",
+ "\t\t \t_this.folder_dd.el.show();",
+ "\t\t \t_this.folder_dd.load();",
+ "\t\t ",
+ "\t\t \tbreak;",
+ "\t\t \t",
+ "\t\tcase \"Checkout from git\":",
+ "\t\t _this.name_lbl.el.show(); ",
+ " \t _this.name_entry.el.show(); ",
+ " \t _this.name_lbl.el.label= \"not yet\";",
+ " \t _this.name_entry.el.text = \"this is not supported yet\";",
+ "\t\t\tbreak;",
+ "\t\tdefault:",
+ "\t\t\tbreak;",
+ "\t}",
+ " ",
+ "\t",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "string extra_value" : "",
+ "xtype" : "DropDown",
"| string getValue" : [
- " () {",
- " var ix = this.el.get_active();",
- " if (ix < 0 ) {",
- " return \"\";",
- " }",
- " switch(ix) {",
- " case 0:",
- " return \"Roo\";",
- " case 1:",
- " return \"Gtk\";",
- " case 2:",
- " return \"Flutter\";",
- " }",
- " return \"\";",
- "}",
- ""
+ "() {",
+ "\tvar m = (Gtk.StringList) this.el.model;",
+ "\treturn m.get_string(this.el.selected);",
+ "\t",
+ "}"
+ ],
+ "| void load" : [
+ "() {",
+ "",
+ "\tvar sl = (Gtk.StringList) this.el.model;\t",
+ "\tvar hd = GLib.Environment.get_home_dir();",
+ "\twhile(sl.get_n_items() > 0) {",
+ "\t\tsl.remove(0);",
+ "\t}",
+ "\tif (FileUtils.test(hd + \"/gitlive\" ,FileTest.IS_DIR)) {",
+ "\t\tsl.append(hd + \"/gitlive\");",
+ "\t}",
+ "\tif (FileUtils.test(hd + \"/Projects\" ,FileTest.IS_DIR)) {",
+ "\t\tsl.append(hd + \"/Projects\");",
+ "\t}",
+ "\tif (this.extra_value != \"\" && FileUtils.test(this.extra_value ,FileTest.IS_DIR)) {",
+ "\t\tsl.append(this.extra_value);",
+ "\t}",
+ "\t",
+ "\tsl.append(\"Select Folder\");",
+ "\tthis.el.selected = Gtk.INVALID_LIST_POSITION;",
+ "\t",
+ "}"
+ ]
+ },
+ {
+ "$ Gtk.Align halign" : "Gtk.Align.START",
+ "$ xns" : "Gtk",
+ "id" : "folder_lbl",
+ "string label" : "Add Folder",
+ "xtype" : "Label"
+ },
+ {
+ "$ xns" : "Gtk",
+ "bool hexpand" : true,
+ "id" : "folder_dd",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "strings" : "{ \"gitlive\", \"Projects\", \"Select\" }",
+ "xtype" : "StringList"
+ }
+ ],
+ "listeners" : {
+ "notify[\"selected\"]" : [
+ "() => {",
+ "\tvar fn = this.getValue();",
+ "\tif (fn == \"\") {",
+ "\t\treturn;",
+ "\t}",
+ "\tvar p = _this.parent_dd.getValue();",
+ "\tif (!FileUtils.test(p + \"/\" + fn + \"/.roobuilder.jcfg\" , GLib.FileTest.EXISTS)) {",
+ "\t\treturn;",
+ "\t}",
+ "\tvar ty = Project.Project.peekProjectType(p + \"/\" + fn + \"/.roobuilder.jcfg\" );",
+ "\tif (ty == \"\") {",
+ "\t\treturn;",
+ "\t}",
+ "\t_this.ptype_dd.setValue(ty);",
+ "\t ",
+ " }",
+ " ",
+ " "
+ ]
+ },
+ "xtype" : "DropDown",
+ "| string getValue" : [
+ "() {",
+ "\tvar m = (Gtk.StringList) this.el.model;",
+ "\treturn this.el.selected == Gtk.INVALID_LIST_POSITION ?",
+ "\t\t\t \"\" : m.get_string(this.el.selected);",
+ "\t",
+ "}"
+ ],
+ "| void load" : [
+ "() {",
+ "\tvar p = _this.parent_dd.getValue();",
+ "\tvar f = File.new_for_path(p);",
+ "\tvar sl = (Gtk.StringList) this.el.model;\t",
+ "\twhile(sl.get_n_items() > 0) {",
+ "\t\tsl.remove(0);",
+ "\t}",
+ "\tvar gstr = new Gee.ArrayList<string>();",
+ "\t",
+ "\t",
+ "\ttry {",
+ "\t\tvar file_enum = f.enumerate_children(",
+ "\t\t\tGLib.FileAttribute.STANDARD_DISPLAY_NAME, ",
+ "\t\t\tGLib.FileQueryInfoFlags.NONE, null);",
+ "\t ",
+ " \t",
+ "\t\t",
+ "\t\tFileInfo next_file; ",
+ "\t\t ",
+ "\t\twhile ((next_file = file_enum.next_file(null)) != null) {",
+ "\t\t\tvar fn = next_file.get_display_name();",
+ "\t\t ",
+ "\t\t\tif (fn[0] == '.') { // skip hidden",
+ "\t\t\t\tcontinue;",
+ "\t\t\t}",
+ "\t\t\t ",
+ "\t\t\tif (!FileUtils.test(p + \"/\" + fn, GLib.FileTest.IS_DIR)) {",
+ "\t\t\t\tcontinue;",
+ "\t\t\t}",
+ "\t\t\tif (null != Project.Project.getProjectByPath(p + \"/\" + fn)) {",
+ "\t\t\t\tcontinue;",
+ "\t\t\t}",
+ "\t\t",
+ "\t\t\tgstr.add(fn);",
+ "\t\t}",
+ "\t} catch (GLib.Error e) {",
+ "\t\t// do nothing.. ",
+ "\t}",
+ "\tgstr.sort((a,b) => {",
+ "\t\treturn Posix.strcmp(a.down(), b.down());",
+ "\t});",
+ "",
+ "\tforeach(var str in gstr) {",
+ "\t\tsl.append(str);",
+ "\t}",
+ "\t ",
+ "}"
+ ]
+ },
+ {
+ "$ Gtk.Align halign" : "Gtk.Align.START",
+ "$ xns" : "Gtk",
+ "id" : "name_lbl",
+ "string label" : "Named (New Folder Name)",
+ "xtype" : "Label"
+ },
+ {
+ "$ xns" : "Gtk",
+ "bool hexpand" : true,
+ "id" : "name_entry",
+ "xtype" : "Entry",
+ "| string getValue" : [
+ "() {",
+ "\treturn this.el.text;",
+ "}"
+ ]
+ },
+ {
+ "$ Gtk.Align halign" : "Gtk.Align.START",
+ "$ xns" : "Gtk",
+ "id" : "ptype_lbl",
+ "label" : "Project type :",
+ "xtype" : "Label"
+ },
+ {
+ "$ xns" : "Gtk",
+ "bool hexpand" : true,
+ "id" : "ptype_dd",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "strings" : "{ \"Roo\", \"Gtk\" /*, \"WrappedGtk\", \"Flutter\" */ }",
+ "xtype" : "StringList"
+ }
+ ],
+ "listeners" : {
+ "notify[\"selected\"]" : [
+ "( ) => {",
+ "",
+ "\t_this.ok_btn.el.hide();\t",
+ "\tif (this.getValue() != \"\") {",
+ "\t _this.ok_btn.el.show();",
+ "\t}",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "DropDown",
+ "| string getValue" : [
+ "() {",
+ "\tvar m = (Gtk.StringList) this.el.model;",
+ "\treturn this.el.selected == Gtk.INVALID_LIST_POSITION ?",
+ "\t\t\t \"\" : m.get_string(this.el.selected);",
+ "\t",
+ "}"
+ ],
+ "| void setValue" : [
+ "(string val) {",
+ "\tvar m = (Gtk.StringList) this.el.model;",
+ "\tfor(var i = 0; i < m.get_n_items();i++) {",
+ "\t\tif (m.get_string(i) == val) {",
+ "\t\t\tthis.el.selected = i;",
+ "\t\t\tbreak;",
+ "\t\t}",
+ "\t}",
+ "\tthis.el.selected = Gtk.INVALID_LIST_POSITION;",
+ "",
+ "}"
]
}
],
- "xtype" : "Box"
- },
- {
- "$ action" : "Gtk.FileChooserAction.SELECT_FOLDER",
- "$ create_folders" : false,
- "$ select_multiple" : false,
- "$ xns" : "Gtk",
- "* pack" : "pack_end,true,true,5",
- "bool expand" : true,
- "id" : "dir",
- "xtype" : "FileChooserWidget"
+ "xtype" : "Grid"
}
],
"xtype" : "Box"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add_action_widget,1",
- "label" : "OK",
- "xtype" : "Button"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add_action_widget,0",
- "label" : "Cancel",
- "xtype" : "Button"
}
],
- "listeners" : {
- "destroy_event" : [
- "(self, event) => {",
- "\tthis.el.response(0);",
- "// this.el.hide();",
- " return false;",
- "}"
- ]
- },
"name" : "EditProject",
- "title" : "Project Properties",
- "xtype" : "Dialog",
- "| Project.Project? show" : [
+ "title" : "New Project",
+ "xtype" : "Window",
+ "| void hideAll" : [
+ "() {",
+ " \t_this.parent_lbl.el.hide();",
+ " _this.parent_dd.el.hide(); ",
+ " \t",
+ " \t_this.folder_lbl.el.hide();",
+ " _this.folder_dd.el.hide(); ",
+ " _this.name_lbl.el.hide(); ",
+ " _this.name_entry.el.hide(); ",
+ " _this.ptype_lbl.el.hide(); ",
+ " _this.ptype_dd.el.hide(); ",
+ " _this.ok_btn.el.hide(); ",
+ " ",
+ "}"
+ ],
+ "| void show" : [
"() {",
- " ",
- "",
+ " ",
+ " _this.hideAll(); ",
+ " // hide stuff..",
+ " _this.type_dd.el.selected = Gtk.INVALID_LIST_POSITION;",
+ " _this.folder_dd.el.selected = Gtk.INVALID_LIST_POSITION;",
+ " _this.ptype_dd.el.selected = Gtk.INVALID_LIST_POSITION;",
+ " _this.parent_dd.extra_value = \"\";",
" //[ 'xtype' ].forEach(function(k) {",
" // _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);",
" //});",
"\t// shouild set path..",
- " _this.model.loadData();",
- " this.el.show_all();",
- " ",
- " var err_dialog = Xcls_StandardErrorDialog.singleton();",
- "",
- " var id = -1;",
- " while (id < 0) {",
- " id = this.el.run();",
- " if (id < 1) {",
- " this.el.hide();",
- " return null;",
- " }",
- " ",
- " ",
- " if (_this.xtype.getValue().length < 1) {",
- " ",
- " err_dialog.show(_this.el,\"You have to set Project type\"); ",
- " id = -1;",
- " continue;",
- " }",
- " if (_this.dir.el.get_filename().length < 1) {",
- "",
- " err_dialog.show(_this.el,\"You have to select a folder\"); ",
- " id = -1;",
- " continue;",
- " }",
- " ",
- " }",
- " ",
- " this.el.hide();",
- " ",
- " ",
- " ",
- " ",
- " var fn = _this.dir.el.get_filename();",
- " print(\"add %s\\n\" , fn);",
- " try {",
- "\t\tvar project = Project.Project.factory(_this.xtype.getValue(), fn);",
- "\t\tproject.save();",
- "\t\tProject.projects.set(project.name,project);",
- "\t\treturn project;",
- "\t} catch (Error e) {",
- "\t\tGLib.debug(\"got error? %s\" , e.message);",
- "\t}",
- " //var pr = imports.Builder.Provider.ProjectManager.ProjectManager.update(this.project);",
- " return null;",
" ",
- "",
+ " this.el.show();",
" ",
- " //this.success = c.success;",
- "}",
- ""
+ "}"
]
}
],
- "modOrder" : "",
- "name" : "EditProject",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/EditProject.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "EditProject"
}
\ No newline at end of file
-static EditProject _EditProject;
+ static EditProject _EditProject;
-public class EditProject : Object
-{
- public Gtk.Dialog el;
- private EditProject _this;
-
- public static EditProject singleton()
+ public class EditProject : Object
{
- if (_EditProject == null) {
- _EditProject= new EditProject();
- }
- return _EditProject;
- }
- public Xcls_xtype xtype;
- public Xcls_cellrender cellrender;
- public Xcls_model model;
- public Xcls_dir dir;
-
- // my vars (def)
-
- // ctor
- public EditProject()
- {
- _this = this;
- this.el = new Gtk.Dialog();
-
- // my vars (dec)
-
- // set gobject values
- this.el.title = "Project Properties";
- this.el.name = "EditProject";
- this.el.border_width = 3;
- this.el.default_height = 500;
- this.el.default_width = 600;
- this.el.deletable = true;
- this.el.modal = true;
- var child_0 = new Xcls_Box2( _this );
- child_0.ref();
- this.el.get_content_area().add( child_0.el );
- var child_1 = new Xcls_Button9( _this );
- child_1.ref();
- this.el.add_action_widget ( child_1.el , 1 );
- var child_2 = new Xcls_Button10( _this );
- child_2.ref();
- this.el.add_action_widget ( child_2.el , 0 );
-
- //listeners
- this.el.destroy_event.connect( (self, event) => {
- this.el.response(0);
- // this.el.hide();
- return false;
- });
- }
+ public Gtk.Window el;
+ private EditProject _this;
- // user defined functions
- public Project.Project? show () {
-
-
- //[ 'xtype' ].forEach(function(k) {
- // _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);
- //});
- // shouild set path..
- _this.model.loadData();
- this.el.show_all();
-
- var err_dialog = Xcls_StandardErrorDialog.singleton();
-
- var id = -1;
- while (id < 0) {
- id = this.el.run();
- if (id < 1) {
- this.el.hide();
- return null;
- }
-
-
- if (_this.xtype.getValue().length < 1) {
-
- err_dialog.show(_this.el,"You have to set Project type");
- id = -1;
- continue;
- }
- if (_this.dir.el.get_filename().length < 1) {
-
- err_dialog.show(_this.el,"You have to select a folder");
- id = -1;
- continue;
+ public static EditProject singleton()
+ {
+ if (_EditProject == null) {
+ _EditProject= new EditProject();
}
-
+ return _EditProject;
}
-
- this.el.hide();
-
-
-
-
- var fn = _this.dir.el.get_filename();
- print("add %s\n" , fn);
- try {
- var project = Project.Project.factory(_this.xtype.getValue(), fn);
- project.save();
- Project.projects.set(project.name,project);
- return project;
- } catch (Error e) {
- GLib.debug("got error? %s" , e.message);
- }
- //var pr = imports.Builder.Provider.ProjectManager.ProjectManager.update(this.project);
- return null;
-
-
-
- //this.success = c.success;
- }
- public class Xcls_Box2 : Object
- {
- public Gtk.Box el;
- private EditProject _this;
-
+ public Xcls_ok_btn ok_btn;
+ public Xcls_type_lbl type_lbl;
+ public Xcls_type_dd type_dd;
+ public Xcls_parent_lbl parent_lbl;
+ public Xcls_parent_dd parent_dd;
+ public Xcls_folder_lbl folder_lbl;
+ public Xcls_folder_dd folder_dd;
+ public Xcls_name_lbl name_lbl;
+ public Xcls_name_entry name_entry;
+ public Xcls_ptype_lbl ptype_lbl;
+ public Xcls_ptype_dd ptype_dd;
// my vars (def)
+ public WindowState? windowstate;
+ public signal void canceled ();
+ public signal void selected (Project.Project? proj);
// ctor
- public Xcls_Box2(EditProject _owner )
+ public EditProject()
{
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ _this = this;
+ this.el = new Gtk.Window();
// my vars (dec)
+ this.windowstate = null;
// set gobject values
- this.el.homogeneous = false;
- this.el.expand = true;
- var child_0 = new Xcls_Box3( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,true,3 );
- var child_1 = new Xcls_dir( _this );
- child_1.ref();
- this.el.pack_end ( child_1.el , true,true,5 );
+ this.el.title = "New Project";
+ this.el.name = "EditProject";
+ this.el.default_width = 600;
+ this.el.deletable = true;
+ this.el.modal = true;
+ var child_1 = new Xcls_HeaderBar2( _this );
+ this.el.titlebar = child_1.el;
+ var child_2 = new Xcls_Box5( _this );
+ this.el.child = child_2.el;
}
// user defined functions
- }
- public class Xcls_Box3 : Object
- {
- public Gtk.Box el;
- private EditProject _this;
+ public void show () {
+
+ _this.hideAll();
+ // hide stuff..
+ _this.type_dd.el.selected = Gtk.INVALID_LIST_POSITION;
+ _this.folder_dd.el.selected = Gtk.INVALID_LIST_POSITION;
+ _this.ptype_dd.el.selected = Gtk.INVALID_LIST_POSITION;
+ _this.parent_dd.extra_value = "";
+ //[ 'xtype' ].forEach(function(k) {
+ // _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);
+ //});
+ // shouild set path..
+
+ this.el.show();
+
+ }
+ public void hideAll () {
+ _this.parent_lbl.el.hide();
+ _this.parent_dd.el.hide();
+
+ _this.folder_lbl.el.hide();
+ _this.folder_dd.el.hide();
+ _this.name_lbl.el.hide();
+ _this.name_entry.el.hide();
+ _this.ptype_lbl.el.hide();
+ _this.ptype_dd.el.hide();
+ _this.ok_btn.el.hide();
+
+ }
+ public class Xcls_HeaderBar2 : Object
+ {
+ public Gtk.HeaderBar el;
+ private EditProject _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Box3(EditProject _owner )
+ // ctor
+ public Xcls_HeaderBar2(EditProject _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_Button3( _this );
+ child_1.ref();
+ this.el.pack_start ( child_1.el );
+ new Xcls_ok_btn( _this );
+ this.el.pack_end ( _this.ok_btn.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Button3 : Object
{
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+ public Gtk.Button el;
+ private EditProject _this;
- // my vars (dec)
- // set gobject values
- this.el.homogeneous = false;
- var child_0 = new Xcls_Label4( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,true,3 );
- var child_1 = new Xcls_xtype( _this );
- child_1.ref();
- this.el.pack_end ( child_1.el , true,true,3 );
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button3(EditProject _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.halign = Gtk.Align.END;
+ this.el.hexpand = false;
+ this.el.label = "Cancel";
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ _this.el.hide();
+ _this.canceled();
+
+
+ });
+ }
+
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_Label4 : Object
- {
- public Gtk.Label el;
- private EditProject _this;
+ public class Xcls_ok_btn : Object
+ {
+ public Gtk.Button el;
+ private EditProject _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_ok_btn(EditProject _owner )
+ {
+ _this = _owner;
+ _this.ok_btn = this;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.hexpand = false;
+ this.el.css_classes = { "suggested-action" };
+ this.el.label = "OK";
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+ var err_dialog = Xcls_StandardErrorDialog.singleton();
+
+
+ if (_this.ptype_dd.getValue().length < 1) {
+ err_dialog.show(_this.el,"You have to set Project type");
+ return;
+ }
+ var fn = _this.parent_dd.getValue();
+ var is_existing = false;
+ var is_new_folder = false;
+ switch (_this.type_dd.getValue()) {
+ case "Existing Folder":
+ if (_this.folder_dd.getValue().length < 1) {
+ err_dialog.show(_this.el,"You have to set Folder");
+ return;
+ }
+ fn += "/" + _this.folder_dd.getValue();
+ is_existing = true;
+ break;
+
+ case "New Folder":
+ if (_this.name_entry.getValue().length < 1) {
+ err_dialog.show(_this.el,"You have enter a Project Name");
+ return;
+ }
+ fn += "/" + _this.name_entry.getValue();
+
+ if (FileUtils.test( fn ,FileTest.EXISTS)) {
+ err_dialog.show(_this.el,"That folder already exists");
+ return;
+ }
+ var dir = File.new_for_path(fn);
+ try {
+ dir.make_directory();
+ } catch (Error e) {
+ GLib.error("Failed to make directory %s", fn);
+ }
+ is_new_folder = true;
+ break;
+
+ default:
+ return;
+
+ }
+
+
+
+
+ _this.el.hide();
+
+
+
+
+ GLib.debug("add %s\n" , fn);
+ try {
+ var project = Project.Project.factory(_this.ptype_dd.getValue(), fn);
+ if (is_new_folder) {
+ project.initialize();
+
+ } else {
+ project.load();
+ }
+
+ project.save();
+ Project.Project.saveProjectList();
+ _this.selected(project); // this should trigger a load()
+ if (is_new_folder || is_existing) {
+ _this.windowstate.projectPopoverShow(_this.el, project);
+ }
+
+ return;
+ } catch (Error e) {
+ GLib.debug("got error? %s" , e.message);
+ }
+
+
+ });
+ }
+ // user defined functions
+ }
- // my vars (def)
- // ctor
- public Xcls_Label4(EditProject _owner )
+ public class Xcls_Box5 : Object
{
- _this = _owner;
- this.el = new Gtk.Label( "Project type :" );
+ public Gtk.Box el;
+ private EditProject _this;
+
+
+ // my vars (def)
+ public bool expand;
+
+ // ctor
+ public Xcls_Box5(EditProject _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_Grid6( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ }
- // my vars (dec)
+ // user defined functions
+ }
+ public class Xcls_Grid6 : Object
+ {
+ public Gtk.Grid el;
+ private EditProject _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Grid6(EditProject _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Grid();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.column_spacing = 4;
+ this.el.row_spacing = 4;
+ this.el.margin_bottom = 20;
+ new Xcls_type_lbl( _this );
+ this.el.attach( _this.type_lbl.el, 0, 0, 1, 1 );
+ new Xcls_type_dd( _this );
+ this.el.attach( _this.type_dd.el, 1, 0, 1, 1 );
+ new Xcls_parent_lbl( _this );
+ this.el.attach( _this.parent_lbl.el, 0, 1, 1, 1 );
+ new Xcls_parent_dd( _this );
+ this.el.attach( _this.parent_dd.el, 1, 1, 1, 1 );
+ new Xcls_folder_lbl( _this );
+ this.el.attach( _this.folder_lbl.el, 0, 2, 1, 1 );
+ new Xcls_folder_dd( _this );
+ this.el.attach( _this.folder_dd.el, 1, 2, 1, 1 );
+ new Xcls_name_lbl( _this );
+ this.el.attach( _this.name_lbl.el, 0, 3, 1, 1 );
+ new Xcls_name_entry( _this );
+ this.el.attach( _this.name_entry.el, 1, 3, 1, 1 );
+ new Xcls_ptype_lbl( _this );
+ this.el.attach( _this.ptype_lbl.el, 0, 4, 1, 1 );
+ new Xcls_ptype_dd( _this );
+ this.el.attach( _this.ptype_dd.el, 1, 4, 1, 1 );
+ }
- // set gobject values
+ // user defined functions
}
+ public class Xcls_type_lbl : Object
+ {
+ public Gtk.Label el;
+ private EditProject _this;
- // user defined functions
- }
- public class Xcls_xtype : Object
- {
- public Gtk.ComboBox el;
- private EditProject _this;
+ // my vars (def)
+ // ctor
+ public Xcls_type_lbl(EditProject _owner )
+ {
+ _this = _owner;
+ _this.type_lbl = this;
+ this.el = new Gtk.Label( "Create a Project from:" );
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_xtype(EditProject _owner )
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_type_dd : Object
{
- _this = _owner;
- _this.xtype = this;
- this.el = new Gtk.ComboBox();
+ public Gtk.DropDown el;
+ private EditProject _this;
- // my vars (dec)
- // set gobject values
- var child_0 = new Xcls_cellrender( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
- var child_1 = new Xcls_model( _this );
- child_1.ref();
- this.el.set_model ( child_1.el );
+ // my vars (def)
- // init method
+ // ctor
+ public Xcls_type_dd(EditProject _owner )
+ {
+ _this = _owner;
+ _this.type_dd = this;
+ var child_1 = new Xcls_StringList9( _this );
+ child_1.ref();
+ this.el = new Gtk.DropDown( child_1.el, null );
- this.el.add_attribute(_this.cellrender.el , "markup", 1 );
- }
+ // my vars (dec)
- // user defined functions
- public string getValue () {
- var ix = this.el.get_active();
- if (ix < 0 ) {
- return "";
- }
- switch(ix) {
- case 0:
- return "Roo";
- case 1:
- return "Gtk";
- case 2:
- return "Flutter";
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.selected = Gtk.INVALID_LIST_POSITION;
+
+ // init method
+
+ {
+
}
- return "";
+
+ //listeners
+ this.el.notify["selected"].connect( ( ) => {
+
+ if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
+ return;
+ }
+ var m = (Gtk.StringList) this.el.model;
+ GLib.debug("selected item: %s", m.get_string(this.el.selected));
+
+ _this.hideAll();
+ _this.parent_lbl.el.show();
+ _this.parent_dd.el.show();
+ _this.parent_dd.load();
+ /*
+ break;
+
+ switch (m.get_string(this.el.selected)) {
+ case "New Folder":
+ _this.name_lbl.el.show();
+ _this.name_entry.el.show();
+ break;
+ case "Existing Folder":
+ _this.folder_lbl.el.show();
+ _this.folder_dd.el.show();
+ break;
+
+ case "Checkout from git":
+ _this.name_lbl.el.show();
+ _this.name_entry.el.show();
+ break;
+ default:
+ _this.hideAll();
+ break;
+
+ }
+
+ */
+
+
+
+
+
+
+ });
+ }
+
+ // user defined functions
+ public string getValue () {
+ var m = (Gtk.StringList) this.el.model;
+ return m.get_string(this.el.selected);
+
+ }
}
- }
- public class Xcls_cellrender : Object
- {
- public Gtk.CellRendererText el;
- private EditProject _this;
+ public class Xcls_StringList9 : Object
+ {
+ public Gtk.StringList el;
+ private EditProject _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_cellrender(EditProject _owner )
+ // ctor
+ public Xcls_StringList9(EditProject _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.StringList( { "New Folder", "Existing Folder" /*, "Checkout from git" */ } );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_parent_lbl : Object
{
- _this = _owner;
- _this.cellrender = this;
- this.el = new Gtk.CellRendererText();
+ public Gtk.Label el;
+ private EditProject _this;
- // my vars (dec)
- // set gobject values
+ // my vars (def)
+
+ // ctor
+ public Xcls_parent_lbl(EditProject _owner )
+ {
+ _this = _owner;
+ _this.parent_lbl = this;
+ this.el = new Gtk.Label( "In Folder:" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ }
+
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_parent_dd : Object
+ {
+ public Gtk.DropDown el;
+ private EditProject _this;
+
+
+ // my vars (def)
+ public string extra_value;
+
+ // ctor
+ public Xcls_parent_dd(EditProject _owner )
+ {
+ _this = _owner;
+ _this.parent_dd = this;
+ var child_1 = new Xcls_StringList12( _this );
+ child_1.ref();
+ this.el = new Gtk.DropDown( child_1.el, null );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+
+ //listeners
+ this.el.notify["selected"].connect( ( ) => {
+ if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
+ _this.hideAll();
+ _this.parent_lbl.el.show();
+ _this.parent_dd.el.show();
+
+ return;
+ }
+
+
+
+ if (this.getValue() == "Select Folder") {
+ var fd = new Gtk.FileDialog();
+ fd.title = "Select Folder";
+ fd.modal = true;
+
+ fd.select_folder.begin(_this.el, null, (obj, res) => {
+ try {
+ var f = fd.select_folder.end(res);
+ this.extra_value = f.get_path();
+ var sl = (Gtk.StringList) this.el.model;
+
+ sl.remove(sl.get_n_items()-1);
+
+ sl.append(this.extra_value);
+ sl.append("Select Folder");
+ this.el.selected = sl.get_n_items()-2;
+ } catch (GLib.Error e) {
+ // do nothing?
+ }
+
+ });
+ return;
+
+ }
+ _this.hideAll();
+ _this.parent_lbl.el.show();
+ _this.parent_dd.el.show();
+
+
+ _this.ptype_lbl.el.show();
+ _this.ptype_dd.el.show();
+ // folder selected...
+ switch(_this.type_dd.getValue()) {
+ case "New Folder":
+ _this.name_lbl.el.show();
+ _this.name_entry.el.show();
+ _this.name_entry.el.text = "";
+ _this.ptype_lbl.el.show();
+ _this.ptype_dd.el.show();
+ break;
+
+ case "Existing Folder":
+ _this.folder_lbl.el.show();
+ _this.folder_dd.el.show();
+ _this.folder_dd.load();
+
+ break;
+
+ case "Checkout from git":
+ _this.name_lbl.el.show();
+ _this.name_entry.el.show();
+ _this.name_lbl.el.label= "not yet";
+ _this.name_entry.el.text = "this is not supported yet";
+ break;
+ default:
+ break;
+ }
+
+
+
+ });
+ }
- public class Xcls_model : Object
- {
- public Gtk.ListStore el;
- private EditProject _this;
+ // user defined functions
+ public string getValue () {
+ var m = (Gtk.StringList) this.el.model;
+ return m.get_string(this.el.selected);
+
+ }
+ public void load () {
+
+ var sl = (Gtk.StringList) this.el.model;
+ var hd = GLib.Environment.get_home_dir();
+ while(sl.get_n_items() > 0) {
+ sl.remove(0);
+ }
+ if (FileUtils.test(hd + "/gitlive" ,FileTest.IS_DIR)) {
+ sl.append(hd + "/gitlive");
+ }
+ if (FileUtils.test(hd + "/Projects" ,FileTest.IS_DIR)) {
+ sl.append(hd + "/Projects");
+ }
+ if (this.extra_value != "" && FileUtils.test(this.extra_value ,FileTest.IS_DIR)) {
+ sl.append(this.extra_value);
+ }
+
+ sl.append("Select Folder");
+ this.el.selected = Gtk.INVALID_LIST_POSITION;
+
+ }
+ }
+ public class Xcls_StringList12 : Object
+ {
+ public Gtk.StringList el;
+ private EditProject _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_model(EditProject _owner )
+ // ctor
+ public Xcls_StringList12(EditProject _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.StringList( { "gitlive", "Projects", "Select" } );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_folder_lbl : Object
{
- _this = _owner;
- _this.model = this;
- this.el = new Gtk.ListStore.newv( { typeof(string),typeof(string) } );
+ public Gtk.Label el;
+ private EditProject _this;
- // my vars (dec)
- // set gobject values
+ // my vars (def)
+
+ // ctor
+ public Xcls_folder_lbl(EditProject _owner )
+ {
+ _this = _owner;
+ _this.folder_lbl = this;
+ this.el = new Gtk.Label( "Add Folder" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ }
+
+ // user defined functions
}
- // user defined functions
- public void loadData ( ) {
- this.el.clear();
-
- Gtk.TreeIter iter;
-
- el.append(out iter);
- el.set_value(iter, 0, "Roo");
- el.set_value(iter, 1, "Roo Project");
-
- el.append(out iter);
- el.set_value(iter, 0, "Gtk");
- el.set_value(iter, 1, "Gtk Project");
-
- el.append(out iter);
- el.set_value(iter, 0, "Flutter");
- el.set_value(iter, 1, "Flutter Project");
-
-
+ public class Xcls_folder_dd : Object
+ {
+ public Gtk.DropDown el;
+ private EditProject _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_folder_dd(EditProject _owner )
+ {
+ _this = _owner;
+ _this.folder_dd = this;
+ var child_1 = new Xcls_StringList15( _this );
+ child_1.ref();
+ this.el = new Gtk.DropDown( child_1.el, null );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+
+ //listeners
+ this.el.notify["selected"].connect( () => {
+ var fn = this.getValue();
+ if (fn == "") {
+ return;
+ }
+ var p = _this.parent_dd.getValue();
+ if (!FileUtils.test(p + "/" + fn + "/.roobuilder.jcfg" , GLib.FileTest.EXISTS)) {
+ return;
+ }
+ var ty = Project.Project.peekProjectType(p + "/" + fn + "/.roobuilder.jcfg" );
+ if (ty == "") {
+ return;
+ }
+ _this.ptype_dd.setValue(ty);
+
+ });
+ }
+
+ // user defined functions
+ public string getValue () {
+ var m = (Gtk.StringList) this.el.model;
+ return this.el.selected == Gtk.INVALID_LIST_POSITION ?
+ "" : m.get_string(this.el.selected);
+
+ }
+ public void load () {
+ var p = _this.parent_dd.getValue();
+ var f = File.new_for_path(p);
+ var sl = (Gtk.StringList) this.el.model;
+ while(sl.get_n_items() > 0) {
+ sl.remove(0);
+ }
+ var gstr = new Gee.ArrayList<string>();
+
+
+ try {
+ var file_enum = f.enumerate_children(
+ GLib.FileAttribute.STANDARD_DISPLAY_NAME,
+ GLib.FileQueryInfoFlags.NONE, null);
+
+
+
+ FileInfo next_file;
+
+ while ((next_file = file_enum.next_file(null)) != null) {
+ var fn = next_file.get_display_name();
+
+ if (fn[0] == '.') { // skip hidden
+ continue;
+ }
+
+ if (!FileUtils.test(p + "/" + fn, GLib.FileTest.IS_DIR)) {
+ continue;
+ }
+ if (null != Project.Project.getProjectByPath(p + "/" + fn)) {
+ continue;
+ }
+
+ gstr.add(fn);
+ }
+ } catch (GLib.Error e) {
+ // do nothing..
+ }
+ gstr.sort((a,b) => {
+ return Posix.strcmp(a.down(), b.down());
+ });
+
+ foreach(var str in gstr) {
+ sl.append(str);
+ }
+
+ }
}
- }
+ public class Xcls_StringList15 : Object
+ {
+ public Gtk.StringList el;
+ private EditProject _this;
+ // my vars (def)
- public class Xcls_dir : Object
- {
- public Gtk.FileChooserWidget el;
- private EditProject _this;
+ // ctor
+ public Xcls_StringList15(EditProject _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.StringList( { "gitlive", "Projects", "Select" } );
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ }
- // ctor
- public Xcls_dir(EditProject _owner )
+ // user defined functions
+ }
+
+
+ public class Xcls_name_lbl : Object
{
- _this = _owner;
- _this.dir = this;
- this.el = new Gtk.FileChooserWidget( Gtk.FileChooserAction.SELECT_FOLDER );
+ public Gtk.Label el;
+ private EditProject _this;
- // my vars (dec)
- // set gobject values
- this.el.expand = true;
- this.el.create_folders = false;
- this.el.select_multiple = false;
+ // my vars (def)
+
+ // ctor
+ public Xcls_name_lbl(EditProject _owner )
+ {
+ _this = _owner;
+ _this.name_lbl = this;
+ this.el = new Gtk.Label( "Named (New Folder Name)" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ }
+
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_name_entry : Object
+ {
+ public Gtk.Entry el;
+ private EditProject _this;
- public class Xcls_Button9 : Object
- {
- public Gtk.Button el;
- private EditProject _this;
+ // my vars (def)
+ // ctor
+ public Xcls_name_entry(EditProject _owner )
+ {
+ _this = _owner;
+ _this.name_entry = this;
+ this.el = new Gtk.Entry();
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_Button9(EditProject _owner )
+ // set gobject values
+ this.el.hexpand = true;
+ }
+
+ // user defined functions
+ public string getValue () {
+ return this.el.text;
+ }
+ }
+
+ public class Xcls_ptype_lbl : Object
{
- _this = _owner;
- this.el = new Gtk.Button();
+ public Gtk.Label el;
+ private EditProject _this;
- // my vars (dec)
- // set gobject values
- this.el.label = "OK";
+ // my vars (def)
+
+ // ctor
+ public Xcls_ptype_lbl(EditProject _owner )
+ {
+ _this = _owner;
+ _this.ptype_lbl = this;
+ this.el = new Gtk.Label( "Project type :" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ }
+
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_ptype_dd : Object
+ {
+ public Gtk.DropDown el;
+ private EditProject _this;
- public class Xcls_Button10 : Object
- {
- public Gtk.Button el;
- private EditProject _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_ptype_dd(EditProject _owner )
+ {
+ _this = _owner;
+ _this.ptype_dd = this;
+ var child_1 = new Xcls_StringList20( _this );
+ child_1.ref();
+ this.el = new Gtk.DropDown( child_1.el, null );
- // ctor
- public Xcls_Button10(EditProject _owner )
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+
+ //listeners
+ this.el.notify["selected"].connect( ( ) => {
+
+ _this.ok_btn.el.hide();
+ if (this.getValue() != "") {
+ _this.ok_btn.el.show();
+ }
+
+ });
+ }
+
+ // user defined functions
+ public string getValue () {
+ var m = (Gtk.StringList) this.el.model;
+ return this.el.selected == Gtk.INVALID_LIST_POSITION ?
+ "" : m.get_string(this.el.selected);
+
+ }
+ public void setValue (string val) {
+ var m = (Gtk.StringList) this.el.model;
+ for(var i = 0; i < m.get_n_items();i++) {
+ if (m.get_string(i) == val) {
+ this.el.selected = i;
+ break;
+ }
+ }
+ this.el.selected = Gtk.INVALID_LIST_POSITION;
+
+ }
+ }
+ public class Xcls_StringList20 : Object
{
- _this = _owner;
- this.el = new Gtk.Button();
+ public Gtk.StringList el;
+ private EditProject _this;
- // my vars (dec)
- // set gobject values
- this.el.label = "Cancel";
+ // my vars (def)
+
+ // ctor
+ public Xcls_StringList20(EditProject _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.StringList( { "Roo", "Gtk" /*, "WrappedGtk", "Flutter" */ } );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
}
- // user defined functions
- }
-}
+
+
+ }
{
"build_module" : "builder",
+ "gen_extended" : false,
"items" : [
{
+ "# GtkSource.SearchContext searchcontext" : "null",
"# JsRender.JsRender? file" : "null",
"# JsRender.Node node" : "null",
"# JsRender.NodeProp? prop" : "null",
"# string activeEditor" : "\"\"",
"$ homogeneous" : false,
"$ xns" : "Gtk",
- "* pack" : "add",
"@ void save" : "()",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
- "Gtk.SourceSearchContext searchcontext" : "null",
"bool hexpand" : true,
"bool vexpand" : true,
"int last_search_end" : 0,
{
"$ homogeneous" : false,
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,true",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "bool hexpand" : true,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
- "bool always_show_image" : true,
"id" : "save_button",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* prop" : "image",
- "string icon_name" : "document-save",
- "xtype" : "Image"
- }
- ],
"label" : "Save",
"listeners" : {
"clicked" : [
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
"bool hexpand" : true,
"xtype" : "Label"
},
"}",
""
],
- "* pack" : "add",
- "bool draw_value" : true,
+ "bool draw_value" : false,
"bool has_origin" : true,
"bool sensitive" : true,
"int digits" : 0,
"change_value" : [
"(st, val ) => {",
"\t ",
- "\t try {",
- "\t _this.view.css.load_from_data(",
- "\t \t\t\"#editor-view { font: %dpx Monospace; }\".printf((int)val)",
- "\t \t\t);",
- " } catch (Error e) {}",
+ "\t ",
+ "\t _this.view.css.load_from_string(",
+ "\t \t\t\"#editor-view { font: %dpx monospace; }\".printf((int)val)",
+ "\t );",
+ " ",
" \treturn false;",
"}"
]
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
- "bool always_show_image" : true,
"id" : "close_btn",
"items" : [
{
"$ xns" : "Gtk",
- "* prop" : "image",
+ "* prop" : "child",
+ "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
"string icon_name" : "window-close",
"xtype" : "Image"
}
" "
]
},
+ "string icon_name" : "window-close",
"xtype" : "Button"
}
],
},
{
"$ xns" : "Gtk",
- "* init" : [
- "this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
- ""
- ],
+ "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
+ "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
+ "bool overlay_scrolling" : false,
"bool vexpand" : true,
"id" : "RightEditor",
"items" : [
{
+ "# Gtk.CssProvider css" : "null",
"$ gboolean auto_indent" : true,
- "$ show_line_numbers" : true,
- "$ xns" : "Gtk",
+ "$ xns" : "GtkSource",
"* init" : [
- " ",
"",
- "\tthis.css = new Gtk.CssProvider();",
- "\ttry {",
- "\t\tthis.css.load_from_data(\"#editor-view { font: 10px Monospace;}\");",
- "\t} catch (Error e) {}",
- "\tthis.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);",
+ "",
+ "this.css = new Gtk.CssProvider();",
+ "",
+ "this.css.load_from_string(",
+ "\t\"#editor-view { font: 12px monospace;}\"",
+ ");",
+ " ",
+ "Gtk.StyleContext.add_provider_for_display(",
+ "\tthis.el.get_display(),",
+ "\tthis.css,",
+ "\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
+ ");",
+ "\t",
+ " ",
"\t ",
- "\t\t ",
"",
- "\ttry { ",
- "\t\tthis.el.completion.add_provider(new Palete.CompletionProvider(_this));",
- " } catch (GLib.Error e) {}",
- " ",
- "\tthis.el.completion.unblock_interactive();",
- "\tthis.el.completion.select_on_show\t\t\t= true; // select",
- "\tthis.el.completion.show_headers\t\t\t= false;",
- "\tthis.el.completion.remember_info_visibility\t\t= true;",
- " ",
- " ",
- " var attrs = new Gtk.SourceMarkAttributes();",
- " 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 Gtk.SourceMarkAttributes();",
- " 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);",
- " ",
+ " ",
+ "this.el.completion.add_provider(new Palete.CompletionProvider(_this));",
" ",
- " ",
- " var dattrs = new Gtk.SourceMarkAttributes();",
- " 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);",
- " ",
- " ",
- " this.el.get_space_drawer().set_matrix(null);",
- " this.el.get_space_drawer().set_types_for_locations( ",
- "\t\tGtk.SourceSpaceLocationFlags.ALL,",
- "\t\tGtk.SourceSpaceTypeFlags.ALL",
- " );",
- " this.el.get_space_drawer().set_enable_matrix(true);",
- " /*",
- " Gtk.SourceDrawSpacesFlags.LEADING + ",
+ "",
+ "this.el.completion.unblock_interactive();",
+ "this.el.completion.select_on_show = true; // select",
+ "",
+ "this.el.completion.remember_info_visibility\t = 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) => {",
+ "\tGLib.debug(\"tooltip query? %s\", mark.name);",
+ " return strdup(mark.name);",
+ "});",
+ "dattrs.query_tooltip_markup.connect(( mark) => {",
+ "\tGLib.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( ",
+ "\tGtkSource.SpaceLocationFlags.ALL,",
+ "\tGtkSource.SpaceTypeFlags.ALL",
+ ");",
+ "this.el.get_space_drawer().set_enable_matrix(true);",
+ "/*",
+ "Gtk.SourceDrawSpacesFlags.LEADING + ",
"Gtk.SourceDrawSpacesFlags.TRAILING + ",
"Gtk.SourceDrawSpacesFlags.TAB + ",
"Gtk.SourceDrawSpacesFlags.SPACE",
- " */"
+ "*/"
],
- "* pack" : "add",
- "Gtk.CssProvider css" : "null",
+ "* prop" : "child",
+ "bool has_tooltip" : true,
+ "bool hexpand" : true,
"bool insert_spaces_instead_of_tabs" : true,
+ "bool vexpand" : true,
+ "boolean show_line_marks" : true,
+ "boolean show_line_numbers" : true,
"gboolean highlight_current_line" : true,
- "gboolean show_line_marks" : true,
"id" : "view",
"indent_width" : 4,
"items" : [
{
- "$ xns" : "Gtk",
- "* pack" : "set_buffer",
+ "$ Gee.HashMap<int,string>? xmarks" : "null",
+ "$ xns" : "GtkSource",
+ "$ xtype" : "Buffer",
+ "* prop" : "buffer",
"bool check_queued" : false,
- "bool check_running" : false,
+ "bool enable_undo" : true,
"id" : "buffer",
"int error_line" : "-1",
"listeners" : {
" // this.get('/LeftPanel.model').changed( str , false);",
" return ;",
"}",
- "",
- " ",
""
]
},
- "xtype" : "SourceBuffer",
"| bool checkSyntax" : [
" () {",
" ",
- " if (this.check_running) {",
- " print(\"Check is running\\n\");",
- " if (this.check_queued) { ",
- " print(\"Check is already queued\");",
- " return true;",
- " }",
- " this.check_queued = true;",
- " print(\"Adding queued Check \");",
- " GLib.Timeout.add_seconds(1, () => {",
- " this.check_queued = false;",
- " ",
- " this.checkSyntax();",
- " return false;",
- " });",
" ",
- "",
- " return true;",
- " }",
" var str = this.toString();",
" ",
" // needed???",
" return true;",
" }",
" ",
- " if (_this.file.xtype == \"PlainFile\") {",
+ " // bit presumptiona",
+ " if (_this.file.xtype == \"PlainFile\" && _this.file.project.xtype == \"Gtk\") {",
" ",
" // assume it's gtk...",
- " this.check_running = true;",
- " ",
- " if (!BuilderApplication.valasource.checkPlainFileSpawn(",
- "\t _this.file,",
- "\t str",
- "\t )) {",
- " this.check_running = false;",
- " }",
- "\t",
+ " ",
+ "\t\tBuilderApplication.valacompilequeue.addFile( ",
+ "\t\t\tPalete.ValaCompileRequestType.FILE_CHANGE, ",
+ "\t\t\t_this.file , str, false) ;",
+ " ",
+ "",
" return true;",
" ",
" }",
" if (_this.file == null) {",
" return true;",
" }",
- " var p = _this.file.project.palete;",
+ " ",
" ",
"",
+ " ",
" ",
- " this.check_running = true;",
- " ",
- " ",
- " if (_this.file.language == \"js\") {",
- " this.check_running = false;",
- " print(\"calling validate javascript\\n\"); ",
- " Gee.HashMap<int,string> errors;",
- " p.javascriptHasErrors(",
- " \t\t_this.window.windowstate,",
- " str, ",
- " _this.prop,",
- " _this.file, // no reference not node?",
- " out errors",
- " );",
- " return this.highlightErrors(errors); ",
- " ",
- " }",
- " ",
- " ",
- " print(\"calling validate vala\\n\"); ",
+ " GLib.debug(\"calling validate\"); ",
" // clear the buttons.",
" ",
- " ",
- " if (! BuilderApplication.valasource.checkFileWithNodePropChange(",
- " _this.file,",
- " _this.node,",
- " _this.prop, ",
- " str",
- " )) {",
- " this.check_running = false;",
- " } ",
+ " BuilderApplication.valacompilequeue.addProp( ",
+ " \t\tPalete.ValaCompileRequestType.PROP_CHANGE,",
+ "\t\t\t_this.file,",
+ "\t\t\t_this.node,",
+ "\t\t\t_this.prop,",
+ "\t\t\tstr); ",
" ",
" ",
" ",
"| bool highlightErrors" : [
"( Gee.HashMap<int,string> validate_res) {",
" ",
- " this.error_line = validate_res.size;",
+ "\tthis.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;",
- " }"
+ "\tif (this.error_line < 1) {",
+ "\t\treturn true;",
+ "\t}",
+ "\tvar tlines = this.el.get_line_count ();",
+ "\tGtk.TextIter iter;",
+ "\tvar valiter = validate_res.map_iterator();",
+ "\twhile (valiter.next()) {",
+ "",
+ "\t// print(\"get inter\\n\");",
+ "\t\tvar eline = valiter.get_key();",
+ "\t\tif (eline > tlines) {",
+ "\t\t\tcontinue;",
+ "\t\t}",
+ "\t\tthis.el.get_iter_at_line( out iter, eline);",
+ "\t\t//print(\"mark line\\n\");",
+ "\t\tthis.el.create_source_mark(valiter.get_value(), \"ERR\", iter);",
+ "\t} ",
+ "\treturn false;",
+ "}"
],
"| 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);",
- " ",
- " ",
- " // we should highlight other types of errors..",
- " ",
- " if (!obj.has_member(type)) {",
- " print(\"Return has no errors\\n\");",
- " return true;",
- " }",
- " ",
- " if (_this.window.windowstate.state != WindowState.State.CODEONLY ",
- " ",
- " ) {",
- " return true;",
- " } ",
- " ",
- " ",
- " var err = obj.get_object_member(type);",
- " ",
- " ",
- " if (_this.file == null) {",
- " return true;",
- " ",
- " }",
- " var valafn = _this.file.path;",
+ "\tGtk.TextIter start;",
+ "\tGtk.TextIter end; ",
+ "\tthis.el.get_bounds (out start, out end);",
+ "",
+ "\tthis.el.remove_source_marks (start, end, type);",
+ "\tGLib.debug(\"highlight errors\");\t\t ",
+ "",
+ "\t // we should highlight other types of errors..",
+ "",
+ "\tif (!obj.has_member(type)) {",
+ "\t\tGLib.debug(\"Return has no errors\\n\");",
+ "\t\treturn true;",
+ "\t}",
+ "",
+ "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
+ "\t\t&&",
+ "\t\t_this.window.windowstate.state != WindowState.State.CODE",
+ "\t\t) {",
+ "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
+ "\t\t",
+ "\t\treturn true;",
+ "\t} ",
+ "",
+ "\t//this.marks = new Gee.HashMap<int,string>();",
+ "\tvar err = obj.get_object_member(type);",
" ",
- " if (_this.file.xtype != \"PlainFile\") {",
+ "\tif (_this.file == null) {",
+ "\t\tGLib.debug(\"file is null?\");",
+ "\t\treturn true;",
"",
+ "\t}",
+ "\tvar valafn = _this.file.path;",
"",
- " ",
- " ",
- " 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;",
- " } ",
+ "\tif (_this.file.xtype != \"PlainFile\") {",
"",
+ "\t\tvalafn = \"\";",
+ "\t\ttry { ",
+ "\t\t\tvar regex = new Regex(\"\\\\.bjs$\");",
+ "\t\t\t// should not happen",
+ "\t \t\tvalafn = regex.replace(_this.file.path,_this.file.path.length , 0 , \".vala\");",
+ "\t\t} catch (GLib.RegexError e) {",
+ "\t\t\treturn true;",
+ "\t\t} ",
"",
"",
- " }",
- " if (!err.has_member(valafn)) {",
- " print(\"File path has no errors\\n\");",
- " return true;",
- " }",
"",
- " var lines = err.get_object_member(valafn);",
- " ",
- " var offset = 1;",
- " if (obj.has_member(\"line_offset\")) {",
- " offset = (int)obj.get_int_member(\"line_offset\") + 1;",
- " }",
- " ",
+ "\t}",
+ "\tif (!err.has_member(valafn)) {",
+ "\t\tGLib.debug(\"File path has no errors\");",
+ "\t\treturn true;",
+ "\t}",
"",
- " ",
- " ",
- " var tlines = this.el.get_line_count () +1;",
- " ",
- " lines.foreach_member((obj, line, node) => {",
- " ",
- " Gtk.TextIter iter;",
- " // print(\"get inter\\n\");",
- " var eline = int.parse(line) - offset;",
- " print(\"GOT ERROR on line %s -- converted to %d\\n\", line,eline);",
- " ",
- " ",
- " if (eline > tlines || eline < 0) {",
- " return;",
- " }",
- " this.el.get_iter_at_line( out iter, eline);",
- " //print(\"mark line\\n\");",
- " var msg = \"Line: %d\".printf(eline+1);",
- " var ar = lines.get_array_member(line);",
- " for (var i = 0 ; i < ar.get_length(); i++) {",
- "\t\t msg += (msg.length > 0) ? \"\\n\" : \"\";",
- "\t\t msg += ar.get_string_element(i);",
+ "\tvar lines = err.get_object_member(valafn);",
+ "\t",
+ "\tvar offset = 1;",
+ "\tif (obj.has_member(\"line_offset\")) { // ?? why??",
+ "\t\toffset = (int)obj.get_int_member(\"line_offset\") + 1;",
+ "\t}",
+ "",
+ "",
+ "\tvar tlines = this.el.get_line_count () +1;",
+ "\t",
+ "\tif (_this.prop != null) {",
+ "\t",
+ "\t\ttlines = _this.prop.end_line + 1;",
+ "\t\toffset = _this.prop.start_line + 1;",
+ "\t",
+ "\t}",
+ "\t",
+ "",
+ "",
+ "\tlines.foreach_member((obj, line, node) => {",
+ "\t\t",
+ "\t Gtk.TextIter iter;",
+ "// print(\"get inter\\n\");",
+ "\t var eline = int.parse(line) - offset;",
+ "\t GLib.debug(\"GOT ERROR on line %s -- converted to %d (offset = %d)\\n\", line,eline, offset);",
+ "\t ",
+ "\t ",
+ "\t if (eline > tlines || eline < 0) {",
+ "\t return;",
"\t }",
- " ",
- " ",
- " this.el.create_source_mark(msg, type, iter);",
- " } );",
- " return false;",
- " ",
+ "\t ",
+ "\t ",
+ "\t this.el.get_iter_at_line( out iter, eline);",
+ "\t //print(\"mark line\\n\");",
+ "\t var msg = \"\";",
+ "\t var ar = lines.get_array_member(line);",
+ "\t for (var i = 0 ; i < ar.get_length(); i++) {",
+ "\t \tif (ar.get_string_element(i) == \"Success\") {",
+ "\t \t\tcontinue;",
+ " \t\t}",
+ "\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
+ "\t\t\tmsg += ar.get_string_element(i);",
+ "\t\t}",
+ "\t\tif (msg == \"\") {",
+ "\t\t\treturn;",
+ "\t\t}",
+ "\t\tmsg = \"Line: %d\".printf(eline+1) + \" \" + msg;",
+ "\t this.el.create_source_mark(msg, type, iter);",
+ "\t GLib.debug(\"set line %d to %m\", eline, msg);",
+ "\t // this.marks.set(eline, msg);",
+ "\t} );",
+ "\treturn false;",
"",
"",
"",
"",
- "}",
+ "",
+ "\t}",
""
],
"| string toString" : [
"}",
" "
]
+ },
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "key_released" : [
+ "(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 ) {",
+ "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
+ "\t\t_this.forwardSearch(true);",
+ "\t return;",
+ "\t}",
+ "\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 return;",
+ "\t}",
+ " ",
+ " // print(event.key.keyval)",
+ " ",
+ " return;",
+ " ",
+ " ",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "EventControllerKey"
}
],
"listeners" : {
- "key_release_event" : [
- " (event) => {",
- " ",
- " if (event.keyval == Gdk.Key.s && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
- " GLib.debug(\"SAVE: ctrl-S pressed\");",
- " _this.saveContents();",
- " return false;",
- " }",
- " ",
- " if (event.keyval == Gdk.Key.g && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
- "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
- "\t\t_this.forwardSearch(true);",
- "\t return true;",
- "\t}",
- "\tif (event.keyval == Gdk.Key.f && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
- "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
- "\t\t_this.search_entry.el.grab_focus();",
- "\t return true;",
- "\t}",
- " ",
- " // print(event.key.keyval)",
- " ",
- " return false;",
+ "query_tooltip" : [
+ "(x, y, keyboard_tooltip, tooltip) => {",
+ "\t",
+ "\t//GLib.debug(\"query tooltip\");",
+ "\tGtk.TextIter iter;",
+ "\tint trailing;",
+ "\t",
+ "\tvar yoff = (int) _this.RightEditor.el.vadjustment.value;",
+ "\t",
+ "\t// I think this is problematic - if it's compliing / updating at same time as query.",
+ "\t",
+ "\t//if (_this.window.statusbar_compile_spinner.el.spinning) {",
+ "\t//\treturn false;",
+ "\t//}",
+ "\t",
+ "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
+ "\t ",
+ "\tvar l = iter.get_line();",
"",
- "} ",
+ "\t",
+ "\t ",
+ "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
+ "\tif (l < 0) {",
"",
- " "
+ "\t\treturn false;",
+ "\t}",
+ "\t/*",
+ "\tif (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {",
+ "\t\tGLib.debug(\"line %d setting tip to %s\", l, _this.buffer.marks.get(l));",
+ "\t\ttooltip.set_text(_this.buffer.marks.get(l).dup());",
+ "\t\treturn true;",
+ "\t}",
+ " ",
+ "\treturn false;",
+ "\t*/",
+ "\t",
+ "\t ",
+ "\t// this crashes?? - not sure why.",
+ "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
+ "\tif (marks.is_empty()) {",
+ "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
+ "\t}",
+ "\tif (marks.is_empty()) {",
+ "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
+ "\t}",
+ "\t",
+ "\t// GLib.debug(\"query tooltip line %d marks %d\", (int)l, (int) marks.length());",
+ "\tvar str = \"\";",
+ "\tmarks.@foreach((m) => { ",
+ "\t\t//GLib.debug(\"got mark %s\", m.name);",
+ "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.category + \": \" + m.name;",
+ "\t});",
+ "\t// true if there is a mark..",
+ "\tif (str.length > 0 ) {",
+ "\t\ttooltip.set_text( str );",
+ "\t}",
+ "\treturn str.length > 0 ? true : false;",
+ "\t ",
+ "}",
+ ""
]
},
"string name" : "editor-view",
"uint tab_width" : 4,
- "xtype" : "SourceView",
+ "xtype" : "View",
"| void load" : [
" (string str) {",
"",
"// show the help page for the active node..",
" //this.get('/Help').show();",
- "",
- "",
+ " ",
" // this.get('/BottomPane').el.set_current_page(0);",
- " var buf = (Gtk.SourceBuffer)this.el.get_buffer();",
+ " \tGLib.debug(\"load called - Reset undo buffer\");",
+ " \t",
+ " var buf = (GtkSource.Buffer)this.el.get_buffer();",
+ " buf.begin_irreversible_action();",
" buf.set_text(str, str.length);",
- " buf.set_undo_manager(null);",
+ " buf.end_irreversible_action();",
" ",
- " var lm = Gtk.SourceLanguageManager.get_default();",
+ " var lm = GtkSource.LanguageManager.get_default();",
" var lang = \"vala\";",
" if (_this.file != null) {",
" lang = _this.file.language;",
" lm.get_language(lang);",
" ",
" ",
- " ((Gtk.SourceBuffer)(this.el.get_buffer())) .set_language(lg); ",
+ " ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); ",
"",
" this.el.insert_spaces_instead_of_tabs = true;",
" if (lg != null) {",
},
{
"$ xns" : "Gtk",
+ "* pack" : "append",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
"bool homogeneous" : false,
"bool vexpand" : false,
"items" : [
{
"$ xns" : "Gtk",
- "* init" : [
- "var description = Pango.FontDescription.from_string(\"monospace\");",
- "\tdescription.set_size(8000);",
- "\t this.el.set_property(\"font-desc\",description);",
- "",
- ""
- ],
+ "Gtk.CssProvider css" : "",
"bool hexpand" : true,
"id" : "search_entry",
- "int width_request" : 300,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "key_pressed" : [
+ "(keyval, keycode, state) => {",
+ "",
+ "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
+ "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
+ "\t\t_this.forwardSearch(true);",
+ "\t return true;",
+ "\t}",
+ " ",
+ " ",
+ " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
+ "\t\t_this.forwardSearch(true);",
+ "\t\t",
+ "\t\t",
+ "\t return true;",
+ "",
+ "\t} ",
+ " // print(event.key.keyval)",
+ " ",
+ " return false;",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "EventControllerKey"
+ }
+ ],
"listeners" : {
- "changed" : [
- "() => {",
- "\t/*",
- "\tif (this.el.text == \"\") {",
- "\t\t_this.search_results.el.hide();",
- "\t\treturn;",
- "\t}",
- "\tvar res = 0;",
- "\tswitch(_this.windowstate.state) {",
- "\t\tcase WindowState.State.CODEONLY:",
- "\t\t///case WindowState.State.CODE:",
- "\t\t\t// search the code being edited..",
- "\t\t\tres = _this.windowstate.code_editor_tab.search(this.el.text);",
- "\t\t\t",
- "\t\t\tbreak;",
- "\t\tcase WindowState.State.PREVIEW:",
- "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
- "\t\t\t\t res = _this.windowstate.window_gladeview.search(this.el.text);",
- "\t\t\t} else { ",
- "\t\t\t\t res = _this.windowstate.window_rooview.search(this.el.text);\t\t\t",
- "\t\t\t}",
- "\t\t",
- "\t\t",
- "\t\t\tbreak;",
- "\t}",
- "\t_this.search_results.el.show();",
- "\tif (res > 0) {",
- "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
- "\t} else {",
- "\t\t_this.search_results.el.label = \"No Matches\";",
- "\t}",
- "\t\t",
- "\t*/",
- "\t",
- "}",
- ""
- ],
- "key_press_event" : [
- "(event) => {",
- " if (event.keyval == Gdk.Key.g && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
- "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
- "\t\t_this.forwardSearch(true);",
- "\t return true;",
- "\t}",
- " ",
- " ",
- " \tif (event.keyval == Gdk.Key.Return && this.el.text.length > 0) {",
- "\t\t//var res =",
- "\t\t _this.search(this.el.text);",
- "\t\t _this.search_results.updateResults();",
- "",
- "\t\tGLib.Timeout.add_seconds(2,() => {",
- "\t\t\t _this.search_results.updateResults();",
- "\t\t\t return false;",
- "\t\t });",
- "\t ",
- "\t\t",
- "\t return true;",
+ "search_changed" : [
+ "( ) => {",
"",
- "\t} ",
- " // print(event.key.keyval)",
- " ",
- " return false;",
+ "_this.search(_this.search_entry.el.text);",
+ "\t _this.search_results.updateResults();",
"",
- "} "
+ "\tGLib.Timeout.add_seconds(1,() => {",
+ "\t\t _this.search_results.updateResults();",
+ "\t\t return false;",
+ "\t });",
+ "}",
+ ""
]
},
+ "string name" : "editor-search-entry",
"string placeholder_text" : "Press enter to search",
+ "uint search_delay" : 3,
"xtype" : "SearchEntry",
"| void forwardSearch" : [
"(bool change_focus) {",
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "bool always_show_image" : true,
- "bool visible" : false,
- "id" : "search_results",
- "listeners" : {
- "button_press_event" : [
- "() => {",
- "/*",
- " if (this.popup == null) {",
- " this.popup = new Xcls_ValaCompileErrors();",
- " this.popup.window = _this;",
- " }",
- " ",
- " ",
- " this.popup.show(this.notices, this.el);",
- " */",
- " return true;",
- "}"
- ]
- },
- "xtype" : "MenuItem",
- "| void updateResults" : [
- "() {",
- "\tthis.el.visible = true;",
- "\t",
- "\tvar res = _this.searchcontext.get_occurrences_count();",
- "\tif (res < 0) {",
- "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
- "\t\treturn;",
- "\t}",
- "",
- "\t_this.nextBtn.el.sensitive = false;",
- "\t_this.backBtn.el.sensitive = false;\t",
- "",
- "\tif (res > 0) {",
- "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
- "\t\t_this.nextBtn.el.sensitive = true;",
- "\t\t_this.backBtn.el.sensitive = true;",
- "\t\treturn;",
- "\t} ",
- "\t_this.search_results.el.label = \"No Matches\";",
- "\t",
- "}"
- ]
- }
- ],
- "xtype" : "MenuBar"
+ "id" : "search_results",
+ "int margin_end" : 4,
+ "int margin_start" : 4,
+ "string label" : "No Results",
+ "xtype" : "Label",
+ "| void updateResults" : [
+ "() {",
+ "\tthis.el.visible = true;",
+ "\t",
+ "\tvar res = _this.searchcontext.get_occurrences_count();",
+ "\tif (res < 0) {",
+ "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
+ "\t\treturn;",
+ "\t}",
+ "",
+ "\t_this.nextBtn.el.sensitive = false;",
+ "\t_this.backBtn.el.sensitive = false;\t",
+ "",
+ "\tif (res > 0) {",
+ "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
+ "\t\t_this.nextBtn.el.sensitive = true;",
+ "\t\t_this.backBtn.el.sensitive = true;",
+ "\t\treturn;",
+ "\t} ",
+ "\t_this.search_results.el.label = \"No Matches\";",
+ "\t",
+ "}"
+ ]
},
{
"$ xns" : "Gtk",
"bool always_show_image" : true,
"bool sensitive" : false,
"id" : "nextBtn",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* prop" : "image",
- "string icon_name" : "go-down",
- "xtype" : "Image"
- }
- ],
"listeners" : {
- "button_press_event" : [
+ "clicked" : [
"(event) => {",
"",
"\t_this.forwardSearch(true);",
"\t",
- "\treturn true;",
+ "\t ",
"}",
""
]
},
- "string label" : "Next",
+ "string icon_name" : "go-down",
"xtype" : "Button"
},
{
"bool always_show_image" : true,
"bool sensitive" : false,
"id" : "backBtn",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* prop" : "image",
- "string icon_name" : "go-up",
- "xtype" : "Image"
- }
- ],
"listeners" : {
- "button_press_event" : [
+ "clicked" : [
"(event) => {",
"",
"\t_this.backSearch(true);",
- "\t",
- "\treturn true;",
+ "\t ",
"}",
""
]
},
- "string label" : "Previous",
+ "string icon_name" : "go-up",
"xtype" : "Button"
},
{
"$ xns" : "Gtk",
+ "bool always_show_arrow" : true,
"bool always_show_image" : true,
"items" : [
{
"$ xns" : "Gtk",
- "* prop" : "image",
- "string icon_name" : "emblem-system",
- "xtype" : "Image"
- },
- {
- "$ xns" : "Gtk",
- "* prop" : "popup",
+ "* prop" : "popover",
"id" : "search_settings",
"items" : [
{
"$ xns" : "Gtk",
- "* init" : [
- "{",
- "\tthis.el.show();",
- "}",
- ""
- ],
- "id" : "case_sensitive",
- "string label" : "Case Sensitive",
- "xtype" : "CheckMenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- "{",
- "\tthis.el.show();",
- "}",
- ""
- ],
- "id" : "regex",
- "string label" : "Regex",
- "xtype" : "CheckMenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- "{",
- "\tthis.el.show();",
- "}",
- ""
+ "* prop" : "child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "int spacing" : 0,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ "\tthis.el.show();",
+ "}",
+ ""
+ ],
+ "id" : "case_sensitive",
+ "string label" : "Case Sensitive",
+ "xtype" : "CheckButton"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ "\tthis.el.show();",
+ "}",
+ ""
+ ],
+ "id" : "regex",
+ "string label" : "Regex",
+ "xtype" : "CheckButton"
+ },
+ {
+ "$ xns" : "Gtk",
+ "id" : "multiline",
+ "string label" : "Multi-line (add \\n)",
+ "xtype" : "CheckButton"
+ }
],
- "id" : "multiline",
- "string label" : "Multi-line (add \\n)",
- "xtype" : "CheckMenuItem"
+ "xtype" : "Box"
}
],
- "xtype" : "Menu"
+ "xtype" : "Popover"
}
],
- "string label" : "Settings",
+ "string icon_name" : "emblem-system",
"xtype" : "MenuButton"
}
],
" if (_this.file.xtype != \"PlainFile\") {",
" // in theory these properties have to exist!?!",
" \tthis.prop.val = str;",
- " this.window.windowstate.left_props.reload();",
+ " //this.window.windowstate.left_props.reload();",
" } else {",
" _this.file.setSource( str );",
" }",
"| int search" : [
"(string in_txt) {",
"",
- "\tvar s = new Gtk.SourceSearchSettings();",
+ "\tvar s = new GtkSource.SearchSettings();",
"\ts.case_sensitive = _this.case_sensitive.el.active;",
"\ts.regex_enabled = _this.regex.el.active;\t",
"\ts.wrap_around = false;",
"\t",
- "\tthis.searchcontext = new Gtk.SourceSearchContext(this.buffer.el,s);",
+ "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
"\tthis.searchcontext.set_highlight(true);",
"\tvar txt = in_txt;",
"\t",
"\t ",
"\tthis.buffer.el.get_start_iter(out beg);",
"\tbool has_wrapped_around;",
- "\tthis.searchcontext.forward2(beg, out st, out en, out has_wrapped_around);",
+ "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
"\tthis.last_search_end = 0;",
"\t",
"\treturn this.searchcontext.get_occurrences_count();",
"\tbool has_wrapped_around;",
"\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
"\t",
- "\tif (!this.searchcontext.backward2(beg, out st, out en, out has_wrapped_around)) {",
- "\t",
+ "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
"\t\tthis.last_search_end = 0;",
"\t} else {",
"\t\tthis.last_search_end = en.get_offset();",
"\t\tthis.buffer.el.place_cursor(st);",
"\t\tthis.view.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
"\t}",
- " ",
+ "",
"}",
""
],
"\tGtk.TextIter beg, st,en;",
"\t bool has_wrapped_around;",
"\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end);",
- "\tif (!this.searchcontext.forward2(beg, out st, out en, out has_wrapped_around)) {",
+ "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
"\t",
"\t\tthis.last_search_end = 0; // not sure if this should happen",
"\t} else {",
" ",
"\t\tvar buf = this.view.el.get_buffer();",
"",
- "\t\tvar sbuf = (Gtk.SourceBuffer) buf;",
+ "\t\tvar sbuf = (GtkSource.Buffer) buf;",
"",
"",
"\t\tGtk.TextIter iter; ",
"",
" // find the text for the node..",
" this.view.load( prop.val );",
+ " ",
+ " ",
" this.close_btn.el.show(); ",
" ",
" } else {",
" }",
" ",
"}"
+ ],
+ "| void updateErrorMarks" : [
+ "(GLib.ListStore? ar) {",
+ "\t",
+ " ",
+ "\t",
+ "\t var buf = _this.buffer.el;",
+ "\tGtk.TextIter start;",
+ "\tGtk.TextIter end; ",
+ "\tbuf.get_bounds (out start, out end);",
+ "",
+ "\tbuf.remove_source_marks (start, end, \"ERR\");",
+ "\tbuf.remove_source_marks (start, end, \"WARN\");",
+ "\tbuf.remove_source_marks (start, end, \"DEPR\");",
+ "\tGLib.debug(\"highlight errors\");\t\t ",
+ "",
+ "\t // we should highlight other types of errors..",
+ "",
+ "\tif (ar == null || ar.get_n_items() < 1) {",
+ "\t\tGLib.debug(\"Return has no errors\\n\");",
+ "\t\treturn;",
+ "\t}",
+ "",
+ "\tif (_this.window.windowstate.state != WindowState.State.CODEONLY ",
+ "\t\t&&",
+ "\t\t_this.window.windowstate.state != WindowState.State.CODE",
+ "\t\t) {",
+ "\t\tGLib.debug(\"windowstate != CODEONLY?\");",
+ "\t\t",
+ "\t\treturn;",
+ "\t} ",
+ "",
+ "\t ",
+ "\tif (_this.file == null) {",
+ "\t\tGLib.debug(\"file is null?\");",
+ "\t\treturn;",
+ "",
+ "\t}",
+ " ",
+ "",
+ " ",
+ "\t",
+ "\tvar offset = 1;",
+ "\t ",
+ "",
+ "\tvar tlines = buf.get_line_count () +1;",
+ "\t",
+ "\tif (_this.prop != null) {",
+ "\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\tvar err = (Palete.CompileError) ar.get_item(i);",
+ "\t\t",
+ "\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 ",
+ "\t ",
+ "\t if (eline > tlines || eline < 0) {",
+ "\t return;",
+ "\t }",
+ "\t ",
+ "\t ",
+ "\t buf.get_iter_at_line( out iter, eline);",
+ "\t ",
+ "\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 %m\", eline, msg);",
+ "\t // this.marks.set(eline, msg);",
+ "\t}",
+ "\treturn ;",
+ "",
+ "",
+ "",
+ " ",
+ "",
+ "}"
]
}
],
- "modOrder" : "",
- "name" : "Editor",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/Editor.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "Editor"
}
\ No newline at end of file
-static Editor _Editor;
+ static Editor _Editor;
-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 Xcls_MainWindow window;
- public int pos_root_x;
- public bool dirty;
- public int pos_root_y;
- public bool pos;
- public Gtk.SourceSearchContext searchcontext;
- public int last_search_end;
- public JsRender.NodeProp? prop;
- public JsRender.JsRender? file;
- public JsRender.Node node;
- public signal void save ();
- 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.prop = null;
- this.file = null;
- this.node = null;
- this.activeEditor = "";
-
- // set gobject values
- this.el.homogeneous = false;
- this.el.hexpand = true;
- this.el.vexpand = true;
- var child_0 = new Xcls_Box2( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,true );
- var child_1 = new Xcls_RightEditor( _this );
- child_1.ref();
- this.el.add( child_1.el );
- var child_2 = new Xcls_Box12( _this );
- child_2.ref();
- this.el.add( child_2.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.forward2(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.backward2(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 int search (string in_txt) {
-
- var s = new Gtk.SourceSearchSettings();
- s.case_sensitive = _this.case_sensitive.el.active;
- s.regex_enabled = _this.regex.el.active;
- s.wrap_around = false;
-
- this.searchcontext = new Gtk.SourceSearchContext(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.forward2(beg, out st, out en, out has_wrapped_around);
- this.last_search_end = 0;
-
- return this.searchcontext.get_occurrences_count();
-
-
-
-
- }
- public void reset () {
- this.file = null;
-
- this.node = null;
- this.prop = null;
- this.searchcontext = null;
-
- }
- public void scroll_to_line (int line) {
-
- GLib.Timeout.add(500, () => {
-
- var buf = this.view.el.get_buffer();
-
- var sbuf = (Gtk.SourceBuffer) 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 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 Xcls_Box2(Editor _owner )
+ public Editor()
{
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+ _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;
- var child_0 = new Xcls_save_button( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_Label5( _this );
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ var child_1 = new Xcls_Box2( _this );
child_1.ref();
- this.el.add ( child_1.el );
- var child_2 = new Xcls_Scale6( _this );
- child_2.ref();
- this.el.add ( child_2.el );
- var child_3 = new Xcls_close_btn( _this );
+ 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.add ( child_3.el );
+ this.el.append ( child_3.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 )
+ 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 = _owner;
- _this.save_button = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.always_show_image = true;
- this.el.label = "Save";
- var child_0 = new Xcls_Image4( _this );
- child_0.ref();
- this.el.image = child_0.el;
-
- //listeners
- this.el.clicked.connect( () => {
- _this.saveContents();
- });
+ 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 (GLib.ListStore? ar) {
+
+
+
+ var buf = _this.buffer.el;
+ Gtk.TextIter start;
+ Gtk.TextIter end;
+ buf.get_bounds (out start, out end);
+
+ buf.remove_source_marks (start, end, "ERR");
+ buf.remove_source_marks (start, end, "WARN");
+ buf.remove_source_marks (start, end, "DEPR");
+ GLib.debug("highlight errors");
+
+ // we should highlight other types of errors..
+
+ if (ar == null || ar.get_n_items() < 1) {
+ GLib.debug("Return has no errors\n");
+ return;
+ }
+
+ 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 offset = 1;
+
+
+ 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 %m", 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;
- // user defined functions
- }
- public class Xcls_Image4 : Object
- {
- public Gtk.Image el;
- private Editor _this;
+ // my vars (def)
- // 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 );
+ }
- // ctor
- public Xcls_Image4(Editor _owner )
+ // user defined functions
+ }
+ public class Xcls_save_button : Object
{
- _this = _owner;
- this.el = new Gtk.Image();
+ public Gtk.Button el;
+ private Editor _this;
- // my vars (dec)
- // set gobject values
- this.el.icon_name = "document-save";
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_save_button(Editor _owner )
+ {
+ _this = _owner;
+ _this.save_button = this;
+ this.el = new Gtk.Button();
+ // my vars (dec)
- public class Xcls_Label5 : Object
- {
- public Gtk.Label el;
- private Editor _this;
+ // set gobject values
+ this.el.label = "Save";
+ //listeners
+ this.el.clicked.connect( () => {
+ _this.saveContents();
+ });
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_Label5(Editor _owner )
+ public class Xcls_Label4 : Object
{
- _this = _owner;
- this.el = new Gtk.Label( null );
+ public Gtk.Label el;
+ private Editor _this;
- // my vars (dec)
- // set gobject values
- this.el.hexpand = true;
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_Label4(Editor _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( null );
- public class Xcls_Scale6 : Object
- {
- public Gtk.Scale el;
- private Editor _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.hexpand = true;
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_Scale6(Editor _owner )
+ public class Xcls_Scale5 : Object
{
- _this = _owner;
- this.el = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1);
-
- // my vars (dec)
+ public Gtk.Scale el;
+ private Editor _this;
- // set gobject values
- this.el.width_request = 200;
- this.el.has_origin = true;
- this.el.draw_value = true;
- this.el.digits = 0;
- this.el.sensitive = true;
- // init method
+ // my vars (def)
+ // ctor
+ public Xcls_Scale5(Editor _owner )
{
- this.el.set_range(6,30);
- this.el.set_value(8);
- }
+ _this = _owner;
+ this.el = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1);
- //listeners
- this.el.change_value.connect( (st, val ) => {
-
- try {
- _this.view.css.load_from_data(
- "#editor-view { font: %dpx Monospace; }".printf((int)val)
- );
- } catch (Error e) {}
- return false;
- });
- }
+ // my vars (dec)
- // user defined functions
- }
+ // 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;
- public class Xcls_close_btn : Object
- {
- public Gtk.Button el;
- private Editor _this;
+ // init method
+ {
+ this.el.set_range(6,30);
+ this.el.set_value(8);
+ }
- // my vars (def)
+ //listeners
+ this.el.change_value.connect( (st, val ) => {
+
+
+ _this.view.css.load_from_string(
+ "#editor-view { font: %dpx monospace; }".printf((int)val)
+ );
+
+ return false;
+ });
+ }
- // ctor
- public Xcls_close_btn(Editor _owner )
+ // user defined functions
+ }
+
+ public class Xcls_close_btn : Object
{
- _this = _owner;
- _this.close_btn = this;
- this.el = new Gtk.Button();
+ public Gtk.Button el;
+ private Editor _this;
- // my vars (dec)
- // set gobject values
- this.el.always_show_image = true;
- var child_0 = new Xcls_Image8( _this );
- child_0.ref();
- this.el.image = child_0.el;
-
- //listeners
- this.el.clicked.connect( () => {
- _this.saveContents();
- _this.window.windowstate.switchState(WindowState.State.PREVIEW);
- });
- }
+ // my vars (def)
- // user defined functions
- }
- public class Xcls_Image8 : Object
- {
- public Gtk.Image el;
- private Editor _this;
+ // ctor
+ public Xcls_close_btn(Editor _owner )
+ {
+ _this = _owner;
+ _this.close_btn = this;
+ this.el = new Gtk.Button();
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ this.el.icon_name = "window-close";
+ var child_1 = new Xcls_Image7( _this );
+ this.el.child = child_1.el;
- // ctor
- public Xcls_Image8(Editor _owner )
+ //listeners
+ this.el.clicked.connect( () => {
+ _this.saveContents();
+ _this.window.windowstate.switchState(WindowState.State.PREVIEW);
+ });
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Image7 : Object
{
- _this = _owner;
- this.el = new Gtk.Image();
+ public Gtk.Image el;
+ private Editor _this;
- // my vars (dec)
- // set gobject values
- this.el.icon_name = "window-close";
- }
+ // my vars (def)
- // user defined functions
- }
+ // 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;
+ }
- public class Xcls_RightEditor : Object
- {
- public Gtk.ScrolledWindow el;
- private Editor _this;
+ // user defined functions
+ }
- // my vars (def)
- // ctor
- public Xcls_RightEditor(Editor _owner )
+ public class Xcls_RightEditor : Object
{
- _this = _owner;
- _this.RightEditor = this;
- this.el = new Gtk.ScrolledWindow( null, null );
+ public Gtk.ScrolledWindow el;
+ private Editor _this;
- // my vars (dec)
- // set gobject values
- this.el.vexpand = true;
- var child_0 = new Xcls_view( _this );
- child_0.ref();
- this.el.add ( child_0.el );
+ // my vars (def)
- // init method
+ // 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;
+ }
- this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+ // user defined functions
}
-
- // user defined functions
- }
- public class Xcls_view : Object
- {
- public Gtk.SourceView el;
- private Editor _this;
-
-
- // my vars (def)
- public Gtk.CssProvider css;
-
- // ctor
- public Xcls_view(Editor _owner )
+ public class Xcls_view : Object
{
- _this = _owner;
- _this.view = this;
- this.el = new Gtk.SourceView();
+ public GtkSource.View el;
+ private Editor _this;
- // 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.tab_width = 4;
- this.el.highlight_current_line = true;
- var child_0 = new Xcls_buffer( _this );
- child_0.ref();
- this.el.set_buffer ( child_0.el );
-
- // init method
-
- this.css = new Gtk.CssProvider();
- try {
- this.css.load_from_data("#editor-view { font: 10px Monospace;}");
- } catch (Error e) {}
- this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
-
-
- try {
- this.el.completion.add_provider(new Palete.CompletionProvider(_this));
- } catch (GLib.Error e) {}
+ // 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.el.completion.add_provider(new Palete.CompletionProvider(_this));
+
- this.el.completion.unblock_interactive();
- this.el.completion.select_on_show = true; // select
- this.el.completion.show_headers = false;
- this.el.completion.remember_info_visibility = true;
+ this.el.completion.unblock_interactive();
+ this.el.completion.select_on_show = true; // select
-
- var attrs = new Gtk.SourceMarkAttributes();
+ 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) => {
- //print("tooltip query? %s\n", mark.name);
- return mark.name;
+ 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);
-
- var wattrs = new Gtk.SourceMarkAttributes();
+ 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) => {
- //print("tooltip query? %s\n", mark.name);
- return mark.name;
+ 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 Gtk.SourceMarkAttributes();
+ 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;
+ 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(
- Gtk.SourceSpaceLocationFlags.ALL,
- Gtk.SourceSpaceTypeFlags.ALL
+ 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
+ Gtk.SourceDrawSpacesFlags.TRAILING +
+ Gtk.SourceDrawSpacesFlags.TAB +
+ Gtk.SourceDrawSpacesFlags.SPACE
*/
- //listeners
- this.el.key_release_event.connect( (event) => {
-
- if (event.keyval == Gdk.Key.s && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-S pressed");
- _this.saveContents();
- return false;
- }
-
- if (event.keyval == Gdk.Key.g && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-g pressed");
- _this.forwardSearch(true);
- return true;
- }
- if (event.keyval == Gdk.Key.f && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-f pressed");
- _this.search_entry.el.grab_focus();
- return 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();
- // print(event.key.keyval)
+
+
+ // GLib.debug("query tooltip line %d", (int) l);
+ if (l < 0) {
- return false;
-
- });
- }
+ 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);
- var buf = (Gtk.SourceBuffer)this.el.get_buffer();
- buf.set_text(str, str.length);
- buf.set_undo_manager(null);
+ // user defined functions
+ public void load (string str) {
- var lm = Gtk.SourceLanguageManager.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);
+ // show the help page for the active node..
+ //this.get('/Help').show();
-
- ((Gtk.SourceBuffer)(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;
+ // 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 Gtk.SourceBuffer el;
- private Editor _this;
-
-
- // my vars (def)
- public int error_line;
- public bool check_queued;
- public bool check_running;
-
- // ctor
- public Xcls_buffer(Editor _owner )
+ public class Xcls_buffer : Object
{
- _this = _owner;
- _this.buffer = this;
- this.el = new Gtk.SourceBuffer( null );
+ public GtkSource.Buffer el;
+ private Editor _this;
- // my vars (dec)
- this.error_line = -1;
- this.check_queued = false;
- this.check_running = false;
- // set gobject values
+ // my vars (def)
+ public int error_line;
+ public Gee.HashMap<int,string>? xmarks;
+ public bool check_queued;
- //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 ;
- });
- }
+ // 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 () {
-
- if (this.check_running) {
- print("Check is running\n");
- if (this.check_queued) {
- print("Check is already queued");
+ // 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;
}
- this.check_queued = true;
- print("Adding queued Check ");
- GLib.Timeout.add_seconds(1, () => {
- this.check_queued = false;
-
- this.checkSyntax();
- return false;
- });
+
+ // bit presumptiona
+ if (_this.file.xtype == "PlainFile" && _this.file.project.xtype == "Gtk") {
+
+ // assume it's gtk...
+
+ BuilderApplication.valacompilequeue.addFile(
+ Palete.ValaCompileRequestType.FILE_CHANGE,
+ _this.file , str, false) ;
+
-
- return true;
- }
- var str = this.toString();
+ return true;
+
+ }
+ if (_this.file == null) {
+ return true;
+ }
+
+
- // 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;
+
+
+ GLib.debug("calling validate");
+ // clear the buttons.
+
+ BuilderApplication.valacompilequeue.addProp(
+ Palete.ValaCompileRequestType.PROP_CHANGE,
+ _this.file,
+ _this.node,
+ _this.prop,
+ str);
+
+
+
+ //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);
- if (_this.file.xtype == "PlainFile") {
+ this.el.remove_source_marks (start, end, type);
+ GLib.debug("highlight errors");
- // assume it's gtk...
- this.check_running = true;
-
- if (!BuilderApplication.valasource.checkPlainFileSpawn(
- _this.file,
- str
- )) {
- this.check_running = false;
- }
-
- return true;
+ // we should highlight other types of errors..
- }
- if (_this.file == null) {
- return true;
- }
- var p = _this.file.project.palete;
+ 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);
- this.check_running = true;
+ if (_this.file == null) {
+ GLib.debug("file is null?");
+ return true;
+ }
+ var valafn = _this.file.path;
- if (_this.file.language == "js") {
- this.check_running = false;
- print("calling validate javascript\n");
- Gee.HashMap<int,string> errors;
- p.javascriptHasErrors(
- _this.window.windowstate,
- str,
- _this.prop,
- _this.file, // no reference not node?
- out errors
- );
- return this.highlightErrors(errors);
-
- }
-
-
- print("calling validate vala\n");
- // clear the buttons.
-
+ if (_this.file.xtype != "PlainFile") {
- if (! BuilderApplication.valasource.checkFileWithNodePropChange(
- _this.file,
- _this.node,
- _this.prop,
- str
- )) {
- this.check_running = false;
- }
-
+ 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;
+ }
- //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);
-
-
- // we should highlight other types of errors..
- if (!obj.has_member(type)) {
- print("Return has no errors\n");
- return true;
- }
+ }
+ if (!err.has_member(valafn)) {
+ GLib.debug("File path has no errors");
+ return true;
+ }
- if (_this.window.windowstate.state != WindowState.State.CODEONLY
-
- ) {
- 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 err = obj.get_object_member(type);
+ var tlines = this.el.get_line_count () +1;
+
+ if (_this.prop != null) {
+
+ tlines = _this.prop.end_line + 1;
+ offset = _this.prop.start_line + 1;
+
+ }
+
- if (_this.file == null) {
- return true;
+ 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;
+
- }
- 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)) {
- print("File path has no errors\n");
- return true;
- }
-
- var lines = err.get_object_member(valafn);
-
- var offset = 1;
- if (obj.has_member("line_offset")) {
- offset = (int)obj.get_int_member("line_offset") + 1;
- }
-
-
- var tlines = this.el.get_line_count () +1;
- lines.foreach_member((obj, line, node) => {
+ }
+ 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 iter;
- // print("get inter\n");
- var eline = int.parse(line) - offset;
- print("GOT ERROR on line %s -- converted to %d\n", line,eline);
-
-
- if (eline > tlines || eline < 0) {
+ 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;
}
- this.el.get_iter_at_line( out iter, eline);
- //print("mark line\n");
- var msg = "Line: %d".printf(eline+1);
- var ar = lines.get_array_member(line);
- for (var i = 0 ; i < ar.get_length(); i++) {
- msg += (msg.length > 0) ? "\n" : "";
- msg += ar.get_string_element(i);
- }
+ 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.el.create_source_mark(msg, type, iter);
- } );
- return false;
-
-
-
-
-
- }
- public bool highlightErrors ( Gee.HashMap<int,string> validate_res) {
+ // print(event.key.keyval)
+
+ return;
- 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_Box12 : Object
- {
- public Gtk.Box el;
- private Editor _this;
+ // user defined functions
+ }
- // my vars (def)
- // ctor
- public Xcls_Box12(Editor _owner )
+ public class Xcls_Box12 : Object
{
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
+ public Gtk.Box el;
+ private Editor _this;
- // set gobject values
- this.el.homogeneous = false;
- this.el.vexpand = false;
- var child_0 = new Xcls_search_entry( _this );
- child_0.ref();
- this.el.add( child_0.el );
- var child_1 = new Xcls_MenuBar14( _this );
- child_1.ref();
- this.el.add ( child_1.el );
- var child_2 = new Xcls_nextBtn( _this );
- child_2.ref();
- this.el.add( child_2.el );
- var child_3 = new Xcls_backBtn( _this );
- child_3.ref();
- this.el.add( child_3.el );
- var child_4 = new Xcls_MenuButton20( _this );
- child_4.ref();
- this.el.add( child_4.el );
- }
-
- // user defined functions
- }
- public class Xcls_search_entry : Object
- {
- public Gtk.SearchEntry el;
- private Editor _this;
+ // my vars (def)
- // 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 );
+ }
- // ctor
- public Xcls_search_entry(Editor _owner )
+ // user defined functions
+ }
+ public class Xcls_search_entry : Object
{
- _this = _owner;
- _this.search_entry = this;
- this.el = new Gtk.SearchEntry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.width_request = 300;
- this.el.hexpand = true;
- this.el.placeholder_text = "Press enter to search";
+ public Gtk.SearchEntry el;
+ private Editor _this;
- // init method
- var description = Pango.FontDescription.from_string("monospace");
- description.set_size(8000);
- this.el.set_property("font-desc",description);
+ // my vars (def)
+ public Gtk.CssProvider css;
- //listeners
- this.el.key_press_event.connect( (event) => {
- if (event.keyval == Gdk.Key.g && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-g pressed");
- _this.forwardSearch(true);
- return true;
- }
+ // 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( ( ) => {
-
- if (event.keyval == Gdk.Key.Return && this.el.text.length > 0) {
- //var res =
- _this.search(this.el.text);
- _this.search_results.updateResults();
+ _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) {
- GLib.Timeout.add_seconds(2,() => {
- _this.search_results.updateResults();
- return false;
- });
-
-
- return true;
- }
- // print(event.key.keyval)
-
- return false;
+ _this.forwardSearch(change_focus);
+
+ /*
- });
- this.el.changed.connect( () => {
- /*
- if (this.el.text == "") {
- _this.search_results.el.hide();
- return;
- }
- var res = 0;
switch(_this.windowstate.state) {
case WindowState.State.CODEONLY:
- ///case WindowState.State.CODE:
+ //case WindowState.State.CODE:
// search the code being edited..
- res = _this.windowstate.code_editor_tab.search(this.el.text);
-
+ _this.windowstate.code_editor_tab.forwardSearch(change_focus);
+
break;
case WindowState.State.PREVIEW:
if (_this.windowstate.file.xtype == "Gtk") {
- res = _this.windowstate.window_gladeview.search(this.el.text);
+ _this.windowstate.window_gladeview.forwardSearch(change_focus);
} else {
- res = _this.windowstate.window_rooview.search(this.el.text);
+ _this.windowstate.window_rooview.forwardSearch(change_focus);
}
-
break;
}
- _this.search_results.el.show();
- if (res > 0) {
- _this.search_results.el.label = "%d Matches".printf(res);
- } else {
- _this.search_results.el.label = "No Matches";
- }
-
*/
- });
- }
-
- // 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_MenuBar14 : Object
- {
- public Gtk.MenuBar el;
- private Editor _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_MenuBar14(Editor _owner )
+ public class Xcls_EventControllerKey14 : Object
{
- _this = _owner;
- this.el = new Gtk.MenuBar();
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_search_results( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- }
+ public Gtk.EventControllerKey el;
+ private Editor _this;
- // user defined functions
- }
- public class Xcls_search_results : Object
- {
- public Gtk.MenuItem el;
- private Editor _this;
+ // my vars (def)
- // my vars (def)
- public bool always_show_image;
-
- // ctor
- public Xcls_search_results(Editor _owner )
- {
- _this = _owner;
- _this.search_results = this;
- this.el = new Gtk.MenuItem();
+ // ctor
+ public Xcls_EventControllerKey14(Editor _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.EventControllerKey();
- // my vars (dec)
- this.always_show_image = true;
+ // my vars (dec)
- // set gobject values
- this.el.visible = false;
- this.el.show();
+ // set gobject values
- //listeners
- this.el.button_press_event.connect( () => {
- /*
- if (this.popup == null) {
- this.popup = new Xcls_ValaCompileErrors();
- this.popup.window = _this;
- }
-
+ //listeners
+ this.el.key_pressed.connect( (keyval, keycode, state) => {
- this.popup.show(this.notices, this.el);
- */
- return true;
- });
- }
+ 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 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";
-
+ // user defined functions
}
- }
- public class Xcls_nextBtn : Object
- {
- public Gtk.Button el;
- private Editor _this;
+ public class Xcls_search_results : Object
+ {
+ public Gtk.Label el;
+ private Editor _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_nextBtn(Editor _owner )
- {
- _this = _owner;
- _this.nextBtn = this;
- this.el = new Gtk.Button();
+ // ctor
+ public Xcls_search_results(Editor _owner )
+ {
+ _this = _owner;
+ _this.search_results = this;
+ this.el = new Gtk.Label( "No Results" );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.always_show_image = true;
- this.el.label = "Next";
- this.el.sensitive = false;
- var child_0 = new Xcls_Image17( _this );
- child_0.ref();
- this.el.image = child_0.el;
-
- //listeners
- this.el.button_press_event.connect( (event) => {
+ // 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.forwardSearch(true);
+ _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";
- return true;
- });
+ }
}
- // user defined functions
- }
- public class Xcls_Image17 : Object
- {
- public Gtk.Image el;
- private Editor _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image17(Editor _owner )
+ public class Xcls_nextBtn : Object
{
- _this = _owner;
- this.el = new Gtk.Image();
-
- // my vars (dec)
-
- // set gobject values
- this.el.icon_name = "go-down";
- }
-
- // user defined functions
- }
+ public Gtk.Button el;
+ private Editor _this;
- public class Xcls_backBtn : 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 (def)
+ // my vars (dec)
+ this.always_show_image = true;
- // ctor
- public Xcls_backBtn(Editor _owner )
- {
- _this = _owner;
- _this.backBtn = this;
- this.el = new Gtk.Button();
+ // set gobject values
+ this.el.icon_name = "go-down";
+ this.el.sensitive = false;
- // my vars (dec)
+ //listeners
+ this.el.clicked.connect( (event) => {
+
+ _this.forwardSearch(true);
+
+
+ });
+ }
- // set gobject values
- this.el.always_show_image = true;
- this.el.label = "Previous";
- this.el.sensitive = false;
- var child_0 = new Xcls_Image19( _this );
- child_0.ref();
- this.el.image = child_0.el;
-
- //listeners
- this.el.button_press_event.connect( (event) => {
-
- _this.backSearch(true);
-
- return true;
- });
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_Image19 : Object
- {
- public Gtk.Image el;
- private Editor _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image19(Editor _owner )
+ public class Xcls_backBtn : Object
{
- _this = _owner;
- this.el = new Gtk.Image();
+ public Gtk.Button el;
+ private Editor _this;
- // my vars (dec)
- // set gobject values
- this.el.icon_name = "go-up";
- }
+ // my vars (def)
+ public bool always_show_image;
- // user defined functions
- }
+ // ctor
+ public Xcls_backBtn(Editor _owner )
+ {
+ _this = _owner;
+ _this.backBtn = this;
+ this.el = new Gtk.Button();
+ // my vars (dec)
+ this.always_show_image = true;
- public class Xcls_MenuButton20 : Object
- {
- public Gtk.MenuButton el;
- private Editor _this;
+ // set gobject values
+ this.el.icon_name = "go-up";
+ this.el.sensitive = false;
+ //listeners
+ this.el.clicked.connect( (event) => {
+
+ _this.backSearch(true);
+
+ });
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_MenuButton20(Editor _owner )
+ public class Xcls_MenuButton18 : Object
{
- _this = _owner;
- this.el = new Gtk.MenuButton();
+ public Gtk.MenuButton el;
+ private Editor _this;
- // my vars (dec)
-
- // set gobject values
- this.el.always_show_image = true;
- this.el.label = "Settings";
- var child_0 = new Xcls_Image21( _this );
- child_0.ref();
- this.el.image = child_0.el;
- var child_1 = new Xcls_search_settings( _this );
- child_1.ref();
- this.el.popup = child_1.el;
- }
-
- // user defined functions
- }
- public class Xcls_Image21 : Object
- {
- public Gtk.Image el;
- private Editor _this;
+ // my vars (def)
+ public bool always_show_image;
- // my vars (def)
+ // ctor
+ public Xcls_MenuButton18(Editor _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.MenuButton();
- // ctor
- public Xcls_Image21(Editor _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
+ // my vars (dec)
+ this.always_show_image = true;
- // my vars (dec)
+ // 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;
+ }
- // set gobject values
- this.el.icon_name = "emblem-system";
+ // user defined functions
}
+ public class Xcls_search_settings : Object
+ {
+ public Gtk.Popover el;
+ private Editor _this;
- // user defined functions
- }
-
- public class Xcls_search_settings : Object
- {
- public Gtk.Menu el;
- private Editor _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_search_settings(Editor _owner )
+ {
+ _this = _owner;
+ _this.search_settings = this;
+ this.el = new Gtk.Popover();
- // ctor
- public Xcls_search_settings(Editor _owner )
- {
- _this = _owner;
- _this.search_settings = this;
- this.el = new Gtk.Menu();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ var child_1 = new Xcls_Box20( _this );
+ this.el.child = child_1.el;
+ }
- // set gobject values
- var child_0 = new Xcls_case_sensitive( _this );
- child_0.ref();
- this.el.append( child_0.el );
- var child_1 = new Xcls_regex( _this );
- child_1.ref();
- this.el.append( child_1.el );
- var child_2 = new Xcls_multiline( _this );
- child_2.ref();
- this.el.append( child_2.el );
+ // user defined functions
}
+ public class Xcls_Box20 : Object
+ {
+ public Gtk.Box el;
+ private Editor _this;
- // user defined functions
- }
- public class Xcls_case_sensitive : Object
- {
- public Gtk.CheckMenuItem el;
- private Editor _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Box20(Editor _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // 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 );
+ }
- // ctor
- public Xcls_case_sensitive(Editor _owner )
+ // user defined functions
+ }
+ public class Xcls_case_sensitive : Object
{
- _this = _owner;
- _this.case_sensitive = this;
- this.el = new Gtk.CheckMenuItem();
-
- // my vars (dec)
+ public Gtk.CheckButton el;
+ private Editor _this;
- // set gobject values
- this.el.label = "Case Sensitive";
- this.el.show();
- // init method
+ // my vars (def)
+ // ctor
+ public Xcls_case_sensitive(Editor _owner )
{
- this.el.show();
- }
- }
+ _this = _owner;
+ _this.case_sensitive = this;
+ this.el = new Gtk.CheckButton();
- // user defined functions
- }
+ // my vars (dec)
- public class Xcls_regex : Object
- {
- public Gtk.CheckMenuItem el;
- private Editor _this;
+ // set gobject values
+ this.el.label = "Case Sensitive";
+ // init method
- // my vars (def)
+ {
+ this.el.show();
+ }
+ }
- // ctor
- public Xcls_regex(Editor _owner )
- {
- _this = _owner;
- _this.regex = this;
- this.el = new Gtk.CheckMenuItem();
+ // user defined functions
+ }
- // my vars (dec)
+ public class Xcls_regex : Object
+ {
+ public Gtk.CheckButton el;
+ private Editor _this;
- // set gobject values
- this.el.label = "Regex";
- this.el.show();
- // init method
+ // my vars (def)
+ // ctor
+ public Xcls_regex(Editor _owner )
{
- this.el.show();
- }
- }
+ _this = _owner;
+ _this.regex = this;
+ this.el = new Gtk.CheckButton();
- // user defined functions
- }
+ // my vars (dec)
- public class Xcls_multiline : Object
- {
- public Gtk.CheckMenuItem el;
- private Editor _this;
+ // set gobject values
+ this.el.label = "Regex";
+ // init method
- // my vars (def)
+ {
+ this.el.show();
+ }
+ }
- // ctor
- public Xcls_multiline(Editor _owner )
- {
- _this = _owner;
- _this.multiline = this;
- this.el = new Gtk.CheckMenuItem();
+ // user defined functions
+ }
- // my vars (dec)
+ public class Xcls_multiline : Object
+ {
+ public Gtk.CheckButton el;
+ private Editor _this;
- // set gobject values
- this.el.label = "Multi-line (add \\n)";
- this.el.show();
- // init method
+ // my vars (def)
+ // ctor
+ public Xcls_multiline(Editor _owner )
{
- this.el.show();
+ _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
- }
-}
+ }
+++ /dev/null
-{
- "build_module" : "",
- "items" : [
- {
- "$ xns" : "Gtk",
- "items" : [
- {
- "$ Gtk.Align halign" : "Gtk.Align.CENTER",
- "$ xns" : "Gtk",
- "* prop" : "buttons[]",
- "items" : [
- {
- "$ Gtk.Align halign" : "Gtk.Align.CENTER",
- "$ xns" : "Gtk",
- "* prop" : "image",
- "bool has_default" : true,
- "int icon_size" : 33,
- "string icon_name" : "\"\"",
- "xtype" : "Image"
- }
- ],
- "string label" : "Label",
- "xtype" : "Button"
- },
- {
- "$ xns" : "Gtk",
- "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "int spacing" : 0,
- "items" : [
- {
- "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "$ xns" : "Gtk",
- "items" : [
- {
- "$ xns" : "Gtk",
- "string label" : "xxxcc",
- "xtype" : "Button"
- },
- {
- "$ xns" : "Gtk",
- "xtype" : "MenuButton"
- },
- {
- "$ xns" : "Gtk",
- "string label" : "xxxcc",
- "xtype" : "Button"
- },
- {
- "$ xns" : "Gtk",
- "string label" : "xxxcc",
- "xtype" : "Button"
- }
- ],
- "xtype" : "ButtonBox"
- },
- {
- "$ xns" : "Gtk",
- "* prop" : "_menu",
- "xtype" : "Menu"
- },
- {
- "$ xns" : "Gtk",
- "bool has_entry" : false,
- "xtype" : "ComboBox"
- },
- {
- "$ xns" : "Gtk",
- "xtype" : "GLArea"
- }
- ],
- "xtype" : "Box"
- }
- ],
- "xtype" : "Dialog"
- }
- ],
- "modOrder" : "",
- "name" : "GladeView",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/GladeView.bjs",
- "permname" : "",
- "title" : ""
-}
\ No newline at end of file
+++ /dev/null
-static GladeView _GladeView;
-
-public class GladeView : Object
-{
- public Gtk.Dialog el;
- private GladeView _this;
-
- public static GladeView singleton()
- {
- if (_GladeView == null) {
- _GladeView= new GladeView();
- }
- return _GladeView;
- }
-
- // my vars (def)
-
- // ctor
- public GladeView()
- {
- _this = this;
- this.el = new Gtk.Dialog();
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_Button2( _this );
- this.el.add_action_widget( child_0.el, 0);
- var child_1 = new Xcls_Box4( _this );
- child_1.ref();
- this.el.get_content_area().add( child_1.el );
- }
-
- // user defined functions
- public class Xcls_Button2 : Object
- {
- public Gtk.Button el;
- private GladeView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button2(GladeView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.halign = Gtk.Align.CENTER;
- this.el.label = "Label";
- var child_0 = new Xcls_Image3( _this );
- child_0.ref();
- this.el.image = child_0.el;
- }
-
- // user defined functions
- }
- public class Xcls_Image3 : Object
- {
- public Gtk.Image el;
- private GladeView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image3(GladeView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
-
- // my vars (dec)
-
- // set gobject values
- this.el.has_default = true;
- this.el.icon_name = "\"\"";
- this.el.halign = Gtk.Align.CENTER;
- this.el.icon_size = 33;
- }
-
- // user defined functions
- }
-
-
- public class Xcls_Box4 : Object
- {
- public Gtk.Box el;
- private GladeView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box4(GladeView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_ButtonBox5( _this );
- child_0.ref();
- this.el.add( child_0.el );
- var child_1 = new Xcls_Menu10( _this );
- child_1.ref();
- this.el._menu = child_1.el;
- var child_2 = new Xcls_ComboBox11( _this );
- child_2.ref();
- this.el.add( child_2.el );
- var child_3 = new Xcls_GLArea12( _this );
- child_3.ref();
- this.el.add( child_3.el );
- }
-
- // user defined functions
- }
- public class Xcls_ButtonBox5 : Object
- {
- public Gtk.ButtonBox el;
- private GladeView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ButtonBox5(GladeView _owner )
- {
- _this = _owner;
- this.el = new Gtk.ButtonBox( Gtk.Orientation.HORIZONTAL );
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_Button6( _this );
- child_0.ref();
- this.el.add( child_0.el );
- var child_1 = new Xcls_MenuButton7( _this );
- child_1.ref();
- this.el.add( child_1.el );
- var child_2 = new Xcls_Button8( _this );
- child_2.ref();
- this.el.add( child_2.el );
- var child_3 = new Xcls_Button9( _this );
- child_3.ref();
- this.el.add( child_3.el );
- }
-
- // user defined functions
- }
- public class Xcls_Button6 : Object
- {
- public Gtk.Button el;
- private GladeView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button6(GladeView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "xxxcc";
- }
-
- // user defined functions
- }
-
- public class Xcls_MenuButton7 : Object
- {
- public Gtk.MenuButton el;
- private GladeView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_MenuButton7(GladeView _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuButton();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_Button8 : Object
- {
- public Gtk.Button el;
- private GladeView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button8(GladeView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "xxxcc";
- }
-
- // user defined functions
- }
-
- public class Xcls_Button9 : Object
- {
- public Gtk.Button el;
- private GladeView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button9(GladeView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "xxxcc";
- }
-
- // user defined functions
- }
-
-
- public class Xcls_Menu10 : Object
- {
- public Gtk.Menu el;
- private GladeView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Menu10(GladeView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Menu();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_ComboBox11 : Object
- {
- public Gtk.ComboBox el;
- private GladeView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ComboBox11(GladeView _owner )
- {
- _this = _owner;
- this.el = new Gtk.ComboBox();
-
- // my vars (dec)
-
- // set gobject values
- this.el.has_entry = false;
- }
-
- // user defined functions
- }
-
- public class Xcls_GLArea12 : Object
- {
- public Gtk.GLArea el;
- private GladeView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_GLArea12(GladeView _owner )
- {
- _this = _owner;
- this.el = new Gtk.GLArea();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
-}
"int last_search_end" : 0,
"int width" : 0,
"items" : [
+ {
+ "$ xns" : "Gtk",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "child",
+ "xtype" : "Box"
+ },
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "pressed" : [
+ "(n_press, x, y) => {",
+ "",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "GestureClick"
+ }
+ ],
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "add_controller",
+ "xtype" : "GestureClick"
+ },
+ {
+ "$ xns" : "Gtk",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "Gtk.TreeListModelCreateModelFunc create_func" : "() => { }",
+ "bool autoexpand" : true,
+ "bool passthrough" : true,
+ "xtype" : "TreeListModel"
+ }
+ ],
+ "xtype" : "SingleSelection"
+ },
+ {
+ "$ xns" : "Gtk",
+ "string title" : "",
+ "xtype" : "ColumnViewColumn"
+ }
+ ],
+ "xtype" : "ColumnView"
+ },
{
"$ xns" : "Gtk",
"* pack" : "pack_start,true,true,0",
" ",
" }",
"",
- " ",
- " return;",
- " ",
" ",
- " ",
- " ",
- " ",
- " // should we hold until it's printed...",
- " ",
- " ",
- "",
" ",
" ",
"",
// my vars (def)
public Gtk.Widget lastObj;
public Xcls_MainWindow main_window;
- public Gtk.SourceSearchContext searchcontext;
public int last_search_end;
+ public Gtk.SourceSearchContext searchcontext;
public int width;
public JsRender.JsRender file;
public int height;
// set gobject values
this.el.hexpand = true;
this.el.vexpand = true;
- var child_0 = new Xcls_notebook( _this );
+ var child_0 = new Xcls_Button2( _this );
child_0.ref();
- this.el.pack_start ( child_0.el , true,true,0 );
+ this.el.append( child_0.el );
+ var child_1 = new Xcls_GestureClick5( _this );
+ child_1.ref();
+ this.el.add_controller ( child_1.el );
+ var child_2 = new Xcls_ColumnView6( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ var child_3 = new Xcls_notebook( _this );
+ child_3.ref();
+ this.el.pack_start ( child_3.el , true,true,0 );
//listeners
this.el.size_allocate.connect( (aloc) => {
}
-
- return;
-
-
-
- // should we hold until it's printed...
-
-
-
-
}
+ public class Xcls_Button2 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_GladeuiView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button2(Xcls_GladeuiView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_0 = new Xcls_Box3( _this );
+ child_0.ref();
+ this.el.child = child_0.el;
+ var child_1 = new Xcls_GestureClick4( _this );
+ child_1.ref();
+ this.el.add_controller( child_1.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Box3 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_GladeuiView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box3(Xcls_GladeuiView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( null, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_GestureClick4 : Object
+ {
+ public Gtk.GestureClick el;
+ private Xcls_GladeuiView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_GestureClick4(Xcls_GladeuiView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.GestureClick();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.pressed.connect( (n_press, x, y) => {
+
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_GestureClick5 : Object
+ {
+ public Gtk.GestureClick el;
+ private Xcls_GladeuiView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_GestureClick5(Xcls_GladeuiView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.GestureClick();
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_ColumnView6 : Object
+ {
+ public Gtk.ColumnView el;
+ private Xcls_GladeuiView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_ColumnView6(Xcls_GladeuiView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.ColumnView( null );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_0 = new Xcls_SingleSelection7( _this );
+ child_0.ref();
+ this.el.model = child_0.el;
+ var child_1 = new Xcls_ColumnViewColumn9( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_SingleSelection7 : Object
+ {
+ public Gtk.SingleSelection el;
+ private Xcls_GladeuiView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_SingleSelection7(Xcls_GladeuiView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SingleSelection( null );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_0 = new Xcls_TreeListModel8( _this );
+ child_0.ref();
+ this.el.model = child_0.el;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_TreeListModel8 : Object
+ {
+ public Gtk.TreeListModel el;
+ private Xcls_GladeuiView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_TreeListModel8(Xcls_GladeuiView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.TreeListModel( null, true, true, () => { } );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_ColumnViewColumn9 : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private Xcls_GladeuiView _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_ColumnViewColumn9(Xcls_GladeuiView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.ColumnViewColumn( "", null );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
public class Xcls_notebook : Object
{
public Gtk.Notebook el;
// my vars (def)
+ public JsRender.JsRender file;
// ctor
public Xcls_designview(Xcls_GladeuiView _owner )
this.el = _this.main_window == null ? null : new Glade.DesignView(_this.main_window.gladeproject);
// my vars (dec)
+ this.file = null;
// init method
// my vars (def)
public bool loading;
+ public gboolean show_line_numbers;
public bool allow_node_scroll;
+ public gboolean show_line_marks;
+ public gboolean editable;
// ctor
public Xcls_sourceview(Xcls_GladeuiView _owner )
// my vars (dec)
this.loading = true;
+ this.show_line_numbers = true;
this.allow_node_scroll = true;
-
- // set gobject values
- this.el.editable = false;
- this.el.show_line_marks = true;
- this.el.show_line_numbers = true;
+ this.show_line_marks = true;
+ this.editable = false;
// init method
{
"build_module" : "builder",
+ "gen_extended" : false,
"items" : [
{
"# Gtk.Widget lastObj" : "null",
+ "# GtkSource.SearchContext searchcontext" : "",
"# JsRender.JsRender file" : "null",
"# Xcls_MainWindow main_window" : "",
"$ xns" : "Gtk",
"{",
"",
"\tthis.css = new Gtk.CssProvider();",
- "\ttry {",
- "\t\tthis.css.load_from_data(\"#gtkview-view-layout { background-color: #ccc; }\");",
- "\t} catch (Error e) {}",
- "\tthis.el.get_style_context().add_provider(this.css,",
- "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION);",
"\t ",
- " ",
- " ",
+ "\tthis.css.load_from_string(",
+ "\t\t\"#gtkview-view-layout { background-color: #ccc; }\"",
+ "\t);",
+ "\t ",
+ "\tGtk.StyleContext.add_provider_for_display(",
+ "\t\tthis.el.get_display(),",
+ "\t\tthis.css,",
+ "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
+ "\t);",
+ "\t\t",
" ",
"}",
""
],
"Gtk.CssProvider css" : "",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
- "Gtk.SourceSearchContext searchcontext" : "",
"bool hexpand" : true,
"bool vexpand" : true,
"id" : "GtkView",
- "int height" : 0,
"int last_search_end" : 0,
- "int width" : 0,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true,true,0",
+ "Gtk.Overflow overflow" : "Gtk.Overflow.VISIBLE",
"id" : "notebook",
"items" : [
{
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
+ "* pack" : "set_child",
"id" : "view_layout",
"items" : [
{
}
],
"string name" : "gtkview-view-layout",
- "xtype" : "Layout"
+ "xtype" : "Fixed"
}
],
"xtype" : "ScrolledWindow"
{
"$ xns" : "Gtk",
"bool vexpand" : true,
+ "id" : "sourceviewscroll",
"items" : [
{
"# JsRender.Node? node_selected" : "",
"# string prop_selected" : "\"\"",
- "$ xns" : "Gtk",
+ "$ xns" : "GtkSource",
"* init" : [
"{",
" ",
" ",
" \tthis.css = new Gtk.CssProvider();",
- "\ttry {",
- "\t\tthis.css.load_from_data(\"#gtkview-view { font: 10px Monospace;}\");",
- "\t} catch (Error e) {}",
- "\tthis.el.get_style_context().add_provider(this.css,",
- "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION);",
"\t ",
+ "\tthis.css.load_from_string(\"#gtkview-view { font: 10px monospace ;}\");",
+ "\t ",
+ "\tGtk.StyleContext.add_provider_for_display(",
+ "\t\tthis.el.get_display(),",
+ "\t\tthis.css,",
+ "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
+ "\t);",
+ "\t\t",
"\t\t ",
" this.loading = true;",
- " var buf = this.el.get_buffer();",
- " buf.notify.connect((ps) => {",
- " if (this.loading) {",
- " return;",
- " }",
- " if (ps.name != \"cursor-position\") {",
- " return;",
- " }",
- " 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();",
- " ",
- " var node = _this.file.lineToNode(ln);",
- " ",
- " if (node == null) {",
- " print(\"can not find node\\n\");",
- " return;",
- " }",
- " var ltree = _this.main_window.windowstate.left_tree;",
- " var tp = ltree.model.treePathFromNode(node);",
- " print(\"got tree path %s\\n\", tp);",
- " if (tp != \"\") {",
- "\t this.allow_node_scroll = false; ",
- "\t 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 , () => {",
- "\t this.allow_node_scroll = true;",
- "\t return false;",
- " });",
- " }",
- " ",
- " // highlight the node..",
- " ",
- " });",
- " ",
+ " ",
" ",
" ",
- " var attrs = new Gtk.SourceMarkAttributes();",
+ " var attrs = new GtkSource.MarkAttributes();",
" var pink = Gdk.RGBA();",
" pink.parse ( \"pink\");",
" attrs.set_background ( pink);",
" ",
" this.el.set_mark_attributes (\"ERR\", attrs, 1);",
" ",
- " var wattrs = new Gtk.SourceMarkAttributes();",
+ " var wattrs = new GtkSource.MarkAttributes();",
" var blue = Gdk.RGBA();",
" blue.parse ( \"#ABF4EB\");",
" wattrs.set_background ( blue);",
" ",
" ",
" ",
- " var dattrs = new Gtk.SourceMarkAttributes();",
+ " var dattrs = new GtkSource.MarkAttributes();",
" var purple = Gdk.RGBA();",
" purple.parse ( \"#EEA9FF\");",
" dattrs.set_background ( purple);",
" this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
" ",
" ",
- " var gattrs = new Gtk.SourceMarkAttributes();",
+ " var gattrs = new GtkSource.MarkAttributes();",
" var grey = Gdk.RGBA();",
" grey.parse ( \"#ccc\");",
" gattrs.set_background ( grey);",
"}",
" "
],
- "* pack" : "add",
+ "* pack" : "set_child",
"Gtk.CssProvider css" : "",
"bool allow_node_scroll" : true,
"bool loading" : true,
"id" : "sourceview",
"items" : [
{
- "$ xns" : "Gtk",
+ "$ xns" : "GtkSource",
"* pack" : "set_buffer",
"bool dirty" : false,
"id" : "buffer",
"int error_line" : "-1",
- "xtype" : "SourceBuffer"
+ "listeners" : {
+ "notify[\"cursor_position\"]" : [
+ "() => {",
+ "",
+ "",
+ " 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..",
+ " ",
+ " ",
+ "",
+ " }"
+ ]
+ },
+ "xtype" : "Buffer"
+ },
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "key_pressed" : [
+ "(keyval, keycode, state) => {",
+ "",
+ "\t",
+ "\t ",
+ "\t if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
+ "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
+ "\t\t_this.forwardSearch(true);",
+ "\t return true;",
+ "\t}",
+ " if (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 return true;",
+ "\t}",
+ "\t ",
+ "\treturn false;",
+ "}\t ",
+ "\t"
+ ]
+ },
+ "xtype" : "EventControllerKey"
}
],
"listeners" : {
- "key_press_event" : [
- "(event) => {",
+ "query_tooltip" : [
+ "(x, y, keyboard_tooltip, tooltip) => {",
"\t",
- "\t if (event.keyval == Gdk.Key.g && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
- "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
- "\t\t_this.forwardSearch(true);",
- "\t return true;",
+ "\t//GLib.debug(\"query tooltip\");",
+ "\tGtk.TextIter iter;",
+ "\tint trailing;",
+ "\t",
+ "\tvar yoff = (int) _this.sourceviewscroll.el.vadjustment.value;",
+ "\t",
+ "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
+ "\t ",
+ "\tvar l = iter.get_line();",
+ "\t// GLib.debug(\"query tooltip line %d\", (int) l);",
+ "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, \"ERR\");",
+ "\tif (marks.is_empty()) {",
+ "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"WARN\");",
"\t}",
- " if (event.keyval == Gdk.Key.f && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
- "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
- "\t\t_this.search_entry.el.grab_focus();",
- "\t return true;",
+ "\tif (marks.is_empty()) {",
+ "\t\tmarks = _this.buffer.el.get_source_marks_at_line(l, \"DEPR\");",
"\t}",
- "\t ",
- "\treturn false;",
- "}\t ",
+ "\t",
+ "\t// GLib.debug(\"query tooltip line marks %d\", (int) marks.length());",
+ "\tvar str = \"\";",
+ "\tmarks.@foreach((m) => { ",
+ "\t\t//GLib.debug(\"got mark %s\", m.name);",
+ "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.name;",
+ "\t});",
+ "\t",
+ "\t// true if there is a mark..",
+ "\ttooltip.set_text( str);",
+ "\treturn str.length > 0 ? true : false;",
+ "",
+ "}",
""
]
},
"string name" : "gtkview-view",
- "xtype" : "SourceView",
+ "xtype" : "View",
"| string toString" : [
"() {",
" Gtk.TextIter s;",
" Gtk.TextIter end; ",
" ",
" var buf = this.el.get_buffer();",
- " var sbuf = (Gtk.SourceBuffer)buf;",
+ " var sbuf = (GtkSource.Buffer)buf;",
" buf.get_bounds (out start, out end);",
" ",
" sbuf.remove_source_marks (start, end, type);",
" // we should highlight other types of errors..",
" ",
" if (!obj.has_member(type)) {",
- " print(\"Return has no errors\\n\");",
+ " GLib.debug(\"Return has no errors\\n\");",
" return ;",
" }",
" var err = obj.get_object_member(type);",
" ",
" if (_this.file == null) { ",
+ "\t",
" return; // just in case the file has not loaded yet?",
" }",
" ",
" } ",
"",
" if (!err.has_member(valafn)) {",
- " print(\"File path has no errors\\n\");",
+ " GLib.debug(\"File path has no errors\\n\");",
" return ;",
" }",
" var lines = err.get_object_member(valafn);",
" Gtk.TextIter iter;",
" // print(\"get inter\\n\");",
" var eline = int.parse(line) -1 ;",
- " print(\"GOT ERROR on line %s -- converted to %d\\n\", line,eline);",
+ " GLib.debug(\"GOT ERROR on line %s -- converted to %d\\n\", line,eline);",
" ",
" ",
" if (eline > tlines || eline < 0) {",
" this.loading = true;",
" var buf = this.el.get_buffer();",
" buf.set_text(\"\",0);",
- " var sbuf = (Gtk.SourceBuffer) buf;",
+ " var sbuf = (GtkSource.Buffer) buf;",
"",
" ",
"",
"",
"// print(\"setting str %d\\n\", str.length);",
" buf.set_text(str, str.length);",
- " var lm = Gtk.SourceLanguageManager.get_default();",
+ " var lm = GtkSource.LanguageManager.get_default();",
" ",
" //?? is javascript going to work as js?",
" ",
- " ((Gtk.SourceBuffer)(buf)) .set_language(lm.get_language(_this.file.language));",
+ " ((GtkSource.Buffer)(buf)) .set_language(lm.get_language(_this.file.language));",
" ",
" ",
" Gtk.TextIter start;",
" this.highlightErrorsJson(\"WARN\", obj);",
" this.highlightErrorsJson(\"DEPR\", obj);\t\t\t",
" }",
- " //while (Gtk.events_pending()) {",
+ " // while (Gtk.events_pending()) {",
" // Gtk.main_iteration();",
" // }",
" ",
"(JsRender.Node? sel, bool scroll) {",
" ",
" ",
- " ",
+ " if (this.loading) {",
+ " \treturn;",
+ "\t}",
" // this is connected in widnowstate",
" print(\"Roo-view - node selected\\n\");",
" var buf = this.el.get_buffer();",
" ",
- " var sbuf = (Gtk.SourceBuffer) buf;",
+ " var sbuf = (GtkSource.Buffer) buf;",
"",
" ",
- " while(Gtk.events_pending()) {",
- " Gtk.main_iteration();",
- " }",
+ " // while(Gtk.events_pending()) {",
+ " // Gtk.main_iteration();",
+ " // }",
" ",
" ",
" // clear all the marks..",
"* init" : [
" ",
"this.css = new Gtk.CssProvider();",
- "\ttry {",
- "\t\tthis.css.load_from_data(\"#gtkview-search-entry { font: 10px Monospace;}\");",
- "\t} catch (Error e) {}",
- "\tthis.el.get_style_context().add_provider(this.css,",
- "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION);",
- "\t ",
+ "",
+ "this.css.load_from_string(\"",
+ "\t#gtkview-search-entry { font: 10px monospace ;}\"",
+ ");",
+ "",
+ "Gtk.StyleContext.add_provider_for_display(",
+ "\tthis.el.get_display(),",
+ "\tthis.css,",
+ "\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
+ ");",
"\t\t",
"",
""
"Gtk.CssProvider css" : "",
"bool hexpand" : true,
"id" : "search_entry",
- "int width_request" : 300,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "key_pressed" : [
+ "(keyval, keycode, state) => {",
+ "",
+ "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
+ "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
+ "\t\t_this.forwardSearch(true);",
+ "\t return true;",
+ "\t}",
+ " ",
+ " ",
+ " \tif (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {",
+ "\t\t_this.forwardSearch(true);",
+ "\t\t",
+ "\t\t",
+ "\t return true;",
+ "",
+ "\t} ",
+ " // print(event.key.keyval)",
+ " ",
+ " return false;",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "EventControllerKey"
+ }
+ ],
"listeners" : {
- "changed" : [
- "() => {",
- "\t/*",
- "\tif (this.el.text == \"\") {",
- "\t\t_this.search_results.el.hide();",
- "\t\treturn;",
- "\t}",
- "\tvar res = 0;",
- "\tswitch(_this.windowstate.state) {",
- "\t\tcase WindowState.State.CODEONLY:",
- "\t\t///case WindowState.State.CODE:",
- "\t\t\t// search the code being edited..",
- "\t\t\tres = _this.windowstate.code_editor_tab.search(this.el.text);",
- "\t\t\t",
- "\t\t\tbreak;",
- "\t\tcase WindowState.State.PREVIEW:",
- "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
- "\t\t\t\t res = _this.windowstate.window_gladeview.search(this.el.text);",
- "\t\t\t} else { ",
- "\t\t\t\t res = _this.windowstate.window_rooview.search(this.el.text);\t\t\t",
- "\t\t\t}",
- "\t\t",
- "\t\t",
- "\t\t\tbreak;",
- "\t}",
- "\t_this.search_results.el.show();",
- "\tif (res > 0) {",
- "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
- "\t} else {",
- "\t\t_this.search_results.el.label = \"No Matches\";",
- "\t}",
- "\t\t",
- "\t*/",
- "\t",
- "}",
- ""
- ],
- "key_press_event" : [
- "(event) => {",
- " if (event.keyval == Gdk.Key.g && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
- "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
- "\t\t_this.forwardSearch(true);",
- "\t return true;",
- "\t}",
- " ",
- " ",
- " \tif (event.keyval == Gdk.Key.Return && this.el.text.length > 0) {",
- "\t\t_this.search(this.el.text);",
- "\t\t _this.search_results.updateResults();",
+ "search_changed" : [
+ " () => {",
+ " \t ",
+ "\t_this.search(_this.search_entry.el.text);",
+ "\t _this.search_results.updateResults();",
"",
- "\t\tGLib.Timeout.add_seconds(2,() => {",
- "\t\t\t _this.search_results.updateResults();",
- "\t\t\t return false;",
- "\t\t });",
- "\t ",
- "\t\t",
- "\t return true;",
- "",
- "\t} ",
- " // print(event.key.keyval)",
+ "\tGLib.Timeout.add_seconds(1,() => {",
+ "\t\t _this.search_results.updateResults();",
+ "\t\t return false;",
+ "\t });",
+ "\t ",
" ",
- " return false;",
- "",
- "} "
+ " ",
+ "}"
]
},
"string name" : "gtkview-search-entry",
"string placeholder_text" : "Press enter to search",
+ "uint search_delay" : 3,
"xtype" : "SearchEntry",
"| void forwardSearch" : [
"(bool change_focus) {",
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "bool visible" : false,
- "id" : "search_results",
- "listeners" : {
- "button_press_event" : [
- "() => {",
- "/*",
- " if (this.popup == null) {",
- " this.popup = new Xcls_ValaCompileErrors();",
- " this.popup.window = _this;",
- " }",
- " ",
- " ",
- " this.popup.show(this.notices, this.el);",
- " */",
- " return true;",
- "}"
- ]
- },
- "xtype" : "MenuItem",
- "| void updateResults" : [
- "() {",
- "\tthis.el.visible = true;",
- "\t",
- "\tvar res = _this.searchcontext.get_occurrences_count();",
- "\tif (res < 0) {",
- "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
- "\t\treturn;",
- "\t}",
- "",
- "\t_this.nextBtn.el.sensitive = false;",
- "\t_this.backBtn.el.sensitive = false;\t",
- "",
- "\tif (res > 0) {",
- "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
- "\t\t_this.nextBtn.el.sensitive = true;",
- "\t\t_this.backBtn.el.sensitive = true;",
- "\t\treturn;",
- "\t} ",
- "\t_this.search_results.el.label = \"No Matches\";",
- "\t",
- "}"
- ]
- }
- ],
- "xtype" : "MenuBar"
+ "id" : "search_results",
+ "int margin_end" : 4,
+ "int margin_start" : 4,
+ "string label" : "No Results",
+ "xtype" : "Label",
+ "| void updateResults" : [
+ "() {",
+ "\tthis.el.visible = true;",
+ "\t",
+ "\tvar res = _this.searchcontext.get_occurrences_count();",
+ "\tif (res < 0) {",
+ "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
+ "\t\treturn;",
+ "\t}",
+ "",
+ "\t_this.nextBtn.el.sensitive = false;",
+ "\t_this.backBtn.el.sensitive = false;\t",
+ "",
+ "\tif (res > 0) {",
+ "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
+ "\t\t_this.nextBtn.el.sensitive = true;",
+ "\t\t_this.backBtn.el.sensitive = true;",
+ "\t\treturn;",
+ "\t} ",
+ "\t_this.search_results.el.label = \"No Matches\";",
+ "\t",
+ "}"
+ ]
},
{
"$ xns" : "Gtk",
"bool always_show_image" : true,
"bool sensitive" : false,
"id" : "nextBtn",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* prop" : "image",
- "string icon_name" : "go-down",
- "xtype" : "Image"
- }
- ],
"listeners" : {
- "button_press_event" : [
- "(event) => {",
+ "clicked" : [
+ "( ) => {",
+ "_this.forwardSearch(true);",
+ "\t ",
"",
- "\t_this.forwardSearch(true);",
- "\t",
- "\treturn true;",
"}",
""
]
},
- "string label" : "Next",
+ "string icon_name" : "go-down",
"xtype" : "Button"
},
{
"bool always_show_image" : true,
"bool sensitive" : false,
"id" : "backBtn",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* prop" : "image",
- "string icon_name" : "go-up",
- "xtype" : "Image"
- }
- ],
"listeners" : {
- "button_press_event" : [
- "(event) => {",
+ "clicked" : [
+ "( ) => {",
"",
- "\t_this.backSearch(true);",
+ "_this.backSearch(true);",
"\t",
- "\treturn true;",
"}",
""
]
},
- "string label" : "Previous",
+ "string icon_name" : "go-up",
"xtype" : "Button"
},
{
"$ xns" : "Gtk",
+ "bool always_show_arrow" : true,
"bool always_show_image" : true,
"items" : [
{
"$ xns" : "Gtk",
- "* prop" : "image",
- "string icon_name" : "emblem-system",
- "xtype" : "Image"
- },
- {
- "$ xns" : "Gtk",
- "* prop" : "popup",
+ "* ctor" : "new Gtk.PopoverMenu.from_model(null)",
+ "* prop" : "popover",
"id" : "search_settings",
"items" : [
{
"$ xns" : "Gtk",
- "* init" : [
- "{",
- "\tthis.el.show();",
- "}",
- ""
- ],
- "id" : "case_sensitive",
- "string label" : "Case Sensitive",
- "xtype" : "CheckMenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- "{",
- "\tthis.el.show();",
- "}",
- ""
- ],
- "id" : "regex",
- "string label" : "Regex",
- "xtype" : "CheckMenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- "{",
- "\tthis.el.show();",
- "}",
- ""
+ "* pack" : "set_child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "int spacing" : 0,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "id" : "case_sensitive",
+ "string label" : "Case Sensitive",
+ "xtype" : "CheckButton"
+ },
+ {
+ "$ xns" : "Gtk",
+ "id" : "regex",
+ "string label" : "Regex",
+ "xtype" : "CheckButton"
+ },
+ {
+ "$ xns" : "Gtk",
+ "id" : "multiline",
+ "string label" : "Multi-line (add \\n)",
+ "xtype" : "CheckButton"
+ }
],
- "id" : "multiline",
- "string label" : "Multi-line (add \\n)",
- "xtype" : "CheckMenuItem"
+ "xtype" : "Box"
}
],
- "xtype" : "Menu"
+ "xtype" : "PopoverMenu"
}
],
- "string label" : "Settings",
+ "string icon_name" : "emblem-system",
"xtype" : "MenuButton"
}
],
"xtype" : "Notebook"
}
],
- "listeners" : {
- "size_allocate" : [
- "(aloc) => {",
- " ",
- " this.width = aloc.width;",
- " this.height =aloc.height;",
- "}",
- " "
- ]
- },
"xtype" : "Box",
"| int search" : [
"(string in_txt) {",
"\t",
" ",
" ",
- "\tvar s = new Gtk.SourceSearchSettings();",
+ "\tvar s = new GtkSource.SearchSettings();",
"\ts.case_sensitive = _this.case_sensitive.el.active;",
"\ts.regex_enabled = _this.regex.el.active;\t",
"\ts.wrap_around = false;",
"\t",
- "\tthis.searchcontext = new Gtk.SourceSearchContext(this.buffer.el,s);",
+ "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
"\tthis.searchcontext.set_highlight(true);",
"\tvar txt = in_txt;",
"\t",
"\tGtk.TextIter beg, st,en;",
"\tbool has_wrapped_around;",
"\tthis.buffer.el.get_start_iter(out beg);",
- "\tthis.searchcontext.forward2(beg, out st, out en, out has_wrapped_around);",
+ "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
"\tthis.last_search_end = 0;",
"\t",
"\treturn this.searchcontext.get_occurrences_count();",
"\tbool has_wrapped_around;",
"\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
"\t",
- "\tif (!this.searchcontext.backward2(beg, out st, out en, out has_wrapped_around)) {",
+ "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
"\t",
"\t\tthis.last_search_end = 0;",
"\t\treturn;",
"\tthis.sourceview.el.scroll_to_iter(st, 0.1f, true, 0.0f, 0.5f);",
"\tvar ln = st.get_line();",
"\tthis.highlightNodeAtLine(ln);",
- "\t",
- " ",
+ "\t ",
"}",
""
],
" }",
" ",
" ",
+ " \tthis.file.widgetToIcon(this.container.el); ",
"",
- " var win = this.el.get_parent_window();",
- " var width = win.get_width();",
- " var height = win.get_height();",
- " //try {",
- " Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height); // this.el.position?",
- " this.file.writeIcon(screenshot);",
- " //} catch (Error e) {",
- " ",
- " //}",
- "",
- " ",
+ " ",
" return;",
" ",
" ",
" ",
" ",
" // should we hold until it's printed...",
- " ",
- " ",
- "",
- " ",
- " ",
- "",
+ " ",
"",
" ",
" ",
"\tbool has_wrapped_around;",
"\tvar buf = this.sourceview.el.get_buffer();",
"\tbuf.get_iter_at_offset(out beg, this.last_search_end);",
- "\tif (!this.searchcontext.forward2(beg, out st, out en, out has_wrapped_around)) {",
+ "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
"\t\tthis.last_search_end = 0;",
"\t\treturn;",
"\t}",
"| void highlightNodeAtLine" : [
"(int ln) {",
"",
- "",
+ "\t// this is done from clicking on the editor..",
"\t ",
"\t// highlight node...",
"\t",
" return;",
" }",
" var prop = node.lineToProp(ln+1);",
- " print(\"prop : %s\", prop == null ? \"???\" : prop);",
+ " print(\"prop : %s\", prop == null ? \"???\" : prop.name);",
" ",
" ",
" // ---------- this selects the tree's node...",
" ",
" var ltree = _this.main_window.windowstate.left_tree;",
- " var tp = ltree.model.treePathFromNode(node);",
- " print(\"got tree path %s\\n\", tp);",
- " if (tp == \"\") {",
- "\t\treturn;",
- "\t}",
+ " ltree.model.selectNode(node);",
+ " //var tp = ltree.model.treePathFromNode(node);",
+ " ",
+ " //print(\"got tree path %s\\n\", tp);",
+ " //if (tp == \"\") {",
+ "\t//\treturn;",
+ "\t//}",
" //_this.sourceview.allow_node_scroll = false; /// block node scrolling..",
"\t ",
" ",
" // let's try allowing editing on the methods.",
" // a little klunky at present..",
"\t_this.sourceview.prop_selected = \"\";",
+ "\t/*",
" if (prop != null) {",
"\t\t//see if we can find it..",
"\t\tvar kv = prop.split(\":\");",
"\t\t\t",
"\t\t}",
" }",
- " ltree.view.setCursor(tp, \"editor\");",
+ " */",
+ " //ltree.view.setCursor(tp, \"editor\");",
" // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false); ",
" _this.sourceview.nodeSelected(node,false);",
" ",
" // hide the compile view at present..",
" ",
" ",
- " var w = this.width;",
- " var h = this.height;",
+ " var w = this.el.get_width();",
+ " var h = this.el.get_height();",
" ",
" print(\"ALLOC SET SIZES %d, %d\\n\", w,h); ",
" ",
" print(\"SET SIZES %d, %d\\n\", w,h); ",
" _this.container.el.set_size_request(w,h);",
" ",
- " _this.view_layout.el.set_size(w,h); // should be baded on calc.. -- see update_scrolled.",
- " ",
- " ",
+ " _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) {",
+ " \t\tthis.container.el.remove(fc);",
+ " \t\t}",
+ " ",
+ " \t\tvar xmlstr = JsRender.NodeToGlade.mungeFile( file);",
+ " \t\tvar builder = new Gtk.Builder.from_string (xmlstr, xmlstr.length);",
+ " \t\tvar obj = (Gtk.Widget) builder.get_object(\"w\"+ file.tree.oid.to_string());",
+ " \t\t this.container.el.append(obj);",
+ "\t obj.show();",
+ " this.createThumb();",
+ " ",
+ " \t ",
+ " return;/*",
"\tvar x = new JsRender.NodeToGtk((Project.Gtk) file.project, file.tree);",
" var obj = x.munge() as Gtk.Widget;",
" this.lastObj = null;",
"\t}",
"\tthis.lastObj = obj;",
" ",
- " this.container.el.add(obj);",
- " obj.show_all();",
+ " this.container.el.append(obj);",
+ " obj.show();",
" ",
- " ",
+ " */",
" ",
"}",
" "
"\t ",
"\t\t var buf = this.sourceview.el.get_buffer();",
"\t ",
- "\t\tvar sbuf = (Gtk.SourceBuffer) buf;",
+ "\t\tvar sbuf = (GtkSource.Buffer) buf;",
"",
"",
"\t\tGtk.TextIter iter; ",
]
}
],
- "modOrder" : "",
- "name" : "GtkView",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/GtkView.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "GtkView"
}
\ No newline at end of file
-static Xcls_GtkView _GtkView;
+ static Xcls_GtkView _GtkView;
-public class Xcls_GtkView : Object
-{
- public Gtk.Box el;
- private Xcls_GtkView _this;
-
- public static Xcls_GtkView singleton()
+ public class Xcls_GtkView : Object
{
- if (_GtkView == null) {
- _GtkView= new Xcls_GtkView();
+ public Gtk.Box el;
+ private Xcls_GtkView _this;
+
+ public static Xcls_GtkView singleton()
+ {
+ if (_GtkView == null) {
+ _GtkView= new Xcls_GtkView();
+ }
+ return _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_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 Gtk.SourceSearchContext searchcontext;
- public int last_search_end;
- public int width;
- public JsRender.JsRender file;
- public int height;
-
- // ctor
- public Xcls_GtkView()
- {
- _this = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ 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;
- // my vars (dec)
- this.lastObj = null;
- this.last_search_end = 0;
- this.width = 0;
- this.file = null;
- this.height = 0;
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ new Xcls_notebook( _this );
+ this.el.append( _this.notebook.el );
- // set gobject values
- this.el.hexpand = true;
- this.el.vexpand = true;
- var child_0 = new Xcls_notebook( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true,true,0 );
+ // init method
- // 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;
+
- this.css = new Gtk.CssProvider();
- try {
- this.css.load_from_data("#gtkview-view-layout { background-color: #ccc; }");
- } catch (Error e) {}
- this.el.get_style_context().add_provider(this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
-
+ 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();
+
+ */
}
-
- //listeners
- this.el.size_allocate.connect( (aloc) => {
+ public void highlightNodeAtLine (int ln) {
+
+ // this is done from clicking on the editor..
+
+ // highlight node...
+
+
+ var node = _this.file.lineToNode(ln+1);
- this.width = aloc.width;
- this.height =aloc.height;
- });
- }
-
- // user defined functions
- public void loadFile (JsRender.JsRender file)
- {
- this.file = null;
-
- if (file.tree == null) {
+ if (node == null) {
+ //print("can not find node\n");
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.width;
- var h = this.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);
+ var prop = node.lineToProp(ln+1);
+ print("prop : %s", prop == null ? "???" : prop.name);
+
+
+ // ---------- this selects the tree's node...
- print("SET SIZES %d, %d\n", w,h);
- _this.container.el.set_size_request(w,h);
+ var ltree = _this.main_window.windowstate.left_tree;
+ ltree.model.selectNode(node);
+ //var tp = ltree.model.treePathFromNode(node);
- _this.view_layout.el.set_size(w,h); // should be baded on calc.. -- see update_scrolled.
-
+ //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");
- 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.add(obj);
- obj.show_all();
-
-
-
- }
- 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);
+
+ // 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);
- // ---------- this selects the tree's node...
-
- var ltree = _this.main_window.windowstate.left_tree;
- 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;
+ // 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;
+ // });
+ // }
- } 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.forward2(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.backward2(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 Gtk.SourceSearchSettings();
- s.case_sensitive = _this.case_sensitive.el.active;
- s.regex_enabled = _this.regex.el.active;
- s.wrap_around = false;
-
- this.searchcontext = new Gtk.SourceSearchContext(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.forward2(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;
+ 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();
-
- var win = this.el.get_parent_window();
- var width = win.get_width();
- var height = win.get_height();
- //try {
- Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height); // this.el.position?
- this.file.writeIcon(screenshot);
- //} catch (Error e) {
+
- //}
-
-
- return;
+ }
+ 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);
-
-
-
- // should we hold until it's printed...
+
+ return;
+
+
+
+
+
+ // should we hold until it's printed...
+
-
-
+
+
+ }
+ 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 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 = (Gtk.SourceBuffer) 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
- var child_0 = new Xcls_label_preview( _this );
- child_0.ref();
- var child_1 = new Xcls_label_code( _this );
- child_1.ref();
- var child_2 = new Xcls_ScrolledWindow5( _this );
- child_2.ref();
- this.el.append_page ( child_2.el , _this.label_preview.el );
- var child_3 = new Xcls_Box8( _this );
- child_3.ref();
- this.el.append_page ( child_3.el , _this.label_code.el );
+
}
+ public class Xcls_notebook : Object
+ {
+ public Gtk.Notebook el;
+ private Xcls_GtkView _this;
- // user defined functions
- }
- public class Xcls_label_preview : Object
- {
- public Gtk.Label el;
- private Xcls_GtkView _this;
+ // my vars (def)
- // 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 );
+ }
- // ctor
- public Xcls_label_preview(Xcls_GtkView _owner )
+ // user defined functions
+ }
+ public class Xcls_label_preview : Object
{
- _this = _owner;
- _this.label_preview = this;
- this.el = new Gtk.Label( "Preview" );
+ public Gtk.Label el;
+ private Xcls_GtkView _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_label_preview(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.label_preview = this;
+ this.el = new Gtk.Label( "Preview" );
- public class Xcls_label_code : Object
- {
- public Gtk.Label el;
- private Xcls_GtkView _this;
+ // my vars (dec)
+ // set gobject values
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_label_code(Xcls_GtkView _owner )
+ public class Xcls_label_code : Object
{
- _this = _owner;
- _this.label_code = this;
- this.el = new Gtk.Label( "Preview Generated Code" );
+ public Gtk.Label el;
+ private Xcls_GtkView _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_label_code(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.label_code = this;
+ this.el = new Gtk.Label( "Preview Generated Code" );
- public class Xcls_ScrolledWindow5 : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_GtkView _this;
+ // my vars (dec)
+ // set gobject values
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_ScrolledWindow5(Xcls_GtkView _owner )
+ public class Xcls_ScrolledWindow5 : Object
{
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
+ public Gtk.ScrolledWindow el;
+ private Xcls_GtkView _this;
- // my vars (dec)
- // set gobject values
- var child_0 = new Xcls_view_layout( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- }
+ // my vars (def)
- // user defined functions
- }
- public class Xcls_view_layout : Object
- {
- public Gtk.Layout el;
- private Xcls_GtkView _this;
+ // ctor
+ public Xcls_ScrolledWindow5(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.ScrolledWindow();
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ new Xcls_view_layout( _this );
+ this.el.set_child ( _this.view_layout.el );
+ }
- // ctor
- public Xcls_view_layout(Xcls_GtkView _owner )
+ // user defined functions
+ }
+ public class Xcls_view_layout : Object
{
- _this = _owner;
- _this.view_layout = this;
- this.el = new Gtk.Layout( null, null );
+ public Gtk.Fixed el;
+ private Xcls_GtkView _this;
- // my vars (dec)
- // set gobject values
- this.el.name = "gtkview-view-layout";
- var child_0 = new Xcls_container( _this );
- child_0.ref();
- this.el.put ( child_0.el , 10,10 );
- }
+ // my vars (def)
- // user defined functions
- }
- public class Xcls_container : Object
- {
- public Gtk.Box el;
- private Xcls_GtkView _this;
+ // ctor
+ public Xcls_view_layout(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.view_layout = this;
+ this.el = new Gtk.Fixed();
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ this.el.name = "gtkview-view-layout";
+ new Xcls_container( _this );
+ this.el.put ( _this.container.el , 10,10 );
+ }
- // ctor
- public Xcls_container(Xcls_GtkView _owner )
+ // user defined functions
+ }
+ public class Xcls_container : Object
{
- _this = _owner;
- _this.container = this;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+ public Gtk.Box el;
+ private Xcls_GtkView _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_container(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.container = this;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+ // my vars (dec)
+ // set gobject values
+ }
- public class Xcls_Box8 : Object
- {
- public Gtk.Box el;
- private Xcls_GtkView _this;
+ // user defined functions
+ }
- // my vars (def)
- // ctor
- public Xcls_Box8(Xcls_GtkView _owner )
+ public class Xcls_Box8 : Object
{
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ public Gtk.Box el;
+ private Xcls_GtkView _this;
- // my vars (dec)
- // set gobject values
- var child_0 = new Xcls_ScrolledWindow9( _this );
- child_0.ref();
- this.el.add( child_0.el );
- var child_1 = new Xcls_Box12( _this );
- child_1.ref();
- this.el.add( child_1.el );
- }
+ // my vars (def)
- // user defined functions
- }
- public class Xcls_ScrolledWindow9 : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_GtkView _this;
+ // ctor
+ public Xcls_Box8(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ // my vars (dec)
- // my vars (def)
+ // 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 );
+ }
- // ctor
- public Xcls_ScrolledWindow9(Xcls_GtkView _owner )
+ // user defined functions
+ }
+ public class Xcls_sourceviewscroll : Object
{
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
+ public Gtk.ScrolledWindow el;
+ private Xcls_GtkView _this;
- // my vars (dec)
- // set gobject values
- this.el.vexpand = true;
- var child_0 = new Xcls_sourceview( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- }
+ // my vars (def)
- // user defined functions
- }
- public class Xcls_sourceview : Object
- {
- public Gtk.SourceView el;
- private Xcls_GtkView _this;
+ // ctor
+ public Xcls_sourceviewscroll(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.sourceviewscroll = this;
+ this.el = new Gtk.ScrolledWindow();
+ // my vars (dec)
- // my vars (def)
- public bool loading;
- public string prop_selected;
- public Gtk.CssProvider css;
- public bool allow_node_scroll;
- public JsRender.Node? node_selected;
+ // set gobject values
+ this.el.vexpand = true;
+ new Xcls_sourceview( _this );
+ this.el.set_child ( _this.sourceview.el );
+ }
- // ctor
- public Xcls_sourceview(Xcls_GtkView _owner )
+ // user defined functions
+ }
+ public class Xcls_sourceview : Object
{
- _this = _owner;
- _this.sourceview = this;
- this.el = new Gtk.SourceView();
+ public GtkSource.View el;
+ private Xcls_GtkView _this;
- // 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;
- var child_0 = new Xcls_buffer( _this );
- child_0.ref();
- this.el.set_buffer ( child_0.el );
-
- // init method
+ // 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.css = new Gtk.CssProvider();
- try {
- this.css.load_from_data("#gtkview-view { font: 10px Monospace;}");
- } catch (Error e) {}
- this.el.get_style_context().add_provider(this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
-
+ _this = _owner;
+ _this.sourceview = this;
+ this.el = new GtkSource.View();
+
+ // my vars (dec)
this.loading = true;
- var buf = this.el.get_buffer();
- buf.notify.connect((ps) => {
- if (this.loading) {
- return;
- }
- if (ps.name != "cursor-position") {
- return;
- }
- print("cursor changed : %d\n", buf.cursor_position);
- Gtk.TextIter cpos;
- buf.get_iter_at_offset(out cpos, buf.cursor_position);
+ 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 ln = cpos.get_line();
-
- var node = _this.file.lineToNode(ln);
-
- if (node == null) {
- print("can not find node\n");
- return;
- }
- var ltree = _this.main_window.windowstate.left_tree;
- var tp = ltree.model.treePathFromNode(node);
- 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;
- });
- }
+
+
+ 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;
+ });
- // highlight the node..
+ 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;
+
});
-
-
-
- var attrs = new Gtk.SourceMarkAttributes();
- 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;
- });
+ }
+
+ // user defined functions
+ public void loadFile ( ) {
+ this.loading = true;
+ var buf = this.el.get_buffer();
+ buf.set_text("",0);
+ var sbuf = (GtkSource.Buffer) buf;
+
- this.el.set_mark_attributes ("ERR", attrs, 1);
+
+ if (_this.file == null || _this.file.xtype != "Gtk") {
+ print("xtype != Gtk");
+ this.loading = false;
+ return;
+ }
- var wattrs = new Gtk.SourceMarkAttributes();
- 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;
- });
+ 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 ;
+ }
- this.el.set_mark_attributes ("WARN", wattrs, 1);
+ 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?
- var dattrs = new Gtk.SourceMarkAttributes();
- 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;
- });
+ ((GtkSource.Buffer)(buf)) .set_language(lm.get_language(_this.file.language));
+
- this.el.set_mark_attributes ("DEPR", dattrs, 1);
+ Gtk.TextIter start;
+ Gtk.TextIter end;
+
+ sbuf.get_bounds (out start, out end);
+ sbuf.remove_source_marks (start, end, null); // remove all marks..
- var gattrs = new Gtk.SourceMarkAttributes();
- var grey = Gdk.RGBA();
- grey.parse ( "#ccc");
- gattrs.set_background ( grey);
-
+ if (_this.main_window.windowstate.last_compile_result != null) {
+ var obj = _this.main_window.windowstate.last_compile_result;
+ this.highlightErrorsJson("ERR", obj);
+ this.highlightErrorsJson("WARN", obj);
+ this.highlightErrorsJson("DEPR", obj);
+ }
+ // while (Gtk.events_pending()) {
+ // Gtk.main_iteration();
+ // }
- this.el.set_mark_attributes ("grey", gattrs, 1);
+ 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);
- }
-
- //listeners
- this.el.key_press_event.connect( (event) => {
-
- if (event.keyval == Gdk.Key.g && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-g pressed");
- _this.forwardSearch(true);
- return true;
- }
- if (event.keyval == Gdk.Key.f && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-f pressed");
- _this.search_entry.el.grab_focus();
- return true;
+ //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);
}
-
- return false;
- });
- }
-
- // user defined functions
- public void loadFile ( ) {
- this.loading = true;
- var buf = this.el.get_buffer();
- buf.set_text("",0);
- var sbuf = (Gtk.SourceBuffer) 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 = Gtk.SourceLanguageManager.get_default();
-
- //?? is javascript going to work as js?
-
- ((Gtk.SourceBuffer)(buf)) .set_language(lm.get_language(_this.file.language));
-
-
- Gtk.TextIter start;
- Gtk.TextIter end;
- sbuf.get_bounds (out start, out end);
- sbuf.remove_source_marks (start, end, null); // remove all marks..
-
-
- if (_this.main_window.windowstate.last_compile_result != null) {
- var obj = _this.main_window.windowstate.last_compile_result;
- this.highlightErrorsJson("ERR", obj);
- this.highlightErrorsJson("WARN", obj);
- this.highlightErrorsJson("DEPR", obj);
- }
- //while (Gtk.events_pending()) {
- // Gtk.main_iteration();
- // }
-
- this.loading = false;
- }
- public void nodeSelected (JsRender.Node? sel, bool scroll) {
-
-
-
- // this is connected in widnowstate
- print("Roo-view - node selected\n");
- var buf = this.el.get_buffer();
-
- var sbuf = (Gtk.SourceBuffer) buf;
-
-
- while(Gtk.events_pending()) {
- Gtk.main_iteration();
- }
-
-
- // clear all the marks..
- Gtk.TextIter start;
- Gtk.TextIter end;
+ 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);
+
+ }
+
+ }
- 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 void highlightErrorsJson (string type, Json.Object obj) {
+ Gtk.TextIter start;
+ Gtk.TextIter end;
+
+ var buf = this.el.get_buffer();
+ var sbuf = (GtkSource.Buffer)buf;
+ buf.get_bounds (out start, out end);
+ sbuf.remove_source_marks (start, end, type);
+
+
+ // we should highlight other types of errors..
+
+ if (!obj.has_member(type)) {
+ GLib.debug("Return has no errors\n");
+ return ;
+ }
+ var err = obj.get_object_member(type);
+
+ if (_this.file == null) {
+
+ return; // just in case the file has not loaded yet?
}
+
- }
+ var valafn = "";
+ try {
+ var regex = new Regex("\\.bjs$");
+
+
+ valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
+ } catch (GLib.RegexError e) {
+ return;
+ }
-
- }
- public void highlightErrorsJson (string type, Json.Object obj) {
- Gtk.TextIter start;
- Gtk.TextIter end;
-
- var buf = this.el.get_buffer();
- var sbuf = (Gtk.SourceBuffer)buf;
- buf.get_bounds (out start, out end);
+ if (!err.has_member(valafn)) {
+ GLib.debug("File path has no errors\n");
+ return ;
+ }
+ var lines = err.get_object_member(valafn);
+
+
+
+ var tlines = buf.get_line_count () +1;
+
+ lines.foreach_member((obj, line, node) => {
+
+ Gtk.TextIter iter;
+ // print("get inter\n");
+ var eline = int.parse(line) -1 ;
+ GLib.debug("GOT ERROR on line %s -- converted to %d\n", line,eline);
+
+
+ if (eline > tlines || eline < 0) {
+ return;
+ }
+ sbuf.get_iter_at_line( out iter, eline);
+ //print("mark line\n");
+ var msg = type + " on line: %d - %s".printf(eline+1, valafn);
+ var ar = lines.get_array_member(line);
+ for (var i = 0 ; i < ar.get_length(); i++) {
+ msg += (msg.length > 0) ? "\n" : "";
+ msg += ar.get_string_element(i);
+ }
+
+
+ sbuf.create_source_mark(msg, type, iter);
+ } );
+ return ;
- sbuf.remove_source_marks (start, end, type);
-
- // we should highlight other types of errors..
- if (!obj.has_member(type)) {
- print("Return has no errors\n");
- return ;
- }
- var err = obj.get_object_member(type);
- if (_this.file == null) {
- return; // just in case the file has not loaded yet?
}
-
-
- var valafn = "";
- try {
- var regex = new Regex("\\.bjs$");
-
-
- valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
- } catch (GLib.RegexError e) {
- return;
- }
-
- if (!err.has_member(valafn)) {
- print("File path has no errors\n");
- return ;
+ 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;
}
- var lines = err.get_object_member(valafn);
-
-
-
- var tlines = buf.get_line_count () +1;
-
- lines.foreach_member((obj, line, node) => {
+ }
+ 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( () => {
- Gtk.TextIter iter;
- // print("get inter\n");
- var eline = int.parse(line) -1 ;
- print("GOT ERROR on line %s -- converted to %d\n", line,eline);
-
+
+ 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);
- if (eline > tlines || eline < 0) {
+ var ln = cpos.get_line();
+
+ var node = _this.file.lineToNode(ln);
+
+ if (node == null) {
+ print("can not find node\n");
return;
}
- sbuf.get_iter_at_line( out iter, eline);
- //print("mark line\n");
- var msg = type + " on line: %d - %s".printf(eline+1, valafn);
- var ar = lines.get_array_member(line);
- for (var i = 0 ; i < ar.get_length(); i++) {
- msg += (msg.length > 0) ? "\n" : "";
- msg += ar.get_string_element(i);
- }
+ _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;
+ // });
+ // }
- sbuf.create_source_mark(msg, type, iter);
- } );
- return ;
-
-
-
-
- }
- 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;
+ // highlight the node..
+
+
+
+ });
+ }
+
+ // user defined functions
}
- }
- public class Xcls_buffer : Object
- {
- public Gtk.SourceBuffer el;
- private Xcls_GtkView _this;
+ public class Xcls_EventControllerKey12 : Object
+ {
+ public Gtk.EventControllerKey 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 Gtk.SourceBuffer( null );
+ // my vars (def)
- // my vars (dec)
- this.error_line = -1;
- this.dirty = false;
+ // ctor
+ public Xcls_EventControllerKey12(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.EventControllerKey();
- // set gobject values
- }
+ // my vars (dec)
- // user defined functions
- }
+ // 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_Box12 : Object
- {
- public Gtk.Box el;
- private Xcls_GtkView _this;
+ public class Xcls_Box13 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_GtkView _this;
- // my vars (def)
- // ctor
- public Xcls_Box12(Xcls_GtkView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+ // my vars (def)
- // my vars (dec)
+ // 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 );
+ }
- // set gobject values
- this.el.homogeneous = false;
- this.el.vexpand = false;
- var child_0 = new Xcls_search_entry( _this );
- child_0.ref();
- this.el.add( child_0.el );
- var child_1 = new Xcls_MenuBar14( _this );
- child_1.ref();
- this.el.add ( child_1.el );
- var child_2 = new Xcls_nextBtn( _this );
- child_2.ref();
- this.el.add( child_2.el );
- var child_3 = new Xcls_backBtn( _this );
- child_3.ref();
- this.el.add( child_3.el );
- var child_4 = new Xcls_MenuButton20( _this );
- child_4.ref();
- this.el.add( child_4.el );
+ // user defined functions
}
-
- // user defined functions
- }
- public class Xcls_search_entry : Object
- {
- public Gtk.SearchEntry el;
- private Xcls_GtkView _this;
+ public class Xcls_search_entry : Object
+ {
+ public Gtk.SearchEntry el;
+ private Xcls_GtkView _this;
- // my vars (def)
- public Gtk.CssProvider css;
+ // 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();
+ // ctor
+ public Xcls_search_entry(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.search_entry = this;
+ this.el = new Gtk.SearchEntry();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.width_request = 300;
- this.el.name = "gtkview-search-entry";
- this.el.hexpand = true;
- this.el.placeholder_text = "Press enter to search";
+ // 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
+ // init method
- this.css = new Gtk.CssProvider();
- try {
- this.css.load_from_data("#gtkview-search-entry { font: 10px Monospace;}");
- } catch (Error e) {}
- this.el.get_style_context().add_provider(this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
- //listeners
- this.el.key_press_event.connect( (event) => {
- if (event.keyval == Gdk.Key.g && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-g pressed");
- _this.forwardSearch(true);
- return true;
- }
+ this.css = new Gtk.CssProvider();
-
- if (event.keyval == Gdk.Key.Return && this.el.text.length > 0) {
- _this.search(this.el.text);
- _this.search_results.updateResults();
+ 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) {
- GLib.Timeout.add_seconds(2,() => {
- _this.search_results.updateResults();
- return false;
- });
-
-
- return true;
- }
- // print(event.key.keyval)
-
- return false;
+ _this.forwardSearch(change_focus);
+
+ /*
- });
- this.el.changed.connect( () => {
- /*
- if (this.el.text == "") {
- _this.search_results.el.hide();
- return;
- }
- var res = 0;
switch(_this.windowstate.state) {
case WindowState.State.CODEONLY:
- ///case WindowState.State.CODE:
+ //case WindowState.State.CODE:
// search the code being edited..
- res = _this.windowstate.code_editor_tab.search(this.el.text);
-
+ _this.windowstate.code_editor_tab.forwardSearch(change_focus);
+
break;
case WindowState.State.PREVIEW:
if (_this.windowstate.file.xtype == "Gtk") {
- res = _this.windowstate.window_gladeview.search(this.el.text);
+ _this.windowstate.window_gladeview.forwardSearch(change_focus);
} else {
- res = _this.windowstate.window_rooview.search(this.el.text);
+ _this.windowstate.window_rooview.forwardSearch(change_focus);
}
-
break;
}
- _this.search_results.el.show();
- if (res > 0) {
- _this.search_results.el.label = "%d Matches".printf(res);
- } else {
- _this.search_results.el.label = "No Matches";
- }
-
*/
- });
- }
-
- // 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_MenuBar14 : Object
- {
- public Gtk.MenuBar el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_MenuBar14(Xcls_GtkView _owner )
+ public class Xcls_EventControllerKey15 : Object
{
- _this = _owner;
- this.el = new Gtk.MenuBar();
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_search_results( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- }
-
- // user defined functions
- }
- public class Xcls_search_results : Object
- {
- public Gtk.MenuItem el;
- private Xcls_GtkView _this;
+ public Gtk.EventControllerKey el;
+ private Xcls_GtkView _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_search_results(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.search_results = this;
- this.el = new Gtk.MenuItem();
+ // ctor
+ public Xcls_EventControllerKey15(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.EventControllerKey();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.visible = false;
- this.el.show();
+ // set gobject values
- //listeners
- this.el.button_press_event.connect( () => {
- /*
- if (this.popup == null) {
- this.popup = new Xcls_ValaCompileErrors();
- this.popup.window = _this;
- }
-
+ //listeners
+ this.el.key_pressed.connect( (keyval, keycode, state) => {
- this.popup.show(this.notices, this.el);
- */
- return true;
- });
- }
+ 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 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";
-
+ // user defined functions
}
- }
- public class Xcls_nextBtn : Object
- {
- public Gtk.Button el;
- private Xcls_GtkView _this;
+ public class Xcls_search_results : Object
+ {
+ public Gtk.Label el;
+ private Xcls_GtkView _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_nextBtn(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.nextBtn = this;
- this.el = new Gtk.Button();
+ // ctor
+ public Xcls_search_results(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ _this.search_results = this;
+ this.el = new Gtk.Label( "No Results" );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.always_show_image = true;
- this.el.label = "Next";
- this.el.sensitive = false;
- var child_0 = new Xcls_Image17( _this );
- child_0.ref();
- this.el.image = child_0.el;
-
- //listeners
- this.el.button_press_event.connect( (event) => {
+ // 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;
- _this.forwardSearch(true);
+ 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";
- return true;
- });
+ }
}
- // user defined functions
- }
- public class Xcls_Image17 : Object
- {
- public Gtk.Image el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image17(Xcls_GtkView _owner )
+ public class Xcls_nextBtn : Object
{
- _this = _owner;
- this.el = new Gtk.Image();
-
- // my vars (dec)
-
- // set gobject values
- this.el.icon_name = "go-down";
- }
-
- // user defined functions
- }
+ public Gtk.Button el;
+ private Xcls_GtkView _this;
- public class Xcls_backBtn : 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 (def)
+ // my vars (dec)
+ this.always_show_image = true;
- // ctor
- public Xcls_backBtn(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.backBtn = this;
- this.el = new Gtk.Button();
+ // set gobject values
+ this.el.icon_name = "go-down";
+ this.el.sensitive = false;
- // my vars (dec)
+ //listeners
+ this.el.clicked.connect( ( ) => {
+ _this.forwardSearch(true);
+
+
+ });
+ }
- // set gobject values
- this.el.always_show_image = true;
- this.el.label = "Previous";
- this.el.sensitive = false;
- var child_0 = new Xcls_Image19( _this );
- child_0.ref();
- this.el.image = child_0.el;
-
- //listeners
- this.el.button_press_event.connect( (event) => {
-
- _this.backSearch(true);
-
- return true;
- });
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_Image19 : Object
- {
- public Gtk.Image el;
- private Xcls_GtkView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image19(Xcls_GtkView _owner )
+ public class Xcls_backBtn : Object
{
- _this = _owner;
- this.el = new Gtk.Image();
+ public Gtk.Button el;
+ private Xcls_GtkView _this;
- // my vars (dec)
- // set gobject values
- this.el.icon_name = "go-up";
- }
+ // my vars (def)
+ public bool always_show_image;
- // user defined functions
- }
+ // 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;
- public class Xcls_MenuButton20 : Object
- {
- public Gtk.MenuButton el;
- private Xcls_GtkView _this;
+ // set gobject values
+ this.el.icon_name = "go-up";
+ this.el.sensitive = false;
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ _this.backSearch(true);
+
+ });
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_MenuButton20(Xcls_GtkView _owner )
+ public class Xcls_MenuButton19 : Object
{
- _this = _owner;
- this.el = new Gtk.MenuButton();
-
- // my vars (dec)
-
- // set gobject values
- this.el.always_show_image = true;
- this.el.label = "Settings";
- var child_0 = new Xcls_Image21( _this );
- child_0.ref();
- this.el.image = child_0.el;
- var child_1 = new Xcls_search_settings( _this );
- child_1.ref();
- this.el.popup = child_1.el;
- }
+ public Gtk.MenuButton el;
+ private Xcls_GtkView _this;
- // user defined functions
- }
- public class Xcls_Image21 : Object
- {
- public Gtk.Image el;
- private Xcls_GtkView _this;
+ // my vars (def)
+ public bool always_show_image;
- // my vars (def)
+ // ctor
+ public Xcls_MenuButton19(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.MenuButton();
- // ctor
- public Xcls_Image21(Xcls_GtkView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
+ // my vars (dec)
+ this.always_show_image = true;
- // my vars (dec)
+ // 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;
+ }
- // set gobject values
- this.el.icon_name = "emblem-system";
+ // user defined functions
}
+ public class Xcls_search_settings : Object
+ {
+ public Gtk.PopoverMenu el;
+ private Xcls_GtkView _this;
- // user defined functions
- }
-
- public class Xcls_search_settings : Object
- {
- public Gtk.Menu el;
- private Xcls_GtkView _this;
+ // my vars (def)
- // 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);
- // ctor
- public Xcls_search_settings(Xcls_GtkView _owner )
- {
- _this = _owner;
- _this.search_settings = this;
- this.el = new Gtk.Menu();
+ // my vars (dec)
- // 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_0 = new Xcls_case_sensitive( _this );
- child_0.ref();
- this.el.append( child_0.el );
- var child_1 = new Xcls_regex( _this );
- child_1.ref();
- this.el.append( child_1.el );
- var child_2 = new Xcls_multiline( _this );
- child_2.ref();
- this.el.append( child_2.el );
+ // user defined functions
}
+ public class Xcls_Box21 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_GtkView _this;
- // user defined functions
- }
- public class Xcls_case_sensitive : Object
- {
- public Gtk.CheckMenuItem 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 );
+
+ // 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 );
+ }
- // ctor
- public Xcls_case_sensitive(Xcls_GtkView _owner )
+ // user defined functions
+ }
+ public class Xcls_case_sensitive : Object
{
- _this = _owner;
- _this.case_sensitive = this;
- this.el = new Gtk.CheckMenuItem();
+ public Gtk.CheckButton el;
+ private Xcls_GtkView _this;
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Case Sensitive";
- this.el.show();
- // init method
+ // my vars (def)
+ // ctor
+ public Xcls_case_sensitive(Xcls_GtkView _owner )
{
- this.el.show();
- }
- }
-
- // user defined functions
- }
+ _this = _owner;
+ _this.case_sensitive = this;
+ this.el = new Gtk.CheckButton();
- public class Xcls_regex : Object
- {
- public Gtk.CheckMenuItem el;
- private Xcls_GtkView _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.label = "Case Sensitive";
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_regex(Xcls_GtkView _owner )
+ public class Xcls_regex : Object
{
- _this = _owner;
- _this.regex = this;
- this.el = new Gtk.CheckMenuItem();
-
- // my vars (dec)
+ public Gtk.CheckButton el;
+ private Xcls_GtkView _this;
- // set gobject values
- this.el.label = "Regex";
- this.el.show();
- // init method
+ // my vars (def)
+ // ctor
+ public Xcls_regex(Xcls_GtkView _owner )
{
- this.el.show();
- }
- }
-
- // user defined functions
- }
+ _this = _owner;
+ _this.regex = this;
+ this.el = new Gtk.CheckButton();
- public class Xcls_multiline : Object
- {
- public Gtk.CheckMenuItem el;
- private Xcls_GtkView _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.label = "Regex";
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_multiline(Xcls_GtkView _owner )
+ public class Xcls_multiline : Object
{
- _this = _owner;
- _this.multiline = this;
- this.el = new Gtk.CheckMenuItem();
-
- // my vars (dec)
+ public Gtk.CheckButton el;
+ private Xcls_GtkView _this;
- // set gobject values
- this.el.label = "Multi-line (add \\n)";
- this.el.show();
- // init method
+ // my vars (def)
+ // ctor
+ public Xcls_multiline(Xcls_GtkView _owner )
{
- this.el.show();
+ _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
- }
-}
+ }
{
"build_module" : "builder",
+ "gen_extended" : false,
"items" : [
{
"# Project.Project project" : "null",
"# WindowState windowstate" : "",
- "# string title" : "\"Roo Application Builder\"",
"$ type" : "Gtk.WindowType.TOPLEVEL",
"$ xns" : "Gtk",
+ "* ctor" : "new Gtk.ApplicationWindow(BuilderApplication.singleton({}))",
"* init" : [
" ",
" ",
" this.el.set_icon_name(\"roobuilder\");",
+ " ",
+ " ",
+ " ",
" "
],
"border_width" : 0,
"id" : "MainWindow",
"items" : [
{
+ "$ string title" : "\"Application Builder\"",
"$ xns" : "Gtk",
"* pack" : "set_titlebar",
"bool show_close_button" : true,
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
"items" : [
{
- "# Gee.ArrayList<Gtk.MenuItem> mitems" : "",
+ "# Gee.ArrayList<Gtk.Widget> mitems" : "",
"$ Gtk.Align halign" : "Gtk.Align.START",
- "$ Gtk.ArrowType direction" : "Gtk.ArrowType.DOWN",
"$ xns" : "Gtk",
"* init" : [
"{",
- "\tthis.mitems = new Gee.ArrayList<Gtk.MenuItem>();",
- "\t",
+ "\tthis.mitems = new Gee.ArrayList<Gtk.Button>();",
"}",
""
],
- "bool always_show_image" : true,
- "bool use_popover" : false,
"id" : "windowbtn",
"int margin_end" : 4,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "set_image",
- "utf8 icon_name" : "window-new",
- "xtype" : "Image"
+ "* pack" : false,
+ "id" : "windowspopup",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "set_child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "id" : "popover_menu",
+ "int spacing" : 0,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "append",
+ "items" : [
+ {
+ "$ Gtk.ShortcutScope scope" : "Gtk.ShortcutScope.GLOBAL",
+ "$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ "\tthis.el.add_shortcut(",
+ "\t\tnew Gtk.Shortcut(",
+ "\t\t\tnew Gtk.KeyvalTrigger(Gdk.Key.N,Gdk.ModifierType.CONTROL_MASK),",
+ "\t\t\tnew Gtk.SignalAction(\"clicked\")",
+ "\t\t)",
+ "\t);",
+ "}",
+ ""
+ ],
+ "xtype" : "ShortcutController"
+ }
+ ],
+ "listeners" : {
+ "clicked" : [
+ "( ) => {",
+ "\t_this.windowspopup.el.hide();",
+ "\t_this.windowstate.showPopoverFiles(_this.windowbtn.el, _this.project, true);",
+ "}",
+ ""
+ ]
+ },
+ "string label" : "New Window",
+ "xtype" : "Button"
+ },
+ {
+ "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "$ xns" : "Gtk",
+ "* pack" : "append",
+ "xtype" : "Separator"
+ }
+ ],
+ "xtype" : "Box"
+ }
+ ],
+ "xtype" : "Popover"
},
{
"$ xns" : "Gtk",
- "* init" : [
- " ",
- " this.el.show_all();",
- " "
- ],
- "* prop" : "popup",
+ "* prop" : "child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "append",
- "listeners" : {
- "activate" : [
- "( ) => {",
- "",
- "\t_this.windowstate.showPopoverFiles(_this.windowbtn.el, _this.project, true);",
- "}",
- ""
- ]
- },
- "string label" : "New Window",
- "xtype" : "MenuItem"
+ "int margin_start" : 4,
+ "string icon_name" : "window-new",
+ "xtype" : "Image"
},
{
"$ xns" : "Gtk",
- "* pack" : "append",
- "xtype" : "SeparatorMenuItem"
+ "string label" : "Windows (Add/List)",
+ "xtype" : "Label"
}
],
- "xtype" : "Menu"
+ "xtype" : "Box"
}
],
- "string label" : "Windows",
- "xtype" : "MenuButton",
+ "listeners" : {
+ "clicked" : [
+ "( ) => {",
+ "\tthis.updateMenu();",
+ "",
+ "\t _this.windowspopup.el.set_parent(this.el);",
+ "",
+ "\t _this.windowspopup.el.set_position(Gtk.PositionType.BOTTOM); ",
+ "\t _this.windowspopup.el.popup(); ",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "Button",
"| void updateMenu" : [
"() {",
"\t foreach(var m in this.mitems) {",
- "\t \t this.el.popup.remove(m);",
+ "\t \t _this.popover_menu.el.remove(m);",
"\t }",
"\t this.mitems.clear();",
- "\t ",
+ "\t",
"\t BuilderApplication.windows.sort((a,b) => {",
"\t \tif (a.windowstate == null ||",
" \t\t\t a.windowstate.file == null || ",
"\t \tif (ap != bp) {",
"\t \t\treturn ap.collate(bp);",
"\t \t}",
- "\t \tvar af = a.windowstate.file.getTitle();",
- "\t \tvar bf = b.windowstate.file.getTitle();\t \t",
+ "\t \tvar af = a.windowstate.file == null ? \"\" : a.windowstate.file.getTitle();",
+ "\t \tvar bf = b.windowstate.file == null ? \"\" : b.windowstate.file.getTitle();\t \t",
"\t\treturn af.collate(bf);",
"\t ",
"\t });",
"\t \t\tcontinue;",
" \t\t}",
" \t\tif (w.windowstate.file.project.name != p || p != \"\") {",
- " \t\t\tvar ms = new Gtk.SeparatorMenuItem();",
- " \t\t\tthis.el.popup.append(ms);",
+ " \t\t\tvar ms = new Gtk.Separator(Gtk.Orientation.HORIZONTAL);",
+ " \t\t\t_this.popover_menu.el.append(ms);",
"\t\t \tms.show();",
"\t\t \tthis.mitems.add(ms);",
" \t\t}",
" \t\t",
" \t\t",
" \t\t",
- "\t \tvar m = new Gtk.MenuItem.with_label(",
- "\t\t \tw.windowstate.file.project.name + \" : \" + w.windowstate.file.getTitle()",
+ "\t \tvar m = new Gtk.Button.with_label(",
+ "\t\t \tw.windowstate.file.project.name + \" : \" + w.windowstate.file.relpath",
"\t \t);",
+ "\t \tm.halign = Gtk.Align.START;",
+ "\t \t",
"\t \t",
"\t \t//w.windowstate.file.path);",
- "\t \tm.activate.connect(() => {",
+ "\t \tm.clicked.connect(() => {",
+ "\t\t \t_this.windowspopup.el.hide();",
"\t \t\t BuilderApplication.windows.get(wid).el.present();",
"\t \t});",
- "\t \tthis.el.popup.append(m);",
- "\t \tm.show();",
+ "\t \t_this.popover_menu.el.append(m);",
+ "\t \t//m.show();",
"\t \tthis.mitems.add(m);",
"\t }",
"}"
]
},
{
- "$ tooltop_text" : "\"Open File\"",
"$ xns" : "Gtk",
- "* pack" : "add",
+ "* pack" : "append",
"bool always_show_image" : true,
"id" : "open_projects_btn",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "set_image",
- "utf8 icon_name" : "system-file-manager",
- "xtype" : "Image"
- }
- ],
"listeners" : {
"clicked" : [
" ( ) => {",
" \t_this.windowstate.showPopoverFiles(this.el, _this.project, false);",
- "",
"}"
]
},
+ "string icon_name" : "system-file-manager",
"string label" : "Files / Projects",
+ "tooltop_text" : "\"Open File\"",
"xtype" : "Button"
}
],
"xtype" : "Box"
}
],
- "string title" : "Application Builder",
"xtype" : "HeaderBar"
},
{
- "$ homogeneous" : false,
"$ xns" : "Gtk",
- "* pack" : "add",
+ "* pack" : "set_child",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool homogeneous" : false,
+ "bool vexpand" : true,
"id" : "vbox",
"items" : [
{
"# int lastWidth" : 0,
"$ xns" : "Gtk",
- "* pack" : "pack_start,true,true,0",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "bool hexpand" : true,
+ "bool vexpand" : true,
"id" : "mainpane",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
+ "* prop" : "start_child",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "bool hexpand" : true,
+ "bool vexpand" : true,
"id" : "leftpane",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true,true,0",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
"id" : "editpane",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add1",
+ "* prop" : "start_child",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool hexpand" : true,
+ "bool vexpand" : true,
"id" : "tree",
"xtype" : "Box"
},
{
"$ xns" : "Gtk",
- "* pack" : "add2",
+ "* prop" : "end_child",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool hexpand" : true,
+ "bool vexpand" : true,
"id" : "props",
"xtype" : "Box"
}
],
"listeners" : {
"accept_position" : [
- "() => {",
- "\tGLib.debug(\"Accept postion\");",
+ "( ) => {",
+ "\t_this.windowstate.left_tree.onresize();",
"\treturn true;",
- "}"
+ "}",
+ ""
],
"move_handle" : [
"(scroll) => {",
},
{
"$ xns" : "Gtk",
- "* pack" : "add2",
+ "* prop" : "end_child",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool hexpand" : true,
+ "bool vexpand" : true,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool hexpand" : true,
"bool vexpand" : true,
"id" : "rooviewbox",
"xtype" : "Box"
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool hexpand" : true,
"bool vexpand" : true,
"id" : "codeeditviewbox",
"xtype" : "Box"
"xtype" : "Box"
}
],
+ "listeners" : {
+ "accept_position" : [
+ "( ) => {",
+ "\t_this.windowstate.left_tree.onresize();",
+ "\treturn true;",
+ "}",
+ ""
+ ]
+ },
"position" : 400,
"xtype" : "Paned"
},
{
"$ xns" : "Gtk",
- "* pack" : "pack_end,false,true,0",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
"bool homogeneous" : false,
+ "bool vexpand" : false,
"items" : [
{
"$ tooltip_text" : "\"Project Details\"",
"$ xns" : "Gtk",
- "* pack" : "add",
"bool always_show_image" : true,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "set_image",
- "utf8 icon_name" : "emblem-system",
- "xtype" : "Image"
- }
- ],
"listeners" : {
"clicked" : [
" ( ) => {",
" ",
- " _this.windowstate.projectPopoverShow(this.el, _this.project);",
+ " _this.windowstate.projectPopoverShow(_this.el, null);",
" ",
" ",
"}"
]
},
+ "string icon_name" : "emblem-system",
"string label" : "Edit Project Settings",
"xtype" : "Button"
},
{
"$ tooltip_text" : "\"File Details\"",
"$ xns" : "Gtk",
- "* pack" : "add",
"bool always_show_image" : true,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "set_image",
- "utf8 icon_name" : "document-properties",
- "xtype" : "Image"
- }
- ],
"listeners" : {
"clicked" : [
" ( ) => {",
" return ;",
" }",
" _this.windowstate.file_details.show(",
- " _this.windowstate.file, this.el, false",
+ " _this.windowstate.file, _this.el, false",
" );",
" ",
" return ; ",
"}"
]
},
+ "string icon_name" : "document-properties",
"string label" : "Edit File Properties",
"xtype" : "Button"
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
"bool always_show_image" : true,
"items" : [
{
"$ xns" : "Gtk",
+ "* ctor" : "new Gtk.PopoverMenu.from_model(null)",
"* init" : [
"{",
- " this.el.show_all();",
+ " // this.el.show();",
"}",
""
],
- "* pack" : "set_popup",
+ "* prop" : "popover",
"id" : "topbarmenu",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "append",
- "listeners" : {
- "activate" : [
- " ( ) => {",
- " Resources.singleton().fetchStart();",
- "}"
- ]
- },
- "string label" : "Download updated Resources",
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append",
- "listeners" : {
- "activate" : [
- "() => {",
- " About.singleton().el.show();",
- " }"
- ]
- },
- "string label" : "About the Builder",
- "xtype" : "MenuItem"
+ "* pack" : "set_child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "int spacing" : 0,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "activate" : [
+ " ( ) => {",
+ " Resources.singleton().fetchStart();",
+ "}"
+ ]
+ },
+ "string label" : "Download updated Resources",
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "clicked" : [
+ "() => {",
+ " About.singleton().el.show();",
+ " }"
+ ]
+ },
+ "string label" : "About the Builder",
+ "xtype" : "Button"
+ }
+ ],
+ "xtype" : "Box"
}
],
- "xtype" : "Menu"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "set_image",
- "utf8 icon_name" : "dialog-information",
- "xtype" : "Image"
+ "xtype" : "PopoverMenu"
}
],
+ "string icon_name" : "dialog-information",
"string label" : "About",
"xtype" : "MenuButton"
},
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true,true,0",
+ "bool hexpand" : true,
"string label" : " ",
"xtype" : "Label"
},
"}",
""
],
- "* pack" : "pack_start,true,true,0",
"bool show_text" : true,
"id" : "statusbar",
"ulong handler_id" : "-1",
"xtype" : "ProgressBar"
},
{
+ "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
"$ xns" : "Gtk",
- "* pack" : "add",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
"id" : "statusbar_compilestatus_label",
+ "int margin_end" : 4,
+ "int margin_start" : 4,
"string label" : "Compile Status:",
- "xtype" : "MenuItem"
+ "xtype" : "Label"
},
{
- "# Json.Object notices" : "new Json.Object() ",
+ "# GLib.ListStore notices" : "null",
"$ xns" : "Gtk",
- "* pack" : "add",
"Xcls_ValaCompileErrors popup" : "",
"id" : "statusbar_errors",
- "items" : [
- {
- "$ xns" : "Gtk",
- "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "int spacing" : 2,
- "items" : [
- {
- "$ xns" : "Gtk",
- "utf8 icon_name" : "dialog-error",
- "xtype" : "Image"
- },
- {
- "$ xns" : "Gtk",
- "id" : "statusbar_errors_label",
- "string label" : "Errors",
- "xtype" : "Label"
- }
- ],
- "xtype" : "Box"
- }
- ],
"listeners" : {
- "button_press_event" : [
+ "clicked" : [
"() => {",
+ " ",
+ "",
+ " ",
" if (this.popup == null) {",
" this.popup = new Xcls_ValaCompileErrors();",
" this.popup.window = _this;",
+ " //this.popup.el.application = _this.el.application;",
+ "\t // this.popup.el.set_transient_for( _this.el );",
+ " this.popup.el.set_parent(this.el);",
" }",
- " ",
- " ",
+ " if (_this.statusbar_compile_spinner.el.spinning) {",
+ "\t\tthis.popup.el.show(); \t",
+ " \treturn;",
+ "\t} ",
" this.popup.show(this.notices, this.el);",
- " return true;",
+ " return;",
"}"
]
},
- "xtype" : "MenuItem",
+ "string icon_name" : "dialog-error",
+ "string label" : "0 Errors",
+ "xtype" : "Button",
"| void setNotices" : [
- "(Json.Object nots, int qty) {",
- " this.el.show_all();",
- " _this.statusbar_errors_label.el.label = qty.to_string() + \" Errors\";",
+ "(GLib.ListStore nots, int qty, int tf) {",
+ " ",
+ " if (qty < 1 ) {",
+ " \tthis.el.hide();",
+ " \tif (this.popup != null && this.popup.el.visible) {",
+ " \t\tthis.popup.el.hide();",
+ "\t\t}",
+ " \treturn;",
+ " }",
+ " ",
+ " this.el.show();",
+ " this.el.label = \"%d/%d Errors\".printf(tf,qty);",
" this.notices = nots;",
- "",
+ "\tif (this.popup != null && this.popup.el.visible) {",
+ "\t\t this.popup.show(this.notices, this.el);",
+ " }",
"}",
""
]
},
{
- "# Json.Object notices" : "new Json.Object()",
+ "# GLib.ListStore notices" : "null",
"$ xns" : "Gtk",
- "* pack" : "add",
"Xcls_ValaCompileErrors popup" : "",
"id" : "statusbar_warnings",
- "items" : [
- {
- "$ xns" : "Gtk",
- "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "int spacing" : 2,
- "items" : [
- {
- "$ xns" : "Gtk",
- "utf8 icon_name" : "dialog-warning",
- "xtype" : "Image"
- },
- {
- "$ xns" : "Gtk",
- "id" : "statusbar_warnings_label",
- "string label" : "Errors",
- "xtype" : "Label"
- }
- ],
- "xtype" : "Box"
- }
- ],
"listeners" : {
- "button_press_event" : [
+ "clicked" : [
"() => {",
- " if (this.popup == null) {",
+ " ",
+ "\tif (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);",
" }",
- " ",
+ " if (_this.statusbar_compile_spinner.el.spinning) {",
+ "\t\tthis.popup.el.show(); \t",
+ " \treturn;",
+ "\t} ",
" this.popup.show(this.notices, this.el);",
- " return true;",
+ " return;",
"}"
]
},
- "xtype" : "MenuItem",
+ "string icon_name" : "dialog-warning",
+ "string label" : "0 Warnings",
+ "xtype" : "Button",
"| void setNotices" : [
- "(Json.Object nots, int qty) {",
- " this.el.show_all();",
- " _this.statusbar_warnings_label.el.label = qty.to_string() + \" Warnings\";",
- " this.notices = nots;",
+ "(GLib.ListStore nots, int qty, int tf) {",
+ " ",
+ " if (qty < 1 ) {",
+ " \tthis.el.hide();",
+ " \tif (this.popup != null && this.popup.el.visible) {",
+ " \t\tthis.popup.el.hide();",
+ "\t\t}",
+ " \treturn;",
+ " }",
+ " this.el.show();",
+ " this.el.label = \"%d/%d Warnings\".printf(tf,qty);",
+ " this.notices = nots;",
+ " if (this.popup != null && this.popup.el.visible) {",
+ "\t\t this.popup.show(this.notices, this.el);",
+ " }",
+ " ",
"",
"}",
""
]
},
{
- "# Json.Object notices" : "new Json.Object()",
+ "# GLib.ListStore notices" : "null",
"$ xns" : "Gtk",
- "* pack" : "add",
"Xcls_ValaCompileErrors popup" : "",
"id" : "statusbar_depricated",
- "items" : [
- {
- "$ xns" : "Gtk",
- "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "int spacing" : 2,
- "items" : [
- {
- "$ xns" : "Gtk",
- "utf8 icon_name" : "dialog-information",
- "xtype" : "Image"
- },
- {
- "$ xns" : "Gtk",
- "id" : "statusbar_depricated_label",
- "string label" : "Errors",
- "xtype" : "Label"
- }
- ],
- "xtype" : "Box"
- }
- ],
"listeners" : {
- "button_press_event" : [
+ "clicked" : [
"() => {",
- " if (this.popup == null) {",
+ " ",
+ "\tif (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);",
" }",
- " ",
+ " if (_this.statusbar_compile_spinner.el.spinning) {",
+ "\t\tthis.popup.el.show(); \t",
+ " \treturn;",
+ "\t} ",
" ",
" this.popup.show(this.notices, this.el);",
- " return true;",
+ " return;",
"}"
]
},
- "xtype" : "MenuItem",
+ "string icon_name" : "dialog-information",
+ "string label" : "0 Depricated",
+ "xtype" : "Button",
"| void setNotices" : [
- "(Json.Object nots, int qty) {",
- " this.el.show_all();",
- " _this.statusbar_depricated_label.el.label = qty.to_string() + \" Depricated\";",
+ "(GLib.ListStore nots, int qty, int tf) {",
+ " if (qty < 1) {",
+ " \tthis.el.hide();",
+ " \tif (this.popup != null && this.popup.el.visible) {",
+ "\t\t\t this.popup.el.hide();",
+ "\t\t}",
+ " ",
+ " \treturn;",
+ "\t}",
+ " ",
+ " this.el.show();",
+ " ",
+ " this.el.label = \"%d/%d Depricated\".printf(tf,qty);",
" this.notices = nots;",
- "",
+ "\tif (this.popup != null && this.popup.el.visible) {",
+ "\t\t this.popup.show(this.notices, this.el);",
+ " }",
"}",
""
]
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
"Xcls_ValaCompileErrors popup" : "",
"id" : "statusbar_run",
- "items" : [
- {
- "$ xns" : "Gtk",
- "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "int spacing" : 2,
- "items" : [
- {
- "$ xns" : "Gtk",
- "utf8 icon_name" : "media-playback-start",
- "xtype" : "Image"
- },
- {
- "$ xns" : "Gtk",
- "string label" : "Run",
- "xtype" : "Label"
- }
- ],
- "xtype" : "Box"
- }
- ],
"listeners" : {
- "button_press_event" : [
+ "clicked" : [
"() => {",
- "\tif (_this.windowstate.file == null) {",
- "\t\treturn true;",
+ " ",
+ " if (_this.windowstate.file == null) {",
+ "\t\treturn;",
"\t}",
- "\tBuilderApplication.valasource.spawnExecute(_this.windowstate.file);",
- "\t",
+ " if (_this.statusbar_compile_spinner.el.spinning) {",
+ " \t_this.windowstate.compile_results.el.set_parent(this.el);",
+ "\t _this.windowstate.compile_results.el.show(); // show currently running.",
+ " \treturn;",
+ "\t}",
+ "\tBuilderApplication.valacompilequeue.addFile( ",
+ "\t \t\t\t\t\tPalete.ValaCompileRequestType.RUN, ",
+ "\t \t\t\t\t\t_this.windowstate.file, \"\", true ) ;",
+ "",
+ "\t_this.windowstate.compile_results.el.set_parent(this.el);",
"\t_this.windowstate.compile_results.show(this.el,true);",
- "\t",
- "\treturn true;",
+ "\t ",
"}"
]
},
- "xtype" : "MenuItem"
+ "string icon_name" : "media-playback-start",
+ "string label" : "Run",
+ "xtype" : "Button"
}
],
- "xtype" : "MenuBar"
+ "xtype" : "Box"
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
"id" : "statusbar_compile_spinner",
+ "int margin_end" : 4,
+ "int margin_start" : 4,
"string tooltip_text" : "Compiling",
"xtype" : "Spinner",
"| void start" : [
"() {",
" this.el.show();",
" this.el.start(); ",
+ " ",
+ "\t ",
"}",
""
],
"() {",
" this.el.stop();",
" this.el.hide();",
+ " ",
"}",
""
]
}
],
"listeners" : {
- "delete_event" : [
- "( event) => {",
- " return false;",
- "} "
+ "close_request" : [
+ "( ) => {",
+ "",
+ "\treturn false;",
+ "}",
+ ""
],
- "destroy" : [
+ "hide" : [
"() => {",
" ",
" ",
" ",
" if (BuilderApplication.windows.size < 1) {",
"",
- " Gtk.main_quit();",
+ " BuilderApplication.singleton( null ).quit();",
" }",
"}"
],
- "key_release_event" : [
- " (event) => {",
- " ",
- " ",
- "\t",
- "\tif (event.keyval == Gdk.Key.n && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
- "\t\tprint(\"SAVE: ctrl-n pressed\");",
- "\t\t_this.windowstate.showPopoverFiles(_this.windowbtn.el, _this.project, true);",
- "\t\treturn false;",
- "\t}",
- "\t",
- " // print(event.key.keyval)",
- " ",
- " return false;",
- "",
- "} ",
- "",
- ""
- ],
"show" : [
" ( ) => {",
" // hide the file editing..",
" ",
" //this.hideViewEditing();",
- " _this.statusbar.el.hide();",
- " _this.statusbar_errors.el.hide();",
- " _this.statusbar_warnings.el.hide();",
- " _this.statusbar_depricated.el.hide();",
+ " // 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();",
+ " ",
+ " ",
"",
"}"
]
},
- "xtype" : "Window",
+ "string title" : "Roo Application Builder",
+ "xtype" : "ApplicationWindow",
"| void initChildren" : [
" () {",
" // this needs putting in a better place..",
" var w = new Xcls_MainWindow();",
" w.ref();",
"\tBuilderApplication.addWindow(w);",
- " w.el.show_all();",
+ " w.el.show();",
" w.initChildren();",
" w.windowstate.showPopoverFiles(w.open_projects_btn.el, _this.project, false);",
" ",
""
],
"| void setTitle" : [
- " (string str) {",
- " this.headerbar.el.set_title(this.title + \" - \" + str);",
- "} ",
- ""
+ " () {",
+ " if (_this.windowstate.project == null || ",
+ "\t _this.windowstate.file == null",
+ " ) {",
+ " \tthis.el.set_title(\"Select File\");",
+ " \treturn;",
+ "\t}",
+ " _this.el.set_title(",
+ " \t_this.windowstate.project.name + ",
+ " \t\" - \" +",
+ "\t\t_this.windowstate.file.relpath);",
+ "} "
],
"| void show" : [
"() {",
" ",
- " this.el.show_all();",
+ " this.el.show();",
+ " if (this.windowstate.file == null) {",
+ " \tthis.windowstate.showPopoverFiles(this.open_projects_btn.el, null, false);",
+ " }",
+ "}"
+ ],
+ "| void updateErrors" : [
+ "(Palete.ValaCompileRequest? req) {",
"",
+ "\tif (req == null) {",
+ " ",
+ "\t _this.statusbar_errors.el.hide();",
+ "\t\t_this.statusbar_warnings.el.hide();",
+ "\t\t_this.statusbar_depricated.el.hide();",
+ "\t\treturn;",
+ "\t}",
+ "\t",
+ "\t",
+ "\tthis.statusbar_errors.setNotices(",
+ "\t\treq.errorByType.get(\"ERR\"),",
+ "\t\treq.totalErrors(\"ERR\"),",
+ "\t\treq.totalErrors(\"ERR\", this.windowstate.file)",
+ "\t);",
+ "\tthis.statusbar_warnings.setNotices(",
+ "\t\treq.errorByType.get(\"WARN\"),",
+ "\t\treq.totalErrors(\"WARN\"),",
+ "\t\treq.totalErrors(\"WARN\", this.windowstate.file)",
+ "\t);",
+ "\tthis.statusbar_depricated.setNotices(",
+ "\t\treq.errorByType.get(\"DEPR\"),",
+ "\t\treq.totalErrors(\"DEPR\"),",
+ "\t\treq.totalErrors(\"DEPR\", this.windowstate.file)",
+ "\t);",
"}"
]
}
],
- "modOrder" : "",
- "name" : "MainWindow",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/MainWindow.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "MainWindow"
}
\ No newline at end of file
-static Xcls_MainWindow _MainWindow;
+ static Xcls_MainWindow _MainWindow;
-public class Xcls_MainWindow : Object
-{
- public Gtk.Window 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_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_errors_label statusbar_errors_label;
- public Xcls_statusbar_warnings statusbar_warnings;
- public Xcls_statusbar_warnings_label statusbar_warnings_label;
- public Xcls_statusbar_depricated statusbar_depricated;
- public Xcls_statusbar_depricated_label statusbar_depricated_label;
- public Xcls_statusbar_run statusbar_run;
- public Xcls_statusbar_compile_spinner statusbar_compile_spinner;
-
- // my vars (def)
- public string title;
- public WindowState windowstate;
- public Project.Project project;
-
- // ctor
- public Xcls_MainWindow()
- {
- _this = this;
- this.el = new Gtk.Window( Gtk.WindowType.TOPLEVEL );
-
- // my vars (dec)
- this.title = "Roo Application Builder";
- this.project = null;
-
- // set gobject values
- this.el.border_width = 0;
- this.el.default_height = 850;
- this.el.default_width = 1200;
- var child_0 = new Xcls_headerbar( _this );
- child_0.ref();
- this.el.set_titlebar ( child_0.el );
- var child_1 = new Xcls_vbox( _this );
- child_1.ref();
- this.el.add ( child_1.el );
-
- // init method
-
- this.el.set_icon_name("roobuilder");
-
- //listeners
- this.el.delete_event.connect( ( event) => {
- return false;
- });
- this.el.destroy.connect( () => {
-
-
- Resources.singleton().disconnect(_this.statusbar.handler_id);
-
- BuilderApplication.removeWindow(this);
-
- if (BuilderApplication.windows.size < 1) {
-
- Gtk.main_quit();
- }
- });
- this.el.show.connect( ( ) => {
- // hide the file editing..
-
- //this.hideViewEditing();
- _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.key_release_event.connect( (event) => {
-
-
-
- if (event.keyval == Gdk.Key.n && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- print("SAVE: ctrl-n pressed");
- _this.windowstate.showPopoverFiles(_this.windowbtn.el, _this.project, true);
- return false;
- }
-
- // print(event.key.keyval)
-
- return false;
-
- });
- }
-
- // user defined functions
- public void initChildren () {
- // this needs putting in a better place..
- this.windowstate = new WindowState(this);
-
-
-
-
-
-
-
-
- }
- public void show () {
-
- this.el.show_all();
-
- }
- public void setTitle (string str) {
- this.headerbar.el.set_title(this.title + " - " + str);
- }
- public void openNewWindow () {
-
- var w = new Xcls_MainWindow();
- w.ref();
- BuilderApplication.addWindow(w);
- w.el.show_all();
- w.initChildren();
- w.windowstate.showPopoverFiles(w.open_projects_btn.el, _this.project, false);
-
- }
- public class Xcls_headerbar : Object
- {
- public Gtk.HeaderBar el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_headerbar(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.headerbar = this;
- this.el = new Gtk.HeaderBar();
-
- // my vars (dec)
-
- // set gobject values
- this.el.title = "Application Builder";
- this.el.show_close_button = true;
- var child_0 = new Xcls_Box3( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el );
- }
-
- // user defined functions
- }
- public class Xcls_Box3 : Object
+ public class Xcls_MainWindow : Object
{
- public Gtk.Box el;
+ public Gtk.ApplicationWindow el;
private Xcls_MainWindow _this;
-
- // my vars (def)
-
- // ctor
- public Xcls_Box3(Xcls_MainWindow _owner )
+ public static Xcls_MainWindow singleton()
{
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_windowbtn( _this );
- child_0.ref();
- this.el.add( child_0.el );
- var child_1 = new Xcls_open_projects_btn( _this );
- child_1.ref();
- this.el.add ( child_1.el );
- }
-
- // user defined functions
- }
- public class Xcls_windowbtn : Object
- {
- public Gtk.MenuButton el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
- public Gee.ArrayList<Gtk.MenuItem> mitems;
-
- // ctor
- public Xcls_windowbtn(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.windowbtn = this;
- this.el = new Gtk.MenuButton();
-
- // my vars (dec)
-
- // set gobject values
- this.el.margin_end = 4;
- this.el.halign = Gtk.Align.START;
- this.el.direction = Gtk.ArrowType.DOWN;
- this.el.use_popover = false;
- this.el.always_show_image = true;
- this.el.label = "Windows";
- var child_0 = new Xcls_Image5( _this );
- child_0.ref();
- this.el.set_image ( child_0.el );
- var child_1 = new Xcls_Menu6( _this );
- child_1.ref();
- this.el.popup = child_1.el;
-
- // init method
-
- {
- this.mitems = new Gee.ArrayList<Gtk.MenuItem>();
-
+ if (_MainWindow == null) {
+ _MainWindow= new Xcls_MainWindow();
}
+ return _MainWindow;
}
-
- // user defined functions
- public void updateMenu () {
- foreach(var m in this.mitems) {
- this.el.popup.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.getTitle();
- var bf = 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.SeparatorMenuItem();
- this.el.popup.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.MenuItem.with_label(
- w.windowstate.file.project.name + " : " + w.windowstate.file.getTitle()
- );
-
- //w.windowstate.file.path);
- m.activate.connect(() => {
- BuilderApplication.windows.get(wid).el.present();
- });
- this.el.popup.append(m);
- m.show();
- this.mitems.add(m);
- }
- }
- }
- public class Xcls_Image5 : Object
- {
- public Gtk.Image el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image5(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
-
- // my vars (dec)
-
- // set gobject values
- this.el.icon_name = "window-new";
- }
-
- // user defined functions
- }
-
- public class Xcls_Menu6 : Object
- {
- public Gtk.Menu el;
- private Xcls_MainWindow _this;
-
+ 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_Menu6(Xcls_MainWindow _owner )
+ public Xcls_MainWindow()
{
- _this = _owner;
- this.el = new Gtk.Menu();
+ _this = this;
+ this.el = new Gtk.ApplicationWindow(BuilderApplication.singleton({}));
// my vars (dec)
+ this.project = null;
// set gobject values
- var child_0 = new Xcls_MenuItem7( _this );
- child_0.ref();
- this.el.append ( child_0.el );
- var child_1 = new Xcls_SeparatorMenuItem8( _this );
- child_1.ref();
- this.el.append ( child_1.el );
+ 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.show_all();
- }
-
- // user defined functions
- }
- public class Xcls_MenuItem7 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_MenuItem7(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "New Window";
- this.el.show();
+ this.el.set_icon_name("roobuilder");
//listeners
- this.el.activate.connect( ( ) => {
+ this.el.close_request.connect( ( ) => {
- _this.windowstate.showPopoverFiles(_this.windowbtn.el, _this.project, true);
+ return false;
});
- }
-
- // user defined functions
- }
-
- public class Xcls_SeparatorMenuItem8 : Object
- {
- public Gtk.SeparatorMenuItem el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SeparatorMenuItem8(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.SeparatorMenuItem();
-
- // my vars (dec)
-
- // set gobject values
- this.el.show();
- }
-
- // user defined functions
- }
-
-
-
- public class Xcls_open_projects_btn : Object
- {
- public Gtk.Button el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_open_projects_btn(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.open_projects_btn = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.always_show_image = true;
- this.el.label = "Files / Projects";
- var child_0 = new Xcls_Image10( _this );
- child_0.ref();
- this.el.set_image ( child_0.el );
-
- //listeners
- this.el.clicked.connect( ( ) => {
- _this.windowstate.showPopoverFiles(this.el, _this.project, false);
+ 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();
+
+
});
- }
-
- // user defined functions
- }
- public class Xcls_Image10 : Object
- {
- public Gtk.Image el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image10(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
-
- // my vars (dec)
-
- // set gobject values
- this.el.icon_name = "system-file-manager";
- }
-
- // user defined functions
- }
-
-
-
-
- public class Xcls_vbox : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_vbox(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.vbox = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- var child_0 = new Xcls_mainpane( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true,true,0 );
- var child_1 = new Xcls_Box20( _this );
- child_1.ref();
- this.el.pack_end ( child_1.el , false,true,0 );
- }
-
- // 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 (dec)
- this.lastWidth = 0;
-
- // set gobject values
- this.el.position = 400;
- var child_0 = new Xcls_leftpane( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_Box17( _this );
- child_1.ref();
- this.el.add2 ( child_1.el );
- }
-
- // 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
- var child_0 = new Xcls_editpane( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true,true,0 );
- }
-
- // 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
- var child_0 = new Xcls_tree( _this );
- child_0.ref();
- this.el.add1 ( child_0.el );
- var child_1 = new Xcls_props( _this );
- child_1.ref();
- this.el.add2 ( child_1.el );
-
- //listeners
- this.el.accept_position.connect( () => {
- GLib.debug("Accept postion");
- return true;
- });
- this.el.move_handle.connect( (scroll) => {
- GLib.debug("Move handle");
- return true;
+ this.el.hide.connect( () => {
+
+
+ Resources.singleton().disconnect(_this.statusbar.handler_id);
+
+ BuilderApplication.removeWindow(this);
+
+ if (BuilderApplication.windows.size < 1) {
+
+ BuilderApplication.singleton( null ).quit();
+ }
});
}
// 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
- }
-
- // user defined functions
- }
-
- public class Xcls_props : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_props(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.props = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
+ public void updateErrors (Palete.ValaCompileRequest? req) {
+
+ if (req == null) {
+
+ _this.statusbar_errors.el.hide();
+ _this.statusbar_warnings.el.hide();
+ _this.statusbar_depricated.el.hide();
+ return;
+ }
+
+
+ this.statusbar_errors.setNotices(
+ req.errorByType.get("ERR"),
+ req.totalErrors("ERR"),
+ req.totalErrors("ERR", this.windowstate.file)
+ );
+ this.statusbar_warnings.setNotices(
+ req.errorByType.get("WARN"),
+ req.totalErrors("WARN"),
+ req.totalErrors("WARN", this.windowstate.file)
+ );
+ this.statusbar_depricated.setNotices(
+ req.errorByType.get("DEPR"),
+ req.totalErrors("DEPR"),
+ req.totalErrors("DEPR", this.windowstate.file)
+ );
}
-
- // user defined functions
- }
-
-
-
- public class Xcls_Box17 : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box17(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_rooviewbox( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_codeeditviewbox( _this );
- child_1.ref();
- this.el.add ( child_1.el );
+ public void initChildren () {
+ // this needs putting in a better place..
+ this.windowstate = new WindowState(this);
+
+
+
+
+
+
+
+
}
-
- // 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)
-
- // set gobject values
- this.el.vexpand = true;
+ public void show () {
+
+ this.el.show();
+ if (this.windowstate.file == null) {
+ this.windowstate.showPopoverFiles(this.open_projects_btn.el, null, false);
+ }
}
-
- // 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 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.vexpand = true;
+ 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);
}
-
- // user defined functions
- }
-
-
-
- public class Xcls_Box20 : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box20(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- var child_0 = new Xcls_Button21( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_Button23( _this );
- child_1.ref();
- this.el.add ( child_1.el );
- var child_2 = new Xcls_MenuButton25( _this );
- child_2.ref();
- this.el.add ( child_2.el );
- var child_3 = new Xcls_Label30( _this );
- child_3.ref();
- this.el.pack_start ( child_3.el , true,true,0 );
- var child_4 = new Xcls_statusbar( _this );
- child_4.ref();
- this.el.pack_start ( child_4.el , true,true,0 );
- var child_5 = new Xcls_MenuBar32( _this );
- child_5.ref();
- this.el.add ( child_5.el );
- var child_6 = new Xcls_statusbar_compile_spinner( _this );
- child_6.ref();
- this.el.add ( child_6.el );
+ 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);
+
}
-
- // user defined functions
- }
- public class Xcls_Button21 : Object
- {
- public Gtk.Button el;
- private Xcls_MainWindow _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button21(Xcls_MainWindow _owner )
+ public class Xcls_headerbar : Object
{
- _this = _owner;
- this.el = new Gtk.Button();
+ public Gtk.HeaderBar el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
-
- // set gobject values
- this.el.always_show_image = true;
- this.el.tooltip_text = "Project Details";
- this.el.label = "Edit Project Settings";
- var child_0 = new Xcls_Image22( _this );
- child_0.ref();
- this.el.set_image ( child_0.el );
- //listeners
- this.el.clicked.connect( ( ) => {
-
- _this.windowstate.projectPopoverShow(this.el, _this.project);
-
-
- });
+ // 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;
- // user defined functions
- }
- public class Xcls_Image22 : Object
- {
- public Gtk.Image el;
- private Xcls_MainWindow _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Box3(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
- // ctor
- public Xcls_Image22(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
+ // my vars (dec)
- // 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 );
+ }
- // set gobject values
- this.el.icon_name = "emblem-system";
+ // user defined functions
}
+ public class Xcls_windowbtn : Object
+ {
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
- // user defined functions
- }
+ // my vars (def)
+ public Gee.ArrayList<Gtk.Widget> mitems;
- public class Xcls_Button23 : Object
- {
- public Gtk.Button el;
- private Xcls_MainWindow _this;
+ // ctor
+ public Xcls_windowbtn(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.windowbtn = this;
+ this.el = new Gtk.Button();
+ // my vars (dec)
- // my vars (def)
+ // 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;
- // ctor
- public Xcls_Button23(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
+ // init method
- // my vars (dec)
+ {
+ this.mitems = new Gee.ArrayList<Gtk.Button>();
+ }
- // set gobject values
- this.el.always_show_image = true;
- this.el.tooltip_text = "File Details";
- this.el.label = "Edit File Properties";
- var child_0 = new Xcls_Image24( _this );
- child_0.ref();
- this.el.set_image ( child_0.el );
+ //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();
+ });
+ }
- //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 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;
- // user defined functions
- }
- public class Xcls_Image24 : Object
- {
- public Gtk.Image el;
- private Xcls_MainWindow _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_windowspopup(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.windowspopup = this;
+ this.el = new Gtk.Popover();
- // ctor
- public Xcls_Image24(Xcls_MainWindow _owner )
+ // 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
{
- _this = _owner;
- this.el = new Gtk.Image();
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
- // set gobject values
- this.el.icon_name = "document-properties";
+ // 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;
- // user defined functions
- }
+ // my vars (def)
- public class Xcls_MenuButton25 : Object
- {
- public Gtk.MenuButton el;
- private Xcls_MainWindow _this;
+ // ctor
+ public Xcls_Button7(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+ // my vars (dec)
- // my vars (def)
+ // 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 );
- // ctor
- public Xcls_MenuButton25(Xcls_MainWindow _owner )
+ //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
{
- _this = _owner;
- this.el = new Gtk.MenuButton();
+ public Gtk.ShortcutController el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
- // set gobject values
- this.el.always_show_image = true;
- this.el.label = "About";
- var child_0 = new Xcls_topbarmenu( _this );
- child_0.ref();
- this.el.set_popup ( child_0.el );
- var child_1 = new Xcls_Image29( _this );
- child_1.ref();
- this.el.set_image ( child_1.el );
- }
+ // my vars (def)
- // user defined functions
- }
- public class Xcls_topbarmenu : Object
- {
- public Gtk.Menu el;
- private Xcls_MainWindow _this;
+ // ctor
+ public Xcls_ShortcutController8(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.ShortcutController();
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ this.el.scope = Gtk.ShortcutScope.GLOBAL;
- // ctor
- public Xcls_topbarmenu(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.topbarmenu = this;
- this.el = new Gtk.Menu();
+ // init method
- // my vars (dec)
+ {
+ this.el.add_shortcut(
+ new Gtk.Shortcut(
+ new Gtk.KeyvalTrigger(Gdk.Key.N,Gdk.ModifierType.CONTROL_MASK),
+ new Gtk.SignalAction("clicked")
+ )
+ );
+ }
+ }
- // set gobject values
- var child_0 = new Xcls_MenuItem27( _this );
- child_0.ref();
- this.el.append ( child_0.el );
- var child_1 = new Xcls_MenuItem28( _this );
- child_1.ref();
- this.el.append ( child_1.el );
+ // user defined functions
+ }
+
+
+ public class Xcls_Separator9 : Object
+ {
+ public Gtk.Separator el;
+ private Xcls_MainWindow _this;
- // init method
+ // my vars (def)
+
+ // ctor
+ public Xcls_Separator9(Xcls_MainWindow _owner )
{
- this.el.show_all();
+ _this = _owner;
+ this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
+
+ // my vars (dec)
+
+ // set gobject values
}
- }
- // user defined functions
- }
- public class Xcls_MenuItem27 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_MainWindow _this;
+ // user defined functions
+ }
- // my vars (def)
- // ctor
- public Xcls_MenuItem27(Xcls_MainWindow _owner )
+ public class Xcls_Box10 : Object
{
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
- // set gobject values
- this.el.label = "Download updated Resources";
- this.el.show();
+ // my vars (def)
- //listeners
- this.el.activate.connect( ( ) => {
- Resources.singleton().fetchStart();
- });
+ // ctor
+ public Xcls_Box10(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // 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 );
+ }
+
+ // user defined functions
}
+ public class Xcls_Image11 : Object
+ {
+ public Gtk.Image el;
+ private Xcls_MainWindow _this;
- // user defined functions
- }
- public class Xcls_MenuItem28 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_MainWindow _this;
+ // my vars (def)
+ // ctor
+ public Xcls_Image11(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Image();
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_MenuItem28(Xcls_MainWindow _owner )
+ // set gobject values
+ this.el.icon_name = "window-new";
+ this.el.margin_start = 4;
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Label12 : Object
{
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ public Gtk.Label el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
- // set gobject values
- this.el.label = "About the Builder";
- this.el.show();
+ // my vars (def)
- //listeners
- this.el.activate.connect( () => {
- About.singleton().el.show();
- });
- }
+ // ctor
+ public Xcls_Label12(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Windows (Add/List)" );
- // user defined functions
- }
+ // my vars (dec)
+ // set gobject values
+ }
- public class Xcls_Image29 : Object
- {
- public Gtk.Image el;
- private Xcls_MainWindow _this;
+ // user defined functions
+ }
- // my vars (def)
- // ctor
- public Xcls_Image29(Xcls_MainWindow _owner )
+ public class Xcls_open_projects_btn : Object
{
- _this = _owner;
- this.el = new Gtk.Image();
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
-
- // set gobject values
- this.el.icon_name = "dialog-information";
- }
- // user defined functions
- }
+ // 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();
- public class Xcls_Label30 : Object
- {
- public Gtk.Label el;
- private Xcls_MainWindow _this;
+ // my vars (dec)
+ this.always_show_image = true;
+ // set gobject values
+ this.el.icon_name = "system-file-manager";
+ this.el.label = "Files / Projects";
- // my vars (def)
+ //listeners
+ this.el.clicked.connect( ( ) => {
+ _this.windowstate.showPopoverFiles(this.el, _this.project, false);
+ });
+ }
- // ctor
- public Xcls_Label30(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( " " );
+ // user defined functions
+ }
- // my vars (dec)
- // set gobject values
- }
- // user defined functions
- }
+ public class Xcls_vbox : Object
+ {
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
- public class Xcls_statusbar : Object
- {
- public Gtk.ProgressBar el;
- private Xcls_MainWindow _this;
+ // my vars (def)
- // my vars (def)
- public ulong handler_id;
+ // ctor
+ public Xcls_vbox(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.vbox = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // 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 );
+ }
- // ctor
- public Xcls_statusbar(Xcls_MainWindow _owner )
+ // user defined functions
+ }
+ public class Xcls_mainpane : Object
{
- _this = _owner;
- _this.statusbar = this;
- this.el = new Gtk.ProgressBar();
+ public Gtk.Paned el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
- this.handler_id = -1;
-
- // set gobject values
- this.el.show_text = true;
- // init method
+ // my vars (def)
+ public int lastWidth;
+ // ctor
+ public Xcls_mainpane(Xcls_MainWindow _owner )
{
- 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()));
-
- });
+ _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
- }
+ // user defined functions
+ }
+ public class Xcls_leftpane : Object
+ {
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
- public class Xcls_MenuBar32 : Object
- {
- public Gtk.MenuBar el;
- private Xcls_MainWindow _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_leftpane(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.leftpane = this;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
- // ctor
- public Xcls_MenuBar32(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuBar();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ new Xcls_editpane( _this );
+ this.el.append( _this.editpane.el );
+ }
- // set gobject values
- var child_0 = new Xcls_statusbar_compilestatus_label( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_statusbar_errors( _this );
- child_1.ref();
- this.el.add ( child_1.el );
- var child_2 = new Xcls_statusbar_warnings( _this );
- child_2.ref();
- this.el.add ( child_2.el );
- var child_3 = new Xcls_statusbar_depricated( _this );
- child_3.ref();
- this.el.add ( child_3.el );
- var child_4 = new Xcls_statusbar_run( _this );
- child_4.ref();
- this.el.add ( child_4.el );
+ // user defined functions
}
+ public class Xcls_editpane : Object
+ {
+ public Gtk.Paned el;
+ private Xcls_MainWindow _this;
- // user defined functions
- }
- public class Xcls_statusbar_compilestatus_label : Object
- {
- public Gtk.MenuItem el;
- private Xcls_MainWindow _this;
+ // my vars (def)
- // 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;
+ });
+ }
- // ctor
- public Xcls_statusbar_compilestatus_label(Xcls_MainWindow _owner )
+ // user defined functions
+ }
+ public class Xcls_tree : Object
{
- _this = _owner;
- _this.statusbar_compilestatus_label = this;
- this.el = new Gtk.MenuItem();
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
- // set gobject values
- this.el.label = "Compile Status:";
- this.el.show();
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_tree(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.tree = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
- public class Xcls_statusbar_errors : Object
- {
- public Gtk.MenuItem el;
- private Xcls_MainWindow _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ }
- // my vars (def)
- public Xcls_ValaCompileErrors popup;
- public Json.Object notices;
+ // user defined functions
+ }
- // ctor
- public Xcls_statusbar_errors(Xcls_MainWindow _owner )
+ public class Xcls_props : Object
{
- _this = _owner;
- _this.statusbar_errors = this;
- this.el = new Gtk.MenuItem();
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
- this.notices = new Json.Object();
- // set gobject values
- var child_0 = new Xcls_Box35( _this );
- child_0.ref();
- this.el.add( child_0.el );
- this.el.show();
+ // my vars (def)
- //listeners
- this.el.button_press_event.connect( () => {
- if (this.popup == null) {
- this.popup = new Xcls_ValaCompileErrors();
- this.popup.window = _this;
- }
-
-
- this.popup.show(this.notices, this.el);
- return true;
- });
- }
+ // ctor
+ public Xcls_props(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.props = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
- // user defined functions
- public void setNotices (Json.Object nots, int qty) {
- this.el.show_all();
- _this.statusbar_errors_label.el.label = qty.to_string() + " Errors";
- this.notices = nots;
-
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ }
+
+ // user defined functions
}
- }
- public class Xcls_Box35 : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
- // my vars (def)
- // ctor
- public Xcls_Box35(Xcls_MainWindow _owner )
+ public class Xcls_Box20 : Object
{
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 2 );
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
- // set gobject values
- var child_0 = new Xcls_Image36( _this );
- child_0.ref();
- this.el.add( child_0.el );
- var child_1 = new Xcls_statusbar_errors_label( _this );
- child_1.ref();
- this.el.add( child_1.el );
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box20(Xcls_MainWindow _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_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;
- // user defined functions
- }
- public class Xcls_Image36 : Object
- {
- public Gtk.Image el;
- private Xcls_MainWindow _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_rooviewbox(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.rooviewbox = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
- // ctor
- public Xcls_Image36(Xcls_MainWindow _owner )
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_codeeditviewbox : Object
{
- _this = _owner;
- this.el = new Gtk.Image();
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
- // set gobject values
- this.el.icon_name = "dialog-error";
+ // 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)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ }
+
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_statusbar_errors_label : Object
- {
- public Gtk.Label el;
- private Xcls_MainWindow _this;
+ public class Xcls_Box23 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
- // my vars (def)
- // ctor
- public Xcls_statusbar_errors_label(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.statusbar_errors_label = this;
- this.el = new Gtk.Label( "Errors" );
+ // my vars (def)
- // my vars (dec)
+ // 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 );
+ }
- // set gobject values
+ // user defined functions
}
+ public class Xcls_Button24 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
- // user defined functions
- }
+ // my vars (def)
+ public bool always_show_image;
+ // ctor
+ public Xcls_Button24(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- public class Xcls_statusbar_warnings : Object
- {
- public Gtk.MenuItem el;
- private Xcls_MainWindow _this;
+ // 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";
- // my vars (def)
- public Xcls_ValaCompileErrors popup;
- public Json.Object notices;
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ _this.windowstate.projectPopoverShow(_this.el, null);
+
+
+ });
+ }
- // ctor
- public Xcls_statusbar_warnings(Xcls_MainWindow _owner )
+ // user defined functions
+ }
+
+ public class Xcls_Button25 : Object
{
- _this = _owner;
- _this.statusbar_warnings = this;
- this.el = new Gtk.MenuItem();
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
- this.notices = new Json.Object();
- // set gobject values
- var child_0 = new Xcls_Box39( _this );
- child_0.ref();
- this.el.add( child_0.el );
- this.el.show();
+ // my vars (def)
+ public bool always_show_image;
- //listeners
- this.el.button_press_event.connect( () => {
- if (this.popup == null) {
- this.popup = new Xcls_ValaCompileErrors();
- this.popup.window = _this;
- }
+ // 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 ;
- this.popup.show(this.notices, this.el);
- return true;
- });
- }
+
+ });
+ }
- // user defined functions
- public void setNotices (Json.Object nots, int qty) {
- this.el.show_all();
- _this.statusbar_warnings_label.el.label = qty.to_string() + " Warnings";
- this.notices = nots;
-
+ // user defined functions
}
- }
- public class Xcls_Box39 : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
-
- // my vars (def)
-
- // ctor
- public Xcls_Box39(Xcls_MainWindow _owner )
+ public class Xcls_MenuButton26 : Object
{
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 2 );
+ public Gtk.MenuButton el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
- // set gobject values
- var child_0 = new Xcls_Image40( _this );
- child_0.ref();
- this.el.add( child_0.el );
- var child_1 = new Xcls_statusbar_warnings_label( _this );
- child_1.ref();
- this.el.add( child_1.el );
- }
+ // my vars (def)
+ public bool always_show_image;
- // user defined functions
- }
- public class Xcls_Image40 : Object
- {
- public Gtk.Image el;
- private Xcls_MainWindow _this;
+ // ctor
+ public Xcls_MenuButton26(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.MenuButton();
+ // my vars (dec)
+ this.always_show_image = true;
- // my vars (def)
+ // set gobject values
+ this.el.icon_name = "dialog-information";
+ this.el.label = "About";
+ new Xcls_topbarmenu( _this );
+ this.el.popover = _this.topbarmenu.el;
+ }
- // ctor
- public Xcls_Image40(Xcls_MainWindow _owner )
+ // user defined functions
+ }
+ public class Xcls_topbarmenu : Object
{
- _this = _owner;
- this.el = new Gtk.Image();
-
- // my vars (dec)
+ public Gtk.PopoverMenu el;
+ private Xcls_MainWindow _this;
- // set gobject values
- this.el.icon_name = "dialog-warning";
- }
- // user defined functions
- }
+ // my vars (def)
- public class Xcls_statusbar_warnings_label : Object
- {
- public Gtk.Label el;
- private Xcls_MainWindow _this;
+ // ctor
+ public Xcls_topbarmenu(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.topbarmenu = this;
+ this.el = new Gtk.PopoverMenu.from_model(null);
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ var child_1 = new Xcls_Box28( _this );
+ child_1.ref();
+ this.el.set_child ( child_1.el );
- // ctor
- public Xcls_statusbar_warnings_label(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.statusbar_warnings_label = this;
- this.el = new Gtk.Label( "Errors" );
+ // init method
- // my vars (dec)
+ {
+ // this.el.show();
+ }
+ }
- // set gobject values
+ // user defined functions
}
+ public class Xcls_Box28 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_MainWindow _this;
- // user defined functions
- }
+ // my vars (def)
+ // ctor
+ public Xcls_Box28(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // 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 );
+ }
- public class Xcls_statusbar_depricated : Object
- {
- public Gtk.MenuItem el;
- private Xcls_MainWindow _this;
+ // user defined functions
+ }
+ public class Xcls_Button29 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
- // my vars (def)
- public Xcls_ValaCompileErrors popup;
- public Json.Object notices;
+ // my vars (def)
- // ctor
- public Xcls_statusbar_depricated(Xcls_MainWindow _owner )
- {
- _this = _owner;
- _this.statusbar_depricated = this;
- this.el = new Gtk.MenuItem();
+ // ctor
+ public Xcls_Button29(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // my vars (dec)
- this.notices = new Json.Object();
+ // my vars (dec)
- // set gobject values
- var child_0 = new Xcls_Box43( _this );
- child_0.ref();
- this.el.add( child_0.el );
- this.el.show();
+ // set gobject values
+ this.el.label = "Download updated Resources";
- //listeners
- this.el.button_press_event.connect( () => {
- if (this.popup == null) {
- this.popup = new Xcls_ValaCompileErrors();
- this.popup.window = _this;
- }
-
-
- this.popup.show(this.notices, this.el);
- return true;
- });
- }
+ //listeners
+ this.el.activate.connect( ( ) => {
+ Resources.singleton().fetchStart();
+ });
+ }
- // user defined functions
- public void setNotices (Json.Object nots, int qty) {
- this.el.show_all();
- _this.statusbar_depricated_label.el.label = qty.to_string() + " Depricated";
- this.notices = nots;
-
+ // user defined functions
}
- }
- public class Xcls_Box43 : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
+ public class Xcls_Button30 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
- // my vars (def)
- // ctor
- public Xcls_Box43(Xcls_MainWindow _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 2 );
+ // my vars (def)
- // my vars (dec)
+ // ctor
+ public Xcls_Button30(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // set gobject values
- var child_0 = new Xcls_Image44( _this );
- child_0.ref();
- this.el.add( child_0.el );
- var child_1 = new Xcls_statusbar_depricated_label( _this );
- child_1.ref();
- this.el.add( child_1.el );
+ // my vars (dec)
+
+ // set gobject values
+ this.el.label = "About the Builder";
+
+ //listeners
+ this.el.clicked.connect( () => {
+ About.singleton().el.show();
+ });
+ }
+
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_Image44 : Object
- {
- public Gtk.Image el;
- private Xcls_MainWindow _this;
- // my vars (def)
- // ctor
- public Xcls_Image44(Xcls_MainWindow _owner )
+ public class Xcls_Label31 : Object
{
- _this = _owner;
- this.el = new Gtk.Image();
+ public Gtk.Label el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
- // set gobject values
- this.el.icon_name = "dialog-information";
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_Label31(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( " " );
- public class Xcls_statusbar_depricated_label : Object
- {
- public Gtk.Label el;
- private Xcls_MainWindow _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.hexpand = true;
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_statusbar_depricated_label(Xcls_MainWindow _owner )
+ public class Xcls_statusbar : Object
{
- _this = _owner;
- _this.statusbar_depricated_label = this;
- this.el = new Gtk.Label( "Errors" );
+ public Gtk.ProgressBar el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
+ public ulong handler_id;
- // user defined functions
- }
+ // ctor
+ public Xcls_statusbar(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.statusbar = this;
+ this.el = new Gtk.ProgressBar();
+
+ // my vars (dec)
+ this.handler_id = -1;
+
+ // 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;
- public class Xcls_statusbar_run : Object
- {
- public Gtk.MenuItem el;
- private Xcls_MainWindow _this;
+ // my vars (def)
- // my vars (def)
- public Xcls_ValaCompileErrors popup;
+ // 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 );
+ }
- // ctor
- public Xcls_statusbar_run(Xcls_MainWindow _owner )
+ // user defined functions
+ }
+ public class Xcls_statusbar_compilestatus_label : Object
{
- _this = _owner;
- _this.statusbar_run = this;
- this.el = new Gtk.MenuItem();
+ public Gtk.Label el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
- // set gobject values
- var child_0 = new Xcls_Box47( _this );
- child_0.ref();
- this.el.add( child_0.el );
- this.el.show();
+ // my vars (def)
- //listeners
- this.el.button_press_event.connect( () => {
- if (_this.windowstate.file == null) {
- return true;
- }
- BuilderApplication.valasource.spawnExecute(_this.windowstate.file);
-
- _this.windowstate.compile_results.show(this.el,true);
-
- return true;
- });
- }
+ // ctor
+ public Xcls_statusbar_compilestatus_label(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.statusbar_compilestatus_label = this;
+ this.el = new Gtk.Label( "Compile Status:" );
- // user defined functions
- }
- public class Xcls_Box47 : Object
- {
- public Gtk.Box el;
- private Xcls_MainWindow _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.margin_end = 4;
+ this.el.margin_start = 4;
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_Box47(Xcls_MainWindow _owner )
+ public class Xcls_statusbar_errors : Object
{
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 2 );
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
- // set gobject values
- var child_0 = new Xcls_Image48( _this );
- child_0.ref();
- this.el.add( child_0.el );
- var child_1 = new Xcls_Label49( _this );
- child_1.ref();
- this.el.add( child_1.el );
- }
+ // my vars (def)
+ public Xcls_ValaCompileErrors popup;
+ public GLib.ListStore notices;
- // user defined functions
- }
- public class Xcls_Image48 : Object
- {
- public Gtk.Image el;
- private Xcls_MainWindow _this;
+ // ctor
+ public Xcls_statusbar_errors(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.statusbar_errors = this;
+ this.el = new Gtk.Button();
+ // my vars (dec)
+ this.notices = null;
- // my vars (def)
+ // set gobject values
+ this.el.icon_name = "dialog-error";
+ this.el.label = "0 Errors";
- // ctor
- public Xcls_Image48(Xcls_MainWindow _owner )
+ //listeners
+ this.el.clicked.connect( () => {
+
+
+
+ if (this.popup == null) {
+ this.popup = new Xcls_ValaCompileErrors();
+ this.popup.window = _this;
+ //this.popup.el.application = _this.el.application;
+ // this.popup.el.set_transient_for( _this.el );
+ this.popup.el.set_parent(this.el);
+ }
+ if (_this.statusbar_compile_spinner.el.spinning) {
+ this.popup.el.show();
+ return;
+ }
+ this.popup.show(this.notices, this.el);
+ return;
+ });
+ }
+
+ // user defined functions
+ public void setNotices (GLib.ListStore nots, int qty, int tf) {
+
+ if (qty < 1 ) {
+ this.el.hide();
+ if (this.popup != null && this.popup.el.visible) {
+ this.popup.el.hide();
+ }
+ return;
+ }
+
+ this.el.show();
+ this.el.label = "%d/%d Errors".printf(tf,qty);
+ this.notices = nots;
+ if (this.popup != null && this.popup.el.visible) {
+ this.popup.show(this.notices, this.el);
+ }
+ }
+ }
+
+ public class Xcls_statusbar_warnings : Object
{
- _this = _owner;
- this.el = new Gtk.Image();
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
- // set gobject values
- this.el.icon_name = "media-playback-start";
- }
+ // my vars (def)
+ public Xcls_ValaCompileErrors popup;
+ public GLib.ListStore notices;
- // user defined functions
- }
+ // ctor
+ public Xcls_statusbar_warnings(Xcls_MainWindow _owner )
+ {
+ _this = _owner;
+ _this.statusbar_warnings = this;
+ this.el = new Gtk.Button();
- public class Xcls_Label49 : Object
- {
- public Gtk.Label el;
- private Xcls_MainWindow _this;
+ // my vars (dec)
+ this.notices = null;
+ // set gobject values
+ this.el.icon_name = "dialog-warning";
+ this.el.label = "0 Warnings";
- // my vars (def)
+ //listeners
+ this.el.clicked.connect( () => {
+
+ 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);
+ }
+ if (_this.statusbar_compile_spinner.el.spinning) {
+ this.popup.el.show();
+ return;
+ }
+ this.popup.show(this.notices, this.el);
+ return;
+ });
+ }
- // ctor
- public Xcls_Label49(Xcls_MainWindow _owner )
+ // user defined functions
+ public void setNotices (GLib.ListStore nots, int qty, int tf) {
+
+ if (qty < 1 ) {
+ this.el.hide();
+ if (this.popup != null && this.popup.el.visible) {
+ this.popup.el.hide();
+ }
+ return;
+ }
+ this.el.show();
+ this.el.label = "%d/%d Warnings".printf(tf,qty);
+ this.notices = nots;
+ if (this.popup != null && this.popup.el.visible) {
+ this.popup.show(this.notices, this.el);
+ }
+
+
+ }
+ }
+
+ public class Xcls_statusbar_depricated : Object
{
- _this = _owner;
- this.el = new Gtk.Label( "Run" );
+ public Gtk.Button el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
- // set gobject values
+ // 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) {
+ this.popup = new Xcls_ValaCompileErrors();
+ this.popup.window = _this;
+ // this.popup.el.set_transient_for( _this.el );
+ this.popup.el.set_parent(this.el);
+ }
+ if (_this.statusbar_compile_spinner.el.spinning) {
+ this.popup.el.show();
+ return;
+ }
+
+ this.popup.show(this.notices, this.el);
+ return;
+ });
+ }
+
+ // user defined functions
+ public void setNotices (GLib.ListStore nots, int qty, int tf) {
+ if (qty < 1) {
+ this.el.hide();
+ if (this.popup != null && this.popup.el.visible) {
+ this.popup.el.hide();
+ }
+
+ return;
+ }
+
+ this.el.show();
+
+ this.el.label = "%d/%d Depricated".printf(tf,qty);
+ this.notices = nots;
+ if (this.popup != null && this.popup.el.visible) {
+ this.popup.show(this.notices, this.el);
+ }
+ }
}
- // user defined functions
- }
+ 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();
- public class Xcls_statusbar_compile_spinner : Object
- {
- public Gtk.Spinner el;
- private Xcls_MainWindow _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.icon_name = "media-playback-start";
+ this.el.label = "Run";
- // my vars (def)
+ //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;
+ }
+ BuilderApplication.valacompilequeue.addFile(
+ Palete.ValaCompileRequestType.RUN,
+ _this.windowstate.file, "", true ) ;
+
+ _this.windowstate.compile_results.el.set_parent(this.el);
+ _this.windowstate.compile_results.show(this.el,true);
+
+ });
+ }
- // ctor
- public Xcls_statusbar_compile_spinner(Xcls_MainWindow _owner )
+ // user defined functions
+ }
+
+
+ public class Xcls_statusbar_compile_spinner : Object
{
- _this = _owner;
- _this.statusbar_compile_spinner = this;
- this.el = new Gtk.Spinner();
+ public Gtk.Spinner el;
+ private Xcls_MainWindow _this;
- // my vars (dec)
- // set gobject values
- this.el.tooltip_text = "Compiling";
- }
+ // my vars (def)
- // user defined functions
- public void start () {
- this.el.show();
- this.el.start();
- }
- public void stop () {
- this.el.stop();
- this.el.hide();
+ // 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();
+
+ }
}
- }
-}
+ }
{
"build_module" : "",
+ "gen_extended" : false,
"items" : [
{
"$ xns" : "Gtk",
"@ void after_node_change" : "(JsRender.Node? node)",
"@ void before_node_change" : "(JsRender.Node? node)",
- "@ void drag_end" : "()",
"Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
"Xcls_MainWindow mainwindow" : "",
"bool active" : false,
" ",
""
],
- "* pack" : "add",
+ "* pack" : "set_child",
+ "id" : "viewwin",
"items" : [
{
- "# string dragData" : "",
- "$ enable_tree_lines" : true,
- "$ headers_visible" : true,
"$ xns" : "Gtk",
- "* init" : [
- " {",
- " this.el.set_size_request(150,-1);",
- " // set_reorderable: [1]",
- " ",
- " ",
- "\tthis.css = new Gtk.CssProvider();",
- "\ttry {",
- "\t\tthis.css.load_from_data(\"#popover-add-object-view { font-szie: 12px;}\");",
- "\t} catch (Error e) {}",
- "\tthis.el.get_style_context().add_provider(this.css,",
- "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION);",
- "\t ",
- "\t ",
- " ",
- " var selection = this.el.get_selection();",
- " selection.set_mode( Gtk.SelectionMode.SINGLE);",
- " // this.selection.signal['changed'].connect(function() {",
- " // _view.listeners['cursor-changed'].apply(_view, [ _view, '']);",
- " //});",
- " // see: http://live.gnome.org/GnomeLove/DragNDropTutorial",
- " ",
- " Gtk.drag_source_set (",
- " this.el, /* widget will be drag-able */",
- " Gdk.ModifierType.BUTTON1_MASK, /* modifier that will start a drag */",
- " BuilderApplication.targetList, /* lists of target to support */",
- " Gdk.DragAction.COPY /* what to do with data after dropped */",
- " );",
- " //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);",
- " ",
- " // Gtk.drag_source_set_target_list(this.el, Application.targetList);",
- " // Gtk.drag_source_add_text_targets(this.el); ",
- " ",
- "}",
- ""
- ],
- "* pack" : "add",
- "Gtk.CssProvider css" : "",
+ "* pack" : "set_child",
+ "bool hexpand" : true,
+ "bool vexpand" : true,
+ "id" : "view",
"items" : [
{
- "$ columns" : "typeof(string),typeof(string),typeof(Gdk.Pixbuf)",
+ "$ Gdk.DragAction[] actions" : "Gdk.DragAction.COPY | Gdk.DragAction.MOVE ",
"$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "model",
- "n_columns" : 3,
- "xtype" : "ListStore",
- "| string getValue" : [
- " (Gtk.TreeIter iter, int col) {",
- "\tGLib.Value gval;",
- "\tthis.el.get_value(iter, col , out gval);",
- "\treturn (string)gval;",
- " ",
+ "listeners" : {
+ "drag_begin" : [
+ "( drag ) => {",
+ "\tGLib.debug(\"SOURCE: drag-begin\");",
+ "\t ",
+ " // find what is selected in our tree...",
+ " var data = _this.selmodel.getSelectedNode();",
+ "\tif (data == null) {",
+ "\t\treturn ;",
+ "\t}",
+ "\t ",
+ " var xname = data.fqn();",
+ " GLib.debug (\"XNAME IS %s\", xname);",
+ "",
+ " \tvar widget = _this.view.getWidgetAtRow(_this.selmodel.el.selected);",
+ " \t",
+ " \t",
+ " var paintable = new Gtk.WidgetPaintable(widget);",
+ " this.el.set_icon(paintable, 0,0);",
+ " ",
+ " ",
+ "}"
+ ],
+ "drag_end" : [
+ "(drag, delete_data) => {",
+ "\t_this.hide();",
+ "",
+ "}",
+ ""
+ ],
+ "prepare" : [
+ "(x, y) => {",
+ "",
+ "\t",
+ "\t",
+ "///\t( drag_context, data, info, time) => {",
+ " ",
+ "",
+ "\t//print(\"drag-data-get\");",
+ " \tvar ndata = _this.selmodel.getSelectedNode();",
+ "\tif (ndata == null) {",
+ "\t \tGLib.debug(\"return empty string - no selection..\");",
+ "\t\treturn null;",
+ "\t ",
+ "\t}",
+ "",
+ " ",
+ "\t//data.set_text(tp,tp.length); ",
+ "",
+ "\tvar \tstr = ndata.toJsonString();",
+ "\tGLib.debug(\"prepare store: %s\", str);",
+ "\tGLib.Value ov = GLib.Value(typeof(string));",
+ "\tov.set_string(str);",
+ " \tvar cont = new Gdk.ContentProvider.for_value(ov);",
+ " ",
+ "\t//GLib.Value v = GLib.Value(typeof(string));",
+ "\t//var str = drop.read_text( [ \"text/plain\" ] 0);",
+ "\t ",
+ "\t//cont.get_value(ref v);",
+ "\t//GLib.debug(\"set %s\", v.get_string());",
+ " ",
+ " \treturn cont;",
+ "\t ",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "DragSource"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "id" : "selmodel",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* ctor" : [
+ "new Gtk.TreeListModel(",
+ " new GLib.ListStore(typeof(JsRender.Node)), //..... << that's our store..",
+ " false, // passthru",
+ " true, // autexpand",
+ " (item) => {",
+ " \treturn ((JsRender.Node)item).childstore;",
+ " ",
+ " }",
+ " ",
+ " ",
+ ")"
+ ],
+ "* prop" : "model",
+ "id" : "model",
+ "xtype" : "TreeListModel"
+ }
+ ],
+ "xtype" : "SingleSelection",
+ "| 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();",
+ "\t ",
+ "}"
+ ],
+ "| JsRender.Node? getSelectedNode" : [
+ "() {",
+ " if (this.el.selected_item == null) {",
+ "\t\treturn null;",
+ " }\t\t\t ",
+ " var tr = (Gtk.TreeListRow)this.el.selected_item;",
+ " return (JsRender.Node)tr.get_item();",
+ "\t ",
"}"
]
},
{
"$ xns" : "Gtk",
- "* init" : [
- "this.el.add_attribute(_this.txtrender.el , \"markup\", 1 );",
- "this.el.add_attribute(_this.iconrender.el , \"pixbuf\", 2 );",
- ""
- ],
"* pack" : "append_column",
+ "bool expand" : true,
+ "id" : "maincol",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "iconrender",
- "xtype" : "CellRendererPixbuf"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "txtrender",
- "xtype" : "CellRendererText"
+ "* prop" : "factory",
+ "listeners" : {
+ "bind" : [
+ "(listitem) => {",
+ "\t //GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
+ "\t",
+ "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
+ " ",
+ "\t ",
+ " \tvar hbox = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();",
+ " ",
+ " ",
+ "\t",
+ "\tvar img = (Gtk.Image) hbox.get_first_child();",
+ "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
+ "\t",
+ "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
+ "\t",
+ "\t",
+ "\t",
+ "\tvar node = (JsRender.Node) lr.get_item();",
+ "\t",
+ " GLib.debug(\"node is %s\", node.get_type().name());",
+ " GLib.debug(\"lbl is %s\", lbl.get_type().name());",
+ " GLib.debug(\"node fqn %s\", node.fqn());",
+ "// was item (1) in old layout",
+ "",
+ "\t ",
+ " \timg.file = node.iconFilename;",
+ " \tlbl.label = node.fqn();",
+ "// \tlbl.tooltip_markup = node.nodeTip();",
+ " ",
+ " ",
+ " \t// bind image...",
+ " \t",
+ "}",
+ ""
+ ],
+ "setup" : [
+ "(listitem) => {",
+ "\t",
+ " ",
+ "\tvar hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
+ "\tvar icon = new Gtk.Image();",
+ "\tvar lbl = new Gtk.Label(\"\");",
+ "\tlbl.use_markup = true;",
+ "\t",
+ "\t",
+ " \tlbl.justify = Gtk.Justification.LEFT;",
+ " \tlbl.xalign = 0;",
+ "\tlbl.margin_start = 4;",
+ "//\tlistitem.activatable = true; ??",
+ "\t",
+ "\thbox.append(icon);",
+ "\thbox.append(lbl);",
+ "\t ",
+ "\t((Gtk.ListItem)listitem).set_child(hbox);",
+ "\t ",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "SignalListItemFactory"
}
],
- "utf8 title" : "Drag to add Object",
- "xtype" : "TreeViewColumn"
+ "title" : "Drag to add Object",
+ "xtype" : "ColumnViewColumn"
+ },
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "pressed" : [
+ "(n_press, x, y) => {",
+ "\tif (n_press < 2) { /// doubleclick?",
+ "\t\treturn;",
+ "\t}",
+ "\t//var pos = \"\";",
+ "\t// find left tree selected node",
+ "\tvar addto = _this.mainwindow.windowstate.left_tree.selmodel.getSelectedNode();",
+ "\t//var row = _this.view.getRowAt(x,y, out pos);",
+ "\t",
+ " \t var add = _this.selmodel.getSelectedNode().deepClone();",
+ "\taddto.appendChild(add);",
+ "\t_this.mainwindow.windowstate.left_props.changed();",
+ "\t_this.mainwindow.windowstate.left_tree.model.selectNode(add);",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "GestureClick"
}
],
- "listeners" : {
- "button_press_event" : [
- " ( event) => {",
- "",
- " //\tif (!this.get('/Editor').save()) {",
- " //\t // popup!! - click handled.. ",
- "// \t return true;",
- "// }",
- " return false;",
- "}"
- ],
- "drag_begin" : [
- " ( ctx) => {",
- " // we could fill this in now...",
- "// Seed.print('SOURCE: drag-begin');",
- " ",
- " ",
- " ",
- " Gtk.TreeIter iter;",
- " var s = this.el.get_selection();",
- " ",
- " Gtk.TreeModel mod;",
- " s.get_selected(out mod, out iter);",
- " var path = mod.get_path(iter);",
- " ",
- " /// pix is a surface..",
- " var pix = this.el.create_row_drag_icon ( path);",
- " ",
- " ",
- " Gtk.drag_set_icon_surface (ctx, pix);",
- " GLib.Value value;",
- " ",
- "",
- " _this.model.el.get_value(iter, 0, out value);",
- " ",
- " this.dragData = (string) value;",
- " ",
- " ",
- " return;",
- "}"
- ],
- "drag_data_get" : [
- "(drag_context, selection_data, info, time) => {",
- " \t//Seed.print('Palete: drag-data-get: ' + target_type);",
- " if (this.dragData.length < 1 ) {",
- " return; ",
- " }",
- " ",
- " GLib.debug(\"setting drag data to %s\\n\", this.dragData);",
- " // selection_data.set_text(this.dragData ,this.dragData.length);",
- " selection_data.set (selection_data.get_target (), 8, (uchar[]) this.dragData.to_utf8 ());",
- "",
- " //this.el.dragData = \"TEST from source widget\";",
- " ",
- " ",
- "}"
- ],
- "drag_end" : [
- "( drag_context) => {",
- " \t GLib.debug(\"SOURCE: drag-end (call listener on this)\\n\");",
- "\t",
- "\tthis.dragData = \"\";",
- "\t//this.dropList = null;",
- "\t_this.drag_end(); // call signal..",
- "\t//this.get('/LeftTree.view').highlight(false);",
- "\t ",
- "}"
- ]
- },
- "string name" : "popover-add-object-view",
- "xtype" : "TreeView"
+ "xtype" : "ColumnView",
+ "| Gtk.Widget? getWidgetAt" : [
+ "(double x, double in_y) {",
+ "/*",
+ " \t",
+ "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
+ " \tvar colview = gesture.widget;",
+ " \tvar line_no = check_list_widget(colview, x,y);",
+ " if (line_no > -1) {",
+ " \t\tvar item = colview.model.get_item(line_no);",
+ " \t\t ",
+ " \t}",
+ " \t*/",
+ " \tvar y = in_y + _this.viewwin.el.vadjustment.value; ",
+ " var child = this.el.get_first_child(); ",
+ " \t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
+ " \tvar line_no = -1; ",
+ " \tvar reading_header = true;",
+ " \tvar curr_y = 0;",
+ " \tvar header_height = 0;",
+ " \tvar h = 0;",
+ " \twhile (child != null) {",
+ "\t\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
+ "\t if (reading_header) {",
+ "\t\t\t\t",
+ "",
+ "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
+ "\t\t\t h += child.get_height();",
+ "\t\t\t\t\tchild = child.get_next_sibling();",
+ "\t\t\t\t\tcontinue;",
+ "\t\t\t\t}",
+ "\t\t\t\t// should be columnlistview",
+ "\t\t\t\tchild = child.get_first_child(); ",
+ "\t\t\t GLib.debug(\"header height=%d\", h);",
+ "\t\t\t\theader_height = h;",
+ "\t\t\t\t",
+ "\t\t\t\treading_header = false;",
+ "\t\t\t\t",
+ "\t }",
+ "\t\t line_no++;",
+ "",
+ "\t\t\tif (y < header_height) {",
+ "\t\t \treturn null;",
+ "\t \t}",
+ "",
+ "\t\t\tvar hh = child.get_height();",
+ "\t\t\t//GLib.debug(\"got cell xy = %d,%d w,h= %d,%d\", alloc.x, alloc.y, alloc.width, alloc.height);",
+ "",
+ "\t\t if (y > curr_y && y <= header_height + hh + curr_y ) {",
+ "\t\t\t return (Gtk.Widget)child;",
+ "\t\t }",
+ "\t\t curr_y += hh ;",
+ "",
+ "\t\t if (curr_y > y) {",
+ "\t\t return null;",
+ "\t }",
+ "\t child = child.get_next_sibling(); ",
+ " \t}",
+ " return null;",
+ "",
+ " }"
+ ],
+ "| Gtk.Widget? getWidgetAtRow" : [
+ "(uint row) {",
+ "/*",
+ "// ?? could be done with model?",
+ " \t",
+ "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
+ " \tvar colview = gesture.widget;",
+ " \tvar line_no = check_list_widget(colview, x,y);",
+ " if (line_no > -1) {",
+ " \t\tvar item = colview.model.get_item(line_no);",
+ " \t\t ",
+ " \t}",
+ " \t*/",
+ "\t\tGLib.debug(\"Get Widget At Row %d\", (int)row);",
+ " var child = this.el.get_first_child(); ",
+ " \tvar line_no = -1; ",
+ " \tvar reading_header = true;",
+ "",
+ " \twhile (child != null) {",
+ "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
+ " \t if (reading_header) {",
+ "\t\t\t ",
+ "\t\t\t ",
+ "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
+ "\t\t\t\t\tchild = child.get_next_sibling();",
+ "\t\t\t\t\tcontinue;",
+ "\t\t\t\t}",
+ "\t\t\t\tchild = child.get_first_child(); ",
+ "\t\t\t\treading_header = false;",
+ "\t }",
+ "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
+ " \t\t child = child.get_next_sibling();",
+ " \t\t continue;",
+ "\t\t }",
+ "\t\t line_no++;",
+ "\t\t\tif (line_no == row) {",
+ "\t\t\t\tGLib.debug(\"Returning widget %s\", child.get_type().name());",
+ "\t\t\t return (Gtk.Widget)child;",
+ "\t\t }",
+ "\t child = child.get_next_sibling(); ",
+ " \t}",
+ "\t\tGLib.debug(\"Rturning null\");",
+ " return null;",
+ "",
+ " }"
+ ],
+ "| int getRowAt" : [
+ "(double x, double in_y, out string pos) {",
+ "",
+ "",
+ "\t ",
+ "",
+ "/*",
+ " \t",
+ "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
+ " \tvar colview = gesture.widget;",
+ " \tvar line_no = check_list_widget(colview, x,y);",
+ " if (line_no > -1) {",
+ " \t\tvar item = colview.model.get_item(line_no);",
+ " \t\t ",
+ " \t}",
+ " \t*/",
+ " \t\t ",
+ " \t\t",
+ " \t\t//GLib.debug(\"offset = %d y = %d\", (int) voff, (int) in_y);",
+ " \tvar y = in_y + _this.viewwin.el.vadjustment.value; ",
+ " var child = this.el.get_first_child(); ",
+ " \t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
+ " \tvar line_no = -1; ",
+ " \tvar reading_header = true;",
+ " \tvar real_y = 0;",
+ " \tvar header_height = 0;",
+ " \tpos = \"none\";",
+ " \tvar h = 0;",
+ " \twhile (child != null) {",
+ "\t\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
+ " \t if (reading_header) {",
+ "\t\t\t\t",
+ "",
+ "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
+ "\t\t\t h += child.get_height();",
+ "\t\t\t\t\tchild = child.get_next_sibling();",
+ "\t\t\t\t\tcontinue;",
+ "\t\t\t\t}",
+ "\t\t\t\t// should be columnlistview",
+ "\t\t\t\tchild = child.get_first_child(); ",
+ "\t\t\t GLib.debug(\"header height=%d\", h);",
+ "\t\t\t\theader_height = h;",
+ "\t\t\t\t",
+ "\t\t\t\treading_header = false;",
+ "\t\t\t\t",
+ "\t }",
+ "\t ",
+ "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
+ " \t\t child = child.get_next_sibling();",
+ " \t\t continue;",
+ "\t\t }",
+ "\t\t ",
+ "\t\t \tif (y < header_height) {",
+ "\t\t \treturn -1;",
+ "\t \t}",
+ "\t\t ",
+ "\t\t line_no++;",
+ "\t\t\tvar hh = child.get_height();",
+ "\t\t\t//child.get_allocation(out alloc);",
+ "\t\t\t//GLib.debug(\"got cell xy = %d,%d w,h= %d,%d\", alloc.x, alloc.y, alloc.width, alloc.height);",
+ "\t\t\t//GLib.debug(\"row %d y= %d %s\", line_no, (int) (header_height + alloc.y),",
+ "\t\t\t",
+ "\t\t\t//\tchild.visible ? \"VIS\" : \"hidden\");",
+ "",
+ "\t\t if (y > (header_height + real_y) && y <= (header_height + real_y + hh) ) {",
+ "\t\t \tif (y > ( header_height + real_y + (hh * 0.8))) {",
+ "\t\t \t\tpos = \"below\";",
+ "\t \t\t} else if (y > ( header_height + real_y + (hh * 0.2))) {",
+ "\t \t\t\tpos = \"over\";",
+ " \t\t\t} else {",
+ " \t\t\t\tpos = \"above\";",
+ "\t\t\t\t}",
+ "\t\t \t GLib.debug(\"getRowAt return : %d, %s\", line_no, pos);",
+ "\t\t\t return line_no;",
+ "\t\t }",
+ " ",
+ "",
+ "\t\t if (real_y + hh > y) {",
+ "\t\t return -1;",
+ "\t }",
+ "\t real_y += hh;",
+ "\t child = child.get_next_sibling(); ",
+ " \t}",
+ " return -1;",
+ "",
+ " }"
+ ]
}
],
"xtype" : "ScrolledWindow"
}
],
"xtype" : "Popover",
- "| void clear" : [
+ "| void a_clear" : [
"() {",
- " this.model.el.clear();",
+ " var m = (GLib.ListStore) _this.model.el.model;",
+ "\tm.remove_all();",
+ "",
+ "\t",
+ "",
"}",
""
],
"| void show" : [
"(Palete.Palete pal, string cls, Gtk.Widget onbtn) {",
"",
- " ",
- " ",
+ " ",
"",
- " var tr = pal.getChildList(cls);",
- " this.model.el.clear();",
+ " var tr = pal.getChildList(cls, false);",
+ " var m = (GLib.ListStore) _this.model.el.model;",
+ "\tm.remove_all();",
"",
+ "\t",
+ "\t// new version will not support properties here..",
+ "\t// they will be part of the properties, clicking will add a node..",
+ "\t// will change the return list above eventually?",
+ "\t",
+ " ",
+ "\tforeach (var dname in tr) {",
+ "\t\t ",
"",
- " Gtk.TreeIter citer;",
- " var ic = Gtk.IconTheme.get_default();",
- " Gdk.Pixbuf pixdef = null;",
- " try {",
- "\t\tpixdef = ic.load_icon(\"emblem-new\", 16,0);",
- "\t} catch (Error e) {",
+ "\t\tGLib.debug(\"add to model: %s\", dname);\t\t",
+ "\t\tm.append(pal.fqnToNode(dname));",
"\t}",
+ "\t m.sort( (a, b) => {",
"",
- " for(var i =0 ; i < tr.length; i++) {",
- " this.model.el.append(out citer); ",
- " var dname = tr[i];",
- " var clsname = dname;",
- " if (dname.contains(\":\")) {",
- "\t\t\tvar ar = dname.split(\":\");",
- "\t\t\tdname = \"<b>\" + ar[1] +\"</b> - <i>\"+ar[0]+\"</i>\";",
- "\t\t\tclsname = ar[0]; /// possibly?",
- "\t\t}",
- " ",
- " this.model.el.set_value(citer, 0, tr[i] ); // used data. ",
- " this.model.el.set_value(citer, 1, dname ); // displayed value.",
- " ",
- " var clsb = clsname.split(\".\");",
- " var sub = clsb.length > 1 ? clsb[1].down() : \"\";",
- " ",
- " var pix = pixdef;",
- " var fn = \"/usr/share/glade/pixmaps/hicolor/16x16/actions/widget-gtk-\" + sub + \".png\";",
- " if (FileUtils.test (fn, FileTest.IS_REGULAR)) {",
- " \ttry {",
- "\t \tpix = new Gdk.Pixbuf.from_file (fn);",
- " \t} catch (Error e) {}",
- " \t",
- " }",
- " ",
- " ",
- " this.model.el.set_value(citer, 2, pix );",
- " ",
- " ",
- " }",
- " this.model.el.set_sort_column_id(1,Gtk.SortType.ASCENDING);",
- " ",
+ "\t\t\treturn Posix.strcmp( ((JsRender.Node)a).fqn(), ((JsRender.Node)b).fqn());",
+ "\t\t\t",
+ "\t\t});",
+ "\t ",
" ",
- " ",
- " // set size up...",
- " ",
- " this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
- " int w,h;",
- " this.mainwindow.el.get_size(out w, out h);",
+ " var win = this.mainwindow.el;",
+ " //var w = win.get_width();",
+ " var h = win.get_height();",
+ "",
" ",
" // left tree = 250, editor area = 500?",
" ",
"\t// max hieght ...",
" this.el.set_size_request( 350, h); // full height?",
"",
- " ",
+ " this.el.set_parent(onbtn);",
"",
- " if (this.el.relative_to == null) {",
- " this.el.set_relative_to(onbtn);",
- " }",
- " this.el.show_all();",
+ " //if (this.el.relative_to == null) {",
+ " \t//Gtk.Allocation rect;",
+ " \t//onbtn.get_allocation(out rect);",
+ " // this.el.set_pointing_to(rect);",
+ " //}",
+ " this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);",
+ " this.el.show();",
" ",
- " while(Gtk.events_pending()) { ",
- " Gtk.main_iteration();",
- " } ",
- " // this.hpane.el.set_position( 0);",
"}",
""
]
}
],
- "modOrder" : "",
- "name" : "PopoverAddObject",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/PopoverAddObject.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "PopoverAddObject"
}
\ No newline at end of file
-static Xcls_PopoverAddObject _PopoverAddObject;
+ static Xcls_PopoverAddObject _PopoverAddObject;
-public class Xcls_PopoverAddObject : Object
-{
- public Gtk.Popover el;
- private Xcls_PopoverAddObject _this;
-
- public static Xcls_PopoverAddObject singleton()
+ public class Xcls_PopoverAddObject : Object
{
- if (_PopoverAddObject == null) {
- _PopoverAddObject= new Xcls_PopoverAddObject();
+ public Gtk.Popover el;
+ private Xcls_PopoverAddObject _this;
+
+ public static Xcls_PopoverAddObject singleton()
+ {
+ if (_PopoverAddObject == null) {
+ _PopoverAddObject= new Xcls_PopoverAddObject();
+ }
+ return _PopoverAddObject;
}
- return _PopoverAddObject;
- }
- public Xcls_model model;
- public Xcls_iconrender iconrender;
- public Xcls_txtrender txtrender;
-
- // my vars (def)
- public signal void before_node_change (JsRender.Node? node);
- public signal void after_node_change (JsRender.Node? node);
- public signal void drag_end ();
- public Xcls_MainWindow mainwindow;
- public bool active;
-
- // ctor
- public Xcls_PopoverAddObject()
- {
- _this = this;
- this.el = new Gtk.Popover( null );
-
- // my vars (dec)
- this.active = false;
-
- // set gobject values
- this.el.width_request = 900;
- this.el.height_request = 800;
- this.el.hexpand = false;
- this.el.modal = true;
- this.el.position = Gtk.PositionType.RIGHT;
- var child_0 = new Xcls_ScrolledWindow2( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- }
+ public Xcls_viewwin viewwin;
+ public Xcls_view view;
+ public Xcls_selmodel selmodel;
+ public Xcls_model model;
+ public Xcls_maincol maincol;
- // user defined functions
- public void show (Palete.Palete pal, string cls, Gtk.Widget onbtn) {
-
+ // my vars (def)
+ public signal void before_node_change (JsRender.Node? node);
+ public bool modal;
+ public signal void after_node_change (JsRender.Node? node);
+ public bool active;
+ public Xcls_MainWindow mainwindow;
+
+ // ctor
+ public Xcls_PopoverAddObject()
+ {
+ _this = this;
+ this.el = new Gtk.Popover();
+
+ // my vars (dec)
+ this.modal = true;
+ this.active = false;
+
+ // set gobject values
+ this.el.width_request = 900;
+ this.el.height_request = 800;
+ this.el.hexpand = false;
+ this.el.position = Gtk.PositionType.RIGHT;
+ new Xcls_viewwin( _this );
+ this.el.set_child ( _this.viewwin.el );
+ }
+
+ // user defined functions
+ public void a_clear () {
+ var m = (GLib.ListStore) _this.model.el.model;
+ m.remove_all();
+
+
-
-
- var tr = pal.getChildList(cls);
- this.model.el.clear();
-
-
- Gtk.TreeIter citer;
- var ic = Gtk.IconTheme.get_default();
- Gdk.Pixbuf pixdef = null;
- try {
- pixdef = ic.load_icon("emblem-new", 16,0);
- } catch (Error e) {
- }
-
- for(var i =0 ; i < tr.length; i++) {
- this.model.el.append(out citer);
- var dname = tr[i];
- var clsname = dname;
- if (dname.contains(":")) {
- var ar = dname.split(":");
- dname = "<b>" + ar[1] +"</b> - <i>"+ar[0]+"</i>";
- clsname = ar[0]; /// possibly?
- }
-
- this.model.el.set_value(citer, 0, tr[i] ); // used data.
- this.model.el.set_value(citer, 1, dname ); // displayed value.
-
- var clsb = clsname.split(".");
- var sub = clsb.length > 1 ? clsb[1].down() : "";
-
- var pix = pixdef;
- var fn = "/usr/share/glade/pixmaps/hicolor/16x16/actions/widget-gtk-" + sub + ".png";
- if (FileUtils.test (fn, FileTest.IS_REGULAR)) {
- try {
- pix = new Gdk.Pixbuf.from_file (fn);
- } catch (Error e) {}
-
- }
-
-
- this.model.el.set_value(citer, 2, pix );
-
-
}
- this.model.el.set_sort_column_id(1,Gtk.SortType.ASCENDING);
+ public void show (Palete.Palete pal, string cls, Gtk.Widget onbtn) {
+
+ var tr = pal.getChildList(cls, false);
+ var m = (GLib.ListStore) _this.model.el.model;
+ m.remove_all();
- // set size up...
+
+ // new version will not support properties here..
+ // they will be part of the properties, clicking will add a node..
+ // will change the return list above eventually?
+
+
+ foreach (var dname in tr) {
+
- this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
- int w,h;
- this.mainwindow.el.get_size(out w, out h);
+ GLib.debug("add to model: %s", dname);
+ m.append(pal.fqnToNode(dname));
+ }
+ m.sort( (a, b) => {
- // left tree = 250, editor area = 500?
+ return Posix.strcmp( ((JsRender.Node)a).fqn(), ((JsRender.Node)b).fqn());
+
+ });
+
+
+ var win = this.mainwindow.el;
+ //var w = win.get_width();
+ var h = win.get_height();
- // min 450?
- // max hieght ...
- this.el.set_size_request( 350, h); // full height?
-
+
+ // left tree = 250, editor area = 500?
+
+ // min 450?
+ // max hieght ...
+ this.el.set_size_request( 350, h); // full height?
-
- if (this.el.relative_to == null) {
- this.el.set_relative_to(onbtn);
+ this.el.set_parent(onbtn);
+
+ //if (this.el.relative_to == null) {
+ //Gtk.Allocation rect;
+ //onbtn.get_allocation(out rect);
+ // this.el.set_pointing_to(rect);
+ //}
+ this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);
+ this.el.show();
+
}
- this.el.show_all();
-
- while(Gtk.events_pending()) {
- Gtk.main_iteration();
- }
- // this.hpane.el.set_position( 0);
- }
- public void clear () {
- this.model.el.clear();
- }
- public void hide () {
-
- this.el.hide();
- }
- public class Xcls_ScrolledWindow2 : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_PopoverAddObject _this;
+ public void hide () {
+
+ this.el.hide();
+ }
+ public class Xcls_viewwin : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private Xcls_PopoverAddObject _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_ScrolledWindow2(Xcls_PopoverAddObject _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
+ // ctor
+ public Xcls_viewwin(Xcls_PopoverAddObject _owner )
+ {
+ _this = _owner;
+ _this.viewwin = this;
+ this.el = new Gtk.ScrolledWindow();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.shadow_type = Gtk.ShadowType.IN;
- var child_0 = new Xcls_TreeView3( _this );
- child_0.ref();
- this.el.add ( child_0.el );
+ // set gobject values
+ new Xcls_view( _this );
+ this.el.set_child ( _this.view.el );
+
+ // init method
- // init method
+ this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+ this.el.set_size_request(-1,200);
+ }
- this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
- this.el.set_size_request(-1,200);
+ // user defined functions
}
+ public class Xcls_view : Object
+ {
+ public Gtk.ColumnView el;
+ private Xcls_PopoverAddObject _this;
- // user defined functions
- }
- public class Xcls_TreeView3 : Object
- {
- public Gtk.TreeView el;
- private Xcls_PopoverAddObject _this;
+ // my vars (def)
- // my vars (def)
- public string dragData;
- public Gtk.CssProvider css;
+ // ctor
+ public Xcls_view(Xcls_PopoverAddObject _owner )
+ {
+ _this = _owner;
+ _this.view = this;
+ new Xcls_selmodel( _this );
+ this.el = new Gtk.ColumnView( _this.selmodel.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ var child_2 = new Xcls_DragSource4( _this );
+ child_2.ref();
+ this.el.add_controller( child_2.el );
+ new Xcls_maincol( _this );
+ this.el.append_column ( _this.maincol.el );
+ var child_4 = new Xcls_GestureClick9( _this );
+ child_4.ref();
+ this.el.add_controller( child_4.el );
+ }
- // ctor
- public Xcls_TreeView3(Xcls_PopoverAddObject _owner )
+ // user defined functions
+ public Gtk.Widget? getWidgetAtRow (uint row) {
+ /*
+ // ?? could be done with model?
+
+ 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 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_DragSource4 : Object
{
- _this = _owner;
- this.el = new Gtk.TreeView();
+ public Gtk.DragSource el;
+ private Xcls_PopoverAddObject _this;
- // my vars (dec)
- // set gobject values
- this.el.name = "popover-add-object-view";
- this.el.enable_tree_lines = true;
- this.el.headers_visible = true;
- var child_0 = new Xcls_model( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_TreeViewColumn5( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
-
- // init method
+ // my vars (def)
+ // ctor
+ public Xcls_DragSource4(Xcls_PopoverAddObject _owner )
{
- this.el.set_size_request(150,-1);
- // set_reorderable: [1]
-
-
- this.css = new Gtk.CssProvider();
- try {
- this.css.load_from_data("#popover-add-object-view { font-szie: 12px;}");
- } catch (Error e) {}
- this.el.get_style_context().add_provider(this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
-
-
- var selection = this.el.get_selection();
- selection.set_mode( Gtk.SelectionMode.SINGLE);
- // this.selection.signal['changed'].connect(function() {
- // _view.listeners['cursor-changed'].apply(_view, [ _view, '']);
- //});
- // see: http://live.gnome.org/GnomeLove/DragNDropTutorial
-
- Gtk.drag_source_set (
- this.el, /* widget will be drag-able */
- Gdk.ModifierType.BUTTON1_MASK, /* modifier that will start a drag */
- BuilderApplication.targetList, /* lists of target to support */
- Gdk.DragAction.COPY /* what to do with data after dropped */
- );
- //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);
-
- // Gtk.drag_source_set_target_list(this.el, Application.targetList);
- // Gtk.drag_source_add_text_targets(this.el);
-
- }
+ _this = _owner;
+ this.el = new Gtk.DragSource();
- //listeners
- this.el.button_press_event.connect( ( event) => {
-
- // if (!this.get('/Editor').save()) {
- // // popup!! - click handled..
- // return true;
- // }
- return false;
- });
- this.el.drag_begin.connect( ( ctx) => {
- // we could fill this in now...
- // Seed.print('SOURCE: drag-begin');
-
-
-
- Gtk.TreeIter iter;
- var s = this.el.get_selection();
-
- Gtk.TreeModel mod;
- s.get_selected(out mod, out iter);
- var path = mod.get_path(iter);
+ // 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);
- /// pix is a surface..
- var pix = this.el.create_row_drag_icon ( path);
+ //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);
- Gtk.drag_set_icon_surface (ctx, pix);
- GLib.Value value;
-
-
- _this.model.el.get_value(iter, 0, out value);
-
- this.dragData = (string) value;
-
-
- return;
- });
- this.el.drag_data_get.connect( (drag_context, selection_data, info, time) => {
- //Seed.print('Palete: drag-data-get: ' + target_type);
- if (this.dragData.length < 1 ) {
- return;
- }
+
+ });
+ this.el.drag_end.connect( (drag, delete_data) => {
+ _this.hide();
- GLib.debug("setting drag data to %s\n", this.dragData);
- // selection_data.set_text(this.dragData ,this.dragData.length);
- selection_data.set (selection_data.get_target (), 8, (uchar[]) this.dragData.to_utf8 ());
-
- //this.el.dragData = "TEST from source widget";
-
-
- });
- this.el.drag_end.connect( ( drag_context) => {
- GLib.debug("SOURCE: drag-end (call listener on this)\n");
-
- this.dragData = "";
- //this.dropList = null;
- _this.drag_end(); // call signal..
- //this.get('/LeftTree.view').highlight(false);
-
- });
+ });
+ }
+
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_model : Object
- {
- public Gtk.ListStore el;
- private Xcls_PopoverAddObject _this;
+ public class Xcls_selmodel : Object
+ {
+ public Gtk.SingleSelection el;
+ private Xcls_PopoverAddObject _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_model(Xcls_PopoverAddObject _owner )
- {
- _this = _owner;
- _this.model = this;
- this.el = new Gtk.ListStore.newv( { typeof(string),typeof(string),typeof(Gdk.Pixbuf) } );
+ // ctor
+ public Xcls_selmodel(Xcls_PopoverAddObject _owner )
+ {
+ _this = _owner;
+ _this.selmodel = this;
+ new Xcls_model( _this );
+ this.el = new Gtk.SingleSelection( _this.model.el );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ }
- // user defined functions
- public string getValue (Gtk.TreeIter iter, int col) {
- GLib.Value gval;
- this.el.get_value(iter, col , out gval);
- return (string)gval;
-
+ // 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_PopoverAddObject _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_model(Xcls_PopoverAddObject _owner )
+ {
+ _this = _owner;
+ _this.model = this;
+ this.el = new Gtk.TreeListModel(
+ new GLib.ListStore(typeof(JsRender.Node)), //..... << that's our store..
+ false, // passthru
+ true, // autexpand
+ (item) => {
+ return ((JsRender.Node)item).childstore;
+
}
+
+
+);
- public class Xcls_TreeViewColumn5 : Object
- {
- public Gtk.TreeViewColumn el;
- private Xcls_PopoverAddObject _this;
+ // my vars (dec)
+ // set gobject values
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_TreeViewColumn5(Xcls_PopoverAddObject _owner )
+
+ public class Xcls_maincol : Object
{
- _this = _owner;
- this.el = new Gtk.TreeViewColumn();
+ public Gtk.ColumnViewColumn el;
+ private Xcls_PopoverAddObject _this;
- // my vars (dec)
- // set gobject values
- this.el.title = "Drag to add Object";
- var child_0 = new Xcls_iconrender( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
- var child_1 = new Xcls_txtrender( _this );
- child_1.ref();
- this.el.pack_start ( child_1.el , true );
-
- // init method
-
- this.el.add_attribute(_this.txtrender.el , "markup", 1 );
- this.el.add_attribute(_this.iconrender.el , "pixbuf", 2 );
- }
+ // my vars (def)
- // user defined functions
- }
- public class Xcls_iconrender : Object
- {
- public Gtk.CellRendererPixbuf el;
- private Xcls_PopoverAddObject _this;
+ // ctor
+ public Xcls_maincol(Xcls_PopoverAddObject _owner )
+ {
+ _this = _owner;
+ _this.maincol = this;
+ var child_1 = new Xcls_SignalListItemFactory8( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Drag to add Object", child_1.el );
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ this.el.id = "maincol";
+ this.el.expand = true;
+ }
- // ctor
- public Xcls_iconrender(Xcls_PopoverAddObject _owner )
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory8 : Object
{
- _this = _owner;
- _this.iconrender = this;
- this.el = new Gtk.CellRendererPixbuf();
+ public Gtk.SignalListItemFactory el;
+ private Xcls_PopoverAddObject _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_SignalListItemFactory8(Xcls_PopoverAddObject _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
- public class Xcls_txtrender : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_PopoverAddObject _this;
+ // my vars (dec)
+ // set gobject values
- // my vars (def)
+ //listeners
+ this.el.setup.connect( (listitem) => {
+
+
+ var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);
+ var icon = new Gtk.Image();
+ var lbl = new Gtk.Label("");
+ lbl.use_markup = true;
+
+
+ lbl.justify = Gtk.Justification.LEFT;
+ lbl.xalign = 0;
+ lbl.margin_start = 4;
+ // listitem.activatable = true; ??
+
+ hbox.append(icon);
+ hbox.append(lbl);
+
+ ((Gtk.ListItem)listitem).set_child(hbox);
+
+ });
+ 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 hbox = (Gtk.Box) ((Gtk.ListItem)listitem).get_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());
+ GLib.debug("lbl is %s", lbl.get_type().name());
+ GLib.debug("node fqn %s", node.fqn());
+ // was item (1) in old layout
+
+
+ img.file = node.iconFilename;
+ lbl.label = node.fqn();
+ // lbl.tooltip_markup = node.nodeTip();
+
+
+ // bind image...
+
+ });
+ }
- // ctor
- public Xcls_txtrender(Xcls_PopoverAddObject _owner )
+ // user defined functions
+ }
+
+
+ public class Xcls_GestureClick9 : Object
{
- _this = _owner;
- _this.txtrender = this;
- this.el = new Gtk.CellRendererText();
+ public Gtk.GestureClick el;
+ private Xcls_PopoverAddObject _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_GestureClick9(Xcls_PopoverAddObject _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) { /// doubleclick?
+ return;
+ }
+ //var pos = "";
+ // find left tree selected node
+ var addto = _this.mainwindow.windowstate.left_tree.selmodel.getSelectedNode();
+ //var row = _this.view.getRowAt(x,y, out pos);
+
+ var add = _this.selmodel.getSelectedNode().deepClone();
+ addto.appendChild(add);
+ _this.mainwindow.windowstate.left_props.changed();
+ _this.mainwindow.windowstate.left_tree.model.selectNode(add);
+ });
+ }
+ // user defined functions
+ }
-}
+ }
{
"build_module" : "",
+ "gen_extended" : false,
"items" : [
{
"# JsRender.NodePropType ptype" : "",
"$ xns" : "Gtk",
- "@ void select" : "(JsRender.NodeProp prop)",
+ "* ctor" : "new Gtk.Popover()",
"Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
+ "JsRender.Node? node" : "null",
"Xcls_MainWindow mainwindow" : "",
"bool active" : false,
"bool hexpand" : false,
{
"$ shadow_type" : "Gtk.ShadowType.IN",
"$ xns" : "Gtk",
- "* init" : [
- " this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
- " "
- ],
- "* pack" : "add",
+ "* pack" : "set_child",
+ "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
+ "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
+ "id" : "viewwin",
"items" : [
{
- "$ enable_tree_lines" : true,
- "$ headers_visible" : true,
"$ xns" : "Gtk",
- "* init" : [
- "{ ",
- " ",
- "\tthis.css = new Gtk.CssProvider();",
- "\ttry {",
- "\t\tthis.css.load_from_data(\"#popover-add-prop-view { font-sze: 12px;}\");",
- "\t} catch (Error e) {}",
- " this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);",
- "\t ",
- "\t ",
- " ",
- " this.el.get_selection().set_mode( Gtk.SelectionMode.SINGLE);",
- " ",
- "",
- " ",
- " ",
- " ",
- "}",
- ""
- ],
- "* pack" : "add",
- "Gtk.CssProvider css" : "",
+ "* pack" : "set_child",
+ "bool hexpand" : true,
+ "bool reorderable" : true,
+ "bool show_column_separators" : true,
+ "bool show_row_separators" : true,
+ "bool single_click_activate" : false,
+ "bool vexpand" : true,
+ "id" : "view",
"items" : [
{
- "$ columns" : [
- "",
- "typeof(JsRender.NodeProp), // 0 real key",
- "typeof(string), // 1 text display",
- "typeof(string), // 2 tooltip",
- "typeof(string), // 3 sortable string",
- "typeof(string), // 4 prop type",
- "typeof(string) // 5 from interface",
- "",
- " "
- ],
"$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "model",
- "n_columns" : 6,
- "xtype" : "ListStore",
- "| JsRender.NodeProp getValue" : [
- "(Gtk.TreeIter iter)",
- "{",
+ "listeners" : {
+ "pressed" : [
+ "(n_press, x, y) => {",
+ " ",
+ "\tif (n_press < 2) { /// doubleclick?",
+ "\t\treturn;",
+ "\t}",
+ "\t//string pos;",
+ "\t",
+ "\t",
+ "\t// use selection?!",
+ "\tvar tr = (Gtk.TreeListRow)_this.selmodel.el.selected_item;",
+ "\tGLib.debug(\"SELECTED = %s\", tr.item.get_type().name());",
+ "\tvar prop = (JsRender.NodeProp) tr.item;",
+ "",
+ "\t",
+ "\t",
+ "\t// double press ? ",
+ "//\tvar row = _this.view.getRowAt(x,y, out pos );",
+ "//\tvar prop = _this.sortmodel.getNodeAt(row);",
+ " ",
+ "//\t_this.select(np);",
+ "\t",
+ "\tif (!prop.name.contains(\"[]\") && _this.node.has_prop_key(prop)) {",
+ "\t\tGLib.debug(\"node already has this key.\");",
+ "\t\treturn; // cant add it twice? -- ",
+ "\t}",
+ "\t// you can not click on ones with children.",
+ "\t",
+ "\tif (prop.childstore.n_items > 0 ) {",
+ "\t\tGLib.debug(\"no clicking on expandables\");",
+ "\t\treturn;",
+ "\t}",
+ "\t// if it's a node...",
+ "\tif (prop.add_node != null) {",
+ "",
+ "\t\tif (!prop.name.contains(\"[]\") && null != _this.node.findProp(prop.name)) {",
+ "\t\t\tGLib.debug(\"Add Child already contains child with %s\", prop.name);\t",
+ "\t\t\treturn;\t\t\t\t\t",
+ "\t\t}",
+ "\t\t GLib.debug(\"Add Child Node %s\", prop.name);\t\t\t",
+ "\t\t _this.el.hide();",
+ "\t\t var add = prop.add_node.deepClone();",
+ "\t\t_this.node.appendChild(add);",
+ "\t\t _this.mainwindow.windowstate.left_props.changed();",
+ "\t\t _this.mainwindow.windowstate.left_tree.model.selectNode(add);",
+ "\t\t ",
+ "\t\treturn;",
+ "\t}",
+ "\t",
+ "\t_this.el.hide();",
+ "\tGLib.debug(\"Add %s\", prop.name);",
+ "\tvar add = prop.dupe();",
+ "\t_this.node.add_prop(add);",
+ "\t _this.mainwindow.windowstate.left_props.changed();",
+ " \t_this.mainwindow.windowstate.left_props.view.editProp(add);",
+ "\t",
+ "",
+ "\t //_this.mainwindow.windowstate.left_props.changed();",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "GestureClick"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "bool can_unselect" : true,
+ "id" : "selmodel",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ "\t//this.el.set_sorter(new Gtk.TreeListRowSorter(_this.view.el.sorter));",
+ "}",
+ ""
+ ],
+ "* prop" : "model",
+ "id" : "sortmodel",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* ctor" : [
+ "new Gtk.TreeListModel(",
+ " new GLib.ListStore(typeof(JsRender.NodeProp)), //..... << that's our store..",
+ " false, // passthru",
+ " false, // autexpand",
+ " (item) => {",
+ " \treturn ((JsRender.NodeProp)item).childstore;",
+ " ",
+ " }",
+ " ",
+ " ",
+ ")"
+ ],
+ "* prop" : "model",
+ "id" : "model",
+ "xtype" : "TreeListModel",
+ "| JsRender.NodeProp getNodeAt" : [
+ "(uint row) {",
+ "",
+ " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
+ " ",
+ " return (JsRender.NodeProp)tr.get_item();",
+ "\t ",
+ "}"
+ ]
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "sorter",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "sorter",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "expression",
+ "GLib.Type this_type" : "typeof(JsRender.NodeProp)",
+ "string property_name" : "sort_name",
+ "xtype" : "PropertyExpression"
+ }
+ ],
+ "xtype" : "StringSorter"
+ }
+ ],
+ "xtype" : "TreeListRowSorter"
+ }
+ ],
+ "xtype" : "SortListModel",
+ "| JsRender.NodeProp? getNodeAt" : [
+ "(uint row) {",
+ "",
+ " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
+ " ",
+ " // GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
+ " \t",
+ " ",
+ " return (JsRender.NodeProp)tr.get_item();",
+ "\t ",
+ "}"
+ ]
+ }
+ ],
+ "xtype" : "SingleSelection",
+ "| JsRender.NodeProp? getNodeAt" : [
+ "(uint row) {",
"",
- " GLib.Value value;",
- " this.el.get_value(iter, 0, out value);",
- " ",
- " return (JsRender.NodeProp)value;",
+ " 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.NodeProp)tr.get_item();",
+ "\t ",
"}"
]
},
{
"$ xns" : "Gtk",
"* init" : [
- " this.el.add_attribute(_this.namerender.el , \"markup\", 1 );",
- " ",
- " this.el.add_attribute(_this.namerender.el , \"tooltip\", 2 );"
+ "{",
+ "\t this.el.set_sorter( new Gtk.StringSorter(",
+ "\t \tnew Gtk.PropertyExpression(typeof(JsRender.NodeProp), null, \"name\")",
+ " \t));",
+ "\t\t",
+ "}",
+ ""
],
"* pack" : "append_column",
- "id" : "namecol",
- "int sort_column_id" : 3,
+ "bool expand" : true,
+ "bool resizable" : true,
+ "id" : "name",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "namerender",
- "xtype" : "CellRendererText"
+ "* prop" : "factory",
+ "listeners" : {
+ "bind" : [
+ "(listitem) => {",
+ "\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 lbl = (Gtk.Label) expand.child;",
+ "\t",
+ "\t if (lbl.label != \"\") { // do not update",
+ "\t \treturn;",
+ " \t}",
+ "\t",
+ "",
+ "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
+ "\tvar np = (JsRender.NodeProp) lr.get_item();",
+ "\tGLib.debug(\"change %s to %s\", lbl.label, np.name);",
+ "\tlbl.label = np.to_property_option_markup(np.propertyof == _this.node.fqn());",
+ "\tlbl.tooltip_markup = np.to_property_option_tooltip();",
+ "\t ",
+ " expand.set_hide_expander( np.childstore.n_items < 1);",
+ " \texpand.set_list_row(lr);",
+ " ",
+ " \t ",
+ " \t// bind image...",
+ " \t",
+ "}",
+ ""
+ ],
+ "setup" : [
+ "(listitem) => {",
+ "\t",
+ "\tvar expand = new Gtk.TreeExpander();",
+ "\t ",
+ "\texpand.set_indent_for_depth(true);",
+ "\texpand.set_indent_for_icon(true);",
+ "\t ",
+ "\tvar lbl = new Gtk.Label(\"\");",
+ "\tlbl.use_markup = true;",
+ "\t",
+ "\t",
+ " \tlbl.halign = Gtk.Align.START;",
+ " \tlbl.xalign = 0;",
+ "",
+ " ",
+ "\texpand.set_child(lbl);",
+ "\t((Gtk.ListItem)listitem).set_child(expand);",
+ "\t((Gtk.ListItem)listitem).activatable = false;",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "SignalListItemFactory"
}
],
- "utf8 title" : "Double click to add",
- "xtype" : "TreeViewColumn"
+ "string title" : "Double click to add",
+ "xtype" : "ColumnViewColumn"
},
{
"$ xns" : "Gtk",
"* init" : [
- " this.el.add_attribute(_this.typerender.el , \"text\", 4 );",
- " ",
+ "{",
+ "\t this.el.set_sorter( new Gtk.StringSorter(",
+ "\t \tnew Gtk.PropertyExpression(typeof(JsRender.NodeProp), null, \"rtype\")",
+ " \t));",
+ "\t\t",
+ "}",
""
],
"* pack" : "append_column",
- "id" : "type",
- "int sort_column_id" : 4,
+ "bool expand" : true,
+ "bool resizable" : true,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "typerender",
- "xtype" : "CellRendererText"
+ "* prop" : "factory",
+ "listeners" : {
+ "bind" : [
+ "(listitem) => {",
+ "\t",
+ " \tvar lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child(); ",
+ " \tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
+ "\tvar np = (JsRender.NodeProp) lr.get_item();",
+ "\t",
+ " if (lbl.label != \"\") { // do not update",
+ "\t \treturn;",
+ " \t}",
+ "\tlbl.label = np.rtype;",
+ " \t ",
+ "}",
+ ""
+ ],
+ "setup" : [
+ "(listitem) => {",
+ "",
+ "\t ",
+ "\tvar label = new Gtk.Label(\"\");",
+ " \tlabel.halign = Gtk.Align.START;",
+ " \tlabel.xalign = 0;",
+ "\t((Gtk.ListItem)listitem).set_child(label);",
+ "\t((Gtk.ListItem)listitem).activatable = false;",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "SignalListItemFactory"
}
],
"string title" : "Type",
- "xtype" : "TreeViewColumn"
+ "xtype" : "ColumnViewColumn"
},
{
"$ xns" : "Gtk",
"* init" : [
- " this.el.add_attribute(_this.fromrender.el , \"text\", 5);",
- " ",
+ "{",
+ "\t this.el.set_sorter( new Gtk.StringSorter(",
+ "\t \tnew Gtk.PropertyExpression(typeof(JsRender.NodeProp), null, \"propertyof\")",
+ " \t));",
+ "\t\t",
+ "}",
""
],
"* pack" : "append_column",
- "id" : "from",
- "int sort_column_id" : 5,
+ "bool expand" : true,
+ "bool resizable" : true,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "fromrender",
- "xtype" : "CellRendererText"
+ "* prop" : "factory",
+ "listeners" : {
+ "bind" : [
+ "(listitem) => {",
+ "",
+ " \tvar lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child(); ",
+ " \tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
+ "\tvar np = (JsRender.NodeProp) lr.get_item();",
+ "\t",
+ " if (lbl.label != \"\") { // do not update",
+ "\t \treturn;",
+ " \t}",
+ "\tlbl.label = np.propertyof;",
+ " \t ",
+ "}",
+ ""
+ ],
+ "setup" : [
+ "(listitem) => {",
+ "",
+ "\t ",
+ "\tvar label = new Gtk.Label(\"\");",
+ "\tlabel.halign = Gtk.Align.START;",
+ " \tlabel.xalign = 0;",
+ "\t((Gtk.ListItem)listitem).set_child(label);",
+ "\t((Gtk.ListItem)listitem).activatable = false;",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "SignalListItemFactory"
}
],
- "string title" : "From",
- "xtype" : "TreeViewColumn"
+ "string title" : "Property of",
+ "xtype" : "ColumnViewColumn"
}
],
- "listeners" : {
- "row_activated" : [
- "(path, column) => {",
- "",
- "\tGtk.TreeIter iter;",
- "",
- "",
- "\tvar m = _this.model;",
- "",
- "\tm.el.get_iter(out iter,path);",
- "",
- " ",
- "\tvar prop = m.getValue(iter);",
- " ",
- "",
- "\t// hide the popover",
- "\t_this.el.hide();",
- "\t ",
- "\t",
- "\t_this.select(prop);",
- " ",
- "}",
- " "
- ]
- },
- "string name" : "popover-add-prop-view",
- "tooltip_column" : 2,
- "xtype" : "TreeView"
+ "xtype" : "ColumnView",
+ "| int getRowAt" : [
+ "(double x, double in_y, out string pos) {",
+ "",
+ "",
+ "\t ",
+ "",
+ "/*",
+ " \t",
+ "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
+ " \tvar colview = gesture.widget;",
+ " \tvar line_no = check_list_widget(colview, x,y);",
+ " if (line_no > -1) {",
+ " \t\tvar item = colview.model.get_item(line_no);",
+ " \t\t ",
+ " \t}",
+ " \t*/",
+ " \t\t ",
+ " \t\t",
+ " \t\t//GLib.debug(\"offset = %d y = %d\", (int) voff, (int) in_y);",
+ " \tvar y = in_y + _this.viewwin.el.vadjustment.value; ",
+ " var child = this.el.get_first_child(); ",
+ " \t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
+ " \tvar line_no = -1; ",
+ " \tvar reading_header = true;",
+ " \tvar real_y = 0;",
+ " \tvar header_height = 0;",
+ " \tpos = \"none\";",
+ " \tvar h = 0;",
+ " \twhile (child != null) {",
+ "\t\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
+ " \t if (reading_header) {",
+ "\t\t\t\t",
+ "",
+ "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
+ "\t\t\t h += child.get_height();",
+ "\t\t\t\t\tchild = child.get_next_sibling();",
+ "\t\t\t\t\tcontinue;",
+ "\t\t\t\t}",
+ "\t\t\t\t// should be columnlistview",
+ "\t\t\t\tchild = child.get_first_child(); ",
+ "\t\t\t GLib.debug(\"header height=%d\", h);",
+ "\t\t\t\theader_height = h;",
+ "\t\t\t\t",
+ "\t\t\t\treading_header = false;",
+ "\t\t\t\t",
+ "\t }",
+ "\t ",
+ "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
+ " \t\t child = child.get_next_sibling();",
+ " \t\t continue;",
+ "\t\t }",
+ "\t\t ",
+ "\t\t \tif (y < header_height) {",
+ "\t\t \treturn -1;",
+ "\t \t}",
+ "\t\t ",
+ "\t\t line_no++;",
+ "\t\t\tvar hh = child.get_height();",
+ "\t\t\t//child.get_allocation(out alloc);",
+ "\t\t\t//GLib.debug(\"got cell xy = %d,%d w,h= %d,%d\", alloc.x, alloc.y, alloc.width, alloc.height);",
+ "\t\t\t//GLib.debug(\"row %d y= %d %s\", line_no, (int) (header_height + alloc.y),",
+ "\t\t\t",
+ "\t\t\t//\tchild.visible ? \"VIS\" : \"hidden\");",
+ "",
+ "\t\t if (y > (header_height + real_y) && y <= (header_height + real_y + hh) ) {",
+ "\t\t \tif (y > ( header_height + real_y + (hh * 0.8))) {",
+ "\t\t \t\tpos = \"below\";",
+ "\t \t\t} else if (y > ( header_height + real_y + (hh * 0.2))) {",
+ "\t \t\t\tpos = \"over\";",
+ " \t\t\t} else {",
+ " \t\t\t\tpos = \"above\";",
+ "\t\t\t\t}",
+ "\t\t \t GLib.debug(\"getRowAt return : %d, %s\", line_no, pos);",
+ "\t\t\t return line_no;",
+ "\t\t }",
+ " ",
+ "",
+ "\t\t if (real_y + hh > y) {",
+ "\t\t return -1;",
+ "\t }",
+ "\t real_y += hh;",
+ "\t child = child.get_next_sibling(); ",
+ " \t}",
+ " return -1;",
+ "",
+ " }"
+ ]
}
],
"xtype" : "ScrolledWindow"
"xtype" : "Popover",
"| void clear" : [
"() {",
- " this.model.el.clear();",
+ " var m = (GLib.ListStore) _this.model.el.model;",
+ "\tm.remove_all();",
+ "",
"}",
""
],
"() {",
"\tthis.ptype = JsRender.NodePropType.NONE;",
"\tthis.el.hide();",
+ "\tthis.node = null;",
"}",
""
],
"| void show" : [
- "(Palete.Palete pal, JsRender.NodePropType ptype, string xtype, Gtk.Widget onbtn) {",
+ "(Palete.Palete pal, JsRender.NodePropType ptype, JsRender.Node node , Gtk.Widget onbtn) {",
"",
" /// what does this do?",
" //if (this.prop_or_listener != \"\" && this.prop_or_listener == prop_or_listener) {",
" //\tthis.el.hide();",
" //\treturn;",
"\t//}",
+ "\tthis.node = node;",
"\t",
+ "\tvar xtype = node.fqn();",
"\t",
+ "\t// ",
"\t",
" this.ptype = ptype;",
" ",
- " this.model.el.clear();",
- "",
- " Gtk.TreeIter iter;",
+ " \t var m = (GLib.ListStore) _this.model.el.model;",
+ "\t m.remove_all();",
+ " ",
+ " ",
+ " ///Gee.HashMap<string,GirObject>",
" var elementList = pal.getPropertiesFor( xtype, ptype);",
" ",
" //print (\"GOT \" + elementList.length + \" items for \" + fullpath + \"|\" + type);",
" ",
" var miter = elementList.map_iterator();",
" while (miter.next()) {",
- " var p = miter.get_value();",
- " ",
- " this.model.el.append(out iter);",
- "\t\t",
- "\t\tvar prop = p.toNodeProp();",
- "\t\t",
- "\t \t ",
- "",
- " this.model.el.set(iter,",
- " 0, prop, ",
- " 1, prop.to_property_option_markup(p.propertyof == xtype),",
- " 2, prop.to_property_option_tooltip(), ",
- " 3, prop.name,",
- " 4, prop.rtype,",
- " 5, p.propertyof,",
- " -1",
- " );",
+ " var p = miter.get_value(); // nodeprop.",
+ " ",
+ "\t\tvar prop = p.toNodeProp(pal, xtype);",
+ "\t\tif (prop == null) {",
+ "\t\t\tcontinue;",
+ "\t\t}",
+ "\t\tif (node.has_prop_key(prop)) {",
+ "\t\t\tGLib.debug(\"Skip - has key already %s\", prop.name);",
+ "\t\t\tcontinue;\t\t\t",
+ "\t\t}",
+ "\t\t//JsRender.NodeProp",
+ "\t\tGLib.debug(\"Prop add %s\", prop.name);",
+ "\t \t m.append(prop);",
" }",
- " this.model.el.set_sort_column_id(3,Gtk.SortType.ASCENDING); ",
" ",
" // set size up...",
" ",
+ " ",
+ " var win = this.mainwindow.el;",
+ " // var w = win.get_width();",
+ " var h = win.get_height() - 50;",
+ "",
"",
- " int w,h;",
- " this.mainwindow.el.get_size(out w, out h);",
- " ",
" // left tree = 250, editor area = 500?",
" ",
" // min 450?",
"\t// max hieght ...",
" this.el.set_size_request( 550, h);",
+ " //this.el.set_parent(onbtn);",
+ "\t_this.view.el.sort_by_column(null, Gtk.SortType.ASCENDING);",
+ "\t_this.view.el.sort_by_column(_this.name.el, Gtk.SortType.ASCENDING);",
"",
- " ",
- "",
- " if (this.el.relative_to == null) {",
- " this.el.set_relative_to(onbtn);",
- " }",
- " this.el.show_all();",
+ "\t//Gtk.Allocation rect;",
+ "\t//onbtn.get_allocation(out rect);",
+ "\t//this.el.set_pointing_to(rect);",
+ " this.el.show();",
" ",
- " while(Gtk.events_pending()) { ",
- " Gtk.main_iteration(); // why?",
- " } ",
+ " //while(Gtk.events_pending()) { ",
+ " // Gtk.main_iteration(); // why?",
+ " //} ",
" // this.hpane.el.set_position( 0);",
"}",
""
]
}
],
- "modOrder" : "",
- "name" : "PopoverAddProp",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/PopoverAddProp.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "PopoverAddProp"
}
\ No newline at end of file
-static Xcls_PopoverAddProp _PopoverAddProp;
+ static Xcls_PopoverAddProp _PopoverAddProp;
-public class Xcls_PopoverAddProp : Object
-{
- public Gtk.Popover el;
- private Xcls_PopoverAddProp _this;
-
- public static Xcls_PopoverAddProp singleton()
- {
- if (_PopoverAddProp == null) {
- _PopoverAddProp= new Xcls_PopoverAddProp();
- }
- return _PopoverAddProp;
- }
- public Xcls_model model;
- public Xcls_namecol namecol;
- public Xcls_namerender namerender;
- public Xcls_type type;
- public Xcls_typerender typerender;
- public Xcls_from from;
- public Xcls_fromrender fromrender;
-
- // my vars (def)
- public JsRender.NodePropType ptype;
- public signal void select (JsRender.NodeProp prop);
- public Xcls_MainWindow mainwindow;
- public bool active;
-
- // ctor
- public Xcls_PopoverAddProp()
+ public class Xcls_PopoverAddProp : Object
{
- _this = this;
- this.el = new Gtk.Popover( null );
-
- // my vars (dec)
- this.active = false;
-
- // set gobject values
- this.el.width_request = 900;
- this.el.height_request = 800;
- this.el.hexpand = false;
- this.el.modal = true;
- this.el.position = Gtk.PositionType.RIGHT;
- var child_0 = new Xcls_ScrolledWindow2( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- }
-
- // user defined functions
- public void show (Palete.Palete pal, JsRender.NodePropType ptype, string xtype, Gtk.Widget onbtn) {
-
- /// what does this do?
- //if (this.prop_or_listener != "" && this.prop_or_listener == prop_or_listener) {
- // this.prop_or_listener = "";
- // this.el.hide();
- // return;
- //}
-
-
-
- this.ptype = ptype;
-
- this.model.el.clear();
-
- Gtk.TreeIter iter;
- var elementList = pal.getPropertiesFor( xtype, ptype);
-
- //print ("GOT " + elementList.length + " items for " + fullpath + "|" + type);
- // console.dump(elementList);
-
- var miter = elementList.map_iterator();
- while (miter.next()) {
- var p = miter.get_value();
-
- this.model.el.append(out iter);
-
- var prop = p.toNodeProp();
-
-
-
- this.model.el.set(iter,
- 0, prop,
- 1, prop.to_property_option_markup(p.propertyof == xtype),
- 2, prop.to_property_option_tooltip(),
- 3, prop.name,
- 4, prop.rtype,
- 5, p.propertyof,
- -1
- );
- }
- this.model.el.set_sort_column_id(3,Gtk.SortType.ASCENDING);
-
- // set size up...
-
-
- int w,h;
- this.mainwindow.el.get_size(out w, out h);
-
- // left tree = 250, editor area = 500?
-
- // min 450?
- // max hieght ...
- this.el.set_size_request( 550, h);
-
-
-
- if (this.el.relative_to == null) {
- this.el.set_relative_to(onbtn);
- }
- this.el.show_all();
-
- while(Gtk.events_pending()) {
- Gtk.main_iteration(); // why?
- }
- // this.hpane.el.set_position( 0);
- }
- public void clear () {
- this.model.el.clear();
- }
- public void hide () {
- this.ptype = JsRender.NodePropType.NONE;
- this.el.hide();
- }
- public class Xcls_ScrolledWindow2 : Object
- {
- public Gtk.ScrolledWindow el;
+ public Gtk.Popover el;
private Xcls_PopoverAddProp _this;
+ public static Xcls_PopoverAddProp singleton()
+ {
+ if (_PopoverAddProp == null) {
+ _PopoverAddProp= new Xcls_PopoverAddProp();
+ }
+ return _PopoverAddProp;
+ }
+ public Xcls_viewwin viewwin;
+ public Xcls_view view;
+ public Xcls_selmodel selmodel;
+ public Xcls_sortmodel sortmodel;
+ public Xcls_model model;
+ public Xcls_name name;
// my vars (def)
+ public bool modal;
+ public JsRender.NodePropType ptype;
+ public bool active;
+ public Xcls_MainWindow mainwindow;
+ public JsRender.Node? node;
// ctor
- public Xcls_ScrolledWindow2(Xcls_PopoverAddProp _owner )
+ public Xcls_PopoverAddProp()
{
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
+ _this = this;
+ this.el = new Gtk.Popover();
// my vars (dec)
+ this.modal = true;
+ this.active = false;
+ this.node = null;
// set gobject values
- this.el.shadow_type = Gtk.ShadowType.IN;
- var child_0 = new Xcls_TreeView3( _this );
- child_0.ref();
- this.el.add ( child_0.el );
-
- // init method
-
- this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+ this.el.width_request = 900;
+ this.el.height_request = 800;
+ this.el.hexpand = false;
+ this.el.position = Gtk.PositionType.RIGHT;
+ new Xcls_viewwin( _this );
+ this.el.set_child ( _this.viewwin.el );
}
// user defined functions
- }
- public class Xcls_TreeView3 : Object
- {
- public Gtk.TreeView el;
- private Xcls_PopoverAddProp _this;
+ public void show (Palete.Palete pal, JsRender.NodePropType ptype, JsRender.Node node , Gtk.Widget onbtn) {
+
+ /// what does this do?
+ //if (this.prop_or_listener != "" && this.prop_or_listener == prop_or_listener) {
+ // this.prop_or_listener = "";
+ // this.el.hide();
+ // return;
+ //}
+ this.node = node;
+
+ var xtype = node.fqn();
+
+ //
+
+ this.ptype = ptype;
+
+ var m = (GLib.ListStore) _this.model.el.model;
+ m.remove_all();
+
+
+ ///Gee.HashMap<string,GirObject>
+ var elementList = pal.getPropertiesFor( xtype, ptype);
+
+ //print ("GOT " + elementList.length + " items for " + fullpath + "|" + type);
+ // console.dump(elementList);
+
+ var miter = elementList.map_iterator();
+ while (miter.next()) {
+ var p = miter.get_value(); // nodeprop.
+
+ var prop = p.toNodeProp(pal, xtype);
+ if (prop == null) {
+ continue;
+ }
+ if (node.has_prop_key(prop)) {
+ GLib.debug("Skip - has key already %s", prop.name);
+ continue;
+ }
+ //JsRender.NodeProp
+ GLib.debug("Prop add %s", prop.name);
+ m.append(prop);
+ }
+
+ // set size up...
+
+
+ var win = this.mainwindow.el;
+ // var w = win.get_width();
+ var h = win.get_height() - 50;
+
+
+ // left tree = 250, editor area = 500?
+
+ // min 450?
+ // max hieght ...
+ this.el.set_size_request( 550, h);
+ //this.el.set_parent(onbtn);
+ _this.view.el.sort_by_column(null, Gtk.SortType.ASCENDING);
+ _this.view.el.sort_by_column(_this.name.el, Gtk.SortType.ASCENDING);
+
+ //Gtk.Allocation rect;
+ //onbtn.get_allocation(out rect);
+ //this.el.set_pointing_to(rect);
+ this.el.show();
+
+ //while(Gtk.events_pending()) {
+ // Gtk.main_iteration(); // why?
+ //}
+ // this.hpane.el.set_position( 0);
+ }
+ public void clear () {
+ var m = (GLib.ListStore) _this.model.el.model;
+ m.remove_all();
+
+ }
+ public void hide () {
+ this.ptype = JsRender.NodePropType.NONE;
+ this.el.hide();
+ this.node = null;
+ }
+ public class Xcls_viewwin : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private Xcls_PopoverAddProp _this;
- // my vars (def)
- public Gtk.CssProvider css;
+ // my vars (def)
- // ctor
- public Xcls_TreeView3(Xcls_PopoverAddProp _owner )
- {
- _this = _owner;
- this.el = new Gtk.TreeView();
+ // ctor
+ public Xcls_viewwin(Xcls_PopoverAddProp _owner )
+ {
+ _this = _owner;
+ _this.viewwin = this;
+ this.el = new Gtk.ScrolledWindow();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.name = "popover-add-prop-view";
- this.el.tooltip_column = 2;
- this.el.enable_tree_lines = true;
- this.el.headers_visible = true;
- var child_0 = new Xcls_model( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_namecol( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
- var child_2 = new Xcls_type( _this );
- child_2.ref();
- this.el.append_column ( child_2.el );
- var child_3 = new Xcls_from( _this );
- child_3.ref();
- this.el.append_column ( child_3.el );
-
- // init method
-
- {
-
- this.css = new Gtk.CssProvider();
- try {
- this.css.load_from_data("#popover-add-prop-view { font-sze: 12px;}");
- } catch (Error e) {}
- this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
-
-
- this.el.get_selection().set_mode( Gtk.SelectionMode.SINGLE);
-
-
-
-
-
+ // set gobject values
+ this.el.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
+ this.el.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
+ new Xcls_view( _this );
+ this.el.set_child ( _this.view.el );
}
- //listeners
- this.el.row_activated.connect( (path, column) => {
+ // user defined functions
+ }
+ public class Xcls_view : Object
+ {
+ public Gtk.ColumnView el;
+ private Xcls_PopoverAddProp _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_view(Xcls_PopoverAddProp _owner )
+ {
+ _this = _owner;
+ _this.view = this;
+ new Xcls_selmodel( _this );
+ this.el = new Gtk.ColumnView( _this.selmodel.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.single_click_activate = false;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ this.el.show_row_separators = true;
+ this.el.show_column_separators = true;
+ this.el.reorderable = true;
+ var child_2 = new Xcls_GestureClick4( _this );
+ child_2.ref();
+ this.el.add_controller( child_2.el );
+ new Xcls_name( _this );
+ this.el.append_column ( _this.name.el );
+ var child_4 = new Xcls_ColumnViewColumn13( _this );
+ child_4.ref();
+ this.el.append_column ( child_4.el );
+ var child_5 = new Xcls_ColumnViewColumn15( _this );
+ child_5.ref();
+ this.el.append_column ( child_5.el );
+ }
+
+ // user defined functions
+ public int getRowAt (double x, double in_y, out string pos) {
- Gtk.TreeIter iter;
+
- var m = _this.model;
+ /*
+
+ 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) {
+
- m.el.get_iter(out iter,path);
+ 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");
-
- var prop = m.getValue(iter);
+ 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;
+ }
- // hide the popover
- _this.el.hide();
-
-
- _this.select(prop);
-
- });
+ if (real_y + hh > y) {
+ return -1;
+ }
+ real_y += hh;
+ child = child.get_next_sibling();
+ }
+ return -1;
+
+ }
}
+ public class Xcls_GestureClick4 : Object
+ {
+ public Gtk.GestureClick el;
+ private Xcls_PopoverAddProp _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_GestureClick4(Xcls_PopoverAddProp _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) { /// doubleclick?
+ return;
+ }
+ //string pos;
+
+
+ // use selection?!
+ var tr = (Gtk.TreeListRow)_this.selmodel.el.selected_item;
+ GLib.debug("SELECTED = %s", tr.item.get_type().name());
+ var prop = (JsRender.NodeProp) tr.item;
+
+
+
+ // double press ?
+ // var row = _this.view.getRowAt(x,y, out pos );
+ // var prop = _this.sortmodel.getNodeAt(row);
+
+ // _this.select(np);
+
+ if (!prop.name.contains("[]") && _this.node.has_prop_key(prop)) {
+ GLib.debug("node already has this key.");
+ return; // cant add it twice? --
+ }
+ // you can not click on ones with children.
+
+ if (prop.childstore.n_items > 0 ) {
+ GLib.debug("no clicking on expandables");
+ return;
+ }
+ // if it's a node...
+ if (prop.add_node != null) {
+
+ if (!prop.name.contains("[]") && null != _this.node.findProp(prop.name)) {
+ GLib.debug("Add Child already contains child with %s", prop.name);
+ return;
+ }
+ GLib.debug("Add Child Node %s", prop.name);
+ _this.el.hide();
+ var add = prop.add_node.deepClone();
+ _this.node.appendChild(add);
+ _this.mainwindow.windowstate.left_props.changed();
+ _this.mainwindow.windowstate.left_tree.model.selectNode(add);
+
+ return;
+ }
+
+ _this.el.hide();
+ GLib.debug("Add %s", prop.name);
+ var add = prop.dupe();
+ _this.node.add_prop(add);
+ _this.mainwindow.windowstate.left_props.changed();
+ _this.mainwindow.windowstate.left_props.view.editProp(add);
+
+
+ //_this.mainwindow.windowstate.left_props.changed();
+
+ });
+ }
- // user defined functions
- }
- public class Xcls_model : Object
- {
- public Gtk.ListStore el;
- private Xcls_PopoverAddProp _this;
+ // user defined functions
+ }
+ public class Xcls_selmodel : Object
+ {
+ public Gtk.SingleSelection el;
+ private Xcls_PopoverAddProp _this;
- // my vars (def)
- // ctor
- public Xcls_model(Xcls_PopoverAddProp _owner )
- {
- _this = _owner;
- _this.model = this;
- this.el = new Gtk.ListStore.newv( {
-typeof(JsRender.NodeProp), // 0 real key
-typeof(string), // 1 text display
-typeof(string), // 2 tooltip
-typeof(string), // 3 sortable string
-typeof(string), // 4 prop type
-typeof(string) // 5 from interface
-
- } );
+ // my vars (def)
- // my vars (dec)
+ // ctor
+ public Xcls_selmodel(Xcls_PopoverAddProp _owner )
+ {
+ _this = _owner;
+ _this.selmodel = this;
+ new Xcls_sortmodel( _this );
+ this.el = new Gtk.SingleSelection( _this.sortmodel.el );
- // set gobject values
- }
+ // my vars (dec)
- // user defined functions
- public JsRender.NodeProp getValue (Gtk.TreeIter iter)
- {
-
- GLib.Value value;
- this.el.get_value(iter, 0, out value);
-
- return (JsRender.NodeProp)value;
+ // set gobject values
+ this.el.can_unselect = true;
+ }
+
+ // user defined functions
+ public JsRender.NodeProp? 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.NodeProp)tr.get_item();
+
+ }
}
- }
+ public class Xcls_sortmodel : Object
+ {
+ public Gtk.SortListModel el;
+ private Xcls_PopoverAddProp _this;
- public class Xcls_namecol : Object
- {
- public Gtk.TreeViewColumn el;
- private Xcls_PopoverAddProp _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_sortmodel(Xcls_PopoverAddProp _owner )
+ {
+ _this = _owner;
+ _this.sortmodel = this;
+ new Xcls_model( _this );
+ var child_2 = new Xcls_TreeListRowSorter8( _this );
+ child_2.ref();
+ this.el = new Gtk.SortListModel( _this.model.el, child_2.el );
- // ctor
- public Xcls_namecol(Xcls_PopoverAddProp _owner )
- {
- _this = _owner;
- _this.namecol = this;
- this.el = new Gtk.TreeViewColumn();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
- // set gobject values
- this.el.sort_column_id = 3;
- this.el.title = "Double click to add";
- var child_0 = new Xcls_namerender( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
+ // init method
- // init method
+ {
+ //this.el.set_sorter(new Gtk.TreeListRowSorter(_this.view.el.sorter));
+ }
+ }
- this.el.add_attribute(_this.namerender.el , "markup", 1 );
-
- this.el.add_attribute(_this.namerender.el , "tooltip", 2 );
+ // user defined functions
+ public JsRender.NodeProp? getNodeAt (uint row) {
+
+ var tr = (Gtk.TreeListRow)this.el.get_item(row);
+
+ // GLib.debug("get_item (2) = %s", a.get_type().name());
+
+
+ return (JsRender.NodeProp)tr.get_item();
+
+ }
}
-
- // user defined functions
+ public class Xcls_model : Object
+ {
+ public Gtk.TreeListModel el;
+ private Xcls_PopoverAddProp _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_model(Xcls_PopoverAddProp _owner )
+ {
+ _this = _owner;
+ _this.model = this;
+ this.el = new Gtk.TreeListModel(
+ new GLib.ListStore(typeof(JsRender.NodeProp)), //..... << that's our store..
+ false, // passthru
+ false, // autexpand
+ (item) => {
+ return ((JsRender.NodeProp)item).childstore;
+
}
- public class Xcls_namerender : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_PopoverAddProp _this;
+
+
+);
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ }
- // ctor
- public Xcls_namerender(Xcls_PopoverAddProp _owner )
+ // user defined functions
+ public JsRender.NodeProp getNodeAt (uint row) {
+
+ var tr = (Gtk.TreeListRow)this.el.get_item(row);
+
+ return (JsRender.NodeProp)tr.get_item();
+
+ }
+ }
+
+ public class Xcls_TreeListRowSorter8 : Object
{
- _this = _owner;
- _this.namerender = this;
- this.el = new Gtk.CellRendererText();
+ public Gtk.TreeListRowSorter el;
+ private Xcls_PopoverAddProp _this;
- // my vars (dec)
- // set gobject values
+ // my vars (def)
+
+ // ctor
+ public Xcls_TreeListRowSorter8(Xcls_PopoverAddProp _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_StringSorter9( _this );
+ child_1.ref();
+ this.el = new Gtk.TreeListRowSorter( child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
}
+ public class Xcls_StringSorter9 : Object
+ {
+ public Gtk.StringSorter el;
+ private Xcls_PopoverAddProp _this;
- // user defined functions
- }
+ // my vars (def)
- public class Xcls_type : Object
- {
- public Gtk.TreeViewColumn el;
- private Xcls_PopoverAddProp _this;
+ // ctor
+ public Xcls_StringSorter9(Xcls_PopoverAddProp _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_PropertyExpression10( _this );
+ child_1.ref();
+ this.el = new Gtk.StringSorter( child_1.el );
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ }
- // ctor
- public Xcls_type(Xcls_PopoverAddProp _owner )
+ // user defined functions
+ }
+ public class Xcls_PropertyExpression10 : Object
{
- _this = _owner;
- _this.type = this;
- this.el = new Gtk.TreeViewColumn();
+ public Gtk.PropertyExpression el;
+ private Xcls_PopoverAddProp _this;
- // my vars (dec)
- // set gobject values
- this.el.sort_column_id = 4;
- this.el.title = "Type";
- var child_0 = new Xcls_typerender( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
+ // my vars (def)
+
+ // ctor
+ public Xcls_PropertyExpression10(Xcls_PopoverAddProp _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.PropertyExpression( typeof(JsRender.NodeProp), null, "sort_name" );
- // init method
+ // my vars (dec)
- this.el.add_attribute(_this.typerender.el , "text", 4 );
+ // set gobject values
+ }
+
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_typerender : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_PopoverAddProp _this;
- // my vars (def)
- // ctor
- public Xcls_typerender(Xcls_PopoverAddProp _owner )
+
+ public class Xcls_name : Object
{
- _this = _owner;
- _this.typerender = this;
- this.el = new Gtk.CellRendererText();
+ public Gtk.ColumnViewColumn el;
+ private Xcls_PopoverAddProp _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_name(Xcls_PopoverAddProp _owner )
+ {
+ _this = _owner;
+ _this.name = this;
+ var child_1 = new Xcls_SignalListItemFactory12( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Double click to add", child_1.el );
+ // my vars (dec)
- public class Xcls_from : Object
- {
- public Gtk.TreeViewColumn el;
- private Xcls_PopoverAddProp _this;
+ // set gobject values
+ this.el.id = "name";
+ this.el.expand = true;
+ this.el.resizable = true;
+ // init method
- // my vars (def)
+ {
+ this.el.set_sorter( new Gtk.StringSorter(
+ new Gtk.PropertyExpression(typeof(JsRender.NodeProp), null, "name")
+ ));
+
+ }
+ }
- // ctor
- public Xcls_from(Xcls_PopoverAddProp _owner )
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory12 : Object
{
- _this = _owner;
- _this.from = this;
- this.el = new Gtk.TreeViewColumn();
+ public Gtk.SignalListItemFactory el;
+ private Xcls_PopoverAddProp _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_SignalListItemFactory12(Xcls_PopoverAddProp _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.halign = Gtk.Align.START;
+ 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 np = (JsRender.NodeProp) lr.get_item();
+ GLib.debug("change %s to %s", lbl.label, np.name);
+ lbl.label = np.to_property_option_markup(np.propertyof == _this.node.fqn());
+ lbl.tooltip_markup = np.to_property_option_tooltip();
+
+ expand.set_hide_expander( np.childstore.n_items < 1);
+ expand.set_list_row(lr);
+
+
+ // bind image...
+
+ });
+ }
- // my vars (dec)
+ // user defined functions
+ }
- // set gobject values
- this.el.sort_column_id = 5;
- this.el.title = "From";
- var child_0 = new Xcls_fromrender( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
- // init method
+ public class Xcls_ColumnViewColumn13 : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private Xcls_PopoverAddProp _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_ColumnViewColumn13(Xcls_PopoverAddProp _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_SignalListItemFactory14( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Type", child_1.el );
+
+ // my vars (dec)
- this.el.add_attribute(_this.fromrender.el , "text", 5);
+ // set gobject values
+ this.el.expand = true;
+ this.el.resizable = true;
+
+ // init method
+
+ {
+ this.el.set_sorter( new Gtk.StringSorter(
+ new Gtk.PropertyExpression(typeof(JsRender.NodeProp), null, "rtype")
+ ));
+
+ }
+ }
+
+ // user defined functions
}
+ public class Xcls_SignalListItemFactory14 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private Xcls_PopoverAddProp _this;
- // user defined functions
- }
- public class Xcls_fromrender : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_PopoverAddProp _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_SignalListItemFactory14(Xcls_PopoverAddProp _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
- // ctor
- public Xcls_fromrender(Xcls_PopoverAddProp _owner )
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (listitem) => {
+
+
+ var label = new Gtk.Label("");
+ label.halign = Gtk.Align.START;
+ label.xalign = 0;
+ ((Gtk.ListItem)listitem).set_child(label);
+ ((Gtk.ListItem)listitem).activatable = false;
+ });
+ this.el.bind.connect( (listitem) => {
+
+ var lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();
+ var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
+ var np = (JsRender.NodeProp) lr.get_item();
+
+ if (lbl.label != "") { // do not update
+ return;
+ }
+ lbl.label = np.rtype;
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_ColumnViewColumn15 : Object
{
- _this = _owner;
- _this.fromrender = this;
- this.el = new Gtk.CellRendererText();
+ public Gtk.ColumnViewColumn el;
+ private Xcls_PopoverAddProp _this;
- // my vars (dec)
- // set gobject values
+ // my vars (def)
+
+ // ctor
+ public Xcls_ColumnViewColumn15(Xcls_PopoverAddProp _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_SignalListItemFactory16( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Property of", child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.expand = true;
+ this.el.resizable = true;
+
+ // init method
+
+ {
+ this.el.set_sorter( new Gtk.StringSorter(
+ new Gtk.PropertyExpression(typeof(JsRender.NodeProp), null, "propertyof")
+ ));
+
+ }
+ }
+
+ // user defined functions
}
+ public class Xcls_SignalListItemFactory16 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private Xcls_PopoverAddProp _this;
- // user defined functions
- }
+ // my vars (def)
+
+ // ctor
+ public Xcls_SignalListItemFactory16(Xcls_PopoverAddProp _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (listitem) => {
+
+
+ var label = new Gtk.Label("");
+ label.halign = Gtk.Align.START;
+ label.xalign = 0;
+ ((Gtk.ListItem)listitem).set_child(label);
+ ((Gtk.ListItem)listitem).activatable = false;
+ });
+ this.el.bind.connect( (listitem) => {
+
+ var lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();
+ var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
+ var np = (JsRender.NodeProp) lr.get_item();
+
+ if (lbl.label != "") { // do not update
+ return;
+ }
+ lbl.label = np.propertyof;
+
+ });
+ }
+ // user defined functions
+ }
-}
+
+
+ }
+++ /dev/null
-{
- "build_module" : "",
- "items" : [
- {
- "# Editor editor" : "",
- "$ xns" : "Gtk",
- "* init" : [
- "{",
- " this.editor = new Editor();",
- " this.el.add(this.editor.el);",
- "}",
- ""
- ],
- "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
- "Xcls_MainWindow win" : "",
- "bool active" : false,
- "bool hexpand" : false,
- "bool modal" : true,
- "id" : "PopoverEditor",
- "int height_request" : 800,
- "int width_request" : 900,
- "listeners" : {
- "hide" : [
- "() => {",
- "\t// save...",
- "\t _this.editor.saveContents();",
- "}"
- ]
- },
- "string prop_or_listener" : "\"\"",
- "xtype" : "Popover",
- "| void setMainWindow" : [
- "(Xcls_MainWindow win) {",
- "\tthis.win = win;",
- "\tthis.editor.window = win;",
- "}",
- ""
- ],
- "| void show" : [
- "(Gtk.Widget on_el, JsRender.JsRender file, JsRender.Node? node, string ptype, string key) {",
- "\tthis.editor.show( file, node, ptype, key);",
- "\t",
- " int w,h;",
- " this.win.el.get_size(out w, out h);",
- " ",
- " // left tree = 250, editor area = 500?",
- " ",
- " // min 450?",
- "\t// max hieght ...",
- "\t",
- "\tvar ww = on_el.get_allocated_width();",
- "\t",
- "\t// width = should be max = w-ww , or 600 at best..?",
- "\t ",
- " this.el.set_size_request( int.min(800,(w - ww)), h);",
- "",
- " ",
- "\tthis.el.set_modal(true);",
- "\tthis.el.set_relative_to(on_el);",
- "",
- "\tthis.el.set_position(Gtk.PositionType.TOP);",
- "",
- "\t// window + header?",
- " ",
- "\tthis.el.show_all();",
- " //while(Gtk.events_pending()) { ",
- " // Gtk.main_iteration(); // why?",
- " //} ",
- "",
- "}",
- ""
- ]
- }
- ],
- "modOrder" : "",
- "name" : "PopoverEditor",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/PopoverEditor.bjs",
- "permname" : "",
- "title" : ""
-}
\ No newline at end of file
+++ /dev/null
-static Xcls_PopoverEditor _PopoverEditor;
-
-public class Xcls_PopoverEditor : Object
-{
- public Gtk.Popover el;
- private Xcls_PopoverEditor _this;
-
- public static Xcls_PopoverEditor singleton()
- {
- if (_PopoverEditor == null) {
- _PopoverEditor= new Xcls_PopoverEditor();
- }
- return _PopoverEditor;
- }
-
- // my vars (def)
- public bool active;
- public Editor editor;
- public Xcls_MainWindow win;
- public string prop_or_listener;
-
- // ctor
- public Xcls_PopoverEditor()
- {
- _this = this;
- this.el = new Gtk.Popover( null );
-
- // my vars (dec)
- this.active = false;
- this.prop_or_listener = "";
-
- // set gobject values
- this.el.width_request = 900;
- this.el.height_request = 800;
- this.el.hexpand = false;
- this.el.modal = true;
- this.el.position = Gtk.PositionType.RIGHT;
-
- // init method
-
- {
- this.editor = new Editor();
- this.el.add(this.editor.el);
- }
-
- //listeners
- this.el.hide.connect( () => {
- // save...
- _this.editor.saveContents();
- });
- }
-
- // user defined functions
- public void show (Gtk.Widget on_el, JsRender.JsRender file, JsRender.Node? node, string ptype, string key) {
- this.editor.show( file, node, ptype, key);
-
- int w,h;
- this.win.el.get_size(out w, out h);
-
- // left tree = 250, editor area = 500?
-
- // min 450?
- // max hieght ...
-
- var ww = on_el.get_allocated_width();
-
- // width = should be max = w-ww , or 600 at best..?
-
- this.el.set_size_request( int.min(800,(w - ww)), h);
-
-
- this.el.set_modal(true);
- this.el.set_relative_to(on_el);
-
- this.el.set_position(Gtk.PositionType.TOP);
-
- // window + header?
-
- this.el.show_all();
- //while(Gtk.events_pending()) {
- // Gtk.main_iteration(); // why?
- //}
-
- }
- public void setMainWindow (Xcls_MainWindow win) {
- this.win = win;
- this.editor.window = win;
- }
-}
{
"build_module" : "builder",
+ "gen_extended" : false,
"items" : [
{
"# JsRender.JsRender file" : "null",
"# bool new_window" : true,
"$ xns" : "Gtk",
"@ void success" : "(Project.Project pr, JsRender.JsRender file)",
- "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
"Xcls_MainWindow mainwindow" : "null",
"bool done" : false,
"bool modal" : true,
{
"$ pack" : "add",
"$ xns" : "Gtk",
- "* pack" : "add",
+ "* pack" : "set_child",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
"bool hexpand" : true,
"bool homogeneous" : false,
+ "int margin_bottom" : 4,
+ "int margin_end" : 4,
+ "int margin_start" : 4,
+ "int margin_top" : 4,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,true,0",
- "string title" : "Add / Edit File",
- "xtype" : "HeaderBar"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,4",
+ "* columns" : 2,
+ "* pack" : "append",
"bool hexpand" : true,
"id" : "grid",
+ "int column_spacing" : 4,
"int margin_end" : 4,
"int margin_start" : 4,
"items" : [
{
"$ justify" : "Gtk.Justification.RIGHT",
+ "$ visible" : true,
+ "$ xns" : "Gtk",
+ "id" : "dir_dropdown_lbl",
+ "label" : "Create File in this Directory",
+ "x_options" : 4,
+ "xalign" : 0.90000000000000002,
+ "xtype" : "Label"
+ },
+ {
"$ xns" : "Gtk",
- "* pack" : "attach,0,0,1,1",
- "id" : "filetypelbl",
+ "id" : "dir_dropdown",
+ "int colspan" : 1,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "id" : "dir_model",
+ "strings" : "{}",
+ "xtype" : "StringList"
+ }
+ ],
+ "xtype" : "DropDown",
+ "| string getValue" : [
+ "() {",
+ "\treturn _this.dir_model.el.get_string(this.el.selected);",
+ "}"
+ ]
+ },
+ {
+ "$ justify" : "Gtk.Justification.RIGHT",
+ "$ xns" : "Gtk",
+ "id" : "filetype_lbl",
"label" : "File type",
"x_options" : 4,
"xalign" : 0.90000000000000002,
},
{
"$ xns" : "Gtk",
- "* init" : "this.el.add_attribute(_this.ftdbcellrenderer.el , \"markup\", 1 );",
- "* pack" : "attach,1,0,1,1",
"bool hexpand" : true,
"id" : "filetype",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "ftdbcellrenderer",
- "xtype" : "CellRendererText"
- },
- {
- "$ columns" : "typeof(string),typeof(string)",
- "$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "ftdbmodel",
- "n_columns" : 2,
- "xtype" : "ListStore",
- "| void loadData" : [
- " (string cur) {",
- " this.el.clear(); ",
- " Gtk.TreeIter iter;",
+ "* prop" : "model",
+ "id" : "filetype_model",
+ "strings" : "{}",
+ "xtype" : "StringList",
+ "| void load" : [
+ "() {",
" var el = this.el;",
" ",
- " /// el.append(out iter);",
- " ",
- " ",
- " // el.set_value(iter, 0, \"\");",
- " // el.set_value(iter, 1, \"aaa - Just add Element - aaa\");",
- "",
- " el.append(out iter);",
- "",
- " ",
- " el.set_value(iter, 0, \"bjs\");",
- " el.set_value(iter, 1, \"User Interface File (bjs)\");",
- " _this.filetype.el.set_active_iter(iter);",
- "",
- " el.append(out iter);",
- " ",
- " el.set_value(iter, 0, \"vala\");",
- " el.set_value(iter, 1, \"Vala\");",
- "\tif (cur == \"vala\") {",
- "\t _this.filetype.el.set_active_iter(iter);",
- " }",
- "",
- "",
- "",
- " el.append(out iter);",
+ " while (el.get_n_items() > 0) {",
+ " \tel.remove(0);",
+ "\t}",
+ " \tel.append(\"bjs - User Interface File\");",
+ " ",
" ",
- " el.set_value(iter, 0, \"js\");",
- " el.set_value(iter, 1, \"Javascript\");",
- "",
- "\tif (cur == \"js\") {",
- "\t _this.filetype.el.set_active_iter(iter);",
- " }",
+ " switch(_this.project.xtype) {",
+ " \tcase \"Roo\":",
+ " \t \tel.append(\"js - Javascript File\");",
+ " \t \tel.append(\"css - CSS File\");",
+ " \t \tel.append(\"php - Javascript File\");",
+ " \t \t",
+ "\t\tbreak;",
"",
- " el.append(out iter);",
- " ",
- " el.set_value(iter, 0, \"css\");",
- " el.set_value(iter, 1, \"CSS\");",
+ "\tcase \"Gtk\":\t\t",
+ "\t\t\t",
+ " \t \tel.append(\"vala - Vala File\");",
+ " \t \tel.append(\"css - CSS File\");",
+ " \t \tel.append(\"other - Other Type\");",
+ " \t \tbreak;",
+ " \t default : ",
+ " \t \tbreak;",
+ "\t}",
"",
- "\tif (cur == \"css\") {",
- "\t _this.filetype.el.set_active_iter(iter);",
- " }",
- " ",
- "}",
- ""
+ "\t",
+ "\t",
+ "\t",
+ "}"
]
}
],
"listeners" : {
- "changed" : [
+ "notify[\"selected\"]" : [
"() => {",
- "\tGtk.TreeIter iter;",
- "\tbool is_bjs = true;",
- "\tif (this.el.get_active_iter(out iter)) {",
- "\t\tValue vfname;",
- "\t\t_this.ftdbmodel.el.get_value (iter, 0, out vfname);",
- "\t\t is_bjs = ((string)vfname) == \"bjs\";",
- "\t}",
- " ",
+ "",
+ " ",
" ",
" // directory is only available for non-bjs ",
- " this.showhide(is_bjs);",
- "",
+ " this.showhide( );",
"",
- "}",
- ""
+ " }"
]
},
- "xtype" : "ComboBox",
+ "xtype" : "DropDown",
+ "| string getValue" : [
+ "() {",
+ "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
+ "\t\treturn \"\";",
+ "\t}",
+ "\t",
+ "\treturn _this.filetype_model.el.get_string(this.el.selected).split(\" \")[0];",
+ "}"
+ ],
+ "| void setValue" : [
+ "(string cur) {",
+ "\tvar el = _this.filetype_model.el;",
+ "\tfor(var i= 0; i < el.get_n_items();i++) {",
+ "\t\tif (el.get_string(i).has_prefix(cur)) {",
+ "\t\t\tthis.el.selected = i;",
+ "\t\t\tbreak;",
+ "\t\t}",
+ "\t}",
+ "}"
+ ],
"| void showhide" : [
- "(bool is_bjs) {",
+ "() {",
"",
"",
- "\t ",
- "\t_this.grid.showAllRows();",
- "",
+ "\t",
+ "\t",
+ "\t_this.title_lbl.el.hide();",
+ "\t_this.title.el.hide();",
+ "\t",
+ "\t_this.region_lbl.el.hide();",
+ "\t_this.region.el.hide();",
+ "\t",
+ "\t_this.parent_lbl.el.hide();",
+ "\t_this.parent.el.hide();",
+ "\t",
+ "\t_this.permname_lbl.el.hide();",
+ "\t_this.permname.el.hide();",
+ "\t",
+ "\t_this.modOrder_lbl.el.hide();",
+ "\t_this.modOrder.el.hide();",
+ "\t",
+ "\t_this.build_module_lbl.el.hide();",
+ "\t_this.build_module.el.hide();",
+ "\t",
+ "\t_this.gen_lbl.el.hide();",
+ "\t_this.gen.el.hide();",
+ " ",
+ "\tvar sel = this.getValue();",
+ "\t",
"\tswitch(_this.project.xtype) {",
"\t\tcase \"Roo\":",
+ "\t\t \t",
+ "\t\t\tif (sel == \"bjs\") {",
+ "\t\t\t\t_this.title_lbl.el.show();",
+ "\t\t\t\t_this.title.el.show();",
+ "\t\t\t\t",
+ "\t\t\t\t_this.region_lbl.el.show();",
+ "\t\t\t\t_this.region.el.show();",
+ "\t\t\t\t",
+ "\t\t\t\t_this.parent_lbl.el.show();",
+ "\t\t\t\t_this.parent.el.show();",
+ "\t\t\t\t",
+ "\t\t\t\t_this.permname_lbl.el.show();",
+ "\t\t\t\t_this.permname.el.show();",
+ "\t\t\t\t",
+ "\t\t\t\t_this.modOrder_lbl.el.show();",
+ "\t\t\t\t_this.modOrder.el.show();",
"\t\t\t",
- "\t\t\t_this.grid.hideRow(7);",
- "\t\t\t_this.grid.hideRow(8);\t\t\t",
- "\t\t\t// hide: vala: module",
- "\t\t\t// row 7",
- "\t\t\t// row 8 (directory)",
+ "\t\t\t}",
+ "\t\t\t_this.build_module_model.load(null);",
+ "\t\t ",
"\t\t\t",
"\t\t\tbreak;",
"\t\tdefault: // vala..",
- "\t\t\t_this.grid.hideRow(2);",
- "\t\t\t_this.grid.hideRow(3);\t",
- "\t\t\t_this.grid.hideRow(4);",
- "\t\t\t_this.grid.hideRow(5);\t",
- "\t\t\t_this.grid.hideRow(6);\t",
- "\t\t // hide 2,3,4,5,6,",
- "\t\t if (_this.file.name.length > 0) {",
- "\t\t \t_this.grid.hideRow(8); // directory - cant change it here..",
- "\t \t}",
+ "\t\t",
+ "\t \t\t_this.build_module_lbl.el.show();",
+ "\t\t\t_this.build_module.el.show();",
+ "\t",
+ "\t\t\t_this.gen_lbl.el.show();",
+ "\t\t\t_this.gen.el.show();",
"\t\t ",
"\t\t\tbreak;",
"\t}",
" //??? why can we not create bjs files in other directories??",
"\t//if (!is_bjs && _this.file.path.length < 1) {",
"\t",
- "\t\t_this.dirmodel.loadData();",
+ " ",
"\t\t",
"\t\t",
"\t//}",
{
"$ justify" : "Gtk.Justification.RIGHT",
"$ xns" : "Gtk",
- "* pack" : "attach,0,1,1,1",
- "label" : "Component Name",
+ "label" : "Component Name (File name without extension)",
"x_options" : 4,
"xalign" : 0.90000000000000002,
"xtype" : "Label"
{
"$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "attach,1,1,1,1",
"bool hexpand" : true,
"id" : "name",
"xtype" : "Entry"
"$ justify" : "Gtk.Justification.RIGHT",
"$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "attach,0,2,1,1",
+ "id" : "title_lbl",
"label" : "Title",
"x_options" : 4,
"xalign" : 0.90000000000000002,
"$ justify" : "Gtk.Justification.RIGHT",
"$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "attach,0,3,1,1",
+ "id" : "region_lbl",
"label" : "Region",
"tooltip_text" : "center, north, south, east, west",
"x_options" : 4,
{
"$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "attach,1,3,1,1",
"bool hexpand" : true,
"id" : "region",
"xtype" : "Entry"
"$ justify" : "Gtk.Justification.RIGHT",
"$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "attach,0,4,1,1",
+ "id" : "parent_lbl",
"label" : "Parent Name",
"x_options" : 4,
"xalign" : 0.90000000000000002,
{
"$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "attach,1,4,1,1",
"id" : "parent",
"xtype" : "Entry"
},
"$ justify" : "Gtk.Justification.RIGHT",
"$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "attach,0,5,1,1",
+ "id" : "permname_lbl",
"label" : "Permission Name",
"x_options" : 4,
"xalign" : 0.90000000000000002,
{
"$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "attach,1,5,1,1",
"id" : "permname",
"xtype" : "Entry"
},
"$ justify" : "Gtk.Justification.RIGHT",
"$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "attach,0,6,1,1",
+ "id" : "modOrder_lbl",
"label" : "Order (for tabs)",
"x_options" : 4,
"xalign" : 0.90000000000000002,
{
"$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "attach,1,6,1,1",
"id" : "modOrder",
"xtype" : "Entry"
},
"$ justify" : "Gtk.Justification.RIGHT",
"$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "attach,0,7,1,1",
+ "id" : "build_module_lbl",
"label" : "Module to build",
"x_options" : 4,
"xalign" : 0.90000000000000002,
},
{
"$ xns" : "Gtk",
- "* init" : "this.el.add_attribute(_this.dbcellrenderer.el , \"markup\", 1 );",
- "* pack" : "attach,1,7,1,1",
"id" : "build_module",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "dbcellrenderer",
- "xtype" : "CellRendererText"
- },
- {
- "$ columns" : "typeof(string),typeof(string)",
- "$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "dbmodel",
- "n_columns" : 2,
- "xtype" : "ListStore",
- "| void loadData" : [
- " (Gee.ArrayList<string> data, string cur) {",
- " this.el.clear(); ",
- " Gtk.TreeIter iter;",
- " var el = this.el;",
- " ",
- " /// el.append(out iter);",
- " ",
- " ",
- " // el.set_value(iter, 0, \"\");",
- " // el.set_value(iter, 1, \"aaa - Just add Element - aaa\");",
- "",
- " el.append(out iter);",
- "",
- " ",
- " el.set_value(iter, 0, \"\");",
- " el.set_value(iter, 1, \"-- select a module --\");",
- " _this.build_module.el.set_active_iter(iter);",
- " ",
- " for (var i = 0; i < data.size;i++) {",
- " ",
- "",
- " el.append(out iter);",
- " ",
- " el.set_value(iter, 0, data.get(i));",
- " el.set_value(iter, 1, data.get(i));",
- " ",
- " if (data.get(i) == cur) {",
- " _this.build_module.el.set_active_iter(iter);",
- " }",
- " ",
- " }",
- " this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); ",
- " ",
- "}",
- ""
- ]
- }
- ],
- "xtype" : "ComboBox"
- },
- {
- "$ justify" : "Gtk.Justification.RIGHT",
- "$ visible" : true,
- "$ xns" : "Gtk",
- "* pack" : "attach,0,8,1,1",
- "label" : "Directory",
- "x_options" : 4,
- "xalign" : 0.90000000000000002,
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* init" : "this.el.add_attribute(_this.dircellrenderer.el , \"markup\", 1 );",
- "* pack" : "attach,1,8,1,1",
- "id" : "dir",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "dircellrenderer",
- "xtype" : "CellRendererText"
- },
- {
- "$ columns" : "typeof(string),typeof(string)",
- "$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "dirmodel",
- "n_columns" : 2,
- "xtype" : "ListStore",
- "| void loadData" : [
- " () {",
+ "* prop" : "model",
+ "id" : "build_module_model",
+ "strings" : "{}",
+ "xtype" : "StringList",
+ "| void load" : [
+ "(Gee.HashMap<string,Project.GtkValaSettings>? compilegroups)",
+ "{",
"\t",
+ "\t_this.build_module.el.hide();",
+ "\t\t_this.build_module_lbl.el.hide();",
+ "\tvar el = _this.build_module_model.el;",
+ "\t while (el.get_n_items() > 0) {",
+ "\t\t\tel.remove(0);",
+ "\t}",
"\t",
- " ",
- " this.el.clear(); ",
- " ",
- " if (!(_this.project is Project.Gtk)) {",
+ "\tif (compilegroups == null) {",
"\t\treturn;",
"\t}",
- " var sd = ((Project.Gtk)_this.project).sourcedirs();",
- " ",
- " Gtk.TreeIter iter;",
- " var el = this.el;",
- " ",
- " /// el.append(out iter);",
- " ",
- " ",
- " // el.set_value(iter, 0, \"\");",
- " // el.set_value(iter, 1, \"aaa - Just add Element - aaa\");",
- "",
- "// el.append(out iter);",
- "",
- " ",
- "// el.set_value(iter, 0, \"\");",
- " // el.set_value(iter, 1, \"-- select a directoyr --\");",
- " //_this.build_module.el.set_active_iter(iter);",
- " ",
- " for (var i = 0; i < sd.length;i++) {",
- " ",
- "",
- " el.append(out iter);",
- " ",
- " el.set_value(iter, 0, sd[i]);",
- " el.set_value(iter, 1, sd[i]);",
- " ",
- " //if (data.get(i) == cur) {",
- " // _this.build_module.el.set_active_iter(iter);",
- " // }",
- " ",
- " }",
- " // this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING); ",
- " ",
- "}",
- ""
+ "\tforeach(var k in compilegroups.keys) {",
+ "\t\tthis.el.append(k);",
+ "\t}",
+ "\tif (compilegroups.keys.size > 0) {",
+ "\t\t_this.build_module.el.selected = 0;",
+ "\t\t_this.build_module.el.show();",
+ "\t\t_this.build_module_lbl.el.show();",
+ "\t} else {",
+ "\t\t",
+ "\t}",
+ "\t",
+ "}"
]
}
],
- "xtype" : "ComboBox"
+ "xtype" : "DropDown",
+ "| string getValue" : [
+ " ",
+ "() {",
+ "\tif (this.el.selected < 0) {",
+ "\t\treturn \"\";",
+ "\t}",
+ "\t",
+ "\treturn _this.build_module_model.el.get_string(this.el.selected);",
+ "}",
+ " "
+ ],
+ "| void setValue" : [
+ "(string str) {",
+ "\tvar m = _this.build_module_model.el;",
+ "\tfor(var i = 0; i < m.get_n_items(); i++) {",
+ "\t\tif (m.get_string(i) == str) {",
+ "\t\t\tthis.el.selected = i;",
+ "\t\t\treturn;",
+ "\t\t}",
+ "\t}",
+ "\t\t",
+ "}"
+ ]
},
{
"$ justify" : "Gtk.Justification.RIGHT",
"$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "attach,0,9,1,1",
+ "id" : "path_lbl",
"int colspan" : 1,
"label" : "Full path",
"x_options" : 4,
{
"$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "attach,1,9,1,1",
"bool editable" : false,
"bool hexpand" : true,
"id" : "path",
"int colspan" : 1,
"xtype" : "Entry"
+ },
+ {
+ "$ justify" : "Gtk.Justification.RIGHT",
+ "$ visible" : true,
+ "$ xns" : "Gtk",
+ "id" : "gen_lbl",
+ "int colspan" : 1,
+ "label" : "Generate as Extended (experimental)",
+ "x_options" : 4,
+ "xalign" : 0.90000000000000002,
+ "xtype" : "Label"
+ },
+ {
+ "$ xns" : "Gtk",
+ "id" : "gen",
+ "listeners" : {
+ "toggled" : [
+ "( ) => {",
+ "\t ",
+ "\tthis.el.label = this.el.active ? \"Extended\" : \"Wrapped\";",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "string label" : "Wrapped",
+ "xtype" : "CheckButton"
}
],
- "n_columns" : 2,
- "n_rows" : 8,
"uint row_spacing" : 2,
"xtype" : "Grid",
"| void hideRow" : [
" }",
"}"
]
+ }
+ ],
+ "xtype" : "Box"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "titlebar",
+ "bool show_title_buttons" : false,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start",
+ "listeners" : {
+ "clicked" : [
+ "() => { ",
+ " \t_this.done = true;",
+ " _this.el.hide(); ",
+ "}"
+ ]
+ },
+ "string label" : "Cancel",
+ "xtype" : "Button"
},
{
+ "$ css_classes" : "{ \"suggested-action\" }",
"$ xns" : "Gtk",
- "* pack" : "add",
- "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "int margin_bottom" : 4,
- "int margin_end" : 4,
- "int margin_start" : 4,
- "int margin_top" : 4,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "bool always_show_image" : true,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "set_image",
- "utf8 icon_name" : "window-close",
- "xtype" : "Image"
- }
- ],
- "listeners" : {
- "clicked" : [
- "() => { ",
- "",
- " _this.done = true;",
- " _this.el.hide(); ",
- "}"
- ]
- },
- "string label" : "Cancel",
- "xtype" : "Button"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "bool always_show_image" : true,
- "bool has_default" : true,
- "id" : "save_btn",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "set_image",
- "utf8 icon_name" : "document-save",
- "xtype" : "Image"
- }
- ],
- "listeners" : {
- "clicked" : [
- "( ) => { ",
- "",
- " ",
- "",
- "",
- "\tif (_this.name.el.get_text().length < 1) {",
- "\t Xcls_StandardErrorDialog.singleton().show(",
- "\t _this.mainwindow.el,",
- "\t \"You have to set Component name \"",
- "\t );",
- "\t ",
- "\t return;",
- "\t}",
- "\t// what does this do?",
- "\t",
- "\tvar isNew = _this.file.name.length > 0 ? false : true;",
- "\t/*",
- "\tif (!isNew && this.file.name != _this.name.el.get_text()) {",
- "\t Xcls_StandardErrorDialog.singleton().show(",
- "\t this.el,",
- "\t \"Sorry changing names does not work yet. \"",
- "\t );",
- "\t ",
- "\t return;",
- "\t}",
- "\t*/",
- "\t ",
- "\t",
- " ",
- "\t// FIXME - this may be more complicated...",
- "\t//for (var i in this.def) {",
- "\t// this.file[i] = this.get(i).el.get_text();",
- "\t//}",
- "",
- "\tif (!isNew) {",
- "\t // try {",
- "\t _this.updateFileFromEntry();",
- "\t // } catch( JsRender.Error.RENAME_FILE_EXISTS er) {",
- "\t // Xcls_StandardErrorDialog.singleton().show(",
- "\t // _this.mainwindow.el,",
- "\t // \"The name you used already exists \"",
- "\t // );",
- "\t // return;",
- "\t ",
- "\t //}",
- "",
- "\t _this.done = true;",
- "\t _this.file.save();",
- "\t _this.el.hide();",
- "\t return;",
- "\t}",
- "\t",
- "\t// ---------------- NEW FILES...",
- "\tGtk.TreeIter iter;",
- "",
- "\tif (!_this.filetype.el.get_active_iter(out iter)) {",
- "\t\t// should not happen...",
- "\t\t// so we are jut going to return without ",
- "\t\tXcls_StandardErrorDialog.singleton().show(",
- "\t _this.mainwindow.el,",
- "\t \"You must select a file type. \"",
- "\t );",
- "\t return;",
- "\t\t ",
- "\t}",
- "\t",
- "\t",
- "\tvar fn = _this.name.el.get_text();",
- "\t",
- "\tValue ftypename;",
- "\t_this.ftdbmodel.el.get_value (iter, 0, out ftypename);",
- "\tvar ext = ((string)ftypename);",
- "\tvar dir = _this.project.firstPath(); ",
- "\tif (ext != \"bjs\") {",
- "\t ",
- "\t\tif (!_this.dir.el.get_active_iter(out iter)) {",
- "\t\t\t// should not happen...",
- "\t\t\t// so we are jut going to return without ",
- "\t\t\tXcls_StandardErrorDialog.singleton().show(",
- "\t\t\t _this.mainwindow.el,",
- "\t\t\t \"You must select a directory \"",
- "\t\t\t);",
- "\t\t\treturn;",
- "\t\t}",
- "\t\tValue vdir;",
- "\t\t_this.dirmodel.el.get_value (iter, 0, out vdir);",
- "\t\tdir = (string)vdir;",
- "\t}",
- "\t",
- "\tvar targetfile = dir + \"/\" + fn;",
- "\t",
- "\t// strip the file type off the end..",
- "\t",
- "\ttry {",
- "\t\tvar rx = new GLib.Regex(\"\\\\.\" + ext + \"$\",GLib.RegexCompileFlags.CASELESS);",
- "\t\ttargetfile = rx.replace(targetfile, targetfile.length, 0, \"\"); ",
- "\t } catch (RegexError e) {} // ignore.",
- "\t ",
- "\tif (GLib.FileUtils.test(targetfile + \".\" + ext, GLib.FileTest.EXISTS)) {",
- "\t Xcls_StandardErrorDialog.singleton().show(",
- "\t _this.mainwindow.el,",
- "\t \"That file already exists\"",
- "\t ); ",
- "\t return;",
- "\t}",
- "\tJsRender.JsRender f;",
- " try {",
- "\t f = JsRender.JsRender.factory(",
- "\t\t\text == \"bjs\" ? _this.file.project.xtype : \"PlainFile\", ",
- "\t\t\t_this.file.project, ",
- "\t\t\ttargetfile + \".\" + ext);",
- "\t} catch (JsRender.Error e) {",
- "\t\treturn;",
- "\t}",
- "\t_this.file = f;",
- "\t",
- "\t",
- "",
- "\t",
- "\t_this.updateFileFromEntry();",
- "\t_this.file.loaded = true;",
- "\t_this.file.save();",
- "\tif (ext == \"bjs\") {",
- "\t\t",
- "\t\t\t_this.file.project.addFile(_this.file);",
- "\t\t ",
- "\t}",
- "\t",
- " ",
- "\t// what about .js ?",
- " _this.done = true;",
- "\t_this.el.hide();",
- "",
- "// hopefull this will work with bjs files..",
- "\t",
- "\t_this.success(_this.project, _this.file);",
- " ",
- "}"
- ]
- },
- "string label" : "Save",
- "xtype" : "Button"
- }
- ],
- "xtype" : "ButtonBox"
+ "* pack" : "pack_end",
+ "bool always_show_image" : true,
+ "bool hexpand" : false,
+ "id" : "save_btn",
+ "listeners" : {
+ "clicked" : [
+ "( ) => { ",
+ "",
+ " ",
+ "",
+ "",
+ "\tif (_this.name.el.get_text().length < 1) {",
+ "\t Xcls_StandardErrorDialog.singleton().show(",
+ "\t _this.mainwindow.el,",
+ "\t \"You have to set a Component name \"",
+ "\t );",
+ "\t ",
+ "\t return;",
+ "\t}",
+ "\t// what does this do?",
+ "\t",
+ "\tvar isNew = _this.file.name.length > 0 ? false : true;",
+ "\t/*",
+ "\tif (!isNew && this.file.name != _this.name.el.get_text()) {",
+ "\t Xcls_StandardErrorDialog.singleton().show(",
+ "\t this.el,",
+ "\t \"Sorry changing names does not work yet. \"",
+ "\t );",
+ "\t ",
+ "\t return;",
+ "\t}",
+ "\t*/",
+ "\t ",
+ " ",
+ "\t// FIXME - this may be more complicated...",
+ "\t//for (var i in this.def) {",
+ "\t// this.file[i] = this.get(i).el.get_text();",
+ "\t//}",
+ "",
+ "\tif (!isNew) {",
+ "\t // try {",
+ "\t ",
+ "\t \tvar old_target = _this.file.build_module;",
+ " _this.updateFileFromEntry();",
+ "\t if (_this.project.xtype == \"Gtk\" && old_target != _this.file.build_module) {",
+ "\t \tvar gp = (JsRender.Gtk)_this.file;",
+ "\t \tgp.updateCompileGroup(old_target, _this.file.build_module);",
+ " \t}",
+ "",
+ "\t _this.done = true;",
+ "\t _this.file.save();",
+ "\t _this.el.hide();",
+ "\t return;",
+ "\t}",
+ "\t",
+ "\t// ---------------- NEW FILES...",
+ "\tvar ftype = _this.filetype.getValue();",
+ "",
+ "\tif (ftype == \"\") {",
+ "\t\t// should not happen...",
+ "\t\t// so we are jut going to return without ",
+ "\t\tXcls_StandardErrorDialog.singleton().show(",
+ "\t _this.mainwindow.el,",
+ "\t \"You must select a file type. \"",
+ "\t );",
+ "\t return;",
+ "\t\t ",
+ "\t}",
+ "\t",
+ "\t",
+ "\tvar fn = _this.name.el.get_text();",
+ "\t",
+ "\t ",
+ "\tvar ext = ftype;",
+ "\t//var dir = _this.project.path; ",
+ "\t ",
+ "\t var dir = _this.dir_dropdown.getValue();",
+ "\t",
+ "\t ",
+ "\t",
+ "\t ",
+ "\tvar targetfile = _this.project.path;",
+ "\tif (dir != \"\") {",
+ "\t\ttargetfile += dir;",
+ "\t}",
+ "\ttargetfile += \"/\" + fn;",
+ "\t",
+ "\t// strip the file type off the end..",
+ "\t",
+ "\ttry {",
+ "\t\tvar rx = new GLib.Regex(\"\\\\.\" + ext + \"$\",GLib.RegexCompileFlags.CASELESS);",
+ "\t\tfn = rx.replace(targetfile, targetfile.length, 0, \"\"); ",
+ "\t } catch (RegexError e) {} // ignore.",
+ "\t ",
+ "\t targetfile += \".\" + ext;",
+ "\t ",
+ "\t ",
+ "\tif (GLib.FileUtils.test(targetfile, GLib.FileTest.EXISTS)) {",
+ "\t Xcls_StandardErrorDialog.singleton().show(",
+ "\t _this.mainwindow.el,",
+ "\t \"That file already exists\"",
+ "\t ); ",
+ "\t return;",
+ "\t}",
+ "\tJsRender.JsRender f;",
+ " try {",
+ "\t f = JsRender.JsRender.factory(",
+ "\t\t\text == \"bjs\" ? _this.file.project.xtype : \"PlainFile\", ",
+ "\t\t\t_this.file.project, ",
+ "\t\t\ttargetfile);",
+ "\t} catch (JsRender.Error e) {",
+ "\t\tXcls_StandardErrorDialog.singleton().show(",
+ "\t _this.mainwindow.el,",
+ "\t \"Error creating file\"",
+ "\t ); ",
+ "\t\treturn;",
+ "\t}",
+ "\t_this.file = f;",
+ "\t",
+ "\t",
+ "",
+ "\t",
+ "\t_this.updateFileFromEntry();",
+ "\t_this.file.loaded = true;",
+ "\t_this.file.save();",
+ " _this.file.project.addFile(_this.file);",
+ "\t\t ",
+ "\t ",
+ " ",
+ "\t// what about .js ?",
+ " _this.done = true;",
+ "\t_this.el.hide();",
+ "",
+ "// hopefull this will work with bjs files..",
+ "\t",
+ "\t_this.success(_this.project, _this.file);",
+ " ",
+ "}"
+ ]
+ },
+ "string icon_name" : "document-save",
+ "string label" : "Save",
+ "xtype" : "Button"
}
],
- "xtype" : "Box"
+ "title" : "Add / Edit File",
+ "xtype" : "HeaderBar"
}
],
"listeners" : {
- "closed" : [
- "() => {",
- " if (!this.done) {",
- " _this.el.show();",
- " ",
- " }",
- "} "
- ],
- "hide" : [
+ "close_request" : [
"( ) => {",
- "",
- " if (!this.done) {",
- " _this.el.show();",
- " ",
- " }",
+ "\t_this.el.hide();",
+ "\treturn true;",
"}",
""
]
},
+ "string title" : "Add / Edit File",
"uint border_width" : 0,
- "xtype" : "Popover",
+ "xtype" : "Window",
"| void show" : [
- "(JsRender.JsRender c, Gtk.Widget btn, bool new_window) ",
+ "(JsRender.JsRender c, Gtk.Window pwin, bool new_window) ",
"{",
+ " ",
" this.project = c.project;",
" this.done = false;",
" this.new_window = new_window;",
" ",
" //if (!this.el) {",
" //this.init();",
- " //}",
- " _this.path.el.set_text(c.path);",
+ " //} ",
+ " ",
+ " ",
+ "",
" _this.name.el.set_text(c.name);",
" _this.title.el.set_text(c.title);",
" _this.parent.el.set_text(c.parent); ",
" _this.region.el.set_text(c.region);",
" _this.modOrder.el.set_text(c.modOrder);",
" _this.permname.el.set_text(c.permname);",
+ " ",
+ " _this.gen.el.active = c.gen_extended;",
+ " ",
+ "\t_this.path_lbl.el.show();",
+ " _this.path.el.show();",
+ " _this.dir_dropdown_lbl.el.hide();",
+ " _this.dir_dropdown.el.hide();",
+ " if (c.name == \"\") {",
+ " \t_this.path_lbl.el.hide();",
+ "\t _this.path.el.hide();",
+ "\t this.filetype_model.load();",
+ " _this.dir_dropdown_lbl.el.show();",
+ "\t _this.dir_dropdown.el.show();",
+ "\t ",
+ " } else {",
+ " _this.path.el.set_text(c.relpath);",
+ " }",
" ",
" ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " var ar = new Gee.ArrayList<string>();",
- " _this.dbmodel.loadData(ar,\"\");",
- " // load the modules... if relivant..",
" if (this.project.xtype == \"Gtk\") {",
- " var p = (Project.Gtk)c.project;",
- " var cg = p.compilegroups;",
- "",
- " var iter = cg.map_iterator();",
- " while(iter.next()) {",
- " var key = iter.get_key();",
- " if (key == \"_default_\") {",
- " continue;",
- " }",
- " ar.add(key);",
- " };",
- " _this.dbmodel.loadData(ar, c.build_module);",
- "",
+ " \tvar p = (Project.Gtk) this.project;",
+ "\t this.build_module_model.load(p.compilegroups);",
+ "\t // it will select first if available...",
+ "\t // only for new files.",
+ "\t if (c.name != \"\") {",
+ "\t\t this.build_module.setValue(c.build_module);",
+ "\t }",
" }",
- " ",
+ "\t ",
" ",
" _this.file = c;",
- " //console.log('show all');",
- " this.el.set_modal(true);",
- " this.el.set_relative_to(btn);",
- "",
- " this.el.set_position(Gtk.PositionType.TOP);",
- "",
- " int w,h;",
- " this.mainwindow.el.get_size(out w, out h);",
- " this.el.set_size_request( 550, 100); // should expand height, but give a min width.",
- "",
" ",
+ " // this.el.set_size_request( 550, 100); // should expand height, but give a min width.",
+ "",
+ " this.el.set_transient_for(pwin);",
" ",
" // window + header?",
" print(\"SHOWALL - POPIP\\n\");",
- " this.el.show_all();",
+ " this.el.show();",
" this.name.el.grab_focus();",
" ",
- " ",
+ " _this.project.loadDirsToStringList(this.dir_model.el);",
" ",
" if (c.path.length > 0) {",
"\t this.save_btn.el.set_label(\"Save\");",
+ "\t\t_this.filetype_lbl.el.hide();",
"\t\t_this.filetype.el.hide();",
- "\t\t_this.filetypelbl.el.hide();",
- "\t\t_this.filetype.showhide(true); // as we only work on bjs files currently",
+ "\t\t_this.filetype.showhide(); // as we only work on bjs files currently",
" } else {",
" this.save_btn.el.set_label(\"Create\");",
- " _this.ftdbmodel.loadData(\"bjs\"); // fixme - need to determine type..",
"\t _this.filetype.el.show();",
- "\t _this.filetypelbl.el.show();",
+ "\t _this.filetype_lbl.el.show();",
+ "\t _this.filetype.showhide();",
" }",
" ",
" ",
" _this.file.parent = _this.parent.el.get_text(); ",
" _this.file.permname = _this.permname.el.get_text(); ",
" _this.file.modOrder = _this.modOrder.el.get_text();",
- " ",
- " if (_this.file.name.length > 0 && _this.file.name != _this.name.el.get_text()) {",
+ " _this.file.gen_extended = _this.gen.el.active;",
+ " var new_name = _this.name.el.get_text();",
+ " if (_this.file.name.length > 0 && _this.file.name != new_name) {",
" try {",
- " \t_this.file.renameTo(_this.name.el.get_text());",
+ " \t_this.file.renameTo( new_name );",
" \t} catch (JsRender.Error e) { } // do nothing?",
" }",
- " // store the module...",
- " _this.file.build_module = \"\"; ",
- " Gtk.TreeIter iter; ",
- " if (_this.build_module.el.get_active_iter (out iter)) {",
- " Value vfname;",
- " this.dbmodel.el.get_value (iter, 0, out vfname);",
- " if (((string)vfname).length > 0) {",
- " _this.file.build_module = (string)vfname;",
- " }",
- " ",
- " }",
+ " ",
+ " _this.file.build_module = _this.build_module.getValue();",
+ " ",
" ",
" ",
"",
]
}
],
- "modOrder" : "",
- "name" : "PopoverFileDetails",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/PopoverFileDetails.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "PopoverFileDetails"
}
\ No newline at end of file
-static Xcls_PopoverFileDetails _PopoverFileDetails;
+ static Xcls_PopoverFileDetails _PopoverFileDetails;
-public class Xcls_PopoverFileDetails : Object
-{
- public Gtk.Popover el;
- private Xcls_PopoverFileDetails _this;
-
- public static Xcls_PopoverFileDetails singleton()
- {
- if (_PopoverFileDetails == null) {
- _PopoverFileDetails= new Xcls_PopoverFileDetails();
- }
- return _PopoverFileDetails;
- }
- public Xcls_grid grid;
- public Xcls_filetypelbl filetypelbl;
- public Xcls_filetype filetype;
- public Xcls_ftdbcellrenderer ftdbcellrenderer;
- public Xcls_ftdbmodel ftdbmodel;
- public Xcls_name name;
- public Xcls_title title;
- public Xcls_region region;
- public Xcls_parent parent;
- public Xcls_permname permname;
- public Xcls_modOrder modOrder;
- public Xcls_build_module build_module;
- public Xcls_dbcellrenderer dbcellrenderer;
- public Xcls_dbmodel dbmodel;
- public Xcls_dir dir;
- public Xcls_dircellrenderer dircellrenderer;
- public Xcls_dirmodel dirmodel;
- public Xcls_path path;
- public Xcls_save_btn save_btn;
-
- // my vars (def)
- public bool new_window;
- public signal void success (Project.Project pr, JsRender.JsRender file);
- public JsRender.JsRender file;
- public Project.Project project;
- public Xcls_MainWindow mainwindow;
- public bool done;
-
- // ctor
- public Xcls_PopoverFileDetails()
- {
- _this = this;
- this.el = new Gtk.Popover( null );
-
- // my vars (dec)
- this.new_window = true;
- this.file = null;
- this.mainwindow = null;
- this.done = false;
-
- // set gobject values
- this.el.border_width = 0;
- this.el.modal = true;
- this.el.position = Gtk.PositionType.RIGHT;
- var child_0 = new Xcls_Box2( _this );
- child_0.ref();
- this.el.add ( child_0.el );
-
- //listeners
- this.el.closed.connect( () => {
- if (!this.done) {
- _this.el.show();
-
- }
- });
- this.el.hide.connect( ( ) => {
-
- if (!this.done) {
- _this.el.show();
-
- }
- });
- }
-
- // user defined functions
- public void show (JsRender.JsRender c, Gtk.Widget btn, bool new_window)
- {
- this.project = c.project;
- this.done = false;
- this.new_window = new_window;
-
- //if (!this.el) {
- //this.init();
- //}
- _this.path.el.set_text(c.path);
- _this.name.el.set_text(c.name);
- _this.title.el.set_text(c.title);
- _this.parent.el.set_text(c.parent);
- _this.region.el.set_text(c.region);
- _this.modOrder.el.set_text(c.modOrder);
- _this.permname.el.set_text(c.permname);
-
-
-
-
-
-
-
-
- var ar = new Gee.ArrayList<string>();
- _this.dbmodel.loadData(ar,"");
- // load the modules... if relivant..
- if (this.project.xtype == "Gtk") {
- var p = (Project.Gtk)c.project;
- var cg = p.compilegroups;
-
- var iter = cg.map_iterator();
- while(iter.next()) {
- var key = iter.get_key();
- if (key == "_default_") {
- continue;
- }
- ar.add(key);
- };
- _this.dbmodel.loadData(ar, c.build_module);
-
- }
-
-
- _this.file = c;
- //console.log('show all');
- this.el.set_modal(true);
- this.el.set_relative_to(btn);
-
- this.el.set_position(Gtk.PositionType.TOP);
-
- int w,h;
- this.mainwindow.el.get_size(out w, out h);
- this.el.set_size_request( 550, 100); // should expand height, but give a min width.
-
-
-
- // window + header?
- print("SHOWALL - POPIP\n");
- this.el.show_all();
- this.name.el.grab_focus();
-
-
-
- if (c.path.length > 0) {
- this.save_btn.el.set_label("Save");
- _this.filetype.el.hide();
- _this.filetypelbl.el.hide();
- _this.filetype.showhide(true); // as we only work on bjs files currently
- } else {
- this.save_btn.el.set_label("Create");
- _this.ftdbmodel.loadData("bjs"); // fixme - need to determine type..
- _this.filetype.el.show();
- _this.filetypelbl.el.show();
- }
-
-
- //this.success = c.success;
-
-
- }
- public void updateFileFromEntry () {
-
- _this.file.title = _this.title.el.get_text();
- _this.file.region = _this.region.el.get_text();
- _this.file.parent = _this.parent.el.get_text();
- _this.file.permname = _this.permname.el.get_text();
- _this.file.modOrder = _this.modOrder.el.get_text();
-
- if (_this.file.name.length > 0 && _this.file.name != _this.name.el.get_text()) {
- try {
- _this.file.renameTo(_this.name.el.get_text());
- } catch (JsRender.Error e) { } // do nothing?
- }
- // store the module...
- _this.file.build_module = "";
- Gtk.TreeIter iter;
- if (_this.build_module.el.get_active_iter (out iter)) {
- Value vfname;
- this.dbmodel.el.get_value (iter, 0, out vfname);
- if (((string)vfname).length > 0) {
- _this.file.build_module = (string)vfname;
- }
-
- }
-
-
-
-
- }
- public class Xcls_Box2 : Object
+ public class Xcls_PopoverFileDetails : Object
{
- public Gtk.Box el;
+ public Gtk.Window el;
private Xcls_PopoverFileDetails _this;
-
- // my vars (def)
-
- // ctor
- public Xcls_Box2(Xcls_PopoverFileDetails _owner )
+ public static Xcls_PopoverFileDetails singleton()
{
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- this.el.hexpand = true;
- var child_0 = new Xcls_HeaderBar3( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,true,0 );
- var child_1 = new Xcls_grid( _this );
- child_1.ref();
- this.el.pack_start ( child_1.el , false,false,4 );
- var child_2 = new Xcls_ButtonBox31( _this );
- child_2.ref();
- this.el.add ( child_2.el );
+ if (_PopoverFileDetails == null) {
+ _PopoverFileDetails= new Xcls_PopoverFileDetails();
+ }
+ return _PopoverFileDetails;
}
-
- // user defined functions
- }
- public class Xcls_HeaderBar3 : Object
- {
- public Gtk.HeaderBar el;
- private Xcls_PopoverFileDetails _this;
-
+ public Xcls_grid grid;
+ public Xcls_dir_dropdown_lbl dir_dropdown_lbl;
+ public Xcls_dir_dropdown dir_dropdown;
+ public Xcls_dir_model dir_model;
+ public Xcls_filetype_lbl filetype_lbl;
+ public Xcls_filetype filetype;
+ public Xcls_filetype_model filetype_model;
+ public Xcls_name name;
+ public Xcls_title_lbl title_lbl;
+ public Xcls_title title;
+ public Xcls_region_lbl region_lbl;
+ public Xcls_region region;
+ public Xcls_parent_lbl parent_lbl;
+ public Xcls_parent parent;
+ public Xcls_permname_lbl permname_lbl;
+ public Xcls_permname permname;
+ public Xcls_modOrder_lbl modOrder_lbl;
+ public Xcls_modOrder modOrder;
+ public Xcls_build_module_lbl build_module_lbl;
+ public Xcls_build_module build_module;
+ public Xcls_build_module_model build_module_model;
+ public Xcls_path_lbl path_lbl;
+ public Xcls_path path;
+ public Xcls_gen_lbl gen_lbl;
+ public Xcls_gen gen;
+ public Xcls_save_btn save_btn;
// my vars (def)
+ public bool new_window;
+ public signal void success (Project.Project pr, JsRender.JsRender file);
+ public JsRender.JsRender file;
+ public Project.Project project;
+ public uint border_width;
+ public bool done;
+ public Xcls_MainWindow mainwindow;
// ctor
- public Xcls_HeaderBar3(Xcls_PopoverFileDetails _owner )
+ public Xcls_PopoverFileDetails()
{
- _this = _owner;
- this.el = new Gtk.HeaderBar();
+ _this = this;
+ this.el = new Gtk.Window();
// my vars (dec)
+ this.new_window = true;
+ this.file = null;
+ this.border_width = 0;
+ this.done = false;
+ this.mainwindow = null;
// set gobject values
this.el.title = "Add / Edit File";
- }
-
- // user defined functions
- }
-
- public class Xcls_grid : Object
- {
- public Gtk.Grid el;
- private Xcls_PopoverFileDetails _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_grid(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- _this.grid = this;
- this.el = new Gtk.Grid();
-
- // my vars (dec)
-
- // set gobject values
- this.el.margin_end = 4;
- this.el.margin_start = 4;
- this.el.hexpand = true;
- this.el.row_spacing = 2;
- var child_0 = new Xcls_filetypelbl( _this );
- child_0.ref();
- this.el.attach ( child_0.el , 0,0,1,1 );
- var child_1 = new Xcls_filetype( _this );
+ this.el.modal = true;
+ var child_1 = new Xcls_Box2( _this );
child_1.ref();
- this.el.attach ( child_1.el , 1,0,1,1 );
- var child_2 = new Xcls_Label9( _this );
- child_2.ref();
- this.el.attach ( child_2.el , 0,1,1,1 );
- var child_3 = new Xcls_name( _this );
- child_3.ref();
- this.el.attach ( child_3.el , 1,1,1,1 );
- var child_4 = new Xcls_Label11( _this );
- child_4.ref();
- this.el.attach ( child_4.el , 0,2,1,1 );
- var child_5 = new Xcls_title( _this );
- child_5.ref();
- this.el.attach ( child_5.el , 1,2,1,1 );
- var child_6 = new Xcls_Label13( _this );
- child_6.ref();
- this.el.attach ( child_6.el , 0,3,1,1 );
- var child_7 = new Xcls_region( _this );
- child_7.ref();
- this.el.attach ( child_7.el , 1,3,1,1 );
- var child_8 = new Xcls_Label15( _this );
- child_8.ref();
- this.el.attach ( child_8.el , 0,4,1,1 );
- var child_9 = new Xcls_parent( _this );
- child_9.ref();
- this.el.attach ( child_9.el , 1,4,1,1 );
- var child_10 = new Xcls_Label17( _this );
- child_10.ref();
- this.el.attach ( child_10.el , 0,5,1,1 );
- var child_11 = new Xcls_permname( _this );
- child_11.ref();
- this.el.attach ( child_11.el , 1,5,1,1 );
- var child_12 = new Xcls_Label19( _this );
- child_12.ref();
- this.el.attach ( child_12.el , 0,6,1,1 );
- var child_13 = new Xcls_modOrder( _this );
- child_13.ref();
- this.el.attach ( child_13.el , 1,6,1,1 );
- var child_14 = new Xcls_Label21( _this );
- child_14.ref();
- this.el.attach ( child_14.el , 0,7,1,1 );
- var child_15 = new Xcls_build_module( _this );
- child_15.ref();
- this.el.attach ( child_15.el , 1,7,1,1 );
- var child_16 = new Xcls_Label25( _this );
- child_16.ref();
- this.el.attach ( child_16.el , 0,8,1,1 );
- var child_17 = new Xcls_dir( _this );
- child_17.ref();
- this.el.attach ( child_17.el , 1,8,1,1 );
- var child_18 = new Xcls_Label29( _this );
- child_18.ref();
- this.el.attach ( child_18.el , 0,9,1,1 );
- var child_19 = new Xcls_path( _this );
- child_19.ref();
- this.el.attach ( child_19.el , 1,9,1,1 );
+ this.el.set_child ( child_1.el );
+ var child_2 = new Xcls_HeaderBar29( _this );
+ this.el.titlebar = child_2.el;
+
+ //listeners
+ this.el.close_request.connect( ( ) => {
+ _this.el.hide();
+ return true;
+ });
}
// user defined functions
- public void showAllRows () {
- for (var i = 2; i < 10;i++) {
- var el = _this.grid.el.get_child_at(0,i);
- el.show();
- el = _this.grid.el.get_child_at(1,i);
- el.show();
+ public void show (JsRender.JsRender c, Gtk.Window pwin, bool new_window)
+ {
+
+ this.project = c.project;
+ this.done = false;
+ this.new_window = new_window;
+
+ //if (!this.el) {
+ //this.init();
+ //}
+
+
+
+ _this.name.el.set_text(c.name);
+ _this.title.el.set_text(c.title);
+ _this.parent.el.set_text(c.parent);
+ _this.region.el.set_text(c.region);
+ _this.modOrder.el.set_text(c.modOrder);
+ _this.permname.el.set_text(c.permname);
+
+ _this.gen.el.active = c.gen_extended;
+
+ _this.path_lbl.el.show();
+ _this.path.el.show();
+ _this.dir_dropdown_lbl.el.hide();
+ _this.dir_dropdown.el.hide();
+ if (c.name == "") {
+ _this.path_lbl.el.hide();
+ _this.path.el.hide();
+ this.filetype_model.load();
+ _this.dir_dropdown_lbl.el.show();
+ _this.dir_dropdown.el.show();
+
+ } else {
+ _this.path.el.set_text(c.relpath);
+ }
+
+
+ if (this.project.xtype == "Gtk") {
+ var p = (Project.Gtk) this.project;
+ this.build_module_model.load(p.compilegroups);
+ // it will select first if available...
+ // only for new files.
+ if (c.name != "") {
+ this.build_module.setValue(c.build_module);
+ }
}
+
+
+ _this.file = c;
+
+ // this.el.set_size_request( 550, 100); // should expand height, but give a min width.
+
+ this.el.set_transient_for(pwin);
+
+ // window + header?
+ print("SHOWALL - POPIP\n");
+ this.el.show();
+ this.name.el.grab_focus();
+
+ _this.project.loadDirsToStringList(this.dir_model.el);
+
+ if (c.path.length > 0) {
+ this.save_btn.el.set_label("Save");
+ _this.filetype_lbl.el.hide();
+ _this.filetype.el.hide();
+ _this.filetype.showhide(); // as we only work on bjs files currently
+ } else {
+ this.save_btn.el.set_label("Create");
+ _this.filetype.el.show();
+ _this.filetype_lbl.el.show();
+ _this.filetype.showhide();
+ }
+
+
+ //this.success = c.success;
+
+
}
- public void hideRow (int row)
- {
- var el = _this.grid.el.get_child_at(0,row);
+ public void updateFileFromEntry () {
- el.hide();
- el = _this.grid.el.get_child_at(1,row);
- el.hide();
+ _this.file.title = _this.title.el.get_text();
+ _this.file.region = _this.region.el.get_text();
+ _this.file.parent = _this.parent.el.get_text();
+ _this.file.permname = _this.permname.el.get_text();
+ _this.file.modOrder = _this.modOrder.el.get_text();
+ _this.file.gen_extended = _this.gen.el.active;
+ var new_name = _this.name.el.get_text();
+ if (_this.file.name.length > 0 && _this.file.name != new_name) {
+ try {
+ _this.file.renameTo( new_name );
+ } catch (JsRender.Error e) { } // do nothing?
+ }
+
+ _this.file.build_module = _this.build_module.getValue();
+
+
+
+
}
- }
- public class Xcls_filetypelbl : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverFileDetails _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_filetypelbl(Xcls_PopoverFileDetails _owner )
+ public class Xcls_Box2 : Object
{
- _this = _owner;
- _this.filetypelbl = this;
- this.el = new Gtk.Label( "File type" );
+ public Gtk.Box el;
+ private Xcls_PopoverFileDetails _this;
- // my vars (dec)
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- }
-
- // user defined functions
- }
+ // my vars (def)
- public class Xcls_filetype : Object
- {
- public Gtk.ComboBox el;
- private Xcls_PopoverFileDetails _this;
+ // ctor
+ public Xcls_Box2(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ this.el.homogeneous = false;
+ 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_grid( _this );
+ this.el.append ( child_1.el );
+ }
- // ctor
- public Xcls_filetype(Xcls_PopoverFileDetails _owner )
+ // user defined functions
+ }
+ public class Xcls_grid : Object
{
- _this = _owner;
- _this.filetype = this;
- this.el = new Gtk.ComboBox();
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- var child_0 = new Xcls_ftdbcellrenderer( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
- var child_1 = new Xcls_ftdbmodel( _this );
- child_1.ref();
- this.el.set_model ( child_1.el );
-
- // init method
-
- this.el.add_attribute(_this.ftdbcellrenderer.el , "markup", 1 );
+ public Gtk.Grid el;
+ private Xcls_PopoverFileDetails _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_grid(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.grid = this;
+ this.el = new Gtk.Grid();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.margin_end = 4;
+ this.el.margin_start = 4;
+ this.el.hexpand = true;
+ this.el.column_spacing = 4;
+ this.el.row_spacing = 2;
+ var child_1 = new Xcls_dir_dropdown_lbl( _this );
+ this.el.attach( child_1.el, 0, 0, 1, 1 );
+ var child_2 = new Xcls_dir_dropdown( _this );
+ this.el.attach( child_2.el, 1, 0, 1, 1 );
+ var child_3 = new Xcls_filetype_lbl( _this );
+ this.el.attach( child_3.el, 0, 1, 1, 1 );
+ var child_4 = new Xcls_filetype( _this );
+ this.el.attach( child_4.el, 1, 1, 1, 1 );
+ var child_5 = new Xcls_Label10( _this );
+ child_5.ref();
+ this.el.attach( child_5.el, 0, 2, 1, 1 );
+ var child_6 = new Xcls_name( _this );
+ this.el.attach( child_6.el, 1, 2, 1, 1 );
+ var child_7 = new Xcls_title_lbl( _this );
+ this.el.attach( child_7.el, 0, 3, 1, 1 );
+ var child_8 = new Xcls_title( _this );
+ this.el.attach ( child_8.el , 1,2,1,1 );
+ var child_9 = new Xcls_region_lbl( _this );
+ this.el.attach( child_9.el, 0, 4, 1, 1 );
+ var child_10 = new Xcls_region( _this );
+ this.el.attach( child_10.el, 1, 4, 1, 1 );
+ var child_11 = new Xcls_parent_lbl( _this );
+ this.el.attach( child_11.el, 0, 5, 1, 1 );
+ var child_12 = new Xcls_parent( _this );
+ this.el.attach( child_12.el, 1, 5, 1, 1 );
+ var child_13 = new Xcls_permname_lbl( _this );
+ this.el.attach( child_13.el, 0, 6, 1, 1 );
+ var child_14 = new Xcls_permname( _this );
+ this.el.attach( child_14.el, 1, 6, 1, 1 );
+ var child_15 = new Xcls_modOrder_lbl( _this );
+ this.el.attach( child_15.el, 0, 7, 1, 1 );
+ var child_16 = new Xcls_modOrder( _this );
+ this.el.attach( child_16.el, 1, 7, 1, 1 );
+ var child_17 = new Xcls_build_module_lbl( _this );
+ this.el.attach( child_17.el, 0, 8, 1, 1 );
+ var child_18 = new Xcls_build_module( _this );
+ this.el.attach( child_18.el, 1, 8, 1, 1 );
+ var child_19 = new Xcls_path_lbl( _this );
+ this.el.attach( child_19.el, 0, 9, 1, 1 );
+ var child_20 = new Xcls_path( _this );
+ this.el.attach( child_20.el, 1, 9, 1, 1 );
+ var child_21 = new Xcls_gen_lbl( _this );
+ this.el.attach( child_21.el, 0, 10, 1, 1 );
+ var child_22 = new Xcls_gen( _this );
+ this.el.attach( child_22.el, 1, 10, 1, 1 );
+ }
- //listeners
- this.el.changed.connect( () => {
- Gtk.TreeIter iter;
- bool is_bjs = true;
- if (this.el.get_active_iter(out iter)) {
- Value vfname;
- _this.ftdbmodel.el.get_value (iter, 0, out vfname);
- is_bjs = ((string)vfname) == "bjs";
- }
-
-
- // directory is only available for non-bjs
- this.showhide(is_bjs);
+ // user defined functions
+ public void showAllRows () {
+ for (var i = 2; i < 10;i++) {
+ var el = _this.grid.el.get_child_at(0,i);
+ el.show();
+ el = _this.grid.el.get_child_at(1,i);
+ el.show();
+ }
+ }
+ public void hideRow (int row)
+ {
+ var el = _this.grid.el.get_child_at(0,row);
+ el.hide();
+ el = _this.grid.el.get_child_at(1,row);
+ el.hide();
- });
+ }
}
+ public class Xcls_dir_dropdown_lbl : Object
+ {
+ public Gtk.Label el;
+ private Xcls_PopoverFileDetails _this;
- // user defined functions
- public void showhide (bool is_bjs) {
-
-
-
- _this.grid.showAllRows();
-
- switch(_this.project.xtype) {
- case "Roo":
-
- _this.grid.hideRow(7);
- _this.grid.hideRow(8);
- // hide: vala: module
- // row 7
- // row 8 (directory)
-
- break;
- default: // vala..
- _this.grid.hideRow(2);
- _this.grid.hideRow(3);
- _this.grid.hideRow(4);
- _this.grid.hideRow(5);
- _this.grid.hideRow(6);
- // hide 2,3,4,5,6,
- if (_this.file.name.length > 0) {
- _this.grid.hideRow(8); // directory - cant change it here..
- }
-
- break;
- }
-
- // load up the directories
- //??? why can we not create bjs files in other directories??
- //if (!is_bjs && _this.file.path.length < 1) {
-
- _this.dirmodel.loadData();
-
-
- //}
-
-
- }
- }
- public class Xcls_ftdbcellrenderer : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_dir_dropdown_lbl(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.dir_dropdown_lbl = this;
+ this.el = new Gtk.Label( "Create File in this Directory" );
- // ctor
- public Xcls_ftdbcellrenderer(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- _this.ftdbcellrenderer = this;
- this.el = new Gtk.CellRendererText();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.justify = Gtk.Justification.RIGHT;
+ this.el.xalign = 0.900000f;
+ this.el.visible = true;
+ }
- // set gobject values
+ // user defined functions
}
- // user defined functions
- }
-
- public class Xcls_ftdbmodel : Object
- {
- public Gtk.ListStore el;
- private Xcls_PopoverFileDetails _this;
-
+ public class Xcls_dir_dropdown : Object
+ {
+ public Gtk.DropDown el;
+ private Xcls_PopoverFileDetails _this;
- // my vars (def)
- // ctor
- public Xcls_ftdbmodel(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- _this.ftdbmodel = this;
- this.el = new Gtk.ListStore.newv( { typeof(string),typeof(string) } );
+ // my vars (def)
+ public int colspan;
- // my vars (dec)
+ // ctor
+ public Xcls_dir_dropdown(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.dir_dropdown = this;
+ var child_1 = new Xcls_dir_model( _this );
+ this.el = new Gtk.DropDown( child_1.el, null );
- // set gobject values
- }
+ // my vars (dec)
+ this.colspan = 1;
- // user defined functions
- public void loadData (string cur) {
- this.el.clear();
- Gtk.TreeIter iter;
- var el = this.el;
-
- /// el.append(out iter);
-
-
- // el.set_value(iter, 0, "");
- // el.set_value(iter, 1, "aaa - Just add Element - aaa");
-
- el.append(out iter);
-
-
- el.set_value(iter, 0, "bjs");
- el.set_value(iter, 1, "User Interface File (bjs)");
- _this.filetype.el.set_active_iter(iter);
-
- el.append(out iter);
-
- el.set_value(iter, 0, "vala");
- el.set_value(iter, 1, "Vala");
- if (cur == "vala") {
- _this.filetype.el.set_active_iter(iter);
+ // set gobject values
}
-
-
-
- el.append(out iter);
-
- el.set_value(iter, 0, "js");
- el.set_value(iter, 1, "Javascript");
-
- if (cur == "js") {
- _this.filetype.el.set_active_iter(iter);
- }
-
- el.append(out iter);
-
- el.set_value(iter, 0, "css");
- el.set_value(iter, 1, "CSS");
-
- if (cur == "css") {
- _this.filetype.el.set_active_iter(iter);
+
+ // user defined functions
+ public string getValue () {
+ return _this.dir_model.el.get_string(this.el.selected);
}
-
}
- }
-
+ public class Xcls_dir_model : Object
+ {
+ public Gtk.StringList el;
+ private Xcls_PopoverFileDetails _this;
- public class Xcls_Label9 : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_dir_model(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.dir_model = this;
+ this.el = new Gtk.StringList( {} );
- // ctor
- public Xcls_Label9(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Component Name" );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ }
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_name : Object
- {
- public Gtk.Entry el;
- private Xcls_PopoverFileDetails _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_name(Xcls_PopoverFileDetails _owner )
+ public class Xcls_filetype_lbl : Object
{
- _this = _owner;
- _this.name = this;
- this.el = new Gtk.Entry();
+ public Gtk.Label el;
+ private Xcls_PopoverFileDetails _this;
- // my vars (dec)
- // set gobject values
- this.el.hexpand = true;
- this.el.visible = true;
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_filetype_lbl(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.filetype_lbl = this;
+ this.el = new Gtk.Label( "File type" );
- public class Xcls_Label11 : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.justify = Gtk.Justification.RIGHT;
+ this.el.xalign = 0.900000f;
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_Label11(Xcls_PopoverFileDetails _owner )
+ public class Xcls_filetype : Object
{
- _this = _owner;
- this.el = new Gtk.Label( "Title" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.visible = true;
- }
+ public Gtk.DropDown el;
+ private Xcls_PopoverFileDetails _this;
- // user defined functions
- }
- public class Xcls_title : Object
- {
- public Gtk.Entry el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (def)
+ // ctor
+ public Xcls_filetype(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.filetype = this;
+ var child_1 = new Xcls_filetype_model( _this );
+ this.el = new Gtk.DropDown( child_1.el, null );
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_title(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- _this.title = this;
- this.el = new Gtk.Entry();
+ // set gobject values
+ this.el.hexpand = true;
- // my vars (dec)
+ //listeners
+ this.el.notify["selected"].connect( () => {
+
+
+
+ // directory is only available for non-bjs
+ this.showhide( );
+
+ });
+ }
- // set gobject values
- this.el.hexpand = true;
- this.el.visible = true;
+ // user defined functions
+ public string getValue () {
+ if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
+ return "";
+ }
+
+ return _this.filetype_model.el.get_string(this.el.selected).split(" ")[0];
+ }
+ public void showhide () {
+
+
+
+
+ _this.title_lbl.el.hide();
+ _this.title.el.hide();
+
+ _this.region_lbl.el.hide();
+ _this.region.el.hide();
+
+ _this.parent_lbl.el.hide();
+ _this.parent.el.hide();
+
+ _this.permname_lbl.el.hide();
+ _this.permname.el.hide();
+
+ _this.modOrder_lbl.el.hide();
+ _this.modOrder.el.hide();
+
+ _this.build_module_lbl.el.hide();
+ _this.build_module.el.hide();
+
+ _this.gen_lbl.el.hide();
+ _this.gen.el.hide();
+
+ var sel = this.getValue();
+
+ switch(_this.project.xtype) {
+ case "Roo":
+
+ if (sel == "bjs") {
+ _this.title_lbl.el.show();
+ _this.title.el.show();
+
+ _this.region_lbl.el.show();
+ _this.region.el.show();
+
+ _this.parent_lbl.el.show();
+ _this.parent.el.show();
+
+ _this.permname_lbl.el.show();
+ _this.permname.el.show();
+
+ _this.modOrder_lbl.el.show();
+ _this.modOrder.el.show();
+
+ }
+ _this.build_module_model.load(null);
+
+
+ break;
+ default: // vala..
+
+ _this.build_module_lbl.el.show();
+ _this.build_module.el.show();
+
+ _this.gen_lbl.el.show();
+ _this.gen.el.show();
+
+ break;
+ }
+
+ // load up the directories
+ //??? why can we not create bjs files in other directories??
+ //if (!is_bjs && _this.file.path.length < 1) {
+
+
+
+
+ //}
+
+
+ }
+ public void setValue (string cur) {
+ var el = _this.filetype_model.el;
+ for(var i= 0; i < el.get_n_items();i++) {
+ if (el.get_string(i).has_prefix(cur)) {
+ this.el.selected = i;
+ break;
+ }
+ }
+ }
}
+ public class Xcls_filetype_model : Object
+ {
+ public Gtk.StringList el;
+ private Xcls_PopoverFileDetails _this;
- // user defined functions
- }
-
- public class Xcls_Label13 : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_filetype_model(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.filetype_model = this;
+ this.el = new Gtk.StringList( {} );
- // ctor
- public Xcls_Label13(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Region" );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ }
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.tooltip_text = "center, north, south, east, west";
- this.el.visible = true;
+ // user defined functions
+ public void load () {
+ var el = this.el;
+
+ while (el.get_n_items() > 0) {
+ el.remove(0);
+ }
+ el.append("bjs - User Interface File");
+
+
+ switch(_this.project.xtype) {
+ case "Roo":
+ el.append("js - Javascript File");
+ el.append("css - CSS File");
+ el.append("php - Javascript File");
+
+ break;
+
+ case "Gtk":
+
+ el.append("vala - Vala File");
+ el.append("css - CSS File");
+ el.append("other - Other Type");
+ break;
+ default :
+ break;
+ }
+
+
+
+
+ }
}
- // user defined functions
- }
-
- public class Xcls_region : Object
- {
- public Gtk.Entry el;
- private Xcls_PopoverFileDetails _this;
-
- // my vars (def)
-
- // ctor
- public Xcls_region(Xcls_PopoverFileDetails _owner )
+ public class Xcls_Label10 : Object
{
- _this = _owner;
- _this.region = this;
- this.el = new Gtk.Entry();
+ public Gtk.Label el;
+ private Xcls_PopoverFileDetails _this;
- // my vars (dec)
- // set gobject values
- this.el.hexpand = true;
- this.el.visible = true;
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_Label10(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Component Name (File name without extension)" );
- public class Xcls_Label15 : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.justify = Gtk.Justification.RIGHT;
+ this.el.xalign = 0.900000f;
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_Label15(Xcls_PopoverFileDetails _owner )
+ public class Xcls_name : Object
{
- _this = _owner;
- this.el = new Gtk.Label( "Parent Name" );
+ public Gtk.Entry el;
+ private Xcls_PopoverFileDetails _this;
- // my vars (dec)
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.visible = true;
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_name(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.name = this;
+ this.el = new Gtk.Entry();
- public class Xcls_parent : Object
- {
- public Gtk.Entry el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.visible = true;
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_parent(Xcls_PopoverFileDetails _owner )
+ public class Xcls_title_lbl : Object
{
- _this = _owner;
- _this.parent = this;
- this.el = new Gtk.Entry();
+ public Gtk.Label el;
+ private Xcls_PopoverFileDetails _this;
- // my vars (dec)
- // set gobject values
- this.el.visible = true;
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_title_lbl(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.title_lbl = this;
+ this.el = new Gtk.Label( "Title" );
- public class Xcls_Label17 : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.justify = Gtk.Justification.RIGHT;
+ this.el.xalign = 0.900000f;
+ this.el.visible = true;
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_Label17(Xcls_PopoverFileDetails _owner )
+ public class Xcls_title : Object
{
- _this = _owner;
- this.el = new Gtk.Label( "Permission Name" );
+ public Gtk.Entry el;
+ private Xcls_PopoverFileDetails _this;
- // my vars (dec)
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.visible = true;
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_title(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.title = this;
+ this.el = new Gtk.Entry();
- public class Xcls_permname : Object
- {
- public Gtk.Entry el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.visible = true;
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_permname(Xcls_PopoverFileDetails _owner )
+ public class Xcls_region_lbl : Object
{
- _this = _owner;
- _this.permname = this;
- this.el = new Gtk.Entry();
+ public Gtk.Label el;
+ private Xcls_PopoverFileDetails _this;
- // my vars (dec)
- // set gobject values
- this.el.visible = true;
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_region_lbl(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.region_lbl = this;
+ this.el = new Gtk.Label( "Region" );
- public class Xcls_Label19 : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.justify = Gtk.Justification.RIGHT;
+ this.el.xalign = 0.900000f;
+ this.el.tooltip_text = "center, north, south, east, west";
+ this.el.visible = true;
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_Label19(Xcls_PopoverFileDetails _owner )
+ public class Xcls_region : Object
{
- _this = _owner;
- this.el = new Gtk.Label( "Order (for tabs)" );
+ public Gtk.Entry el;
+ private Xcls_PopoverFileDetails _this;
- // my vars (dec)
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.visible = true;
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_region(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.region = this;
+ this.el = new Gtk.Entry();
- public class Xcls_modOrder : Object
- {
- public Gtk.Entry el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.visible = true;
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_modOrder(Xcls_PopoverFileDetails _owner )
+ public class Xcls_parent_lbl : Object
{
- _this = _owner;
- _this.modOrder = this;
- this.el = new Gtk.Entry();
+ public Gtk.Label el;
+ private Xcls_PopoverFileDetails _this;
- // my vars (dec)
- // set gobject values
- this.el.visible = true;
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_parent_lbl(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.parent_lbl = this;
+ this.el = new Gtk.Label( "Parent Name" );
- public class Xcls_Label21 : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.justify = Gtk.Justification.RIGHT;
+ this.el.xalign = 0.900000f;
+ this.el.visible = true;
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_Label21(Xcls_PopoverFileDetails _owner )
+ public class Xcls_parent : Object
{
- _this = _owner;
- this.el = new Gtk.Label( "Module to build" );
+ public Gtk.Entry el;
+ private Xcls_PopoverFileDetails _this;
- // my vars (dec)
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.visible = true;
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_parent(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.parent = this;
+ this.el = new Gtk.Entry();
- public class Xcls_build_module : Object
- {
- public Gtk.ComboBox el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.visible = true;
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_build_module(Xcls_PopoverFileDetails _owner )
+ public class Xcls_permname_lbl : Object
{
- _this = _owner;
- _this.build_module = this;
- this.el = new Gtk.ComboBox();
+ public Gtk.Label el;
+ private Xcls_PopoverFileDetails _this;
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_dbcellrenderer( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
- var child_1 = new Xcls_dbmodel( _this );
- child_1.ref();
- this.el.set_model ( child_1.el );
- // init method
+ // my vars (def)
- this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
- }
+ // ctor
+ public Xcls_permname_lbl(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.permname_lbl = this;
+ this.el = new Gtk.Label( "Permission Name" );
- // user defined functions
- }
- public class Xcls_dbcellrenderer : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.justify = Gtk.Justification.RIGHT;
+ this.el.xalign = 0.900000f;
+ this.el.visible = true;
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_dbcellrenderer(Xcls_PopoverFileDetails _owner )
+ public class Xcls_permname : Object
{
- _this = _owner;
- _this.dbcellrenderer = this;
- this.el = new Gtk.CellRendererText();
+ public Gtk.Entry el;
+ private Xcls_PopoverFileDetails _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_permname(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.permname = this;
+ this.el = new Gtk.Entry();
- public class Xcls_dbmodel : Object
- {
- public Gtk.ListStore el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.visible = true;
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_dbmodel(Xcls_PopoverFileDetails _owner )
+ public class Xcls_modOrder_lbl : Object
{
- _this = _owner;
- _this.dbmodel = this;
- this.el = new Gtk.ListStore.newv( { typeof(string),typeof(string) } );
+ public Gtk.Label el;
+ private Xcls_PopoverFileDetails _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- public void loadData (Gee.ArrayList<string> data, string cur) {
- this.el.clear();
- Gtk.TreeIter iter;
- var el = this.el;
-
- /// el.append(out iter);
-
-
- // el.set_value(iter, 0, "");
- // el.set_value(iter, 1, "aaa - Just add Element - aaa");
-
- el.append(out iter);
-
-
- el.set_value(iter, 0, "");
- el.set_value(iter, 1, "-- select a module --");
- _this.build_module.el.set_active_iter(iter);
-
- for (var i = 0; i < data.size;i++) {
-
-
- el.append(out iter);
-
- el.set_value(iter, 0, data.get(i));
- el.set_value(iter, 1, data.get(i));
-
- if (data.get(i) == cur) {
- _this.build_module.el.set_active_iter(iter);
- }
-
+ // ctor
+ public Xcls_modOrder_lbl(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.modOrder_lbl = this;
+ this.el = new Gtk.Label( "Order (for tabs)" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.justify = Gtk.Justification.RIGHT;
+ this.el.xalign = 0.900000f;
+ this.el.visible = true;
}
- this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
-
+
+ // user defined functions
}
- }
+ public class Xcls_modOrder : Object
+ {
+ public Gtk.Entry el;
+ private Xcls_PopoverFileDetails _this;
- public class Xcls_Label25 : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_modOrder(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.modOrder = this;
+ this.el = new Gtk.Entry();
- // ctor
- public Xcls_Label25(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Directory" );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.visible = true;
+ }
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.visible = true;
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_build_module_lbl : Object
+ {
+ public Gtk.Label el;
+ private Xcls_PopoverFileDetails _this;
- public class Xcls_dir : Object
- {
- public Gtk.ComboBox el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_build_module_lbl(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.build_module_lbl = this;
+ this.el = new Gtk.Label( "Module to build" );
- // ctor
- public Xcls_dir(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- _this.dir = this;
- this.el = new Gtk.ComboBox();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.justify = Gtk.Justification.RIGHT;
+ this.el.xalign = 0.900000f;
+ this.el.visible = true;
+ }
- // set gobject values
- var child_0 = new Xcls_dircellrenderer( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
- var child_1 = new Xcls_dirmodel( _this );
- child_1.ref();
- this.el.set_model ( child_1.el );
+ // user defined functions
+ }
- // init method
+ public class Xcls_build_module : Object
+ {
+ public Gtk.DropDown el;
+ private Xcls_PopoverFileDetails _this;
- this.el.add_attribute(_this.dircellrenderer.el , "markup", 1 );
- }
- // user defined functions
- }
- public class Xcls_dircellrenderer : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (def)
+ // ctor
+ public Xcls_build_module(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.build_module = this;
+ var child_1 = new Xcls_build_module_model( _this );
+ this.el = new Gtk.DropDown( child_1.el, null );
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_dircellrenderer(Xcls_PopoverFileDetails _owner )
+ // set gobject values
+ }
+
+ // user defined functions
+ public string getValue () {
+ if (this.el.selected < 0) {
+ return "";
+ }
+
+ return _this.build_module_model.el.get_string(this.el.selected);
+ }
+ public void setValue (string str) {
+ var m = _this.build_module_model.el;
+ for(var i = 0; i < m.get_n_items(); i++) {
+ if (m.get_string(i) == str) {
+ this.el.selected = i;
+ return;
+ }
+ }
+
+ }
+ }
+ public class Xcls_build_module_model : Object
{
- _this = _owner;
- _this.dircellrenderer = this;
- this.el = new Gtk.CellRendererText();
+ public Gtk.StringList el;
+ private Xcls_PopoverFileDetails _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_build_module_model(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.build_module_model = this;
+ this.el = new Gtk.StringList( {} );
- public class Xcls_dirmodel : Object
- {
- public Gtk.ListStore el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (dec)
+ // set gobject values
+ }
- // my vars (def)
+ // user defined functions
+ public void load (Gee.HashMap<string,Project.GtkValaSettings>? compilegroups)
+ {
+
+ _this.build_module.el.hide();
+ _this.build_module_lbl.el.hide();
+ var el = _this.build_module_model.el;
+ while (el.get_n_items() > 0) {
+ el.remove(0);
+ }
+
+ if (compilegroups == null) {
+ return;
+ }
+ foreach(var k in compilegroups.keys) {
+ this.el.append(k);
+ }
+ if (compilegroups.keys.size > 0) {
+ _this.build_module.el.selected = 0;
+ _this.build_module.el.show();
+ _this.build_module_lbl.el.show();
+ } else {
+
+ }
+
+ }
+ }
- // ctor
- public Xcls_dirmodel(Xcls_PopoverFileDetails _owner )
+
+ public class Xcls_path_lbl : Object
{
- _this = _owner;
- _this.dirmodel = this;
- this.el = new Gtk.ListStore.newv( { typeof(string),typeof(string) } );
+ public Gtk.Label el;
+ private Xcls_PopoverFileDetails _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
+ public int colspan;
- // user defined functions
- public void loadData () {
-
-
-
- this.el.clear();
-
- if (!(_this.project is Project.Gtk)) {
- return;
- }
- var sd = ((Project.Gtk)_this.project).sourcedirs();
-
- Gtk.TreeIter iter;
- var el = this.el;
-
- /// el.append(out iter);
-
-
- // el.set_value(iter, 0, "");
- // el.set_value(iter, 1, "aaa - Just add Element - aaa");
-
- // el.append(out iter);
-
-
- // el.set_value(iter, 0, "");
- // el.set_value(iter, 1, "-- select a directoyr --");
- //_this.build_module.el.set_active_iter(iter);
-
- for (var i = 0; i < sd.length;i++) {
-
-
- el.append(out iter);
-
- el.set_value(iter, 0, sd[i]);
- el.set_value(iter, 1, sd[i]);
-
- //if (data.get(i) == cur) {
- // _this.build_module.el.set_active_iter(iter);
- // }
-
+ // ctor
+ public Xcls_path_lbl(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.path_lbl = this;
+ this.el = new Gtk.Label( "Full path" );
+
+ // my vars (dec)
+ this.colspan = 1;
+
+ // set gobject values
+ this.el.justify = Gtk.Justification.RIGHT;
+ this.el.xalign = 0.900000f;
+ this.el.visible = true;
}
- // this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
-
+
+ // user defined functions
}
- }
+ public class Xcls_path : Object
+ {
+ public Gtk.Entry el;
+ private Xcls_PopoverFileDetails _this;
- public class Xcls_Label29 : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (def)
+ public int colspan;
- // my vars (def)
- public int colspan;
+ // ctor
+ public Xcls_path(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.path = this;
+ this.el = new Gtk.Entry();
- // ctor
- public Xcls_Label29(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Full path" );
+ // my vars (dec)
+ this.colspan = 1;
- // my vars (dec)
- this.colspan = 1;
+ // set gobject values
+ this.el.editable = false;
+ this.el.hexpand = true;
+ this.el.visible = true;
+ }
- // set gobject values
- this.el.justify = Gtk.Justification.RIGHT;
- this.el.xalign = 0.900000f;
- this.el.visible = true;
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_gen_lbl : Object
+ {
+ public Gtk.Label el;
+ private Xcls_PopoverFileDetails _this;
- public class Xcls_path : Object
- {
- public Gtk.Entry el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (def)
+ public int colspan;
- // my vars (def)
- public int colspan;
+ // ctor
+ public Xcls_gen_lbl(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.gen_lbl = this;
+ this.el = new Gtk.Label( "Generate as Extended (experimental)" );
- // ctor
- public Xcls_path(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- _this.path = this;
- this.el = new Gtk.Entry();
+ // my vars (dec)
+ this.colspan = 1;
- // my vars (dec)
- this.colspan = 1;
+ // set gobject values
+ this.el.justify = Gtk.Justification.RIGHT;
+ this.el.xalign = 0.900000f;
+ this.el.visible = true;
+ }
- // set gobject values
- this.el.editable = false;
- this.el.hexpand = true;
- this.el.visible = true;
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_gen : Object
+ {
+ public Gtk.CheckButton el;
+ private Xcls_PopoverFileDetails _this;
- public class Xcls_ButtonBox31 : Object
- {
- public Gtk.ButtonBox el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (def)
+ // ctor
+ public Xcls_gen(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.gen = this;
+ this.el = new Gtk.CheckButton();
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_ButtonBox31(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- this.el = new Gtk.ButtonBox( Gtk.Orientation.HORIZONTAL );
+ // set gobject values
+ this.el.label = "Wrapped";
- // my vars (dec)
+ //listeners
+ this.el.toggled.connect( ( ) => {
+
+ this.el.label = this.el.active ? "Extended" : "Wrapped";
+
+ });
+ }
- // set gobject values
- this.el.margin_end = 4;
- this.el.margin_start = 4;
- this.el.margin_bottom = 4;
- this.el.margin_top = 4;
- var child_0 = new Xcls_Button32( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_save_btn( _this );
- child_1.ref();
- this.el.add ( child_1.el );
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_Button32 : Object
- {
- public Gtk.Button el;
- private Xcls_PopoverFileDetails _this;
-
- // my vars (def)
- // ctor
- public Xcls_Button32(Xcls_PopoverFileDetails _owner )
+ public class Xcls_HeaderBar29 : Object
{
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
+ public Gtk.HeaderBar el;
+ private Xcls_PopoverFileDetails _this;
- // set gobject values
- this.el.always_show_image = true;
- this.el.label = "Cancel";
- var child_0 = new Xcls_Image33( _this );
- child_0.ref();
- this.el.set_image ( child_0.el );
- //listeners
- this.el.clicked.connect( () => {
-
- _this.done = true;
- _this.el.hide();
- });
- }
+ // my vars (def)
- // user defined functions
- }
- public class Xcls_Image33 : Object
- {
- public Gtk.Image el;
- private Xcls_PopoverFileDetails _this;
+ // ctor
+ public Xcls_HeaderBar29(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.HeaderBar();
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ this.el.show_title_buttons = false;
+ var child_1 = new Xcls_Button30( _this );
+ child_1.ref();
+ this.el.pack_start ( child_1.el );
+ var child_2 = new Xcls_save_btn( _this );
+ this.el.pack_end ( child_2.el );
+ }
- // ctor
- public Xcls_Image33(Xcls_PopoverFileDetails _owner )
+ // user defined functions
+ }
+ public class Xcls_Button30 : Object
{
- _this = _owner;
- this.el = new Gtk.Image();
+ public Gtk.Button el;
+ private Xcls_PopoverFileDetails _this;
- // my vars (dec)
- // set gobject values
- this.el.icon_name = "window-close";
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_Button30(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+ // my vars (dec)
- public class Xcls_save_btn : Object
- {
- public Gtk.Button el;
- private Xcls_PopoverFileDetails _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_save_btn(Xcls_PopoverFileDetails _owner )
+ public class Xcls_save_btn : Object
{
- _this = _owner;
- _this.save_btn = this;
- this.el = new Gtk.Button();
+ public Gtk.Button el;
+ private Xcls_PopoverFileDetails _this;
- // my vars (dec)
-
- // set gobject values
- this.el.has_default = true;
- this.el.always_show_image = true;
- this.el.label = "Save";
- var child_0 = new Xcls_Image35( _this );
- child_0.ref();
- this.el.set_image ( child_0.el );
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
-
-
-
- if (_this.name.el.get_text().length < 1) {
- Xcls_StandardErrorDialog.singleton().show(
- _this.mainwindow.el,
- "You have to set Component name "
- );
-
- return;
- }
- // what does this do?
-
- var isNew = _this.file.name.length > 0 ? false : true;
- /*
- if (!isNew && this.file.name != _this.name.el.get_text()) {
- Xcls_StandardErrorDialog.singleton().show(
- this.el,
- "Sorry changing names does not work yet. "
- );
-
- return;
- }
- */
-
-
-
- // FIXME - this may be more complicated...
- //for (var i in this.def) {
- // this.file[i] = this.get(i).el.get_text();
- //}
-
- if (!isNew) {
- // try {
- _this.updateFileFromEntry();
- // } catch( JsRender.Error.RENAME_FILE_EXISTS er) {
- // Xcls_StandardErrorDialog.singleton().show(
- // _this.mainwindow.el,
- // "The name you used already exists "
- // );
- // return;
-
- //}
-
- _this.done = true;
- _this.file.save();
- _this.el.hide();
- return;
- }
-
- // ---------------- NEW FILES...
- Gtk.TreeIter iter;
-
- if (!_this.filetype.el.get_active_iter(out iter)) {
- // should not happen...
- // so we are jut going to return without
- Xcls_StandardErrorDialog.singleton().show(
- _this.mainwindow.el,
- "You must select a file type. "
- );
- return;
-
- }
-
-
- var fn = _this.name.el.get_text();
-
- Value ftypename;
- _this.ftdbmodel.el.get_value (iter, 0, out ftypename);
- var ext = ((string)ftypename);
- var dir = _this.project.firstPath();
- if (ext != "bjs") {
-
- if (!_this.dir.el.get_active_iter(out iter)) {
- // should not happen...
- // so we are jut going to return without
- Xcls_StandardErrorDialog.singleton().show(
- _this.mainwindow.el,
- "You must select a directory "
- );
- return;
- }
- Value vdir;
- _this.dirmodel.el.get_value (iter, 0, out vdir);
- dir = (string)vdir;
- }
-
- var targetfile = dir + "/" + fn;
-
- // strip the file type off the end..
-
- try {
- var rx = new GLib.Regex("\\." + ext + "$",GLib.RegexCompileFlags.CASELESS);
- targetfile = rx.replace(targetfile, targetfile.length, 0, "");
- } catch (RegexError e) {} // ignore.
-
- if (GLib.FileUtils.test(targetfile + "." + ext, GLib.FileTest.EXISTS)) {
- Xcls_StandardErrorDialog.singleton().show(
- _this.mainwindow.el,
- "That file already exists"
- );
- return;
- }
- JsRender.JsRender f;
- try {
- f = JsRender.JsRender.factory(
- ext == "bjs" ? _this.file.project.xtype : "PlainFile",
- _this.file.project,
- targetfile + "." + ext);
- } catch (JsRender.Error e) {
- return;
- }
- _this.file = f;
-
-
-
-
- _this.updateFileFromEntry();
- _this.file.loaded = true;
- _this.file.save();
- if (ext == "bjs") {
-
- _this.file.project.addFile(_this.file);
-
- }
-
-
- // what about .js ?
- _this.done = true;
- _this.el.hide();
-
- // hopefull this will work with bjs files..
-
- _this.success(_this.project, _this.file);
-
- });
- }
- // user defined functions
- }
- public class Xcls_Image35 : Object
- {
- public Gtk.Image el;
- private Xcls_PopoverFileDetails _this;
+ // my vars (def)
+ public bool always_show_image;
+ // ctor
+ public Xcls_save_btn(Xcls_PopoverFileDetails _owner )
+ {
+ _this = _owner;
+ _this.save_btn = this;
+ this.el = new Gtk.Button();
- // my vars (def)
+ // my vars (dec)
+ this.always_show_image = true;
- // ctor
- public Xcls_Image35(Xcls_PopoverFileDetails _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
+ // set gobject values
+ this.el.icon_name = "document-save";
+ this.el.hexpand = false;
+ this.el.css_classes = { "suggested-action" };
+ this.el.label = "Save";
- // my vars (dec)
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+
+
+
+ if (_this.name.el.get_text().length < 1) {
+ Xcls_StandardErrorDialog.singleton().show(
+ _this.mainwindow.el,
+ "You have to set a Component name "
+ );
+
+ return;
+ }
+ // what does this do?
+
+ var isNew = _this.file.name.length > 0 ? false : true;
+ /*
+ if (!isNew && this.file.name != _this.name.el.get_text()) {
+ Xcls_StandardErrorDialog.singleton().show(
+ this.el,
+ "Sorry changing names does not work yet. "
+ );
+
+ return;
+ }
+ */
+
+
+ // FIXME - this may be more complicated...
+ //for (var i in this.def) {
+ // this.file[i] = this.get(i).el.get_text();
+ //}
+
+ if (!isNew) {
+ // try {
+
+ var old_target = _this.file.build_module;
+ _this.updateFileFromEntry();
+ if (_this.project.xtype == "Gtk" && old_target != _this.file.build_module) {
+ var gp = (JsRender.Gtk)_this.file;
+ gp.updateCompileGroup(old_target, _this.file.build_module);
+ }
+
+ _this.done = true;
+ _this.file.save();
+ _this.el.hide();
+ return;
+ }
+
+ // ---------------- NEW FILES...
+ var ftype = _this.filetype.getValue();
+
+ if (ftype == "") {
+ // should not happen...
+ // so we are jut going to return without
+ Xcls_StandardErrorDialog.singleton().show(
+ _this.mainwindow.el,
+ "You must select a file type. "
+ );
+ return;
+
+ }
+
+
+ var fn = _this.name.el.get_text();
+
+
+ var ext = ftype;
+ //var dir = _this.project.path;
+
+ var dir = _this.dir_dropdown.getValue();
+
+
+
+
+ var targetfile = _this.project.path;
+ if (dir != "") {
+ targetfile += dir;
+ }
+ targetfile += "/" + fn;
+
+ // strip the file type off the end..
+
+ try {
+ var rx = new GLib.Regex("\\." + ext + "$",GLib.RegexCompileFlags.CASELESS);
+ fn = rx.replace(targetfile, targetfile.length, 0, "");
+ } catch (RegexError e) {} // ignore.
+
+ targetfile += "." + ext;
+
+
+ if (GLib.FileUtils.test(targetfile, GLib.FileTest.EXISTS)) {
+ Xcls_StandardErrorDialog.singleton().show(
+ _this.mainwindow.el,
+ "That file already exists"
+ );
+ return;
+ }
+ JsRender.JsRender f;
+ try {
+ f = JsRender.JsRender.factory(
+ ext == "bjs" ? _this.file.project.xtype : "PlainFile",
+ _this.file.project,
+ targetfile);
+ } catch (JsRender.Error e) {
+ Xcls_StandardErrorDialog.singleton().show(
+ _this.mainwindow.el,
+ "Error creating file"
+ );
+ return;
+ }
+ _this.file = f;
+
+
+
+
+ _this.updateFileFromEntry();
+ _this.file.loaded = true;
+ _this.file.save();
+ _this.file.project.addFile(_this.file);
+
+
+
+ // what about .js ?
+ _this.done = true;
+ _this.el.hide();
+
+ // hopefull this will work with bjs files..
+
+ _this.success(_this.project, _this.file);
+
+ });
+ }
- // set gobject values
- this.el.icon_name = "document-save";
+ // user defined functions
}
- // user defined functions
- }
-
-
-
-}
+ }
{
"build_module" : "",
+ "gen_extended" : false,
"items" : [
{
"# Gdk.Pixbuf missing_thumb_pixbuf" : "",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
+ "* pack" : "set_child",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool hexpand" : true,
+ "bool vexpand" : true,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool hexpand" : true,
"items" : [
{
+ "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
"$ xns" : "Gtk",
- "* pack" : "add",
- "Gtk.ToolbarStyle toolbar_style" : "Gtk.ToolbarStyle.BOTH",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
+ "items" : [
+ {
+ "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "$ xns" : "Gtk",
+ "* prop" : "child",
+ "items" : [
+ {
+ "$ Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
+ "$ xns" : "Gtk",
+ "int margin_end" : 4,
+ "string icon_name" : "folder-new",
+ "xtype" : "Image"
+ },
+ {
+ "$ xns" : "Gtk",
+ "string label" : "New Project",
+ "xtype" : "Label"
+ }
+ ],
+ "xtype" : "Box"
+ }
+ ],
"listeners" : {
"clicked" : [
" ( ) => {",
" // create a new file in project..",
" //Xcls_DialogNewComponent.singleton().show(",
" var pe = EditProject.singleton();",
- " //pe.el.set_transient_for(_this.el);",
- " pe.el.set_modal(true); ",
+ " pe.el.application = _this.win.el.application;",
+ " pe.el.set_transient_for( _this.win.el );",
+ " ",
+ " _this.el.hide();",
" ",
- " var p = pe.show();",
+ " pe.selected.connect((pr) => {",
+ " \t",
+ "\t _this.is_loaded = false;",
+ "\t _this.show(null, pr, _this.new_window);",
"",
- " if (p == null) {",
- " return;",
- " }",
+ " });",
" ",
- " /*",
- " _this.win.windowstate.left_projects.is_loaded = false; ",
- " _this.win.windowstate.left_projects.load();",
- " _this.win.windowstate.left_projects.selectProject(p);",
- " */",
- " return ; ",
+ " pe.canceled.connect((pr) => {",
+ " \t",
+ " ",
+ "\t _this.show(null, null, _this.new_window);",
+ "",
+ " });",
+ " ",
+ " pe.showIt();",
+ " ",
"",
"}"
]
},
- "string icon_name" : "folder-new",
"string label" : "New Project",
- "xtype" : "ToolButton"
+ "xtype" : "Button"
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
"listeners" : {
"clicked" : [
" ( ) => {",
},
"string icon_name" : "emblem-system",
"string label" : "Project Properties",
- "xtype" : "ToolButton"
+ "xtype" : "Button"
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
"listeners" : {
"clicked" : [
" ( ) => {",
},
"string icon_name" : "user-trash",
"string label" : "Delete Project",
- "xtype" : "ToolButton"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "listeners" : {
- "clicked" : [
- " () => {",
- " // create a new file in project..",
- " print(\"add file selected\\n\");",
- " ",
- " if (_this.selectedProject == null) {",
- " \treturn;",
- " }",
- " try {",
- " \tvar f = JsRender.JsRender.factory(_this.selectedProject.xtype, _this.selectedProject, \"\");",
- " \t_this.win.windowstate.file_details.show( f, this.el, _this.new_window );",
- " } catch (JsRender.Error e) {}",
- "",
- "}"
- ]
- },
- "string icon_name" : "document-new",
- "string label" : "New File",
- "xtype" : "ToolButton"
+ "xtype" : "Button"
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
"listeners" : {
"clicked" : [
" () => {",
},
"string icon_name" : "document-new",
"string label" : "New File",
- "xtype" : "ToolButton"
+ "xtype" : "Button"
}
],
- "xtype" : "Toolbar"
+ "xtype" : "Box"
}
],
"xtype" : "Box"
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "bool hexpand" : true,
"bool homogeneous" : false,
+ "bool vexpand" : true,
"items" : [
{
- "$ shadow_type" : "Gtk.ShadowType.IN",
"$ xns" : "Gtk",
"* init" : [
" this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
" "
],
- "* pack" : "add",
"bool expand" : true,
+ "bool has_frame" : true,
+ "bool hexpand" : true,
+ "bool vexpand" : true,
"int width_request" : 150,
"items" : [
{
" ",
"this.css = new Gtk.CssProvider();",
"try {",
- "\tthis.css.load_from_data(\"#popover-files-view { font-size: 10px;}\");",
+ "\tthis.css.load_from_data(\"#popover-files-view { font-size: 10px;}\".data);",
"} catch (Error e) {}",
"this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);",
" ",
" ",
" "
],
- "* pack" : "add",
+ "* pack" : "set_child",
"Gtk.CssProvider css" : "",
+ "bool hexpand" : true,
+ "bool vexpand" : true,
"id" : "view",
"items" : [
{
{
"$ xns" : "Gtk",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
- "bool expand" : true,
+ "bool hexpand" : true,
+ "bool vexpand" : true,
"int spacing" : 0,
"int width_request" : 600,
"items" : [
"",
"this.css = new Gtk.CssProvider();",
"try {",
- "\tthis.css.load_from_data(\"#popover-files-iconsearch { font: monospace 10px;}\");",
+ "\tthis.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);",
" ",
" this.el.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);",
" "
],
- "* pack" : "add",
- "Gtk.ShadowType shadow_type" : "Gtk.ShadowType.IN",
- "bool expand" : true,
+ "bool has_frame" : true,
+ "bool hexpand" : true,
+ "bool vexpand" : true,
"id" : "iconscroll",
"int width_request" : 600,
"items" : [
"}",
""
],
- "* pack" : "add",
+ "* pack" : "set_child",
"bool has_tooltip" : true,
+ "bool hexpand" : true,
+ "bool vexpand" : true,
"id" : "iconview",
"int item_width" : 100,
"int markup_column" : 1,
"\tGLib.Value val;",
"\t_this.iconmodel.el.get_value(iter, 4, out val);",
"\t",
- "\ttooltip.set_icon((Gdk.Pixbuf) val.get_object());",
+ "\ttooltip.set_icon( Gdk.Texture.for_pixbuf(",
+ "\t\t(Gdk.Pixbuf) val.get_object()",
+ "\t));",
"\t _this.iconview.el.set_tooltip_item(tooltip, path);",
"\treturn true;",
"}",
{
"$ xns" : "Gtk",
"* init" : " this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
- "* pack" : "add",
- "Gtk.ShadowType shadow_type" : "Gtk.ShadowType.IN",
- "bool expand" : true,
+ "bool has_frame" : true,
+ "bool hexpand" : true,
+ "bool vexpand" : true,
"bool visible" : false,
"id" : "file_container",
- "int width_request" : 100,
+ "int width_request" : 200,
"items" : [
{
"$ enable_tree_lines" : true,
"",
"this.css = new Gtk.CssProvider();",
"try {",
- "\tthis.css.load_from_data(\"#popover-files-fileview { font-size: 12px;}\");",
+ "\tthis.css.load_from_data(\"#popover-files-fileview { font-size: 12px;}\".data);",
"} catch (Error e) {}",
"this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);",
" ",
"",
""
],
- "* pack" : "add",
+ "* pack" : "set_child",
"Gtk.CssProvider css" : "",
"bool activate_on_single_click" : false,
- "bool expand" : true,
+ "bool hexpand" : true,
+ "bool vexpand" : true,
"id" : "fileview",
"items" : [
{
"\t//if (project != null) {",
"//\t\tthis.selectProject(project);",
"//\t}",
- " \tif (_this.win.windowstate.project == null) {",
- " \t\tthis.el.show();",
- "\t}",
+ " \t//if (_this.win.windowstate.project == null) {",
+ " \t//\tthis.el.show();",
+ "\t//}",
"}"
]
},
"string lastfilter" : "\"\"",
- "xtype" : "Popover",
+ "string title" : "Select Project /File",
+ "xtype" : "Window",
"| void load" : [
"() {",
" // clear list...",
" ",
" ",
" try {",
- "\t if (_this.missing_thumb_pixbuf == null) {",
- "\t var icon_theme = Gtk.IconTheme.get_default ();",
- "\t _this.missing_thumb_pixbuf = icon_theme.load_icon (\"package-x-generic\", 92, 0);",
- "\t _this.missing_thumb_pixbuf.ref();",
- "\t }",
+ " if (_this.missing_thumb_pixbuf == null) {",
+ " ",
+ " \tvar icon_theme = Gtk.IconTheme.get_for_display(this.el.get_display());",
+ " \t var icon = icon_theme.lookup_icon (\"package-x-generic\", null, 92,1, ",
+ "\t\t\t\t\t Gtk.TextDirection.NONE, 0);",
+ "\t\t \t_this.missing_thumb_pixbuf = (new Gdk.Pixbuf.from_file (icon.file.get_path())).scale_simple(",
+ "\t\t \t\t92, 92 \t, Gdk.InterpType.NEAREST) ;",
+ " _this.missing_thumb_pixbuf.ref();",
+ " }",
"\t ",
"",
"\t } catch (Error e) {",
"| void setMainWindow" : [
"(Xcls_MainWindow win) {",
"\tthis.win = win;",
- "\t ",
+ "\tthis.el.set_transient_for(win.el);",
+ "\tthis.el.application = BuilderApplication.singleton({});",
"}",
""
],
"| void show" : [
- "(Gtk.Widget on_el, Project.Project? project, bool new_window) {",
+ "(Gtk.Widget? on_el, Project.Project? project, bool new_window) {",
"\t//this.editor.show( file, node, ptype, key);",
"\t",
"\tthis.new_window = new_window;",
"\t\t// save...",
"\tthis.load();",
- "\tthis.el.show_all(); // show first - so we can hide stuff later.\t",
+ "\tif (on_el != null) {",
+ "\t\tthis.el.set_parent(on_el);",
+ "\t}",
+ "\t // show first - so we can hide stuff later.\t",
"\tif (project != null) {",
"\t",
"\t\tthis.selectProject(project);",
"\t}",
"\t",
"\t",
- " int w,h;",
- " this.win.el.get_size(out w, out h);",
- " ",
+ " // var win = this.win.el;",
+ " // var w = win.get_width();",
+ " // var h = win.get_height();",
+ "",
" // left tree = 250, editor area = 500?",
" ",
" // min 450?",
"\t",
"\t// width = should be max = w-ww , or 600 at best..?",
"\t ",
- " this.el.set_size_request( w, h); // same as parent...",
+ " //this.el.set_size_request( w - 100, h - 100); // same as parent...",
"",
"",
- "\tthis.el.set_modal(true);",
- "\tthis.el.set_relative_to(on_el);",
- "",
- "\t ",
- "",
+ "\t//this.el.set_autohide(true); // can hide",
+ "\t//Gtk.Allocation rect;",
+ "\t//on_el.get_allocation(out rect);",
+ " // this.el.set_pointing_to(rect);",
+ " //this.el.set_offset(200,0);",
+ " //this.el.set_position(Gtk.PositionType.BOTTOM);",
+ "\tthis.el.show();",
+ "\t ",
"}",
""
]
}
],
- "modOrder" : "",
"name" : "PopoverFiles",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/PopoverFiles.bjs",
- "permname" : "",
- "title" : ""
+ "namespace" : ""
}
\ No newline at end of file
public class Xcls_PopoverFiles : Object
{
- public Gtk.Popover el;
+ public Gtk.Window el;
private Xcls_PopoverFiles _this;
public static Xcls_PopoverFiles singleton()
public Xcls_MainWindow win;
public string lastfilter;
public bool in_onprojectselected;
- public Project.Project selectedProject;
public bool is_loading;
public bool new_window;
+ public Project.Project selectedProject;
+ public Gtk.PositionType position;
public Gdk.Pixbuf missing_thumb_pixbuf;
public Gee.HashMap<string,Gdk.Pixbuf> image_cache;
public bool active;
public Xcls_PopoverFiles()
{
_this = this;
- this.el = new Gtk.Popover( null );
+ this.el = new Gtk.Window();
// my vars (dec)
this.lastfilter = "";
this.in_onprojectselected = false;
this.is_loading = false;
this.new_window = false;
+ this.position = Gtk.PositionType.TOP;
this.image_cache = null;
this.active = false;
this.is_loaded = false;
// set gobject values
this.el.width_request = 900;
+ this.el.title = "Select Project /File";
this.el.height_request = 800;
this.el.hexpand = false;
this.el.modal = true;
- this.el.position = Gtk.PositionType.TOP;
- var child_0 = new Xcls_Box2( _this );
- child_0.ref();
- this.el.add ( child_0.el );
+ var child_1 = new Xcls_Box2( _this );
+ child_1.ref();
+ this.el.set_child ( child_1.el );
//listeners
this.el.hide.connect( ( ) => {
//if (project != null) {
// this.selectProject(project);
// }
- if (_this.win.windowstate.project == null) {
- this.el.show();
- }
+ //if (_this.win.windowstate.project == null) {
+ // this.el.show();
+ //}
});
}
print("tried to select %s, could not find it", project.name);
}
}
- public void show (Gtk.Widget on_el, Project.Project? project, bool new_window) {
+ public void show (Gtk.Widget? on_el, Project.Project? project, bool new_window) {
//this.editor.show( file, node, ptype, key);
this.new_window = new_window;
// save...
this.load();
- this.el.show_all(); // show first - so we can hide stuff later.
+ if (on_el != null) {
+ this.el.set_parent(on_el);
+ }
+ // show first - so we can hide stuff later.
if (project != null) {
this.selectProject(project);
}
- int w,h;
- this.win.el.get_size(out w, out h);
-
+ // var win = this.win.el;
+ // var w = win.get_width();
+ // var h = win.get_height();
+
// left tree = 250, editor area = 500?
// min 450?
// width = should be max = w-ww , or 600 at best..?
- this.el.set_size_request( w, h); // same as parent...
+ //this.el.set_size_request( w - 100, h - 100); // same as parent...
- this.el.set_modal(true);
- this.el.set_relative_to(on_el);
-
-
-
+ //this.el.set_autohide(true); // can hide
+ //Gtk.Allocation rect;
+ //on_el.get_allocation(out rect);
+ // this.el.set_pointing_to(rect);
+ //this.el.set_offset(200,0);
+ //this.el.set_position(Gtk.PositionType.BOTTOM);
+ this.el.show();
+
}
public void load () {
// clear list...
try {
- if (_this.missing_thumb_pixbuf == null) {
- var icon_theme = Gtk.IconTheme.get_default ();
- _this.missing_thumb_pixbuf = icon_theme.load_icon ("package-x-generic", 92, 0);
- _this.missing_thumb_pixbuf.ref();
- }
+ if (_this.missing_thumb_pixbuf == null) {
+
+ var icon_theme = Gtk.IconTheme.get_for_display(this.el.get_display());
+ var icon = icon_theme.lookup_icon ("package-x-generic", null, 92,1,
+ Gtk.TextDirection.NONE, 0);
+ _this.missing_thumb_pixbuf = (new Gdk.Pixbuf.from_file (icon.file.get_path())).scale_simple(
+ 92, 92 , Gdk.InterpType.NEAREST) ;
+ _this.missing_thumb_pixbuf.ref();
+ }
} catch (Error e) {
}
public void setMainWindow (Xcls_MainWindow win) {
this.win = win;
-
+ this.el.set_transient_for(win.el);
+ this.el.application = BuilderApplication.singleton({});
}
public class Xcls_Box2 : Object
{
// my vars (dec)
// set gobject values
- var child_0 = new Xcls_Box3( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_Box10( _this );
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ var child_1 = new Xcls_Box3( _this );
child_1.ref();
- this.el.add ( child_1.el );
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Box12( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
}
// user defined functions
// my vars (dec)
// set gobject values
- var child_0 = new Xcls_Toolbar4( _this );
- child_0.ref();
- this.el.add ( child_0.el );
+ this.el.hexpand = true;
+ var child_1 = new Xcls_Box4( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
}
// user defined functions
}
- public class Xcls_Toolbar4 : Object
+ public class Xcls_Box4 : Object
{
- public Gtk.Toolbar el;
+ public Gtk.Box el;
private Xcls_PopoverFiles _this;
// my vars (def)
// ctor
- public Xcls_Toolbar4(Xcls_PopoverFiles _owner )
+ public Xcls_Box4(Xcls_PopoverFiles _owner )
{
_this = _owner;
- this.el = new Gtk.Toolbar();
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
// my vars (dec)
// set gobject values
- this.el.toolbar_style = Gtk.ToolbarStyle.BOTH;
- var child_0 = new Xcls_ToolButton5( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_ToolButton6( _this );
+ var child_1 = new Xcls_Button5( _this );
child_1.ref();
- this.el.add ( child_1.el );
- var child_2 = new Xcls_ToolButton7( _this );
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Button9( _this );
child_2.ref();
- this.el.add ( child_2.el );
- var child_3 = new Xcls_ToolButton8( _this );
+ this.el.append( child_2.el );
+ var child_3 = new Xcls_Button10( _this );
child_3.ref();
- this.el.add ( child_3.el );
- var child_4 = new Xcls_ToolButton9( _this );
+ this.el.append( child_3.el );
+ var child_4 = new Xcls_Button11( _this );
child_4.ref();
- this.el.add ( child_4.el );
+ this.el.append( child_4.el );
}
// user defined functions
}
- public class Xcls_ToolButton5 : Object
+ public class Xcls_Button5 : Object
{
- public Gtk.ToolButton el;
+ public Gtk.Button el;
private Xcls_PopoverFiles _this;
// my vars (def)
// ctor
- public Xcls_ToolButton5(Xcls_PopoverFiles _owner )
+ public Xcls_Button5(Xcls_PopoverFiles _owner )
{
_this = _owner;
- this.el = new Gtk.ToolButton( null, "New Project" );
+ this.el = new Gtk.Button();
// my vars (dec)
// set gobject values
- this.el.icon_name = "folder-new";
+ this.el.label = "New Project";
+ var child_1 = new Xcls_Box6( _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.el.set_transient_for(_this.el);
- pe.el.set_modal(true);
+ pe.el.application = _this.win.el.application;
+ pe.el.set_transient_for( _this.win.el );
+
+ _this.el.hide();
- var p = pe.show();
+ pe.selected.connect((pr) => {
+
+ _this.is_loaded = false;
+ _this.show(null, pr, _this.new_window);
- if (p == null) {
- return;
- }
+ });
- /*
- _this.win.windowstate.left_projects.is_loaded = false;
- _this.win.windowstate.left_projects.load();
- _this.win.windowstate.left_projects.selectProject(p);
- */
- return ;
+ pe.canceled.connect((pr) => {
+
+
+ _this.show(null, null, _this.new_window);
+
+ });
+
+ pe.showIt();
+
});
}
// user defined functions
}
+ public class Xcls_Box6 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_PopoverFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box6(Xcls_PopoverFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Image7( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Label8( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Image7 : Object
+ {
+ public Gtk.Image el;
+ private Xcls_PopoverFiles _this;
+
- public class Xcls_ToolButton6 : Object
+ // my vars (def)
+
+ // ctor
+ public Xcls_Image7(Xcls_PopoverFiles _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_Label8 : Object
{
- public Gtk.ToolButton el;
+ public Gtk.Label el;
private Xcls_PopoverFiles _this;
// my vars (def)
// ctor
- public Xcls_ToolButton6(Xcls_PopoverFiles _owner )
+ public Xcls_Label8(Xcls_PopoverFiles _owner )
{
_this = _owner;
- this.el = new Gtk.ToolButton( null, "Project Properties" );
+ this.el = new Gtk.Label( "New Project" );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+
+ public class Xcls_Button9 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_PopoverFiles _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Button9(Xcls_PopoverFiles _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
// my vars (dec)
// set gobject values
this.el.icon_name = "emblem-system";
+ this.el.label = "Project Properties";
//listeners
this.el.clicked.connect( ( ) => {
// user defined functions
}
- public class Xcls_ToolButton7 : Object
+ public class Xcls_Button10 : Object
{
- public Gtk.ToolButton el;
+ public Gtk.Button el;
private Xcls_PopoverFiles _this;
// my vars (def)
// ctor
- public Xcls_ToolButton7(Xcls_PopoverFiles _owner )
+ public Xcls_Button10(Xcls_PopoverFiles _owner )
{
_this = _owner;
- this.el = new Gtk.ToolButton( null, "Delete Project" );
+ this.el = new Gtk.Button();
// my vars (dec)
// set gobject values
this.el.icon_name = "user-trash";
+ this.el.label = "Delete Project";
//listeners
this.el.clicked.connect( ( ) => {
// user defined functions
}
- public class Xcls_ToolButton8 : Object
+ public class Xcls_Button11 : Object
{
- public Gtk.ToolButton el;
+ public Gtk.Button el;
private Xcls_PopoverFiles _this;
// my vars (def)
// ctor
- public Xcls_ToolButton8(Xcls_PopoverFiles _owner )
+ public Xcls_Button11(Xcls_PopoverFiles _owner )
{
_this = _owner;
- this.el = new Gtk.ToolButton( null, "New File" );
+ this.el = new Gtk.Button();
// my vars (dec)
// set gobject values
this.el.icon_name = "document-new";
+ this.el.label = "New File";
//listeners
this.el.clicked.connect( () => {
// user defined functions
}
- public class Xcls_ToolButton9 : Object
- {
- public Gtk.ToolButton el;
- private Xcls_PopoverFiles _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ToolButton9(Xcls_PopoverFiles _owner )
- {
- _this = _owner;
- this.el = new Gtk.ToolButton( null, "New File" );
-
- // my vars (dec)
- // set gobject values
- this.el.icon_name = "document-new";
- //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_Box10 : Object
+ public class Xcls_Box12 : Object
{
public Gtk.Box el;
private Xcls_PopoverFiles _this;
// my vars (def)
// ctor
- public Xcls_Box10(Xcls_PopoverFiles _owner )
+ public Xcls_Box12(Xcls_PopoverFiles _owner )
{
_this = _owner;
this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
// set gobject values
this.el.homogeneous = false;
- var child_0 = new Xcls_ScrolledWindow11( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_Box16( _this );
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ var child_1 = new Xcls_ScrolledWindow13( _this );
child_1.ref();
- this.el.add( child_1.el );
- var child_2 = new Xcls_file_container( _this );
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Box18( _this );
child_2.ref();
- this.el.add ( child_2.el );
+ this.el.append( child_2.el );
+ var child_3 = new Xcls_file_container( _this );
+ this.el.append( child_3.el );
}
// user defined functions
}
- public class Xcls_ScrolledWindow11 : Object
+ public class Xcls_ScrolledWindow13 : Object
{
public Gtk.ScrolledWindow el;
private Xcls_PopoverFiles _this;
// my vars (def)
+ public bool expand;
// ctor
- public Xcls_ScrolledWindow11(Xcls_PopoverFiles _owner )
+ public Xcls_ScrolledWindow13(Xcls_PopoverFiles _owner )
{
_this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
+ this.el = new Gtk.ScrolledWindow();
// my vars (dec)
+ this.expand = true;
// set gobject values
this.el.width_request = 150;
- this.el.expand = true;
- this.el.shadow_type = Gtk.ShadowType.IN;
- var child_0 = new Xcls_view( _this );
- child_0.ref();
- this.el.add ( child_0.el );
+ this.el.has_frame = true;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ var child_1 = new Xcls_view( _this );
+ this.el.set_child ( child_1.el );
// init method
// set gobject values
this.el.name = "popover-files-view";
+ this.el.hexpand = true;
+ this.el.vexpand = true;
this.el.enable_tree_lines = true;
this.el.headers_visible = true;
- var child_0 = new Xcls_model( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_TreeViewColumn14( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
+ var child_1 = new Xcls_model( _this );
+ this.el.set_model ( child_1.el );
+ var child_2 = new Xcls_TreeViewColumn16( _this );
+ child_2.ref();
+ this.el.append_column ( child_2.el );
// init method
this.css = new Gtk.CssProvider();
try {
- this.css.load_from_data("#popover-files-view { font-size: 10px;}");
+ this.css.load_from_data("#popover-files-view { font-size: 10px;}".data);
} catch (Error e) {}
this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
// user defined functions
}
- public class Xcls_TreeViewColumn14 : Object
+ public class Xcls_TreeViewColumn16 : Object
{
public Gtk.TreeViewColumn el;
private Xcls_PopoverFiles _this;
// my vars (def)
// ctor
- public Xcls_TreeViewColumn14(Xcls_PopoverFiles _owner )
+ public Xcls_TreeViewColumn16(Xcls_PopoverFiles _owner )
{
_this = _owner;
this.el = new Gtk.TreeViewColumn();
// set gobject values
this.el.title = "Projects";
- var child_0 = new Xcls_namecol( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
+ var child_1 = new Xcls_namecol( _this );
+ this.el.pack_start ( child_1.el , true );
// init method
- public class Xcls_Box16 : Object
+ public class Xcls_Box18 : Object
{
public Gtk.Box el;
private Xcls_PopoverFiles _this;
// my vars (def)
// ctor
- public Xcls_Box16(Xcls_PopoverFiles _owner )
+ public Xcls_Box18(Xcls_PopoverFiles _owner )
{
_this = _owner;
this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
// set gobject values
this.el.width_request = 600;
- this.el.expand = true;
- var child_0 = new Xcls_Box17( _this );
- child_0.ref();
- this.el.add( child_0.el );
- var child_1 = new Xcls_iconscroll( _this );
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ var child_1 = new Xcls_Box19( _this );
child_1.ref();
- this.el.add ( child_1.el );
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_iconscroll( _this );
+ this.el.append( child_2.el );
}
// user defined functions
}
- public class Xcls_Box17 : Object
+ public class Xcls_Box19 : Object
{
public Gtk.Box el;
private Xcls_PopoverFiles _this;
// my vars (def)
// ctor
- public Xcls_Box17(Xcls_PopoverFiles _owner )
+ public Xcls_Box19(Xcls_PopoverFiles _owner )
{
_this = _owner;
this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
// set gobject values
this.el.hexpand = true;
- var child_0 = new Xcls_iconsearch( _this );
- child_0.ref();
- this.el.add( child_0.el );
+ var child_1 = new Xcls_iconsearch( _this );
+ this.el.append( child_1.el );
}
// user defined functions
this.css = new Gtk.CssProvider();
try {
- this.css.load_from_data("#popover-files-iconsearch { font: monospace 10px;}");
+ 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);
{
_this = _owner;
_this.iconscroll = this;
- this.el = new Gtk.ScrolledWindow( null, null );
+ this.el = new Gtk.ScrolledWindow();
// my vars (dec)
// set gobject values
this.el.width_request = 600;
- this.el.expand = true;
- this.el.shadow_type = Gtk.ShadowType.IN;
- var child_0 = new Xcls_iconview( _this );
- child_0.ref();
- this.el.add ( child_0.el );
+ this.el.has_frame = true;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ var child_1 = new Xcls_iconview( _this );
+ this.el.set_child ( child_1.el );
// init method
// set gobject values
this.el.markup_column = 1;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
this.el.pixbuf_column = 3;
this.el.has_tooltip = true;
this.el.item_width = 100;
- var child_0 = new Xcls_iconmodel( _this );
- child_0.ref();
- this.el.model = child_0.el;
+ var child_1 = new Xcls_iconmodel( _this );
+ this.el.model = child_1.el;
// init method
GLib.Value val;
_this.iconmodel.el.get_value(iter, 4, out val);
- tooltip.set_icon((Gdk.Pixbuf) val.get_object());
+ tooltip.set_icon( Gdk.Texture.for_pixbuf(
+ (Gdk.Pixbuf) val.get_object()
+ ));
_this.iconview.el.set_tooltip_item(tooltip, path);
return true;
});
{
_this = _owner;
_this.file_container = this;
- this.el = new Gtk.ScrolledWindow( null, null );
+ this.el = new Gtk.ScrolledWindow();
// my vars (dec)
// set gobject values
- this.el.width_request = 100;
- this.el.expand = true;
- this.el.shadow_type = Gtk.ShadowType.IN;
+ this.el.width_request = 200;
+ this.el.has_frame = true;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
this.el.visible = false;
- var child_0 = new Xcls_fileview( _this );
- child_0.ref();
- this.el.add ( child_0.el );
+ var child_1 = new Xcls_fileview( _this );
+ this.el.set_child ( child_1.el );
// init method
// set gobject values
this.el.name = "popover-files-fileview";
this.el.activate_on_single_click = false;
- this.el.expand = true;
+ this.el.hexpand = true;
+ this.el.vexpand = true;
this.el.enable_tree_lines = true;
this.el.headers_visible = true;
- var child_0 = new Xcls_filemodel( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_TreeViewColumn25( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
+ var child_1 = new Xcls_filemodel( _this );
+ this.el.set_model ( child_1.el );
+ var child_2 = new Xcls_TreeViewColumn27( _this );
+ child_2.ref();
+ this.el.append_column ( child_2.el );
// init method
this.css = new Gtk.CssProvider();
try {
- this.css.load_from_data("#popover-files-fileview { font-size: 12px;}");
+ this.css.load_from_data("#popover-files-fileview { font-size: 12px;}".data);
} catch (Error e) {}
this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
// user defined functions
}
- public class Xcls_TreeViewColumn25 : Object
+ public class Xcls_TreeViewColumn27 : Object
{
public Gtk.TreeViewColumn el;
private Xcls_PopoverFiles _this;
// my vars (def)
// ctor
- public Xcls_TreeViewColumn25(Xcls_PopoverFiles _owner )
+ public Xcls_TreeViewColumn27(Xcls_PopoverFiles _owner )
{
_this = _owner;
this.el = new Gtk.TreeViewColumn();
// set gobject values
this.el.title = "File";
- var child_0 = new Xcls_filenamecol( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
+ var child_1 = new Xcls_filenamecol( _this );
+ this.el.pack_start ( child_1.el , true );
// init method
{
"build_module" : "builder",
+ "gen_extended" : false,
"items" : [
{
"# JsRender.NodeProp? prop" : "",
"$ xns" : "Gtk",
+ "* ctor" : "new Gtk.Popover()",
"@ void success" : "(Project.Project pr, JsRender.JsRender file)",
"Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
"JsRender.Node node" : "",
"Xcls_MainWindow mainwindow" : "null",
+ "bool autohide" : true,
"bool done" : false,
"bool is_new" : false,
- "bool modal" : true,
"id" : "PopoverProperty",
"items" : [
{
- "$ pack" : "add",
"$ xns" : "Gtk",
+ "* pack" : "set_child",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
"bool homogeneous" : false,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,true,0",
+ "bool show_title_buttons" : false,
"id" : "header",
- "string title" : "Modify / Create Property",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "title_widget",
+ "id" : "headertitle",
+ "string label" : "Add / Edit property",
+ "xtype" : "Label"
+ }
+ ],
"xtype" : "HeaderBar"
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
- "Gtk.Align halign" : "Gtk.Align.START",
- "Gtk.Justification justify" : "Gtk.Justification.LEFT",
- "int margin_top" : 12,
- "label" : "Special Flags",
- "x_options" : 4,
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* init" : "this.el.add_attribute(_this.dbcellrenderer.el , \"markup\", 1 );",
- "* pack" : "add",
- "id" : "kflag",
+ "bool show_row_separators" : true,
+ "bool show_separators" : true,
+ "id" : "ptype",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "dbcellrenderer",
- "xtype" : "CellRendererText"
+ "* prop" : "model",
+ "id" : "pselmodel",
+ "items" : [
+ {
+ "$ xns" : "GLib",
+ "* ctor" : "new GLib.ListStore(typeof(JsRender.NodeProp));",
+ "* init" : [
+ "{",
+ "",
+ "",
+ "\tthis.el.append( new JsRender.NodeProp.prop(\"\"));",
+ "\tthis.el.append( new JsRender.NodeProp.raw(\"\"));",
+ "\tthis.el.append( new JsRender.NodeProp.valamethod(\"\"));",
+ "\tthis.el.append( new JsRender.NodeProp.special(\"\"));\t",
+ "\tthis.el.append( new JsRender.NodeProp.listener(\"\"));\t\t",
+ "\tthis.el.append( new JsRender.NodeProp.user(\"\"));\t",
+ "\tthis.el.append( new JsRender.NodeProp.sig(\"\"));\t",
+ "\t",
+ "",
+ "}",
+ ""
+ ],
+ "* prop" : "model",
+ "id" : "pmodel",
+ "xtype" : "ListStore"
+ }
+ ],
+ "xtype" : "SingleSelection"
},
{
- "$ columns" : "typeof(JsRender.NodePropType),typeof(string)",
"$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "dbmodel",
- "n_columns" : 2,
- "xtype" : "ListStore",
- "| void loadData" : [
- " (JsRender.NodeProp prop) {",
- " this.el.clear(); ",
- " Gtk.TreeIter iter;",
- " var el = this.el;",
- " ",
- " ",
- " // vala signal.. '@'",
- " // raw value '$'",
- " // user defined property '#'",
- " // user defined method '|'",
- " // special property '*' => prop |args|ctor|init",
- " ",
- " ",
- " ",
- " /// el.append(out iter);",
- " ",
- " ",
- " // el.set_value(iter, 0, \"\");",
- " // el.set_value(iter, 1, \"aaa - Just add Element - aaa\");",
- "",
- " ",
- "\tif (prop.ptype == JsRender.NodePropType.LISTENER) { ",
- "\t\tel.append(out iter);",
- "\t\tel.set(iter, 0, JsRender.NodePropType.LISTENER, 1, \"Event Handler / Listener\", -1);",
- "\t}\t ",
- "\telse if (_this.mainwindow.windowstate.file.xtype == \"Gtk\") {",
- "\t\t el.append(out iter);",
- "\t el.set(iter, 0, JsRender.NodePropType.PROP, 1, \"Normal Property\", -1);",
- "\t",
- "\t\t",
- "\t\tel.append(out iter);",
- "\t\tel.set(iter, 0, JsRender.NodePropType.RAW, 1, \"Raw Property (not escaped)\", -1);",
- "\t\t ",
- "\t\t",
- "\t\tel.append(out iter);",
- "\t\tel.set(iter, 0, JsRender.NodePropType.USER, 1, \"User defined property\", -1);",
- "\t\t ",
- "\t\tel.append(out iter);",
- "\t\tel.set(iter, 0, JsRender.NodePropType.METHOD, 1, \"User defined method\", -1);",
- "\t\t ",
- "\t\tel.append(out iter);",
- "\t\tel.set(iter, 0, JsRender.NodePropType.SPECIAL, 1, \"Special property (eg. prop | args | ctor | init )\", -1);",
- "\t\t ",
- "\t\t",
- "\t\tel.append(out iter);",
- "\t el.set(iter, 0, JsRender.NodePropType.SIGNAL, 1, \"Vala Signal\", -1);",
- "\t\t ",
- "\t\t",
- "\t} else { ",
- "\t\t// javascript",
- "\t el.append(out iter);",
- "\t el.set(iter, 0, JsRender.NodePropType.PROP, 1, \"Normal Property\", -1);",
- "\t",
- "\t\tel.append(out iter);",
- "\t\tel.set(iter, 0, JsRender.NodePropType.RAW, 1, \"Raw Property (not escaped)\", -1);",
- "\t\t",
- "\t\t// we appear to still use this?!? (builderCfg?)",
- "\t\tel.append(out iter);",
- "\t\tel.set(iter, 0, JsRender.NodePropType.USER, 1, \"User defined property\", -1);",
- "\t\t",
- "\t\t",
- "\t\tel.append(out iter);",
- "\t\tel.set(iter, 0, JsRender.NodePropType.METHOD, 1, \"User defined method\", -1);",
- "\t ",
- "\t\tel.append(out iter);",
- "\t\tel.set(iter, 0, JsRender.NodePropType.SPECIAL, 1, \"(*) Special property (eg. prop )\", -1);",
- "\t\t ",
- "\t",
- "\t}",
- "\t// set selected, based on arg",
- "\tel.foreach((tm, tp, titer) => {",
- "\t\tGLib.Value val;",
- "\t\tel.get_value(titer, 0, out val);",
- "\t\t ",
- "\t\t//print(\"check %s against %s\\n\", (string)val, _this.prop.ptype);",
- "\t\tif (((JsRender.NodePropType)val) == prop.ptype) {",
- "\t\t\t_this.kflag.el.set_active_iter(titer);",
- "\t\t\treturn true;",
- "\t\t}",
- "\t\treturn false;",
- "\t});",
- "\t",
- "",
- " ",
- "}",
- ""
- ]
+ "* pack" : "append_column",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "factory",
+ "listeners" : {
+ "bind" : [
+ "(listitem) => {",
+ "",
+ " \tvar lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child(); ",
+ " \tvar np = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
+ " ",
+ "\t",
+ " ",
+ "\tlbl.label = np.ptype.to_name();",
+ " \t ",
+ "}",
+ ""
+ ],
+ "setup" : [
+ "(listitem) => {",
+ "",
+ "\t ",
+ "\tvar label = new Gtk.Label(\"\");",
+ "\tlabel.xalign = 0;",
+ "\t ",
+ "\t((Gtk.ListItem)listitem).set_child(label);",
+ "\t((Gtk.ListItem)listitem).activatable = false;",
+ "\t",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "SignalListItemFactory"
+ }
+ ],
+ "string title" : "Property Type",
+ "xtype" : "ColumnViewColumn"
}
],
- "xtype" : "ComboBox"
+ "xtype" : "ColumnView",
+ "| JsRender.NodePropType getValue" : [
+ "() {",
+ "\t",
+ "\tvar li = (JsRender.NodeProp) _this.pmodel.el.get_item(",
+ "\t\t_this.pselmodel.el.get_selected()",
+ "\t\t);",
+ "\treturn li.ptype;",
+ "",
+ "}"
+ ],
+ "| void setValue" : [
+ "(JsRender.NodePropType pt) ",
+ "{",
+ " \tfor (var i = 0; i < _this.pmodel.el.n_items; i++) {",
+ "\t \tvar li = (JsRender.NodeProp) _this.pmodel.el.get_item(i);",
+ " \t\tif (li.ptype == pt) {",
+ " \t\t\t_this.pselmodel.el.set_selected(i);",
+ " \t\t\treturn;",
+ "\t\t}",
+ "\t}",
+ "\tGLib.debug(\"failed to set selected ptype\");",
+ "\t_this.pselmodel.el.set_selected(0);",
+ "}"
+ ]
},
{
"$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "add",
"Gtk.Align halign" : "Gtk.Align.START",
"Gtk.Justification justify" : "Gtk.Justification.LEFT",
"int margin_top" : 12,
{
"$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "add",
"id" : "ktype",
"xtype" : "Entry"
},
{
"$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "add",
"Gtk.Align halign" : "Gtk.Align.START",
"Gtk.Justification justify" : "Gtk.Justification.LEFT",
"int margin_top" : 12,
{
"$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "add",
"id" : "kname",
- "listeners" : {
- "focus_out_event" : [
- "()=>{",
- "\t_this.error.setError(\"\");",
- "\tvar val = this.el.get_text().strip(); ",
- "\tif (val.length < 1) {",
- "\t\t_this.error.setError(\"Name can not be empty\");",
- "\t}",
- "\treturn true;",
- "}",
- "",
- ""
- ],
- "key_release_event" : [
- "()=>{",
- "\t_this.error.setError(\"\");",
- "\tvar val = this.el.get_text().strip(); ",
- "\tif (val.length < 1) {",
- "\t\t_this.error.setError(\"Name can not be empty\");",
- "\t}",
- "\treturn true;",
- "}",
- "",
- ""
- ]
- },
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "leave" : [
+ "( ) => {",
+ "",
+ " _this.error.setError(\"\");",
+ "\tvar val = _this.kname.el.get_text().strip(); ",
+ "\tif (val.length < 1) {",
+ "\t\t_this.error.setError(\"Name can not be empty\");",
+ "\t}",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "EventControllerFocus"
+ },
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "key_released" : [
+ "(keyval, keycode, state) => {",
+ "",
+ " _this.error.setError(\"\");",
+ "\tvar val = _this.kname.el.get_text().strip(); ",
+ "\tif (val.length < 1) {",
+ "\t\t_this.error.setError(\"Name can not be empty\");",
+ "\t}",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "EventControllerKey"
+ }
+ ],
"xtype" : "Entry"
},
{
"$ visible" : true,
"$ xns" : "Gtk",
- "* pack" : "add",
"Gtk.Align halign" : "Gtk.Align.START",
"Gtk.Justification justify" : "Gtk.Justification.LEFT",
"bool use_markup" : true,
"| void setError" : [
"(string err) {",
"\tif (err == \"\") {",
- "\t\tthis.el.hide();",
+ "\t\tthis.el.label = \"\";",
"\t} else {",
- "\t\tthis.el.show();",
+ "",
"\t\t",
"\t\tthis.el.label = \"<span color=\\\"red\\\">\" + err + \"</span>\";",
"\t}",
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
"id" : "buttonbar",
"int margin_top" : 20,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
"bool always_show_image" : true,
"bool hexpand" : true,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "composite_name",
- "* prop" : "image",
- "string icon_name" : "window-close",
- "xtype" : "Image"
- }
- ],
"listeners" : {
- "button_press_event" : [
- "() => { ",
- "",
+ "clicked" : [
+ "() => {",
"\t_this.prop = null;",
"\t_this.is_new = false;",
"\t_this.kname.el.set_text(\"Cancel\");",
"\t_this.el.hide();",
- "\treturn false;",
+ "\t",
"}"
]
},
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
"bool always_show_image" : true,
"bool hexpand" : true,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* prop" : "image",
- "string icon_name" : "list-add",
- "xtype" : "Image"
- }
- ],
"listeners" : {
- "button_press_event" : [
+ "clicked" : [
"() => {",
"\t// check if text is not empty..",
"\tif ( _this.kname.el.get_text().strip().length < 1) {",
+ "\t",
"\t\t// error should already be showing?",
- "\t\treturn false;",
+ "\t\treturn;",
"\t}",
- "\t_this.updateProp();",
- "\t",
+ "\t ",
"\t// since we can't add listeners?!?!?",
"\t// only check props.",
"\t// check if property already exists in node.\t",
- "\tvar prop = _this.prop;",
+ "",
+ "",
+ "\tvar prop = new JsRender.NodeProp(",
+ "\t\t_this.kname.el.get_text().strip(),",
+ "\t\t_this.ptype.getValue(),",
+ "\t\t_this.ktype.el.get_text().strip(),",
+ "\t\t_this.prop.val",
+ "\t);",
+ "",
"\tif (_this.node.props.has_key(prop.to_index_key())) {",
"\t\t_this.error.setError(\"Property already exists\");",
- "\t\treturn false;\t",
+ "\t\treturn;\t",
"\t}",
"\t",
"\t",
- "\t ",
- "\t_this.is_new = false;\t",
- "\t ",
+ "\t",
+ "\t_this.node.add_prop(prop);",
"\t// hide self",
"\t_this.prop = null; // skip checks..",
+ "\t_this.is_new = false;",
"\t_this.el.hide();",
+ " ",
+ "\t_this.mainwindow.windowstate.left_props.view.editProp(prop);",
"",
- "// add it, ",
- "\t// trigger editing of property.",
- "\t// allow hide to work?",
- "\twhile (Gtk.events_pending()) {",
- "\t\tGtk.main_iteration();",
- "\t}",
"\t",
- "\t_this.mainwindow.windowstate.left_props.addProp(prop);\t\t",
"\t",
- "\treturn false;",
"}"
]
},
"\t\treturn;",
"\t}",
"\t",
- "\tvar oldkey = this.prop.to_index_key();\t",
+ " ",
" \t",
" ",
" \tthis.updateProp();",
- " \t",
- " \tvar newkey = this.prop.to_index_key();\t",
- " \tif (oldkey != newkey) {",
- " \t",
- " \t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {",
- " \t\t\tthis.node.listeners.unset(oldkey);",
- " \t\t\tthis.node.listeners.set(newkey, _this.prop);",
- " \t\t} else {",
- " \t\t\tthis.node.props.unset(oldkey);",
- " \t\t\tthis.node.props.set(newkey, _this.prop);",
- " \t\t}",
- " \t",
- " \t}",
- "\t_this.mainwindow.windowstate.left_props.reload();",
+ " ",
+ "\t ",
"",
"",
" ",
"\tif (_this.is_new || this.kname.el.get_text().strip().length < 1) {",
"\t\t// dont allow hiding if we are creating a new one.",
"\t\tGLib.debug(\"prevent hiding as its new or text is empty\"); ",
- "\t\tthis.el.show_all();",
+ "\t\tthis.el.show();",
"\t\treturn;",
"",
"\t}",
},
"string key_type" : "",
"string old_keyname" : "",
- "uint border_width" : 0,
"xtype" : "Popover",
"| void show" : [
"(",
"\tthis.is_new = is_new; ",
"\tvar pref = is_new ? \"Add \" : \"Modify \";",
"\tif (prop.ptype == JsRender.NodePropType.LISTENER) {",
- "\t\tthis.header.el.title = pref + \"Event Listener\"; // cant really happen yet?",
+ "\t\tthis.headertitle.el.label = pref + \"Event Listener\"; // cant really happen yet?",
"\t} else {",
- "\t\tthis.header.el.title = pref + \"Property\";",
+ "\t\tthis.headertitle.el.label = pref + \"Property\";",
"\t}",
"\tthis.prop = prop;",
"\tthis.node = node;",
"\t_this.kname.el.set_text(prop.name);",
"\t_this.ktype.el.set_text(prop.rtype);",
"\t",
- "\t_this.dbmodel.loadData(prop );",
+ " \t_this.ptype.setValue(prop.ptype);",
"\t// does node have this property...",
"",
"",
"\t_this.node = node;",
"\t//console.log('show all');",
- "\tthis.el.set_modal(true);",
- "\tthis.el.set_relative_to(btn);",
- "\tif (y > -1) {",
- "\t\t",
"\t",
- "\t\tvar r = Gdk.Rectangle() {",
- "\t\t\tx = btn.get_allocated_width(), // align left...",
+ "\tGLib.debug(\"set parent = %s\", btn.get_type().name());",
+ "\tvar par = btn.get_parent();",
+ "\t",
+ "\tif (par == null) {",
+ "\t\tGLib.debug(\"parent of that is null - not showing\");",
+ "\t\treturn;",
+ "\t}",
+ "\tif (this.el.parent == null) {",
+ "\t\tthis.el.set_parent(btn);",
+ "\t}",
+ "\tvar r = Gdk.Rectangle() {",
+ "\t\t\tx = btn.get_width(), // align left...",
+ "\t\t\ty = 0,",
+ "\t\t\twidth = 1,",
+ "\t\t\theight = 1",
+ "\t\t};",
+ "\t//Gtk.Allocation rect;",
+ "\t//btn.get_allocation(out rect);",
+ " this.el.set_pointing_to(r);",
+ " ",
+ "",
+ "\t ",
+ "\tif (y > -1) {",
+ "\t\t ",
+ "\t\t r = Gdk.Rectangle() {",
+ "\t\t\tx = btn.get_width(), // align left...",
"\t\t\ty = y,",
"\t\t\twidth = 1,",
"\t\t\theight = 1",
"\t//this.el.set_position(Gtk.PositionType.TOP);",
"",
"\t// window + header?",
- "\t print(\"SHOWALL - POPIP\\n\");",
- "\tthis.el.show_all();",
+ "\t GLib.debug(\"SHOWALL - POPIP\\n\");",
+ "\t",
"\tthis.kname.el.grab_focus();",
"\tthis.buttonbar.el.hide();",
"\tif (this.is_new) {",
"\t\tthis.buttonbar.el.show();",
"\t}",
- "\t this.error.setError(\"\");",
- "",
+ "\tthis.error.setError(\"\");",
+ "\tthis.el.show();",
"\t//this.success = c.success;",
" ",
"}"
],
"| void updateProp" : [
"() {",
- " ",
- "\tGtk.TreeIter citer;",
- "\tGLib.Value gval;",
- "\tthis.kflag.el.get_active_iter(out citer);",
- "\tthis.dbmodel.el.get_value(citer, 0, out gval);",
- "",
- "",
- "\t_this.prop.name = this.kname.el.get_text().strip(); ",
- "\t_this.prop.rtype = this.ktype.el.get_text().strip(); ",
- "\t_this.prop.ptype = (JsRender.NodePropType) gval;",
+ " \tGLib.debug(\"updateProp called\");",
"",
+ "\t",
+ "\t",
+ "\t_this.prop.name = this.kname.el.get_text().strip();",
+ "\t_this.prop.ptype = this.ptype.getValue();",
+ "\t_this.prop.rtype = this.ktype.el.get_text().strip();",
+ "\t",
+ "\t ",
"}",
""
]
}
],
- "modOrder" : "",
- "name" : "PopoverProperty",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/PopoverProperty.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "PopoverProperty"
}
\ No newline at end of file
-static Xcls_PopoverProperty _PopoverProperty;
+ static Xcls_PopoverProperty _PopoverProperty;
-public class Xcls_PopoverProperty : Object
-{
- public Gtk.Popover el;
- private Xcls_PopoverProperty _this;
-
- public static Xcls_PopoverProperty singleton()
- {
- if (_PopoverProperty == null) {
- _PopoverProperty= new Xcls_PopoverProperty();
- }
- return _PopoverProperty;
- }
- public Xcls_header header;
- public Xcls_kflag kflag;
- public Xcls_dbcellrenderer dbcellrenderer;
- public Xcls_dbmodel dbmodel;
- public Xcls_ktype ktype;
- public Xcls_kname kname;
- public Xcls_error error;
- public Xcls_buttonbar buttonbar;
-
- // my vars (def)
- public bool is_new;
- public signal void success (Project.Project pr, JsRender.JsRender file);
- public string key_type;
- public JsRender.NodeProp? prop;
- public JsRender.Node node;
- public Xcls_MainWindow mainwindow;
- public bool done;
- public string old_keyname;
-
- // ctor
- public Xcls_PopoverProperty()
- {
- _this = this;
- this.el = new Gtk.Popover( null );
-
- // my vars (dec)
- this.is_new = false;
- this.mainwindow = null;
- this.done = false;
-
- // set gobject values
- this.el.border_width = 0;
- this.el.modal = true;
- this.el.position = Gtk.PositionType.RIGHT;
- var child_0 = new Xcls_Box2( _this );
- child_0.ref();
- this.el.add( child_0.el );
-
- //listeners
- this.el.closed.connect( () => {
-
- GLib.debug("popover closed");
- if (_this.is_new) {
- // dont allow hiding if we are creating a new one.
- // on.hide will reshow it.
- return;
- }
- if (_this.prop == null) {
- // hide and dont update.
- return;
- }
- if (this.kname.el.get_text().strip().length < 1) {
- return;
- }
-
- var oldkey = this.prop.to_index_key();
-
-
- this.updateProp();
-
- var newkey = this.prop.to_index_key();
- if (oldkey != newkey) {
-
- if (_this.prop.ptype == JsRender.NodePropType.LISTENER) {
- this.node.listeners.unset(oldkey);
- this.node.listeners.set(newkey, _this.prop);
- } else {
- this.node.props.unset(oldkey);
- this.node.props.set(newkey, _this.prop);
- }
-
- }
- _this.mainwindow.windowstate.left_props.reload();
-
-
-
- });
- this.el.hide.connect( () => {
- GLib.debug("popover hidden");
- if (_this.is_new || this.kname.el.get_text().strip().length < 1) {
- // dont allow hiding if we are creating a new one.
- GLib.debug("prevent hiding as its new or text is empty");
- this.el.show_all();
- return;
-
- }
-
- });
- }
-
- // user defined functions
- public void updateProp () {
-
- Gtk.TreeIter citer;
- GLib.Value gval;
- this.kflag.el.get_active_iter(out citer);
- this.dbmodel.el.get_value(citer, 0, out gval);
-
-
- _this.prop.name = this.kname.el.get_text().strip();
- _this.prop.rtype = this.ktype.el.get_text().strip();
- _this.prop.ptype = (JsRender.NodePropType) gval;
-
- }
- public void show (
- Gtk.Widget btn,
- JsRender.Node node,
- JsRender.NodeProp prop,
- int y,
- bool is_new = false
- )
- {
-
-
- this.is_new = is_new;
- var pref = is_new ? "Add " : "Modify ";
- if (prop.ptype == JsRender.NodePropType.LISTENER) {
- this.header.el.title = pref + "Event Listener"; // cant really happen yet?
- } else {
- this.header.el.title = pref + "Property";
- }
- this.prop = prop;
- this.node = node;
-
- _this.kname.el.set_text(prop.name);
- _this.ktype.el.set_text(prop.rtype);
-
- _this.dbmodel.loadData(prop );
- // does node have this property...
-
-
- _this.node = node;
- //console.log('show all');
- this.el.set_modal(true);
- this.el.set_relative_to(btn);
- if (y > -1) {
-
-
- var r = Gdk.Rectangle() {
- x = btn.get_allocated_width(), // align left...
- y = y,
- width = 1,
- height = 1
- };
- this.el.set_pointing_to( r);
- }
-
-
-
- //this.el.set_position(Gtk.PositionType.TOP);
-
- // window + header?
- print("SHOWALL - POPIP\n");
- this.el.show_all();
- this.kname.el.grab_focus();
- this.buttonbar.el.hide();
- if (this.is_new) {
- this.buttonbar.el.show();
- }
- this.error.setError("");
-
- //this.success = c.success;
-
- }
- public class Xcls_Box2 : Object
+ public class Xcls_PopoverProperty : Object
{
- public Gtk.Box el;
+ public Gtk.Popover el;
private Xcls_PopoverProperty _this;
+ public static Xcls_PopoverProperty singleton()
+ {
+ if (_PopoverProperty == null) {
+ _PopoverProperty= new Xcls_PopoverProperty();
+ }
+ return _PopoverProperty;
+ }
+ public Xcls_header header;
+ public Xcls_headertitle headertitle;
+ public Xcls_ptype ptype;
+ public Xcls_pselmodel pselmodel;
+ public Xcls_pmodel pmodel;
+ public Xcls_ktype ktype;
+ public Xcls_kname kname;
+ public Xcls_error error;
+ public Xcls_buttonbar buttonbar;
// my vars (def)
+ public bool is_new;
+ public signal void success (Project.Project pr, JsRender.JsRender file);
+ public string key_type;
+ public JsRender.NodeProp? prop;
+ public bool done;
+ public Xcls_MainWindow mainwindow;
+ public JsRender.Node node;
+ public string old_keyname;
// ctor
- public Xcls_Box2(Xcls_PopoverProperty _owner )
+ public Xcls_PopoverProperty()
{
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ _this = this;
+ this.el = new Gtk.Popover();
// my vars (dec)
+ this.is_new = false;
+ this.done = false;
+ this.mainwindow = null;
// set gobject values
- this.el.homogeneous = false;
- var child_0 = new Xcls_header( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,true,0 );
- var child_1 = new Xcls_Label4( _this );
+ this.el.autohide = true;
+ this.el.position = Gtk.PositionType.RIGHT;
+ var child_1 = new Xcls_Box2( _this );
child_1.ref();
- this.el.add ( child_1.el );
- var child_2 = new Xcls_kflag( _this );
- child_2.ref();
- this.el.add ( child_2.el );
- var child_3 = new Xcls_Label8( _this );
- child_3.ref();
- this.el.add ( child_3.el );
- var child_4 = new Xcls_ktype( _this );
- child_4.ref();
- this.el.add ( child_4.el );
- var child_5 = new Xcls_Label10( _this );
- child_5.ref();
- this.el.add ( child_5.el );
- var child_6 = new Xcls_kname( _this );
- child_6.ref();
- this.el.add ( child_6.el );
- var child_7 = new Xcls_error( _this );
- child_7.ref();
- this.el.add ( child_7.el );
- var child_8 = new Xcls_buttonbar( _this );
- child_8.ref();
- this.el.add ( child_8.el );
+ this.el.set_child ( child_1.el );
+
+ //listeners
+ this.el.closed.connect( () => {
+
+ GLib.debug("popover closed");
+ if (_this.is_new) {
+ // dont allow hiding if we are creating a new one.
+ // on.hide will reshow it.
+ return;
+ }
+ if (_this.prop == null) {
+ // hide and dont update.
+ return;
+ }
+ if (this.kname.el.get_text().strip().length < 1) {
+ return;
+ }
+
+
+
+
+ this.updateProp();
+
+
+
+
+
+ });
+ this.el.hide.connect( () => {
+ GLib.debug("popover hidden");
+ if (_this.is_new || this.kname.el.get_text().strip().length < 1) {
+ // dont allow hiding if we are creating a new one.
+ GLib.debug("prevent hiding as its new or text is empty");
+ this.el.show();
+ return;
+
+ }
+
+ });
}
// user defined functions
- }
- public class Xcls_header : Object
- {
- public Gtk.HeaderBar el;
- private Xcls_PopoverProperty _this;
+ public void updateProp () {
+ GLib.debug("updateProp called");
+
+
+
+ _this.prop.name = this.kname.el.get_text().strip();
+ _this.prop.ptype = this.ptype.getValue();
+ _this.prop.rtype = this.ktype.el.get_text().strip();
+
+
+ }
+ public void show (
+ Gtk.Widget btn,
+ JsRender.Node node,
+ JsRender.NodeProp prop,
+ int y,
+ bool is_new = false
+ )
+ {
+
+
+ this.is_new = is_new;
+ var pref = is_new ? "Add " : "Modify ";
+ if (prop.ptype == JsRender.NodePropType.LISTENER) {
+ this.headertitle.el.label = pref + "Event Listener"; // cant really happen yet?
+ } else {
+ this.headertitle.el.label = pref + "Property";
+ }
+ this.prop = prop;
+ this.node = node;
+
+ _this.kname.el.set_text(prop.name);
+ _this.ktype.el.set_text(prop.rtype);
+
+ _this.ptype.setValue(prop.ptype);
+ // does node have this property...
+
+
+ _this.node = node;
+ //console.log('show all');
+
+ GLib.debug("set parent = %s", btn.get_type().name());
+ var par = btn.get_parent();
+
+ if (par == null) {
+ GLib.debug("parent of that is null - not showing");
+ return;
+ }
+ if (this.el.parent == null) {
+ this.el.set_parent(btn);
+ }
+ var r = Gdk.Rectangle() {
+ x = btn.get_width(), // align left...
+ y = 0,
+ width = 1,
+ height = 1
+ };
+ //Gtk.Allocation rect;
+ //btn.get_allocation(out rect);
+ this.el.set_pointing_to(r);
+
+
+
+ if (y > -1) {
+
+ r = Gdk.Rectangle() {
+ x = btn.get_width(), // align left...
+ y = y,
+ width = 1,
+ height = 1
+ };
+ this.el.set_pointing_to( r);
+ }
+
+
+
+ //this.el.set_position(Gtk.PositionType.TOP);
+
+ // window + header?
+ GLib.debug("SHOWALL - POPIP\n");
+
+ this.kname.el.grab_focus();
+ this.buttonbar.el.hide();
+ if (this.is_new) {
+ this.buttonbar.el.show();
+ }
+ this.error.setError("");
+ this.el.show();
+ //this.success = c.success;
+
+ }
+ public class Xcls_Box2 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_PopoverProperty _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box2(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.homogeneous = false;
+ new Xcls_header( _this );
+ this.el.append( _this.header.el );
+ new Xcls_ptype( _this );
+ this.el.append( _this.ptype.el );
+ var child_3 = new Xcls_Label10( _this );
+ child_3.ref();
+ this.el.append( child_3.el );
+ new Xcls_ktype( _this );
+ this.el.append( _this.ktype.el );
+ var child_5 = new Xcls_Label12( _this );
+ child_5.ref();
+ this.el.append( child_5.el );
+ new Xcls_kname( _this );
+ this.el.append( _this.kname.el );
+ new Xcls_error( _this );
+ this.el.append( _this.error.el );
+ new Xcls_buttonbar( _this );
+ this.el.append( _this.buttonbar.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_header : Object
+ {
+ public Gtk.HeaderBar el;
+ private Xcls_PopoverProperty _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_header(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- _this.header = this;
- this.el = new Gtk.HeaderBar();
+ // ctor
+ public Xcls_header(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ _this.header = this;
+ this.el = new Gtk.HeaderBar();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.title = "Modify / Create Property";
- }
+ // set gobject values
+ this.el.show_title_buttons = false;
+ new Xcls_headertitle( _this );
+ this.el.title_widget = _this.headertitle.el;
+ }
- // user defined functions
- }
+ // user defined functions
+ }
+ public class Xcls_headertitle : Object
+ {
+ public Gtk.Label el;
+ private Xcls_PopoverProperty _this;
- public class Xcls_Label4 : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverProperty _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_headertitle(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ _this.headertitle = this;
+ this.el = new Gtk.Label( "Add / Edit property" );
- // ctor
- public Xcls_Label4(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Special Flags" );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ }
- // set gobject values
- this.el.halign = Gtk.Align.START;
- this.el.justify = Gtk.Justification.LEFT;
- this.el.margin_top = 12;
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_kflag : Object
- {
- public Gtk.ComboBox el;
- private Xcls_PopoverProperty _this;
+ public class Xcls_ptype : Object
+ {
+ public Gtk.ColumnView el;
+ private Xcls_PopoverProperty _this;
- // my vars (def)
+ // my vars (def)
+ public bool show_separators;
- // ctor
- public Xcls_kflag(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- _this.kflag = this;
- this.el = new Gtk.ComboBox();
+ // ctor
+ public Xcls_ptype(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ _this.ptype = this;
+ new Xcls_pselmodel( _this );
+ this.el = new Gtk.ColumnView( _this.pselmodel.el );
- // my vars (dec)
+ // my vars (dec)
+ this.show_separators = true;
- // set gobject values
- var child_0 = new Xcls_dbcellrenderer( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
- var child_1 = new Xcls_dbmodel( _this );
- child_1.ref();
- this.el.set_model ( child_1.el );
+ // set gobject values
+ this.el.show_row_separators = true;
+ var child_2 = new Xcls_ColumnViewColumn8( _this );
+ child_2.ref();
+ this.el.append_column ( child_2.el );
+ }
- // init method
-
- this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
+ // user defined functions
+ public JsRender.NodePropType getValue () {
+
+ var li = (JsRender.NodeProp) _this.pmodel.el.get_item(
+ _this.pselmodel.el.get_selected()
+ );
+ return li.ptype;
+
+ }
+ public void setValue (JsRender.NodePropType pt)
+ {
+ for (var i = 0; i < _this.pmodel.el.n_items; i++) {
+ var li = (JsRender.NodeProp) _this.pmodel.el.get_item(i);
+ if (li.ptype == pt) {
+ _this.pselmodel.el.set_selected(i);
+ return;
+ }
+ }
+ GLib.debug("failed to set selected ptype");
+ _this.pselmodel.el.set_selected(0);
+ }
}
+ public class Xcls_pselmodel : Object
+ {
+ public Gtk.SingleSelection el;
+ private Xcls_PopoverProperty _this;
- // user defined functions
- }
- public class Xcls_dbcellrenderer : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_PopoverProperty _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_pselmodel(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ _this.pselmodel = this;
+ new Xcls_pmodel( _this );
+ this.el = new Gtk.SingleSelection( _this.pmodel.el );
- // ctor
- public Xcls_dbcellrenderer(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- _this.dbcellrenderer = this;
- this.el = new Gtk.CellRendererText();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ }
- // set gobject values
+ // user defined functions
}
+ public class Xcls_pmodel : Object
+ {
+ public GLib.ListStore el;
+ private Xcls_PopoverProperty _this;
- // user defined functions
- }
- public class Xcls_dbmodel : Object
- {
- public Gtk.ListStore el;
- private Xcls_PopoverProperty _this;
+ // my vars (def)
+ // ctor
+ public Xcls_pmodel(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ _this.pmodel = this;
+ this.el = new GLib.ListStore(typeof(JsRender.NodeProp));;
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_dbmodel(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- _this.dbmodel = this;
- this.el = new Gtk.ListStore.newv( { typeof(JsRender.NodePropType),typeof(string) } );
+ // set gobject values
- // my vars (dec)
+ // init method
- // set gobject values
- }
+ {
+
+
+ this.el.append( new JsRender.NodeProp.prop(""));
+ this.el.append( new JsRender.NodeProp.raw(""));
+ this.el.append( new JsRender.NodeProp.valamethod(""));
+ this.el.append( new JsRender.NodeProp.special(""));
+ this.el.append( new JsRender.NodeProp.listener(""));
+ this.el.append( new JsRender.NodeProp.user(""));
+ this.el.append( new JsRender.NodeProp.sig(""));
+
+
+ }
+ }
- // user defined functions
- public void loadData (JsRender.NodeProp prop) {
- this.el.clear();
- Gtk.TreeIter iter;
- var el = this.el;
-
-
- // vala signal.. '@'
- // raw value '$'
- // user defined property '#'
- // user defined method '|'
- // special property '*' => prop |args|ctor|init
-
-
-
- /// el.append(out iter);
-
-
- // el.set_value(iter, 0, "");
- // el.set_value(iter, 1, "aaa - Just add Element - aaa");
-
-
- if (prop.ptype == JsRender.NodePropType.LISTENER) {
- el.append(out iter);
- el.set(iter, 0, JsRender.NodePropType.LISTENER, 1, "Event Handler / Listener", -1);
- }
- else if (_this.mainwindow.windowstate.file.xtype == "Gtk") {
- el.append(out iter);
- el.set(iter, 0, JsRender.NodePropType.PROP, 1, "Normal Property", -1);
-
-
- el.append(out iter);
- el.set(iter, 0, JsRender.NodePropType.RAW, 1, "Raw Property (not escaped)", -1);
-
-
- el.append(out iter);
- el.set(iter, 0, JsRender.NodePropType.USER, 1, "User defined property", -1);
-
- el.append(out iter);
- el.set(iter, 0, JsRender.NodePropType.METHOD, 1, "User defined method", -1);
-
- el.append(out iter);
- el.set(iter, 0, JsRender.NodePropType.SPECIAL, 1, "Special property (eg. prop | args | ctor | init )", -1);
-
-
- el.append(out iter);
- el.set(iter, 0, JsRender.NodePropType.SIGNAL, 1, "Vala Signal", -1);
-
-
- } else {
- // javascript
- el.append(out iter);
- el.set(iter, 0, JsRender.NodePropType.PROP, 1, "Normal Property", -1);
-
- el.append(out iter);
- el.set(iter, 0, JsRender.NodePropType.RAW, 1, "Raw Property (not escaped)", -1);
-
- // we appear to still use this?!? (builderCfg?)
- el.append(out iter);
- el.set(iter, 0, JsRender.NodePropType.USER, 1, "User defined property", -1);
-
-
- el.append(out iter);
- el.set(iter, 0, JsRender.NodePropType.METHOD, 1, "User defined method", -1);
-
- el.append(out iter);
- el.set(iter, 0, JsRender.NodePropType.SPECIAL, 1, "(*) Special property (eg. prop )", -1);
-
-
- }
- // set selected, based on arg
- el.foreach((tm, tp, titer) => {
- GLib.Value val;
- el.get_value(titer, 0, out val);
-
- //print("check %s against %s\n", (string)val, _this.prop.ptype);
- if (((JsRender.NodePropType)val) == prop.ptype) {
- _this.kflag.el.set_active_iter(titer);
- return true;
- }
- return false;
- });
-
-
-
+ // user defined functions
}
- }
-
- public class Xcls_Label8 : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverProperty _this;
-
- // my vars (def)
-
- // ctor
- public Xcls_Label8(Xcls_PopoverProperty _owner )
+ public class Xcls_ColumnViewColumn8 : Object
{
- _this = _owner;
- this.el = new Gtk.Label( "Type or Return Type" );
+ public Gtk.ColumnViewColumn el;
+ private Xcls_PopoverProperty _this;
- // my vars (dec)
- // set gobject values
- this.el.halign = Gtk.Align.START;
- this.el.justify = Gtk.Justification.LEFT;
- this.el.margin_top = 12;
- this.el.visible = true;
- }
-
- // user defined functions
- }
+ // my vars (def)
- public class Xcls_ktype : Object
- {
- public Gtk.Entry el;
- private Xcls_PopoverProperty _this;
+ // ctor
+ public Xcls_ColumnViewColumn8(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_SignalListItemFactory9( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Property Type", child_1.el );
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ }
- // ctor
- public Xcls_ktype(Xcls_PopoverProperty _owner )
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory9 : Object
{
- _this = _owner;
- _this.ktype = this;
- this.el = new Gtk.Entry();
+ public Gtk.SignalListItemFactory el;
+ private Xcls_PopoverProperty _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_SignalListItemFactory9(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (listitem) => {
+
+
+ var label = new Gtk.Label("");
+ label.xalign = 0;
+
+ ((Gtk.ListItem)listitem).set_child(label);
+ ((Gtk.ListItem)listitem).activatable = false;
+
+ });
+ this.el.bind.connect( (listitem) => {
+
+ var lbl = (Gtk.Label) ((Gtk.ListItem)listitem).get_child();
+ var np = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();
+
+
+
+ lbl.label = np.ptype.to_name();
+
+ });
+ }
+
+ // user defined functions
+ }
- // my vars (dec)
- // set gobject values
- this.el.visible = true;
- }
- // user defined functions
- }
+ public class Xcls_Label10 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_PopoverProperty _this;
- public class Xcls_Label10 : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverProperty _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Label10(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Type or Return Type" );
- // ctor
- public Xcls_Label10(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Name" );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.justify = Gtk.Justification.LEFT;
+ this.el.margin_top = 12;
+ this.el.visible = true;
+ }
- // set gobject values
- this.el.halign = Gtk.Align.START;
- this.el.justify = Gtk.Justification.LEFT;
- this.el.tooltip_text = "center, north, south, east, west";
- this.el.margin_top = 12;
- this.el.visible = true;
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_ktype : Object
+ {
+ public Gtk.Entry el;
+ private Xcls_PopoverProperty _this;
- public class Xcls_kname : Object
- {
- public Gtk.Entry el;
- private Xcls_PopoverProperty _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_ktype(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ _this.ktype = this;
+ this.el = new Gtk.Entry();
- // ctor
- public Xcls_kname(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- _this.kname = this;
- this.el = new Gtk.Entry();
+ // my vars (dec)
- // my vars (dec)
-
- // set gobject values
- this.el.visible = true;
+ // set gobject values
+ this.el.visible = true;
+ }
- //listeners
- this.el.focus_out_event.connect( ()=>{
- _this.error.setError("");
- var val = this.el.get_text().strip();
- if (val.length < 1) {
- _this.error.setError("Name can not be empty");
- }
- return true;
- });
- this.el.key_release_event.connect( ()=>{
- _this.error.setError("");
- var val = this.el.get_text().strip();
- if (val.length < 1) {
- _this.error.setError("Name can not be empty");
- }
- return true;
- });
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_Label12 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_PopoverProperty _this;
- public class Xcls_error : Object
- {
- public Gtk.Label el;
- private Xcls_PopoverProperty _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Label12(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Name" );
- // ctor
- public Xcls_error(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- _this.error = this;
- this.el = new Gtk.Label( "<span color=\"red\">Error Message</span>" );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.justify = Gtk.Justification.LEFT;
+ this.el.tooltip_text = "center, north, south, east, west";
+ this.el.margin_top = 12;
+ this.el.visible = true;
+ }
- // set gobject values
- this.el.halign = Gtk.Align.START;
- this.el.justify = Gtk.Justification.LEFT;
- this.el.tooltip_text = "center, north, south, east, west";
- this.el.margin_top = 0;
- this.el.visible = true;
- this.el.use_markup = true;
+ // user defined functions
}
- // user defined functions
- public void setError (string err) {
- if (err == "") {
- this.el.hide();
- } else {
- this.el.show();
-
- this.el.label = "<span color=\"red\">" + err + "</span>";
- }
- }
- }
+ public class Xcls_kname : Object
+ {
+ public Gtk.Entry el;
+ private Xcls_PopoverProperty _this;
- public class Xcls_buttonbar : Object
- {
- public Gtk.Box el;
- private Xcls_PopoverProperty _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_kname(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ _this.kname = this;
+ this.el = new Gtk.Entry();
- // ctor
- public Xcls_buttonbar(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- _this.buttonbar = this;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.visible = true;
+ var child_1 = new Xcls_EventControllerFocus14( _this );
+ child_1.ref();
+ this.el.add_controller( child_1.el );
+ var child_2 = new Xcls_EventControllerKey15( _this );
+ child_2.ref();
+ this.el.add_controller( child_2.el );
+ }
- // set gobject values
- this.el.margin_top = 20;
- var child_0 = new Xcls_Button14( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_Button16( _this );
- child_1.ref();
- this.el.add ( child_1.el );
+ // user defined functions
}
+ public class Xcls_EventControllerFocus14 : Object
+ {
+ public Gtk.EventControllerFocus el;
+ private Xcls_PopoverProperty _this;
- // user defined functions
- }
- public class Xcls_Button14 : Object
- {
- public Gtk.Button el;
- private Xcls_PopoverProperty _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_EventControllerFocus14(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.EventControllerFocus();
- // ctor
- public Xcls_Button14(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
- // set gobject values
- this.el.hexpand = true;
- this.el.always_show_image = true;
- this.el.label = "Cancel";
- var child_0 = new Xcls_Image15( _this );
- child_0.ref();
- this.el.image = child_0.el;
+ //listeners
+ this.el.leave.connect( ( ) => {
+
+ _this.error.setError("");
+ var val = _this.kname.el.get_text().strip();
+ if (val.length < 1) {
+ _this.error.setError("Name can not be empty");
+ }
+
+ });
+ }
- //listeners
- this.el.button_press_event.connect( () => {
-
- _this.prop = null;
- _this.is_new = false;
- _this.kname.el.set_text("Cancel");
- _this.el.hide();
- return false;
- });
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_Image15 : Object
- {
- public Gtk.Image el;
- private Xcls_PopoverProperty _this;
+ public class Xcls_EventControllerKey15 : Object
+ {
+ public Gtk.EventControllerKey el;
+ private Xcls_PopoverProperty _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Image15(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
+ // ctor
+ public Xcls_EventControllerKey15(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.EventControllerKey();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.icon_name = "window-close";
+ // set gobject values
+
+ //listeners
+ this.el.key_released.connect( (keyval, keycode, state) => {
+
+ _this.error.setError("");
+ var val = _this.kname.el.get_text().strip();
+ if (val.length < 1) {
+ _this.error.setError("Name can not be empty");
+ }
+
+ });
+ }
+
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_error : Object
+ {
+ public Gtk.Label el;
+ private Xcls_PopoverProperty _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_error(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ _this.error = this;
+ this.el = new Gtk.Label( "<span color=\"red\">Error Message</span>" );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.justify = Gtk.Justification.LEFT;
+ this.el.tooltip_text = "center, north, south, east, west";
+ this.el.margin_top = 0;
+ this.el.visible = true;
+ this.el.use_markup = true;
+ }
+
+ // user defined functions
+ public void setError (string err) {
+ if (err == "") {
+ this.el.label = "";
+ } else {
+
+
+ this.el.label = "<span color=\"red\">" + err + "</span>";
+ }
+ }
+ }
- public class Xcls_Button16 : Object
- {
- public Gtk.Button el;
- private Xcls_PopoverProperty _this;
+ public class Xcls_buttonbar : Object
+ {
+ public Gtk.Box el;
+ private Xcls_PopoverProperty _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Button16(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
+ // ctor
+ public Xcls_buttonbar(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ _this.buttonbar = this;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.hexpand = true;
- this.el.always_show_image = true;
- this.el.label = "Add Property";
- var child_0 = new Xcls_Image17( _this );
- child_0.ref();
- this.el.image = child_0.el;
+ // set gobject values
+ this.el.margin_top = 20;
+ var child_1 = new Xcls_Button18( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Button19( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ }
- //listeners
- this.el.button_press_event.connect( () => {
- // check if text is not empty..
- if ( _this.kname.el.get_text().strip().length < 1) {
- // error should already be showing?
- return false;
- }
- _this.updateProp();
-
- // since we can't add listeners?!?!?
- // only check props.
- // check if property already exists in node.
- var prop = _this.prop;
- if (_this.node.props.has_key(prop.to_index_key())) {
- _this.error.setError("Property already exists");
- return false;
- }
-
-
-
- _this.is_new = false;
-
- // hide self
- _this.prop = null; // skip checks..
- _this.el.hide();
-
- // add it,
- // trigger editing of property.
- // allow hide to work?
- while (Gtk.events_pending()) {
- Gtk.main_iteration();
- }
-
- _this.mainwindow.windowstate.left_props.addProp(prop);
-
- return false;
- });
+ // user defined functions
}
+ public class Xcls_Button18 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_PopoverProperty _this;
- // user defined functions
- }
- public class Xcls_Image17 : Object
- {
- public Gtk.Image el;
- private Xcls_PopoverProperty _this;
+ // my vars (def)
+ public bool always_show_image;
- // my vars (def)
+ // ctor
+ public Xcls_Button18(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // ctor
- public Xcls_Image17(Xcls_PopoverProperty _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
+ // my vars (dec)
+ this.always_show_image = true;
- // my vars (dec)
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.label = "Cancel";
- // set gobject values
- this.el.icon_name = "list-add";
- }
+ //listeners
+ this.el.clicked.connect( () => {
+ _this.prop = null;
+ _this.is_new = false;
+ _this.kname.el.set_text("Cancel");
+ _this.el.hide();
+
+ });
+ }
- // user defined functions
- }
+ // user defined functions
+ }
+ public class Xcls_Button19 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_PopoverProperty _this;
+
+
+ // my vars (def)
+ public bool always_show_image;
+
+ // ctor
+ public Xcls_Button19(Xcls_PopoverProperty _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+
+ // my vars (dec)
+ this.always_show_image = true;
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.label = "Add Property";
+
+ //listeners
+ this.el.clicked.connect( () => {
+ // check if text is not empty..
+ if ( _this.kname.el.get_text().strip().length < 1) {
+
+ // error should already be showing?
+ return;
+ }
+
+ // since we can't add listeners?!?!?
+ // only check props.
+ // check if property already exists in node.
+
+
+ var prop = new JsRender.NodeProp(
+ _this.kname.el.get_text().strip(),
+ _this.ptype.getValue(),
+ _this.ktype.el.get_text().strip(),
+ _this.prop.val
+ );
+
+ if (_this.node.props.has_key(prop.to_index_key())) {
+ _this.error.setError("Property already exists");
+ return;
+ }
+
+
+
+ _this.node.add_prop(prop);
+ // hide self
+ _this.prop = null; // skip checks..
+ _this.is_new = false;
+ _this.el.hide();
+
+ _this.mainwindow.windowstate.left_props.view.editProp(prop);
+
+
+
+ });
+ }
+
+ // user defined functions
+ }
-}
+ }
+++ /dev/null
-{
- "build_module" : "builder",
- "items" : [
- {
- "# Project.Project project" : "",
- "$ homogeneous" : false,
- "$ xns" : "Gtk",
- "@ void buttonPressed" : "(string btn)",
- "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
- "border_width" : 5,
- "id" : "RooProjectSettings",
- "items" : [
- {
- "$ homogeneous" : true,
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "gboolean expand" : false,
- "gboolean vexpand" : false,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "label" : "Apply",
- "listeners" : {
- "button_press_event" : [
- "() => {",
- " _this.save();",
- " ",
- " _this.buttonPressed(\"apply\");",
- " return false;",
- "}"
- ]
- },
- "xtype" : "Button"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "label" : "Save",
- "listeners" : {
- "button_press_event" : [
- "() => {",
- " _this.save();",
- " ",
- " _this.buttonPressed(\"save\");",
- " return false;",
- "}"
- ]
- },
- "xtype" : "Button"
- }
- ],
- "xtype" : "Box"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_end,true,true,0",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : false,
- "id" : "label_global",
- "utf8 label" : "Global",
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : false,
- "id" : "label_database",
- "utf8 label" : "Database",
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append_page,_this.label_global.el",
- "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
- "gboolean homogeneous" : false,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "gint margin" : 3,
- "id" : "path",
- "label" : "filename",
- "xalign" : 0,
- "xtype" : "Label"
- },
- {
- "$ homogeneous" : false,
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "gboolean expand" : false,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "gint margin" : 3,
- "label" : "HTML template file",
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "id" : "base_template",
- "xtype" : "Entry"
- }
- ],
- "xtype" : "Box"
- },
- {
- "$ homogeneous" : false,
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "gboolean expand" : false,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "gint margin" : 3,
- "label" : "root URL",
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "id" : "rootURL",
- "xtype" : "Entry"
- }
- ],
- "xtype" : "Box"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "label" : "HTML To insert at end of <HEAD>",
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,true,true,0",
- "items" : [
- {
- "$ xns" : "GtkSource",
- "* init" : [
- " ",
- " var description = Pango.FontDescription.from_string(\"monospace\");",
- " description.set_size(9000);",
- " this.el.override_font(description);"
- ],
- "* pack" : "add",
- "id" : "view",
- "listeners" : {
- "key_release_event" : [
- " ( event) =>{",
- " if (event.keyval != 115) {",
- " return false;",
- " ",
- " }",
- " if ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {",
- " return false;",
- " }",
- " var buf = this.el.get_buffer();",
- " Gtk.TextIter s;",
- " Gtk.TextIter e;",
- " buf.get_start_iter(out s);",
- " buf.get_end_iter(out e);",
- " _this.project.runhtml = buf.get_text(s,e,true);",
- " ",
- " ",
- " _this.buttonPressed(\"save\");",
- " ",
- " return false;",
- " ",
- "}"
- ]
- },
- "xtype" : "View"
- }
- ],
- "xtype" : "ScrolledWindow"
- }
- ],
- "xtype" : "Box"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append_page,_this.label_database.el",
- "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
- "gboolean homogeneous" : false,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "label" : "Type (eg. MySQL or PostgreSQL)",
- "xalign" : 0,
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "id" : "database_DBTYPE",
- "listeners" : {
- "key_press_event" : [
- "(ev) => {",
- "",
- " if (ev.keyval == Gdk.Key.Tab) {",
- " _this.database_DBNAME.el.grab_focus();",
- " return true;",
- " }",
- "",
- "",
- " return false;",
- "}",
- ""
- ]
- },
- "xtype" : "Entry"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "label" : "Name",
- "xalign" : 0,
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "id" : "database_DBNAME",
- "listeners" : {
- "key_press_event" : [
- "(ev) => {",
- "",
- " if (ev.keyval == Gdk.Key.Tab) {",
- " _this.database_DBUSERNAME.el.grab_focus();",
- " return true;",
- " }",
- "",
- "",
- " return false;",
- "}",
- ""
- ]
- },
- "xtype" : "Entry"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "label" : "Username",
- "xalign" : 0,
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "id" : "database_DBUSERNAME",
- "listeners" : {
- "key_press_event" : [
- "(ev) => {",
- "",
- " if (ev.keyval == Gdk.Key.Tab) {",
- " _this.database_DBPASSWORD.el.grab_focus();",
- " return true;",
- " }",
- "",
- "",
- " return false;",
- "}",
- ""
- ]
- },
- "xtype" : "Entry"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "label" : "Password",
- "xalign" : 0,
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "id" : "database_DBPASSWORD",
- "xtype" : "Entry"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "listeners" : {
- "clicked" : [
- "() => {",
- "",
- "",
- " _this.database_ERROR.el.label = \"\";",
- " Gda.Connection cnc;",
- " try {",
- " // assumes localhost...",
- " cnc = Gda.Connection.open_from_string (",
- "\t\t\t_this.database_DBTYPE.el.get_text(),",
- "\t\t\t\"DB_NAME=\" + _this.database_DBNAME.el.get_text(), ",
- "\t\t\t\"USERNAME=\" + _this.database_DBUSERNAME.el.get_text() + ",
- "\t\t\t\";PASSWORD=\" + _this.database_DBPASSWORD.el.get_text(),",
- "\t\t\tGda.ConnectionOptions.NONE",
- "\t\t);",
- " //} catch (Gda.ConnectionError ce) { ",
- " // _this.database_ERROR.el.label = ce.message; ",
- " } catch(Gda.ConnectionError ue) {",
- " _this.database_ERROR.el.label = ue.message;",
- " return;",
- " } catch(Gda.ConfigError ue) {",
- " _this.database_ERROR.el.label = ue.message;",
- " return;",
- " }",
- " _this.database_ERROR.el.label = \"Connection Succeeded\";",
- " cnc.close();",
- "}"
- ]
- },
- "utf8 label" : "Check Connection",
- "xtype" : "Button"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "gint margin" : 3,
- "id" : "database_ERROR",
- "label" : " ",
- "xalign" : 0,
- "xtype" : "Label"
- }
- ],
- "xtype" : "Box"
- }
- ],
- "xtype" : "Notebook"
- }
- ],
- "xtype" : "Box",
- "| void save" : [
- "()",
- "{",
- " var buf = _this.view.el.get_buffer();",
- " Gtk.TextIter s;",
- " Gtk.TextIter e;",
- " buf.get_start_iter(out s);",
- " buf.get_end_iter(out e);",
- " _this.project.runhtml = buf.get_text(s,e,true);",
- " ",
- " _this.project.rootURL = _this.rootURL.el.get_text();",
- " _this.project.base_template = _this.base_template.el.get_text(); ",
- " ",
- " var js = _this.project.json_project_data;",
- " js.set_string_member(\"DBTYPE\", _this.database_DBTYPE.el.get_text());",
- " js.set_string_member(\"DBNAME\", _this.database_DBNAME.el.get_text());",
- " js.set_string_member(\"DBUSERNAME\", _this.database_DBUSERNAME.el.get_text());",
- " js.set_string_member(\"DBPASSWORD\", _this.database_DBPASSWORD.el.get_text());",
- "// _this.project.set_string_member(\"DBHOST\", _this.DBTYPE.el.get_text()); ",
- " ",
- " // need to re-init the database ",
- " ",
- " _this.project.initRooDatabase();",
- " ",
- "}"
- ],
- "| void show" : [
- " (Project.Project project) {",
- " _this.project = project;",
- " _this.path.el.label = project.firstPath();",
- " // get the active project.",
- " var lm = Gtk.SourceLanguageManager.get_default();",
- " ",
- " ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(",
- " ",
- " lm.get_language(\"html\"));",
- " ",
- " //print (project.fn);",
- " //project.runhtml = project.runhtml || '';",
- " _this.view.el.get_buffer().set_text(project.runhtml);",
- " ",
- " ",
- " _this.rootURL.el.set_text( _this.project.rootURL );",
- " _this.base_template.el.set_text(_this.project.base_template); ",
- " var js = _this.project;",
- " _this.database_DBTYPE.el.set_text( js.get_string_member(\"DBTYPE\") );",
- " _this.database_DBNAME.el.set_text( js.get_string_member(\"DBNAME\") );",
- " _this.database_DBUSERNAME.el.set_text( js.get_string_member(\"DBUSERNAME\") );",
- " _this.database_DBPASSWORD.el.set_text( js.get_string_member(\"DBPASSWORD\") );",
- " //this.el.show_all();",
- "}",
- ""
- ]
- }
- ],
- "modOrder" : "",
- "name" : "ProjectSettings",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/ProjectSettings.bjs",
- "permname" : "",
- "title" : ""
-}
\ No newline at end of file
+++ /dev/null
-static Xcls_RooProjectSettings _RooProjectSettings;
-
-public class Xcls_RooProjectSettings : Object
-{
- public Gtk.Box el;
- private Xcls_RooProjectSettings _this;
-
- public static Xcls_RooProjectSettings singleton()
- {
- if (_RooProjectSettings == null) {
- _RooProjectSettings= new Xcls_RooProjectSettings();
- }
- return _RooProjectSettings;
- }
- public Xcls_label_global label_global;
- public Xcls_label_database label_database;
- public Xcls_path path;
- public Xcls_base_template base_template;
- public Xcls_rootURL rootURL;
- public Xcls_view view;
- public Xcls_database_DBTYPE database_DBTYPE;
- public Xcls_database_DBNAME database_DBNAME;
- public Xcls_database_DBUSERNAME database_DBUSERNAME;
- public Xcls_database_DBPASSWORD database_DBPASSWORD;
- public Xcls_database_ERROR database_ERROR;
-
- // my vars (def)
- public signal void buttonPressed (string btn);
- public Project.Project project;
-
- // ctor
- public Xcls_RooProjectSettings()
- {
- _this = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- this.el.border_width = 5;
- var child_0 = new Xcls_Box2( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,false,0 );
- var child_1 = new Xcls_Notebook5( _this );
- child_1.ref();
- this.el.pack_end ( child_1.el , true,true,0 );
- }
-
- // user defined functions
- public void show (Project.Project project) {
- _this.project = project;
- _this.path.el.label = project.firstPath();
- // get the active project.
- var lm = Gtk.SourceLanguageManager.get_default();
-
- ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(
-
- lm.get_language("html"));
-
- //print (project.fn);
- //project.runhtml = project.runhtml || '';
- _this.view.el.get_buffer().set_text(project.runhtml);
-
-
- _this.rootURL.el.set_text( _this.project.rootURL );
- _this.base_template.el.set_text(_this.project.base_template);
- var js = _this.project;
- _this.database_DBTYPE.el.set_text( js.get_string_member("DBTYPE") );
- _this.database_DBNAME.el.set_text( js.get_string_member("DBNAME") );
- _this.database_DBUSERNAME.el.set_text( js.get_string_member("DBUSERNAME") );
- _this.database_DBPASSWORD.el.set_text( js.get_string_member("DBPASSWORD") );
- //this.el.show_all();
- }
- public void save ()
- {
- var buf = _this.view.el.get_buffer();
- Gtk.TextIter s;
- Gtk.TextIter e;
- buf.get_start_iter(out s);
- buf.get_end_iter(out e);
- _this.project.runhtml = buf.get_text(s,e,true);
-
- _this.project.rootURL = _this.rootURL.el.get_text();
- _this.project.base_template = _this.base_template.el.get_text();
-
- var js = _this.project.json_project_data;
- js.set_string_member("DBTYPE", _this.database_DBTYPE.el.get_text());
- js.set_string_member("DBNAME", _this.database_DBNAME.el.get_text());
- js.set_string_member("DBUSERNAME", _this.database_DBUSERNAME.el.get_text());
- js.set_string_member("DBPASSWORD", _this.database_DBPASSWORD.el.get_text());
- // _this.project.set_string_member("DBHOST", _this.DBTYPE.el.get_text());
-
- // need to re-init the database
-
- _this.project.initRooDatabase();
-
- }
- public class Xcls_Box2 : Object
- {
- public Gtk.Box el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box2(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = true;
- this.el.expand = false;
- this.el.vexpand = false;
- var child_0 = new Xcls_Button3( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_Button4( _this );
- child_1.ref();
- this.el.add ( child_1.el );
- }
-
- // user defined functions
- }
- public class Xcls_Button3 : Object
- {
- public Gtk.Button el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button3(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Apply";
-
- //listeners
- this.el.button_press_event.connect( () => {
- _this.save();
-
- _this.buttonPressed("apply");
- return false;
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Button4 : Object
- {
- public Gtk.Button el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button4(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Save";
-
- //listeners
- this.el.button_press_event.connect( () => {
- _this.save();
-
- _this.buttonPressed("save");
- return false;
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_Notebook5 : Object
- {
- public Gtk.Notebook el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Notebook5(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Notebook();
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_label_global( _this );
- child_0.ref();
- var child_1 = new Xcls_label_database( _this );
- child_1.ref();
- var child_2 = new Xcls_Box8( _this );
- child_2.ref();
- this.el.append_page ( child_2.el , _this.label_global.el );
- var child_3 = new Xcls_Box19( _this );
- child_3.ref();
- this.el.append_page ( child_3.el , _this.label_database.el );
- }
-
- // user defined functions
- }
- public class Xcls_label_global : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_label_global(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.label_global = this;
- this.el = new Gtk.Label( "Global" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_label_database : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_label_database(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.label_database = this;
- this.el = new Gtk.Label( "Database" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_Box8 : Object
- {
- public Gtk.Box el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box8(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- var child_0 = new Xcls_path( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,false,0 );
- var child_1 = new Xcls_Box10( _this );
- child_1.ref();
- this.el.pack_start ( child_1.el , false,false,0 );
- var child_2 = new Xcls_Box13( _this );
- child_2.ref();
- this.el.pack_start ( child_2.el , false,false,0 );
- var child_3 = new Xcls_Label16( _this );
- child_3.ref();
- this.el.pack_start ( child_3.el , false,false,0 );
- var child_4 = new Xcls_ScrolledWindow17( _this );
- child_4.ref();
- this.el.pack_start ( child_4.el , true,true,0 );
- }
-
- // user defined functions
- }
- public class Xcls_path : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_path(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.path = this;
- this.el = new Gtk.Label( "filename" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.margin = 3;
- this.el.xalign = 0f;
- }
-
- // user defined functions
- }
-
- public class Xcls_Box10 : Object
- {
- public Gtk.Box el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box10(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- this.el.expand = false;
- var child_0 = new Xcls_Label11( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,false,0 );
- var child_1 = new Xcls_base_template( _this );
- child_1.ref();
- this.el.add ( child_1.el );
- }
-
- // user defined functions
- }
- public class Xcls_Label11 : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label11(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "HTML template file" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.margin = 3;
- }
-
- // user defined functions
- }
-
- public class Xcls_base_template : Object
- {
- public Gtk.Entry el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_base_template(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.base_template = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
- public class Xcls_Box13 : Object
- {
- public Gtk.Box el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box13(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- this.el.expand = false;
- var child_0 = new Xcls_Label14( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,false,0 );
- var child_1 = new Xcls_rootURL( _this );
- child_1.ref();
- this.el.add ( child_1.el );
- }
-
- // user defined functions
- }
- public class Xcls_Label14 : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label14(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "root URL" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.margin = 3;
- }
-
- // user defined functions
- }
-
- public class Xcls_rootURL : Object
- {
- public Gtk.Entry el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_rootURL(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.rootURL = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
- public class Xcls_Label16 : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label16(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "HTML To insert at end of <HEAD>" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_ScrolledWindow17 : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ScrolledWindow17(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_view( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- }
-
- // user defined functions
- }
- public class Xcls_view : Object
- {
- public Gtk.SourceView el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_view(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.view = this;
- this.el = new Gtk.SourceView();
-
- // my vars (dec)
-
- // init method
-
- var description = Pango.FontDescription.from_string("monospace");
- description.set_size(9000);
- this.el.override_font(description);
-
- //listeners
- this.el.key_release_event.connect( ( event) =>{
- if (event.keyval != 115) {
- return false;
-
- }
- if ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {
- return false;
- }
- var buf = this.el.get_buffer();
- Gtk.TextIter s;
- Gtk.TextIter e;
- buf.get_start_iter(out s);
- buf.get_end_iter(out e);
- _this.project.runhtml = buf.get_text(s,e,true);
-
-
- _this.buttonPressed("save");
-
- return false;
-
- });
- }
-
- // user defined functions
- }
-
-
-
- public class Xcls_Box19 : Object
- {
- public Gtk.Box el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box19(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- var child_0 = new Xcls_Label20( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,false,0 );
- var child_1 = new Xcls_database_DBTYPE( _this );
- child_1.ref();
- this.el.pack_start ( child_1.el , false,false,0 );
- var child_2 = new Xcls_Label22( _this );
- child_2.ref();
- this.el.pack_start ( child_2.el , false,false,0 );
- var child_3 = new Xcls_database_DBNAME( _this );
- child_3.ref();
- this.el.pack_start ( child_3.el , false,false,0 );
- var child_4 = new Xcls_Label24( _this );
- child_4.ref();
- this.el.pack_start ( child_4.el , false,false,0 );
- var child_5 = new Xcls_database_DBUSERNAME( _this );
- child_5.ref();
- this.el.pack_start ( child_5.el , false,false,0 );
- var child_6 = new Xcls_Label26( _this );
- child_6.ref();
- this.el.pack_start ( child_6.el , false,false,0 );
- var child_7 = new Xcls_database_DBPASSWORD( _this );
- child_7.ref();
- this.el.pack_start ( child_7.el , false,false,0 );
- var child_8 = new Xcls_Button28( _this );
- child_8.ref();
- this.el.pack_start ( child_8.el , false,false,0 );
- var child_9 = new Xcls_database_ERROR( _this );
- child_9.ref();
- this.el.pack_start ( child_9.el , false,false,0 );
- }
-
- // user defined functions
- }
- public class Xcls_Label20 : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label20(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Type (eg. MySQL or PostgreSQL)" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.xalign = 0f;
- }
-
- // user defined functions
- }
-
- public class Xcls_database_DBTYPE : Object
- {
- public Gtk.Entry el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_database_DBTYPE(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.database_DBTYPE = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.key_press_event.connect( (ev) => {
-
- if (ev.keyval == Gdk.Key.Tab) {
- _this.database_DBNAME.el.grab_focus();
- return true;
- }
-
-
- return false;
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Label22 : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label22(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Name" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.xalign = 0f;
- }
-
- // user defined functions
- }
-
- public class Xcls_database_DBNAME : Object
- {
- public Gtk.Entry el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_database_DBNAME(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.database_DBNAME = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.key_press_event.connect( (ev) => {
-
- if (ev.keyval == Gdk.Key.Tab) {
- _this.database_DBUSERNAME.el.grab_focus();
- return true;
- }
-
-
- return false;
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Label24 : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label24(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Username" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.xalign = 0f;
- }
-
- // user defined functions
- }
-
- public class Xcls_database_DBUSERNAME : Object
- {
- public Gtk.Entry el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_database_DBUSERNAME(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.database_DBUSERNAME = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.key_press_event.connect( (ev) => {
-
- if (ev.keyval == Gdk.Key.Tab) {
- _this.database_DBPASSWORD.el.grab_focus();
- return true;
- }
-
-
- return false;
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Label26 : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label26(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Password" );
-
- // my vars (dec)
-
- // set gobject values
- this.el.xalign = 0f;
- }
-
- // user defined functions
- }
-
- public class Xcls_database_DBPASSWORD : Object
- {
- public Gtk.Entry el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_database_DBPASSWORD(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.database_DBPASSWORD = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_Button28 : Object
- {
- public Gtk.Button el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button28(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Check Connection";
-
- //listeners
- this.el.clicked.connect( () => {
-
-
- _this.database_ERROR.el.label = "";
- Gda.Connection cnc;
- try {
- // assumes localhost...
- cnc = Gda.Connection.open_from_string (
- _this.database_DBTYPE.el.get_text(),
- "DB_NAME=" + _this.database_DBNAME.el.get_text(),
- "USERNAME=" + _this.database_DBUSERNAME.el.get_text() +
- ";PASSWORD=" + _this.database_DBPASSWORD.el.get_text(),
- Gda.ConnectionOptions.NONE
- );
- //} catch (Gda.ConnectionError ce) {
- // _this.database_ERROR.el.label = ce.message;
- } catch(Gda.ConnectionError ue) {
- _this.database_ERROR.el.label = ue.message;
- return;
- } catch(Gda.ConfigError ue) {
- _this.database_ERROR.el.label = ue.message;
- return;
- }
- _this.database_ERROR.el.label = "Connection Succeeded";
- cnc.close();
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_database_ERROR : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_database_ERROR(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.database_ERROR = this;
- this.el = new Gtk.Label( " " );
-
- // my vars (dec)
-
- // set gobject values
- this.el.margin = 3;
- this.el.xalign = 0f;
- }
-
- // user defined functions
- }
-
-
-
-}
{
"build_module" : "builder",
+ "gen_extended" : false,
"items" : [
{
"$ xns" : "Gtk",
"@ void buttonPressed" : "(string btn)",
"Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
- "Project.Project project" : "",
+ "Project.Roo project" : "",
+ "bool autohide" : false,
"bool done" : false,
"bool modal" : true,
"id" : "RooProjectSettings",
{
"$ homogeneous" : false,
"$ xns" : "Gtk",
- "* pack" : "add",
+ "* pack" : "set_child",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
"border_width" : 5,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true,true,0",
"items" : [
{
"$ xns" : "Gtk",
{
"$ homogeneous" : true,
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,4",
"id" : "grid",
"int margin_end" : 4,
"int margin_start" : 4,
{
"$ xns" : "Gtk",
"* pack" : "attach,0,0,1,1",
- "gint margin" : 3,
+ "int margin_bottom" : 3,
+ "int margin_end" : 3,
+ "int margin_start" : 3,
+ "int margin_top" : 3,
"label" : "Filename",
"xalign" : 0,
"xtype" : "Label"
{
"$ xns" : "Gtk",
"* pack" : "attach,1,0,1,1",
- "gint margin" : 3,
"id" : "path",
+ "int margin_bottom" : 3,
+ "int margin_end" : 3,
+ "int margin_start" : 3,
+ "int margin_top" : 3,
"label" : "filename",
"xalign" : 0,
"xtype" : "Label"
{
"$ xns" : "Gtk",
"* pack" : "attach,0,1,1,1",
- "gint margin" : 3,
+ "int margin_bottom" : 3,
+ "int margin_end" : 3,
+ "int margin_start" : 3,
+ "int margin_top" : 3,
"label" : "HTML template file",
"xtype" : "Label"
},
{
"$ xns" : "Gtk",
"* pack" : "attach,0,2,1,1",
- "gint margin" : 3,
+ "int margin_bottom" : 3,
+ "int margin_end" : 3,
+ "int margin_start" : 3,
+ "int margin_top" : 3,
"label" : "root URL",
"xtype" : "Label"
},
{
"$ xns" : "Gtk",
"* pack" : "attach,0,3,1,1",
- "gint margin" : 3,
"label" : "Generate HTML in",
"xtype" : "Label"
},
},
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
"label" : "HTML To insert at end of <HEAD>",
"xtype" : "Label"
},
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true,true,0",
+ "bool vexpand" : true,
"items" : [
{
- "$ xns" : "Gtk",
+ "$ xns" : "GtkSource",
"* init" : [
" ",
" ",
"this.css = new Gtk.CssProvider();",
- "try {",
- "\tthis.css.load_from_data(\"#roo-project-settings-view{ font: monospace 10px;}\");",
- "} catch (Error e) {}",
- "this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);",
+ " ",
+ "\tthis.css.load_from_string(",
+ "\t\"#roo-project-settings-view{ font: 10px monospace;}\"",
+ ");",
+ " ",
+ "//this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);",
" ",
- " "
+ " Gtk.StyleContext.add_provider_for_display(",
+ "\t Gdk.Display.get_default(), ",
+ "\t this.css,",
+ "\t Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
+ " );"
],
- "* pack" : "add",
+ "* pack" : "set_child",
"Gtk.CssProvider css" : "",
"id" : "view",
- "listeners" : {
- "key_release_event" : [
- " ( event) =>{",
- " if (event.keyval != 115) {",
- " return false;",
- " ",
- " }",
- " if ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {",
- " return false;",
- " }",
- " var buf = this.el.get_buffer();",
- " Gtk.TextIter s;",
- " Gtk.TextIter e;",
- " buf.get_start_iter(out s);",
- " buf.get_end_iter(out e);",
- " _this.project.runhtml = buf.get_text(s,e,true);",
- " ",
- " ",
- " _this.buttonPressed(\"save\");",
- " ",
- " return false;",
- " ",
- "}"
- ]
- },
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "key_released" : [
+ "(keyval, keycode, state) => {",
+ "",
+ "",
+ " if (keyval != 115) {",
+ " return;",
+ " ",
+ " }",
+ " if ( (state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {",
+ " return;",
+ " }",
+ " var buf = _this.view.el.get_buffer();",
+ " Gtk.TextIter s;",
+ " Gtk.TextIter e;",
+ " buf.get_start_iter(out s);",
+ " buf.get_end_iter(out e);",
+ " _this.project.runhtml = buf.get_text(s,e,true);",
+ " ",
+ " ",
+ " _this.buttonPressed(\"save\");",
+ " ",
+ " ",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "EventControllerKey"
+ }
+ ],
"string name" : "roo-project-settings-view",
- "xtype" : "SourceView"
+ "xtype" : "View"
}
],
"xtype" : "ScrolledWindow"
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
"label" : "Type (eg. MySQL or PostgreSQL)",
"xalign" : 0,
"xtype" : "Label"
},
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
"id" : "database_DBTYPE",
- "listeners" : {
- "key_press_event" : [
- "(ev) => {",
- "",
- " if (ev.keyval == Gdk.Key.Tab) {",
- " _this.database_DBNAME.el.grab_focus();",
- " return true;",
- " }",
- "",
- "",
- " return false;",
- "}",
- ""
- ]
- },
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "key_pressed" : [
+ "(keyval, keycode, state) => {",
+ " if (keyval == Gdk.Key.Tab) {",
+ " _this.database_DBNAME.el.grab_focus();",
+ " return true;",
+ " }",
+ "",
+ "",
+ "\treturn false;",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "EventControllerKey"
+ }
+ ],
"xtype" : "Entry"
},
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
"label" : "Name",
"xalign" : 0,
"xtype" : "Label"
},
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
"id" : "database_DBNAME",
- "listeners" : {
- "key_press_event" : [
- "(ev) => {",
- "",
- " if (ev.keyval == Gdk.Key.Tab) {",
- " _this.database_DBUSERNAME.el.grab_focus();",
- " return true;",
- " }",
- "",
- "",
- " return false;",
- "}",
- ""
- ]
- },
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "key_pressed" : [
+ "(keyval, keycode, state) => {",
+ " if (keyval == Gdk.Key.Tab) {",
+ " _this.database_DBUSERNAME.el.grab_focus();",
+ " return true;",
+ " }",
+ "",
+ "",
+ "\treturn false;",
+ "\t ",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "EventControllerKey"
+ }
+ ],
"xtype" : "Entry"
},
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
"label" : "Username",
"xalign" : 0,
"xtype" : "Label"
},
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
"id" : "database_DBUSERNAME",
- "listeners" : {
- "key_press_event" : [
- "(ev) => {",
- "",
- " if (ev.keyval == Gdk.Key.Tab) {",
- " _this.database_DBPASSWORD.el.grab_focus();",
- " return true;",
- " }",
- "",
- "",
- " return false;",
- "}",
- ""
- ]
- },
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "key_pressed" : [
+ "(keyval, keycode, state) => {",
+ " if (keyval == Gdk.Key.Tab) {",
+ " _this.database_DBPASSWORD.el.grab_focus();",
+ " return true;",
+ " }",
+ "",
+ "",
+ "\treturn false;",
+ "\t ",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "EventControllerKey"
+ }
+ ],
"xtype" : "Entry"
},
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
"label" : "Password",
"xalign" : 0,
"xtype" : "Label"
},
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
"id" : "database_DBPASSWORD",
"xtype" : "Entry"
},
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
"listeners" : {
"clicked" : [
"() => {",
},
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "gint margin" : 3,
"id" : "database_ERROR",
"label" : " ",
"xalign" : 0,
}
],
"xtype" : "Notebook"
+ }
+ ],
+ "xtype" : "Box"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "titlebar",
+ "bool show_title_buttons" : false,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start",
+ "listeners" : {
+ "clicked" : [
+ "() => { ",
+ "",
+ " _this.done = true;",
+ " _this.el.hide(); ",
+ "}"
+ ]
+ },
+ "string label" : "Cancel",
+ "xtype" : "Button"
},
{
- "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
"$ xns" : "Gtk",
- "int margin_bottom" : 4,
- "int margin_end" : 4,
- "int margin_start" : 4,
- "int margin_top" : 4,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "listeners" : {
- "clicked" : [
- "() => { ",
- "",
- " _this.done = true;",
- " _this.el.hide(); ",
- "}"
- ]
- },
- "string label" : "Cancel",
- "xtype" : "Button"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "listeners" : {
- "clicked" : [
- "( ) => { ",
- "",
- " _this.buttonPressed(\"apply\");",
- " ",
- " ",
- "}"
- ]
- },
- "string label" : "Apply / Keep editing",
- "xtype" : "Button"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "listeners" : {
- "clicked" : [
- "( ) => { ",
- "",
- " ",
- " _this.buttonPressed(\"save\");",
- " ",
- "\t// what about .js ?",
- " _this.done = true;",
- "\t_this.el.hide();",
- "",
- "// hopefull this will work with bjs files..",
- "\t",
- " ",
- " ",
- "}"
- ]
- },
- "string label" : "Save",
- "xtype" : "Button"
- }
- ],
- "xtype" : "ButtonBox"
+ "* pack" : "pack_end",
+ "css_classes" : "{ \"suggested-action\" }",
+ "listeners" : {
+ "clicked" : [
+ "( ) => { ",
+ "",
+ " ",
+ " _this.buttonPressed(\"save\");",
+ " ",
+ "\t// what about .js ?",
+ " _this.done = true;",
+ "\t_this.el.hide();",
+ "",
+ "// hopefull this will work with bjs files..",
+ "\t",
+ " ",
+ " ",
+ "}"
+ ]
+ },
+ "string label" : "Save",
+ "xtype" : "Button"
}
],
- "xtype" : "Box"
+ "xtype" : "HeaderBar"
}
],
+ "string title" : "Edit Project settings",
"uint border_width" : 0,
- "xtype" : "Popover",
+ "xtype" : "Window",
"| void save" : [
"() {",
" var buf = _this.view.el.get_buffer();",
" // set by event changed...",
" //_this.project.base_template = _this.base_template.el.get_text(); ",
" ",
- " var js = _this.project.json_project_data;",
- " js.set_string_member(\"DBTYPE\", _this.database_DBTYPE.el.get_text());",
- " js.set_string_member(\"DBNAME\", _this.database_DBNAME.el.get_text());",
- " js.set_string_member(\"DBUSERNAME\", _this.database_DBUSERNAME.el.get_text());",
- " js.set_string_member(\"DBPASSWORD\", _this.database_DBPASSWORD.el.get_text());",
+ " var js = _this.project;",
+ " js.DBTYPE = _this.database_DBTYPE.el.get_text();",
+ " js.DBNAME= _this.database_DBNAME.el.get_text();",
+ " js.DBUSERNAME= _this.database_DBUSERNAME.el.get_text();",
+ " js.DBPASSWORD= _this.database_DBPASSWORD.el.get_text();",
"// _this.project.set_string_member(\"DBHOST\", _this.DBTYPE.el.get_text()); ",
" ",
" // need to re-init the database ",
- " ",
- " _this.project.initRooDatabase();",
+ " \tjs.save();",
+ " _this.project.initDatabase();",
" ",
" ",
"}"
],
"| void show" : [
- " (Gtk.Widget btn, Project.Project project) {",
+ " (Gtk.Window pwin, Project.Roo project) {",
" _this.done = false;",
" ",
" _this.project = project;",
- " _this.path.el.label = project.firstPath();",
+ " _this.path.el.label = project.path;",
" // get the active project.",
- " var lm = Gtk.SourceLanguageManager.get_default();",
+ " var lm = GtkSource.LanguageManager.get_default();",
" ",
- " ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(",
+ " ((GtkSource.Buffer)(_this.view.el.get_buffer())) .set_language(",
" lm.get_language(\"html\")",
" );",
" ",
" //print (project.fn);",
" //project.runhtml = project.runhtml || '';",
" _this.view.el.get_buffer().set_text(project.runhtml);",
- " ",
- " ",
+ " ",
" ",
" _this.rootURL.el.set_text( _this.project.rootURL );",
" ",
"",
" _this.base_template_model.loadData();",
" ",
- " var js = _this.project;",
- " _this.database_DBTYPE.el.set_text( js.get_string_member(\"DBTYPE\") );",
- " _this.database_DBNAME.el.set_text( js.get_string_member(\"DBNAME\") );",
- " _this.database_DBUSERNAME.el.set_text( js.get_string_member(\"DBUSERNAME\") );",
- " _this.database_DBPASSWORD.el.set_text( js.get_string_member(\"DBPASSWORD\") );",
+ " //var js = _this.project;",
+ " _this.database_DBTYPE.el.set_text( _this.project.DBTYPE );",
+ " _this.database_DBNAME.el.set_text( _this.project.DBNAME );",
+ " _this.database_DBUSERNAME.el.set_text( _this.project.DBUSERNAME );",
+ " _this.database_DBPASSWORD.el.set_text( _this.project.DBPASSWORD );",
" ",
" \t//console.log('show all');",
- "\tthis.el.set_modal(true);",
- "\tthis.el.set_relative_to(btn);",
- "",
- "\tthis.el.set_position(Gtk.PositionType.RIGHT);",
"",
+ "\t",
+ " this.el.set_transient_for(pwin);",
"\t// window + header?",
"\t print(\"SHOWALL - POPIP\\n\");",
- "\tthis.el.show_all();",
+ "\tthis.el.show();",
"\tthis.el.set_size_request(800,600);",
"\tthis.view.el.grab_focus();",
"\t",
]
}
],
- "modOrder" : "",
- "name" : "RooProjectSettings",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/RooProjectSettings.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "RooProjectSettings"
}
\ No newline at end of file
-static Xcls_RooProjectSettings _RooProjectSettings;
+ static Xcls_RooProjectSettings _RooProjectSettings;
-public class Xcls_RooProjectSettings : Object
-{
- public Gtk.Popover el;
- private Xcls_RooProjectSettings _this;
-
- public static Xcls_RooProjectSettings singleton()
- {
- if (_RooProjectSettings == null) {
- _RooProjectSettings= new Xcls_RooProjectSettings();
- }
- return _RooProjectSettings;
- }
- public Xcls_label_global label_global;
- public Xcls_label_database label_database;
- public Xcls_grid grid;
- public Xcls_path path;
- public Xcls_base_template base_template;
- public Xcls_base_template_cellrenderer base_template_cellrenderer;
- public Xcls_base_template_model base_template_model;
- public Xcls_rootURL rootURL;
- public Xcls_html_gen html_gen;
- public Xcls_html_gen_cellrenderer html_gen_cellrenderer;
- public Xcls_html_gen_model html_gen_model;
- public Xcls_view view;
- public Xcls_database_DBTYPE database_DBTYPE;
- public Xcls_database_DBNAME database_DBNAME;
- public Xcls_database_DBUSERNAME database_DBUSERNAME;
- public Xcls_database_DBPASSWORD database_DBPASSWORD;
- public Xcls_database_ERROR database_ERROR;
-
- // my vars (def)
- public signal void buttonPressed (string btn);
- public Project.Project project;
- public bool done;
-
- // ctor
- public Xcls_RooProjectSettings()
- {
- _this = this;
- this.el = new Gtk.Popover( null );
-
- // my vars (dec)
- this.done = false;
-
- // set gobject values
- this.el.border_width = 0;
- this.el.modal = true;
- this.el.position = Gtk.PositionType.RIGHT;
- var child_0 = new Xcls_Box2( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- }
-
- // user defined functions
- public void show (Gtk.Widget btn, Project.Project project) {
- _this.done = false;
-
- _this.project = project;
- _this.path.el.label = project.firstPath();
- // get the active project.
- var lm = Gtk.SourceLanguageManager.get_default();
-
- ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(
- lm.get_language("html")
- );
-
- //print (project.fn);
- //project.runhtml = project.runhtml || '';
- _this.view.el.get_buffer().set_text(project.runhtml);
-
-
-
- _this.rootURL.el.set_text( _this.project.rootURL );
-
- _this.html_gen_model.loadData(_this.project.html_gen);
-
- _this.base_template_model.loadData();
-
- var js = _this.project;
- _this.database_DBTYPE.el.set_text( js.get_string_member("DBTYPE") );
- _this.database_DBNAME.el.set_text( js.get_string_member("DBNAME") );
- _this.database_DBUSERNAME.el.set_text( js.get_string_member("DBUSERNAME") );
- _this.database_DBPASSWORD.el.set_text( js.get_string_member("DBPASSWORD") );
-
- //console.log('show all');
- this.el.set_modal(true);
- this.el.set_relative_to(btn);
-
- this.el.set_position(Gtk.PositionType.RIGHT);
-
- // window + header?
- print("SHOWALL - POPIP\n");
- this.el.show_all();
- this.el.set_size_request(800,600);
- this.view.el.grab_focus();
-
-
- //this.el.show_all();
- }
- public void save () {
- var buf = _this.view.el.get_buffer();
- Gtk.TextIter s;
- Gtk.TextIter e;
- buf.get_start_iter(out s);
- buf.get_end_iter(out e);
- _this.project.runhtml = buf.get_text(s,e,true);
-
- _this.project.rootURL = _this.rootURL.el.get_text();
-
-
- Gtk.TreeIter iter;
- Value html_gen_val;
- _this.html_gen.el.get_active_iter(out iter);
- _this.html_gen_model.el.get_value (iter, 0, out html_gen_val);
-
- _this.project.html_gen = (string)html_gen_val;
-
- // set by event changed...
- //_this.project.base_template = _this.base_template.el.get_text();
-
- var js = _this.project.json_project_data;
- js.set_string_member("DBTYPE", _this.database_DBTYPE.el.get_text());
- js.set_string_member("DBNAME", _this.database_DBNAME.el.get_text());
- js.set_string_member("DBUSERNAME", _this.database_DBUSERNAME.el.get_text());
- js.set_string_member("DBPASSWORD", _this.database_DBPASSWORD.el.get_text());
- // _this.project.set_string_member("DBHOST", _this.DBTYPE.el.get_text());
-
- // need to re-init the database
-
- _this.project.initRooDatabase();
-
-
- }
- public class Xcls_Box2 : Object
+ public class Xcls_RooProjectSettings : Object
{
- public Gtk.Box el;
+ public Gtk.Window el;
private Xcls_RooProjectSettings _this;
+ public static Xcls_RooProjectSettings singleton()
+ {
+ if (_RooProjectSettings == null) {
+ _RooProjectSettings= new Xcls_RooProjectSettings();
+ }
+ return _RooProjectSettings;
+ }
+ public Xcls_label_global label_global;
+ public Xcls_label_database label_database;
+ public Xcls_grid grid;
+ public Xcls_path path;
+ public Xcls_base_template base_template;
+ public Xcls_base_template_cellrenderer base_template_cellrenderer;
+ public Xcls_base_template_model base_template_model;
+ public Xcls_rootURL rootURL;
+ public Xcls_html_gen html_gen;
+ public Xcls_html_gen_cellrenderer html_gen_cellrenderer;
+ public Xcls_html_gen_model html_gen_model;
+ public Xcls_view view;
+ public Xcls_database_DBTYPE database_DBTYPE;
+ public Xcls_database_DBNAME database_DBNAME;
+ public Xcls_database_DBUSERNAME database_DBUSERNAME;
+ public Xcls_database_DBPASSWORD database_DBPASSWORD;
+ public Xcls_database_ERROR database_ERROR;
// my vars (def)
+ public signal void buttonPressed (string btn);
+ public Gtk.PositionType position;
+ public uint border_width;
+ public bool done;
+ public Project.Roo project;
+ public bool autohide;
// ctor
- public Xcls_Box2(Xcls_RooProjectSettings _owner )
+ public Xcls_RooProjectSettings()
{
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ _this = this;
+ this.el = new Gtk.Window();
// my vars (dec)
+ this.position = Gtk.PositionType.RIGHT;
+ this.border_width = 0;
+ this.done = false;
+ this.autohide = false;
// set gobject values
- this.el.homogeneous = false;
- this.el.border_width = 5;
- var child_0 = new Xcls_Notebook3( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true,true,0 );
- var child_1 = new Xcls_ButtonBox34( _this );
+ this.el.title = "Edit Project settings";
+ this.el.modal = true;
+ var child_1 = new Xcls_Box2( _this );
child_1.ref();
- this.el.add( child_1.el );
+ this.el.set_child ( child_1.el );
+ var child_2 = new Xcls_HeaderBar38( _this );
+ this.el.titlebar = child_2.el;
}
// user defined functions
- }
- public class Xcls_Notebook3 : Object
- {
- public Gtk.Notebook el;
- private Xcls_RooProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Notebook3(Xcls_RooProjectSettings _owner )
+ public void show (Gtk.Window pwin, Project.Roo project) {
+ _this.done = false;
+
+ _this.project = project;
+ _this.path.el.label = project.path;
+ // get the active project.
+ var lm = GtkSource.LanguageManager.get_default();
+
+ ((GtkSource.Buffer)(_this.view.el.get_buffer())) .set_language(
+ lm.get_language("html")
+ );
+
+ //print (project.fn);
+ //project.runhtml = project.runhtml || '';
+ _this.view.el.get_buffer().set_text(project.runhtml);
+
+
+ _this.rootURL.el.set_text( _this.project.rootURL );
+
+ _this.html_gen_model.loadData(_this.project.html_gen);
+
+ _this.base_template_model.loadData();
+
+ //var js = _this.project;
+ _this.database_DBTYPE.el.set_text( _this.project.DBTYPE );
+ _this.database_DBNAME.el.set_text( _this.project.DBNAME );
+ _this.database_DBUSERNAME.el.set_text( _this.project.DBUSERNAME );
+ _this.database_DBPASSWORD.el.set_text( _this.project.DBPASSWORD );
+
+ //console.log('show all');
+
+
+ this.el.set_transient_for(pwin);
+ // window + header?
+ print("SHOWALL - POPIP\n");
+ this.el.show();
+ this.el.set_size_request(800,600);
+ this.view.el.grab_focus();
+
+
+ //this.el.show_all();
+ }
+ public void save () {
+ var buf = _this.view.el.get_buffer();
+ Gtk.TextIter s;
+ Gtk.TextIter e;
+ buf.get_start_iter(out s);
+ buf.get_end_iter(out e);
+ _this.project.runhtml = buf.get_text(s,e,true);
+
+ _this.project.rootURL = _this.rootURL.el.get_text();
+
+
+ Gtk.TreeIter iter;
+ Value html_gen_val;
+ _this.html_gen.el.get_active_iter(out iter);
+ _this.html_gen_model.el.get_value (iter, 0, out html_gen_val);
+
+ _this.project.html_gen = (string)html_gen_val;
+
+ // set by event changed...
+ //_this.project.base_template = _this.base_template.el.get_text();
+
+ var js = _this.project;
+ js.DBTYPE = _this.database_DBTYPE.el.get_text();
+ js.DBNAME= _this.database_DBNAME.el.get_text();
+ js.DBUSERNAME= _this.database_DBUSERNAME.el.get_text();
+ js.DBPASSWORD= _this.database_DBPASSWORD.el.get_text();
+ // _this.project.set_string_member("DBHOST", _this.DBTYPE.el.get_text());
+
+ // need to re-init the database
+ js.save();
+ _this.project.initDatabase();
+
+
+ }
+ public class Xcls_Box2 : Object
{
- _this = _owner;
- this.el = new Gtk.Notebook();
+ public Gtk.Box el;
+ private Xcls_RooProjectSettings _this;
- // my vars (dec)
- // set gobject values
- var child_0 = new Xcls_label_global( _this );
- child_0.ref();
- var child_1 = new Xcls_label_database( _this );
- child_1.ref();
- var child_2 = new Xcls_Box6( _this );
- child_2.ref();
- this.el.append_page ( child_2.el , _this.label_global.el );
- var child_3 = new Xcls_Box23( _this );
- child_3.ref();
- this.el.append_page ( child_3.el , _this.label_database.el );
- }
+ // my vars (def)
- // user defined functions
- }
- public class Xcls_label_global : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
+ // ctor
+ public Xcls_Box2(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ this.el.homogeneous = false;
+ var child_1 = new Xcls_Notebook3( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ }
- // ctor
- public Xcls_label_global(Xcls_RooProjectSettings _owner )
+ // user defined functions
+ }
+ public class Xcls_Notebook3 : Object
{
- _this = _owner;
- _this.label_global = this;
- this.el = new Gtk.Label( "Global" );
-
- // my vars (dec)
+ public Gtk.Notebook el;
+ private Xcls_RooProjectSettings _this;
- // set gobject values
- }
- // user defined functions
- }
+ // my vars (def)
- public class Xcls_label_database : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
+ // ctor
+ public Xcls_Notebook3(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Notebook();
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ new Xcls_label_global( _this );
+ new Xcls_label_database( _this );
+ var child_3 = new Xcls_Box6( _this );
+ child_3.ref();
+ this.el.append_page ( child_3.el , _this.label_global.el );
+ var child_4 = new Xcls_Box24( _this );
+ child_4.ref();
+ this.el.append_page ( child_4.el , _this.label_database.el );
+ }
- // ctor
- public Xcls_label_database(Xcls_RooProjectSettings _owner )
+ // user defined functions
+ }
+ public class Xcls_label_global : Object
{
- _this = _owner;
- _this.label_database = this;
- this.el = new Gtk.Label( "Database" );
+ public Gtk.Label el;
+ private Xcls_RooProjectSettings _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_label_global(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ _this.label_global = this;
+ this.el = new Gtk.Label( "Global" );
- public class Xcls_Box6 : Object
- {
- public Gtk.Box el;
- private Xcls_RooProjectSettings _this;
+ // my vars (dec)
+ // set gobject values
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_Box6(Xcls_RooProjectSettings _owner )
+ public class Xcls_label_database : Object
{
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ public Gtk.Label el;
+ private Xcls_RooProjectSettings _this;
- // my vars (dec)
- // set gobject values
- this.el.homogeneous = false;
- var child_0 = new Xcls_grid( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,false,4 );
- var child_1 = new Xcls_Label20( _this );
- child_1.ref();
- this.el.pack_start ( child_1.el , false,false,0 );
- var child_2 = new Xcls_ScrolledWindow21( _this );
- child_2.ref();
- this.el.pack_start ( child_2.el , true,true,0 );
- }
+ // my vars (def)
- // user defined functions
- }
- public class Xcls_grid : Object
- {
- public Gtk.Grid el;
- private Xcls_RooProjectSettings _this;
+ // ctor
+ public Xcls_label_database(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ _this.label_database = this;
+ this.el = new Gtk.Label( "Database" );
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ }
- // ctor
- public Xcls_grid(Xcls_RooProjectSettings _owner )
+ // user defined functions
+ }
+
+ public class Xcls_Box6 : Object
{
- _this = _owner;
- _this.grid = this;
- this.el = new Gtk.Grid();
+ public Gtk.Box el;
+ private Xcls_RooProjectSettings _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box6(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.homogeneous = false;
+ new Xcls_grid( _this );
+ this.el.append( _this.grid.el );
+ var child_2 = new Xcls_Label20( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ var child_3 = new Xcls_ScrolledWindow21( _this );
+ child_3.ref();
+ this.el.append( child_3.el );
+ }
- // my vars (dec)
+ // user defined functions
+ }
+ public class Xcls_grid : Object
+ {
+ public Gtk.Grid el;
+ private Xcls_RooProjectSettings _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_grid(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ _this.grid = this;
+ this.el = new Gtk.Grid();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.margin_end = 4;
+ this.el.margin_start = 4;
+ this.el.row_spacing = 2;
+ var child_1 = new Xcls_Label8( _this );
+ child_1.ref();
+ this.el.attach ( child_1.el , 0,0,1,1 );
+ new Xcls_path( _this );
+ this.el.attach ( _this.path.el , 1,0,1,1 );
+ var child_3 = new Xcls_Label10( _this );
+ child_3.ref();
+ this.el.attach ( child_3.el , 0,1,1,1 );
+ new Xcls_base_template( _this );
+ this.el.attach ( _this.base_template.el , 1,1,1,1 );
+ var child_5 = new Xcls_Label14( _this );
+ child_5.ref();
+ this.el.attach ( child_5.el , 0,2,1,1 );
+ new Xcls_rootURL( _this );
+ this.el.attach ( _this.rootURL.el , 1,2,1,1 );
+ var child_7 = new Xcls_Label16( _this );
+ child_7.ref();
+ this.el.attach ( child_7.el , 0,3,1,1 );
+ new Xcls_html_gen( _this );
+ this.el.attach ( _this.html_gen.el , 1,3,1,1 );
+ }
- // set gobject values
- this.el.margin_end = 4;
- this.el.margin_start = 4;
- this.el.row_spacing = 2;
- var child_0 = new Xcls_Label8( _this );
- child_0.ref();
- this.el.attach ( child_0.el , 0,0,1,1 );
- var child_1 = new Xcls_path( _this );
- child_1.ref();
- this.el.attach ( child_1.el , 1,0,1,1 );
- var child_2 = new Xcls_Label10( _this );
- child_2.ref();
- this.el.attach ( child_2.el , 0,1,1,1 );
- var child_3 = new Xcls_base_template( _this );
- child_3.ref();
- this.el.attach ( child_3.el , 1,1,1,1 );
- var child_4 = new Xcls_Label14( _this );
- child_4.ref();
- this.el.attach ( child_4.el , 0,2,1,1 );
- var child_5 = new Xcls_rootURL( _this );
- child_5.ref();
- this.el.attach ( child_5.el , 1,2,1,1 );
- var child_6 = new Xcls_Label16( _this );
- child_6.ref();
- this.el.attach ( child_6.el , 0,3,1,1 );
- var child_7 = new Xcls_html_gen( _this );
- child_7.ref();
- this.el.attach ( child_7.el , 1,3,1,1 );
+ // user defined functions
}
+ public class Xcls_Label8 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_RooProjectSettings _this;
- // user defined functions
- }
- public class Xcls_Label8 : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Label8(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Filename" );
- // ctor
- public Xcls_Label8(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Filename" );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.margin_end = 3;
+ this.el.margin_start = 3;
+ this.el.xalign = 0f;
+ this.el.margin_bottom = 3;
+ this.el.margin_top = 3;
+ }
- // set gobject values
- this.el.margin = 3;
- this.el.xalign = 0f;
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_path : Object
+ {
+ public Gtk.Label el;
+ private Xcls_RooProjectSettings _this;
- public class Xcls_path : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_path(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ _this.path = this;
+ this.el = new Gtk.Label( "filename" );
- // ctor
- public Xcls_path(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.path = this;
- this.el = new Gtk.Label( "filename" );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.margin_end = 3;
+ this.el.margin_start = 3;
+ this.el.xalign = 0f;
+ this.el.margin_bottom = 3;
+ this.el.margin_top = 3;
+ }
- // set gobject values
- this.el.margin = 3;
- this.el.xalign = 0f;
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_Label10 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_RooProjectSettings _this;
- public class Xcls_Label10 : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Label10(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "HTML template file" );
- // ctor
- public Xcls_Label10(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "HTML template file" );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.margin_end = 3;
+ this.el.margin_start = 3;
+ this.el.margin_bottom = 3;
+ this.el.margin_top = 3;
+ }
- // set gobject values
- this.el.margin = 3;
+ // user defined functions
}
- // user defined functions
- }
-
- public class Xcls_base_template : Object
- {
- public Gtk.ComboBox el;
- private Xcls_RooProjectSettings _this;
+ public class Xcls_base_template : Object
+ {
+ public Gtk.ComboBox el;
+ private Xcls_RooProjectSettings _this;
- // my vars (def)
- public bool loading;
+ // my vars (def)
+ public bool loading;
- // ctor
- public Xcls_base_template(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.base_template = this;
- this.el = new Gtk.ComboBox();
+ // ctor
+ public Xcls_base_template(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ _this.base_template = this;
+ this.el = new Gtk.ComboBox();
- // my vars (dec)
- this.loading = false;
+ // my vars (dec)
+ this.loading = false;
- // set gobject values
- var child_0 = new Xcls_base_template_cellrenderer( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
- var child_1 = new Xcls_base_template_model( _this );
- child_1.ref();
- this.el.set_model ( child_1.el );
+ // set gobject values
+ new Xcls_base_template_cellrenderer( _this );
+ this.el.pack_start ( _this.base_template_cellrenderer.el , true );
+ new Xcls_base_template_model( _this );
+ this.el.set_model ( _this.base_template_model.el );
- // init method
+ // init method
- this.el.add_attribute(_this.base_template_cellrenderer.el , "markup", 0 );
+ this.el.add_attribute(_this.base_template_cellrenderer.el , "markup", 0 );
- //listeners
- this.el.changed.connect( () => {
- Gtk.TreeIter iter;
-
- // this get's called when we are filling in the data... ???
- if (this.loading) {
- return;
- }
-
-
- if (this.el.get_active_iter(out iter)) {
- Value vfname;
- _this.base_template_model.el.get_value (iter, 0, out vfname);
- _this.project.base_template = ((string)vfname) ;
-
- print("\nSET base template to %s\n", _this.project.base_template );
- // is_bjs = ((string)vfname) == "bjs";
- }
+ //listeners
+ this.el.changed.connect( () => {
+ Gtk.TreeIter iter;
+
+ // this get's called when we are filling in the data... ???
+ if (this.loading) {
+ return;
+ }
+
+
+ if (this.el.get_active_iter(out iter)) {
+ Value vfname;
+ _this.base_template_model.el.get_value (iter, 0, out vfname);
+ _this.project.base_template = ((string)vfname) ;
+
+ print("\nSET base template to %s\n", _this.project.base_template );
+ // is_bjs = ((string)vfname) == "bjs";
+ }
+
+
+ // directory is only available for non-bjs
+
-
- // directory is only available for non-bjs
-
-
-
- });
+
+ });
+ }
+
+ // user defined functions
}
+ public class Xcls_base_template_cellrenderer : Object
+ {
+ public Gtk.CellRendererText el;
+ private Xcls_RooProjectSettings _this;
- // user defined functions
- }
- public class Xcls_base_template_cellrenderer : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_RooProjectSettings _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_base_template_cellrenderer(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ _this.base_template_cellrenderer = this;
+ this.el = new Gtk.CellRendererText();
- // ctor
- public Xcls_base_template_cellrenderer(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.base_template_cellrenderer = this;
- this.el = new Gtk.CellRendererText();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ }
- // set gobject values
+ // user defined functions
}
- // user defined functions
- }
-
- public class Xcls_base_template_model : Object
- {
- public Gtk.ListStore el;
- private Xcls_RooProjectSettings _this;
+ public class Xcls_base_template_model : Object
+ {
+ public Gtk.ListStore el;
+ private Xcls_RooProjectSettings _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_base_template_model(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.base_template_model = this;
- this.el = new Gtk.ListStore.newv( { typeof(string) } );
+ // ctor
+ public Xcls_base_template_model(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ _this.base_template_model = this;
+ this.el = new Gtk.ListStore.newv( { typeof(string) } );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ }
- // user defined functions
- public void loadData () {
- _this.base_template.loading = true;
-
- this.el.clear();
- Gtk.TreeIter iter;
- var el = this.el;
+ // user defined functions
+ public void loadData () {
+ _this.base_template.loading = true;
+
+ this.el.clear();
+ Gtk.TreeIter iter;
+ var el = this.el;
+
+ /// el.append(out iter);
+
+
+ el.append(out iter);
+ el.set_value(iter, 0, "roo.builder.html");
+ _this.base_template.el.set_active_iter(iter);
+ if (_this.project.base_template == "roo.builder.html") {
+ _this.base_template.el.set_active_iter(iter);
+ }
- /// el.append(out iter);
+ el.append(out iter);
+ el.set_value(iter, 0, "bootstrap.builder.html");
+
+ print("\ncur template = %s\n", _this.project.base_template);
+
+ if (_this.project.base_template == "bootstrap.builder.html") {
+ _this.base_template.el.set_active_iter(iter);
+ }
+ el.append(out iter);
+ el.set_value(iter, 0, "bootstrap4.builder.html");
+ if (_this.project.base_template == "bootstrap4.builder.html") {
+ _this.base_template.el.set_active_iter(iter);
+ }
+
-
- el.append(out iter);
- el.set_value(iter, 0, "roo.builder.html");
- _this.base_template.el.set_active_iter(iter);
- if (_this.project.base_template == "roo.builder.html") {
- _this.base_template.el.set_active_iter(iter);
- }
-
- el.append(out iter);
- el.set_value(iter, 0, "bootstrap.builder.html");
-
- print("\ncur template = %s\n", _this.project.base_template);
-
- if (_this.project.base_template == "bootstrap.builder.html") {
- _this.base_template.el.set_active_iter(iter);
- }
- el.append(out iter);
- el.set_value(iter, 0, "bootstrap4.builder.html");
- if (_this.project.base_template == "bootstrap4.builder.html") {
- _this.base_template.el.set_active_iter(iter);
- }
+ el.append(out iter);
+ el.set_value(iter, 0, "mailer.builder.html");
-
- el.append(out iter);
- el.set_value(iter, 0, "mailer.builder.html");
-
- if (_this.project.base_template == "mailer.builder.html") {
- _this.base_template.el.set_active_iter(iter);
+ if (_this.project.base_template == "mailer.builder.html") {
+ _this.base_template.el.set_active_iter(iter);
+ }
+ _this.base_template.loading = false;
+
}
- _this.base_template.loading = false;
-
}
- }
- public class Xcls_Label14 : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
+ public class Xcls_Label14 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_RooProjectSettings _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Label14(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "root URL" );
+ // ctor
+ public Xcls_Label14(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "root URL" );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.margin = 3;
+ // set gobject values
+ this.el.margin_end = 3;
+ this.el.margin_start = 3;
+ this.el.margin_bottom = 3;
+ this.el.margin_top = 3;
+ }
+
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_rootURL : Object
+ {
+ public Gtk.Entry el;
+ private Xcls_RooProjectSettings _this;
- public class Xcls_rootURL : Object
- {
- public Gtk.Entry el;
- private Xcls_RooProjectSettings _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_rootURL(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ _this.rootURL = this;
+ this.el = new Gtk.Entry();
- // ctor
- public Xcls_rootURL(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.rootURL = this;
- this.el = new Gtk.Entry();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ }
- // set gobject values
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_Label16 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_RooProjectSettings _this;
- public class Xcls_Label16 : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Label16(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Generate HTML in" );
- // ctor
- public Xcls_Label16(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Generate HTML in" );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ }
- // set gobject values
- this.el.margin = 3;
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_html_gen : Object
+ {
+ public Gtk.ComboBox el;
+ private Xcls_RooProjectSettings _this;
- public class Xcls_html_gen : Object
- {
- public Gtk.ComboBox el;
- private Xcls_RooProjectSettings _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_html_gen(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ _this.html_gen = this;
+ this.el = new Gtk.ComboBox();
- // ctor
- public Xcls_html_gen(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.html_gen = this;
- this.el = new Gtk.ComboBox();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ new Xcls_html_gen_cellrenderer( _this );
+ this.el.pack_start ( _this.html_gen_cellrenderer.el , true );
+ new Xcls_html_gen_model( _this );
+ this.el.set_model ( _this.html_gen_model.el );
- // set gobject values
- var child_0 = new Xcls_html_gen_cellrenderer( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
- var child_1 = new Xcls_html_gen_model( _this );
- child_1.ref();
- this.el.set_model ( child_1.el );
+ // init method
- // init method
+ this.el.add_attribute(_this.html_gen_cellrenderer.el , "markup", 1 );
+ }
- this.el.add_attribute(_this.html_gen_cellrenderer.el , "markup", 1 );
+ // user defined functions
}
+ public class Xcls_html_gen_cellrenderer : Object
+ {
+ public Gtk.CellRendererText el;
+ private Xcls_RooProjectSettings _this;
- // user defined functions
- }
- public class Xcls_html_gen_cellrenderer : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_RooProjectSettings _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_html_gen_cellrenderer(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ _this.html_gen_cellrenderer = this;
+ this.el = new Gtk.CellRendererText();
- // ctor
- public Xcls_html_gen_cellrenderer(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.html_gen_cellrenderer = this;
- this.el = new Gtk.CellRendererText();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ }
- // set gobject values
+ // user defined functions
}
- // user defined functions
- }
-
- public class Xcls_html_gen_model : Object
- {
- public Gtk.ListStore el;
- private Xcls_RooProjectSettings _this;
+ public class Xcls_html_gen_model : Object
+ {
+ public Gtk.ListStore el;
+ private Xcls_RooProjectSettings _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_html_gen_model(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.html_gen_model = this;
- this.el = new Gtk.ListStore.newv( { typeof(string),typeof(string) } );
+ // ctor
+ public Xcls_html_gen_model(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ _this.html_gen_model = this;
+ this.el = new Gtk.ListStore.newv( { typeof(string),typeof(string) } );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
+ }
- // user defined functions
- public void loadData (string cur) {
- this.el.clear();
- Gtk.TreeIter iter;
- var el = this.el;
+ // user defined functions
+ public void loadData (string cur) {
+ this.el.clear();
+ Gtk.TreeIter iter;
+ var el = this.el;
+
+
+ el.append(out iter);
-
- el.append(out iter);
-
+
+ el.set_value(iter, 0, "");
+ el.set_value(iter, 1, "Do not Generate");
+ _this.html_gen.el.set_active_iter(iter);
- el.set_value(iter, 0, "");
- el.set_value(iter, 1, "Do not Generate");
- _this.html_gen.el.set_active_iter(iter);
-
- el.append(out iter);
+ el.append(out iter);
+
+ el.set_value(iter, 0, "bjs");
+ el.set_value(iter, 1, "same directory as BJS file");
+ if (cur == "bjs") {
+ _this.html_gen.el.set_active_iter(iter);
+ }
- el.set_value(iter, 0, "bjs");
- el.set_value(iter, 1, "same directory as BJS file");
- if (cur == "bjs") {
- _this.html_gen.el.set_active_iter(iter);
- }
-
-
-
- el.append(out iter);
- el.set_value(iter, 0, "templates");
- el.set_value(iter, 1, "in templates subdirectory");
-
- if (cur == "template") {
- _this.html_gen.el.set_active_iter(iter);
+
+ el.append(out iter);
+
+ el.set_value(iter, 0, "templates");
+ el.set_value(iter, 1, "in templates subdirectory");
+
+ if (cur == "template") {
+ _this.html_gen.el.set_active_iter(iter);
+ }
+
+
}
-
-
}
- }
- public class Xcls_Label20 : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
+ public class Xcls_Label20 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_RooProjectSettings _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Label20(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "HTML To insert at end of <HEAD>" );
+ // ctor
+ public Xcls_Label20(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "HTML To insert at end of <HEAD>" );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
+ // set gobject values
+ }
+
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_ScrolledWindow21 : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private Xcls_RooProjectSettings _this;
- public class Xcls_ScrolledWindow21 : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_RooProjectSettings _this;
+ // my vars (def)
+
+ // ctor
+ public Xcls_ScrolledWindow21(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.ScrolledWindow();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.vexpand = true;
+ new Xcls_view( _this );
+ this.el.set_child ( _this.view.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_view : Object
+ {
+ public GtkSource.View el;
+ private Xcls_RooProjectSettings _this;
- // my vars (def)
- // ctor
- public Xcls_ScrolledWindow21(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
+ // my vars (def)
+ public Gtk.CssProvider css;
- // my vars (dec)
+ // ctor
+ public Xcls_view(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ _this.view = this;
+ this.el = new GtkSource.View();
- // set gobject values
- var child_0 = new Xcls_view( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- }
+ // my vars (dec)
- // user defined functions
- }
- public class Xcls_view : Object
- {
- public Gtk.SourceView el;
- private Xcls_RooProjectSettings _this;
+ // set gobject values
+ this.el.name = "roo-project-settings-view";
+ var child_1 = new Xcls_EventControllerKey23( _this );
+ child_1.ref();
+ this.el.add_controller( child_1.el );
+ // init method
- // my vars (def)
- public Gtk.CssProvider css;
+ this.css = new Gtk.CssProvider();
+
+ this.css.load_from_string(
+ "#roo-project-settings-view{ font: 10px monospace;}"
+ );
+
+ //this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+
+ Gtk.StyleContext.add_provider_for_display(
+ Gdk.Display.get_default(),
+ this.css,
+ Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
+ );
+ }
- // ctor
- public Xcls_view(Xcls_RooProjectSettings _owner )
+ // user defined functions
+ }
+ public class Xcls_EventControllerKey23 : Object
{
- _this = _owner;
- _this.view = this;
- this.el = new Gtk.SourceView();
+ public Gtk.EventControllerKey el;
+ private Xcls_RooProjectSettings _this;
- // my vars (dec)
-
- // set gobject values
- this.el.name = "roo-project-settings-view";
- // init method
+ // my vars (def)
- this.css = new Gtk.CssProvider();
- try {
- this.css.load_from_data("#roo-project-settings-view{ font: monospace 10px;}");
- } catch (Error e) {}
- this.el.get_style_context().add_provider(this.css,Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+ // ctor
+ public Xcls_EventControllerKey23(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.EventControllerKey();
- //listeners
- this.el.key_release_event.connect( ( event) =>{
- if (event.keyval != 115) {
- return false;
-
- }
- if ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {
- return false;
- }
- var buf = this.el.get_buffer();
- Gtk.TextIter s;
- Gtk.TextIter e;
- buf.get_start_iter(out s);
- buf.get_end_iter(out e);
- _this.project.runhtml = buf.get_text(s,e,true);
-
-
- _this.buttonPressed("save");
-
- return false;
-
- });
- }
+ // my vars (dec)
- // user defined functions
- }
+ // set gobject values
+ //listeners
+ this.el.key_released.connect( (keyval, keycode, state) => {
+
+
+ if (keyval != 115) {
+ return;
+
+ }
+ if ( (state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {
+ return;
+ }
+ var buf = _this.view.el.get_buffer();
+ Gtk.TextIter s;
+ Gtk.TextIter e;
+ buf.get_start_iter(out s);
+ buf.get_end_iter(out e);
+ _this.project.runhtml = buf.get_text(s,e,true);
+
+
+ _this.buttonPressed("save");
+
+
+
+ });
+ }
+ // user defined functions
+ }
- public class Xcls_Box23 : Object
- {
- public Gtk.Box el;
- private Xcls_RooProjectSettings _this;
- // my vars (def)
- // ctor
- public Xcls_Box23(Xcls_RooProjectSettings _owner )
+ public class Xcls_Box24 : Object
{
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
+ public Gtk.Box el;
+ private Xcls_RooProjectSettings _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box24(Xcls_RooProjectSettings _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_Label25( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ new Xcls_database_DBTYPE( _this );
+ this.el.append( _this.database_DBTYPE.el );
+ var child_3 = new Xcls_Label28( _this );
+ child_3.ref();
+ this.el.append( child_3.el );
+ new Xcls_database_DBNAME( _this );
+ this.el.append( _this.database_DBNAME.el );
+ var child_5 = new Xcls_Label31( _this );
+ child_5.ref();
+ this.el.append( child_5.el );
+ new Xcls_database_DBUSERNAME( _this );
+ this.el.append( _this.database_DBUSERNAME.el );
+ var child_7 = new Xcls_Label34( _this );
+ child_7.ref();
+ this.el.append( child_7.el );
+ new Xcls_database_DBPASSWORD( _this );
+ this.el.append( _this.database_DBPASSWORD.el );
+ var child_9 = new Xcls_Button36( _this );
+ child_9.ref();
+ this.el.append( child_9.el );
+ new Xcls_database_ERROR( _this );
+ this.el.append( _this.database_ERROR.el );
+ }
- // set gobject values
- this.el.homogeneous = false;
- var child_0 = new Xcls_Label24( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,false,0 );
- var child_1 = new Xcls_database_DBTYPE( _this );
- child_1.ref();
- this.el.pack_start ( child_1.el , false,false,0 );
- var child_2 = new Xcls_Label26( _this );
- child_2.ref();
- this.el.pack_start ( child_2.el , false,false,0 );
- var child_3 = new Xcls_database_DBNAME( _this );
- child_3.ref();
- this.el.pack_start ( child_3.el , false,false,0 );
- var child_4 = new Xcls_Label28( _this );
- child_4.ref();
- this.el.pack_start ( child_4.el , false,false,0 );
- var child_5 = new Xcls_database_DBUSERNAME( _this );
- child_5.ref();
- this.el.pack_start ( child_5.el , false,false,0 );
- var child_6 = new Xcls_Label30( _this );
- child_6.ref();
- this.el.pack_start ( child_6.el , false,false,0 );
- var child_7 = new Xcls_database_DBPASSWORD( _this );
- child_7.ref();
- this.el.pack_start ( child_7.el , false,false,0 );
- var child_8 = new Xcls_Button32( _this );
- child_8.ref();
- this.el.pack_start ( child_8.el , false,false,0 );
- var child_9 = new Xcls_database_ERROR( _this );
- child_9.ref();
- this.el.pack_start ( child_9.el , false,false,0 );
+ // user defined functions
}
+ public class Xcls_Label25 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_RooProjectSettings _this;
- // user defined functions
- }
- public class Xcls_Label24 : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Label25(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Type (eg. MySQL or PostgreSQL)" );
- // ctor
- public Xcls_Label24(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Type (eg. MySQL or PostgreSQL)" );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.xalign = 0f;
+ }
- // set gobject values
- this.el.xalign = 0f;
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_database_DBTYPE : Object
+ {
+ public Gtk.Entry el;
+ private Xcls_RooProjectSettings _this;
- public class Xcls_database_DBTYPE : Object
- {
- public Gtk.Entry el;
- private Xcls_RooProjectSettings _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_database_DBTYPE(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ _this.database_DBTYPE = this;
+ this.el = new Gtk.Entry();
- // ctor
- public Xcls_database_DBTYPE(Xcls_RooProjectSettings _owner )
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_EventControllerKey27( _this );
+ child_1.ref();
+ this.el.add_controller( child_1.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_EventControllerKey27 : Object
{
- _this = _owner;
- _this.database_DBTYPE = this;
- this.el = new Gtk.Entry();
+ public Gtk.EventControllerKey el;
+ private Xcls_RooProjectSettings _this;
- // my vars (dec)
- // set gobject values
+ // my vars (def)
- //listeners
- this.el.key_press_event.connect( (ev) => {
-
- if (ev.keyval == Gdk.Key.Tab) {
- _this.database_DBNAME.el.grab_focus();
- return true;
- }
-
-
- return false;
- });
- }
+ // ctor
+ public Xcls_EventControllerKey27(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.EventControllerKey();
- // user defined functions
- }
+ // my vars (dec)
- public class Xcls_Label26 : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
+ // set gobject values
+ //listeners
+ this.el.key_pressed.connect( (keyval, keycode, state) => {
+ if (keyval == Gdk.Key.Tab) {
+ _this.database_DBNAME.el.grab_focus();
+ return true;
+ }
+
+
+ return false;
+ });
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_Label26(Xcls_RooProjectSettings _owner )
+
+ public class Xcls_Label28 : Object
{
- _this = _owner;
- this.el = new Gtk.Label( "Name" );
+ public Gtk.Label el;
+ private Xcls_RooProjectSettings _this;
- // my vars (dec)
- // set gobject values
- this.el.xalign = 0f;
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_Label28(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Name" );
- public class Xcls_database_DBNAME : Object
- {
- public Gtk.Entry el;
- private Xcls_RooProjectSettings _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.xalign = 0f;
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_database_DBNAME(Xcls_RooProjectSettings _owner )
+ public class Xcls_database_DBNAME : Object
{
- _this = _owner;
- _this.database_DBNAME = this;
- this.el = new Gtk.Entry();
+ public Gtk.Entry el;
+ private Xcls_RooProjectSettings _this;
- // my vars (dec)
- // set gobject values
+ // my vars (def)
- //listeners
- this.el.key_press_event.connect( (ev) => {
-
- if (ev.keyval == Gdk.Key.Tab) {
- _this.database_DBUSERNAME.el.grab_focus();
- return true;
- }
-
-
- return false;
- });
+ // ctor
+ public Xcls_database_DBNAME(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ _this.database_DBNAME = this;
+ this.el = new Gtk.Entry();
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_EventControllerKey30( _this );
+ child_1.ref();
+ this.el.add_controller( child_1.el );
+ }
+
+ // user defined functions
}
+ public class Xcls_EventControllerKey30 : Object
+ {
+ public Gtk.EventControllerKey el;
+ private Xcls_RooProjectSettings _this;
- // user defined functions
- }
- public class Xcls_Label28 : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
+ // my vars (def)
+ // ctor
+ public Xcls_EventControllerKey30(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.EventControllerKey();
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_Label28(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Username" );
+ // set gobject values
- // my vars (dec)
+ //listeners
+ this.el.key_pressed.connect( (keyval, keycode, state) => {
+ if (keyval == Gdk.Key.Tab) {
+ _this.database_DBUSERNAME.el.grab_focus();
+ return true;
+ }
+
+
+ return false;
+
+ });
+ }
- // set gobject values
- this.el.xalign = 0f;
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_database_DBUSERNAME : Object
- {
- public Gtk.Entry el;
- private Xcls_RooProjectSettings _this;
+ public class Xcls_Label31 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_RooProjectSettings _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_database_DBUSERNAME(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.database_DBUSERNAME = this;
- this.el = new Gtk.Entry();
+ // ctor
+ public Xcls_Label31(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Username" );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
+ // set gobject values
+ this.el.xalign = 0f;
+ }
- //listeners
- this.el.key_press_event.connect( (ev) => {
-
- if (ev.keyval == Gdk.Key.Tab) {
- _this.database_DBPASSWORD.el.grab_focus();
- return true;
- }
-
-
- return false;
- });
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_database_DBUSERNAME : Object
+ {
+ public Gtk.Entry el;
+ private Xcls_RooProjectSettings _this;
- public class Xcls_Label30 : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_database_DBUSERNAME(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ _this.database_DBUSERNAME = this;
+ this.el = new Gtk.Entry();
- // ctor
- public Xcls_Label30(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Password" );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ var child_1 = new Xcls_EventControllerKey33( _this );
+ child_1.ref();
+ this.el.add_controller( child_1.el );
+ }
- // set gobject values
- this.el.xalign = 0f;
+ // user defined functions
}
+ public class Xcls_EventControllerKey33 : Object
+ {
+ public Gtk.EventControllerKey el;
+ private Xcls_RooProjectSettings _this;
- // user defined functions
- }
- public class Xcls_database_DBPASSWORD : Object
- {
- public Gtk.Entry el;
- private Xcls_RooProjectSettings _this;
+ // my vars (def)
+ // ctor
+ public Xcls_EventControllerKey33(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.EventControllerKey();
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_database_DBPASSWORD(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.database_DBPASSWORD = this;
- this.el = new Gtk.Entry();
+ // set gobject values
- // my vars (dec)
+ //listeners
+ this.el.key_pressed.connect( (keyval, keycode, state) => {
+ if (keyval == Gdk.Key.Tab) {
+ _this.database_DBPASSWORD.el.grab_focus();
+ return true;
+ }
+
+
+ return false;
+
+
+ });
+ }
- // set gobject values
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_Button32 : Object
- {
- public Gtk.Button el;
- private Xcls_RooProjectSettings _this;
+ public class Xcls_Label34 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_RooProjectSettings _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Button32(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
+ // ctor
+ public Xcls_Label34(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Password" );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.label = "Check Connection";
+ // set gobject values
+ this.el.xalign = 0f;
+ }
- //listeners
- this.el.clicked.connect( () => {
-
-
- _this.database_ERROR.el.label = "";
- Gda.Connection cnc;
- try {
- // assumes localhost...
- cnc = Gda.Connection.open_from_string (
- _this.database_DBTYPE.el.get_text(),
- "DB_NAME=" + _this.database_DBNAME.el.get_text(),
- "USERNAME=" + _this.database_DBUSERNAME.el.get_text() +
- ";PASSWORD=" + _this.database_DBPASSWORD.el.get_text(),
- Gda.ConnectionOptions.NONE
- );
- //} catch (Gda.ConnectionError ce) {
- // _this.database_ERROR.el.label = ce.message;
- } catch(GLib.Error ue) {
- _this.database_ERROR.el.label = ue.message;
- return;
- }
- _this.database_ERROR.el.label = "Connection Succeeded";
- cnc.close();
- });
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_database_DBPASSWORD : Object
+ {
+ public Gtk.Entry el;
+ private Xcls_RooProjectSettings _this;
- public class Xcls_database_ERROR : Object
- {
- public Gtk.Label el;
- private Xcls_RooProjectSettings _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_database_DBPASSWORD(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ _this.database_DBPASSWORD = this;
+ this.el = new Gtk.Entry();
- // ctor
- public Xcls_database_ERROR(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- _this.database_ERROR = this;
- this.el = new Gtk.Label( " " );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ }
- // set gobject values
- this.el.margin = 3;
- this.el.xalign = 0f;
+ // user defined functions
}
- // user defined functions
- }
-
+ public class Xcls_Button36 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_RooProjectSettings _this;
- public class Xcls_ButtonBox34 : Object
- {
- public Gtk.ButtonBox el;
- private Xcls_RooProjectSettings _this;
+ // my vars (def)
+ // ctor
+ public Xcls_Button36(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_ButtonBox34(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.ButtonBox( Gtk.Orientation.HORIZONTAL );
+ // set gobject values
+ this.el.label = "Check Connection";
- // my vars (dec)
+ //listeners
+ this.el.clicked.connect( () => {
+
+
+ _this.database_ERROR.el.label = "";
+ Gda.Connection cnc;
+ try {
+ // assumes localhost...
+ cnc = Gda.Connection.open_from_string (
+ _this.database_DBTYPE.el.get_text(),
+ "DB_NAME=" + _this.database_DBNAME.el.get_text(),
+ "USERNAME=" + _this.database_DBUSERNAME.el.get_text() +
+ ";PASSWORD=" + _this.database_DBPASSWORD.el.get_text(),
+ Gda.ConnectionOptions.NONE
+ );
+ //} catch (Gda.ConnectionError ce) {
+ // _this.database_ERROR.el.label = ce.message;
+ } catch(GLib.Error ue) {
+ _this.database_ERROR.el.label = ue.message;
+ return;
+ }
+ _this.database_ERROR.el.label = "Connection Succeeded";
+ cnc.close();
+ });
+ }
- // set gobject values
- this.el.margin_end = 4;
- this.el.margin_start = 4;
- this.el.margin_bottom = 4;
- this.el.margin_top = 4;
- var child_0 = new Xcls_Button35( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_Button36( _this );
- child_1.ref();
- this.el.add ( child_1.el );
- var child_2 = new Xcls_Button37( _this );
- child_2.ref();
- this.el.add ( child_2.el );
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_Button35 : Object
- {
- public Gtk.Button el;
- private Xcls_RooProjectSettings _this;
+ public class Xcls_database_ERROR : Object
+ {
+ public Gtk.Label el;
+ private Xcls_RooProjectSettings _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Button35(Xcls_RooProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
+ // ctor
+ public Xcls_database_ERROR(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ _this.database_ERROR = this;
+ this.el = new Gtk.Label( " " );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.label = "Cancel";
+ // set gobject values
+ this.el.xalign = 0f;
+ }
- //listeners
- this.el.clicked.connect( () => {
-
- _this.done = true;
- _this.el.hide();
- });
+ // user defined functions
}
- // user defined functions
- }
-
- public class Xcls_Button36 : Object
- {
- public Gtk.Button el;
- private Xcls_RooProjectSettings _this;
- // my vars (def)
- // ctor
- public Xcls_Button36(Xcls_RooProjectSettings _owner )
+ public class Xcls_HeaderBar38 : Object
{
- _this = _owner;
- this.el = new Gtk.Button();
+ public Gtk.HeaderBar el;
+ private Xcls_RooProjectSettings _this;
- // my vars (dec)
- // set gobject values
- this.el.label = "Apply / Keep editing";
+ // my vars (def)
- //listeners
- this.el.clicked.connect( ( ) => {
-
- _this.buttonPressed("apply");
-
-
- });
+ // ctor
+ public Xcls_HeaderBar38(Xcls_RooProjectSettings _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_Button39( _this );
+ child_1.ref();
+ this.el.pack_start ( child_1.el );
+ var child_2 = new Xcls_Button40( _this );
+ child_2.ref();
+ this.el.pack_end ( child_2.el );
+ }
+
+ // user defined functions
}
+ public class Xcls_Button39 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_RooProjectSettings _this;
- // user defined functions
- }
- public class Xcls_Button37 : Object
- {
- public Gtk.Button el;
- private Xcls_RooProjectSettings _this;
+ // my vars (def)
+ // ctor
+ public Xcls_Button39(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_Button37(Xcls_RooProjectSettings _owner )
+ // set gobject values
+ this.el.label = "Cancel";
+
+ //listeners
+ this.el.clicked.connect( () => {
+
+ _this.done = true;
+ _this.el.hide();
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_Button40 : Object
{
- _this = _owner;
- this.el = new Gtk.Button();
+ public Gtk.Button el;
+ private Xcls_RooProjectSettings _this;
- // my vars (dec)
- // set gobject values
- this.el.label = "Save";
+ // my vars (def)
- //listeners
- this.el.clicked.connect( ( ) => {
-
-
- _this.buttonPressed("save");
-
- // what about .js ?
- _this.done = true;
- _this.el.hide();
-
- // hopefull this will work with bjs files..
-
-
-
- });
- }
+ // ctor
+ public Xcls_Button40(Xcls_RooProjectSettings _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // user defined functions
- }
+ // my vars (dec)
+
+ // set gobject values
+ this.el.css_classes = { "suggested-action" };
+ this.el.label = "Save";
+
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+
+ _this.buttonPressed("save");
+
+ // what about .js ?
+ _this.done = true;
+ _this.el.hide();
+
+ // hopefull this will work with bjs files..
+
+
+
+ });
+ }
+ // user defined functions
+ }
-}
+ }
"Gtk.DialogFlags flags" : "Gtk.DialogFlags.MODAL",
"id" : "StandardErrorDialog",
"listeners" : {
- "delete_event" : [
- " (self, event) => {",
- " this.el.hide();",
- " return true;",
- " ",
- "} ",
- ""
- ],
"response" : [
" (self, response_id) => {",
" this.el.hide();",
" this.el.set_transient_for(win);",
" this.el.modal = true;",
" this.el.text = msg;",
- " this.el.show_all();",
+ " this.el.show();",
"}",
""
]
this.el.use_markup = true;
//listeners
- this.el.delete_event.connect( (self, event) => {
- this.el.hide();
- return true;
-
- });
this.el.response.connect( (self, response_id) => {
this.el.hide();
});
this.el.set_transient_for(win);
this.el.modal = true;
this.el.text = msg;
- this.el.show_all();
+ this.el.show();
}
}
{
"build_module" : "builder",
+ "gen_extended" : false,
"items" : [
{
- "# Json.Object notices" : "",
+ "# GLib.ListStore notices" : "",
"# Xcls_MainWindow window" : "",
"$ xns" : "Gtk",
+ "* ctor" : "new Gtk.Popover()",
"Gtk.PositionType position" : "Gtk.PositionType.TOP",
- "bool active" : false,
- "bool hexpand" : false,
- "bool modal" : true,
+ "bool autohide" : true,
"id" : "ValaCompileErrors",
"int height_request" : 800,
"int width_request" : 900,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
+ "* pack" : "set_child",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
"bool hexpand" : false,
"gboolean homogeneous" : false,
"id" : "compile_view",
"items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,true,true,0",
- "utf8 label" : "Compile and Run ",
- "xtype" : "Button"
- }
- ],
- "xtype" : "Box"
- },
{
"$ xns" : "Gtk",
"* init" : [
"}",
""
],
- "* pack" : "pack_end,true,true,0",
"items" : [
{
"$ xns" : "Gtk",
- "* init" : [
- "{",
- " this.css = new Gtk.CssProvider();",
- "\ttry {",
- "\t\tthis.css.load_from_data(\"#compile-erros-view { font-size: 12px;}\");",
- "\t} catch (Error e) {}",
- "\tthis.el.get_style_context().add_provider(this.css,",
- "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION);",
- "\t ",
- "\t ",
- "}",
- ""
- ],
- "* pack" : "add",
- "Gtk.CssProvider css" : "",
- "id" : "compile_tree",
+ "* pack" : "set_child",
+ "bool hexpand" : true,
+ "bool vexpand" : true,
+ "id" : "tree",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "set_model",
- "columns" : [
- " typeof(string), ",
- " typeof(int),",
- " typeof(string),",
- " typeof(string) "
+ "* prop" : "model",
+ "id" : "selmodel",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "id" : "sortmodel",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* ctor" : [
+ "new Gtk.TreeListModel(",
+ " new GLib.ListStore(typeof(Palete.CompileError)), //..... << that's our store..",
+ " false, // passthru",
+ " false, // autexpand",
+ " (item) => {",
+ " ",
+ " \t ",
+ " \t return ((Palete.CompileError)item).lines;",
+ " ",
+ " }",
+ " ",
+ " ",
+ ")"
+ ],
+ "* prop" : "model",
+ "id" : "model",
+ "xtype" : "TreeListModel"
+ }
+ ],
+ "xtype" : "SortListModel",
+ "| Json.Object getNodeAt" : [
+ "(uint row) {",
+ "",
+ " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
+ " ",
+ " ",
+ " // GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
+ " \t",
+ " ",
+ " return (Json.Object)tr.get_item();",
+ "\t ",
+ "}"
+ ]
+ }
],
- "gint n_columns" : 4,
- "id" : "compile_result_store",
- "xtype" : "TreeStore"
+ "xtype" : "SingleSelection",
+ "| Json.Object 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 (Json.Object)tr.get_item();",
+ "\t ",
+ "}"
+ ]
},
{
"$ xns" : "Gtk",
- "* init" : [
- "{",
- " this.el.add_attribute(_this.renderer.el , \"markup\", 2 );",
- " ",
- "}",
- ""
- ],
"* pack" : "append_column",
+ "bool expand" : true,
+ "bool resizable" : true,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "renderer",
- "xtype" : "CellRendererText"
+ "* prop" : "factory",
+ "listeners" : {
+ "bind" : [
+ "(listitem) => {",
+ "\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 lbl = (Gtk.Label) expand.child;",
+ "\t",
+ "\t if (lbl.label != \"\") { // do not update",
+ "\t \treturn;",
+ " \t}",
+ "\t",
+ "",
+ "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
+ "\tvar np = (Palete.CompileError) lr.get_item();",
+ "\t",
+ "\t",
+ "\t//GLib.debug(\"change %s to %s\", lbl.label, np.name);",
+ "\tlbl.label = np.line_msg;",
+ "\t//lbl.tooltip_markup = np.to_property_option_tooltip();",
+ "\t ",
+ " expand.set_hide_expander( np.lines.n_items < 1);",
+ "\texpand.set_list_row(lr);",
+ " ",
+ " \t// expand current file.",
+ " \tif (_this.window.windowstate.file.path == np.file.path) {",
+ " \t\tlr.expanded = true;",
+ "\t}",
+ " \t ",
+ " \t// bind image...",
+ " \t",
+ "}",
+ ""
+ ],
+ "setup" : [
+ "(listitem) => {",
+ "\t",
+ "\tvar expand = new Gtk.TreeExpander();",
+ "\t ",
+ "\texpand.set_indent_for_depth(true);",
+ "\texpand.set_indent_for_icon(true);",
+ "\t ",
+ "\tvar lbl = new Gtk.Label(\"\");",
+ "\tlbl.use_markup = true;",
+ "\t",
+ "\t",
+ " \tlbl.justify = Gtk.Justification.LEFT;",
+ " \tlbl.xalign = 0;",
+ "",
+ " ",
+ "\texpand.set_child(lbl);",
+ "\t((Gtk.ListItem)listitem).set_child(expand);",
+ "\t((Gtk.ListItem)listitem).activatable = false;",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "SignalListItemFactory"
}
],
- "string id" : "column",
- "utf8 title" : "Compile output",
- "xtype" : "TreeViewColumn"
+ "string title" : "Compile Result",
+ "xtype" : "ColumnViewColumn"
+ },
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "pressed" : [
+ "(n_press, x, y) => {",
+ "\t",
+ "\tif (n_press < 2) { /// doubleclick?",
+ "\t\treturn;",
+ "\t}",
+ " ",
+ "\t",
+ "\t",
+ "\t// use selection?!",
+ "\tvar tr = (Gtk.TreeListRow)_this.selmodel.el.selected_item;",
+ "\t//GLib.debug(\"SELECTED = %s\", tr.item.get_type().name());",
+ "\tvar ce = (Palete.CompileError) tr.item;",
+ "",
+ "\tif (ce.line < 0) {",
+ "\t\t// did not click on a line.",
+ "\t\treturn;",
+ "\t}",
+ "\t ",
+ "\t ",
+ " var fname = ce.parent.file;",
+ " \tvar line = ce.line; ",
+ " GLib.debug(\"open %s @ %d\\n\", ce.parent.file.path, ce.line);",
+ " ",
+ " ",
+ " var bjsf = \"\";",
+ " try { ",
+ " var regex = new Regex(\"\\\\.vala$\");",
+ " ",
+ " ",
+ " bjsf = regex.replace(fname.path,fname.path.length , 0 , \".bjs\");",
+ " } catch (GLib.RegexError e) {",
+ " return;",
+ " } ",
+ " var p = _this.window.project;",
+ " ",
+ " ",
+ " ",
+ " var jsr = p.getByPath(bjsf);",
+ " if (jsr != null) {",
+ " _this.window.windowstate.fileViewOpen(jsr, true, line);",
+ " ",
+ " if (jsr.path == _this.window.windowstate.file.path) {",
+ " \t_this.el.hide();",
+ " \t}",
+ " ",
+ " ",
+ " return;",
+ " ",
+ " }",
+ " try {",
+ "\t\tvar pf = JsRender.JsRender.factory(\"PlainFile\", p, fname.path);",
+ "\t\t_this.window.windowstate.fileViewOpen(pf, true, line);",
+ " } catch (JsRender.Error e) {}",
+ " // try hiding the left nav..",
+ " ",
+ " return;",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "uint button" : 0,
+ "xtype" : "GestureClick"
}
],
- "listeners" : {
- "button_press_event" : [
- " ( ev) => {",
- " ",
- " Gtk.TreeViewColumn col;",
- " int cell_x;",
- " int cell_y;",
- " Gtk.TreePath path;",
- " if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {",
- " print(\"nothing selected on click\");",
- " ",
- " return false; //not on a element.",
- " }",
- " ",
- " ",
- " // right click.",
- " if (ev.type != Gdk.EventType.2BUTTON_PRESS || ev.button != 1 ) { ",
- " // show popup!. ",
- " ",
- " ",
- " return false;",
- " }",
- " Gtk.TreeIter iter;",
- " var mod = _this.compile_result_store.el;",
- " mod.get_iter (out iter, path);",
- " ",
- " ",
- " ",
- " // var val = \"\";",
- " GLib.Value value;",
- " _this.compile_result_store.el.get_value(iter, 3, out value);",
- " var fname = (string)value;",
- " GLib.Value lvalue;",
- " _this.compile_result_store.el.get_value(iter, 1, out lvalue);",
- " var line = (int) lvalue;",
- " ",
- " print(\"open %s @ %d\\n\", fname, line);",
- " ",
- " ",
- " var bjsf = \"\";",
- " try { ",
- " var regex = new Regex(\"\\\\.vala$\");",
- " ",
- " ",
- " bjsf = regex.replace(fname,fname.length , 0 , \".bjs\");",
- " } catch (GLib.RegexError e) {",
- " return false;",
- " } ",
- " var p = _this.window.project;",
- " ",
- " ",
- " ",
- " var jsr = p.getByPath(bjsf);",
- " if (jsr != null) {",
- " _this.window.windowstate.fileViewOpen(jsr, true, line);",
- " ",
- " return false;",
- " ",
- " }",
- " try {",
- "\t\tvar pf = JsRender.JsRender.factory(\"PlainFile\", p, fname);",
- "\t\t_this.window.windowstate.fileViewOpen(pf, true, line);",
- " } catch (JsRender.Error e) {}",
- " // try hiding the left nav..",
- " ",
- " return false;",
- " ",
- " }",
- " "
- ]
- },
- "string name" : "compile-erros-view",
- "xtype" : "TreeView"
+ "xtype" : "ColumnView"
}
],
"xtype" : "ScrolledWindow"
],
"xtype" : "Popover",
"| void show" : [
- "(Json.Object tree, Gtk.Widget onbtn) {",
+ "( GLib.ListStore ls , Gtk.Widget onbtn) {",
"",
" ",
- " ",
- " this.notices = tree;",
+ " \t//this.el.present();",
+ " //this.el.popup();",
+ " this.notices = ls;",
" ",
" //print(\"looking for %s\\n\", id);",
" // loop through parent childnre",
" ",
" ",
- " var store = this.compile_result_store.el; ",
- " ",
- " store.clear();",
- " \tGtk.TreeIter? expand = null;",
- " ",
- " tree.foreach_member((obj, file, node) => {",
- " // id line \"display text\", file",
- " ",
- " var title = GLib.Path.get_basename(GLib.Path.get_dirname( file)) + \"/\" + GLib.Path.get_basename( file) ;",
- " Gtk.TreeIter iter;",
- " GLib.debug(\"Add file %s\", title);",
- " store.append(out iter, null);",
- " var lines = tree.get_object_member(file);",
- " title += \" (\" + lines.get_size().to_string() + \")\";",
- " store.set(iter, ",
- " \t0, file, ",
- " \t1, -1, ",
- " \t2, title, ",
- " \t3, file,",
- " \t-1);",
- " ",
- " if (this.window.windowstate.file.path == file) {",
- " GLib.debug(\"Expanding Row: %s\", file);",
- " expand = iter ;",
- "",
- " ",
- " }",
- " ",
- " ",
- " lines.foreach_member((obja, line, nodea) => {",
- " var msg = \"\";",
- " var ar = lines.get_array_member(line);",
- " for (var i = 0 ; i < ar.get_length(); i++) {",
- "\t\t\t\tmsg += (msg.length > 0) ? \"\\n\" : \"\";",
- "\t\t\t\tmsg += ar.get_string_element(i);",
- "\t\t }",
- "\t\t Gtk.TreeIter citer; ",
- "\t\t GLib.debug(\"Add line %s\", line);",
- "\t\t store.append(out citer, iter);",
- "\t\t store.set(citer, ",
- "\t\t 0, file + \":\" + int.parse(line).to_string(\"%09d\"), ",
- "\t\t 1, int.parse(line), ",
- "\t\t 2, GLib.Markup.escape_text(line + \": \" + msg), ",
- "\t\t 3, file, ",
- "\t\t -1);",
- " ",
- " });",
- " ",
- " ",
- " });",
+ " this.tree.el.hide(); //<< very important!!!",
" ",
- " store.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
+ " // store.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
+ " ",
+ " var win = this.window.el;",
+ " var w = win.get_width();",
+ " var h = win.get_height();",
"",
- " ",
- " int w,h;",
- " this.window.el.get_size(out w, out h);",
- " ",
+ " ",
+ " ",
" // left tree = 250, editor area = 500?",
" ",
" // min 450?",
" new_w = w-100;",
" }",
" this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));",
+ " ",
"",
- " ",
- "",
- " if (this.el.relative_to == null) {",
- " this.el.set_relative_to(onbtn);",
- " }",
- " this.el.show_all();",
+ " // this.el.set_relative_to(onbtn);",
+ "\t//Gtk.Allocation rect;",
+ "\t//onbtn.get_allocation(out rect);",
+ " //this.el.set_pointing_to(rect);",
+ "\tthis.el.present();",
+ " this.el.popup();",
" ",
- " \tif (expand != null) {",
- " \t_this.compile_tree.el.expand_row( store.get_path(expand) , true);",
- "\t}",
+ " ",
+ "\tvar tm = new Gtk.TreeListModel(",
+ "\t\tls, //..... << that's our store..",
+ "\t\tfalse, // passthru",
+ "\t\tfalse, // autexpand",
+ "\t\t(item) => {",
+ "\t\t",
+ "\t\t\t return ((Palete.CompileError)item).lines;",
+ "\t\t",
+ "\t\t}",
+ "\t);",
+ " ",
+ " _this.model.el = tm;",
+ " _this.sortmodel.el.set_model(tm);",
+ " ",
+ " this.tree.el.show(); ",
" ",
- " while(Gtk.events_pending()) { ",
- " Gtk.main_iteration();",
- " } ",
+ " \t//if (expand != null) {",
+ " //\t_this.compile_tree.el.expand_row( store.get_path(expand) , true);",
+ "//\t}",
+ " ",
" // this.hpane.el.set_position( 0);",
"}",
""
]
}
],
- "modOrder" : "",
- "name" : "ValaCompileErrors",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/ValaCompileErrors.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "ValaCompileErrors"
}
\ No newline at end of file
-static Xcls_ValaCompileErrors _ValaCompileErrors;
+ static Xcls_ValaCompileErrors _ValaCompileErrors;
-public class Xcls_ValaCompileErrors : Object
-{
- public Gtk.Popover el;
- private Xcls_ValaCompileErrors _this;
-
- public static Xcls_ValaCompileErrors singleton()
- {
- if (_ValaCompileErrors == null) {
- _ValaCompileErrors= new Xcls_ValaCompileErrors();
- }
- return _ValaCompileErrors;
- }
- public Xcls_compile_view compile_view;
- public Xcls_compile_tree compile_tree;
- public Xcls_compile_result_store compile_result_store;
- public Xcls_column column;
- public Xcls_renderer renderer;
-
- // my vars (def)
- public Xcls_MainWindow window;
- public Json.Object notices;
- public bool active;
-
- // ctor
- public Xcls_ValaCompileErrors()
+ public class Xcls_ValaCompileErrors : Object
{
- _this = this;
- this.el = new Gtk.Popover( null );
-
- // my vars (dec)
- this.active = false;
-
- // set gobject values
- this.el.width_request = 900;
- this.el.height_request = 800;
- this.el.hexpand = false;
- this.el.modal = true;
- this.el.position = Gtk.PositionType.TOP;
- var child_0 = new Xcls_compile_view( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- }
+ public Gtk.Popover el;
+ private Xcls_ValaCompileErrors _this;
- // user defined functions
- public void show (Json.Object tree, Gtk.Widget onbtn) {
-
-
-
- this.notices = tree;
-
- //print("looking for %s\n", id);
- // loop through parent childnre
-
-
- var store = this.compile_result_store.el;
-
- store.clear();
- Gtk.TreeIter? expand = null;
-
- tree.foreach_member((obj, file, node) => {
- // id line "display text", file
-
- var title = GLib.Path.get_basename(GLib.Path.get_dirname( file)) + "/" + GLib.Path.get_basename( file) ;
- Gtk.TreeIter iter;
- GLib.debug("Add file %s", title);
- store.append(out iter, null);
- var lines = tree.get_object_member(file);
- title += " (" + lines.get_size().to_string() + ")";
- store.set(iter,
- 0, file,
- 1, -1,
- 2, title,
- 3, file,
- -1);
-
- if (this.window.windowstate.file.path == file) {
- GLib.debug("Expanding Row: %s", file);
- expand = iter ;
-
-
+ public static Xcls_ValaCompileErrors singleton()
+ {
+ if (_ValaCompileErrors == null) {
+ _ValaCompileErrors= new Xcls_ValaCompileErrors();
}
-
-
- lines.foreach_member((obja, line, nodea) => {
- var msg = "";
- var ar = lines.get_array_member(line);
- for (var i = 0 ; i < ar.get_length(); i++) {
- msg += (msg.length > 0) ? "\n" : "";
- msg += ar.get_string_element(i);
- }
- Gtk.TreeIter citer;
- GLib.debug("Add line %s", line);
- store.append(out citer, iter);
- store.set(citer,
- 0, file + ":" + int.parse(line).to_string("%09d"),
- 1, int.parse(line),
- 2, GLib.Markup.escape_text(line + ": " + msg),
- 3, file,
- -1);
-
- });
-
-
- });
-
- store.set_sort_column_id(0,Gtk.SortType.ASCENDING);
-
-
- int w,h;
- this.window.el.get_size(out w, out h);
-
- // left tree = 250, editor area = 500?
-
- // min 450?
- var new_w = int.min(650, w-100);
- if (new_w > (w-100)) {
- new_w = w-100;
+ return _ValaCompileErrors;
}
- this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
-
-
-
- if (this.el.relative_to == null) {
- this.el.set_relative_to(onbtn);
- }
- this.el.show_all();
-
- if (expand != null) {
- _this.compile_tree.el.expand_row( store.get_path(expand) , true);
- }
-
- while(Gtk.events_pending()) {
- Gtk.main_iteration();
- }
- // this.hpane.el.set_position( 0);
- }
- public class Xcls_compile_view : Object
- {
- public Gtk.Box el;
- private Xcls_ValaCompileErrors _this;
-
+ public Xcls_compile_view compile_view;
+ public Xcls_tree tree;
+ public Xcls_selmodel selmodel;
+ public Xcls_sortmodel sortmodel;
+ public Xcls_model model;
// my vars (def)
+ public Xcls_MainWindow window;
+ public GLib.ListStore notices;
// ctor
- public Xcls_compile_view(Xcls_ValaCompileErrors _owner )
+ public Xcls_ValaCompileErrors()
{
- _this = _owner;
- _this.compile_view = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ _this = this;
+ this.el = new Gtk.Popover();
// my vars (dec)
// set gobject values
- this.el.homogeneous = false;
- this.el.hexpand = false;
- var child_0 = new Xcls_Box3( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,false,0 );
- var child_1 = new Xcls_ScrolledWindow5( _this );
- child_1.ref();
- this.el.pack_end ( child_1.el , true,true,0 );
+ this.el.width_request = 900;
+ this.el.height_request = 800;
+ this.el.autohide = true;
+ this.el.position = Gtk.PositionType.TOP;
+ new Xcls_compile_view( _this );
+ this.el.set_child ( _this.compile_view.el );
}
// user defined functions
- }
- public class Xcls_Box3 : Object
- {
- public Gtk.Box el;
- private Xcls_ValaCompileErrors _this;
+ public void show ( GLib.ListStore ls , Gtk.Widget onbtn) {
+
+
+ //this.el.present();
+ //this.el.popup();
+ this.notices = ls;
+
+ //print("looking for %s\n", id);
+ // loop through parent childnre
+
+
+ this.tree.el.hide(); //<< very important!!!
+
+ // store.set_sort_column_id(0,Gtk.SortType.ASCENDING);
+
+ var win = this.window.el;
+ var w = win.get_width();
+ var h = win.get_height();
+
+
+
+ // left tree = 250, editor area = 500?
+
+ // min 450?
+ var new_w = int.min(650, 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));
+
+
+ // this.el.set_relative_to(onbtn);
+ //Gtk.Allocation rect;
+ //onbtn.get_allocation(out rect);
+ //this.el.set_pointing_to(rect);
+ this.el.present();
+ this.el.popup();
+
+
+ var tm = new Gtk.TreeListModel(
+ ls, //..... << that's our store..
+ false, // passthru
+ false, // autexpand
+ (item) => {
+
+ return ((Palete.CompileError)item).lines;
+
+ }
+ );
+
+ _this.model.el = tm;
+ _this.sortmodel.el.set_model(tm);
+
+ this.tree.el.show();
+
+ //if (expand != null) {
+ // _this.compile_tree.el.expand_row( store.get_path(expand) , true);
+ // }
+
+ // this.hpane.el.set_position( 0);
+ }
+ public class Xcls_compile_view : Object
+ {
+ public Gtk.Box el;
+ private Xcls_ValaCompileErrors _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Box3(Xcls_ValaCompileErrors _owner )
+ // ctor
+ public Xcls_compile_view(Xcls_ValaCompileErrors _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 = false;
+ var child_1 = new Xcls_ScrolledWindow3( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_ScrolledWindow3 : Object
{
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+ public Gtk.ScrolledWindow el;
+ private Xcls_ValaCompileErrors _this;
- // my vars (dec)
- // set gobject values
- var child_0 = new Xcls_Button4( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true,true,0 );
- }
+ // my vars (def)
- // user defined functions
- }
- public class Xcls_Button4 : Object
- {
- public Gtk.Button el;
- private Xcls_ValaCompileErrors _this;
+ // ctor
+ public Xcls_ScrolledWindow3(Xcls_ValaCompileErrors _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.ScrolledWindow();
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ new Xcls_tree( _this );
+ this.el.set_child ( _this.tree.el );
- // ctor
- public Xcls_Button4(Xcls_ValaCompileErrors _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
+ // init method
- // my vars (dec)
+ {
+ this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+
+
+ }
+ }
- // set gobject values
- this.el.label = "Compile and Run ";
+ // user defined functions
}
+ public class Xcls_tree : Object
+ {
+ public Gtk.ColumnView el;
+ private Xcls_ValaCompileErrors _this;
- // user defined functions
- }
+ // my vars (def)
- public class Xcls_ScrolledWindow5 : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_ValaCompileErrors _this;
+ // ctor
+ public Xcls_tree(Xcls_ValaCompileErrors _owner )
+ {
+ _this = _owner;
+ _this.tree = this;
+ new Xcls_selmodel( _this );
+ this.el = new Gtk.ColumnView( _this.selmodel.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ var child_2 = new Xcls_ColumnViewColumn8( _this );
+ child_2.ref();
+ this.el.append_column ( child_2.el );
+ var child_3 = new Xcls_GestureClick10( _this );
+ child_3.ref();
+ this.el.add_controller( child_3.el );
+ }
+ // user defined functions
+ }
+ public class Xcls_selmodel : Object
+ {
+ public Gtk.SingleSelection el;
+ private Xcls_ValaCompileErrors _this;
- // my vars (def)
- // ctor
- public Xcls_ScrolledWindow5(Xcls_ValaCompileErrors _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
+ // my vars (def)
- // my vars (dec)
+ // ctor
+ public Xcls_selmodel(Xcls_ValaCompileErrors _owner )
+ {
+ _this = _owner;
+ _this.selmodel = this;
+ new Xcls_sortmodel( _this );
+ this.el = new Gtk.SingleSelection( _this.sortmodel.el );
- // set gobject values
- var child_0 = new Xcls_compile_tree( _this );
- child_0.ref();
- this.el.add ( child_0.el );
+ // my vars (dec)
- // init method
+ // set gobject values
+ }
- {
- this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
-
+ // user defined functions
+ public Json.Object 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 (Json.Object)tr.get_item();
+
}
}
+ public class Xcls_sortmodel : Object
+ {
+ public Gtk.SortListModel el;
+ private Xcls_ValaCompileErrors _this;
- // user defined functions
- }
- public class Xcls_compile_tree : Object
- {
- public Gtk.TreeView el;
- private Xcls_ValaCompileErrors _this;
+ // my vars (def)
- // my vars (def)
- public Gtk.CssProvider css;
+ // ctor
+ public Xcls_sortmodel(Xcls_ValaCompileErrors _owner )
+ {
+ _this = _owner;
+ _this.sortmodel = this;
+ new Xcls_model( _this );
+ this.el = new Gtk.SortListModel( _this.model.el, null );
- // ctor
- public Xcls_compile_tree(Xcls_ValaCompileErrors _owner )
- {
- _this = _owner;
- _this.compile_tree = this;
- this.el = new Gtk.TreeView();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ }
- // set gobject values
- this.el.name = "compile-erros-view";
- var child_0 = new Xcls_compile_result_store( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_column( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
+ // user defined functions
+ public Json.Object getNodeAt (uint row) {
+
+ var tr = (Gtk.TreeListRow)this.el.get_item(row);
+
+
+ // GLib.debug("get_item (2) = %s", a.get_type().name());
+
+
+ return (Json.Object)tr.get_item();
+
+ }
+ }
+ public class Xcls_model : Object
+ {
+ public Gtk.TreeListModel el;
+ private Xcls_ValaCompileErrors _this;
- // init method
+ // my vars (def)
+
+ // ctor
+ public Xcls_model(Xcls_ValaCompileErrors _owner )
{
- this.css = new Gtk.CssProvider();
- try {
- this.css.load_from_data("#compile-erros-view { font-size: 12px;}");
- } catch (Error e) {}
- this.el.get_style_context().add_provider(this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
-
+ _this = _owner;
+ _this.model = this;
+ this.el = new Gtk.TreeListModel(
+ new GLib.ListStore(typeof(Palete.CompileError)), //..... << that's our store..
+ false, // passthru
+ false, // autexpand
+ (item) => {
+
+
+ return ((Palete.CompileError)item).lines;
+
+ }
+
+
+);
+
+ // my vars (dec)
+
+ // set gobject values
}
- //listeners
- this.el.button_press_event.connect( ( ev) => {
-
- Gtk.TreeViewColumn col;
- int cell_x;
- int cell_y;
- Gtk.TreePath path;
- if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
- print("nothing selected on click");
-
- return false; //not on a element.
- }
-
-
- // right click.
- if (ev.type != Gdk.EventType.2BUTTON_PRESS || ev.button != 1 ) {
- // show popup!.
-
-
- return false;
- }
- Gtk.TreeIter iter;
- var mod = _this.compile_result_store.el;
- mod.get_iter (out iter, path);
-
-
-
- // var val = "";
- GLib.Value value;
- _this.compile_result_store.el.get_value(iter, 3, out value);
- var fname = (string)value;
- GLib.Value lvalue;
- _this.compile_result_store.el.get_value(iter, 1, out lvalue);
- var line = (int) lvalue;
-
- print("open %s @ %d\n", fname, line);
-
-
- var bjsf = "";
- try {
- var regex = new Regex("\\.vala$");
-
-
- bjsf = regex.replace(fname,fname.length , 0 , ".bjs");
- } catch (GLib.RegexError e) {
- return false;
- }
- var p = _this.window.project;
-
-
-
- var jsr = p.getByPath(bjsf);
- if (jsr != null) {
- _this.window.windowstate.fileViewOpen(jsr, true, line);
-
- return false;
-
- }
- try {
- var pf = JsRender.JsRender.factory("PlainFile", p, fname);
- _this.window.windowstate.fileViewOpen(pf, true, line);
- } catch (JsRender.Error e) {}
- // try hiding the left nav..
-
- return false;
-
- });
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_compile_result_store : Object
- {
- public Gtk.TreeStore el;
- private Xcls_ValaCompileErrors _this;
-
- // my vars (def)
- // ctor
- public Xcls_compile_result_store(Xcls_ValaCompileErrors _owner )
+ public class Xcls_ColumnViewColumn8 : Object
{
- _this = _owner;
- _this.compile_result_store = this;
- this.el = new Gtk.TreeStore.newv( { typeof(string),
- typeof(int),
- typeof(string),
- typeof(string) } );
+ public Gtk.ColumnViewColumn el;
+ private Xcls_ValaCompileErrors _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
-
- public class Xcls_column : Object
- {
- public Gtk.TreeViewColumn el;
- private Xcls_ValaCompileErrors _this;
+ // ctor
+ public Xcls_ColumnViewColumn8(Xcls_ValaCompileErrors _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_SignalListItemFactory9( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Compile Result", child_1.el );
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ this.el.expand = true;
+ this.el.resizable = true;
+ }
- // ctor
- public Xcls_column(Xcls_ValaCompileErrors _owner )
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory9 : Object
{
- _this = _owner;
- _this.column = this;
- this.el = new Gtk.TreeViewColumn();
-
- // my vars (dec)
+ public Gtk.SignalListItemFactory el;
+ private Xcls_ValaCompileErrors _this;
- // set gobject values
- this.el.title = "Compile output";
- var child_0 = new Xcls_renderer( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
- // init method
+ // my vars (def)
+ // ctor
+ public Xcls_SignalListItemFactory9(Xcls_ValaCompileErrors _owner )
{
- this.el.add_attribute(_this.renderer.el , "markup", 2 );
-
+ _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 np = (Palete.CompileError) lr.get_item();
+
+
+ //GLib.debug("change %s to %s", lbl.label, np.name);
+ lbl.label = np.line_msg;
+ //lbl.tooltip_markup = np.to_property_option_tooltip();
+
+ expand.set_hide_expander( np.lines.n_items < 1);
+ expand.set_list_row(lr);
+
+ // expand current file.
+ if (_this.window.windowstate.file.path == np.file.path) {
+ lr.expanded = true;
+ }
+
+ // bind image...
+
+ });
}
+
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_renderer : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_ValaCompileErrors _this;
+ public class Xcls_GestureClick10 : Object
+ {
+ public Gtk.GestureClick el;
+ private Xcls_ValaCompileErrors _this;
- // my vars (def)
- // ctor
- public Xcls_renderer(Xcls_ValaCompileErrors _owner )
- {
- _this = _owner;
- _this.renderer = this;
- this.el = new Gtk.CellRendererText();
+ // my vars (def)
- // my vars (dec)
+ // ctor
+ public Xcls_GestureClick10(Xcls_ValaCompileErrors _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.GestureClick();
- // set gobject values
- }
+ // my vars (dec)
- // user defined functions
- }
+ // set gobject values
+ this.el.button = 0;
+ //listeners
+ this.el.pressed.connect( (n_press, x, y) => {
+
+ if (n_press < 2) { /// doubleclick?
+ return;
+ }
+
+
+
+ // use selection?!
+ var tr = (Gtk.TreeListRow)_this.selmodel.el.selected_item;
+ //GLib.debug("SELECTED = %s", tr.item.get_type().name());
+ var ce = (Palete.CompileError) tr.item;
+
+ if (ce.line < 0) {
+ // did not click on a line.
+ return;
+ }
+
+
+ var fname = ce.parent.file;
+ var line = ce.line;
+ GLib.debug("open %s @ %d\n", ce.parent.file.path, ce.line);
+
+
+ var bjsf = "";
+ try {
+ var regex = new Regex("\\.vala$");
+
+
+ bjsf = regex.replace(fname.path,fname.path.length , 0 , ".bjs");
+ } catch (GLib.RegexError e) {
+ return;
+ }
+ var p = _this.window.project;
+
+
+
+ var jsr = p.getByPath(bjsf);
+ if (jsr != null) {
+ _this.window.windowstate.fileViewOpen(jsr, true, line);
+
+ if (jsr.path == _this.window.windowstate.file.path) {
+ _this.el.hide();
+ }
+
+
+ return;
+
+ }
+ try {
+ var pf = JsRender.JsRender.factory("PlainFile", p, fname.path);
+ _this.window.windowstate.fileViewOpen(pf, true, line);
+ } catch (JsRender.Error e) {}
+ // try hiding the left nav..
+
+ return;
+
+ });
+ }
+
+ // user defined functions
+ }
-}
+ }
{
"build_module" : "builder",
+ "gen_extended" : false,
"items" : [
{
"$ xns" : "Gtk",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
+ "* pack" : "set_child",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool hexpand" : true,
+ "bool vexpand" : true,
"gboolean homogeneous" : false,
"id" : "compile_view",
"items" : [
"}",
""
],
- "* pack" : "pack_end,true,true,0",
"bool hexpand" : true,
+ "bool vexpand" : true,
"items" : [
{
- "$ xns" : "Gtk",
+ "$ xns" : "GtkSource",
"* init" : [
"{",
"",
" \tthis.css = new Gtk.CssProvider();",
- "\ttry {",
- "\t\tthis.css.load_from_data(\"#compile-results-view { font: 10px Monospace;}\");",
- "\t} catch (Error e) {}",
- "\tthis.el.get_style_context().add_provider(this.css,",
- "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION);",
- "\t ",
+ "\t ",
+ "\tthis.css.load_from_string(",
+ "\t\t\"#compile-results-view { font: 10px monospace ;}\"",
+ "\t);",
+ "\t ",
+ "\t\t\tGtk.StyleContext.add_provider_for_display(",
+ "\t\tthis.el.get_display(),",
+ "\t\tthis.css,",
+ "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
+ "\t);",
+ "\t\t",
"",
"}",
""
],
- "* pack" : "add",
+ "* prop" : "child",
"Gtk.CssProvider css" : "",
"bool editable" : false,
+ "bool hexpand" : true,
"bool show_line_numbers" : false,
+ "bool vexpand" : true,
"id" : "sourceview",
"string name" : "compile-results-view",
- "xtype" : "SourceView"
+ "xtype" : "View"
}
],
"xtype" : "ScrolledWindow"
}
],
"xtype" : "Popover",
- "| void addLine" : [
- "(string str) {",
- "\t",
- "\tif (this.window.windowstate.project.fn != BuilderApplication.valasource.file.project.fn) {",
- "\t\t// not our project.",
- "\t\treturn;",
- "\t}",
- "\t",
- "\tvar buf = (Gtk.SourceBuffer)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) {",
- "\tint w, h;",
- " ",
- "\tthis.window.el.get_size(out w, out h);",
- " ",
+ "\tvar 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);",
" new_w = w-100;",
" }",
" this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));",
- " ",
+ " \tif (this.el.parent == null) {",
+ "\t\tthis.el.set_parent(win);",
+ "\t}",
+ " // Gtk.Allocation rect;",
+ "\t//onbtn.get_allocation(out rect);",
+ " //this.el.set_pointing_to(rect);",
"",
- " if (this.el.relative_to == null) {",
- " this.el.set_relative_to(onbtn);",
- " }",
- " this.el.show_all();",
+ " this.el.popup();",
" // not sure why..",
" ",
" if (reset) {",
- "\t\tvar buf = (Gtk.SourceBuffer)this.sourceview.el.get_buffer();",
+ "\t\tvar buf = (GtkSource.Buffer)this.sourceview.el.get_buffer();",
"\t\tbuf.set_text(\"\",0);",
"\t}",
" ",
- " while(Gtk.events_pending()) { ",
- " Gtk.main_iteration();",
- " }",
" ",
" ",
" ",
"}",
""
+ ],
+ "| 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);",
+ " */",
+ "}",
+ ""
]
}
],
- "modOrder" : "",
- "name" : "ValaCompileResults",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/ValaCompileResults.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "ValaCompileResults"
}
\ No newline at end of file
-static Xcls_ValaCompileResults _ValaCompileResults;
+ static Xcls_ValaCompileResults _ValaCompileResults;
-public class Xcls_ValaCompileResults : Object
-{
- public Gtk.Popover el;
- private Xcls_ValaCompileResults _this;
-
- public static Xcls_ValaCompileResults singleton()
+ public class Xcls_ValaCompileResults : Object
{
- if (_ValaCompileResults == null) {
- _ValaCompileResults= new Xcls_ValaCompileResults();
- }
- return _ValaCompileResults;
- }
- public Xcls_compile_view compile_view;
- public Xcls_sourceview sourceview;
-
- // my vars (def)
- public Xcls_MainWindow window;
- public bool active;
-
- // ctor
- public Xcls_ValaCompileResults()
- {
- _this = this;
- this.el = new Gtk.Popover( null );
-
- // my vars (dec)
- this.active = true;
-
- // set gobject values
- this.el.width_request = 600;
- this.el.height_request = 400;
- this.el.modal = true;
- this.el.position = Gtk.PositionType.TOP;
- var child_0 = new Xcls_compile_view( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- }
-
- // user defined functions
- public void show ( Gtk.Widget onbtn, bool reset) {
- int w, h;
-
- this.window.el.get_size(out w, out h);
-
- // 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.relative_to == null) {
- this.el.set_relative_to(onbtn);
- }
- this.el.show_all();
- // not sure why..
-
- if (reset) {
- var buf = (Gtk.SourceBuffer)this.sourceview.el.get_buffer();
- buf.set_text("",0);
- }
-
- while(Gtk.events_pending()) {
- Gtk.main_iteration();
- }
-
-
-
- }
- public void addLine (string str) {
-
- if (this.window.windowstate.project.fn != BuilderApplication.valasource.file.project.fn) {
- // not our project.
- return;
- }
-
- var buf = (Gtk.SourceBuffer)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;
+ 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_compile_view(Xcls_ValaCompileResults _owner )
+ public Xcls_ValaCompileResults()
{
- _this = _owner;
- _this.compile_view = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ _this = this;
+ this.el = new Gtk.Popover();
// my vars (dec)
+ this.modal = true;
+ this.active = true;
// set gobject values
- this.el.homogeneous = false;
- var child_0 = new Xcls_ScrolledWindow3( _this );
- child_0.ref();
- this.el.pack_end ( child_0.el , true,true,0 );
+ 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 class Xcls_ScrolledWindow3 : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_ValaCompileResults _this;
+ 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)
+ // my vars (def)
- // ctor
- public Xcls_ScrolledWindow3(Xcls_ValaCompileResults _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
+ // 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 );
+ }
- // my vars (dec)
+ // user defined functions
+ }
+ public class Xcls_ScrolledWindow3 : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private Xcls_ValaCompileResults _this;
- // set gobject values
- this.el.hexpand = true;
- var child_0 = new Xcls_sourceview( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- // init method
+ // my vars (def)
+ // ctor
+ public Xcls_ScrolledWindow3(Xcls_ValaCompileResults _owner )
{
- this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
-
-
- }
- }
+ _this = _owner;
+ this.el = new Gtk.ScrolledWindow();
- // user defined functions
- }
- public class Xcls_sourceview : Object
- {
- public Gtk.SourceView el;
- private Xcls_ValaCompileResults _this;
+ // my vars (dec)
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ new Xcls_sourceview( _this );
+ this.el.child = _this.sourceview.el;
- // my vars (def)
- public Gtk.CssProvider css;
+ // init method
- // ctor
- public Xcls_sourceview(Xcls_ValaCompileResults _owner )
- {
- _this = _owner;
- _this.sourceview = this;
- this.el = new Gtk.SourceView();
+ {
+ this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+
+
+ }
+ }
- // my vars (dec)
+ // user defined functions
+ }
+ public class Xcls_sourceview : Object
+ {
+ public GtkSource.View el;
+ private Xcls_ValaCompileResults _this;
- // set gobject values
- this.el.name = "compile-results-view";
- this.el.editable = false;
- this.el.show_line_numbers = false;
- // init method
+ // my vars (def)
+ public Gtk.CssProvider css;
+ // ctor
+ public Xcls_sourceview(Xcls_ValaCompileResults _owner )
{
-
- this.css = new Gtk.CssProvider();
- try {
- this.css.load_from_data("#compile-results-view { font: 10px Monospace;}");
- } catch (Error e) {}
- this.el.get_style_context().add_provider(this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
-
+ _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
- }
+ // user defined functions
+ }
-}
+ }
+++ /dev/null
-{
- "build_module" : "builder",
- "items" : [
- {
- "# Project.Gtk project" : "null",
- "# Xcls_MainWindow window" : "null",
- "$ xns" : "Gtk",
- "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
- "bool hexpand" : true,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,true,true,0",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : false,
- "id" : "label_global",
- "utf8 label" : "Global",
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : false,
- "id" : "label_targets",
- "utf8 label" : "Targets",
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append_page,_this.label_global.el",
- "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
- "gboolean homogeneous" : false,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "utf8 label" : "compile flags",
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "id" : "compile_flags",
- "listeners" : {
- "changed" : [
- "() => {",
- " ",
- " _this.project.compilegroups.get(\"_default_\").compile_flags = this.el.text;",
- " _this.project.writeConfig();",
- "// _this.project.save();",
- "",
- "}"
- ]
- },
- "utf8 placeholder_text" : "eg. -g --valasrc $BASEDIR ",
- "xtype" : "Entry"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,true,true,0",
- "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "int position" : 300,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "bool hexpand" : true,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "gboolean headers_visible" : true,
- "items" : [
- {
- "$ columns" : [
- " typeof(string), // 0 key type",
- " typeof(bool)"
- ],
- "$ n_columns" : 2,
- "$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "default_packages_tree_store",
- "xtype" : "ListStore",
- "| void load" : [
- "() {",
- " ",
- " var def = _this.project.compilegroups.get(\"_default_\");",
- " var items = def.packages;",
- " ",
- " this.el.clear();",
- " var pal = (Palete.Gtk) Palete.factory(\"Gtk\");",
- " var pkgs = pal.packages(_this.project);",
- " print(\"ValaProjectSettings:packages load %d\\n\", pkgs.size);",
- "",
- " Gtk.TreeIter citer;",
- "",
- " for(var i =0 ; i < pkgs.size; i++) {",
- " this.el.append(out citer); ",
- " ",
- " this.el.set_value(citer, 0, pkgs.get(i) ); // title ",
- " this.el.set_value(citer, 1, items.contains(pkgs.get(i)) );",
- " }",
- " this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
- " ",
- "}",
- ""
- ]
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- " ",
- " this.el.add_attribute(_this.packages_render.el , \"text\", 0 );",
- " "
- ],
- "* pack" : "append_column",
- "gboolean expand" : true,
- "gboolean resizable" : true,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false",
- "id" : "packages_render",
- "xtype" : "CellRendererText"
- }
- ],
- "utf8 title" : "package name",
- "xtype" : "TreeViewColumn"
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- "{",
- " this.el.add_attribute(_this.packages_render_use.el , \"active\", 1 );",
- " }"
- ],
- "* pack" : "append_column",
- "gboolean resizable" : false,
- "gint fixed_width" : 50,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false",
- "gboolean activatable" : true,
- "id" : "packages_render_use",
- "listeners" : {
- "toggled" : [
- "( path_string) => { ",
- " var m = _this.default_packages_tree_store.el;",
- " Gtk.TreeIter iter;",
- " Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);",
- " m.get_iter (out iter, path);",
- " GLib.Value val;",
- " m.get_value(iter, 1, out val);",
- " m.set_value(iter, 1, ((bool) val) ? false :true); ",
- " GLib.Value fval; ",
- " m.get_value(iter, 0, out fval);",
- " var fn = (string)fval;",
- " ",
- " var def = _this.project.compilegroups.get(\"_default_\");",
- " var items = def.packages;",
- " if ((bool)val) {",
- " // renive",
- " items.remove(fn);",
- " } else {",
- " items.add(fn);",
- " }",
- " ",
- "}"
- ]
- },
- "xtype" : "CellRendererToggle"
- }
- ],
- "utf8 title" : "use",
- "xtype" : "TreeViewColumn"
- }
- ],
- "string id" : "default_packages_tree",
- "xtype" : "TreeView"
- }
- ],
- "xtype" : "ScrolledWindow"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add2",
- "bool hexpand" : true,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "gboolean headers_visible" : true,
- "id" : "default_directory_tree",
- "items" : [
- {
- "$ columns" : [
- " typeof(string)",
- " "
- ],
- "$ n_columns" : 1,
- "$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "default_directory_tree_store",
- "xtype" : "ListStore",
- "| void load" : [
- "() {",
- " ",
- " this.el.clear();",
- " ",
- " ",
- " var def = _this.project.compilegroups.get(\"_default_\");",
- " var items = def.sources;",
- " ",
- " ",
- " Gtk.TreeIter citer;",
- "",
- " for(var i =0 ; i < items.size; i++) {",
- " this.el.append(out citer); ",
- " ",
- " this.el.set_value(citer, 0, items.get(i) ); // title ",
- " //this.el.set_value(citer, 1, items.get(i) );",
- " }",
- " this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
- " ",
- "}",
- ""
- ]
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- "",
- " this.el.add_attribute(_this.directory_render.el , \"text\", 0 );",
- " "
- ],
- "* pack" : "append_column",
- "gboolean resizable" : true,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false",
- "id" : "directory_render",
- "xtype" : "CellRendererText"
- }
- ],
- "utf8 title" : "Available Directories (right click to add)",
- "xtype" : "TreeViewColumn"
- }
- ],
- "listeners" : {
- "button_press_event" : [
- " ( ev) => {",
- " //console.log(\"button press?\");",
- " ",
- " ",
- " if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) {",
- " //print(\"click\" + ev.type);",
- " return false;",
- " }",
- " //Gtk.TreePath res;",
- " //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {",
- " // return true;",
- " //}",
- " ",
- " // this.el.get_selection().select_path(res);",
- " ",
- " //if (!this.get('/LeftTreeMenu').el) { ",
- " // this.get('/LeftTreeMenu').init(); ",
- " // }",
- " ",
- " _this.default_directory_menu.el.set_screen(Gdk.Screen.get_default());",
- " _this.default_directory_menu.el.show_all();",
- " _this.default_directory_menu.el.popup(null, null, null, 3, ev.time);",
- " // print(\"click:\" + res.path.to_string());",
- " return true;",
- "}"
- ]
- },
- "xtype" : "TreeView"
- },
- {
- "$ xns" : "Gtk",
- "id" : "default_directory_menu",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "listeners" : {
- "activate" : [
- "() => {",
- " ",
- " var chooser = new Gtk.FileChooserDialog (",
- "\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.SELECT_FOLDER ,",
- "\t\"_Cancel\",",
- "\tGtk.ResponseType.CANCEL,",
- "\t\"_Add\",",
- "\tGtk.ResponseType.ACCEPT);",
- " if (chooser.run () != Gtk.ResponseType.ACCEPT) {",
- " chooser.close ();",
- " return;",
- " }",
- " chooser.close ();",
- " // add the directory..",
- " var fn = _this.project.relPath(chooser.get_filename());",
- " _this.project.compilegroups.get(\"_default_\").sources.add(fn);",
- " _this.default_directory_tree_store.load();",
- "}"
- ]
- },
- "utf8 label" : "Add Directory",
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "listeners" : {
- "activate" : [
- "() => {",
- " ",
- " var chooser = new Gtk.FileChooserDialog (",
- "\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.OPEN ,",
- "\t\"_Cancel\",",
- "\tGtk.ResponseType.CANCEL,",
- "\t\"_Add\",",
- "\tGtk.ResponseType.ACCEPT);",
- " if (chooser.run () != Gtk.ResponseType.ACCEPT) {",
- " chooser.close ();",
- " return;",
- " }",
- " chooser.close ();",
- " // add the directory..",
- " var fn = _this.project.relPath(chooser.get_filename());",
- " _this.project.compilegroups.get(\"_default_\").sources.add(fn);",
- " _this.default_directory_tree_store.load();",
- "}"
- ]
- },
- "utf8 label" : "Add File",
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "xtype" : "SeparatorMenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "listeners" : {
- "activate" : [
- "() => {",
- " ",
- " //",
- " Gtk.TreeModel mod;",
- " Gtk.TreeIter iter;",
- " if (!_this.default_directory_tree.el.get_selection().get_selected(out mod, out iter)) {",
- " print(\"nothing selected\\n\");",
- " return;",
- " }",
- "",
- " ",
- " // add the directory..",
- " ",
- " ",
- " GLib.Value val;",
- " mod.get_value(iter,0, out val);",
- " var fn = (string) val;",
- " ",
- " print(\"remove: %s\\n\", fn);",
- " if (!_this.project.compilegroups.get(\"_default_\").sources.remove(fn)) {",
- " print(\"remove failed\");",
- " }",
- " _this.default_directory_tree_store.load();",
- "}"
- ]
- },
- "utf8 label" : "Remove File/Directory",
- "xtype" : "MenuItem"
- }
- ],
- "xtype" : "Menu"
- }
- ],
- "xtype" : "ScrolledWindow"
- }
- ],
- "xtype" : "Paned"
- }
- ],
- "xtype" : "Box"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append_page,_this.label_targets.el",
- "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "gint position" : 300,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* init" : [
- "{ ",
- "this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
- "",
- "}",
- ""
- ],
- "* pack" : "add1",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "id" : "targets_tree_menu",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "listeners" : {
- "activate" : [
- "() => {",
- " ",
- " if (_this.project.compilegroups.has_key(\"NEW GROUP\")) {",
- " return;",
- " }",
- " ",
- " // add the directory..",
- " ",
- " _this.project.compilegroups.set(\"NEW GROUP\", new Project.GtkValaSettings(\"NEW GROUP\"));",
- " _this.targets_tree_store.load();",
- "}"
- ]
- },
- "utf8 label" : "Add Compile Target",
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "xtype" : "SeparatorMenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "listeners" : {
- "activate" : [
- "() => {",
- " ",
- " //",
- " Gtk.TreeModel mod;",
- " Gtk.TreeIter iter;",
- " if (!_this.targets_tree.el.get_selection().get_selected(out mod, out iter)) {",
- " print(\"nothing selected\\n\");",
- " return;",
- " }",
- "",
- " ",
- " // add the directory..",
- " ",
- " ",
- " GLib.Value val;",
- " mod.get_value(iter,0, out val);",
- " var fn = (string) val;",
- " ",
- " print(\"remove: %s\\n\", fn);",
- " if (!_this.project.compilegroups.unset(fn)) {",
- " print(\"remove failed\");",
- " }",
- " _this.targets_tree_store.load();",
- "}"
- ]
- },
- "utf8 label" : "Remove Target",
- "xtype" : "MenuItem"
- }
- ],
- "xtype" : "Menu"
- },
- {
- "# string cursor" : "",
- "$ xns" : "Gtk",
- "* pack" : "add",
- "id" : "targets_tree",
- "items" : [
- {
- "$ columns" : [
- " typeof(string), // 0 key type",
- " typeof(string) // ??",
- " "
- ],
- "$ n_columns" : 2,
- "$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "targets_tree_store",
- "xtype" : "ListStore",
- "| void load" : [
- "() {",
- " ",
- " this.el.clear();",
- " ",
- " ",
- " var cg = _this.project.compilegroups;",
- " ",
- " _this.targets_tree.cursor = \"\";",
- " Gtk.TreeIter citer;",
- " var iter = cg.map_iterator();",
- " while(iter.next()) {",
- " var key = iter.get_key();",
- " if (key == \"_default_\") {",
- " continue;",
- " }",
- " ",
- " this.el.append(out citer); ",
- " ",
- " this.el.set_value(citer, 0, key ); // title ",
- " //this.el.set_value(citer, 1, items.get(i) );",
- " };",
- " this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
- " _this.set_vbox.el.hide();",
- "}",
- ""
- ]
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- " {",
- " this.el.add_attribute(_this.targets_render.el , \"text\", 0 );",
- " }"
- ],
- "* pack" : "append_column",
- "gboolean resizable" : true,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false",
- "gboolean editable" : true,
- "id" : "targets_render",
- "listeners" : {
- "edited" : [
- " (path, newtext) => {",
- " ",
- " Gtk.TreeIter iter;",
- " _this.targets_tree_store.el.get_iter(out iter, new Gtk.TreePath.from_string(path));",
- " GLib.Value gval;",
- " _this.targets_tree_store.el.get_value(iter,0, out gval);",
- " var oldval = (string)gval;",
- " if (oldval == newtext) {",
- " return;",
- " }",
- " var cg = _this.project.compilegroups.get(oldval);",
- " cg.name = newtext;",
- " _this.project.compilegroups.unset(oldval);",
- " _this.project.compilegroups.set(newtext, cg);",
- " _this.targets_tree_store.load();",
- " }"
- ]
- },
- "xtype" : "CellRendererText"
- }
- ],
- "utf8 title" : "name",
- "xtype" : "TreeViewColumn"
- }
- ],
- "listeners" : {
- "button_press_event" : [
- " ( ev) => {",
- " //console.log(\"button press?\");",
- " ",
- " ",
- " if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) {",
- " //print(\"click\" + ev.type);",
- " return false;",
- " }",
- " //Gtk.TreePath res;",
- " //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {",
- " // return true;",
- " //}",
- " ",
- " // this.el.get_selection().select_path(res);",
- " ",
- " //if (!this.get('/LeftTreeMenu').el) { ",
- " // this.get('/LeftTreeMenu').init(); ",
- " // }",
- " ",
- " _this.targets_tree_menu.el.set_screen(Gdk.Screen.get_default());",
- " _this.targets_tree_menu.el.show_all();",
- " _this.targets_tree_menu.el.popup(null, null, null, 3, ev.time);",
- " // print(\"click:\" + res.path.to_string());",
- " return true;",
- "}"
- ],
- "cursor_changed" : [
- " ( ) => {",
- "",
- " if (this.cursor != \"\") {",
- " // save the values..",
- " }",
- " ",
- " // load the new values.",
- " ",
- "",
- " Gtk.TreeModel mod;",
- " Gtk.TreeIter iter;",
- " if (!this.el.get_selection().get_selected(out mod, out iter)) {",
- " print(\"nothing selected\\n\");",
- " // should disable the right hand side..",
- " _this.set_vbox.el.hide();",
- " return;",
- " }",
- " _this.set_vbox.el.show();",
- " ",
- " // add the directory..",
- " ",
- " ",
- " GLib.Value val;",
- " mod.get_value(iter,0, out val);",
- " var fn = (string) val;",
- " ",
- " this.cursor = fn;",
- " var cg = _this.project.compilegroups.get(fn);",
- " ",
- " _this.build_pack_target.el.set_text(cg.target_bin);",
- " _this.build_compile_flags.el.set_text(cg.compile_flags);",
- "\t\t_this.build_execute_args.el.set_text(cg.execute_args);",
- " ",
- " _this.set_vbox.cgroup = cg;",
- " _this.files_tree_store.update();",
- " ",
- " // load the srouces",
- " ",
- "",
- " }"
- ]
- },
- "xtype" : "TreeView"
- }
- ],
- "xtype" : "ScrolledWindow"
- },
- {
- "# Project.GtkValaSettings cgroup" : "null",
- "$ xns" : "Gtk",
- "* pack" : "add2",
- "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
- "gboolean homogeneous" : false,
- "id" : "set_vbox",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "utf8 label" : "target filename",
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "id" : "build_pack_target",
- "listeners" : {
- "changed" : [
- "() => {",
- " if (_this.targets_tree.cursor.length < 1) {",
- " return;",
- " }",
- " _this.project.compilegroups.get(_this.targets_tree.cursor).target_bin = this.el.text;",
- "}"
- ]
- },
- "xtype" : "Entry"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "utf8 label" : "compile flags",
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "id" : "build_compile_flags",
- "listeners" : {
- "changed" : [
- "() => {",
- " if (_this.targets_tree.cursor.length < 1) {",
- " return;",
- " }",
- " _this.project.compilegroups.get(_this.targets_tree.cursor).compile_flags = this.el.text;",
- "}"
- ]
- },
- "xtype" : "Entry"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "utf8 label" : "test argments - when run after a build",
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "id" : "build_execute_args",
- "listeners" : {
- "changed" : [
- "() => {",
- " if (_this.targets_tree.cursor.length < 1) {",
- " return;",
- " }",
- " _this.project.compilegroups.get(_this.targets_tree.cursor).execute_args = this.el.text;",
- "}"
- ]
- },
- "string placeholder_text" : "eg. -f somefile -g ",
- "xtype" : "Entry"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "utf8 label" : "Files to compile",
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,true,true,0",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "items" : [
- {
- "$ columns" : [
- " typeof(string), // 0 file name",
- " typeof(string), // 0 basename",
- " typeof(string), // type (dir orfile)",
- " typeof(bool) // is checked.",
- " "
- ],
- "$ n_columns" : 4,
- "$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "files_tree_store",
- "xtype" : "ListStore",
- "| void load" : [
- "() {",
- " ",
- " this.el.clear();",
- " ",
- " ",
- " var def = _this.project.compilegroups.get(\"_default_\");",
- " var items = def.sources;",
- " ",
- " ",
- " ",
- " ",
- " ",
- " Gtk.TreeIter citer;",
- "",
- " for(var i =0 ; i < items.size; i++) {",
- " ",
- " var files = _this.project.filesForCompile(items.get(i), false);",
- " if (files.size < 1) {",
- " continue;",
- " }",
- " ",
- " this.el.append(out citer); ",
- " ",
- " this.el.set_value(citer, 0, items.get(i) ); // title ",
- " this.el.set_value(citer, 1, \"<span foreground=\\\"green\\\" font_weight=\\\"bold\\\">\" + ",
- " GLib.Markup.escape_text(items.get(i)) + \"</span>\"",
- " ); // title ",
- " print(\"ADD item %s\", items.get(i));",
- " this.el.set_value(citer, 2, \"dir\"); // type ",
- " this.el.set_value(citer, 3, false ); // checked ",
- "",
- " ",
- " ",
- " for(var j =0 ; j < files.size; j++) {",
- " this.el.append(out citer); ",
- " print(\"ADD item %s\", files.get(j));",
- " this.el.set_value(citer, 0, files.get(j) ); // title ",
- " this.el.set_value(citer, 1, GLib.Markup.escape_text( Path.get_basename (files.get(j))) ); // title ",
- " this.el.set_value(citer, 2, \"file\"); // type ",
- " this.el.set_value(citer, 3, false ); // checked ",
- "",
- " }",
- " ",
- " ",
- " //this.el.set_value(citer, 1, items.get(i) );",
- " }",
- " this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
- " ",
- "}",
- " "
- ],
- "| void update" : [
- "() {",
- "",
- "",
- " Gtk.TreeIter citer;",
- "",
- " for(var i =0 ; i < this.el.iter_n_children(null); i++) {",
- " this.el.iter_nth_child(out citer,null,i);",
- "",
- " GLib.Value val;",
- " this.el.get_value(citer,0, out val);",
- " var fn = (string) val;",
- " ",
- " var active = false;",
- " if (_this.set_vbox.cgroup.sources.contains(fn)) {",
- " active = true;",
- " }",
- " ",
- " this.el.set_value(citer, 3, active ); // checked ",
- " }",
- "",
- "",
- "}",
- ""
- ],
- "| void updateDir" : [
- "(string dname, bool bval) {",
- " ",
- " Gtk.TreeIter citer;",
- "",
- " var cg = _this.set_vbox.cgroup;",
- " for(var i =0 ; i < this.el.iter_n_children(null); i++) {",
- " this.el.iter_nth_child(out citer,null,i);",
- "",
- " GLib.Value val;",
- " this.el.get_value(citer,0, out val);",
- " var fn = (string) val;",
- " ",
- " if ( Path.get_dirname (fn) == dname) {",
- " ",
- " this.el.set_value(citer, 3, bval ); // checked ",
- " ",
- " ",
- " ",
- " if (!bval) {",
- " // renive",
- " if (cg.sources.contains(fn)) {",
- " cg.sources.remove(fn);",
- " }",
- " } else {",
- " if (!cg.sources.contains(fn)) {",
- " cg.sources.add(fn);",
- " }",
- " }",
- " ",
- " ",
- " }",
- " }",
- "",
- "}",
- ""
- ]
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- "",
- " this.el.add_attribute(_this.files_render.el , \"markup\", 1 ); // basnemae",
- " ",
- "/* this.el.add_attribute(_this.files_render.el , \"markup\", 2 );",
- "*/"
- ],
- "* pack" : "append_column",
- "gboolean resizable" : true,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false",
- "id" : "files_render",
- "xtype" : "CellRendererText"
- }
- ],
- "utf8 title" : "name",
- "xtype" : "TreeViewColumn"
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- "{",
- " this.el.add_attribute(_this.files_render_use.el , \"active\", 3 );",
- " }"
- ],
- "* pack" : "append_column",
- "gboolean resizable" : false,
- "gint fixed_width" : 50,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false",
- "gboolean activatable" : true,
- "id" : "files_render_use",
- "listeners" : {
- "toggled" : [
- "( path_string) => { ",
- "",
- "",
- "",
- " var m = _this.files_tree_store.el;",
- " Gtk.TreeIter iter;",
- " Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);",
- " m.get_iter (out iter, path);",
- " GLib.Value val;",
- " m.get_value(iter, 3, out val);",
- " m.set_value(iter, 3, ((bool) val) ? false :true); ",
- " ",
- " // type.",
- " GLib.Value ftval; ",
- " m.get_value(iter, 2, out ftval);",
- " var ftype = (string)ftval; ",
- " ",
- " // full name... ",
- " GLib.Value fval; ",
- " m.get_value(iter, 0, out fval);",
- " var fn = (string)fval;",
- " ",
- " ",
- " var cg = _this.set_vbox.cgroup;",
- " // what's the sleected target?",
- " // update the list..",
- " // if ftype is a dir == then toggle all the bellow.",
- " ",
- " if (ftype == \"dir\") {",
- " _this.files_tree_store.updateDir(fn, ((bool) val) ? false :true);",
- " }",
- " ",
- " // if ftype is a file .. see if all the files in that directory are check and check the dir.",
- "",
- " ",
- " if ((bool)val) {",
- " // renive",
- " cg.sources.remove(fn);",
- " } else {",
- " cg.sources.add(fn);",
- " }",
- " ",
- "}"
- ]
- },
- "xtype" : "CellRendererToggle"
- }
- ],
- "utf8 title" : "use",
- "xtype" : "TreeViewColumn"
- }
- ],
- "string id" : "files_tree",
- "xtype" : "TreeView"
- }
- ],
- "xtype" : "ScrolledWindow"
- }
- ],
- "xtype" : "Box"
- }
- ],
- "xtype" : "Paned"
- }
- ],
- "xtype" : "Notebook"
- }
- ],
- "string id" : "ValaProjectSettings",
- "xtype" : "Box",
- "| void save" : [
- "() {",
- " this.project.writeConfig(); ",
- "}"
- ],
- "| void show" : [
- "(Project.Gtk project) {",
- " ",
- " ",
- " print(\"ValaProjectSettings show\\n\");",
- " ",
- " this.project= project;",
- "",
- " this.compile_flags.el.text = _this.project.compilegroups.get(\"_default_\").compile_flags;",
- " ",
- " this.default_directory_tree_store.load(); ",
- " this.default_packages_tree_store.load(); ",
- " this.targets_tree_store.load();",
- " this.files_tree_store.load();",
- "",
- "}",
- ""
- ]
- }
- ],
- "modOrder" : "",
- "name" : "ValaProjectSettings",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/ValaProjectSettings.bjs",
- "permname" : "",
- "title" : ""
-}
\ No newline at end of file
+++ /dev/null
-static ValaProjectSettings _ValaProjectSettings;
-
-public class ValaProjectSettings : Object
-{
- public Gtk.Box el;
- private ValaProjectSettings _this;
-
- public static ValaProjectSettings singleton()
- {
- if (_ValaProjectSettings == null) {
- _ValaProjectSettings= new ValaProjectSettings();
- }
- return _ValaProjectSettings;
- }
- public Xcls_label_global label_global;
- public Xcls_label_targets label_targets;
- public Xcls_compile_flags compile_flags;
- public Xcls_default_packages_tree_store default_packages_tree_store;
- public Xcls_packages_render packages_render;
- public Xcls_packages_render_use packages_render_use;
- public Xcls_default_directory_tree default_directory_tree;
- public Xcls_default_directory_tree_store default_directory_tree_store;
- public Xcls_directory_render directory_render;
- public Xcls_default_directory_menu default_directory_menu;
- public Xcls_targets_tree_menu targets_tree_menu;
- public Xcls_targets_tree targets_tree;
- public Xcls_targets_tree_store targets_tree_store;
- public Xcls_targets_render targets_render;
- public Xcls_set_vbox set_vbox;
- public Xcls_build_pack_target build_pack_target;
- public Xcls_build_compile_flags build_compile_flags;
- public Xcls_build_execute_args build_execute_args;
- public Xcls_files_tree_store files_tree_store;
- public Xcls_files_render files_render;
- public Xcls_files_render_use files_render_use;
-
- // my vars (def)
- public Project.Gtk project;
- public Xcls_MainWindow window;
-
- // ctor
- public ValaProjectSettings()
- {
- _this = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
- this.project = null;
- this.window = null;
-
- // set gobject values
- this.el.hexpand = true;
- var child_0 = new Xcls_Notebook2( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true,true,0 );
- }
-
- // user defined functions
- public void show (Project.Gtk project) {
-
-
- print("ValaProjectSettings show\n");
-
- this.project= project;
-
- this.compile_flags.el.text = _this.project.compilegroups.get("_default_").compile_flags;
-
- this.default_directory_tree_store.load();
- this.default_packages_tree_store.load();
- this.targets_tree_store.load();
- this.files_tree_store.load();
-
- }
- public void save () {
- this.project.writeConfig();
- }
- public class Xcls_Notebook2 : Object
- {
- public Gtk.Notebook el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Notebook2(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Notebook();
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_label_global( _this );
- child_0.ref();
- var child_1 = new Xcls_label_targets( _this );
- child_1.ref();
- var child_2 = new Xcls_Box5( _this );
- child_2.ref();
- this.el.append_page ( child_2.el , _this.label_global.el );
- var child_3 = new Xcls_Paned26( _this );
- child_3.ref();
- this.el.append_page ( child_3.el , _this.label_targets.el );
- }
-
- // user defined functions
- }
- public class Xcls_label_global : Object
- {
- public Gtk.Label el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_label_global(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.label_global = this;
- this.el = new Gtk.Label( "Global" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_label_targets : Object
- {
- public Gtk.Label el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_label_targets(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.label_targets = this;
- this.el = new Gtk.Label( "Targets" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_Box5 : Object
- {
- public Gtk.Box el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Box5(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- this.el.homogeneous = false;
- var child_0 = new Xcls_Label6( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,false,0 );
- var child_1 = new Xcls_compile_flags( _this );
- child_1.ref();
- this.el.pack_start ( child_1.el , false,false,0 );
- var child_2 = new Xcls_Paned8( _this );
- child_2.ref();
- this.el.pack_start ( child_2.el , true,true,0 );
- }
-
- // user defined functions
- }
- public class Xcls_Label6 : Object
- {
- public Gtk.Label el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label6(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "compile flags" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_compile_flags : Object
- {
- public Gtk.Entry el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_compile_flags(ValaProjectSettings _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.compilegroups.get("_default_").compile_flags = this.el.text;
- _this.project.writeConfig();
- // _this.project.save();
-
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Paned8 : Object
- {
- public Gtk.Paned el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Paned8(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
-
- // my vars (dec)
-
- // set gobject values
- this.el.position = 300;
- var child_0 = new Xcls_ScrolledWindow9( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_ScrolledWindow16( _this );
- child_1.ref();
- this.el.add2 ( child_1.el );
- }
-
- // user defined functions
- }
- public class Xcls_ScrolledWindow9 : Object
- {
- public Gtk.ScrolledWindow el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ScrolledWindow9(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- var child_0 = new Xcls_default_packages_tree( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- }
-
- // user defined functions
- }
- public class Xcls_default_packages_tree : Object
- {
- public Gtk.TreeView el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_default_packages_tree(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.TreeView();
-
- // my vars (dec)
-
- // set gobject values
- this.el.headers_visible = true;
- var child_0 = new Xcls_default_packages_tree_store( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_TreeViewColumn12( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
- var child_2 = new Xcls_TreeViewColumn14( _this );
- child_2.ref();
- this.el.append_column ( child_2.el );
- }
-
- // user defined functions
- }
- public class Xcls_default_packages_tree_store : Object
- {
- public Gtk.ListStore el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_default_packages_tree_store(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.default_packages_tree_store = this;
- this.el = new Gtk.ListStore( 2, typeof(string), // 0 key type
- typeof(bool) );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- public void load () {
-
- var def = _this.project.compilegroups.get("_default_");
- var items = def.packages;
-
- this.el.clear();
- var pal = (Palete.Gtk) Palete.factory("Gtk");
- var pkgs = pal.packages(_this.project);
- print("ValaProjectSettings:packages load %d\n", pkgs.size);
-
- Gtk.TreeIter citer;
-
- for(var i =0 ; i < pkgs.size; i++) {
- this.el.append(out citer);
-
- this.el.set_value(citer, 0, pkgs.get(i) ); // title
- this.el.set_value(citer, 1, items.contains(pkgs.get(i)) );
- }
- this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
-
- }
- }
-
- public class Xcls_TreeViewColumn12 : Object
- {
- public Gtk.TreeViewColumn el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_TreeViewColumn12(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.TreeViewColumn();
-
- // my vars (dec)
-
- // set gobject values
- this.el.title = "package name";
- this.el.expand = true;
- this.el.resizable = true;
- var child_0 = new Xcls_packages_render( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false );
-
- // init method
-
- this.el.add_attribute(_this.packages_render.el , "text", 0 );
- }
-
- // user defined functions
- }
- public class Xcls_packages_render : Object
- {
- public Gtk.CellRendererText el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_packages_render(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.packages_render = this;
- this.el = new Gtk.CellRendererText();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
- public class Xcls_TreeViewColumn14 : Object
- {
- public Gtk.TreeViewColumn el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_TreeViewColumn14(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.TreeViewColumn();
-
- // my vars (dec)
-
- // set gobject values
- this.el.title = "use";
- this.el.resizable = false;
- this.el.fixed_width = 50;
- var child_0 = new Xcls_packages_render_use( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false );
-
- // init method
-
- {
- this.el.add_attribute(_this.packages_render_use.el , "active", 1 );
- }
- }
-
- // user defined functions
- }
- public class Xcls_packages_render_use : Object
- {
- public Gtk.CellRendererToggle el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_packages_render_use(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.packages_render_use = this;
- this.el = new Gtk.CellRendererToggle();
-
- // my vars (dec)
-
- // set gobject values
- this.el.activatable = true;
-
- //listeners
- this.el.toggled.connect( ( path_string) => {
- var m = _this.default_packages_tree_store.el;
- Gtk.TreeIter iter;
- Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);
- m.get_iter (out iter, path);
- GLib.Value val;
- m.get_value(iter, 1, out val);
- m.set_value(iter, 1, ((bool) val) ? false :true);
- GLib.Value fval;
- m.get_value(iter, 0, out fval);
- var fn = (string)fval;
-
- var def = _this.project.compilegroups.get("_default_");
- var items = def.packages;
- if ((bool)val) {
- // renive
- items.remove(fn);
- } else {
- items.add(fn);
- }
-
- });
- }
-
- // user defined functions
- }
-
-
-
-
- public class Xcls_ScrolledWindow16 : Object
- {
- public Gtk.ScrolledWindow el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ScrolledWindow16(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- var child_0 = new Xcls_default_directory_tree( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_default_directory_menu( _this );
- child_1.ref();
- }
-
- // user defined functions
- }
- public class Xcls_default_directory_tree : Object
- {
- public Gtk.TreeView el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_default_directory_tree(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.default_directory_tree = this;
- this.el = new Gtk.TreeView();
-
- // my vars (dec)
-
- // set gobject values
- this.el.headers_visible = true;
- var child_0 = new Xcls_default_directory_tree_store( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_TreeViewColumn19( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
-
- //listeners
- this.el.button_press_event.connect( ( ev) => {
- //console.log("button press?");
-
-
- if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) {
- //print("click" + ev.type);
- return false;
- }
- //Gtk.TreePath res;
- //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {
- // return true;
- //}
-
- // this.el.get_selection().select_path(res);
-
- //if (!this.get('/LeftTreeMenu').el) {
- // this.get('/LeftTreeMenu').init();
- // }
-
- _this.default_directory_menu.el.set_screen(Gdk.Screen.get_default());
- _this.default_directory_menu.el.show_all();
- _this.default_directory_menu.el.popup(null, null, null, 3, ev.time);
- // print("click:" + res.path.to_string());
- return true;
- });
- }
-
- // user defined functions
- }
- public class Xcls_default_directory_tree_store : Object
- {
- public Gtk.ListStore el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_default_directory_tree_store(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.default_directory_tree_store = this;
- this.el = new Gtk.ListStore( 1, typeof(string)
- );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- public void load () {
-
- this.el.clear();
-
-
- var def = _this.project.compilegroups.get("_default_");
- var items = def.sources;
-
-
- Gtk.TreeIter citer;
-
- for(var i =0 ; i < items.size; i++) {
- this.el.append(out citer);
-
- this.el.set_value(citer, 0, items.get(i) ); // title
- //this.el.set_value(citer, 1, items.get(i) );
- }
- this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
-
- }
- }
-
- public class Xcls_TreeViewColumn19 : Object
- {
- public Gtk.TreeViewColumn el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_TreeViewColumn19(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.TreeViewColumn();
-
- // my vars (dec)
-
- // set gobject values
- this.el.title = "Available Directories (right click to add)";
- this.el.resizable = true;
- var child_0 = new Xcls_directory_render( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false );
-
- // init method
-
- this.el.add_attribute(_this.directory_render.el , "text", 0 );
- }
-
- // user defined functions
- }
- public class Xcls_directory_render : Object
- {
- public Gtk.CellRendererText el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_directory_render(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.directory_render = this;
- this.el = new Gtk.CellRendererText();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
-
- public class Xcls_default_directory_menu : Object
- {
- public Gtk.Menu el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_default_directory_menu(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.default_directory_menu = this;
- this.el = new Gtk.Menu();
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_MenuItem22( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_MenuItem23( _this );
- child_1.ref();
- this.el.add ( child_1.el );
- var child_2 = new Xcls_SeparatorMenuItem24( _this );
- child_2.ref();
- this.el.add ( child_2.el );
- var child_3 = new Xcls_MenuItem25( _this );
- child_3.ref();
- this.el.add ( child_3.el );
- }
-
- // user defined functions
- }
- public class Xcls_MenuItem22 : Object
- {
- public Gtk.MenuItem el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_MenuItem22(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Add Directory";
-
- //listeners
- this.el.activate.connect( () => {
-
- var chooser = new Gtk.FileChooserDialog (
- "Add a directory", _this.window.el, Gtk.FileChooserAction.SELECT_FOLDER ,
- "_Cancel",
- Gtk.ResponseType.CANCEL,
- "_Add",
- Gtk.ResponseType.ACCEPT);
- if (chooser.run () != Gtk.ResponseType.ACCEPT) {
- chooser.close ();
- return;
- }
- chooser.close ();
- // add the directory..
- var fn = _this.project.relPath(chooser.get_filename());
- _this.project.compilegroups.get("_default_").sources.add(fn);
- _this.default_directory_tree_store.load();
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_MenuItem23 : Object
- {
- public Gtk.MenuItem el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_MenuItem23(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Add File";
-
- //listeners
- this.el.activate.connect( () => {
-
- var chooser = new Gtk.FileChooserDialog (
- "Add a directory", _this.window.el, Gtk.FileChooserAction.OPEN ,
- "_Cancel",
- Gtk.ResponseType.CANCEL,
- "_Add",
- Gtk.ResponseType.ACCEPT);
- if (chooser.run () != Gtk.ResponseType.ACCEPT) {
- chooser.close ();
- return;
- }
- chooser.close ();
- // add the directory..
- var fn = _this.project.relPath(chooser.get_filename());
- _this.project.compilegroups.get("_default_").sources.add(fn);
- _this.default_directory_tree_store.load();
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_SeparatorMenuItem24 : Object
- {
- public Gtk.SeparatorMenuItem el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SeparatorMenuItem24(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.SeparatorMenuItem();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_MenuItem25 : Object
- {
- public Gtk.MenuItem el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_MenuItem25(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Remove File/Directory";
-
- //listeners
- this.el.activate.connect( () => {
-
- //
- Gtk.TreeModel mod;
- Gtk.TreeIter iter;
- if (!_this.default_directory_tree.el.get_selection().get_selected(out mod, out iter)) {
- print("nothing selected\n");
- return;
- }
-
-
- // add the directory..
-
-
- GLib.Value val;
- mod.get_value(iter,0, out val);
- var fn = (string) val;
-
- print("remove: %s\n", fn);
- if (!_this.project.compilegroups.get("_default_").sources.remove(fn)) {
- print("remove failed");
- }
- _this.default_directory_tree_store.load();
- });
- }
-
- // user defined functions
- }
-
-
-
-
-
- public class Xcls_Paned26 : Object
- {
- public Gtk.Paned el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Paned26(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
-
- // my vars (dec)
-
- // set gobject values
- this.el.position = 300;
- var child_0 = new Xcls_ScrolledWindow27( _this );
- child_0.ref();
- this.el.add1 ( child_0.el );
- var child_1 = new Xcls_set_vbox( _this );
- child_1.ref();
- this.el.add2 ( child_1.el );
- }
-
- // user defined functions
- }
- public class Xcls_ScrolledWindow27 : Object
- {
- public Gtk.ScrolledWindow el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ScrolledWindow27(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_targets_tree_menu( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_targets_tree( _this );
- child_1.ref();
- this.el.add ( child_1.el );
-
- // init method
-
- {
- this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
-
- }
- }
-
- // user defined functions
- }
- public class Xcls_targets_tree_menu : Object
- {
- public Gtk.Menu el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_targets_tree_menu(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.targets_tree_menu = this;
- this.el = new Gtk.Menu();
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_MenuItem29( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_SeparatorMenuItem30( _this );
- child_1.ref();
- this.el.add ( child_1.el );
- var child_2 = new Xcls_MenuItem31( _this );
- child_2.ref();
- this.el.add ( child_2.el );
- }
-
- // user defined functions
- }
- public class Xcls_MenuItem29 : Object
- {
- public Gtk.MenuItem el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_MenuItem29(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Add Compile Target";
-
- //listeners
- this.el.activate.connect( () => {
-
- if (_this.project.compilegroups.has_key("NEW GROUP")) {
- return;
- }
-
- // add the directory..
-
- _this.project.compilegroups.set("NEW GROUP", new Project.GtkValaSettings("NEW GROUP"));
- _this.targets_tree_store.load();
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_SeparatorMenuItem30 : Object
- {
- public Gtk.SeparatorMenuItem el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_SeparatorMenuItem30(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.SeparatorMenuItem();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_MenuItem31 : Object
- {
- public Gtk.MenuItem el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_MenuItem31(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
-
- // my vars (dec)
-
- // set gobject values
- this.el.label = "Remove Target";
-
- //listeners
- this.el.activate.connect( () => {
-
- //
- Gtk.TreeModel mod;
- Gtk.TreeIter iter;
- if (!_this.targets_tree.el.get_selection().get_selected(out mod, out iter)) {
- print("nothing selected\n");
- return;
- }
-
-
- // add the directory..
-
-
- GLib.Value val;
- mod.get_value(iter,0, out val);
- var fn = (string) val;
-
- print("remove: %s\n", fn);
- if (!_this.project.compilegroups.unset(fn)) {
- print("remove failed");
- }
- _this.targets_tree_store.load();
- });
- }
-
- // user defined functions
- }
-
-
- public class Xcls_targets_tree : Object
- {
- public Gtk.TreeView el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
- public string cursor;
-
- // ctor
- public Xcls_targets_tree(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.targets_tree = this;
- this.el = new Gtk.TreeView();
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_targets_tree_store( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_TreeViewColumn34( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
-
- //listeners
- this.el.button_press_event.connect( ( ev) => {
- //console.log("button press?");
-
-
- if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) {
- //print("click" + ev.type);
- return false;
- }
- //Gtk.TreePath res;
- //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {
- // return true;
- //}
-
- // this.el.get_selection().select_path(res);
-
- //if (!this.get('/LeftTreeMenu').el) {
- // this.get('/LeftTreeMenu').init();
- // }
-
- _this.targets_tree_menu.el.set_screen(Gdk.Screen.get_default());
- _this.targets_tree_menu.el.show_all();
- _this.targets_tree_menu.el.popup(null, null, null, 3, ev.time);
- // print("click:" + res.path.to_string());
- return true;
- });
- this.el.cursor_changed.connect( ( ) => {
-
- if (this.cursor != "") {
- // save the values..
- }
-
- // load the new values.
-
-
- Gtk.TreeModel mod;
- Gtk.TreeIter iter;
- if (!this.el.get_selection().get_selected(out mod, out iter)) {
- print("nothing selected\n");
- // should disable the right hand side..
- _this.set_vbox.el.hide();
- return;
- }
- _this.set_vbox.el.show();
-
- // add the directory..
-
-
- GLib.Value val;
- mod.get_value(iter,0, out val);
- var fn = (string) val;
-
- this.cursor = fn;
- var cg = _this.project.compilegroups.get(fn);
-
- _this.build_pack_target.el.set_text(cg.target_bin);
- _this.build_compile_flags.el.set_text(cg.compile_flags);
- _this.build_execute_args.el.set_text(cg.execute_args);
-
- _this.set_vbox.cgroup = cg;
- _this.files_tree_store.update();
-
- // load the srouces
-
-
- });
- }
-
- // user defined functions
- }
- public class Xcls_targets_tree_store : Object
- {
- public Gtk.ListStore el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_targets_tree_store(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.targets_tree_store = this;
- this.el = new Gtk.ListStore( 2, typeof(string), // 0 key type
- typeof(string) // ??
- );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- public void load () {
-
- this.el.clear();
-
-
- var cg = _this.project.compilegroups;
-
- _this.targets_tree.cursor = "";
- Gtk.TreeIter citer;
- var iter = cg.map_iterator();
- while(iter.next()) {
- var key = iter.get_key();
- if (key == "_default_") {
- continue;
- }
-
- this.el.append(out citer);
-
- this.el.set_value(citer, 0, key ); // title
- //this.el.set_value(citer, 1, items.get(i) );
- };
- this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
- _this.set_vbox.el.hide();
- }
- }
-
- public class Xcls_TreeViewColumn34 : Object
- {
- public Gtk.TreeViewColumn el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_TreeViewColumn34(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.TreeViewColumn();
-
- // my vars (dec)
-
- // set gobject values
- this.el.title = "name";
- this.el.resizable = true;
- var child_0 = new Xcls_targets_render( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false );
-
- // init method
-
- {
- this.el.add_attribute(_this.targets_render.el , "text", 0 );
- }
- }
-
- // user defined functions
- }
- public class Xcls_targets_render : Object
- {
- public Gtk.CellRendererText el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_targets_render(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.targets_render = this;
- this.el = new Gtk.CellRendererText();
-
- // my vars (dec)
-
- // set gobject values
- this.el.editable = true;
-
- //listeners
- this.el.edited.connect( (path, newtext) => {
-
- Gtk.TreeIter iter;
- _this.targets_tree_store.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
- GLib.Value gval;
- _this.targets_tree_store.el.get_value(iter,0, out gval);
- var oldval = (string)gval;
- if (oldval == newtext) {
- return;
- }
- var cg = _this.project.compilegroups.get(oldval);
- cg.name = newtext;
- _this.project.compilegroups.unset(oldval);
- _this.project.compilegroups.set(newtext, cg);
- _this.targets_tree_store.load();
- });
- }
-
- // user defined functions
- }
-
-
-
-
- public class Xcls_set_vbox : Object
- {
- public Gtk.Box el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
- public Project.GtkValaSettings cgroup;
-
- // ctor
- public Xcls_set_vbox(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.set_vbox = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
- this.cgroup = null;
-
- // set gobject values
- this.el.homogeneous = false;
- var child_0 = new Xcls_Label37( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,false,0 );
- var child_1 = new Xcls_build_pack_target( _this );
- child_1.ref();
- this.el.pack_start ( child_1.el , false,false,0 );
- var child_2 = new Xcls_Label39( _this );
- child_2.ref();
- this.el.pack_start ( child_2.el , false,false,0 );
- var child_3 = new Xcls_build_compile_flags( _this );
- child_3.ref();
- this.el.pack_start ( child_3.el , false,false,0 );
- var child_4 = new Xcls_Label41( _this );
- child_4.ref();
- this.el.pack_start ( child_4.el , false,false,0 );
- var child_5 = new Xcls_build_execute_args( _this );
- child_5.ref();
- this.el.pack_start ( child_5.el , false,false,0 );
- var child_6 = new Xcls_Label43( _this );
- child_6.ref();
- this.el.pack_start ( child_6.el , false,false,0 );
- var child_7 = new Xcls_ScrolledWindow44( _this );
- child_7.ref();
- this.el.pack_start ( child_7.el , true,true,0 );
- }
-
- // user defined functions
- }
- public class Xcls_Label37 : Object
- {
- public Gtk.Label el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label37(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "target filename" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_build_pack_target : Object
- {
- public Gtk.Entry el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_build_pack_target(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.build_pack_target = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.changed.connect( () => {
- if (_this.targets_tree.cursor.length < 1) {
- return;
- }
- _this.project.compilegroups.get(_this.targets_tree.cursor).target_bin = this.el.text;
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Label39 : Object
- {
- public Gtk.Label el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label39(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "compile flags" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_build_compile_flags : Object
- {
- public Gtk.Entry el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_build_compile_flags(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.build_compile_flags = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
-
- //listeners
- this.el.changed.connect( () => {
- if (_this.targets_tree.cursor.length < 1) {
- return;
- }
- _this.project.compilegroups.get(_this.targets_tree.cursor).compile_flags = this.el.text;
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Label41 : Object
- {
- public Gtk.Label el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label41(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "test argments - when run after a build" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_build_execute_args : Object
- {
- public Gtk.Entry el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_build_execute_args(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.build_execute_args = this;
- this.el = new Gtk.Entry();
-
- // my vars (dec)
-
- // set gobject values
- this.el.placeholder_text = "eg. -f somefile -g ";
-
- //listeners
- this.el.changed.connect( () => {
- if (_this.targets_tree.cursor.length < 1) {
- return;
- }
- _this.project.compilegroups.get(_this.targets_tree.cursor).execute_args = this.el.text;
- });
- }
-
- // user defined functions
- }
-
- public class Xcls_Label43 : Object
- {
- public Gtk.Label el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Label43(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.Label( "Files to compile" );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_ScrolledWindow44 : Object
- {
- public Gtk.ScrolledWindow el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ScrolledWindow44(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_files_tree( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- }
-
- // user defined functions
- }
- public class Xcls_files_tree : Object
- {
- public Gtk.TreeView el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_files_tree(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.TreeView();
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_files_tree_store( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_TreeViewColumn47( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
- var child_2 = new Xcls_TreeViewColumn49( _this );
- child_2.ref();
- this.el.append_column ( child_2.el );
- }
-
- // user defined functions
- }
- public class Xcls_files_tree_store : Object
- {
- public Gtk.ListStore el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_files_tree_store(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.files_tree_store = this;
- this.el = new Gtk.ListStore( 4, typeof(string), // 0 file name
- typeof(string), // 0 basename
- typeof(string), // type (dir orfile)
- typeof(bool) // is checked.
- );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- public void updateDir (string dname, bool bval) {
-
- Gtk.TreeIter citer;
-
- var cg = _this.set_vbox.cgroup;
- for(var i =0 ; i < this.el.iter_n_children(null); i++) {
- this.el.iter_nth_child(out citer,null,i);
-
- GLib.Value val;
- this.el.get_value(citer,0, out val);
- var fn = (string) val;
-
- if ( Path.get_dirname (fn) == dname) {
-
- this.el.set_value(citer, 3, bval ); // checked
-
-
-
- if (!bval) {
- // renive
- if (cg.sources.contains(fn)) {
- cg.sources.remove(fn);
- }
- } else {
- if (!cg.sources.contains(fn)) {
- cg.sources.add(fn);
- }
- }
-
-
- }
- }
-
- }
- public void load () {
-
- this.el.clear();
-
-
- var def = _this.project.compilegroups.get("_default_");
- var items = def.sources;
-
-
-
-
-
- Gtk.TreeIter citer;
-
- for(var i =0 ; i < items.size; i++) {
-
- var files = _this.project.filesForCompile(items.get(i), false);
- if (files.size < 1) {
- continue;
- }
-
- this.el.append(out citer);
-
- this.el.set_value(citer, 0, items.get(i) ); // title
- this.el.set_value(citer, 1, "<span foreground=\"green\" font_weight=\"bold\">" +
- GLib.Markup.escape_text(items.get(i)) + "</span>"
- ); // title
- print("ADD item %s", items.get(i));
- this.el.set_value(citer, 2, "dir"); // type
- this.el.set_value(citer, 3, false ); // checked
-
-
-
- for(var j =0 ; j < files.size; j++) {
- this.el.append(out citer);
- print("ADD item %s", files.get(j));
- this.el.set_value(citer, 0, files.get(j) ); // title
- this.el.set_value(citer, 1, GLib.Markup.escape_text( Path.get_basename (files.get(j))) ); // title
- this.el.set_value(citer, 2, "file"); // type
- this.el.set_value(citer, 3, false ); // checked
-
- }
-
-
- //this.el.set_value(citer, 1, items.get(i) );
- }
- this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
-
- }
- public void update () {
-
-
- Gtk.TreeIter citer;
-
- for(var i =0 ; i < this.el.iter_n_children(null); i++) {
- this.el.iter_nth_child(out citer,null,i);
-
- GLib.Value val;
- this.el.get_value(citer,0, out val);
- var fn = (string) val;
-
- var active = false;
- if (_this.set_vbox.cgroup.sources.contains(fn)) {
- active = true;
- }
-
- this.el.set_value(citer, 3, active ); // checked
- }
-
-
- }
- }
-
- public class Xcls_TreeViewColumn47 : Object
- {
- public Gtk.TreeViewColumn el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_TreeViewColumn47(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.TreeViewColumn();
-
- // my vars (dec)
-
- // set gobject values
- this.el.title = "name";
- this.el.resizable = true;
- var child_0 = new Xcls_files_render( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false );
-
- // init method
-
- this.el.add_attribute(_this.files_render.el , "markup", 1 ); // basnemae
-
- /* this.el.add_attribute(_this.files_render.el , "markup", 2 );
- */
- }
-
- // user defined functions
- }
- public class Xcls_files_render : Object
- {
- public Gtk.CellRendererText el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_files_render(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.files_render = this;
- this.el = new Gtk.CellRendererText();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
- public class Xcls_TreeViewColumn49 : Object
- {
- public Gtk.TreeViewColumn el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_TreeViewColumn49(ValaProjectSettings _owner )
- {
- _this = _owner;
- this.el = new Gtk.TreeViewColumn();
-
- // my vars (dec)
-
- // set gobject values
- this.el.title = "use";
- this.el.resizable = false;
- this.el.fixed_width = 50;
- var child_0 = new Xcls_files_render_use( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false );
-
- // init method
-
- {
- this.el.add_attribute(_this.files_render_use.el , "active", 3 );
- }
- }
-
- // user defined functions
- }
- public class Xcls_files_render_use : Object
- {
- public Gtk.CellRendererToggle el;
- private ValaProjectSettings _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_files_render_use(ValaProjectSettings _owner )
- {
- _this = _owner;
- _this.files_render_use = this;
- this.el = new Gtk.CellRendererToggle();
-
- // my vars (dec)
-
- // set gobject values
- this.el.activatable = true;
-
- //listeners
- this.el.toggled.connect( ( path_string) => {
-
-
-
- var m = _this.files_tree_store.el;
- Gtk.TreeIter iter;
- Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);
- m.get_iter (out iter, path);
- GLib.Value val;
- m.get_value(iter, 3, out val);
- m.set_value(iter, 3, ((bool) val) ? false :true);
-
- // type.
- GLib.Value ftval;
- m.get_value(iter, 2, out ftval);
- var ftype = (string)ftval;
-
- // full name...
- GLib.Value fval;
- m.get_value(iter, 0, out fval);
- var fn = (string)fval;
-
-
- var cg = _this.set_vbox.cgroup;
- // what's the sleected target?
- // update the list..
- // if ftype is a dir == then toggle all the bellow.
-
- if (ftype == "dir") {
- _this.files_tree_store.updateDir(fn, ((bool) val) ? false :true);
- }
-
- // if ftype is a file .. see if all the files in that directory are check and check the dir.
-
-
- if ((bool)val) {
- // renive
- cg.sources.remove(fn);
- } else {
- cg.sources.add(fn);
- }
-
- });
- }
-
- // user defined functions
- }
-
-
-
-
-
-
-
-}
{
"build_module" : "builder",
+ "gen_extended" : false,
"items" : [
{
"$ xns" : "Gtk",
"Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
"Project.Gtk project" : "null",
+ "Project.GtkValaSettings? selected_target" : "null",
"Xcls_MainWindow window" : "null",
+ "bool autohide" : false,
"bool done" : false,
"bool modal" : true,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
- "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
- "bool hexpand" : true,
- "bool vexpand" : true,
+ "* prop" : "titlebar",
+ "* title" : "Edit Project Details",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
- "string title" : "Change Vala Project Compile settings",
- "xtype" : "HeaderBar"
+ "* prop" : "title_widget",
+ "string label" : "Change Vala Compile settings",
+ "xtype" : "Label"
},
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true,true,0",
+ "* pack" : "pack_end",
+ "string icon_name" : "",
+ "string label" : "Create / Recreate Build files (configure.ac / makefile.am etc)",
+ "xtype" : "Button"
+ }
+ ],
+ "xtype" : "HeaderBar"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "set_child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool hexpand" : true,
+ "bool vexpand" : true,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "bool vexpand" : true,
+ "id" : "notebook",
"items" : [
{
"$ xns" : "Gtk",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
+ "Gtk.Align halign" : "Gtk.Align.START",
+ "bool hexpand" : true,
"utf8 label" : "compile flags",
"xtype" : "Label"
},
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
"id" : "compile_flags",
"listeners" : {
"changed" : [
"() => {",
" ",
- " _this.project.compilegroups.get(\"_default_\").compile_flags = this.el.text;",
- " _this.project.writeConfig();",
+ " _this.project.compile_flags = this.el.buffer.text;",
+ " _this.project.save();",
"// _this.project.save();",
"",
"}"
},
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true,true,0",
- "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
- "int position" : 300,
+ "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
+ "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
+ "bool has_frame" : true,
+ "bool hexpand" : true,
+ "bool vexpand" : true,
+ "id" : "vapi_scroll",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
- "bool hexpand" : true,
+ "* prop" : "child",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
- "gboolean headers_visible" : true,
+ "* prop" : "model",
"items" : [
- {
- "$ columns" : [
- " typeof(string), // 0 key type",
- " typeof(bool)"
- ],
- "$ n_columns" : 2,
- "$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "default_packages_tree_store",
- "xtype" : "ListStore",
- "| void load" : [
- "() {",
- " ",
- " var def = _this.project.compilegroups.get(\"_default_\");",
- " var items = def.packages;",
- " ",
- " this.el.clear();",
- " var pal = (Palete.Gtk) _this.project.palete;",
- " var pkgs = pal.packages(_this.project);",
- " GLib.debug(\"ValaProjectSettings:packages load %d\\n\", pkgs.size);",
- "",
- " Gtk.TreeIter citer;",
- "",
- " for(var i =0 ; i < pkgs.size; i++) {",
- " this.el.append(out citer); ",
- " ",
- " this.el.set_value(citer, 0, pkgs.get(i) ); // title ",
- " this.el.set_value(citer, 1, items.contains(pkgs.get(i)) );",
- " }",
- " this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
- " ",
- "}",
- ""
- ]
- },
{
"$ xns" : "Gtk",
- "* init" : [
- " ",
- " this.el.add_attribute(_this.packages_render.el , \"text\", 0 );",
- " "
- ],
- "* pack" : "append_column",
- "gboolean expand" : true,
- "gboolean resizable" : true,
+ "* prop" : "model",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false",
- "id" : "packages_render",
- "xtype" : "CellRendererText"
- }
- ],
- "utf8 title" : "package name",
- "xtype" : "TreeViewColumn"
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- "{",
- " this.el.add_attribute(_this.packages_render_use.el , \"active\", 1 );",
- " }"
- ],
- "* pack" : "append_column",
- "gboolean resizable" : false,
- "gint fixed_width" : 50,
- "items" : [
+ "* prop" : "model",
+ "items" : [
+ {
+ "$ xns" : "GLib",
+ "* prop" : "model",
+ "GLib.Type item_type" : "typeof(Project.VapiSelection)",
+ "id" : "vapimodel",
+ "xtype" : "ListStore"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "sorter",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "expression",
+ "GLib.Type this_type" : "typeof(Project.VapiSelection)",
+ "string property_name" : "sortkey",
+ "xtype" : "PropertyExpression"
+ }
+ ],
+ "xtype" : "StringSorter"
+ }
+ ],
+ "xtype" : "SortListModel"
+ },
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false",
- "gboolean activatable" : true,
- "id" : "packages_render_use",
- "listeners" : {
- "toggled" : [
- "( path_string) => { ",
- " var m = _this.default_packages_tree_store.el;",
- " Gtk.TreeIter iter;",
- " Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);",
- " m.get_iter (out iter, path);",
- " GLib.Value val;",
- " m.get_value(iter, 1, out val);",
- " m.set_value(iter, 1, ((bool) val) ? false :true); ",
- " GLib.Value fval; ",
- " m.get_value(iter, 0, out fval);",
- " var fn = (string)fval;",
- " ",
- " var def = _this.project.compilegroups.get(\"_default_\");",
- " var items = def.packages;",
- " if ((bool)val) {",
- " // renive",
- " items.remove(fn);",
- " } else {",
- " items.add(fn);",
- " }",
- " ",
- "}"
- ]
- },
- "xtype" : "CellRendererToggle"
+ "* prop" : "filter",
+ "id" : "vapi_filter",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "expression",
+ "GLib.Type this_type" : "typeof(Project.VapiSelection)",
+ "string property_name" : "sortkey",
+ "xtype" : "PropertyExpression"
+ }
+ ],
+ "xtype" : "StringFilter"
}
],
- "utf8 title" : "use",
- "xtype" : "TreeViewColumn"
+ "xtype" : "FilterListModel"
}
],
- "string id" : "default_packages_tree",
- "xtype" : "TreeView"
- }
- ],
- "xtype" : "ScrolledWindow"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add2",
- "bool hexpand" : true,
- "items" : [
+ "xtype" : "NoSelection"
+ },
{
"$ xns" : "Gtk",
- "* pack" : "add",
- "gboolean headers_visible" : true,
- "id" : "default_directory_tree",
+ "* pack" : "append_column",
+ "bool expand" : true,
"items" : [
{
- "$ columns" : [
- " typeof(string)",
- " "
- ],
- "$ n_columns" : 1,
"$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "default_directory_tree_store",
- "xtype" : "ListStore",
- "| void load" : [
- "() {",
- " ",
- " this.el.clear();",
- " ",
- " ",
- " var def = _this.project.compilegroups.get(\"_default_\");",
- " var items = def.sources;",
- " ",
- " ",
- " Gtk.TreeIter citer;",
- "",
- " for(var i =0 ; i < items.size; i++) {",
- " this.el.append(out citer); ",
- " ",
- " this.el.set_value(citer, 0, items.get(i) ); // title ",
- " //this.el.set_value(citer, 1, items.get(i) );",
- " }",
- " this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
- " ",
- "}",
- ""
- ]
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- "",
- " this.el.add_attribute(_this.directory_render.el , \"text\", 0 );",
- " "
- ],
- "* pack" : "append_column",
- "gboolean resizable" : true,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false",
- "id" : "directory_render",
- "xtype" : "CellRendererText"
- }
- ],
- "utf8 title" : "Available Directories (right click to add)",
- "xtype" : "TreeViewColumn"
+ "* prop" : "factory",
+ "listeners" : {
+ "bind" : [
+ "(listitem) => {",
+ " ",
+ "\tvar lbl = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();",
+ "\t ",
+ "\tvar item = (Project.VapiSelection) ((Gtk.ListItem)listitem).get_item();",
+ "",
+ "\titem.bind_property(\"name\",",
+ " lbl, \"label\",",
+ " GLib.BindingFlags.SYNC_CREATE);",
+ "",
+ "\t ",
+ "}",
+ ""
+ ],
+ "setup" : [
+ "(item) => {",
+ "\t//var j = (JsRender.JsRender) item;",
+ "\tvar gi = (Gtk.ListItem)item;",
+ "\t ",
+ "\tvar lbl = new Gtk.Label(\"\");",
+ "\tlbl.halign = Gtk.Align.START;",
+ "\tgi.set_child(lbl);",
+ "",
+ "",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "SignalListItemFactory"
}
],
- "listeners" : {
- "button_press_event" : [
- " ( ev) => {",
- " //console.log(\"button press?\");",
- " ",
- " ",
- " if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) {",
- " //print(\"click\" + ev.type);",
- " return false;",
- " }",
- " //Gtk.TreePath res;",
- " //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {",
- " // return true;",
- " //}",
- " ",
- " // this.el.get_selection().select_path(res);",
- " ",
- " //if (!this.get('/LeftTreeMenu').el) { ",
- " // this.get('/LeftTreeMenu').init(); ",
- " // }",
- " ",
- " _this.default_directory_menu.el.set_screen(Gdk.Screen.get_default());",
- " _this.default_directory_menu.el.show_all();",
- " _this.default_directory_menu.el.popup_at_pointer(ev);",
- " // print(\"click:\" + res.path.to_string());",
- " return true;",
- "}"
- ]
- },
- "xtype" : "TreeView"
+ "string title" : "Vapi Package",
+ "xtype" : "ColumnViewColumn"
},
{
"$ xns" : "Gtk",
- "id" : "default_directory_menu",
+ "* pack" : "append_column",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
+ "* prop" : "factory",
"listeners" : {
- "activate" : [
- "() => {",
- " ",
- " var chooser = new Gtk.FileChooserDialog (",
- "\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.SELECT_FOLDER ,",
- "\t\"_Cancel\",",
- "\tGtk.ResponseType.CANCEL,",
- "\t\"_Add\",",
- "\tGtk.ResponseType.ACCEPT);",
- " if (chooser.run () != Gtk.ResponseType.ACCEPT) {",
- " chooser.close ();",
- " return;",
- " }",
- " chooser.close ();",
- " // add the directory..",
- " var fn = _this.project.relPath(chooser.get_filename());",
- " _this.project.compilegroups.get(\"_default_\").sources.add(fn);",
- " _this.default_directory_tree_store.load();",
- "}"
- ]
- },
- "utf8 label" : "Add Directory",
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "listeners" : {
- "activate" : [
- "() => {",
- " ",
- " var chooser = new Gtk.FileChooserDialog (",
- "\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.OPEN ,",
- "\t\"_Cancel\",",
- "\tGtk.ResponseType.CANCEL,",
- "\t\"_Add\",",
- "\tGtk.ResponseType.ACCEPT);",
- " if (chooser.run () != Gtk.ResponseType.ACCEPT) {",
- " chooser.close ();",
- " return;",
- " }",
- " chooser.close ();",
- " // add the directory..",
- " var fn = _this.project.relPath(chooser.get_filename());",
- " _this.project.compilegroups.get(\"_default_\").sources.add(fn);",
- " _this.default_directory_tree_store.load();",
- "}"
- ]
- },
- "utf8 label" : "Add File",
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "xtype" : "SeparatorMenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "listeners" : {
- "activate" : [
- "() => {",
- "",
- "\t//",
- "\tGtk.TreeModel mod;",
- "\tGtk.TreeIter iter;",
- "\tif (!_this.default_directory_tree.el.get_selection().get_selected(out mod, out iter)) {",
- "\t\tGLib.debug(\"nothing selected\\n\");",
- "\t\treturn;",
- "\t}",
+ "bind" : [
+ "(listitem) => {",
+ "\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 btn = (Gtk.CheckButton) ((Gtk.ListItem)listitem).get_child();",
+ "\t ",
+ " ",
+ "\tvar vs = (Project.VapiSelection)((Gtk.ListItem)listitem).get_item();",
"",
- "\t\t",
- "\t// add the directory..",
+ "\t//GLib.debug(\"change %s to %s\", lbl.label, np.name);",
"",
+ "\tbtn.active = vs.selected; ",
+ "\t",
+ "\tvs.btn = btn;",
+ " \t// bind image...",
+ " \t",
+ "}"
+ ],
+ "setup" : [
"",
- "\tGLib.Value val;",
- "\tmod.get_value(iter,0, out val);",
- "\tvar fn = (string) val;",
+ "(listitem) => {",
"",
- "\tGLib.debug(\"remove: %s\\n\", fn);",
- "\tif (!_this.project.compilegroups.get(\"_default_\").sources.remove(fn)) {",
- "\t\tGLib.debug(\"remove failed\");",
- "\t}",
- "\t_this.default_directory_tree_store.load();",
- "}"
+ "\tvar btn = new Gtk.CheckButton();",
+ " ",
+ "\t((Gtk.ListItem)listitem).set_child(btn);",
+ "\t",
+ "\tbtn.toggled.connect(() => {",
+ "\t ",
+ "\t\tvar jr = (Project.VapiSelection) ((Gtk.ListItem)listitem).get_item();",
+ "\t\tjr.selected = btn.active;",
+ "\t});",
+ "}",
+ ""
]
},
- "utf8 label" : "Remove File/Directory",
- "xtype" : "MenuItem"
+ "xtype" : "SignalListItemFactory"
}
],
- "xtype" : "Menu"
+ "string title" : "use",
+ "xtype" : "ColumnViewColumn"
}
],
- "xtype" : "ScrolledWindow"
+ "xtype" : "ColumnView"
}
],
- "xtype" : "Paned"
+ "xtype" : "ScrolledWindow"
+ },
+ {
+ "$ xns" : "Gtk",
+ "id" : "vapi_search",
+ "listeners" : {
+ "search_changed" : [
+ "( ) => {",
+ "",
+ " _this.vapi_filter.el.set_search(this.el.get_text());",
+ " ",
+ "}",
+ ""
+ ]
+ },
+ "string placeholder_text" : "Search Libraries (Vapi)",
+ "uint search_delay" : 500,
+ "xtype" : "SearchEntry"
}
],
"xtype" : "Box"
"$ xns" : "Gtk",
"* pack" : "append_page,_this.label_targets.el",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "bool vexpand" : true,
"gint position" : 300,
"items" : [
{
"$ xns" : "Gtk",
- "* init" : [
- "{ ",
- "this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
- "",
- "}",
- ""
+ "* pack" : "set_end_child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "gboolean homogeneous" : false,
+ "id" : "set_vbox",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "bool vexpand" : true,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "child",
+ "id" : "treeview",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "id" : "treeselmodel",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ "\t//this.el.set_sorter(new Gtk.TreeListRowSorter(_this.treeview.el.sorter));",
+ "}",
+ ""
+ ],
+ "* prop" : "model",
+ "id" : "treelistsort",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "Gtk.TreeListModelCreateModelFunc create_func" : [
+ "(item) => {",
+ "\t//GLib.debug(\"liststore got %s\", item.get_type().name());",
+ "\treturn ((JsRender.JsRender)item).childfiles;",
+ "} "
+ ],
+ "bool autoexpand" : true,
+ "bool passthrough" : false,
+ "id" : "treelistmodel",
+ "items" : [
+ {
+ "$ xns" : "GLib",
+ "* prop" : "root",
+ "GLib.Type item_type" : "typeof(JsRender.JsRender)",
+ "id" : "treemodel",
+ "xtype" : "ListStore"
+ }
+ ],
+ "xtype" : "TreeListModel"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "sorter",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "sorter",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "expression",
+ "GLib.Type this_type" : "typeof(JsRender.JsRender)",
+ "string property_name" : "name",
+ "xtype" : "PropertyExpression"
+ }
+ ],
+ "xtype" : "StringSorter"
+ }
+ ],
+ "xtype" : "TreeListRowSorter"
+ }
+ ],
+ "xtype" : "SortListModel"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "filter",
+ "Gtk.CustomFilterFunc match_func" : [
+ "(item) => { ",
+ "\t",
+ "\tvar tr = ((Gtk.TreeListRow)item).get_item();",
+ "\t//GLib.debug(\"filter %s\", tr.get_type().name());",
+ "\tvar j = (JsRender.JsRender) tr;",
+ "\tif (j.xtype == \"Gtk\") {",
+ "\t\treturn true;",
+ "\t}",
+ "\tif (j.xtype != \"Dir\") {",
+ "\t\treturn j.path.has_suffix(\".vala\") || j.path.has_suffix(\".c\");",
+ "\t}",
+ "\t// dirs..",
+ "\t ",
+ "\tfor (var i =0 ; i < j.childfiles.n_items; i++) {",
+ "\t\tvar f = (JsRender.JsRender) j.childfiles.get_item(i);",
+ "\t\tif (f.xtype == \"Gtk\") {",
+ "\t\t\treturn true;",
+ "\t\t}",
+ "\t\tif (f.path.has_suffix(\".vala\") || f.path.has_suffix(\".c\")) {",
+ "\t\t\treturn true;",
+ "\t\t}",
+ "\t}",
+ "\treturn false;",
+ "",
+ "}"
+ ],
+ "xtype" : "CustomFilter"
+ }
+ ],
+ "xtype" : "FilterListModel"
+ }
+ ],
+ "xtype" : "SingleSelection"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ "\t this.el.set_sorter( new Gtk.StringSorter(",
+ "\t \tnew Gtk.PropertyExpression(typeof(JsRender.JsRender), null, \"name\")",
+ " \t));",
+ "\t\t;",
+ "\t\t",
+ "}",
+ ""
+ ],
+ "* pack" : "append_column",
+ "bool expand" : true,
+ "bool resizable" : true,
+ "id" : "name",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "factory",
+ "listeners" : {
+ "bind" : [
+ "(listitem) => {",
+ "\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 lbl = (Gtk.Label) expand.child;",
+ "\t",
+ "\t if (lbl.label != \"\") { // do not update",
+ "\t \treturn;",
+ " \t}",
+ "\t",
+ "",
+ "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
+ "\tvar jr = (JsRender.JsRender) lr.get_item();",
+ "\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.childfiles.n_items < 1);",
+ " \texpand.set_list_row(lr);",
+ " ",
+ " expand.set_hide_expander( jr.xtype != \"Dir\" );",
+ " \t expand.set_list_row(lr);",
+ " ",
+ " \t// bind image...",
+ " \t",
+ "}",
+ ""
+ ],
+ "setup" : [
+ "(listitem) => {",
+ "\t",
+ "\tvar expand = new Gtk.TreeExpander();",
+ "\t ",
+ "\texpand.set_indent_for_depth(true);",
+ "\texpand.set_indent_for_icon(true);",
+ "\t ",
+ "\tvar lbl = new Gtk.Label(\"\");",
+ "\tlbl.use_markup = true;",
+ "\t",
+ "\t",
+ " \tlbl.justify = Gtk.Justification.LEFT;",
+ " \tlbl.xalign = 0;",
+ "",
+ " ",
+ "\texpand.set_child(lbl);",
+ "\t((Gtk.ListItem)listitem).set_child(expand);",
+ "\t((Gtk.ListItem)listitem).activatable = false;",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "SignalListItemFactory"
+ }
+ ],
+ "string title" : "Other Files",
+ "xtype" : "ColumnViewColumn"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "append_column",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "factory",
+ "listeners" : {
+ "bind" : [
+ "(listitem) => {",
+ "\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 btn = (Gtk.CheckButton) ((Gtk.ListItem)listitem).get_child();",
+ "\t ",
+ " ",
+ "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
+ "\tvar jr = (JsRender.JsRender) lr.get_item();",
+ "\t//GLib.debug(\"change %s to %s\", lbl.label, np.name);",
+ "",
+ "\t",
+ "\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 ",
+ "\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",
+ "\t\t",
+ "\t});",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "SignalListItemFactory"
+ }
+ ],
+ "string title" : "use",
+ "xtype" : "ColumnViewColumn"
+ }
+ ],
+ "xtype" : "ColumnView"
+ }
+ ],
+ "xtype" : "ScrolledWindow"
+ }
],
- "* pack" : "add1",
+ "xtype" : "Box"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "start_child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "int spacing" : 0,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
- "id" : "targets_tree_menu",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "bool hexpand" : true,
+ "int spacing" : 0,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
+ "bool hexpand" : true,
"listeners" : {
- "activate" : [
+ "clicked" : [
"() => {",
" ",
" if (_this.project.compilegroups.has_key(\"NEW GROUP\")) {",
" return;",
" }",
- " ",
- " // add the directory..",
- " ",
- " _this.project.compilegroups.set(\"NEW GROUP\", new Project.GtkValaSettings(\"NEW GROUP\"));",
- " _this.targets_tree_store.load();",
+ " 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++) {",
+ " \tvar ncg = (Project.GtkValaSettings) _this.target_model.el.get_item(i);",
+ " \tif (ncg.name == cg.name) {",
+ " \t\t_this.target_sel.el.selected = i;",
+ " \t\t_this.target_sel.selectTarget(cg);",
+ " \t\tbreak;",
+ " \t\t}",
+ "\t} ",
+ "\t",
+ "\t",
+ "\t ",
"}"
]
},
"utf8 label" : "Add Compile Target",
- "xtype" : "MenuItem"
+ "xtype" : "Button"
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
- "xtype" : "SeparatorMenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
+ "bool hexpand" : true,
"listeners" : {
- "activate" : [
+ "clicked" : [
"() => {",
- " ",
- "\t//",
- "\tGtk.TreeModel mod;",
- "\tGtk.TreeIter iter;",
- "\tif (!_this.targets_tree.el.get_selection().get_selected(out mod, out iter)) {",
- "\t\tGLib.debug(\"nothing selected\\n\");",
+ " // load the new values.",
+ "\tif (_this.target_sel.el.selected == Gtk.INVALID_LIST_POSITION) {",
+ "\t\tGLib.debug(\"nothing selected\");",
"\t\treturn;",
"\t}",
- "",
- "",
+ "\t",
+ "\t ",
"\t// add the directory..",
- "",
- "",
- "\tGLib.Value val;",
- "\tmod.get_value(iter,0, out val);",
- "\tvar fn = (string) val;",
- "",
- "\tGLib.debug(\"remove: %s\\n\", fn);",
- "\tif (!_this.project.compilegroups.unset(fn)) {",
+ "\tvar cg = (Project.GtkValaSettings) _this.target_model.el.get_item(_this.target_sel.el.selected);",
+ "\t ",
+ "\t ",
+ "\tGLib.debug(\"remove: %s\\n\", cg.name);",
+ "\tif (!_this.project.compilegroups.unset(cg.name)) {",
"\t\tGLib.debug(\"remove failed\");",
"\t}",
- "\t_this.targets_tree_store.load();",
+ " \t_this.project.loadTargetsIntoStore(_this.target_model.el);",
"}"
]
},
"utf8 label" : "Remove Target",
- "xtype" : "MenuItem"
+ "xtype" : "Button"
}
],
- "xtype" : "Menu"
+ "xtype" : "Box"
},
{
- "# string cursor" : "",
"$ xns" : "Gtk",
- "* pack" : "add",
- "id" : "targets_tree",
+ "* init" : [
+ "{ ",
+ "this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
+ "",
+ "}",
+ ""
+ ],
+ "bool vexpand" : true,
"items" : [
{
- "$ columns" : [
- " typeof(string), // 0 key type",
- " typeof(string) // ??",
- " "
- ],
- "$ n_columns" : 2,
"$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "targets_tree_store",
- "xtype" : "ListStore",
- "| void load" : [
- "() {",
- " ",
- " this.el.clear();",
- " ",
- " ",
- " var cg = _this.project.compilegroups;",
- " ",
- " _this.targets_tree.cursor = \"\";",
- " Gtk.TreeIter citer;",
- " var iter = cg.map_iterator();",
- " while(iter.next()) {",
- " var key = iter.get_key();",
- " if (key == \"_default_\") {",
- " continue;",
- " }",
- " ",
- " this.el.append(out citer); ",
- " ",
- " this.el.set_value(citer, 0, key ); // title ",
- " //this.el.set_value(citer, 1, items.get(i) );",
- " };",
- " this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
- " _this.set_vbox.el.hide();",
- "}",
- ""
- ]
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- " {",
- " this.el.add_attribute(_this.targets_render.el , \"text\", 0 );",
- " }"
- ],
- "* pack" : "append_column",
- "gboolean resizable" : true,
+ "* prop" : "child",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false",
- "gboolean editable" : true,
- "id" : "targets_render",
+ "* prop" : "model",
+ "id" : "target_sel",
+ "items" : [
+ {
+ "$ xns" : "GLib",
+ "* prop" : "model",
+ "GLib.Type item_type" : "typeof(Project.GtkValaSettings)",
+ "id" : "target_model",
+ "xtype" : "ListStore"
+ }
+ ],
"listeners" : {
- "edited" : [
- " (path, newtext) => {",
- " ",
- " Gtk.TreeIter iter;",
- " _this.targets_tree_store.el.get_iter(out iter, new Gtk.TreePath.from_string(path));",
- " GLib.Value gval;",
- " _this.targets_tree_store.el.get_value(iter,0, out gval);",
- " var oldval = (string)gval;",
- " if (oldval == newtext) {",
- " return;",
- " }",
- " var cg = _this.project.compilegroups.get(oldval);",
- " cg.name = newtext;",
- " _this.project.compilegroups.unset(oldval);",
- " _this.project.compilegroups.set(newtext, cg);",
- " _this.targets_tree_store.load();",
- " }"
+ "selection_changed" : [
+ "(position, n_items) => {",
+ "",
+ "\t ",
+ "\t// load the new values.",
+ "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
+ "\t\tthis.selectTarget(null);",
+ "\t\treturn;",
+ "\t}",
+ "\tthis.selectTarget(null);",
+ "\t",
+ " ",
+ "",
+ "\t// add the directory..",
+ "\tvar cg = (Project.GtkValaSettings) _this.target_model.el.get_item(this.el.selected);",
+ "\t",
+ "\tthis.selectTarget(cg);",
+ " ",
+ "}",
+ ""
]
},
- "xtype" : "CellRendererText"
- }
- ],
- "utf8 title" : "name",
- "xtype" : "TreeViewColumn"
- }
- ],
- "listeners" : {
- "button_press_event" : [
- " ( ev) => {",
- " //console.log(\"button press?\");",
- " ",
- " ",
- " if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) {",
- " //print(\"click\" + ev.type);",
- " return false;",
- " }",
- " //Gtk.TreePath res;",
- " //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {",
- " // return true;",
- " //}",
- " ",
- " // this.el.get_selection().select_path(res);",
- " ",
- " //if (!this.get('/LeftTreeMenu').el) { ",
- " // this.get('/LeftTreeMenu').init(); ",
- " // }",
- " ",
- " _this.targets_tree_menu.el.set_screen(Gdk.Screen.get_default());",
- " _this.targets_tree_menu.el.show_all();",
- " _this.targets_tree_menu.el.popup_at_pointer(ev);",
- " // print(\"click:\" + res.path.to_string());",
- " return true;",
- "}"
- ],
- "cursor_changed" : [
- " ( ) => {",
- "",
- "\tif (this.cursor != \"\") {",
- "\t\t// save the values..",
- "\t}",
- "",
- "\t// load the new values.",
- "",
- "",
- "\tGtk.TreeModel mod;",
- "\tGtk.TreeIter iter;",
- "\tif (!this.el.get_selection().get_selected(out mod, out iter)) {",
- "\t\tGLib.debug(\"nothing selected\\n\");",
- "\t\t// should disable the right hand side..",
- "\t\t_this.set_vbox.el.hide();",
- "\t\treturn;",
- "\t}",
- "\t_this.set_vbox.el.show();",
- "",
- "\t// add the directory..",
- "",
- "",
- "\tGLib.Value val;",
- "\tmod.get_value(iter,0, out val);",
- "\tvar fn = (string) val;",
- "",
- "\tthis.cursor = fn;",
- "\tvar cg = _this.project.compilegroups.get(fn);",
- "",
- "\t_this.build_pack_target.el.set_text(cg.target_bin);",
- "\t_this.build_compile_flags.el.set_text(cg.compile_flags);",
- "\t_this.build_execute_args.el.set_text(cg.execute_args);",
- "",
- "\t_this.set_vbox.cgroup = cg;",
- "\t_this.files_tree_store.update();",
- "",
- " // load the srouces",
- "",
- "",
- " }"
- ]
- },
- "xtype" : "TreeView"
- }
- ],
- "xtype" : "ScrolledWindow"
- },
- {
- "# Project.GtkValaSettings cgroup" : "null",
- "$ xns" : "Gtk",
- "* pack" : "add2",
- "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
- "gboolean homogeneous" : false,
- "id" : "set_vbox",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "utf8 label" : "target filename",
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "id" : "build_pack_target",
- "listeners" : {
- "changed" : [
- "() => {",
- " if (_this.targets_tree.cursor.length < 1) {",
- " return;",
- " }",
- " _this.project.compilegroups.get(_this.targets_tree.cursor).target_bin = this.el.text;",
- "}"
- ]
- },
- "xtype" : "Entry"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "utf8 label" : "compile flags",
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "id" : "build_compile_flags",
- "listeners" : {
- "changed" : [
- "() => {",
- " if (_this.targets_tree.cursor.length < 1) {",
- " return;",
- " }",
- " _this.project.compilegroups.get(_this.targets_tree.cursor).compile_flags = this.el.text;",
- "}"
- ]
- },
- "xtype" : "Entry"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "utf8 label" : "test argments - when run after a build",
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "id" : "build_execute_args",
- "listeners" : {
- "changed" : [
- "() => {",
- " if (_this.targets_tree.cursor.length < 1) {",
- " return;",
- " }",
- " _this.project.compilegroups.get(_this.targets_tree.cursor).execute_args = this.el.text;",
- "}"
- ]
- },
- "string placeholder_text" : "eg. -f somefile -g ",
- "xtype" : "Entry"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
- "utf8 label" : "Files to compile",
- "xtype" : "Label"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,true,true,0",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "items" : [
- {
- "$ columns" : [
- " typeof(string), // 0 file name",
- " typeof(string), // 0 basename",
- " typeof(string), // type (dir orfile)",
- " typeof(bool) // is checked.",
- " "
- ],
- "$ n_columns" : 4,
- "$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "files_tree_store",
- "xtype" : "ListStore",
- "| void load" : [
- "() {",
- " ",
- " this.el.clear();",
- " ",
- " ",
- " var def = _this.project.compilegroups.get(\"_default_\");",
- " var items = def.sources;",
- " ",
- " ",
- " ",
- " ",
- " ",
- " Gtk.TreeIter citer;",
- "",
- " for(var i =0 ; i < items.size; i++) {",
- " ",
- " var files = _this.project.filesForCompile(items.get(i), false);",
- " if (files.size < 1) {",
- " continue;",
- " }",
- " ",
- " this.el.append(out citer); ",
- " ",
- " this.el.set_value(citer, 0, items.get(i) ); // title ",
- " this.el.set_value(citer, 1, \"<span foreground=\\\"green\\\" font_weight=\\\"bold\\\">\" + ",
- " GLib.Markup.escape_text(items.get(i)) + \"</span>\"",
- " ); // title ",
- " GLib.debug(\"ADD item %s\", items.get(i));",
- " this.el.set_value(citer, 2, \"dir\"); // type ",
- " this.el.set_value(citer, 3, false ); // checked ",
- "",
- " ",
- " ",
- " for(var j =0 ; j < files.size; j++) {",
- " this.el.append(out citer); ",
- " GLib.debug(\"ADD item %s\", files.get(j));",
- " this.el.set_value(citer, 0, files.get(j) ); // title ",
- " this.el.set_value(citer, 1, GLib.Markup.escape_text( Path.get_basename (files.get(j))) ); // title ",
- " this.el.set_value(citer, 2, \"file\"); // type ",
- " this.el.set_value(citer, 3, false ); // checked ",
- "",
- " }",
- " ",
- " ",
- " //this.el.set_value(citer, 1, items.get(i) );",
- " }",
- " this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
- " if (_this.set_vbox.cgroup == null) {",
- "\t\t_this.set_vbox.el.set_sensitive(false);",
- " ",
- " }",
- "}",
- " "
- ],
- "| void update" : [
- "() {",
- "",
- "",
- " Gtk.TreeIter citer;",
+ "xtype" : "SingleSelection",
+ "| void selectTarget" : [
+ "(Project.GtkValaSettings? cg) {",
+ "// load the new values",
+ "\t _this.selected_target = cg; ",
+ "\t _this.project.active_cg = cg;",
+ "\t ",
"",
- " for(var i =0 ; i < this.el.iter_n_children(null); i++) {",
- " this.el.iter_nth_child(out citer,null,i);",
- "",
- " GLib.Value val;",
- " this.el.get_value(citer,0, out val);",
- " var fn = (string) val;",
- " ",
- " var active = false;",
- " if (_this.set_vbox.cgroup.sources.contains(fn)) {",
- " active = true;",
- " }",
- " ",
- " this.el.set_value(citer, 3, active ); // checked ",
- " }",
- "",
- " _this.set_vbox.el.set_sensitive(true);",
- "}",
- ""
- ],
- "| void updateDir" : [
- "(string dname, bool bval) {",
- " ",
- " Gtk.TreeIter citer;",
- "",
- " var cg = _this.set_vbox.cgroup;",
- " for(var i =0 ; i < this.el.iter_n_children(null); i++) {",
- " this.el.iter_nth_child(out citer,null,i);",
+ "\tif (cg == null) {",
+ "\t\t ",
+ "\t\t_this.set_vbox.el.hide();\t",
+ "\t\t_this.set_vboxb.el.hide();\t",
+ "\t\treturn;",
+ "\t}",
+ "\t",
+ "\t",
+ "\t_this.set_vbox.el.show();",
+ "\t_this.set_vboxb.el.show();",
+ "\t// add the directory..",
+ " ",
+ "\t ",
+ "\t GLib.debug(\"loading dirs into project list\");",
+ "\t cg.loading_ui = true;",
+ "\t ",
"",
- " GLib.Value val;",
- " this.el.get_value(citer,0, out val);",
- " var fn = (string) val;",
- " ",
- " if ( Path.get_dirname (fn) == dname) {",
- " ",
- " this.el.set_value(citer, 3, bval ); // checked ",
- " ",
- " ",
- " ",
- " if (!bval) {",
- " // renive",
- " if (cg.sources.contains(fn)) {",
- " cg.sources.remove(fn);",
- " }",
- " } else {",
- " if (!cg.sources.contains(fn)) {",
- " cg.sources.add(fn);",
- " }",
- " }",
- " ",
- " ",
- " }",
- " }",
+ "\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 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 );",
"",
+ " ",
"}",
""
]
},
{
"$ xns" : "Gtk",
- "* init" : [
- "",
- " this.el.add_attribute(_this.files_render.el , \"markup\", 1 ); // basnemae",
- " ",
- "/* this.el.add_attribute(_this.files_render.el , \"markup\", 2 );",
- "*/"
- ],
"* pack" : "append_column",
- "gboolean resizable" : true,
+ "bool expand" : true,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false",
- "id" : "files_render",
- "xtype" : "CellRendererText"
- }
- ],
- "utf8 title" : "name",
- "xtype" : "TreeViewColumn"
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- "{",
- " this.el.add_attribute(_this.files_render_use.el , \"active\", 3 );",
- " }"
- ],
- "* pack" : "append_column",
- "gboolean resizable" : false,
- "gint fixed_width" : 50,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,false",
- "gboolean activatable" : true,
- "id" : "files_render_use",
+ "* prop" : "factory",
"listeners" : {
- "toggled" : [
- "( path_string) => { ",
+ "bind" : [
+ "(listitem) => {",
+ " ",
+ "\tvar lbl = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();",
+ "\t ",
+ "\tvar item = (Project.GtkValaSettings) ((Gtk.ListItem)listitem).get_item();",
"",
+ "\titem.bind_property(\"name\",",
+ " lbl, \"label\",",
+ " GLib.BindingFlags.SYNC_CREATE);",
"",
+ "\t ",
+ "}",
+ ""
+ ],
+ "setup" : [
+ "(item) => {",
+ "\t//var j = (JsRender.JsRender) item;",
+ "\tvar gi = (Gtk.ListItem)item;",
+ "\t ",
+ "\tvar lbl = new Gtk.Label(\"\");",
+ "\tlbl.halign = Gtk.Align.START;",
+ "\tgi.set_child(lbl);",
"",
- " var m = _this.files_tree_store.el;",
- " Gtk.TreeIter iter;",
- " Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);",
- " m.get_iter (out iter, path);",
- " GLib.Value val;",
- " m.get_value(iter, 3, out val);",
- " m.set_value(iter, 3, ((bool) val) ? false :true); ",
- " ",
- " // type.",
- " GLib.Value ftval; ",
- " m.get_value(iter, 2, out ftval);",
- " var ftype = (string)ftval; ",
- " ",
- " // full name... ",
- " GLib.Value fval; ",
- " m.get_value(iter, 0, out fval);",
- " var fn = (string)fval;",
- " ",
- " ",
- " var cg = _this.set_vbox.cgroup;",
- " // what's the sleected target?",
- " // update the list..",
- " // if ftype is a dir == then toggle all the bellow.",
- " ",
- " if (ftype == \"dir\") {",
- " _this.files_tree_store.updateDir(fn, ((bool) val) ? false :true);",
- " }",
- " ",
- " // if ftype is a file .. see if all the files in that directory are check and check the dir.",
"",
- " ",
- " if ((bool)val) {",
- " // renive",
- " cg.sources.remove(fn);",
- " } else {",
- " cg.sources.add(fn);",
- " }",
- " ",
- "}"
+ "",
+ "}",
+ ""
]
},
- "xtype" : "CellRendererToggle"
+ "xtype" : "SignalListItemFactory"
}
],
- "utf8 title" : "use",
- "xtype" : "TreeViewColumn"
+ "string title" : "Build Target",
+ "xtype" : "ColumnViewColumn"
}
],
- "string id" : "files_tree",
- "xtype" : "TreeView"
+ "xtype" : "ColumnView"
}
],
"xtype" : "ScrolledWindow"
+ },
+ {
+ "$ xns" : "Gtk",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "id" : "set_vboxb",
+ "int spacing" : 0,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "utf8 label" : "Build Name (executable name)",
+ "xtype" : "Label"
+ },
+ {
+ "$ xns" : "Gtk",
+ "id" : "build_name",
+ "listeners" : {
+ "changed" : [
+ "() => {",
+ "\tif (_this.selected_target == null) {",
+ "\t\treturn;",
+ "\t}",
+ "\tvar name = this.el.text;",
+ "\t// name ischanging.. probably always..",
+ "\tif (_this.selected_target.name != name) {",
+ "\t\t_this.project.compilegroups.unset(_this.selected_target.name);",
+ "\t\t_this.project.compilegroups.set(name, _this.selected_target);",
+ "\t}",
+ "",
+ "\t_this.selected_target.name = this.el.buffer.text;",
+ "}"
+ ]
+ },
+ "xtype" : "Entry"
+ },
+ {
+ "$ xns" : "Gtk",
+ "utf8 label" : "test argments - when run after a build",
+ "xtype" : "Label"
+ },
+ {
+ "$ xns" : "Gtk",
+ "id" : "build_execute_args",
+ "listeners" : {
+ "changed" : [
+ "() => {",
+ " if (_this.selected_target == null) {",
+ " return;",
+ " }",
+ " _this.selected_target.execute_args = this.el.buffer.text;",
+ " ",
+ "}"
+ ]
+ },
+ "string placeholder_text" : "eg. -f somefile -g ",
+ "xtype" : "Entry"
+ }
+ ],
+ "xtype" : "Box"
}
],
"xtype" : "Box"
{
"$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
"$ xns" : "Gtk",
- "* pack" : "add",
+ "bool hexpand" : true,
"int margin_bottom" : 4,
"int margin_end" : 4,
"int margin_start" : 4,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
"listeners" : {
"clicked" : [
"() => { ",
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
+ "bool hexpand" : true,
+ "string label" : "",
+ "xtype" : "Label"
+ },
+ {
+ "$ xns" : "Gtk",
+ "css_classes" : "{ \"suggested-action\" }",
"id" : "save_btn",
"listeners" : {
"clicked" : [
"( ) => { ",
"",
" ",
- "_this.project.writeConfig(); ",
+ "_this.project.save(); ",
" ",
"\t// what about .js ?",
" _this.done = true;",
"xtype" : "Button"
}
],
- "xtype" : "ButtonBox"
+ "xtype" : "Box"
}
],
"xtype" : "Box"
}
],
"listeners" : {
- "closed" : [
+ "close_request" : [
"( ) => {",
- " if (!this.done) {",
- " _this.el.show_all();",
- " ",
- " }",
- "",
+ "\tif (!this.done) {",
+ "\t\treturn true;",
+ "\t}",
+ "\treturn false;",
"}",
""
],
]
},
"uint border_width" : 0,
- "xtype" : "Popover",
+ "xtype" : "Window",
"| void save" : [
"() {",
- " this.project.writeConfig(); ",
+ " this.project.save(); ",
"}"
],
"| void show" : [
- "(Gtk.Widget btn, Project.Gtk project) {",
+ "(Gtk.Window pwin, Project.Gtk project) {",
" ",
" //print(\"ValaProjectSettings show\\n\");",
" ",
" this.project= project;",
- "",
- " this.compile_flags.el.text = _this.project.compilegroups.get(\"_default_\").compile_flags;",
+ "\t ",
+ " this.compile_flags.el.buffer.set_text(",
+ " \tproject.compile_flags.data",
+ "\t);",
+ "\t ",
+ " project.loadVapiIntoStore(_this.vapimodel.el);",
+ " GLib.Timeout.add(500, () => {",
+ " \t\t this.vapi_scroll.el.vadjustment.value = 0;\t ",
+ "\t return false;",
+ " });",
" ",
- " this.default_directory_tree_store.load(); ",
- " this.default_packages_tree_store.load(); ",
- " this.targets_tree_store.load();",
- " this.files_tree_store.load();",
- "",
- "",
- "\tthis.el.set_modal(true);",
- "\tthis.el.set_relative_to(btn);",
- "",
- "\tthis.el.set_position(Gtk.PositionType.RIGHT);",
- "",
+ " ",
+ " \t",
+ " \tproject.loadTargetsIntoStore(this.target_model.el);",
+ "\t",
+ " \t_this.target_sel.el.selected = Gtk.INVALID_LIST_POSITION;",
+ "\t_this.target_sel.selectTarget(null);",
+ "//\tGtk.Allocation rect;",
+ "\t//btn.get_allocation(out rect);",
+ " // this.el.set_pointing_to(rect);",
+ "\tthis.el.set_transient_for(pwin);",
"\t// window + header?",
"\t// print(\"SHOWALL - POPIP\\n\");",
- "\tthis.el.set_size_request(800,500);",
- "\tthis.el.show_all();",
+ "\tthis.el.set_size_request(800,800);",
+ "\tthis.el.show();",
+ "\tthis.notebook.el.page = 0; // first page.",
+ "\t",
"\t//this.view.el.grab_focus();",
"",
"}",
]
}
],
- "modOrder" : "",
- "name" : "ValaProjectSettingsPopover",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/ValaProjectSettingsPopover.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "ValaProjectSettingsPopover"
}
\ No newline at end of file
-static ValaProjectSettingsPopover _ValaProjectSettingsPopover;
+ static ValaProjectSettingsPopover _ValaProjectSettingsPopover;
-public class ValaProjectSettingsPopover : Object
-{
- public Gtk.Popover el;
- private ValaProjectSettingsPopover _this;
-
- public static ValaProjectSettingsPopover singleton()
- {
- if (_ValaProjectSettingsPopover == null) {
- _ValaProjectSettingsPopover= new ValaProjectSettingsPopover();
- }
- return _ValaProjectSettingsPopover;
- }
- public Xcls_label_global label_global;
- public Xcls_label_targets label_targets;
- public Xcls_compile_flags compile_flags;
- public Xcls_default_packages_tree default_packages_tree;
- public Xcls_default_packages_tree_store default_packages_tree_store;
- public Xcls_packages_render packages_render;
- public Xcls_packages_render_use packages_render_use;
- public Xcls_default_directory_tree default_directory_tree;
- public Xcls_default_directory_tree_store default_directory_tree_store;
- public Xcls_directory_render directory_render;
- public Xcls_default_directory_menu default_directory_menu;
- public Xcls_targets_tree_menu targets_tree_menu;
- public Xcls_targets_tree targets_tree;
- public Xcls_targets_tree_store targets_tree_store;
- public Xcls_targets_render targets_render;
- public Xcls_set_vbox set_vbox;
- public Xcls_build_pack_target build_pack_target;
- public Xcls_build_compile_flags build_compile_flags;
- public Xcls_build_execute_args build_execute_args;
- public Xcls_files_tree files_tree;
- public Xcls_files_tree_store files_tree_store;
- public Xcls_files_render files_render;
- public Xcls_files_render_use files_render_use;
- public Xcls_save_btn save_btn;
-
- // my vars (def)
- public Xcls_MainWindow window;
- public Project.Gtk project;
- public bool done;
-
- // ctor
- public ValaProjectSettingsPopover()
- {
- _this = this;
- this.el = new Gtk.Popover( null );
-
- // my vars (dec)
- this.window = null;
- this.project = null;
- this.done = false;
-
- // set gobject values
- this.el.border_width = 0;
- this.el.modal = true;
- this.el.position = Gtk.PositionType.RIGHT;
- var child_0 = new Xcls_Box2( _this );
- child_0.ref();
- this.el.add ( child_0.el );
-
- //listeners
- this.el.closed.connect( ( ) => {
- if (!this.done) {
- _this.el.show_all();
-
- }
-
- });
- this.el.hide.connect( () => {
- if (!this.done) {
- _this.el.show();
-
- }
- });
- }
-
- // user defined functions
- public void show (Gtk.Widget btn, Project.Gtk project) {
-
- //print("ValaProjectSettings show\n");
-
- this.project= project;
-
- this.compile_flags.el.text = _this.project.compilegroups.get("_default_").compile_flags;
-
- this.default_directory_tree_store.load();
- this.default_packages_tree_store.load();
- this.targets_tree_store.load();
- this.files_tree_store.load();
-
-
- this.el.set_modal(true);
- this.el.set_relative_to(btn);
-
- this.el.set_position(Gtk.PositionType.RIGHT);
-
- // window + header?
- // print("SHOWALL - POPIP\n");
- this.el.set_size_request(800,500);
- this.el.show_all();
- //this.view.el.grab_focus();
-
- }
- public void save () {
- this.project.writeConfig();
- }
- public class Xcls_Box2 : Object
+ public class ValaProjectSettingsPopover : Object
{
- public Gtk.Box el;
+ public Gtk.Window el;
private ValaProjectSettingsPopover _this;
-
- // my vars (def)
-
- // ctor
- public Xcls_Box2(ValaProjectSettingsPopover _owner )
+ public static ValaProjectSettingsPopover singleton()
{
- _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_0 = new Xcls_HeaderBar3( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_Notebook4( _this );
- child_1.ref();
- this.el.pack_start ( child_1.el , true,true,0 );
- var child_2 = new Xcls_ButtonBox53( _this );
- child_2.ref();
- this.el.add ( child_2.el );
+ if (_ValaProjectSettingsPopover == null) {
+ _ValaProjectSettingsPopover= new ValaProjectSettingsPopover();
+ }
+ return _ValaProjectSettingsPopover;
}
-
- // user defined functions
- }
- public class Xcls_HeaderBar3 : Object
- {
- public Gtk.HeaderBar el;
- private ValaProjectSettingsPopover _this;
-
+ 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 Xcls_MainWindow window;
+ public Gtk.PositionType position;
+ public Project.GtkValaSettings? selected_target;
+ public uint border_width;
+ public bool done;
+ public Project.Gtk project;
+ public bool autohide;
// ctor
- public Xcls_HeaderBar3(ValaProjectSettingsPopover _owner )
+ public ValaProjectSettingsPopover()
{
- _this = _owner;
- this.el = new Gtk.HeaderBar();
+ _this = this;
+ this.el = new Gtk.Window();
// my vars (dec)
+ this.window = null;
+ this.position = Gtk.PositionType.RIGHT;
+ this.selected_target = null;
+ this.border_width = 0;
+ this.done = false;
+ this.project = null;
+ this.autohide = false;
// set gobject values
- this.el.title = "Change Vala Project Compile settings";
+ this.el.modal = true;
+ var child_1 = new Xcls_HeaderBar2( _this );
+ this.el.titlebar = child_1.el;
+ var child_2 = new Xcls_Box5( _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) {
+
+ //print("ValaProjectSettings show\n");
+
+ 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.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;
- public class Xcls_Notebook4 : Object
- {
- public Gtk.Notebook el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_HeaderBar2(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.HeaderBar();
- // ctor
- public Xcls_Notebook4(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.Notebook();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ var child_1 = new Xcls_Label3( _this );
+ this.el.title_widget = child_1.el;
+ var child_2 = new Xcls_Button4( _this );
+ child_2.ref();
+ this.el.pack_end ( child_2.el );
+ }
- // set gobject values
- var child_0 = new Xcls_label_global( _this );
- child_0.ref();
- var child_1 = new Xcls_label_targets( _this );
- child_1.ref();
- var child_2 = new Xcls_Box7( _this );
- child_2.ref();
- this.el.append_page ( child_2.el , _this.label_global.el );
- var child_3 = new Xcls_Paned28( _this );
- child_3.ref();
- this.el.append_page ( child_3.el , _this.label_targets.el );
+ // user defined functions
}
+ public class Xcls_Label3 : Object
+ {
+ public Gtk.Label el;
+ private ValaProjectSettingsPopover _this;
- // user defined functions
- }
- public class Xcls_label_global : Object
- {
- public Gtk.Label el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Label3(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Change Vala Compile settings" );
- // ctor
- public Xcls_label_global(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.label_global = this;
- this.el = new Gtk.Label( "Global" );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ }
- // set gobject values
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_Button4 : Object
+ {
+ public Gtk.Button el;
+ private ValaProjectSettingsPopover _this;
- public class Xcls_label_targets : Object
- {
- public Gtk.Label el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Button4(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // ctor
- public Xcls_label_targets(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.label_targets = this;
- this.el = new Gtk.Label( "Targets" );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.icon_name = "";
+ this.el.label = "Create / Recreate Build files (configure.ac / makefile.am etc)";
+ }
- // set gobject values
+ // user defined functions
}
- // user defined functions
- }
-
- public class Xcls_Box7 : Object
- {
- public Gtk.Box el;
- private ValaProjectSettingsPopover _this;
+ public class Xcls_Box5 : Object
+ {
+ public Gtk.Box el;
+ private ValaProjectSettingsPopover _this;
- // my vars (def)
- // ctor
- public Xcls_Box7(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ // my vars (def)
- // my vars (dec)
+ // ctor
+ public Xcls_Box5(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_Box59( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ }
- // set gobject values
- this.el.homogeneous = false;
- var child_0 = new Xcls_Label8( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,false,0 );
- var child_1 = new Xcls_compile_flags( _this );
- child_1.ref();
- this.el.pack_start ( child_1.el , false,false,0 );
- var child_2 = new Xcls_Paned10( _this );
- child_2.ref();
- this.el.pack_start ( child_2.el , true,true,0 );
+ // user defined functions
}
+ public class Xcls_notebook : Object
+ {
+ public Gtk.Notebook el;
+ private ValaProjectSettingsPopover _this;
- // user defined functions
- }
- public class Xcls_Label8 : Object
- {
- public Gtk.Label el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
- // 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_Box9( _this );
+ child_3.ref();
+ this.el.append_page ( child_3.el , _this.label_global.el );
+ var child_4 = new Xcls_Paned27( _this );
+ child_4.ref();
+ this.el.append_page ( child_4.el , _this.label_targets.el );
+ }
- // ctor
- public Xcls_Label8(ValaProjectSettingsPopover _owner )
+ // user defined functions
+ }
+ public class Xcls_label_global : Object
{
- _this = _owner;
- this.el = new Gtk.Label( "compile flags" );
+ public Gtk.Label el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_label_global(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.label_global = this;
+ this.el = new Gtk.Label( "Global" );
- public class Xcls_compile_flags : Object
- {
- public Gtk.Entry el;
- private ValaProjectSettingsPopover _this;
+ // my vars (dec)
+ // set gobject values
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_compile_flags(ValaProjectSettingsPopover _owner )
+ public class Xcls_label_targets : Object
{
- _this = _owner;
- _this.compile_flags = this;
- this.el = new Gtk.Entry();
+ public Gtk.Label el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
-
- // set gobject values
- this.el.placeholder_text = "eg. -g --valasrc $BASEDIR ";
- //listeners
- this.el.changed.connect( () => {
-
- _this.project.compilegroups.get("_default_").compile_flags = this.el.text;
- _this.project.writeConfig();
- // _this.project.save();
-
- });
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_label_targets(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.label_targets = this;
+ this.el = new Gtk.Label( "Targets" );
- public class Xcls_Paned10 : Object
- {
- public Gtk.Paned el;
- private ValaProjectSettingsPopover _this;
+ // my vars (dec)
+ // set gobject values
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_Paned10(ValaProjectSettingsPopover _owner )
+ public class Xcls_Box9 : Object
{
- _this = _owner;
- this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
+ public Gtk.Box el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- this.el.position = 300;
- var child_0 = new Xcls_ScrolledWindow11( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_ScrolledWindow18( _this );
- child_1.ref();
- this.el.add2 ( child_1.el );
+ // my vars (def)
+
+ // ctor
+ public Xcls_Box9(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_Label10( _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_Label10 : Object
+ {
+ public Gtk.Label el;
+ private ValaProjectSettingsPopover _this;
- // user defined functions
- }
- public class Xcls_ScrolledWindow11 : Object
- {
- public Gtk.ScrolledWindow el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Label10(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "compile flags" );
- // ctor
- public Xcls_ScrolledWindow11(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.halign = Gtk.Align.START;
+ this.el.hexpand = true;
+ }
- // set gobject values
- this.el.hexpand = true;
- var child_0 = new Xcls_default_packages_tree( _this );
- child_0.ref();
- this.el.add ( child_0.el );
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_default_packages_tree : Object
- {
- public Gtk.TreeView el;
- private ValaProjectSettingsPopover _this;
-
+ public class Xcls_compile_flags : Object
+ {
+ public Gtk.Entry el;
+ private ValaProjectSettingsPopover _this;
- // my vars (def)
- // ctor
- public Xcls_default_packages_tree(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.default_packages_tree = this;
- this.el = new Gtk.TreeView();
+ // my vars (def)
- // my vars (dec)
+ // ctor
+ public Xcls_compile_flags(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.compile_flags = this;
+ this.el = new Gtk.Entry();
- // set gobject values
- this.el.headers_visible = true;
- var child_0 = new Xcls_default_packages_tree_store( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_TreeViewColumn14( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
- var child_2 = new Xcls_TreeViewColumn16( _this );
- child_2.ref();
- this.el.append_column ( child_2.el );
- }
+ // my vars (dec)
- // user defined functions
- }
- public class Xcls_default_packages_tree_store : Object
- {
- public Gtk.ListStore 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_default_packages_tree_store(ValaProjectSettingsPopover _owner )
+ public class Xcls_vapi_scroll : Object
{
- _this = _owner;
- _this.default_packages_tree_store = this;
- this.el = new Gtk.ListStore.newv( { typeof(string), // 0 key type
- typeof(bool) } );
+ public Gtk.ScrolledWindow el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- public void load () {
-
- var def = _this.project.compilegroups.get("_default_");
- var items = def.packages;
-
- this.el.clear();
- var pal = (Palete.Gtk) _this.project.palete;
- var pkgs = pal.packages(_this.project);
- GLib.debug("ValaProjectSettings:packages load %d\n", pkgs.size);
-
- Gtk.TreeIter citer;
-
- for(var i =0 ; i < pkgs.size; i++) {
- this.el.append(out citer);
-
- this.el.set_value(citer, 0, pkgs.get(i) ); // title
- this.el.set_value(citer, 1, items.contains(pkgs.get(i)) );
+ // 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_ColumnView13( _this );
+ this.el.child = child_1.el;
}
- this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
-
+
+ // user defined functions
}
- }
+ public class Xcls_ColumnView13 : Object
+ {
+ public Gtk.ColumnView el;
+ private ValaProjectSettingsPopover _this;
- public class Xcls_TreeViewColumn14 : Object
- {
- public Gtk.TreeViewColumn el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_ColumnView13(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_NoSelection14( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnView( child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_2 = new Xcls_ColumnViewColumn22( _this );
+ child_2.ref();
+ this.el.append_column ( child_2.el );
+ var child_3 = new Xcls_ColumnViewColumn24( _this );
+ child_3.ref();
+ this.el.append_column ( child_3.el );
+ }
- // ctor
- public Xcls_TreeViewColumn14(ValaProjectSettingsPopover _owner )
+ // user defined functions
+ }
+ public class Xcls_NoSelection14 : Object
{
- _this = _owner;
- this.el = new Gtk.TreeViewColumn();
+ public Gtk.NoSelection el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- this.el.title = "package name";
- this.el.expand = true;
- this.el.resizable = true;
- var child_0 = new Xcls_packages_render( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false );
+ // my vars (def)
+
+ // ctor
+ public Xcls_NoSelection14(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_FilterListModel15( _this );
+ child_1.ref();
+ this.el = new Gtk.NoSelection( child_1.el );
+
+ // my vars (dec)
- // init method
+ // set gobject values
+ }
- this.el.add_attribute(_this.packages_render.el , "text", 0 );
+ // user defined functions
}
+ public class Xcls_FilterListModel15 : Object
+ {
+ public Gtk.FilterListModel el;
+ private ValaProjectSettingsPopover _this;
- // user defined functions
- }
- public class Xcls_packages_render : Object
- {
- public Gtk.CellRendererText el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_FilterListModel15(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_SortListModel16( _this );
+ child_1.ref();
+ new Xcls_vapi_filter( _this );
+ this.el = new Gtk.FilterListModel( child_1.el, _this.vapi_filter.el );
- // ctor
- public Xcls_packages_render(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.packages_render = this;
- this.el = new Gtk.CellRendererText();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ }
- // set gobject values
+ // user defined functions
}
+ public class Xcls_SortListModel16 : Object
+ {
+ public Gtk.SortListModel el;
+ private ValaProjectSettingsPopover _this;
- // user defined functions
- }
+ // my vars (def)
- public class Xcls_TreeViewColumn16 : Object
- {
- public Gtk.TreeViewColumn el;
- private ValaProjectSettingsPopover _this;
+ // ctor
+ public Xcls_SortListModel16(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ new Xcls_vapimodel( _this );
+ var child_2 = new Xcls_StringSorter18( _this );
+ child_2.ref();
+ this.el = new Gtk.SortListModel( _this.vapimodel.el, child_2.el );
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ }
- // ctor
- public Xcls_TreeViewColumn16(ValaProjectSettingsPopover _owner )
+ // user defined functions
+ }
+ public class Xcls_vapimodel : Object
{
- _this = _owner;
- this.el = new Gtk.TreeViewColumn();
-
- // my vars (dec)
+ public GLib.ListStore el;
+ private ValaProjectSettingsPopover _this;
- // set gobject values
- this.el.title = "use";
- this.el.resizable = false;
- this.el.fixed_width = 50;
- var child_0 = new Xcls_packages_render_use( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false );
- // init method
+ // my vars (def)
+ // ctor
+ public Xcls_vapimodel(ValaProjectSettingsPopover _owner )
{
- this.el.add_attribute(_this.packages_render_use.el , "active", 1 );
- }
- }
+ _this = _owner;
+ _this.vapimodel = this;
+ this.el = new GLib.ListStore( typeof(Project.VapiSelection) );
- // user defined functions
- }
- public class Xcls_packages_render_use : Object
- {
- public Gtk.CellRendererToggle el;
- private ValaProjectSettingsPopover _this;
+ // my vars (dec)
+ // set gobject values
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_packages_render_use(ValaProjectSettingsPopover _owner )
+ public class Xcls_StringSorter18 : Object
{
- _this = _owner;
- _this.packages_render_use = this;
- this.el = new Gtk.CellRendererToggle();
+ public Gtk.StringSorter el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- this.el.activatable = true;
+ // my vars (def)
- //listeners
- this.el.toggled.connect( ( path_string) => {
- var m = _this.default_packages_tree_store.el;
- Gtk.TreeIter iter;
- Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);
- m.get_iter (out iter, path);
- GLib.Value val;
- m.get_value(iter, 1, out val);
- m.set_value(iter, 1, ((bool) val) ? false :true);
- GLib.Value fval;
- m.get_value(iter, 0, out fval);
- var fn = (string)fval;
-
- var def = _this.project.compilegroups.get("_default_");
- var items = def.packages;
- if ((bool)val) {
- // renive
- items.remove(fn);
- } else {
- items.add(fn);
- }
-
- });
+ // ctor
+ public Xcls_StringSorter18(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_PropertyExpression19( _this );
+ child_1.ref();
+ this.el = new Gtk.StringSorter( child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
}
+ public class Xcls_PropertyExpression19 : Object
+ {
+ public Gtk.PropertyExpression el;
+ private ValaProjectSettingsPopover _this;
- // user defined functions
- }
+ // my vars (def)
+ // ctor
+ public Xcls_PropertyExpression19(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.PropertyExpression( typeof(Project.VapiSelection), null, "sortkey" );
+ // my vars (dec)
- public class Xcls_ScrolledWindow18 : Object
- {
- public Gtk.ScrolledWindow el;
- private ValaProjectSettingsPopover _this;
+ // set gobject values
+ }
+ // user defined functions
+ }
- // my vars (def)
- // ctor
- public Xcls_ScrolledWindow18(ValaProjectSettingsPopover _owner )
+
+ public class Xcls_vapi_filter : Object
{
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
+ public Gtk.StringFilter el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- this.el.hexpand = true;
- var child_0 = new Xcls_default_directory_tree( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_default_directory_menu( _this );
- child_1.ref();
- this.el.add( child_1.el );
- }
+ // my vars (def)
- // user defined functions
- }
- public class Xcls_default_directory_tree : Object
- {
- public Gtk.TreeView el;
- private ValaProjectSettingsPopover _this;
+ // ctor
+ public Xcls_vapi_filter(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.vapi_filter = this;
+ var child_1 = new Xcls_PropertyExpression21( _this );
+ child_1.ref();
+ this.el = new Gtk.StringFilter( child_1.el );
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ }
- // ctor
- public Xcls_default_directory_tree(ValaProjectSettingsPopover _owner )
+ // user defined functions
+ }
+ public class Xcls_PropertyExpression21 : Object
{
- _this = _owner;
- _this.default_directory_tree = this;
- this.el = new Gtk.TreeView();
+ public Gtk.PropertyExpression el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- this.el.headers_visible = true;
- var child_0 = new Xcls_default_directory_tree_store( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_TreeViewColumn21( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
+ // my vars (def)
- //listeners
- this.el.button_press_event.connect( ( ev) => {
- //console.log("button press?");
-
-
- if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) {
- //print("click" + ev.type);
- return false;
- }
- //Gtk.TreePath res;
- //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {
- // return true;
- //}
-
- // this.el.get_selection().select_path(res);
-
- //if (!this.get('/LeftTreeMenu').el) {
- // this.get('/LeftTreeMenu').init();
- // }
-
- _this.default_directory_menu.el.set_screen(Gdk.Screen.get_default());
- _this.default_directory_menu.el.show_all();
- _this.default_directory_menu.el.popup_at_pointer(ev);
- // print("click:" + res.path.to_string());
- return true;
- });
+ // ctor
+ public Xcls_PropertyExpression21(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.PropertyExpression( typeof(Project.VapiSelection), null, "sortkey" );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_default_directory_tree_store : Object
- {
- public Gtk.ListStore el;
- private ValaProjectSettingsPopover _this;
- // my vars (def)
- // ctor
- public Xcls_default_directory_tree_store(ValaProjectSettingsPopover _owner )
+ public class Xcls_ColumnViewColumn22 : Object
{
- _this = _owner;
- _this.default_directory_tree_store = this;
- this.el = new Gtk.ListStore.newv( { typeof(string)
- } );
+ public Gtk.ColumnViewColumn el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- public void load () {
-
- this.el.clear();
-
-
- var def = _this.project.compilegroups.get("_default_");
- var items = def.sources;
-
-
- Gtk.TreeIter citer;
-
- for(var i =0 ; i < items.size; i++) {
- this.el.append(out citer);
-
- this.el.set_value(citer, 0, items.get(i) ); // title
- //this.el.set_value(citer, 1, items.get(i) );
+ // ctor
+ public Xcls_ColumnViewColumn22(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_SignalListItemFactory23( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Vapi Package", child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.expand = true;
}
- this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
-
- }
- }
- public class Xcls_TreeViewColumn21 : Object
- {
- public Gtk.TreeViewColumn el;
- private ValaProjectSettingsPopover _this;
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory23 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private ValaProjectSettingsPopover _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_TreeViewColumn21(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.TreeViewColumn();
+ // ctor
+ public Xcls_SignalListItemFactory23(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.title = "Available Directories (right click to add)";
- this.el.resizable = true;
- var child_0 = new Xcls_directory_render( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false );
+ // set gobject values
- // init method
+ //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);
+
+
+ });
+ }
- this.el.add_attribute(_this.directory_render.el , "text", 0 );
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_directory_render : Object
- {
- public Gtk.CellRendererText el;
- private ValaProjectSettingsPopover _this;
+ public class Xcls_ColumnViewColumn24 : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private ValaProjectSettingsPopover _this;
- // my vars (def)
- // ctor
- public Xcls_directory_render(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.directory_render = this;
- this.el = new Gtk.CellRendererText();
+ // my vars (def)
- // my vars (dec)
+ // ctor
+ public Xcls_ColumnViewColumn24(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_SignalListItemFactory25( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "use", child_1.el );
- // set gobject values
- }
+ // my vars (dec)
- // user defined functions
- }
+ // set gobject values
+ }
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory25 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private ValaProjectSettingsPopover _this;
- public class Xcls_default_directory_menu : Object
- {
- public Gtk.Menu el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
+ // ctor
+ public Xcls_SignalListItemFactory25(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_default_directory_menu(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.default_directory_menu = this;
- this.el = new Gtk.Menu();
+ // set gobject values
- // my vars (dec)
+ //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...
+
+ });
+ }
- // set gobject values
- var child_0 = new Xcls_MenuItem24( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_MenuItem25( _this );
- child_1.ref();
- this.el.add ( child_1.el );
- var child_2 = new Xcls_SeparatorMenuItem26( _this );
- child_2.ref();
- this.el.add ( child_2.el );
- var child_3 = new Xcls_MenuItem27( _this );
- child_3.ref();
- this.el.add ( child_3.el );
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_MenuItem24 : Object
- {
- public Gtk.MenuItem el;
- private ValaProjectSettingsPopover _this;
- // my vars (def)
- // ctor
- public Xcls_MenuItem24(ValaProjectSettingsPopover _owner )
+ public class Xcls_vapi_search : Object
{
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ public Gtk.SearchEntry el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- this.el.label = "Add Directory";
- this.el.show();
+ // my vars (def)
- //listeners
- this.el.activate.connect( () => {
-
- var chooser = new Gtk.FileChooserDialog (
- "Add a directory", _this.window.el, Gtk.FileChooserAction.SELECT_FOLDER ,
- "_Cancel",
- Gtk.ResponseType.CANCEL,
- "_Add",
- Gtk.ResponseType.ACCEPT);
- if (chooser.run () != Gtk.ResponseType.ACCEPT) {
- chooser.close ();
- return;
- }
- chooser.close ();
- // add the directory..
- var fn = _this.project.relPath(chooser.get_filename());
- _this.project.compilegroups.get("_default_").sources.add(fn);
- _this.default_directory_tree_store.load();
- });
- }
+ // ctor
+ public Xcls_vapi_search(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.vapi_search = this;
+ this.el = new Gtk.SearchEntry();
- // user defined functions
- }
+ // my vars (dec)
- public class Xcls_MenuItem25 : Object
- {
- public Gtk.MenuItem el;
- private ValaProjectSettingsPopover _this;
+ // 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
+ }
- // my vars (def)
- // ctor
- public Xcls_MenuItem25(ValaProjectSettingsPopover _owner )
+ public class Xcls_Paned27 : Object
{
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ public Gtk.Paned el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- this.el.label = "Add File";
- this.el.show();
+ // my vars (def)
- //listeners
- this.el.activate.connect( () => {
-
- var chooser = new Gtk.FileChooserDialog (
- "Add a directory", _this.window.el, Gtk.FileChooserAction.OPEN ,
- "_Cancel",
- Gtk.ResponseType.CANCEL,
- "_Add",
- Gtk.ResponseType.ACCEPT);
- if (chooser.run () != Gtk.ResponseType.ACCEPT) {
- chooser.close ();
- return;
- }
- chooser.close ();
- // add the directory..
- var fn = _this.project.relPath(chooser.get_filename());
- _this.project.compilegroups.get("_default_").sources.add(fn);
- _this.default_directory_tree_store.load();
- });
- }
+ // ctor
+ public Xcls_Paned27(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_Box44( _this );
+ this.el.start_child = child_2.el;
+ }
- // user defined functions
- }
+ // user defined functions
+ }
+ public class Xcls_set_vbox : Object
+ {
+ public Gtk.Box el;
+ private ValaProjectSettingsPopover _this;
- public class Xcls_SeparatorMenuItem26 : Object
- {
- public Gtk.SeparatorMenuItem el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
- // 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 );
- // ctor
- public Xcls_SeparatorMenuItem26(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.SeparatorMenuItem();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.homogeneous = false;
+ var child_1 = new Xcls_ScrolledWindow29( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ }
- // set gobject values
- this.el.show();
+ // user defined functions
}
+ public class Xcls_ScrolledWindow29 : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private ValaProjectSettingsPopover _this;
- // user defined functions
- }
- public class Xcls_MenuItem27 : Object
- {
- public Gtk.MenuItem el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
+
+ // ctor
+ public Xcls_ScrolledWindow29(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.ScrolledWindow();
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ this.el.vexpand = true;
+ new Xcls_treeview( _this );
+ this.el.child = _this.treeview.el;
+ }
- // ctor
- public Xcls_MenuItem27(ValaProjectSettingsPopover _owner )
+ // user defined functions
+ }
+ public class Xcls_treeview : Object
{
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ public Gtk.ColumnView el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- this.el.label = "Remove File/Directory";
- this.el.show();
+ // my vars (def)
- //listeners
- this.el.activate.connect( () => {
-
- //
- Gtk.TreeModel mod;
- Gtk.TreeIter iter;
- if (!_this.default_directory_tree.el.get_selection().get_selected(out mod, out iter)) {
- GLib.debug("nothing selected\n");
- return;
- }
-
-
- // add the directory..
-
-
- GLib.Value val;
- mod.get_value(iter,0, out val);
- var fn = (string) val;
-
- GLib.debug("remove: %s\n", fn);
- if (!_this.project.compilegroups.get("_default_").sources.remove(fn)) {
- GLib.debug("remove failed");
- }
- _this.default_directory_tree_store.load();
- });
+ // 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_ColumnViewColumn42( _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;
- // user defined functions
- }
+ // my vars (def)
+ // ctor
+ public Xcls_treeselmodel(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.treeselmodel = this;
+ var child_1 = new Xcls_FilterListModel32( _this );
+ child_1.ref();
+ this.el = new Gtk.SingleSelection( child_1.el );
+ // my vars (dec)
+ // set gobject values
+ }
- public class Xcls_Paned28 : Object
- {
- public Gtk.Paned el;
- private ValaProjectSettingsPopover _this;
+ // user defined functions
+ }
+ public class Xcls_FilterListModel32 : Object
+ {
+ public Gtk.FilterListModel el;
+ private ValaProjectSettingsPopover _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Paned28(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
+ // ctor
+ public Xcls_FilterListModel32(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ new Xcls_treelistsort( _this );
+ var child_2 = new Xcls_CustomFilter39( _this );
+ child_2.ref();
+ this.el = new Gtk.FilterListModel( _this.treelistsort.el, child_2.el );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.position = 300;
- var child_0 = new Xcls_ScrolledWindow29( _this );
- child_0.ref();
- this.el.add1 ( child_0.el );
- var child_1 = new Xcls_set_vbox( _this );
- child_1.ref();
- this.el.add2 ( child_1.el );
- }
+ // set gobject values
+ }
- // user defined functions
- }
- public class Xcls_ScrolledWindow29 : Object
- {
- public Gtk.ScrolledWindow el;
- private ValaProjectSettingsPopover _this;
+ // user defined functions
+ }
+ public class Xcls_treelistsort : Object
+ {
+ public Gtk.SortListModel el;
+ private ValaProjectSettingsPopover _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_ScrolledWindow29(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
+ // ctor
+ public Xcls_treelistsort(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.treelistsort = this;
+ new Xcls_treelistmodel( _this );
+ var child_2 = new Xcls_TreeListRowSorter36( _this );
+ child_2.ref();
+ this.el = new Gtk.SortListModel( _this.treelistmodel.el, child_2.el );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- var child_0 = new Xcls_targets_tree_menu( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_targets_tree( _this );
- child_1.ref();
- this.el.add ( child_1.el );
+ // set gobject values
- // init method
+ // init method
- {
- this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
-
+ {
+ //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;
- // user defined functions
- }
- public class Xcls_targets_tree_menu : Object
- {
- public Gtk.Menu el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
- // 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;
+} );
- // ctor
- public Xcls_targets_tree_menu(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.targets_tree_menu = this;
- this.el = new Gtk.Menu();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ }
- // set gobject values
- var child_0 = new Xcls_MenuItem31( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_SeparatorMenuItem32( _this );
- child_1.ref();
- this.el.add ( child_1.el );
- var child_2 = new Xcls_MenuItem33( _this );
- child_2.ref();
- this.el.add ( child_2.el );
+ // user defined functions
}
-
- // user defined functions
- }
- public class Xcls_MenuItem31 : Object
- {
- public Gtk.MenuItem el;
- private ValaProjectSettingsPopover _this;
+ public class Xcls_treemodel : Object
+ {
+ public GLib.ListStore el;
+ private ValaProjectSettingsPopover _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_MenuItem31(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ // 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
- this.el.label = "Add Compile Target";
- this.el.show();
+ // set gobject values
+ }
- //listeners
- this.el.activate.connect( () => {
-
- if (_this.project.compilegroups.has_key("NEW GROUP")) {
- return;
- }
-
- // add the directory..
-
- _this.project.compilegroups.set("NEW GROUP", new Project.GtkValaSettings("NEW GROUP"));
- _this.targets_tree_store.load();
- });
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_SeparatorMenuItem32 : Object
- {
- public Gtk.SeparatorMenuItem el;
- private ValaProjectSettingsPopover _this;
+ public class Xcls_TreeListRowSorter36 : Object
+ {
+ public Gtk.TreeListRowSorter el;
+ private ValaProjectSettingsPopover _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_SeparatorMenuItem32(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.SeparatorMenuItem();
+ // ctor
+ public Xcls_TreeListRowSorter36(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_StringSorter37( _this );
+ child_1.ref();
+ this.el = new Gtk.TreeListRowSorter( child_1.el );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.show();
+ // set gobject values
+ }
+
+ // user defined functions
}
+ public class Xcls_StringSorter37 : Object
+ {
+ public Gtk.StringSorter el;
+ private ValaProjectSettingsPopover _this;
- // user defined functions
- }
- public class Xcls_MenuItem33 : Object
- {
- public Gtk.MenuItem el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
+ // ctor
+ public Xcls_StringSorter37(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_PropertyExpression38( _this );
+ child_1.ref();
+ this.el = new Gtk.StringSorter( child_1.el );
- // my vars (def)
+ // my vars (dec)
- // ctor
- public Xcls_MenuItem33(ValaProjectSettingsPopover _owner )
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+ public class Xcls_PropertyExpression38 : Object
{
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ public Gtk.PropertyExpression el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- this.el.label = "Remove Target";
- this.el.show();
+ // my vars (def)
- //listeners
- this.el.activate.connect( () => {
-
- //
- Gtk.TreeModel mod;
- Gtk.TreeIter iter;
- if (!_this.targets_tree.el.get_selection().get_selected(out mod, out iter)) {
- GLib.debug("nothing selected\n");
- return;
- }
-
-
- // add the directory..
-
-
- GLib.Value val;
- mod.get_value(iter,0, out val);
- var fn = (string) val;
-
- GLib.debug("remove: %s\n", fn);
- if (!_this.project.compilegroups.unset(fn)) {
- GLib.debug("remove failed");
- }
- _this.targets_tree_store.load();
- });
- }
+ // ctor
+ public Xcls_PropertyExpression38(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
- // user defined functions
- }
+ // my vars (dec)
+ // set gobject values
+ }
- public class Xcls_targets_tree : Object
- {
- public Gtk.TreeView el;
- private ValaProjectSettingsPopover _this;
+ // user defined functions
+ }
- // my vars (def)
- public string cursor;
- // ctor
- public Xcls_targets_tree(ValaProjectSettingsPopover _owner )
+
+ public class Xcls_CustomFilter39 : Object
{
- _this = _owner;
- _this.targets_tree = this;
- this.el = new Gtk.TreeView();
+ public Gtk.CustomFilter el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- var child_0 = new Xcls_targets_tree_store( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_TreeViewColumn36( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
+ // my vars (def)
- //listeners
- this.el.button_press_event.connect( ( ev) => {
- //console.log("button press?");
-
-
- if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) {
- //print("click" + ev.type);
- return false;
- }
- //Gtk.TreePath res;
- //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {
- // return true;
- //}
-
- // this.el.get_selection().select_path(res);
-
- //if (!this.get('/LeftTreeMenu').el) {
- // this.get('/LeftTreeMenu').init();
- // }
-
- _this.targets_tree_menu.el.set_screen(Gdk.Screen.get_default());
- _this.targets_tree_menu.el.show_all();
- _this.targets_tree_menu.el.popup_at_pointer(ev);
- // print("click:" + res.path.to_string());
- return true;
- });
- this.el.cursor_changed.connect( ( ) => {
-
- if (this.cursor != "") {
- // save the values..
- }
-
- // load the new values.
-
-
- Gtk.TreeModel mod;
- Gtk.TreeIter iter;
- if (!this.el.get_selection().get_selected(out mod, out iter)) {
- GLib.debug("nothing selected\n");
- // should disable the right hand side..
- _this.set_vbox.el.hide();
- return;
- }
- _this.set_vbox.el.show();
-
- // add the directory..
-
-
- GLib.Value val;
- mod.get_value(iter,0, out val);
- var fn = (string) val;
-
- this.cursor = fn;
- var cg = _this.project.compilegroups.get(fn);
-
- _this.build_pack_target.el.set_text(cg.target_bin);
- _this.build_compile_flags.el.set_text(cg.compile_flags);
- _this.build_execute_args.el.set_text(cg.execute_args);
-
- _this.set_vbox.cgroup = cg;
- _this.files_tree_store.update();
-
- // load the srouces
-
-
- });
- }
+ // ctor
+ public Xcls_CustomFilter39(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());
+ var j = (JsRender.JsRender) tr;
+ if (j.xtype == "Gtk") {
+ return true;
+ }
+ if (j.xtype != "Dir") {
+ return j.path.has_suffix(".vala") || j.path.has_suffix(".c");
+ }
+ // dirs..
+
+ for (var i =0 ; i < j.childfiles.n_items; i++) {
+ var f = (JsRender.JsRender) j.childfiles.get_item(i);
+ if (f.xtype == "Gtk") {
+ return true;
+ }
+ if (f.path.has_suffix(".vala") || f.path.has_suffix(".c")) {
+ return true;
+ }
+ }
+ return false;
+
+} );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
- // user defined functions
- }
- public class Xcls_targets_tree_store : Object
- {
- public Gtk.ListStore el;
- private ValaProjectSettingsPopover _this;
+ // user defined functions
+ }
- // my vars (def)
- // ctor
- public Xcls_targets_tree_store(ValaProjectSettingsPopover _owner )
+ public class Xcls_name : Object
{
- _this = _owner;
- _this.targets_tree_store = this;
- this.el = new Gtk.ListStore.newv( { typeof(string), // 0 key type
- typeof(string) // ??
- } );
+ public Gtk.ColumnViewColumn el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- public void load () {
-
- this.el.clear();
-
-
- var cg = _this.project.compilegroups;
-
- _this.targets_tree.cursor = "";
- Gtk.TreeIter citer;
- var iter = cg.map_iterator();
- while(iter.next()) {
- var key = iter.get_key();
- if (key == "_default_") {
- continue;
+ // ctor
+ public Xcls_name(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.name = this;
+ var child_1 = new Xcls_SignalListItemFactory41( _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")
+ ));
+ ;
+
}
-
- this.el.append(out citer);
-
- this.el.set_value(citer, 0, key ); // title
- //this.el.set_value(citer, 1, items.get(i) );
- };
- this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
- _this.set_vbox.el.hide();
- }
- }
-
- public class Xcls_TreeViewColumn36 : Object
- {
- public Gtk.TreeViewColumn el;
- private ValaProjectSettingsPopover _this;
-
-
- // my vars (def)
+ }
- // ctor
- public Xcls_TreeViewColumn36(ValaProjectSettingsPopover _owner )
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory41 : Object
{
- _this = _owner;
- this.el = new Gtk.TreeViewColumn();
-
- // my vars (dec)
+ public Gtk.SignalListItemFactory el;
+ private ValaProjectSettingsPopover _this;
- // set gobject values
- this.el.title = "name";
- this.el.resizable = true;
- var child_0 = new Xcls_targets_render( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false );
- // init method
+ // my vars (def)
+ // ctor
+ public Xcls_SignalListItemFactory41(ValaProjectSettingsPopover _owner )
{
- this.el.add_attribute(_this.targets_render.el , "text", 0 );
- }
- }
-
- // user defined functions
- }
- public class Xcls_targets_render : Object
- {
- public Gtk.CellRendererText el;
- private ValaProjectSettingsPopover _this;
+ _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
+ }
- // my vars (def)
- // ctor
- public Xcls_targets_render(ValaProjectSettingsPopover _owner )
+ public class Xcls_ColumnViewColumn42 : Object
{
- _this = _owner;
- _this.targets_render = this;
- this.el = new Gtk.CellRendererText();
+ public Gtk.ColumnViewColumn el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- this.el.editable = true;
+ // my vars (def)
- //listeners
- this.el.edited.connect( (path, newtext) => {
-
- Gtk.TreeIter iter;
- _this.targets_tree_store.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
- GLib.Value gval;
- _this.targets_tree_store.el.get_value(iter,0, out gval);
- var oldval = (string)gval;
- if (oldval == newtext) {
- return;
- }
- var cg = _this.project.compilegroups.get(oldval);
- cg.name = newtext;
- _this.project.compilegroups.unset(oldval);
- _this.project.compilegroups.set(newtext, cg);
- _this.targets_tree_store.load();
- });
- }
+ // ctor
+ public Xcls_ColumnViewColumn42(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_SignalListItemFactory43( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "use", child_1.el );
- // user defined functions
- }
+ // my vars (dec)
+ // set gobject values
+ }
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory43 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private ValaProjectSettingsPopover _this;
- public class Xcls_set_vbox : Object
- {
- public Gtk.Box el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
+ // ctor
+ public Xcls_SignalListItemFactory43(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
- // my vars (def)
- public Project.GtkValaSettings cgroup;
+ // my vars (dec)
- // ctor
- public Xcls_set_vbox(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.set_vbox = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ // set gobject values
- // my vars (dec)
- this.cgroup = null;
+ //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...
+
+ });
+ }
- // set gobject values
- this.el.homogeneous = false;
- var child_0 = new Xcls_Label39( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,false,0 );
- var child_1 = new Xcls_build_pack_target( _this );
- child_1.ref();
- this.el.pack_start ( child_1.el , false,false,0 );
- var child_2 = new Xcls_Label41( _this );
- child_2.ref();
- this.el.pack_start ( child_2.el , false,false,0 );
- var child_3 = new Xcls_build_compile_flags( _this );
- child_3.ref();
- this.el.pack_start ( child_3.el , false,false,0 );
- var child_4 = new Xcls_Label43( _this );
- child_4.ref();
- this.el.pack_start ( child_4.el , false,false,0 );
- var child_5 = new Xcls_build_execute_args( _this );
- child_5.ref();
- this.el.pack_start ( child_5.el , false,false,0 );
- var child_6 = new Xcls_Label45( _this );
- child_6.ref();
- this.el.pack_start ( child_6.el , false,false,0 );
- var child_7 = new Xcls_ScrolledWindow46( _this );
- child_7.ref();
- this.el.pack_start ( child_7.el , true,true,0 );
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_Label39 : Object
- {
- public Gtk.Label el;
- private ValaProjectSettingsPopover _this;
- // my vars (def)
- // ctor
- public Xcls_Label39(ValaProjectSettingsPopover _owner )
+
+ public class Xcls_Box44 : Object
{
- _this = _owner;
- this.el = new Gtk.Label( "target filename" );
+ public Gtk.Box el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_Box44(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Box45( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_ScrolledWindow48( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ new Xcls_set_vboxb( _this );
+ this.el.append( _this.set_vboxb.el );
+ }
- public class Xcls_build_pack_target : Object
- {
- public Gtk.Entry el;
- private ValaProjectSettingsPopover _this;
+ // user defined functions
+ }
+ public class Xcls_Box45 : Object
+ {
+ public Gtk.Box el;
+ private ValaProjectSettingsPopover _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_build_pack_target(ValaProjectSettingsPopover _owner )
+ // ctor
+ public Xcls_Box45(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_Button46( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ var child_2 = new Xcls_Button47( _this );
+ child_2.ref();
+ this.el.append( child_2.el );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_Button46 : Object
{
- _this = _owner;
- _this.build_pack_target = this;
- this.el = new Gtk.Entry();
+ public Gtk.Button el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
+ // my vars (def)
- //listeners
- this.el.changed.connect( () => {
- if (_this.targets_tree.cursor.length < 1) {
- return;
- }
- _this.project.compilegroups.get(_this.targets_tree.cursor).target_bin = this.el.text;
- });
- }
+ // ctor
+ public Xcls_Button46(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // user defined functions
- }
+ // my vars (dec)
- public class Xcls_Label41 : Object
- {
- public Gtk.Label el;
- private ValaProjectSettingsPopover _this;
+ // 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;
+ }
+ }
+
+
+
+ });
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_Label41(ValaProjectSettingsPopover _owner )
+ public class Xcls_Button47 : Object
{
- _this = _owner;
- this.el = new Gtk.Label( "compile flags" );
+ public Gtk.Button el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
-
- public class Xcls_build_compile_flags : Object
- {
- public Gtk.Entry el;
- private ValaProjectSettingsPopover _this;
+ // ctor
+ public Xcls_Button47(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
+ }
- // my vars (def)
- // ctor
- public Xcls_build_compile_flags(ValaProjectSettingsPopover _owner )
+ public class Xcls_ScrolledWindow48 : Object
{
- _this = _owner;
- _this.build_compile_flags = this;
- this.el = new Gtk.Entry();
+ public Gtk.ScrolledWindow el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
+ // my vars (def)
- //listeners
- this.el.changed.connect( () => {
- if (_this.targets_tree.cursor.length < 1) {
- return;
- }
- _this.project.compilegroups.get(_this.targets_tree.cursor).compile_flags = this.el.text;
- });
- }
+ // ctor
+ public Xcls_ScrolledWindow48(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.ScrolledWindow();
- // user defined functions
- }
+ // my vars (dec)
- public class Xcls_Label43 : Object
- {
- public Gtk.Label el;
- private ValaProjectSettingsPopover _this;
+ // set gobject values
+ this.el.vexpand = true;
+ var child_1 = new Xcls_ColumnView49( _this );
+ this.el.child = child_1.el;
+ // init method
- // my vars (def)
+ {
+ this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+
+ }
+ }
- // ctor
- public Xcls_Label43(ValaProjectSettingsPopover _owner )
+ // user defined functions
+ }
+ public class Xcls_ColumnView49 : Object
{
- _this = _owner;
- this.el = new Gtk.Label( "test argments - when run after a build" );
+ public Gtk.ColumnView el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- }
-
- // user defined functions
- }
+ // my vars (def)
- public class Xcls_build_execute_args : Object
- {
- public Gtk.Entry el;
- private ValaProjectSettingsPopover _this;
+ // ctor
+ public Xcls_ColumnView49(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ new Xcls_target_sel( _this );
+ this.el = new Gtk.ColumnView( _this.target_sel.el );
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ var child_2 = new Xcls_ColumnViewColumn52( _this );
+ child_2.ref();
+ this.el.append_column ( child_2.el );
+ }
- // ctor
- public Xcls_build_execute_args(ValaProjectSettingsPopover _owner )
+ // user defined functions
+ }
+ public class Xcls_target_sel : Object
{
- _this = _owner;
- _this.build_execute_args = this;
- this.el = new Gtk.Entry();
+ public Gtk.SingleSelection el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
-
- // set gobject values
- this.el.placeholder_text = "eg. -f somefile -g ";
- //listeners
- this.el.changed.connect( () => {
- if (_this.targets_tree.cursor.length < 1) {
- return;
- }
- _this.project.compilegroups.get(_this.targets_tree.cursor).execute_args = this.el.text;
- });
- }
+ // my vars (def)
- // user defined functions
- }
+ // 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 );
- public class Xcls_Label45 : Object
- {
- public Gtk.Label el;
- private ValaProjectSettingsPopover _this;
+ // my vars (dec)
+ // set gobject values
- // my vars (def)
+ //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);
+
+ });
+ }
- // ctor
- public Xcls_Label45(ValaProjectSettingsPopover _owner )
+ // 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
{
- _this = _owner;
- this.el = new Gtk.Label( "Files to compile" );
+ public GLib.ListStore el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- }
-
- // user defined functions
- }
+ // my vars (def)
- public class Xcls_ScrolledWindow46 : Object
- {
- public Gtk.ScrolledWindow el;
- private ValaProjectSettingsPopover _this;
+ // ctor
+ public Xcls_target_model(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.target_model = this;
+ this.el = new GLib.ListStore( typeof(Project.GtkValaSettings) );
+ // my vars (dec)
- // my vars (def)
+ // set gobject values
+ }
- // ctor
- public Xcls_ScrolledWindow46(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
+ // user defined functions
+ }
- // my vars (dec)
- // set gobject values
- var child_0 = new Xcls_files_tree( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- }
+ public class Xcls_ColumnViewColumn52 : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private ValaProjectSettingsPopover _this;
- // user defined functions
- }
- public class Xcls_files_tree : Object
- {
- public Gtk.TreeView el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_ColumnViewColumn52(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ var child_1 = new Xcls_SignalListItemFactory53( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Build Target", child_1.el );
- // ctor
- public Xcls_files_tree(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.files_tree = this;
- this.el = new Gtk.TreeView();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.expand = true;
+ }
- // set gobject values
- var child_0 = new Xcls_files_tree_store( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_TreeViewColumn49( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
- var child_2 = new Xcls_TreeViewColumn51( _this );
- child_2.ref();
- this.el.append_column ( child_2.el );
+ // user defined functions
}
-
- // user defined functions
- }
- public class Xcls_files_tree_store : Object
- {
- public Gtk.ListStore el;
- private ValaProjectSettingsPopover _this;
+ public class Xcls_SignalListItemFactory53 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private ValaProjectSettingsPopover _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_files_tree_store(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.files_tree_store = this;
- this.el = new Gtk.ListStore.newv( { typeof(string), // 0 file name
- typeof(string), // 0 basename
- typeof(string), // type (dir orfile)
- typeof(bool) // is checked.
- } );
+ // ctor
+ public Xcls_SignalListItemFactory53(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- }
+ // set gobject values
- // user defined functions
- public void update () {
-
-
- Gtk.TreeIter citer;
-
- for(var i =0 ; i < this.el.iter_n_children(null); i++) {
- this.el.iter_nth_child(out citer,null,i);
-
- GLib.Value val;
- this.el.get_value(citer,0, out val);
- var fn = (string) val;
+ //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);
- var active = false;
- if (_this.set_vbox.cgroup.sources.contains(fn)) {
- active = true;
- }
- this.el.set_value(citer, 3, active ); // checked
- }
-
- _this.set_vbox.el.set_sensitive(true);
- }
- public void updateDir (string dname, bool bval) {
-
- Gtk.TreeIter citer;
-
- var cg = _this.set_vbox.cgroup;
- for(var i =0 ; i < this.el.iter_n_children(null); i++) {
- this.el.iter_nth_child(out citer,null,i);
-
- GLib.Value val;
- this.el.get_value(citer,0, out val);
- var fn = (string) val;
- if ( Path.get_dirname (fn) == dname) {
-
- this.el.set_value(citer, 3, bval ); // checked
-
-
-
- if (!bval) {
- // renive
- if (cg.sources.contains(fn)) {
- cg.sources.remove(fn);
- }
- } else {
- if (!cg.sources.contains(fn)) {
- cg.sources.add(fn);
- }
- }
-
-
- }
- }
-
- }
- public void load () {
-
- this.el.clear();
-
-
- var def = _this.project.compilegroups.get("_default_");
- var items = def.sources;
-
-
-
-
-
- Gtk.TreeIter citer;
-
- for(var i =0 ; i < items.size; i++) {
-
- var files = _this.project.filesForCompile(items.get(i), false);
- if (files.size < 1) {
- continue;
- }
-
- this.el.append(out citer);
+ });
+ this.el.bind.connect( (listitem) => {
- this.el.set_value(citer, 0, items.get(i) ); // title
- this.el.set_value(citer, 1, "<span foreground=\"green\" font_weight=\"bold\">" +
- GLib.Markup.escape_text(items.get(i)) + "</span>"
- ); // title
- GLib.debug("ADD item %s", items.get(i));
- this.el.set_value(citer, 2, "dir"); // type
- this.el.set_value(citer, 3, false ); // checked
-
-
-
- for(var j =0 ; j < files.size; j++) {
- this.el.append(out citer);
- GLib.debug("ADD item %s", files.get(j));
- this.el.set_value(citer, 0, files.get(j) ); // title
- this.el.set_value(citer, 1, GLib.Markup.escape_text( Path.get_basename (files.get(j))) ); // title
- this.el.set_value(citer, 2, "file"); // type
- this.el.set_value(citer, 3, false ); // checked
-
- }
+ 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);
- //this.el.set_value(citer, 1, items.get(i) );
- }
- this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
- if (_this.set_vbox.cgroup == null) {
- _this.set_vbox.el.set_sensitive(false);
-
+
+ });
}
+
+ // user defined functions
}
- }
- public class Xcls_TreeViewColumn49 : Object
- {
- public Gtk.TreeViewColumn el;
- private ValaProjectSettingsPopover _this;
- // my vars (def)
- // ctor
- public Xcls_TreeViewColumn49(ValaProjectSettingsPopover _owner )
+ public class Xcls_set_vboxb : Object
{
- _this = _owner;
- this.el = new Gtk.TreeViewColumn();
+ public Gtk.Box el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- this.el.title = "name";
- this.el.resizable = true;
- var child_0 = new Xcls_files_render( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false );
+ // my vars (def)
- // init method
+ // ctor
+ public Xcls_set_vboxb(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.set_vboxb = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // my vars (dec)
+
+ // set gobject values
+ var child_1 = new Xcls_Label55( _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_Label57( _this );
+ child_3.ref();
+ this.el.append( child_3.el );
+ new Xcls_build_execute_args( _this );
+ this.el.append( _this.build_execute_args.el );
+ }
- this.el.add_attribute(_this.files_render.el , "markup", 1 ); // basnemae
-
- /* this.el.add_attribute(_this.files_render.el , "markup", 2 );
- */
+ // user defined functions
}
+ public class Xcls_Label55 : Object
+ {
+ public Gtk.Label el;
+ private ValaProjectSettingsPopover _this;
- // user defined functions
- }
- public class Xcls_files_render : Object
- {
- public Gtk.CellRendererText el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Label55(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Build Name (executable name)" );
- // ctor
- public Xcls_files_render(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- _this.files_render = this;
- this.el = new Gtk.CellRendererText();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ }
- // set gobject values
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_build_name : Object
+ {
+ public Gtk.Entry el;
+ private ValaProjectSettingsPopover _this;
- public class Xcls_TreeViewColumn51 : Object
- {
- public Gtk.TreeViewColumn 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;
+ });
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_TreeViewColumn51(ValaProjectSettingsPopover _owner )
+ public class Xcls_Label57 : Object
{
- _this = _owner;
- this.el = new Gtk.TreeViewColumn();
+ public Gtk.Label el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
-
- // set gobject values
- this.el.title = "use";
- this.el.resizable = false;
- this.el.fixed_width = 50;
- var child_0 = new Xcls_files_render_use( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false );
- // init method
+ // my vars (def)
+ // ctor
+ public Xcls_Label57(ValaProjectSettingsPopover _owner )
{
- this.el.add_attribute(_this.files_render_use.el , "active", 3 );
- }
- }
+ _this = _owner;
+ this.el = new Gtk.Label( "test argments - when run after a build" );
- // user defined functions
- }
- public class Xcls_files_render_use : Object
- {
- public Gtk.CellRendererToggle el;
- private ValaProjectSettingsPopover _this;
+ // my vars (dec)
+ // set gobject values
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_files_render_use(ValaProjectSettingsPopover _owner )
+ public class Xcls_build_execute_args : Object
{
- _this = _owner;
- _this.files_render_use = this;
- this.el = new Gtk.CellRendererToggle();
+ public Gtk.Entry el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- this.el.activatable = true;
+ // my vars (def)
- //listeners
- this.el.toggled.connect( ( path_string) => {
-
-
-
- var m = _this.files_tree_store.el;
- Gtk.TreeIter iter;
- Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);
- m.get_iter (out iter, path);
- GLib.Value val;
- m.get_value(iter, 3, out val);
- m.set_value(iter, 3, ((bool) val) ? false :true);
-
- // type.
- GLib.Value ftval;
- m.get_value(iter, 2, out ftval);
- var ftype = (string)ftval;
-
- // full name...
- GLib.Value fval;
- m.get_value(iter, 0, out fval);
- var fn = (string)fval;
-
-
- var cg = _this.set_vbox.cgroup;
- // what's the sleected target?
- // update the list..
- // if ftype is a dir == then toggle all the bellow.
-
- if (ftype == "dir") {
- _this.files_tree_store.updateDir(fn, ((bool) val) ? false :true);
- }
-
- // if ftype is a file .. see if all the files in that directory are check and check the dir.
-
-
- if ((bool)val) {
- // renive
- cg.sources.remove(fn);
- } else {
- cg.sources.add(fn);
- }
-
- });
- }
+ // 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_ButtonBox53 : Object
- {
- public Gtk.ButtonBox el;
- private ValaProjectSettingsPopover _this;
+ public class Xcls_Box59 : Object
+ {
+ public Gtk.Box el;
+ private ValaProjectSettingsPopover _this;
- // my vars (def)
- // ctor
- public Xcls_ButtonBox53(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.ButtonBox( Gtk.Orientation.HORIZONTAL );
+ // my vars (def)
- // my vars (dec)
+ // ctor
+ public Xcls_Box59(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+ // 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_Button60( _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 );
+ new Xcls_save_btn( _this );
+ this.el.append( _this.save_btn.el );
+ }
- // set gobject values
- this.el.margin_end = 4;
- this.el.margin_start = 4;
- this.el.margin_bottom = 4;
- this.el.margin_top = 4;
- var child_0 = new Xcls_Button54( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_save_btn( _this );
- child_1.ref();
- this.el.add ( child_1.el );
+ // user defined functions
}
+ public class Xcls_Button60 : Object
+ {
+ public Gtk.Button el;
+ private ValaProjectSettingsPopover _this;
- // user defined functions
- }
- public class Xcls_Button54 : Object
- {
- public Gtk.Button el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Button60(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // ctor
- public Xcls_Button54(ValaProjectSettingsPopover _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.label = "Cancel";
- // set gobject values
- this.el.label = "Cancel";
+ //listeners
+ this.el.clicked.connect( () => {
+
+ _this.done = true;
+ _this.el.hide();
+ });
+ }
- //listeners
- this.el.clicked.connect( () => {
-
- _this.done = true;
- _this.el.hide();
- });
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_Label61 : Object
+ {
+ public Gtk.Label el;
+ private ValaProjectSettingsPopover _this;
- public class Xcls_save_btn : Object
- {
- public Gtk.Button el;
- private ValaProjectSettingsPopover _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Label61(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "" );
- // ctor
- public Xcls_save_btn(ValaProjectSettingsPopover _owner )
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_save_btn : Object
{
- _this = _owner;
- _this.save_btn = this;
- this.el = new Gtk.Button();
+ public Gtk.Button el;
+ private ValaProjectSettingsPopover _this;
- // my vars (dec)
- // set gobject values
- this.el.label = "Save";
+ // my vars (def)
- //listeners
- this.el.clicked.connect( ( ) => {
-
-
- _this.project.writeConfig();
-
- // what about .js ?
- _this.done = true;
- _this.el.hide();
-
- // hopefull this will work with bjs files..
-
-
-
- });
- }
+ // ctor
+ public Xcls_save_btn(ValaProjectSettingsPopover _owner )
+ {
+ _this = _owner;
+ _this.save_btn = this;
+ this.el = new Gtk.Button();
- // user defined functions
- }
+ // 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();
+
+ // hopefull this will work with bjs files..
+
+
+
+ });
+ }
+
+ // user defined functions
+ }
-}
+ }
+++ /dev/null
-{
- "build_module" : "builder",
- "items" : [
- {
- "$ shadow_type" : "Gtk.ShadowType.IN",
- "$ xns" : "Gtk",
- "* init" : [
- " this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
- " "
- ],
- "@ void select" : "(string key, string type, string skel, string etype)",
- "id" : "WindowAddProp",
- "items" : [
- {
- "$ enable_tree_lines" : true,
- "$ headers_visible" : true,
- "$ xns" : "Gtk",
- "* init" : [
- "{ ",
- " var description = new Pango.FontDescription();",
- " description.set_size(8000);",
- " this.el.override_font(description); ",
- " ",
- " this.el.get_selection().set_mode( Gtk.SelectionMode.SINGLE);",
- " ",
- "",
- " ",
- " ",
- " ",
- "}",
- ""
- ],
- "* pack" : "add",
- "items" : [
- {
- "$ columns" : [
- "typeof(string), // 0 real key",
- "typeof(string), // 1 real type",
- "typeof(string), // 2 docs ?",
- "typeof(string), // 3 visable desc",
- "typeof(string), // 4 function desc",
- "typeof(string) // 5 element type (event|prop)",
- " "
- ],
- "$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "model",
- "n_columns" : 6,
- "xtype" : "ListStore",
- "| string getValue" : [
- "(Gtk.TreeIter iter, int col)",
- "{",
- "",
- " GLib.Value value;",
- " this.el.get_value(iter, col, out value);",
- "",
- " return (string)value;",
- " ",
- "}"
- ]
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- " this.el.add_attribute(_this.namerender.el , \"markup\", 4 );",
- " ",
- ""
- ],
- "* pack" : "append_column",
- "id" : "namecol",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "namerender",
- "xtype" : "CellRendererText"
- }
- ],
- "utf8 title" : "Double click to add",
- "xtype" : "TreeViewColumn"
- }
- ],
- "listeners" : {
- "row_activated" : [
- "(path, column) => {",
- "",
- " Gtk.TreeIter iter;",
- "",
- "",
- " var m = _this.model;",
- " ",
- " m.el.get_iter(out iter,path);",
- " ",
- " ",
- " // var val = \"\";",
- " ",
- " ",
- " var key = m.getValue(iter, 0);",
- " ",
- " var type = m.getValue(iter, 1);",
- " var skel = m.getValue(iter, 3);",
- " var etype = m.getValue(iter, 5);",
- " ",
- " ",
- " _this.select(key,etype == \"signals\" ? \"\" : type,skel, etype);",
- " ",
- "}",
- " "
- ]
- },
- "tooltip_column" : 2,
- "xtype" : "TreeView"
- }
- ],
- "xtype" : "ScrolledWindow",
- "| void clear" : [
- "() {",
- " this.model.el.clear();",
- "",
- "}"
- ],
- "| void show" : [
- "(Palete.Palete pal, string etype, string xtype) {",
- " this.model.el.clear();",
- "",
- " Gtk.TreeIter iter;",
- " var elementList = pal.getPropertiesFor( xtype,etype);",
- " ",
- " ",
- " //print (\"GOT \" + elementList.length + \" items for \" + fullpath + \"|\" + type);",
- " // console.dump(elementList);",
- " ",
- " var miter = elementList.map_iterator();",
- " while (miter.next()) {",
- " var p = miter.get_value();",
- " ",
- " this.model.el.append(out iter);",
- "",
- "\t\tvar dname = p.name;",
- "\t\tvar dtype = p.type;",
- "\t\t ",
- "",
- " this.model.el.set(iter,",
- " 0, p.name, ",
- " 1, p.type,",
- " 2, \"<b>\" + p.name +\"</b> <i>\"+p.type+\"</i>\\n\" + ",
- " GLib.Markup.escape_text(p.doctxt),",
- " 3, p.sig,",
- " 4, \"<b>\" + dname +\"</b> <span size=\\\"small\\\"><i>\"+dtype+\"</i></span>\",",
- " 5, etype,",
- " -1",
- " );",
- " }",
- " this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
- " ",
- "}",
- ""
- ]
- }
- ],
- "modOrder" : "",
- "name" : "WindowAddProp",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/WindowAddProp.bjs",
- "permname" : "",
- "title" : ""
-}
\ No newline at end of file
+++ /dev/null
-static Xcls_WindowAddProp _WindowAddProp;
-
-public class Xcls_WindowAddProp : Object
-{
- public Gtk.ScrolledWindow el;
- private Xcls_WindowAddProp _this;
-
- public static Xcls_WindowAddProp singleton()
- {
- if (_WindowAddProp == null) {
- _WindowAddProp= new Xcls_WindowAddProp();
- }
- return _WindowAddProp;
- }
- public Xcls_model model;
- public Xcls_namecol namecol;
- public Xcls_namerender namerender;
-
- // my vars (def)
- public signal void select (string key, string type, string skel, string etype);
-
- // ctor
- public Xcls_WindowAddProp()
- {
- _this = this;
- this.el = new Gtk.ScrolledWindow( null, null );
-
- // my vars (dec)
-
- // set gobject values
- this.el.shadow_type = Gtk.ShadowType.IN;
- var child_0 = new Xcls_TreeView2( _this );
- child_0.ref();
- this.el.add ( child_0.el );
-
- // init method
-
- this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
- }
-
- // user defined functions
- public void show (Palete.Palete pal, string etype, string xtype) {
- this.model.el.clear();
-
- Gtk.TreeIter iter;
- var elementList = pal.getPropertiesFor( xtype,etype);
-
-
- //print ("GOT " + elementList.length + " items for " + fullpath + "|" + type);
- // console.dump(elementList);
-
- var miter = elementList.map_iterator();
- while (miter.next()) {
- var p = miter.get_value();
-
- this.model.el.append(out iter);
-
- var dname = p.name;
- var dtype = p.type;
-
-
- this.model.el.set(iter,
- 0, p.name,
- 1, p.type,
- 2, "<b>" + p.name +"</b> <i>"+p.type+"</i>\n" +
- GLib.Markup.escape_text(p.doctxt),
- 3, p.sig,
- 4, "<b>" + dname +"</b> <span size=\"small\"><i>"+dtype+"</i></span>",
- 5, etype,
- -1
- );
- }
- this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
-
- }
- public void clear () {
- this.model.el.clear();
-
- }
- public class Xcls_TreeView2 : Object
- {
- public Gtk.TreeView el;
- private Xcls_WindowAddProp _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_TreeView2(Xcls_WindowAddProp _owner )
- {
- _this = _owner;
- this.el = new Gtk.TreeView();
-
- // my vars (dec)
-
- // set gobject values
- this.el.tooltip_column = 2;
- this.el.enable_tree_lines = true;
- this.el.headers_visible = true;
- var child_0 = new Xcls_model( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_namecol( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
-
- // init method
-
- {
- var description = new Pango.FontDescription();
- description.set_size(8000);
- this.el.override_font(description);
-
- this.el.get_selection().set_mode( Gtk.SelectionMode.SINGLE);
-
-
-
-
-
- }
-
- //listeners
- this.el.row_activated.connect( (path, column) => {
-
- Gtk.TreeIter iter;
-
-
- var m = _this.model;
-
- m.el.get_iter(out iter,path);
-
-
- // var val = "";
-
-
- var key = m.getValue(iter, 0);
-
- var type = m.getValue(iter, 1);
- var skel = m.getValue(iter, 3);
- var etype = m.getValue(iter, 5);
-
-
- _this.select(key,etype == "signals" ? "" : type,skel, etype);
-
- });
- }
-
- // user defined functions
- }
- public class Xcls_model : Object
- {
- public Gtk.ListStore el;
- private Xcls_WindowAddProp _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_model(Xcls_WindowAddProp _owner )
- {
- _this = _owner;
- _this.model = this;
- this.el = new Gtk.ListStore( 6, typeof(string), // 0 real key
-typeof(string), // 1 real type
-typeof(string), // 2 docs ?
-typeof(string), // 3 visable desc
-typeof(string), // 4 function desc
-typeof(string) // 5 element type (event|prop)
- );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- public string getValue (Gtk.TreeIter iter, int col)
- {
-
- GLib.Value value;
- this.el.get_value(iter, col, out value);
-
- return (string)value;
-
- }
- }
-
- public class Xcls_namecol : Object
- {
- public Gtk.TreeViewColumn el;
- private Xcls_WindowAddProp _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_namecol(Xcls_WindowAddProp _owner )
- {
- _this = _owner;
- _this.namecol = this;
- this.el = new Gtk.TreeViewColumn();
-
- // my vars (dec)
-
- // set gobject values
- this.el.title = "Double click to add";
- var child_0 = new Xcls_namerender( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
-
- // init method
-
- this.el.add_attribute(_this.namerender.el , "markup", 4 );
- }
-
- // user defined functions
- }
- public class Xcls_namerender : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_WindowAddProp _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_namerender(Xcls_WindowAddProp _owner )
- {
- _this = _owner;
- _this.namerender = this;
- this.el = new Gtk.CellRendererText();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
-
-}
+++ /dev/null
-{
- "build_module" : "builder",
- "items" : [
- {
- "# bool is_loaded" : false,
- "# bool is_loading" : false,
- "$ homogeneous" : false,
- "$ xns" : "Gtk",
- "* pack" : "add",
- "@ void project_selectedx" : "(Project.Project project)",
- "@ void show_new_project" : "()",
- "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
- "id" : "WindowLeftProjects",
- "items" : [
- {
- "$ shadow_type" : "Gtk.ShadowType.IN",
- "$ xns" : "Gtk",
- "* init" : [
- " this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
- ""
- ],
- "* pack" : "pack_end,true,true,0",
- "items" : [
- {
- "$ enable_tree_lines" : true,
- "$ headers_visible" : true,
- "$ xns" : "Gtk",
- "* init" : [
- " var description = new Pango.FontDescription();",
- " description.set_size(8000);",
- " this.el.override_font(description); ",
- " ",
- " var selection = this.el.get_selection();",
- " selection.set_mode( Gtk.SelectionMode.SINGLE);",
- " ",
- "",
- " ",
- " ",
- " "
- ],
- "* pack" : "add",
- "id" : "view",
- "items" : [
- {
- "$ columns" : "typeof(string), typeof(Object)",
- "$ xns" : "Gtk",
- "* init" : [
- "{",
- " this.el.set_sort_func(0, (mod,a,b) => {",
- " GLib.Value ga, gb;",
- " mod.get_value(a,0, out ga);",
- " mod.get_value(b,0, out gb);",
- " ",
- " if ((string)ga == (string)gb) {",
- " return 0;",
- " }",
- " return (string)ga > (string)gb ? 1 : -1;",
- " }); ",
- "",
- "",
- "}",
- ""
- ],
- "* pack" : "set_model",
- "id" : "model",
- "n_columns" : 2,
- "xtype" : "ListStore"
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- "",
- " this.el.add_attribute(_this.namecol.el , \"markup\", 0 );",
- " "
- ],
- "* pack" : "append_column",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "namecol",
- "xtype" : "CellRendererText"
- }
- ],
- "utf8 title" : "Projects",
- "xtype" : "TreeViewColumn"
- }
- ],
- "listeners" : {
- "cursor_changed" : [
- " () => {",
- " if (_this.is_loading) {",
- " return;",
- " }",
- " ",
- " Gtk.TreeIter iter;",
- " Gtk.TreeModel mod;",
- " ",
- " var s = this.el.get_selection();",
- " if (!s.get_selected(out mod, out iter)) {",
- " return;",
- " }",
- " ",
- " GLib.Value gval;",
- "",
- " mod.get_value(iter, 1 , out gval);",
- " var project = (Project.Project)gval.get_object();",
- " ",
- " _this.project_selected(project);",
- " ",
- "} "
- ]
- },
- "xtype" : "TreeView"
- }
- ],
- "xtype" : "ScrolledWindow"
- }
- ],
- "listeners" : {
- "show" : [
- " ( ) => {",
- " this.load(); ",
- "}"
- ]
- },
- "xtype" : "Box",
- "| Project.Project? getSelectedProject" : [
- "() { ",
- " Gtk.TreeIter iter;",
- " Gtk.TreeModel mod;",
- " ",
- " var s = this.view.el.get_selection();",
- " if (!s.get_selected(out mod, out iter)) {",
- " return null;",
- " }",
- " ",
- " GLib.Value gval;",
- "",
- " mod.get_value(iter, 1 , out gval);",
- " var project = (Project.Project)gval.get_object();",
- " ",
- " return project;",
- "}"
- ],
- "| void load" : [
- "() {",
- " // clear list...",
- " ",
- " if (_this.is_loaded) {",
- " return;",
- " }",
- " _this.is_loading = true;",
- " ",
- " _this.is_loaded = true;",
- " ",
- " Project.Project.loadAll();",
- " var projects = Project.Project.allProjectsByName();",
- " ",
- " Gtk.TreeIter iter;",
- " var m = this.model.el;",
- " m.clear();",
- " ",
- " for (var i = 0; i < projects.size; i++) {",
- " m.append(out iter);",
- " m.set(iter, 0,projects.get(i).name );",
- " ",
- " var o = GLib.Value(typeof(Object));",
- " o.set_object((Object)projects.get(i));",
- " ",
- " m.set_value(iter, 1, o);",
- " ",
- " }",
- " m.set_sort_column_id(0, Gtk.SortType.ASCENDING);",
- " _this.is_loading = false; ",
- "}",
- ""
- ],
- "| void selectProject" : [
- "(Project.Project project) {",
- " ",
- " var sel = _this.view.el.get_selection();",
- " ",
- " sel.unselect_all();",
- " ",
- " var found = false;",
- " _this.model.el.foreach((mod, path, iter) => {",
- " GLib.Value val;",
- " ",
- " mod.get_value(iter, 1, out val);",
- " if ( ( (Project.Project)val.get_object()).fn != project.fn) {",
- " print(\"SKIP %s != %s\\n\", ((Project.Project)val.get_object()).name , project.name);",
- " return false;//continue",
- " }",
- " sel.select_iter(iter);",
- " this.project_selected(project);",
- " found = true;",
- " return true;",
- " ",
- " ",
- " });",
- " if (!found) {",
- "\t print(\"tried to select %s, could not find it\", project.name);",
- " }",
- "}",
- ""
- ]
- }
- ],
- "modOrder" : "",
- "name" : "WindowLeftProjects",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/WindowLeftProjects.bjs",
- "permname" : "",
- "title" : ""
-}
\ No newline at end of file
+++ /dev/null
-static Xcls_WindowLeftProjects _WindowLeftProjects;
-
-public class Xcls_WindowLeftProjects : Object
-{
- public Gtk.Box el;
- private Xcls_WindowLeftProjects _this;
-
- public static Xcls_WindowLeftProjects singleton()
- {
- if (_WindowLeftProjects == null) {
- _WindowLeftProjects= new Xcls_WindowLeftProjects();
- }
- return _WindowLeftProjects;
- }
- public Xcls_view view;
- public Xcls_model model;
- public Xcls_namecol namecol;
-
- // my vars (def)
- public signal void project_selectedx (Project.Project project);
- public bool is_loaded;
- public bool is_loading;
- public signal void show_new_project ();
-
- // ctor
- public Xcls_WindowLeftProjects()
- {
- _this = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
- this.is_loaded = false;
- this.is_loading = false;
-
- // set gobject values
- this.el.homogeneous = false;
- var child_0 = new Xcls_ScrolledWindow2( _this );
- child_0.ref();
- this.el.pack_end ( child_0.el , true,true,0 );
-
- //listeners
- this.el.show.connect( ( ) => {
- this.load();
- });
- }
-
- // user defined functions
- public void load () {
- // clear list...
-
- if (_this.is_loaded) {
- return;
- }
- _this.is_loading = true;
-
- _this.is_loaded = true;
-
- Project.Project.loadAll();
- var projects = Project.Project.allProjectsByName();
-
- Gtk.TreeIter iter;
- var m = this.model.el;
- m.clear();
-
- for (var i = 0; i < projects.size; i++) {
- m.append(out iter);
- m.set(iter, 0,projects.get(i).name );
-
- var o = GLib.Value(typeof(Object));
- o.set_object((Object)projects.get(i));
-
- m.set_value(iter, 1, o);
-
- }
- m.set_sort_column_id(0, Gtk.SortType.ASCENDING);
- _this.is_loading = false;
- }
- public Project.Project? getSelectedProject () {
- Gtk.TreeIter iter;
- Gtk.TreeModel mod;
-
- var s = this.view.el.get_selection();
- if (!s.get_selected(out mod, out iter)) {
- return null;
- }
-
- GLib.Value gval;
-
- mod.get_value(iter, 1 , out gval);
- var project = (Project.Project)gval.get_object();
-
- return project;
- }
- public void selectProject (Project.Project project) {
-
- var sel = _this.view.el.get_selection();
-
- sel.unselect_all();
-
- var found = false;
- _this.model.el.foreach((mod, path, iter) => {
- GLib.Value val;
-
- mod.get_value(iter, 1, out val);
- if ( ( (Project.Project)val.get_object()).fn != project.fn) {
- print("SKIP %s != %s\n", ((Project.Project)val.get_object()).name , project.name);
- return false;//continue
- }
- sel.select_iter(iter);
- this.project_selected(project);
- found = true;
- return true;
-
-
- });
- if (!found) {
- print("tried to select %s, could not find it", project.name);
- }
- }
- public class Xcls_ScrolledWindow2 : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_WindowLeftProjects _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ScrolledWindow2(Xcls_WindowLeftProjects _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
-
- // my vars (dec)
-
- // set gobject values
- this.el.shadow_type = Gtk.ShadowType.IN;
- var child_0 = new Xcls_view( _this );
- child_0.ref();
- this.el.add ( child_0.el );
-
- // init method
-
- this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
- }
-
- // user defined functions
- }
- public class Xcls_view : Object
- {
- public Gtk.TreeView el;
- private Xcls_WindowLeftProjects _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_view(Xcls_WindowLeftProjects _owner )
- {
- _this = _owner;
- _this.view = this;
- this.el = new Gtk.TreeView();
-
- // my vars (dec)
-
- // set gobject values
- this.el.enable_tree_lines = true;
- this.el.headers_visible = true;
- var child_0 = new Xcls_model( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_TreeViewColumn5( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
-
- // init method
-
- var description = new Pango.FontDescription();
- description.set_size(8000);
- this.el.override_font(description);
-
- var selection = this.el.get_selection();
- selection.set_mode( Gtk.SelectionMode.SINGLE);
-
- //listeners
- this.el.cursor_changed.connect( () => {
- if (_this.is_loading) {
- return;
- }
-
- Gtk.TreeIter iter;
- Gtk.TreeModel mod;
-
- var s = this.el.get_selection();
- if (!s.get_selected(out mod, out iter)) {
- return;
- }
-
- GLib.Value gval;
-
- mod.get_value(iter, 1 , out gval);
- var project = (Project.Project)gval.get_object();
-
- _this.project_selected(project);
-
- });
- }
-
- // user defined functions
- }
- public class Xcls_model : Object
- {
- public Gtk.ListStore el;
- private Xcls_WindowLeftProjects _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_model(Xcls_WindowLeftProjects _owner )
- {
- _this = _owner;
- _this.model = this;
- this.el = new Gtk.ListStore( 2, typeof(string), typeof(Object) );
-
- // my vars (dec)
-
- // set gobject values
-
- // init method
-
- {
- this.el.set_sort_func(0, (mod,a,b) => {
- GLib.Value ga, gb;
- mod.get_value(a,0, out ga);
- mod.get_value(b,0, out gb);
-
- if ((string)ga == (string)gb) {
- return 0;
- }
- return (string)ga > (string)gb ? 1 : -1;
- });
-
-
- }
- }
-
- // user defined functions
- }
-
- public class Xcls_TreeViewColumn5 : Object
- {
- public Gtk.TreeViewColumn el;
- private Xcls_WindowLeftProjects _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_TreeViewColumn5(Xcls_WindowLeftProjects _owner )
- {
- _this = _owner;
- this.el = new Gtk.TreeViewColumn();
-
- // my vars (dec)
-
- // set gobject values
- this.el.title = "Projects";
- var child_0 = new Xcls_namecol( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
-
- // init method
-
- this.el.add_attribute(_this.namecol.el , "markup", 0 );
- }
-
- // user defined functions
- }
- public class Xcls_namecol : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_WindowLeftProjects _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_namecol(Xcls_WindowLeftProjects _owner )
- {
- _this = _owner;
- _this.namecol = this;
- this.el = new Gtk.CellRendererText();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
-
-
-}
{
"build_module" : "builder",
+ "gen_extended" : false,
"items" : [
{
"# JsRender.JsRender file" : "",
"@ void show_add_props" : "(string type)",
"@ void show_editor" : "(JsRender.JsRender file, JsRender.Node node, JsRender.NodeProp prop)",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool hexpand" : true,
+ "bool loading" : false,
+ "bool vexpand" : true,
"id" : "LeftProps",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,true,0",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "bool hexpand" : true,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
"int margin_end" : 5,
"int margin_start" : 5,
"string label" : "Add:",
{
"$ tooltip_text" : "\"Add Property\"",
"$ xns" : "Gtk",
- "* pack" : "add",
"bool always_show_image" : true,
"bool hexpand" : true,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "set_image",
- "utf8 icon_name" : "format-justify-left",
- "xtype" : "Image"
- }
- ],
"listeners" : {
"clicked" : [
" ( ) => {",
"}"
]
},
+ "string icon_name" : "format-justify-left",
"string label" : "Property",
"xtype" : "Button"
},
{
"$ tooltip_text" : "\"Add Event Code\"",
"$ xns" : "Gtk",
- "* pack" : "add",
"bool always_show_image" : true,
"bool hexpand" : true,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "set_image",
- "utf8 icon_name" : "appointment-new",
- "xtype" : "Image"
- }
- ],
"listeners" : {
"clicked" : [
" ( ) => {",
"}"
]
},
+ "string icon_name" : "appointment-new",
"string label" : "Event",
"xtype" : "Button"
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
"bool always_show_image" : true,
"bool hexpand" : true,
"items" : [
{
"$ xns" : "Gtk",
"* pack" : false,
+ "bool autohide" : true,
"id" : "AddPropertyPopup",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "append",
- "label" : "id: _this.{ID} (Vala)",
- "listeners" : {
- "activate" : [
- " () => {",
- " \t// is this userdef or special??",
- " _this.addProp( new JsRender.NodeProp.prop(\"id\") );",
- "}"
- ]
- },
- "tooltip_markup" : "Using _this.{ID} will map to this element",
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append",
- "label" : "pack: Pack method (Vala)",
- "listeners" : {
- "activate" : [
- " ( ) => {",
- "// is this userdef?",
- " _this.addProp( new JsRender.NodeProp.special(\"pack\", \"add\") );",
- "}"
- ]
- },
- "tooltip_markup" : "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element",
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append",
- "label" : "ctor: Alterative to default contructor (Vala)",
- "listeners" : {
- "activate" : [
- " ( ) => {",
- "",
- " _this.addProp( new JsRender.NodeProp.special(\"ctor\") );",
- "}"
- ]
- },
- "tooltip_markup" : [
- "eg. ",
- "",
- "new Clutter.Image.from_file(.....)"
- ],
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append",
- "label" : "init: initialziation code (vala)",
- "listeners" : {
- "activate" : [
- " ( ) => {",
- " _this.addProp( new JsRender.NodeProp.special(\"init\",\"{\\n\\n}\\n\" ) );",
- "",
- "}"
- ]
- },
- "tooltip_markup" : "This code is called after the ctor",
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append",
- "label" : "cms-id: (Roo JS/Pman library)",
- "listeners" : {
- "activate" : [
- " () => {",
- " ",
- " _this.addProp( new JsRender.NodeProp.prop(\"cms-id\",\"string\", \"\" ) );",
- "",
- " ",
- " ",
- "}"
- ]
- },
- "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})",
- ""
+ "* prop" : "child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "int spacing" : 0,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "label" : "id: _this.{ID} (Vala)",
+ "listeners" : {
+ "clicked" : [
+ " () => {",
+ " \t_this.AddPropertyPopup.el.hide();",
+ " \t// is this userdef or special??",
+ " \tvar add = new JsRender.NodeProp.prop(\"id\");",
+ " \tif (_this.node.has_prop_key(add)) {",
+ "\t \treturn;",
+ " \t}",
+ " \t",
+ " \t_this.node.add_prop( add );",
+ " \t",
+ " \t_this.view.editProp( add );",
+ " \t",
+ "\t",
+ "}"
+ ]
+ },
+ "tooltip_markup" : "Using _this.{ID} will map to this element",
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "label" : "pack: Pack method (Vala)",
+ "listeners" : {
+ "clicked" : [
+ " ( ) => {",
+ " ",
+ "",
+ "\t_this.AddPropertyPopup.el.hide();",
+ " \t// is this userdef or special??",
+ " \tvar add = new JsRender.NodeProp.special(\"pack\", \"add\");",
+ " \tif (_this.node.has_prop_key(add)) {",
+ "\t \treturn;",
+ " \t}",
+ " \t",
+ " \t_this.node.add_prop( add );",
+ " \t",
+ " \t_this.view.editProp( add );",
+ " \t",
+ "",
+ "}"
+ ]
+ },
+ "tooltip_markup" : "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element",
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "label" : "ctor: Alterative to default contructor (Vala)",
+ "listeners" : {
+ "clicked" : [
+ " ( ) => {",
+ " ",
+ " _this.AddPropertyPopup.el.hide();",
+ " \t// is this userdef or special??",
+ " \tvar add = new JsRender.NodeProp.special(\"ctor\");",
+ " \tif (_this.node.has_prop_key(add)) {",
+ "\t \treturn;",
+ " \t}",
+ " \t",
+ " \t_this.node.add_prop( add );",
+ " \t",
+ " \t_this.view.editProp( add );",
+ " \t",
+ "}"
+ ]
+ },
+ "tooltip_markup" : [
+ "eg. ",
+ "",
+ "new Clutter.Image.from_file(.....)"
+ ],
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "label" : "init: initialziation code (vala)",
+ "listeners" : {
+ "clicked" : [
+ " ( ) => {",
+ " ",
+ " _this.AddPropertyPopup.el.hide();",
+ " \t// is this userdef or special??",
+ " \tvar add = new JsRender.NodeProp.special(\"init\",\"{\\n\\n}\\n\" ) ;",
+ " \tif (_this.node.has_prop_key(add)) {",
+ "\t \treturn;",
+ " \t}",
+ " \t",
+ " \t_this.node.add_prop( add );",
+ " \t",
+ " \t_this.view.editProp( add );",
+ "}"
+ ]
+ },
+ "tooltip_markup" : "This code is called after the ctor",
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "label" : "cms-id: (Roo JS/Pman library)",
+ "listeners" : {
+ "clicked" : [
+ " () => {",
+ " ",
+ " _this.AddPropertyPopup.el.hide();",
+ " \t// is this userdef or special??",
+ " \tvar add = new JsRender.NodeProp.prop(\"cms-id\",\"string\", \"\" ) ;",
+ " \tif (_this.node.has_prop_key(add)) {",
+ "\t \treturn;",
+ " \t}",
+ " \t",
+ " \t_this.node.add_prop( add );",
+ " \t",
+ " \t_this.view.editProp( add );",
+ " ",
+ "}"
+ ]
+ },
+ "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})",
+ ""
+ ],
+ "xtype" : "Button"
+ },
+ {
+ "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "$ xns" : "Gtk",
+ "xtype" : "Separator"
+ },
+ {
+ "$ xns" : "Gtk",
+ "label" : "String",
+ "listeners" : {
+ "clicked" : [
+ "(self) => {",
+ " _this.AddPropertyPopup.el.hide();",
+ "\t_this.view.popover.show(",
+ "\t\t_this.view.el, ",
+ "\t\t_this.node, ",
+ "\t\t new JsRender.NodeProp.prop(\"\", \"string\", \"\") ,",
+ "\t\t-1, ",
+ "\t\ttrue",
+ "\t);",
+ " ",
+ "}"
+ ]
+ },
+ "tooltip_markup" : "Add a user defined string property",
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "label" : "Number",
+ "listeners" : {
+ "clicked" : [
+ " ( ) =>{",
+ " _this.AddPropertyPopup.el.hide();",
+ " ",
+ " _this.view.popover.show(",
+ "\t\t_this.view.el, ",
+ "\t\t_this.node, ",
+ "\t\t new JsRender.NodeProp.prop(\"\", \"int\", \"0\") ,",
+ "\t\t-1, ",
+ "\t\ttrue",
+ "\t);",
+ " ",
+ "}"
+ ]
+ },
+ "tooltip_markup" : "Add a user defined number property",
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "label" : "Boolean",
+ "listeners" : {
+ "clicked" : [
+ " ( ) =>{",
+ " ",
+ " \t _this.AddPropertyPopup.el.hide();",
+ " _this.view.popover.show(",
+ "\t\t_this.view.el, ",
+ "\t\t_this.node, ",
+ "\t\t new JsRender.NodeProp.prop(\"\", \"bool\", \"true\") ,",
+ "\t\t-1, ",
+ "\t\ttrue",
+ "\t); ",
+ " ",
+ "}"
+ ]
+ },
+ "tooltip_markup" : "Add a user defined boolean property",
+ "xtype" : "Button"
+ },
+ {
+ "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "$ xns" : "Gtk",
+ "xtype" : "Separator"
+ },
+ {
+ "$ xns" : "Gtk",
+ "label" : "Javascript Function",
+ "listeners" : {
+ "clicked" : [
+ " ( ) =>{",
+ " _this.AddPropertyPopup.el.hide(); ",
+ " _this.view.popover.show(",
+ "\t\t_this.view.el, ",
+ "\t\t_this.node, ",
+ "\t\t new JsRender.NodeProp.jsmethod(\"\") ,",
+ "\t\t-1, ",
+ "\t\ttrue",
+ "\t);",
+ "",
+ " ",
+ "}"
+ ]
+ },
+ "tooltip_markup" : "Add a user function boolean property",
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "label" : "Vala Method",
+ "listeners" : {
+ "clicked" : [
+ " ( ) =>{",
+ "_this.AddPropertyPopup.el.hide();",
+ " _this.view.popover.show(",
+ "\t\t_this.view.el, ",
+ "\t\t_this.node, ",
+ "\t\t new JsRender.NodeProp.valamethod(\"\") ,",
+ "\t\t-1, ",
+ "\t\ttrue",
+ "\t); ",
+ "}"
+ ]
+ },
+ "tooltip_markup" : "Add a user function boolean property",
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "label" : "Vala Signal",
+ "listeners" : {
+ "clicked" : [
+ " ( ) =>{",
+ " _this.AddPropertyPopup.el.hide();",
+ " _this.view.popover.show(",
+ "\t\t_this.view.el, ",
+ "\t\t_this.node, ",
+ "\t\t new JsRender.NodeProp.sig(\"\" ) ,",
+ "\t\t-1, ",
+ "\t\ttrue",
+ "\t); ",
+ "}"
+ ]
+ },
+ "tooltip_markup" : "Add a vala signal",
+ "xtype" : "Button"
+ },
+ {
+ "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "$ xns" : "Gtk",
+ "xtype" : "Separator"
+ },
+ {
+ "$ xns" : "Gtk",
+ "label" : "Flexy - If",
+ "listeners" : {
+ "clicked" : [
+ " ( ) =>{",
+ " \t_this.AddPropertyPopup.el.hide();",
+ " \t_this.view.popover.show(",
+ "\t\t_this.view.el, ",
+ "\t\t_this.node, ",
+ "\t\t new JsRender.NodeProp.prop(\"flexy:if\", \"string\", \"value_or_condition\") ,",
+ "\t\t-1, ",
+ "\t\ttrue",
+ "\t);",
+ "",
+ "",
+ "}"
+ ]
+ },
+ "tooltip_markup" : "Add a flexy if (for HTML templates)",
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "label" : "Flexy - Include",
+ "listeners" : {
+ "clicked" : [
+ " ( ) =>{",
+ " \t_this.AddPropertyPopup.el.hide();",
+ " \t_this.view.popover.show(",
+ "\t\t_this.view.el, ",
+ "\t\t_this.node, ",
+ "\t\t new JsRender.NodeProp.prop(\"flexy:include\", \"string\", \"name_of_file.html\") ,",
+ "\t\t-1, ",
+ "\t\ttrue",
+ "\t);",
+ "",
+ " ",
+ "}"
+ ]
+ },
+ "tooltip_markup" : "Add a flexy include (for HTML templates)",
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "label" : "Flexy - Foreach",
+ "listeners" : {
+ "clicked" : [
+ " ( ) =>{",
+ " \t_this.AddPropertyPopup.el.hide();",
+ " \t_this.view.popover.show(",
+ "\t\t_this.view.el, ",
+ "\t\t_this.node, ",
+ "\t\t new JsRender.NodeProp.prop(\"flexy:if\", \"string\", \"value_or_condition\") ,",
+ "\t\t-1, ",
+ "\t\ttrue",
+ "\t);",
+ " ",
+ "}"
+ ]
+ },
+ "tooltip_markup" : "Add a flexy include (for HTML templates)",
+ "xtype" : "Button"
+ }
],
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "xtype" : "SeparatorMenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append",
- "label" : "String",
- "listeners" : {
- "activate" : [
- "(self) => {",
- "",
- "\t_this.view.popover.show(",
- "\t\t_this.view.el, ",
- "\t\t_this.node, ",
- "\t\t new JsRender.NodeProp.prop(\"\", \"string\", \"\") ,",
- "\t\t-1, ",
- "\t\ttrue",
- "\t);",
- "",
- "}"
- ]
- },
- "tooltip_markup" : "Add a user defined string property",
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append",
- "label" : "Number",
- "listeners" : {
- "activate" : [
- " ( ) =>{",
- " _this.view.popover.show(",
- "\t\t_this.view.el, ",
- "\t\t_this.node, ",
- "\t\t new JsRender.NodeProp.prop(\"\", \"int\", \"0\") ,",
- "\t\t-1, ",
- "\t\ttrue",
- "\t);",
- " ",
- "}"
- ]
- },
- "tooltip_markup" : "Add a user defined number property",
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append",
- "label" : "Boolean",
- "listeners" : {
- "activate" : [
- " ( ) =>{",
- " ",
- " \t",
- " _this.view.popover.show(",
- "\t\t_this.view.el, ",
- "\t\t_this.node, ",
- "\t\t new JsRender.NodeProp.prop(\"\", \"bool\", \"true\") ,",
- "\t\t-1, ",
- "\t\ttrue",
- "\t); ",
- " ",
- "}"
- ]
- },
- "tooltip_markup" : "Add a user defined boolean property",
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "xtype" : "SeparatorMenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append",
- "label" : "Javascript Function",
- "listeners" : {
- "activate" : [
- " ( ) =>{",
- " ",
- " _this.view.popover.show(",
- "\t\t_this.view.el, ",
- "\t\t_this.node, ",
- "\t\t new JsRender.NodeProp.jsmethod(\"\") ,",
- "\t\t-1, ",
- "\t\ttrue",
- "\t);",
- " ",
- " ",
- "}"
- ]
- },
- "tooltip_markup" : "Add a user function boolean property",
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append",
- "label" : "Vala Method",
- "listeners" : {
- "activate" : [
- " ( ) =>{",
- "",
- " _this.view.popover.show(",
- "\t\t_this.view.el, ",
- "\t\t_this.node, ",
- "\t\t new JsRender.NodeProp.valamethod(\"\") ,",
- "\t\t-1, ",
- "\t\ttrue",
- "\t); ",
- "}"
- ]
- },
- "tooltip_markup" : "Add a user function boolean property",
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append",
- "label" : "Vala Signal",
- "listeners" : {
- "activate" : [
- " ( ) =>{",
- " _this.view.popover.show(",
- "\t\t_this.view.el, ",
- "\t\t_this.node, ",
- "\t\t new JsRender.NodeProp.sig(\"\" ) ,",
- "\t\t-1, ",
- "\t\ttrue",
- "\t); ",
- "}"
- ]
- },
- "tooltip_markup" : "Add a vala signal",
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "xtype" : "SeparatorMenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append",
- "label" : "Flexy - If",
- "listeners" : {
- "activate" : [
- " ( ) =>{",
- " \t_this.view.popover.show(",
- "\t\t_this.view.el, ",
- "\t\t_this.node, ",
- "\t\t new JsRender.NodeProp.prop(\"flexy:if\", \"string\", \"value_or_condition\") ,",
- "\t\t-1, ",
- "\t\ttrue",
- "\t);",
- "",
- "",
- "}"
- ]
- },
- "tooltip_markup" : "Add a flexy if (for HTML templates)",
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append",
- "label" : "Flexy - Include",
- "listeners" : {
- "activate" : [
- " ( ) =>{",
- " \t_this.view.popover.show(",
- "\t\t_this.view.el, ",
- "\t\t_this.node, ",
- "\t\t new JsRender.NodeProp.prop(\"flexy:include\", \"string\", \"name_of_file.html\") ,",
- "\t\t-1, ",
- "\t\ttrue",
- "\t);",
- "",
- " ",
- "}"
- ]
- },
- "tooltip_markup" : "Add a flexy include (for HTML templates)",
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "append",
- "label" : "Flexy - Foreach",
- "listeners" : {
- "activate" : [
- " ( ) =>{",
- " ",
- " \t_this.view.popover.show(",
- "\t\t_this.view.el, ",
- "\t\t_this.node, ",
- "\t\t new JsRender.NodeProp.prop(\"flexy:foreach\", \"string\", \"array,key,value\") ,",
- "\t\t-1, ",
- "\t\ttrue",
- "\t);",
- "",
- " ",
- "}"
- ]
- },
- "tooltip_markup" : "Add a flexy foreach (for HTML templates)",
- "xtype" : "MenuItem"
+ "xtype" : "Box"
}
],
- "xtype" : "Menu"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "set_image",
- "string icon_name" : "list-add",
- "xtype" : "Image"
+ "xtype" : "Popover"
}
],
"listeners" : {
- "button_press_event" : [
- " (self, ev) => {",
- " _this.before_edit();",
- " ",
+ "clicked" : [
+ "( ) => {",
+ " //_this.before_edit();",
+ " ",
" ",
" var p = _this.AddPropertyPopup;",
- " p.el.set_screen(Gdk.Screen.get_default());",
- " p.el.show_all();",
- " p.el.popup_at_pointer(ev);",
- " return true;",
- "}"
+ " ",
+ " //\tGtk.Allocation rect;",
+ "\t//this.el.get_allocation(out rect);",
+ "",
+ "\t p.el.set_parent(this.el);",
+ " //p.el.set_pointing_to(rect);",
+ "\tp.el.show();",
+ "\tp.el.set_position(Gtk.PositionType.BOTTOM);",
+ "\tp.el.autohide = true;",
+ " return;",
+ "",
+ "}",
+ ""
]
},
+ "string icon_name" : "list-add",
"string label" : "Other",
"xtype" : "Button"
}
"}",
""
],
- "* pack" : "pack_end,true,true,0",
+ "bool hexpand" : true,
+ "bool vexpand" : true,
"id" : "EditProps",
"items" : [
{
"$ xns" : "Gtk",
"* init" : [
"{",
- " var selection = this.el.get_selection();",
- " selection.set_mode( Gtk.SelectionMode.SINGLE);",
- "",
- "",
+ " ",
" \tthis.css = new Gtk.CssProvider();",
- "\ttry {",
- "\t\tthis.css.load_from_data(\"#leftprops-view { font: 10p; x}\");",
- "\t} catch (Error e) {}",
- "\tthis.el.get_style_context().add_provider(this.css,",
- "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION);",
- "",
- " ",
+ "\t ",
+ "\t\tthis.css.load_from_string(\"",
+ "#leftprops-view { font-size: 12px;}",
+ "\t ",
+ "#leftprops-view dropdown button { ",
+ "\t\t\tmin-height: 16px;\t\t\t ",
+ "\t\t\toutline-offset : 0;",
+ "\t\t}",
+ "#leftprops-view cell dropdown label {",
+ " \t\tpadding-top:0px;",
+ "\t\tpadding-bottom:0px;",
+ "}",
+ "#leftprops-view cell { ",
+ " \t\tpadding-top:2px;",
+ "\t\tpadding-bottom:2px;",
+ "\t\t}",
+ "#leftprops-view cell label, #leftprops-view cell editablelable {",
+ " \t\tpadding-top:4px;",
+ "\t\tpadding-bottom:4px;",
+ "}\");",
+ " ",
+ "\t\tGtk.StyleContext.add_provider_for_display(",
+ "\t\tthis.el.get_display(),",
+ "\t\tthis.css,",
+ "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
+ "\t);",
+ "\t\t",
+ " ",
"}",
""
],
- "* pack" : "add",
+ "* pack" : "set_child",
"Gtk.CssProvider css" : "",
"Xcls_PopoverProperty popover" : "null",
+ "bool hexpand" : true,
+ "bool show_row_separators" : true,
+ "bool single_click_activate" : false,
+ "bool vexpand" : true,
"id" : "view",
"items" : [
{
- "$ changed" : [
- "function(str, doRefresh) {",
- " if (!this.activePath) {",
- " return;",
- " }",
- " var iter = new Gtk.TreeIter();",
- " ",
- " _this.setTreeIter(prop);",
- " this.el.get_iter(iter, new Gtk.TreePath.from_string(this.activePath));",
- " ",
- " this.el.set_value(iter, 1, '' +str);",
- " this.el.set_value(iter, 3, '' + this.toShort(str));",
- " var type = this.getIterValue(iter, 4);",
+ "$ xns" : "Gtk",
+ "* pack" : false,
+ "id" : "deletemenu",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "int spacing" : 0,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "clicked" : [
+ "( ) => {",
+ "\t",
+ "",
+ "\tvar n = (JsRender.NodeProp) _this.selmodel.el.selected_item;",
+ "",
+ "\t_this.deletemenu.el.hide();",
+ "\t_this.node.remove_prop(n);",
+ "}",
+ ""
+ ]
+ },
+ "string label" : "Delete",
+ "xtype" : "Button"
+ }
+ ],
+ "xtype" : "Box"
+ }
+ ],
+ "xtype" : "Popover"
+ },
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "pressed" : [
+ "(n_press, in_x, in_y) => {",
+ "",
+ "\tGLib.debug(\"Prssed %d\", (int) this.el.get_current_button());",
+ "\t",
+ "\tvar col = _this.view.getColAt(in_x, in_y);",
+ "\tif (col != 0) {",
+ "\t\treturn;",
+ "\t}",
+ "\tstring pos;",
+ "\tvar row = _this.view.getRowAt(in_x, in_y, out pos);",
+ "\t",
+ "\tif (row < 0) {",
+ "\t\treturn;",
+ "",
+ "\t}",
+ "\tGLib.debug(\"hit row %d\", row);",
+ "\tvar prop = _this.selmodel.getPropAt(row);",
+ "\t_this.selmodel.selectProp(prop);",
+ "",
+ "\t//var point_at = _this.view.getWidgetAtRow(row);",
+ "\t",
+ "\t \t// need to shift down, as ev.y does not inclucde header apparently..",
+ " \t// or popover might be trying to do a central?",
+ "//\t _this.view.editPropertyDetails(prop, (int) in_y + 12); ",
+ " \t _this.stop_editor();",
+ " _this.view.popover.show(",
+ " \t\t\t_this.view.el, ",
+ " \t\t\t_this.node, prop, ",
+ "\t\t (int)in_y);",
+ " ",
+ " ",
+ " ",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "GestureClick"
+ },
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "pressed" : [
+ "(n_press, in_x, in_y) => {",
+ "",
+ "\t",
+ "\t ",
+ "\tstring pos;",
+ "\tvar row = _this.view.getRowAt(in_x, in_y, out pos);",
+ "\t",
+ "\tif (row < 0) {",
+ "\t\treturn;",
+ "",
+ "\t}",
+ "\t",
+ "\t_this.stop_editor();",
+ "\tGLib.debug(\"hit row %d\", row);",
+ "\tvar prop = _this.selmodel.getPropAt(row);",
+ "\t_this.selmodel.selectProp(prop);",
+ "\t",
+ "\t",
+ "\t",
+ "\tGLib.debug(\"Prssed %d\", (int) this.el.get_current_button());",
+ "\t//_this.deletemenu.el.set_parent(_this.view.el);",
+ "\t_this.deletemenu.el.set_parent(_this.main_window.el);",
+ "\t",
+ "\t",
+ "\t ",
+ "\t_this.deletemenu.el.set_offset(",
+ "\t\t\t(int)in_x - _this.view.el.get_width() ,",
+ "\t\t\t(int)in_y - _this.view.el.get_height()",
+ "\t\t);",
+ "\t_this.deletemenu.el.set_position(Gtk.PositionType.BOTTOM); ",
+ " _this.deletemenu.el.popup();",
+ " ",
+ "}",
+ ""
+ ]
+ },
+ "uint button" : 3,
+ "xtype" : "GestureClick"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "bool can_unselect" : true,
+ "id" : "selmodel",
+ "items" : [
+ {
+ "$ xns" : "GLib",
+ "* ctor" : "new GLib.ListStore(typeof(JsRender.NodeProp))",
+ "* prop" : "model",
+ "id" : "model",
+ "xtype" : "ListStore"
+ }
+ ],
+ "xtype" : "SingleSelection",
+ "| JsRender.NodeProp getPropAt" : [
+ "(uint row) {",
"",
- " this.el.set_value(iter, 5, type + ' : ' + str);",
- " // update the tree... ",
+ "\treturn (JsRender.NodeProp) this.el.get_item(row);",
"",
- " this.get('/LeftTree.model').changed(this.toJS(), doRefresh); ",
- "}",
- ""
+ "\t ",
+ "}"
],
- "$ columns" : [
- " typeof(JsRender.NodeProp), // 0 key type",
- " typeof(string), // 1 display_key",
- " typeof(string), // 2 display_value",
- " typeof(string), // 3 display_tooltip",
- " \t\ttypeof(string) // 4 sortable value",
- "/*",
- " \t0, prop,",
- " \t1, prop.to_display_name(),",
- " \t2, dis_val.",
- " 3, \"<tt>\" + GLib.Markup.escape_text(key + \" \" +kvalue) + \"</tt>\",",
- " 4, \"0 \" + prop.name",
- " ",
- " ); ",
- " */"
+ "| void selectProp" : [
+ "(JsRender.NodeProp prop) {",
+ "\tfor (var i = 0 ; i < this.el.n_items; i++) {",
+ "\t\tvar r = (JsRender.NodeProp)this.el.get_item(i);",
+ "\t\tif (r.equals(prop)) {",
+ "\t\t\tthis.el.selected = i;",
+ "\t\t\treturn;",
+ "\t\t}",
+ "\t}",
+ "\t ",
+ "}"
],
- "$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "model",
- "n_columns" : 5,
- "xtype" : "TreeStore"
+ "| void startEditing" : [
+ "(JsRender.NodeProp prop) {",
+ "\t// should we call select?? - caller does int (from windowstate)",
+ "\t",
+ "}"
+ ]
},
{
- "$ Gtk.TreeViewColumnSizing sizing" : "Gtk.TreeViewColumnSizing.FIXED",
- "$ resizable" : true,
"$ xns" : "Gtk",
- "* init" : [
- " this.el.add_attribute(_this.keyrender.el , \"markup\", 1 ); // 1 is the key.",
- " //this.el.add_attribute(_this.keyrender.el , \"text\", 1 );",
- " "
- ],
"* pack" : "append_column",
"bool expand" : true,
+ "bool resizable" : true,
"id" : "keycol",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false",
- "id" : "keyrender",
- "xtype" : "CellRendererText"
+ "* prop" : "factory",
+ "listeners" : {
+ "bind" : [
+ "(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",
+ " ",
+ "",
+ "}",
+ ""
+ ],
+ "setup" : [
+ "(listitem) => {",
+ "\tvar lbl = new Gtk.Label(\"\");",
+ " \t((Gtk.ListItem)listitem).set_child(lbl);",
+ " \tlbl.justify = Gtk.Justification.LEFT;",
+ " \tlbl.xalign = 1;",
+ " \tlbl.use_markup = true;",
+ "\tlbl.ellipsize = Pango.EllipsizeMode.START;",
+ " \t/*lbl.changed.connect(() => {",
+ "\t\t// notify and save the changed value...",
+ "\t \t//var prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem.get_item());",
+ " ",
+ " //prop.val = lbl.text;",
+ " //_this.updateIter(iter,prop);",
+ " _this.changed();",
+ "\t});",
+ "\t*/",
+ "\t((Gtk.ListItem)listitem).activatable = true;",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "SignalListItemFactory"
}
],
"title" : "Property",
- "xtype" : "TreeViewColumn"
+ "xtype" : "ColumnViewColumn"
},
{
- "$ Gtk.TreeViewColumnSizing sizing" : "Gtk.TreeViewColumnSizing.FIXED",
- "$ resizable" : true,
"$ xns" : "Gtk",
- "* init" : [
- "{",
- "\t",
- " ",
- "",
- "\t",
- "\tthis.el.add_attribute(_this.valrender.el , \"text\", 2 );",
- " ",
- "}",
- ""
- ],
"* pack" : "append_column",
"bool expand" : true,
+ "bool resizable" : true,
"id" : "valcol",
"items" : [
{
- "$ editable" : false,
- "$ has_entry" : true,
"$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "valrender",
- "items" : [
- {
- "$ columns" : "typeof(string)",
- "$ xns" : "Gtk",
- "* pack" : false,
- "* prop" : "model",
- "id" : "valrendermodel",
- "n_columns" : 1,
- "xtype" : "ListStore"
- }
- ],
+ "* prop" : "factory",
+ "bool is_setting" : false,
"listeners" : {
- "edited" : [
- " (path, newtext) => {",
- " GLib.debug(\"Valrender - signal:edited\\n\");",
- " ",
- " this.el.editable = false;",
- " ",
+ "bind" : [
+ "(listitem) => {",
+ "\t this.is_setting = true;",
+ "",
"",
- " Gtk.TreeIter iter;",
- " _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));",
- " GLib.Value gval;",
+ "\tvar bx = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();",
+ " ",
+ "\t",
+ "\t",
+ "\t",
+ "\tvar elbl = (Gtk.EditableLabel)bx.get_first_child();",
+ "\tvar lbl = (Gtk.Label) elbl.get_next_sibling();",
+ "\tvar cb = (Gtk.DropDown) lbl.get_next_sibling();",
+ "\t// decide if it's a combo or editable text..",
+ "\tvar model = (Gtk.StringList) cb.model;",
+ " ",
+ "\telbl.hide();",
+ "\tlbl.hide();",
+ "\tcb.hide();",
+ "\t",
+ "\tvar prop = (JsRender.NodeProp) ((Gtk.ListItem)listitem).get_item();",
+ "\t//GLib.debug(\"prop = %s\", prop.get_type().name());",
+ "\t//GLib.debug(\"prop.val = %s\", prop.val);",
+ "\t//GLib.debug(\"prop.key = %s\", prop.to_display_name());",
+ "\t ",
+ " var use_textarea = prop.useTextArea();",
+ " ",
+ " ",
+ " var pal = _this.file.project.palete;",
" ",
- " _this.model.el.get_value(iter,0, out gval);",
- " var prop = (JsRender.NodeProp)gval;",
- " prop.val = newtext;",
- " _this.updateIter(iter,prop);",
- " _this.changed();",
- " ",
- "}"
- ],
- "editing_started" : [
- "( editable, path) => {",
- " //_this.editing = true;",
- " GLib.debug(\"editing started called\\n\");",
- " if (!_this.allow_edit) {",
- " ",
- " GLib.debug(\"val - editing_Started\\n\");",
- " this.el.editable = false; // make sure it's not editor...",
- " ",
- " ",
- " return;",
+ " string[] opts;",
+ " var has_opts = pal.typeOptions(_this.node.fqn(), prop.name, prop.rtype, out opts);",
+ " ",
+ " if (!has_opts && prop.ptype == JsRender.NodePropType.RAW) {",
+ " \tuse_textarea = true;",
" }",
- " _this.allow_edit =false;",
" ",
- " ",
- " if ( this.el.has_entry ) {",
- " ",
- " Gtk.TreeIter iter;",
- " _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));",
- " GLib.Value gval;",
- " ",
- "",
- " ",
- " // this.get('/LeftPanel.model').activePath = path;",
- " _this.model.el.get_value(iter,0, out gval);",
" ",
- "",
- " var prop = (JsRender.NodeProp)gval;",
- " var combo = (Gtk.ComboBox)editable;",
- "",
- " var entry = (Gtk.Entry) combo.get_child(); ",
- " entry.set_text(prop.val);",
+ " if (use_textarea) {",
+ " \tprop.bind_property(\"val_short\",",
+ " lbl, \"label\",",
+ " GLib.BindingFlags.SYNC_CREATE);",
+ " prop.bind_property(\"val_tooltip\",",
+ " lbl, \"tooltip_markup\",",
+ " GLib.BindingFlags.SYNC_CREATE);",
+ " lbl.show();",
+ "\t\tthis.is_setting = false; ",
+ " return;",
+ " \t",
" }",
- " ",
- "}"
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " // others... - fill in options for true/false?",
+ " // GLib.debug (ktype.up());",
+ " if (has_opts) {",
+ "\t",
+ "\t\twhile(model.get_n_items() > 0) {",
+ "\t\t\tmodel.remove(0);",
+ "\t\t}",
+ "\t\tcb.show();",
+ " \t\t// can not remove - hopefully always empty.",
+ "\t\tvar sel = -1;",
+ "\t\tfor(var i = 0; i < opts.length; i ++) {",
+ "\t\t\tmodel.append( opts[i]);",
+ "\t\t\t// not sure this is a great idea... ",
+ "\t\t\tif (opts[i].down() == prop.val.down()) {",
+ "\t\t\t\tsel = i;",
+ "\t\t\t}",
+ "\t\t}",
+ "\t\tGLib.debug(\"Set selected item to %d\", sel);",
+ "\t\tcb.set_selected(sel > -1 ? sel : Gtk.INVALID_LIST_POSITION); ",
+ "\t\tthis.is_setting = false; ",
+ "\t\treturn ;",
+ " }",
+ " ",
+ "\t// see if type is a Enum.",
+ "\t// triggers a changed event",
+ " ",
+ "\telbl.set_text(prop.val);",
+ " ",
+ "\telbl.show();",
+ "\tthis.is_setting = false; \t\t ",
+ "\t",
+ "\t",
+ "\t",
+ " ",
+ "",
+ "}",
+ ""
+ ],
+ "setup" : [
+ "(listitem) => {",
+ "\tvar hb = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);",
+ "\tvar elbl = new Gtk.EditableLabel(\"\");",
+ "\telbl.hexpand = true;",
+ "\thb.append(elbl);",
+ "\tvar lbl = new Gtk.Label(\"\");",
+ "\thb.append(lbl);",
+ "\tlbl.hexpand = true;",
+ "\tlbl.use_markup = true;",
+ "\tlbl.xalign =0;",
+ "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
+ "\tvar cb = new Gtk.DropDown(new Gtk.StringList({}), null);",
+ "\tcb.hexpand = true;",
+ " ",
+ "\thb.append(cb);",
+ "\t((Gtk.ListItem)listitem).set_child(hb);",
+ "\t ",
+ "\t var ef = new Gtk.EventControllerFocus();",
+ "\t ef.enter.connect(() => {",
+ " \t\t _this.stop_editor();",
+ " \t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
+ "\t\t _this.selmodel.selectProp(prop);\t\t",
+ "\t });",
+ "\t elbl.add_controller(ef);",
+ "\t ",
+ "\t ",
+ "\t // dropdown??? - stop editing, and highliht node",
+ "\t var tb = (Gtk.ToggleButton) cb.get_first_child();",
+ "\t tb.clicked.connect(() => {",
+ "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
+ "\t\t\t",
+ "\t \t _this.stop_editor();",
+ "\t \t _this.selmodel.selectProp(prop);",
+ "\t \t ",
+ "\t });",
+ " \telbl.changed.connect(() => {",
+ "\t\t// notify and save the changed value...",
+ "\t \t",
+ " //_this.updateIter(iter,prop);",
+ " // this should happen automatically",
+ " ",
+ " if (!_this.loading && !this.is_setting) {",
+ "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
+ "\t\t\t ",
+ "\t\t ",
+ "\t\t prop.val = elbl.text;",
+ " \t GLib.debug(\"calling changed\");",
+ "\t _this.changed();",
+ "\t ",
+ " }",
+ " ",
+ "\t});",
+ "\t",
+ "\t",
+ "\tcb.notify[\"selected\"].connect(() => {",
+ "\t\t// dropdown selection changed.",
+ "\t\t",
+ "\t\t",
+ "\t\t",
+ " //_this.updateIter(iter,prop);",
+ " if (!_this.loading && !this.is_setting) {",
+ "\t\t var prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
+ "\t\t var model = (Gtk.StringList)cb.model;",
+ "\t\t prop.val = model.get_string(cb.selected);",
+ "\t\t GLib.debug(\"property set to %s\", prop.val);",
+ " \tGLib.debug(\"calling changed\");",
+ "\t _this.changed();",
+ "\t ",
+ " }",
+ " ",
+ "\t\t",
+ "\t});",
+ "\tvar gc = new Gtk.GestureClick();",
+ "\tlbl.add_controller(gc);",
+ "\tgc.pressed.connect(() => {",
+ "\t \tvar prop = (JsRender.NodeProp)((Gtk.ListItem)listitem).get_item();",
+ "\t\t _this.stop_editor();",
+ "\t _this.show_editor(_this.file, prop.parent, prop);",
+ "\t});",
+ "\t ",
+ "\t",
+ "\t",
+ "}",
+ ""
]
},
- "text_column" : 0,
- "xtype" : "CellRendererCombo",
- "| void setOptions" : [
- "(string[] ar) {",
- "\tvar m = _this.valrendermodel.el;",
- "\tm.clear();",
- "\tGtk.TreeIter iret;",
- " for (var i =0; i < ar.length; i++) {",
- " m.append(out iret);",
- " m.set_value(iret, 0, ar[i]);",
- " }",
- "",
- "}"
- ]
+ "xtype" : "SignalListItemFactory"
}
],
"title" : "Value",
- "xtype" : "TreeViewColumn"
+ "xtype" : "ColumnViewColumn"
},
{
"$ xns" : "Gtk",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "append",
- "label" : "Delete",
- "listeners" : {
- "activate" : [
- " ( ) =>{",
- "\t_this.deleteSelected();",
- "}"
- ]
- },
- "xtype" : "MenuItem"
+ "* prop" : "child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "int spacing" : 0,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "label" : "Delete",
+ "listeners" : {
+ "activate" : [
+ " ( ) =>{",
+ "\t_this.deleteSelected();",
+ "\t",
+ "}"
+ ]
+ },
+ "xtype" : "Button"
+ }
+ ],
+ "xtype" : "Box"
}
],
- "xtype" : "Menu"
+ "xtype" : "Popover"
}
],
- "listeners" : {
- "button_press_event" : [
- " ( ev) => {",
- " ",
- " Gtk.TreeViewColumn col;",
- " int cell_x;",
- " int cell_y;",
- " Gtk.TreePath path;",
- " ",
- " // event x /y are relative to the widget..",
- " if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {",
- " GLib.debug(\"nothing selected on click\");",
- " GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {",
- " this.el.get_selection().unselect_all();",
- "",
- " return false;",
- " });",
- " _this.before_edit();",
- " return false; //not on a element.",
- " }",
- " ",
- " ",
- " // single click on name..",
- " //if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == \"Name\") { ",
- " if (ev.button == 1 && col.title == \"Property\") { ",
- " \t// need to shift down, as ev.y does not inclucde header apparently..",
- " \t// or popover might be trying to do a central?",
- " this.editPropertyDetails(path, (int) ev.y + 12); ",
- " ",
- " return false;",
- " }",
- " ",
- " ",
- " ",
- " ",
- " // right click.",
- " if (ev.type == Gdk.EventType.BUTTON_PRESS && ev.button == 3) { ",
- " // show popup!. ",
- " //if (col.title == \"Value\") {",
- " // _this.before_edit();",
- " // return false;",
- " //}",
- "",
- " var p = _this.ContextMenu;",
- "",
- " p.el.set_screen(Gdk.Screen.get_default());",
- " p.el.show_all();",
- " p.el.popup_at_pointer(ev);",
- " //Seed.print(\"click:\" + res.column.title);",
- " // select the ",
- " GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {",
- " ",
- " this.el.get_selection().select_path(path);",
- " return false;",
- " });",
- " _this.before_edit();",
- " return false;",
- " }",
- " ",
- " ",
- " if (col.title != \"Value\") {",
- " GLib.debug(\"col title != Value\");",
- " ",
- " GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {",
- " this.el.get_selection().select_path(path);",
- " return false;",
- " });",
- " ",
- " _this.before_edit();",
- " // XObject.error(\"column is not value?\");",
- " return false; // ignore.. - key click.. ??? should we do this??",
- " }",
- " ",
- " ",
- " // if the cell can be edited with a pulldown",
- " // then we should return true... - and let the start_editing handle it?",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " // _this.before_edit(); <<< we really need to stop the other editor..",
- " _this.keyrender.el.stop_editing(false);",
- " _this.keyrender.el.editable =false;",
- " ",
- " ",
- " return _this.startEditingValue(path); // assumes selected row..",
- " ",
- " ",
- "",
- " ",
- " ",
- "}"
- ]
- },
"string name" : "leftprops-view",
- "tooltip_column" : 3,
- "xtype" : "TreeView",
- "| void editPropertyDetails" : [
- "(Gtk.TreePath path, int y) {",
+ "xtype" : "ColumnView",
+ "| Gtk.Widget? getWidgetAtRow" : [
+ "(uint row) {",
+ "/*",
+ " \t",
+ "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
+ " \tvar colview = gesture.widget;",
+ " \tvar line_no = check_list_widget(colview, x,y);",
+ " if (line_no > -1) {",
+ " \t\tvar item = colview.model.get_item(line_no);",
+ " \t\t ",
+ " \t}",
+ " \t*/",
+ "\t\tGLib.debug(\"Get Widget At Row %d\", (int)row);",
+ " var child = this.el.get_first_child(); ",
+ " \tvar line_no = -1; ",
+ " \tvar reading_header = true;",
"",
- " ",
- "\t",
+ " \twhile (child != null) {",
+ "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
+ " \t if (reading_header) {",
+ "\t\t\t ",
+ "\t\t\t ",
+ "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
+ "\t\t\t\t\tchild = child.get_next_sibling();",
+ "\t\t\t\t\tcontinue;",
+ "\t\t\t\t}",
+ "\t\t\t\tchild = child.get_first_child(); ",
+ "\t\t\t\treading_header = false;",
+ "\t }",
+ "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
+ " \t\t child = child.get_next_sibling();",
+ " \t\t continue;",
+ "\t\t }",
+ "\t\t line_no++;",
+ "\t\t\tif (line_no == row) {",
+ "\t\t\t\tGLib.debug(\"Returning widget %s\", child.get_type().name());",
+ "\t\t\t return (Gtk.Widget)child;",
+ "\t\t }",
+ "\t child = child.get_next_sibling(); ",
+ " \t}",
+ "\t\tGLib.debug(\"Rturning null\");",
+ " return null;",
"",
- " _this.before_edit();",
- " _this.stop_editor();",
- "\t ",
- " _this.keyrender.el.stop_editing(false);",
- " _this.keyrender.el.editable =false;",
+ " }"
+ ],
+ "| int getColAt" : [
+ "(double x, double y) {",
+ "/*",
+ " \t",
+ "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
+ " \t ",
+ " \t*/",
+ "\t\t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
+ " var child = this.el.get_first_child(); ",
+ " \t ",
+ " \tvar col = 0;",
+ " \tvar offx = 0;",
+ " \twhile (child != null) {",
+ "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
+ "\t\t\t",
+ "\t\t\tif (child.get_type().name() == \"GtkColumnViewRowWidget\") {",
+ "\t\t\t\tchild = child.get_first_child();",
+ "\t\t\t\tcontinue;",
+ "\t\t\t}",
+ "\t\t\t",
+ "\t\t\t//child.get_allocation(out alloc);",
+ "\t\t\tif (x < (child.get_width() + offx)) {",
+ "\t\t\t\treturn col;",
+ "\t\t\t}",
+ "\t\t\toffx += child.get_width();",
+ "\t\t\tcol++;",
+ "\t\t\tchild = child.get_next_sibling();",
+ "\t\t}",
+ " \t ",
+ "\t\t\t ",
+ " return -1;",
"",
- " _this.valrender.el.stop_editing(false);",
- " _this.valrender.el.editable =false;",
- " Gtk.TreeIter iter;",
- " var mod = this.el.get_model();",
- "\t mod.get_iter (out iter, path);",
- "\t ",
- " ",
- "\tGLib.Value gval;",
+ " }"
+ ],
+ "| int getRowAt" : [
+ "(double x, double in_y, out string pos) {",
"",
- " mod.get_value(iter,0, out gval);",
"",
- " this.popover.show(_this.view.el, _this.node, (JsRender.NodeProp)gval, y);",
- " ",
- " ",
- "}",
- ""
+ "\t ",
+ "",
+ "/*",
+ " \t",
+ "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
+ " \tvar colview = gesture.widget;",
+ " \tvar line_no = check_list_widget(colview, x,y);",
+ " if (line_no > -1) {",
+ " \t\tvar item = colview.model.get_item(line_no);",
+ " \t\t ",
+ " \t}",
+ " \t*/",
+ " \t\t ",
+ " \t\t",
+ " \t\t//GLib.debug(\"offset = %d y = %d\", (int) voff, (int) in_y);",
+ " \tvar y = in_y + _this.EditProps.el.vadjustment.value; ",
+ " var child = this.el.get_first_child(); ",
+ " \t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
+ " \tvar line_no = -1; ",
+ " \tvar reading_header = true;",
+ " \tvar real_y = 0;",
+ " \tvar header_height = 0;",
+ " \tpos = \"none\";",
+ " \tvar h = 0;",
+ " \twhile (child != null) {",
+ "\t\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
+ " \t if (reading_header) {",
+ "\t\t\t\t",
+ "",
+ "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
+ "\t\t\t h += child.get_height();",
+ "\t\t\t\t\tchild = child.get_next_sibling();",
+ "\t\t\t\t\tcontinue;",
+ "\t\t\t\t}",
+ "\t\t\t\t// should be columnlistview",
+ "\t\t\t\tchild = child.get_first_child(); ",
+ "\t\t\t GLib.debug(\"header height=%d\", h);",
+ "\t\t\t\theader_height = h;",
+ "\t\t\t\t",
+ "\t\t\t\treading_header = false;",
+ "\t\t\t\t",
+ "\t }",
+ "\t ",
+ "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
+ " \t\t child = child.get_next_sibling();",
+ " \t\t continue;",
+ "\t\t }",
+ "\t\t ",
+ "\t\t \tif (y < header_height) {",
+ "\t\t \treturn -1;",
+ "\t \t}",
+ "\t\t ",
+ "\t\t line_no++;",
+ "\t\t\tvar hh = child.get_height();",
+ "\t\t\t//child.get_allocation(out alloc);",
+ "\t\t\t//GLib.debug(\"got cell xy = %d,%d w,h= %d,%d\", alloc.x, alloc.y, alloc.width, alloc.height);",
+ "\t\t\t//GLib.debug(\"row %d y= %d %s\", line_no, (int) (header_height + alloc.y),",
+ "\t\t\t",
+ "\t\t\t//\tchild.visible ? \"VIS\" : \"hidden\");",
+ "",
+ "\t\t if (y > (header_height + real_y) && y <= (header_height + real_y + hh) ) {",
+ "\t\t \tif (y > ( header_height + real_y + (hh * 0.8))) {",
+ "\t\t \t\tpos = \"below\";",
+ "\t \t\t} else if (y > ( header_height + real_y + (hh * 0.2))) {",
+ "\t \t\t\tpos = \"over\";",
+ " \t\t\t} else {",
+ " \t\t\t\tpos = \"above\";",
+ "\t\t\t\t}",
+ "\t\t \t GLib.debug(\"getRowAt return : %d, %s\", line_no, pos);",
+ "\t\t\t return line_no;",
+ "\t\t }",
+ " ",
+ "",
+ "\t\t if (real_y + hh > y) {",
+ "\t\t return -1;",
+ "\t }",
+ "\t real_y += hh;",
+ "\t child = child.get_next_sibling(); ",
+ " \t}",
+ " return -1;",
+ "",
+ " }"
+ ],
+ "| void editProp" : [
+ "(JsRender.NodeProp prop) ",
+ "{",
+ "\tvar sm = _this.selmodel.el;",
+ " ",
+ "\t\tvar sr = -1;",
+ "\t\tGLib.debug(\"finding node\");",
+ "\t\t_this.selmodel.selectProp(prop);",
+ "\t\t",
+ "\t\tfor (var i = 0 ; i < sm.n_items; i++) {",
+ "\t\t\tvar r = (JsRender.NodeProp)sm.get_item(i);",
+ "\t\t\tif (r.equals(prop)) {",
+ "\t\t\t\tsr = i;",
+ "\t\t\t\tbreak;",
+ "\t\t\t}",
+ "\t\t}",
+ "\t\tif (sr < 0) {",
+ "\t\t\tGLib.debug(\"finding node - cant find it\");",
+ "\t\t\t \t\t",
+ "\t\t\treturn;",
+ "\t\t}",
+ "\t\tvar r = this.getWidgetAtRow(sr);",
+ "\t\tGLib.debug(\"r = %s\", r.get_type().name());",
+ "\t\tvar ca = r.get_first_child();",
+ "\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.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.grab_focus_without_selecting();",
+ "\t\t\treturn;",
+ "\t\t}",
+ "\t\tif (d.get_visible()) {",
+ "\t\t\t_this.stop_editor();",
+ "\t\t\td.activate();",
+ "\t\t\treturn;",
+ "\t\t}",
+ "\t\tif (l.get_visible()) {",
+ "\t\t \t_this.stop_editor();",
+ "\t \t_this.show_editor(_this.file, prop.parent, prop);",
+ "\t\t",
+ "\t\t}",
+ "\t\t",
+ "\t\t",
+ "\t\t",
+ "\t\t//gtkcolumnviewrowwidget",
+ "\t\t // cell widet",
+ "\t\t // cell widget",
+ "\t\t \t// box",
+ "\t\t \t\t// entry / label / dropdown",
+ "\t\t \t\t",
+ "\t\t ",
+ "}"
]
}
],
}
],
"xtype" : "Box",
- "| bool startEditingValue" : [
- "( Gtk.TreePath path) {",
- "",
- " // ONLY return true if editing is allowed - eg. combo..",
- "",
- " GLib.debug(\"start editing?\\n\");",
- " if (!this.stop_editor()) {",
- " GLib.debug(\"stop editor failed\\n\");",
- " return false;",
- " }",
- " ",
- " Gtk.TreeIter iter;",
- "",
- " var mod = this.model.el;",
- " mod.get_iter (out iter, path);",
- " ",
- " GLib.Value gval;",
- " mod.get_value(iter, 0 , out gval);",
- " var prop = (JsRender.NodeProp)gval;",
- "",
- "",
- " ",
- " var use_textarea = false;",
- "",
- " //------------ things that require the text editor...",
- " ",
- " if (prop.ptype == JsRender.NodePropType.LISTENER) {",
- " use_textarea = true;",
- " }",
- " if (prop.ptype == JsRender.NodePropType.METHOD) { ",
- " use_textarea = true;",
- " }",
- " // if (prop.ptype == JsRender.NodePropType.RAW) { // raw string",
- " // use_textarea = true;",
- " // }",
- " if ( prop.name == \"init\" && prop.ptype == JsRender.NodePropType.SPECIAL) {",
- " use_textarea = true;",
- " }",
- " if (prop.val.length > 40) { // long value...",
- " use_textarea = true;",
- " }",
- " 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) {",
- " \tuse_textarea = true;",
- " ",
- " }",
- " ",
- " ",
- " if (use_textarea) {",
- " GLib.debug(\"Call show editor\\n\");",
- " GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {",
- " this.view.el.get_selection().select_path(path);",
- " ",
- " this.show_editor(file, node, prop);",
- " ",
- " return false;",
- " });",
- " ",
- " ",
- " return false;",
- " }",
- " ",
- " ",
- " ",
- " ",
- " ",
- " // others... - fill in options for true/false?",
- " GLib.debug(\"turn on editing %s \\n\" , mod.get_path(iter).to_string());",
- " ",
- " // GLib.debug (ktype.up());",
- " if (has_opts) {",
- " GLib.debug(\"start editing try/false)???\");",
- " this.valrender.el.has_entry = false;",
- " ",
- " this.valrender.setOptions(opts);",
- " ",
- " this.valrender.el.has_entry = false;",
- " this.valrender.el.editable = true;",
- " this.allow_edit = true;",
- " GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {",
- " this.view.el.set_cursor_on_cell(",
- "\t path,",
- "\t this.valcol.el,",
- "\t this.valrender.el,",
- "\t true",
- " );",
- " return false;",
- " });",
- " return true;",
- " }",
- " ",
- " // see if type is a Enum.",
- " ",
- " ",
- " ",
- " ",
- " ",
- " opts = { };",
- " this.valrender.setOptions(opts);",
- " ",
- " GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {",
- " ",
- " // at this point - work out the type...",
- " // if its' a combo... then show the options..",
- " this.valrender.el.has_entry = true;",
- " ",
- " this.valrender.el.editable = true; ",
- " ",
- " ",
- " this.allow_edit = true;",
- " ",
- " ",
- " ",
- " ",
- "",
- " this.view.el.set_cursor_on_cell(",
- " path,",
- " this.valcol.el,",
- " this.valrender.el,",
- " true",
- " );",
- " return false;",
- " });",
- " return false;",
- "}",
- ""
- ],
"| string keyFormat" : [
"(string val, string type) {",
" ",
"",
"}"
],
- "| void addProp" : [
+ "| void a_addProp" : [
" (JsRender.NodeProp prop) {",
" // info includes key, val, skel, etype..",
" //console.dump(info);",
" this.load(this.file, this.node);",
" ",
" ",
- " ",
- " /// need to find the row which I've just added..",
- " ",
- " ",
- " var s = this.view.el.get_selection();",
- " s.unselect_all();",
+ " ",
" ",
" GLib.debug(\"trying to find new iter\");",
- " ",
- " this.model.el.foreach((model, path, iter) => {",
- " GLib.Value gval;",
- " this.model.el.get_value(iter, 0 , out gval);",
- " ",
- " var iprop = (JsRender.NodeProp)gval;",
- " if (iprop.to_index_key() != prop.to_index_key()) {",
- " \treturn false; // continue?",
- " }",
- " ",
- " // delay this?",
- " GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {",
- " \t/*",
- " \t\tif (prop.name == \"\") { // empty string for key name.",
- " \t\t_this.view.editPropertyDetails(this.model.el.get_path(iter));",
- " \t\treturn false;",
- " \t}",
- " \t*/",
- " \t",
- " this.startEditingValue(this.model.el.get_path(iter));",
- " return false;",
- " });",
- " //s.select_iter(iter);",
- " return true; ",
- " });",
- " ",
- " ",
+ " ",
" ",
" ",
"}",
""
],
- "| void before_edit" : [
- "()",
- "{",
- "",
- " GLib.debug(\"before edit - stop editing\\n\");",
- " ",
- " // these do not appear to trigger save...",
- " _this.keyrender.el.stop_editing(false);",
- " _this.keyrender.el.editable =false;",
- "",
- " _this.valrender.el.stop_editing(false);",
- " _this.valrender.el.editable =false; ",
- " ",
- " ",
- "// technicall stop the popup editor..",
- "",
- "}",
- ""
- ],
"| void deleteSelected" : [
" () {",
" ",
- "",
+ "\t\treturn;",
+ "\t\t/*",
" ",
" Gtk.TreeIter iter;",
" Gtk.TreeModel mod;",
" this.load(this.file, this.node);",
" ",
" _this.changed();",
- "}"
- ],
- "| void finish_editing" : [
- "() {",
- " // ",
- " this.before_edit();",
+ " */",
"}"
],
"| void load" : [
"(JsRender.JsRender file, JsRender.Node? node) ",
"{",
"\t// not sure when to initialize this - we should do it on setting main window really. ",
+ "\t",
+ "\tthis.loading = true;",
" if (this.view.popover == null) {",
" \t\t this.view.popover = new Xcls_PopoverProperty();",
" \t\t this.view.popover.mainwindow = _this.main_window;",
"\t}",
" ",
" ",
- " ",
+ " if (this.node != null) {",
+ " \tthis.node.dupeProps(); // ensures removeall will not do somethign silly",
+ " \t",
+ " }",
" ",
" GLib.debug(\"load leftprops\\n\");",
- " this.before_edit();",
+ "",
" this.node = node;",
" this.file = file;",
" ",
" ",
- " this.model.el.clear();",
+ " this.model.el.remove_all();",
" ",
" //this.get('/RightEditor').el.hide();",
" if (node ==null) {",
" return ;",
" }",
- " ",
+ " node.loadProps(this.model.el); ",
" ",
- "",
- " //var provider = this.get('/LeftTree').getPaleteProvider();",
- " Gtk.TreeIter iter;",
" ",
+ " //GLib.debug(\"clear selection\\n\");",
" ",
- " ",
- " ",
- " ",
- " // really need a way to sort the hashmap...",
- " var m = this.model.el;",
- " ",
- " var miter = node.listeners.map_iterator();",
- " var i = 0;",
- " ",
- " while(miter.next()) {",
- " i++;",
- " m.append(out iter,null);",
- " ",
- " this.updateIter(iter, miter.get_value());",
- " ",
- " ",
- " }",
- " ",
- " ",
- " miter = node.props.map_iterator();",
- " ",
- " ",
- " while(miter.next()) {",
- " i++;",
- " m.append(out iter,null);",
- " this.updateIter(iter, miter.get_value());",
- " ",
- " }",
- " GLib.debug(\"clear selection\\n\");",
+ " \tthis.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.model.el.set_sort_column_id(4,Gtk.SortType.ASCENDING); // sort by real key..",
" ",
- " this.view.el.get_selection().unselect_all();",
+ " // 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);",
+ " // _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);",
" ",
"}",
""
- ],
- "| void reload" : [
- "() {",
- "\tthis.load(this.file, this.node);",
- "}",
- ""
- ],
- "| void startEditingKey" : [
- "( Gtk.TreePath path) {",
- " ",
- " if (!this.stop_editor()) {",
- " return;",
- " }",
- " ",
- " // others... - fill in options for true/false?",
- " ",
- " ",
- " GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {",
- " this.allow_edit = true;",
- " this.keyrender.el.editable = true;",
- " ",
- " this.view.el.set_cursor_on_cell(",
- " path,",
- " this.keycol.el,",
- " this.keyrender.el,",
- " true",
- " );",
- " ",
- " return false;",
- " });",
- " ",
- " ",
- "}",
- ""
- ],
- "| void updateIter" : [
- "(Gtk.TreeIter iter, JsRender.NodeProp prop) {",
- "",
- " //print(\"update Iter %s, %s\\n\", key,kvalue);",
- " ",
- " var dl = prop.val.strip().split(\"\\n\");",
- "",
- " var dis_val = dl.length > 1 ? (dl[0].strip()+ \"...\") : dl[0];",
- " ",
- " if (prop.ptype == JsRender.NodePropType.LISTENER) {",
- " ",
- " ",
- " ",
- " this.model.el.set(iter, ",
- " \t0, prop,",
- " \t1, prop.to_display_name(),",
- " \t2, dis_val,",
- " 3, \"<tt>\" + GLib.Markup.escape_text(prop.to_tooltip()) + \"</tt>\",",
- " 4, prop.to_sort_key(),",
- " -1",
- " ); ",
- " return;",
- " }",
- " ",
- "",
- "",
- " this.model.el.set(iter, ",
- " 0, prop,",
- " \t1, prop.to_display_name(),",
- " \t2, dis_val,",
- " 3, \"<tt>\" + GLib.Markup.escape_text(prop.to_tooltip()) + \"</tt>\",",
- " 4, prop.to_sort_key(),",
- " -1",
- " ",
- " ); ",
- "}"
]
}
],
- "modOrder" : "",
- "name" : "WindowLeftProps",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/WindowLeftProps.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "WindowLeftProps"
}
\ No newline at end of file
-static Xcls_LeftProps _LeftProps;
+ 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_model model;
- public Xcls_keycol keycol;
- public Xcls_keyrender keyrender;
- public Xcls_valcol valcol;
- public Xcls_valrender valrender;
- public Xcls_valrendermodel valrendermodel;
- public Xcls_ContextMenu ContextMenu;
-
- // my vars (def)
- public bool allow_edit;
- public signal void show_add_props (string type);
- public Xcls_MainWindow main_window;
- public signal bool stop_editor ();
- public JsRender.JsRender file;
- public JsRender.Node node;
- public signal void changed ();
- public signal void show_editor (JsRender.JsRender file, JsRender.Node node, JsRender.NodeProp prop);
-
- // ctor
- public Xcls_LeftProps()
+ public class Xcls_LeftProps : Object
{
- _this = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
- this.allow_edit = false;
- this.main_window = null;
-
- // set gobject values
- this.el.homogeneous = false ;
- var child_0 = new Xcls_Box2( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,true,0 );
- var child_1 = new Xcls_EditProps( _this );
- child_1.ref();
- this.el.pack_end ( child_1.el , true,true,0 );
- }
+ public Gtk.Box el;
+ private Xcls_LeftProps _this;
- // 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];
+ public static Xcls_LeftProps singleton()
+ {
+ if (_LeftProps == null) {
+ _LeftProps= new Xcls_LeftProps();
+ }
+ return _LeftProps;
}
- // signals
- if (key[0] == '@') {
- return "3 " + bits[bits.length -1];
+ 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
- // 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);
- }
+ var bits = key.split(" ");
- 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>";
-
-
+ if (key[0] == '|') {
+ return "2 " + bits[bits.length -1];
+ }
+ // signals
+ if (key[0] == '@') {
+ return "3 " + bits[bits.length -1];
+ }
- default:
- return dval;
- }
-
+ // props
+ if (key[0] == '#') {
+ return "4 " + bits[bits.length -1];
+ }
+ // the rest..
+ return "5 " + bits[bits.length -1];
-
- }
- public void updateIter (Gtk.TreeIter iter, JsRender.NodeProp prop) {
-
- //print("update Iter %s, %s\n", key,kvalue);
- var dl = prop.val.strip().split("\n");
-
- var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
- if (prop.ptype == JsRender.NodePropType.LISTENER) {
-
-
-
- this.model.el.set(iter,
- 0, prop,
- 1, prop.to_display_name(),
- 2, dis_val,
- 3, "<tt>" + GLib.Markup.escape_text(prop.to_tooltip()) + "</tt>",
- 4, prop.to_sort_key(),
- -1
- );
- return;
}
+ public string keyFormat (string val, string type) {
+
+ // Glib.markup_escape_text(val);
-
-
- this.model.el.set(iter,
- 0, prop,
- 1, prop.to_display_name(),
- 2, dis_val,
- 3, "<tt>" + GLib.Markup.escape_text(prop.to_tooltip()) + "</tt>",
- 4, prop.to_sort_key(),
- -1
-
- );
- }
- public void before_edit ()
- {
-
- GLib.debug("before edit - stop editing\n");
-
- // these do not appear to trigger save...
- _this.keyrender.el.stop_editing(false);
- _this.keyrender.el.editable =false;
-
- _this.valrender.el.stop_editing(false);
- _this.valrender.el.editable =false;
-
-
- // technicall stop the popup editor..
-
- }
- public void deleteSelected () {
-
-
+ 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>";
+ }
- Gtk.TreeIter iter;
- Gtk.TreeModel mod;
+ //@ = signal
+ //$ = property with
+ //# - object properties
+ //* = special
+ // all of these... - display value is last element..
+ var ar = val.strip().split(" ");
- 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;
+ 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:
- this.node.props.unset(prop.to_index_key());
- break;
+ return dval;
}
- this.load(this.file, this.node);
+
- _this.changed();
- }
- public void startEditingKey ( Gtk.TreePath path) {
-
- if (!this.stop_editor()) {
- return;
- }
-
- // others... - fill in options for true/false?
-
-
- GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
- this.allow_edit = true;
- this.keyrender.el.editable = true;
-
- this.view.el.set_cursor_on_cell(
- path,
- this.keycol.el,
- this.keyrender.el,
- true
- );
-
- return false;
- });
-
-
- }
- public void reload () {
- this.load(this.file, this.node);
- }
- public void finish_editing () {
- //
- this.before_edit();
- }
- public bool startEditingValue ( Gtk.TreePath path) {
-
- // ONLY return true if editing is allowed - eg. combo..
-
- GLib.debug("start editing?\n");
- if (!this.stop_editor()) {
- GLib.debug("stop editor failed\n");
- return false;
- }
-
- Gtk.TreeIter iter;
-
- var mod = this.model.el;
- mod.get_iter (out iter, path);
-
- GLib.Value gval;
- mod.get_value(iter, 0 , out gval);
- var prop = (JsRender.NodeProp)gval;
-
-
-
- var use_textarea = false;
-
- //------------ things that require the text editor...
-
- if (prop.ptype == JsRender.NodePropType.LISTENER) {
- use_textarea = true;
- }
- if (prop.ptype == JsRender.NodePropType.METHOD) {
- use_textarea = true;
- }
- // if (prop.ptype == JsRender.NodePropType.RAW) { // raw string
- // use_textarea = true;
- // }
- if ( prop.name == "init" && prop.ptype == JsRender.NodePropType.SPECIAL) {
- use_textarea = true;
- }
- if (prop.val.length > 40) { // long value...
- use_textarea = true;
- }
- 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) {
- GLib.debug("Call show editor\n");
- GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
- this.view.el.get_selection().select_path(path);
+ public void deleteSelected () {
+
+ return;
+ /*
- this.show_editor(file, node, prop);
+ Gtk.TreeIter iter;
+ Gtk.TreeModel mod;
- return false;
- });
-
-
- return false;
- }
-
-
-
-
-
- // others... - fill in options for true/false?
- GLib.debug("turn on editing %s \n" , mod.get_path(iter).to_string());
-
- // GLib.debug (ktype.up());
- if (has_opts) {
- GLib.debug("start editing try/false)???");
- this.valrender.el.has_entry = false;
-
- this.valrender.setOptions(opts);
+ 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();
- this.valrender.el.has_entry = false;
- this.valrender.el.editable = true;
- this.allow_edit = true;
- GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
- this.view.el.set_cursor_on_cell(
- path,
- this.valcol.el,
- this.valrender.el,
- true
- );
- return false;
- });
- return true;
+
+ 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();
+ */
}
-
- // see if type is a Enum.
-
-
-
-
-
- opts = { };
- this.valrender.setOptions(opts);
-
- GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
+ 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);
- // at this point - work out the type...
- // if its' a combo... then show the options..
- this.valrender.el.has_entry = true;
- this.valrender.el.editable = true;
-
+
- this.allow_edit = true;
+ 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
+
+ }
-
- this.view.el.set_cursor_on_cell(
- path,
- this.valcol.el,
- this.valrender.el,
- true
- );
- return false;
- });
- return false;
- }
- public void load (JsRender.JsRender file, JsRender.Node? node)
- {
- // not sure when to initialize this - we should do it on setting main window really.
- if (this.view.popover == null) {
- this.view.popover = new Xcls_PopoverProperty();
- this.view.popover.mainwindow = _this.main_window;
- }
-
-
-
+ GLib.debug("load leftprops\n");
- GLib.debug("load leftprops\n");
- this.before_edit();
- this.node = node;
- this.file = file;
-
-
- this.model.el.clear();
-
- //this.get('/RightEditor').el.hide();
- if (node ==null) {
- return ;
- }
-
-
-
- //var provider = this.get('/LeftTree').getPaleteProvider();
- Gtk.TreeIter iter;
-
-
-
-
-
- // really need a way to sort the hashmap...
- var m = this.model.el;
-
- var miter = node.listeners.map_iterator();
- var i = 0;
-
- while(miter.next()) {
- i++;
- m.append(out iter,null);
-
- this.updateIter(iter, miter.get_value());
+ this.node = node;
+ this.file = file;
-
- }
-
- miter = node.props.map_iterator();
-
-
- while(miter.next()) {
- i++;
- m.append(out iter,null);
- this.updateIter(iter, miter.get_value());
-
- }
- GLib.debug("clear selection\n");
- // 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 void 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.model.el.remove_all();
+
+ //this.get('/RightEditor').el.hide();
+ if (node ==null) {
+ return ;
}
- this.node.props.set(prop.to_index_key(),prop);
- }
-
-
- // add a row???
- this.load(this.file, this.node);
-
-
-
- /// need to find the row which I've just added..
-
-
- var s = this.view.el.get_selection();
- s.unselect_all();
-
- GLib.debug("trying to find new iter");
-
- this.model.el.foreach((model, path, iter) => {
- GLib.Value gval;
- this.model.el.get_value(iter, 0 , out gval);
+ node.loadProps(this.model.el);
- var iprop = (JsRender.NodeProp)gval;
- if (iprop.to_index_key() != prop.to_index_key()) {
- return false; // continue?
- }
- // delay this?
- GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
- /*
- if (prop.name == "") { // empty string for key name.
- _this.view.editPropertyDetails(this.model.el.get_path(iter));
- return false;
- }
- */
-
- this.startEditingValue(this.model.el.get_path(iter));
- return false;
- });
- //s.select_iter(iter);
- return true;
- });
-
-
-
-
- }
- 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
- var child_0 = new Xcls_Label3( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_Button4( _this );
- child_1.ref();
- this.el.add ( child_1.el );
- var child_2 = new Xcls_Button6( _this );
- child_2.ref();
- this.el.add ( child_2.el );
- var child_3 = new Xcls_Button8( _this );
- child_3.ref();
- this.el.add ( child_3.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;
- // 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 (def)
- // my vars (dec)
+ // 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 );
+ }
- // set gobject values
- this.el.margin_end = 5;
- this.el.margin_start = 5;
+ // user defined functions
}
+ public class Xcls_Label3 : Object
+ {
+ public Gtk.Label el;
+ private Xcls_LeftProps _this;
- // user defined functions
- }
-
- public class Xcls_Button4 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Label3(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Label( "Add:" );
- // ctor
- public Xcls_Button4(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.margin_end = 5;
+ this.el.margin_start = 5;
+ }
- // set gobject values
- this.el.hexpand = true;
- this.el.always_show_image = true;
- this.el.tooltip_text = "Add Property";
- this.el.label = "Property";
- var child_0 = new Xcls_Image5( _this );
- child_0.ref();
- this.el.set_image ( child_0.el );
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
- _this.main_window.windowstate.showProps(
- _this.view.el,
- JsRender.NodePropType.PROP
- );
-
- });
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_Image5 : Object
- {
- public Gtk.Image el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image5(Xcls_LeftProps _owner )
+ public class Xcls_Button4 : Object
{
- _this = _owner;
- this.el = new Gtk.Image();
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- // my vars (dec)
- // set gobject values
- this.el.icon_name = "format-justify-left";
- }
+ // my vars (def)
+ public bool always_show_image;
- // user defined functions
- }
+ // ctor
+ public Xcls_Button4(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
+ // my vars (dec)
+ this.always_show_image = true;
- public class Xcls_Button6 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
+ // 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
+ );
+
+ });
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_Button6(Xcls_LeftProps _owner )
+ public class Xcls_Button5 : Object
{
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- // set gobject values
- this.el.hexpand = true;
- this.el.always_show_image = true;
- this.el.tooltip_text = "Add Event Code";
- this.el.label = "Event";
- var child_0 = new Xcls_Image7( _this );
- child_0.ref();
- this.el.set_image ( child_0.el );
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
-
- _this.main_window.windowstate.showProps(
- _this.view.el,
- JsRender.NodePropType.LISTENER
- );
-
-
- });
- }
- // user defined functions
- }
- public class Xcls_Image7 : Object
- {
- public Gtk.Image 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 (def)
+ // my vars (dec)
+ this.always_show_image = true;
- // ctor
- public Xcls_Image7(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
+ // set gobject values
+ this.el.icon_name = "appointment-new";
+ this.el.hexpand = true;
+ this.el.tooltip_text = "Add Event Code";
+ this.el.label = "Event";
- // my vars (dec)
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+
+ _this.main_window.windowstate.showProps(
+ _this.view.el,
+ JsRender.NodePropType.LISTENER
+ );
+
+
+ });
+ }
- // set gobject values
- this.el.icon_name = "appointment-new";
+ // user defined functions
}
- // user defined functions
- }
-
-
- public class Xcls_Button8 : Object
- {
- public Gtk.Button el;
- private Xcls_LeftProps _this;
+ public class Xcls_Button6 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- // my vars (def)
+ // my vars (def)
+ public bool always_show_image;
- // ctor
- public Xcls_Button8(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
+ // ctor
+ public Xcls_Button6(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // my vars (dec)
+ // my vars (dec)
+ this.always_show_image = true;
- // set gobject values
- this.el.hexpand = true;
- this.el.always_show_image = true;
- this.el.label = "Other";
- var child_0 = new Xcls_AddPropertyPopup( _this );
- child_0.ref();
- var child_1 = new Xcls_Image27( _this );
- child_1.ref();
- this.el.set_image ( child_1.el );
+ // set gobject values
+ this.el.icon_name = "list-add";
+ this.el.hexpand = true;
+ this.el.label = "Other";
+ new Xcls_AddPropertyPopup( _this );
- //listeners
- this.el.button_press_event.connect( (self, ev) => {
- _this.before_edit();
-
+ //listeners
+ this.el.clicked.connect( ( ) => {
+ //_this.before_edit();
+
+
+ var p = _this.AddPropertyPopup;
- var p = _this.AddPropertyPopup;
- p.el.set_screen(Gdk.Screen.get_default());
- p.el.show_all();
- p.el.popup_at_pointer(ev);
- return true;
- });
+ // 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;
- // user defined functions
- }
- public class Xcls_AddPropertyPopup : Object
- {
- public Gtk.Menu el;
- private Xcls_LeftProps _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.AddPropertyPopup = this;
+ this.el = new Gtk.Popover();
- // ctor
- public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.AddPropertyPopup = this;
- this.el = new Gtk.Menu();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.autohide = true;
+ var child_1 = new Xcls_Box8( _this );
+ this.el.child = child_1.el;
+ }
- // set gobject values
- var child_0 = new Xcls_MenuItem10( _this );
- child_0.ref();
- this.el.append ( child_0.el );
- var child_1 = new Xcls_MenuItem11( _this );
- child_1.ref();
- this.el.append ( child_1.el );
- var child_2 = new Xcls_MenuItem12( _this );
- child_2.ref();
- this.el.append ( child_2.el );
- var child_3 = new Xcls_MenuItem13( _this );
- child_3.ref();
- this.el.append ( child_3.el );
- var child_4 = new Xcls_MenuItem14( _this );
- child_4.ref();
- this.el.append ( child_4.el );
- var child_5 = new Xcls_SeparatorMenuItem15( _this );
- child_5.ref();
- this.el.add ( child_5.el );
- var child_6 = new Xcls_MenuItem16( _this );
- child_6.ref();
- this.el.append ( child_6.el );
- var child_7 = new Xcls_MenuItem17( _this );
- child_7.ref();
- this.el.append ( child_7.el );
- var child_8 = new Xcls_MenuItem18( _this );
- child_8.ref();
- this.el.append ( child_8.el );
- var child_9 = new Xcls_SeparatorMenuItem19( _this );
- child_9.ref();
- this.el.add ( child_9.el );
- var child_10 = new Xcls_MenuItem20( _this );
- child_10.ref();
- this.el.append ( child_10.el );
- var child_11 = new Xcls_MenuItem21( _this );
- child_11.ref();
- this.el.append ( child_11.el );
- var child_12 = new Xcls_MenuItem22( _this );
- child_12.ref();
- this.el.append ( child_12.el );
- var child_13 = new Xcls_SeparatorMenuItem23( _this );
- child_13.ref();
- this.el.add ( child_13.el );
- var child_14 = new Xcls_MenuItem24( _this );
- child_14.ref();
- this.el.append ( child_14.el );
- var child_15 = new Xcls_MenuItem25( _this );
- child_15.ref();
- this.el.append ( child_15.el );
- var child_16 = new Xcls_MenuItem26( _this );
- child_16.ref();
- this.el.append ( child_16.el );
+ // user defined functions
}
+ public class Xcls_Box8 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_LeftProps _this;
- // user defined functions
- }
- public class Xcls_MenuItem10 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
-
-
- // my vars (def)
- // ctor
- public Xcls_MenuItem10(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ // my vars (def)
- // my vars (dec)
+ // 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 );
+ }
- // set gobject values
- this.el.tooltip_markup = "Using _this.{ID} will map to this element";
- this.el.label = "id: _this.{ID} (Vala)";
- this.el.show();
-
- //listeners
- this.el.activate.connect( () => {
- // is this userdef or special??
- _this.addProp( new JsRender.NodeProp.prop("id") );
- });
+ // user defined functions
}
+ public class Xcls_Button9 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- // user defined functions
- }
- public class Xcls_MenuItem11 : Object
- {
- public Gtk.MenuItem 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 );
+
+
+ });
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_MenuItem11(Xcls_LeftProps _owner )
+ public class Xcls_Button10 : Object
{
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- // 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)";
- this.el.show();
-
- //listeners
- this.el.activate.connect( ( ) => {
- // is this userdef?
- _this.addProp( new JsRender.NodeProp.special("pack", "add") );
- });
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_Button10(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- public class Xcls_MenuItem12 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // 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)";
- // my vars (def)
+ //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 );
+
+
+ });
+ }
- // ctor
- public Xcls_MenuItem12(Xcls_LeftProps _owner )
+ // user defined functions
+ }
+
+ public class Xcls_Button11 : Object
{
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- // 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)";
- this.el.show();
+ // my vars (def)
- //listeners
- this.el.activate.connect( ( ) => {
-
- _this.addProp( new JsRender.NodeProp.special("ctor") );
- });
- }
+ // ctor
+ public Xcls_Button11(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // user defined functions
- }
+ // my vars (dec)
- public class Xcls_MenuItem13 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // 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 );
+
+ });
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_MenuItem13(Xcls_LeftProps _owner )
+ public class Xcls_Button12 : Object
{
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- // my vars (dec)
- // set gobject values
- this.el.tooltip_markup = "This code is called after the ctor";
- this.el.label = "init: initialziation code (vala)";
- this.el.show();
+ // my vars (def)
- //listeners
- this.el.activate.connect( ( ) => {
- _this.addProp( new JsRender.NodeProp.special("init","{\n\n}\n" ) );
-
- });
- }
+ // ctor
+ public Xcls_Button12(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // user defined functions
- }
+ // my vars (dec)
- public class Xcls_MenuItem14 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // 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 );
+ });
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_MenuItem14(Xcls_LeftProps _owner )
+ public class Xcls_Button13 : Object
{
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- // 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)";
- this.el.show();
+ // my vars (def)
- //listeners
- this.el.activate.connect( () => {
-
- _this.addProp( new JsRender.NodeProp.prop("cms-id","string", "" ) );
-
-
-
- });
- }
+ // ctor
+ public Xcls_Button13(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // user defined functions
- }
+ // my vars (dec)
- public class Xcls_SeparatorMenuItem15 : Object
- {
- public Gtk.SeparatorMenuItem el;
- private Xcls_LeftProps _this;
+ // 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 );
+
+ });
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_SeparatorMenuItem15(Xcls_LeftProps _owner )
+ public class Xcls_Separator14 : Object
{
- _this = _owner;
- this.el = new Gtk.SeparatorMenuItem();
+ public Gtk.Separator el;
+ private Xcls_LeftProps _this;
- // my vars (dec)
- // set gobject values
- this.el.show();
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_Separator14(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
- public class Xcls_MenuItem16 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // my vars (dec)
+ // set gobject values
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_MenuItem16(Xcls_LeftProps _owner )
+ public class Xcls_Button15 : Object
{
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- // my vars (dec)
- // set gobject values
- this.el.tooltip_markup = "Add a user defined string property";
- this.el.label = "String";
- this.el.show();
+ // my vars (def)
- //listeners
- this.el.activate.connect( (self) => {
-
- _this.view.popover.show(
- _this.view.el,
- _this.node,
- new JsRender.NodeProp.prop("", "string", "") ,
- -1,
- true
- );
-
- });
+ // 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
}
- // user defined functions
- }
+ public class Xcls_Button16 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- public class Xcls_MenuItem17 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Button16(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // ctor
- public Xcls_MenuItem17(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.tooltip_markup = "Add a user defined number property";
+ this.el.label = "Number";
- // set gobject values
- this.el.tooltip_markup = "Add a user defined number property";
- this.el.label = "Number";
- this.el.show();
-
- //listeners
- this.el.activate.connect( ( ) =>{
- _this.view.popover.show(
- _this.view.el,
- _this.node,
- new JsRender.NodeProp.prop("", "int", "0") ,
- -1,
- true
- );
-
- });
+ //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
}
- // user defined functions
- }
+ public class Xcls_Button17 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- public class Xcls_MenuItem18 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Button17(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // ctor
- public Xcls_MenuItem18(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.tooltip_markup = "Add a user defined boolean property";
+ this.el.label = "Boolean";
- // set gobject values
- this.el.tooltip_markup = "Add a user defined boolean property";
- this.el.label = "Boolean";
- this.el.show();
+ //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
+ );
+
+ });
+ }
- //listeners
- this.el.activate.connect( ( ) =>{
-
-
- _this.view.popover.show(
- _this.view.el,
- _this.node,
- new JsRender.NodeProp.prop("", "bool", "true") ,
- -1,
- true
- );
-
- });
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_Separator18 : Object
+ {
+ public Gtk.Separator el;
+ private Xcls_LeftProps _this;
- public class Xcls_SeparatorMenuItem19 : Object
- {
- public Gtk.SeparatorMenuItem el;
- private Xcls_LeftProps _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Separator18(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
- // ctor
- public Xcls_SeparatorMenuItem19(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.SeparatorMenuItem();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ }
- // set gobject values
- this.el.show();
+ // user defined functions
}
- // user defined functions
- }
-
- public class Xcls_MenuItem20 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
-
+ public class Xcls_Button19 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- // my vars (def)
- // ctor
- public Xcls_MenuItem20(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ // my vars (def)
- // my vars (dec)
+ // 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
+ );
+
+
+ });
+ }
- // set gobject values
- this.el.tooltip_markup = "Add a user function boolean property";
- this.el.label = "Javascript Function";
- this.el.show();
-
- //listeners
- this.el.activate.connect( ( ) =>{
-
- _this.view.popover.show(
- _this.view.el,
- _this.node,
- new JsRender.NodeProp.jsmethod("") ,
- -1,
- true
- );
-
-
- });
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_Button20 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- public class Xcls_MenuItem21 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // my vars (def)
- // 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
+ );
+ });
+ }
- // ctor
- public Xcls_MenuItem21(Xcls_LeftProps _owner )
+ // user defined functions
+ }
+
+ public class Xcls_Button21 : Object
{
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- // my vars (dec)
- // set gobject values
- this.el.tooltip_markup = "Add a user function boolean property";
- this.el.label = "Vala Method";
- this.el.show();
+ // my vars (def)
- //listeners
- this.el.activate.connect( ( ) =>{
-
- _this.view.popover.show(
- _this.view.el,
- _this.node,
- new JsRender.NodeProp.valamethod("") ,
- -1,
- true
- );
- });
+ // 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
}
- // user defined functions
- }
+ public class Xcls_Separator22 : Object
+ {
+ public Gtk.Separator el;
+ private Xcls_LeftProps _this;
- public class Xcls_MenuItem22 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Separator22(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Separator( Gtk.Orientation.HORIZONTAL );
- // ctor
- public Xcls_MenuItem22(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ }
- // set gobject values
- this.el.tooltip_markup = "Add a vala signal";
- this.el.label = "Vala Signal";
- this.el.show();
-
- //listeners
- this.el.activate.connect( ( ) =>{
- _this.view.popover.show(
- _this.view.el,
- _this.node,
- new JsRender.NodeProp.sig("" ) ,
- -1,
- true
- );
- });
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_Button23 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- public class Xcls_SeparatorMenuItem23 : Object
- {
- public Gtk.SeparatorMenuItem el;
- private Xcls_LeftProps _this;
+ // my vars (def)
- // 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
+ );
+
+
+ });
+ }
- // ctor
- public Xcls_SeparatorMenuItem23(Xcls_LeftProps _owner )
+ // user defined functions
+ }
+
+ public class Xcls_Button24 : Object
{
- _this = _owner;
- this.el = new Gtk.SeparatorMenuItem();
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- // my vars (dec)
- // set gobject values
- this.el.show();
- }
+ // my vars (def)
- // user defined functions
- }
+ // 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
+ );
+
+
+ });
+ }
- public class Xcls_MenuItem24 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // user defined functions
+ }
+ public class Xcls_Button25 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- // my vars (def)
- // ctor
- public Xcls_MenuItem24(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ // my vars (def)
- // my vars (dec)
+ // 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
+ );
+
+ });
+ }
- // set gobject values
- this.el.tooltip_markup = "Add a flexy if (for HTML templates)";
- this.el.label = "Flexy - If";
- this.el.show();
-
- //listeners
- this.el.activate.connect( ( ) =>{
- _this.view.popover.show(
- _this.view.el,
- _this.node,
- new JsRender.NodeProp.prop("flexy:if", "string", "value_or_condition") ,
- -1,
- true
- );
-
-
- });
+ // user defined functions
}
- // user defined functions
- }
- public class Xcls_MenuItem25 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
- // my vars (def)
- // ctor
- public Xcls_MenuItem25(Xcls_LeftProps _owner )
+ public class Xcls_EditProps : Object
{
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ public Gtk.ScrolledWindow el;
+ private Xcls_LeftProps _this;
- // my vars (dec)
- // set gobject values
- this.el.tooltip_markup = "Add a flexy include (for HTML templates)";
- this.el.label = "Flexy - Include";
- this.el.show();
-
- //listeners
- this.el.activate.connect( ( ) =>{
- _this.view.popover.show(
- _this.view.el,
- _this.node,
- new JsRender.NodeProp.prop("flexy:include", "string", "name_of_file.html") ,
- -1,
- true
- );
-
-
- });
- }
+ // my vars (def)
+ public bool editing;
- // user defined functions
- }
+ // ctor
+ public Xcls_EditProps(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.EditProps = this;
+ this.el = new Gtk.ScrolledWindow();
- public class Xcls_MenuItem26 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // 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 );
- // my vars (def)
+ // init method
- // ctor
- public Xcls_MenuItem26(Xcls_LeftProps _owner )
+ {
+
+ this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+ }
+ }
+
+ // user defined functions
+ }
+ public class Xcls_view : Object
{
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ public Gtk.ColumnView el;
+ private Xcls_LeftProps _this;
- // my vars (dec)
- // set gobject values
- this.el.tooltip_markup = "Add a flexy foreach (for HTML templates)";
- this.el.label = "Flexy - Foreach";
- this.el.show();
+ // my vars (def)
+ public Gtk.CssProvider css;
+ public Xcls_PopoverProperty popover;
- //listeners
- this.el.activate.connect( ( ) =>{
-
- _this.view.popover.show(
- _this.view.el,
- _this.node,
- new JsRender.NodeProp.prop("flexy:foreach", "string", "array,key,value") ,
- -1,
- true
- );
+ // 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;
- // user defined functions
- }
-
-
- public class Xcls_Image27 : Object
- {
- public Gtk.Image el;
- private Xcls_LeftProps _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_deletemenu(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.deletemenu = this;
+ this.el = new Gtk.Popover();
- // ctor
- public Xcls_Image27(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ var child_1 = new Xcls_Box29( _this );
+ this.el.child = child_1.el;
+ }
- // set gobject values
- this.el.icon_name = "list-add";
+ // user defined functions
}
-
- // user defined functions
- }
+ public class Xcls_Box29 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_LeftProps _this;
+ // my vars (def)
- public class Xcls_EditProps : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_LeftProps _this;
+ // ctor
+ public Xcls_Box29(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ // my vars (dec)
- // my vars (def)
- public bool editing;
+ // set gobject values
+ var child_1 = new Xcls_Button30( _this );
+ child_1.ref();
+ this.el.append( child_1.el );
+ }
- // ctor
- public Xcls_EditProps(Xcls_LeftProps _owner )
+ // user defined functions
+ }
+ public class Xcls_Button30 : Object
{
- _this = _owner;
- _this.EditProps = this;
- this.el = new Gtk.ScrolledWindow( null, null );
-
- // my vars (dec)
- this.editing = false;
+ public Gtk.Button el;
+ private Xcls_LeftProps _this;
- // set gobject values
- this.el.shadow_type = Gtk.ShadowType.IN;
- var child_0 = new Xcls_view( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- // init method
+ // my vars (def)
+ // ctor
+ public Xcls_Button30(Xcls_LeftProps _owner )
{
-
- this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+ _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_view : Object
- {
- public Gtk.TreeView el;
- private Xcls_LeftProps _this;
+ // user defined functions
+ }
- // my vars (def)
- public Gtk.CssProvider css;
- public Xcls_PopoverProperty popover;
- // ctor
- public Xcls_view(Xcls_LeftProps _owner )
+ public class Xcls_GestureClick31 : Object
{
- _this = _owner;
- _this.view = this;
- this.el = new Gtk.TreeView();
+ public Gtk.GestureClick el;
+ private Xcls_LeftProps _this;
- // my vars (dec)
- this.popover = null;
-
- // set gobject values
- this.el.name = "leftprops-view";
- this.el.tooltip_column = 3;
- this.el.enable_tree_lines = true;
- this.el.headers_visible = true;
- var child_0 = new Xcls_model( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_keycol( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
- var child_2 = new Xcls_valcol( _this );
- child_2.ref();
- this.el.append_column ( child_2.el );
- var child_3 = new Xcls_ContextMenu( _this );
- child_3.ref();
- // init method
+ // my vars (def)
+ // ctor
+ public Xcls_GestureClick31(Xcls_LeftProps _owner )
{
- var selection = this.el.get_selection();
- selection.set_mode( Gtk.SelectionMode.SINGLE);
-
-
- this.css = new Gtk.CssProvider();
- try {
- this.css.load_from_data("#leftprops-view { font: 10p; x}");
- } catch (Error e) {}
- this.el.get_style_context().add_provider(this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
-
- }
+ _this = _owner;
+ this.el = new Gtk.GestureClick();
- //listeners
- this.el.button_press_event.connect( ( ev) => {
-
- Gtk.TreeViewColumn col;
- int cell_x;
- int cell_y;
- Gtk.TreePath path;
-
- // event x /y are relative to the widget..
- if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
- GLib.debug("nothing selected on click");
- GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
- this.el.get_selection().unselect_all();
-
- return false;
- });
- _this.before_edit();
- return false; //not on a element.
- }
-
-
- // single click on name..
- //if (ev.type == Gdk.EventType.2BUTTON_PRESS && ev.button == 1 && col.title == "Name") {
- if (ev.button == 1 && col.title == "Property") {
- // need to shift down, as ev.y does not inclucde header apparently..
- // or popover might be trying to do a central?
- this.editPropertyDetails(path, (int) ev.y + 12);
-
- return false;
- }
-
-
+ // 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;
- // right click.
- if (ev.type == Gdk.EventType.BUTTON_PRESS && ev.button == 3) {
- // show popup!.
- //if (col.title == "Value") {
- // _this.before_edit();
- // return false;
- //}
-
- var p = _this.ContextMenu;
-
- p.el.set_screen(Gdk.Screen.get_default());
- p.el.show_all();
- p.el.popup_at_pointer(ev);
- //Seed.print("click:" + res.column.title);
- // select the
- GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
-
- this.el.get_selection().select_path(path);
- return false;
- });
- _this.before_edit();
- return false;
- }
+ }
+ GLib.debug("hit row %d", row);
+ var prop = _this.selmodel.getPropAt(row);
+ _this.selmodel.selectProp(prop);
-
- if (col.title != "Value") {
- GLib.debug("col title != Value");
-
- GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
- this.el.get_selection().select_path(path);
- return false;
- });
+ //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);
- _this.before_edit();
- // XObject.error("column is not value?");
- return false; // ignore.. - key click.. ??? should we do this??
- }
-
-
- // if the cell can be edited with a pulldown
- // then we should return true... - and let the start_editing handle it?
-
-
-
-
-
-
- // _this.before_edit(); <<< we really need to stop the other editor..
- _this.keyrender.el.stop_editing(false);
- _this.keyrender.el.editable =false;
-
-
- return _this.startEditingValue(path); // assumes selected row..
-
-
-
-
- });
- }
+
+ });
+ }
- // user defined functions
- public void editPropertyDetails (Gtk.TreePath path, int y) {
-
-
-
-
- _this.before_edit();
- _this.stop_editor();
-
- _this.keyrender.el.stop_editing(false);
- _this.keyrender.el.editable =false;
-
- _this.valrender.el.stop_editing(false);
- _this.valrender.el.editable =false;
- Gtk.TreeIter iter;
- var mod = this.el.get_model();
- mod.get_iter (out iter, path);
-
-
- GLib.Value gval;
-
- mod.get_value(iter,0, out gval);
-
- this.popover.show(_this.view.el, _this.node, (JsRender.NodeProp)gval, y);
-
-
+ // user defined functions
}
- }
- public class Xcls_model : Object
- {
- public Gtk.TreeStore el;
- private Xcls_LeftProps _this;
+ public class Xcls_GestureClick32 : Object
+ {
+ public Gtk.GestureClick el;
+ private Xcls_LeftProps _this;
- // my vars (def)
- // ctor
- public Xcls_model(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.model = this;
- this.el = new Gtk.TreeStore.newv( { typeof(JsRender.NodeProp), // 0 key type
- typeof(string), // 1 display_key
- typeof(string), // 2 display_value
- typeof(string), // 3 display_tooltip
- typeof(string) // 4 sortable value
-/*
- 0, prop,
- 1, prop.to_display_name(),
- 2, dis_val.
- 3, "<tt>" + GLib.Markup.escape_text(key + " " +kvalue) + "</tt>",
- 4, "0 " + prop.name
-
- );
- */ } );
+ // my vars (def)
- // my vars (dec)
+ // ctor
+ public Xcls_GestureClick32(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.GestureClick();
- // set gobject values
+ // 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
}
- // user defined functions
- }
+ public class Xcls_selmodel : Object
+ {
+ public Gtk.SingleSelection el;
+ private Xcls_LeftProps _this;
- public class Xcls_keycol : Object
- {
- public Gtk.TreeViewColumn el;
- private Xcls_LeftProps _this;
+ // my vars (def)
- // 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 );
- // ctor
- public Xcls_keycol(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.keycol = this;
- this.el = new Gtk.TreeViewColumn();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.can_unselect = true;
+ }
- // set gobject values
- this.el.title = "Property";
- this.el.sizing = Gtk.TreeViewColumnSizing.FIXED;
- this.el.expand = true;
- this.el.resizable = true;
- var child_0 = new Xcls_keyrender( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false );
-
- // init method
-
- this.el.add_attribute(_this.keyrender.el , "markup", 1 ); // 1 is the key.
- //this.el.add_attribute(_this.keyrender.el , "text", 1 );
+ // 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;
- // user defined functions
- }
- public class Xcls_keyrender : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_LeftProps _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_model(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ _this.model = this;
+ this.el = new GLib.ListStore(typeof(JsRender.NodeProp));
- // ctor
- public Xcls_keyrender(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.keyrender = this;
- this.el = new Gtk.CellRendererText();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ }
- // set gobject values
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_keycol : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private Xcls_LeftProps _this;
- public class Xcls_valcol : Object
- {
- public Gtk.TreeViewColumn el;
- private Xcls_LeftProps _this;
+ // my vars (def)
- // 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;
+ }
- // ctor
- public Xcls_valcol(Xcls_LeftProps _owner )
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory36 : Object
{
- _this = _owner;
- _this.valcol = this;
- this.el = new Gtk.TreeViewColumn();
-
- // my vars (dec)
+ public Gtk.SignalListItemFactory el;
+ private Xcls_LeftProps _this;
- // set gobject values
- this.el.title = "Value";
- this.el.sizing = Gtk.TreeViewColumnSizing.FIXED;
- this.el.expand = true;
- this.el.resizable = true;
- var child_0 = new Xcls_valrender( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
- // init method
+ // my vars (def)
+ // ctor
+ public Xcls_SignalListItemFactory36(Xcls_LeftProps _owner )
{
-
-
-
-
- this.el.add_attribute(_this.valrender.el , "text", 2 );
-
+ _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
}
- // user defined functions
- }
- public class Xcls_valrender : Object
- {
- public Gtk.CellRendererCombo el;
- private Xcls_LeftProps _this;
+ public class Xcls_valcol : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private Xcls_LeftProps _this;
- // my vars (def)
- // ctor
- public Xcls_valrender(Xcls_LeftProps _owner )
+ // 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
{
- _this = _owner;
- _this.valrender = this;
- this.el = new Gtk.CellRendererCombo();
+ public Gtk.SignalListItemFactory el;
+ private Xcls_LeftProps _this;
- // my vars (dec)
- // set gobject values
- this.el.editable = false;
- this.el.text_column = 0;
- this.el.has_entry = true;
- var child_0 = new Xcls_valrendermodel( _this );
- child_0.ref();
- this.el.model = child_0.el;
-
- //listeners
- this.el.editing_started.connect( ( editable, path) => {
- //_this.editing = true;
- GLib.debug("editing started called\n");
- if (!_this.allow_edit) {
-
- GLib.debug("val - editing_Started\n");
- this.el.editable = false; // make sure it's not editor...
-
-
- return;
- }
- _this.allow_edit =false;
-
-
- if ( this.el.has_entry ) {
-
- Gtk.TreeIter iter;
- _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
- GLib.Value gval;
-
-
-
- // this.get('/LeftPanel.model').activePath = path;
- _this.model.el.get_value(iter,0, out gval);
+ // 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 prop = (JsRender.NodeProp)gval;
- var combo = (Gtk.ComboBox)editable;
-
- var entry = (Gtk.Entry) combo.get_child();
- entry.set_text(prop.val);
- }
-
- });
- this.el.edited.connect( (path, newtext) => {
- GLib.debug("Valrender - signal:edited\n");
-
- this.el.editable = false;
-
- Gtk.TreeIter iter;
- _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
- GLib.Value gval;
+ 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();
- _this.model.el.get_value(iter,0, out gval);
- var prop = (JsRender.NodeProp)gval;
- prop.val = newtext;
- _this.updateIter(iter,prop);
- _this.changed();
-
- });
- }
-
- // user defined functions
- public void setOptions (string[] ar) {
- var m = _this.valrendermodel.el;
- m.clear();
- Gtk.TreeIter iret;
- for (var i =0; i < ar.length; i++) {
- m.append(out iret);
- m.set_value(iret, 0, ar[i]);
+
+ 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;
+
+
+
+
+
+ });
}
-
- }
- }
- public class Xcls_valrendermodel : Object
- {
- public Gtk.ListStore el;
- private Xcls_LeftProps _this;
+ // user defined functions
+ }
- // my vars (def)
- // ctor
- public Xcls_valrendermodel(Xcls_LeftProps _owner )
+ public class Xcls_ContextMenu : Object
{
- _this = _owner;
- _this.valrendermodel = this;
- this.el = new Gtk.ListStore.newv( { typeof(string) } );
+ public Gtk.Popover el;
+ private Xcls_LeftProps _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
+ // 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;
+ }
- public class Xcls_ContextMenu : Object
- {
- public Gtk.Menu el;
- private Xcls_LeftProps _this;
+ // user defined functions
+ }
+ public class Xcls_Box40 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_LeftProps _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_ContextMenu(Xcls_LeftProps _owner )
- {
- _this = _owner;
- _this.ContextMenu = this;
- this.el = new Gtk.Menu();
+ // ctor
+ public Xcls_Box40(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- var child_0 = new Xcls_MenuItem37( _this );
- child_0.ref();
- this.el.append ( child_0.el );
+ // 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;
- // user defined functions
- }
- public class Xcls_MenuItem37 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_LeftProps _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Button41(Xcls_LeftProps _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // ctor
- public Xcls_MenuItem37(Xcls_LeftProps _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.label = "Delete";
- // set gobject values
- this.el.label = "Delete";
- this.el.show();
+ //listeners
+ this.el.activate.connect( ( ) =>{
+ _this.deleteSelected();
+
+ });
+ }
- //listeners
- this.el.activate.connect( ( ) =>{
- _this.deleteSelected();
- });
+ // user defined functions
}
- // user defined functions
- }
-}
+ }
{
"build_module" : "builder",
+ "gen_extended" : false,
"items" : [
{
"# Xcls_MainWindow main_window" : "null",
"$ xns" : "Gtk",
- "* pack" : "add",
"@ bool before_node_change" : "()",
"@ void changed" : "()",
- "@ void node_selected" : "(JsRender.Node? node, string source)",
+ "@ void node_selected" : "(JsRender.Node? node)",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool hexpand" : true,
+ "bool vexpand" : true,
"id" : "WindowLeftTree",
"items" : [
+ {
+ "$ xns" : "Gtk",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "factory",
+ "xtype" : "SignalListItemFactory"
+ }
+ ],
+ "xtype" : "ListView"
+ },
{
"$ xns" : "Gtk",
"* init" : [
" this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
- " ",
- ""
+ " "
],
- "* pack" : "add",
- "Gtk.ShadowType shadow_type" : "Gtk.ShadowType.IN",
+ "bool has_frame" : true,
+ "bool hexpand" : true,
+ "bool vexpand" : true,
"id" : "viewwin",
"items" : [
{
"# bool blockChanges" : false,
- "# bool drag_in_motion" : "",
- "# int drag_x" : "",
- "# int drag_y" : "",
- "# string dragData" : "",
- "# string[] dropList" : "",
- "$ enable_tree_lines" : true,
"$ string lastEventSource" : "\"\"",
"$ xns" : "Gtk",
"* init" : [
"{",
- " this.css = new Gtk.CssProvider();",
- "\ttry {",
- "\t\tthis.css.load_from_data(\"#left-tree-view { font-size: 10px;}\");",
- "\t} catch (Error e) {}",
- "\tthis.el.get_style_context().add_provider(this.css,",
- "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION);",
- "\t ",
- "\t ",
- " ",
- " var selection = this.el.get_selection();",
- " selection.set_mode( Gtk.SelectionMode.SINGLE);",
- "",
- "",
- " // is this really needed??",
- " /*",
- " this.selection.signal['changed'].connect(function() {",
- "\t _this.get('/LeftTree.view').listeners.cursor_changed.apply(",
- "\t _this.get('/LeftTree.view'), [ _this.get('/LeftTree.view'), '']",
- "\t );",
- " });",
- " */",
- " Gtk.drag_source_set (",
- "\t this.el, /* widget will be drag-able */",
- "\t Gdk.ModifierType.BUTTON1_MASK, /* modifier that will start a drag */",
- "\t BuilderApplication.targetList, /* lists of target to support */",
- "\t Gdk.DragAction.COPY | Gdk.DragAction.MOVE | Gdk.DragAction.LINK /* what to do with data after dropped */",
- " );",
- "",
- " // ?? needed??",
- " //Gtk.drag_source_add_text_targets(this.el); ",
- "",
- " Gtk.drag_dest_set",
- " (",
- " this.el, /* widget that will accept a drop */",
- " Gtk.DestDefaults.MOTION | Gtk.DestDefaults.HIGHLIGHT,",
- " BuilderApplication.targetList, /* lists of target to support */",
- " Gdk.DragAction.COPY | Gdk.DragAction.MOVE | Gdk.DragAction.LINK /* what to do with data after dropped */",
- " );",
+ " ",
+ " this.css = new Gtk.CssProvider();",
+ "//\ttry {",
+ "\t\tthis.css.load_from_string(\"",
+ "#left-tree-view { font-size: 12px;}\t",
+ ".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.drag_dest_set_target_list(this.el, Builder.Application.targetList);",
- " //Gtk.drag_dest_add_text_targets(this.el);",
- " ",
- " ",
- " ",
- " ",
+ "\tGtk.StyleContext.add_provider_for_display(",
+ "\t\tthis.el.get_display(),",
+ "\t\tthis.css,",
+ "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
+ "\t);",
+ "\t",
+ "\t ",
"}",
""
],
- "* pack" : "add",
+ "* prop" : "child",
"Boolean id" : "view",
"Gtk.CssProvider css" : "",
"bool button_is_pressed" : false,
- "bool expand" : true,
"bool headers_visible" : false,
- "bool key_is_pressed" : false,
+ "bool hexpand" : false,
+ "bool vexpand" : true,
"items" : [
{
- "# DialogTemplateSelect template_select" : "null",
- "# string activePath" : "\"\"",
- "$ columns" : [
- "typeof(string),",
- "typeof(string),",
- "typeof(Object),",
- "typeof(Gdk.Pixbuf),",
- "typeof(Gdk.Pixbuf)"
- ],
- "$ listAllTypes" : [
- "function() {",
- " var s = this.get('/LeftTree.view').selection;",
- " print (\"LIST ALL TYPES: \" + s.count_selected_rows() );",
- " ",
- " if (s.count_selected_rows() > 0) {",
- " var iter = new Gtk.TreeIter(); ",
- " s.get_selected(this.el, iter);",
- "",
- " // set some properties of the tree for use by the dropped element.",
- " var value = new GObject.Value('');",
- " this.el.get_value(iter, 2, value);",
- " var data = JSON.parse(value.value);",
- " ",
- " ",
- " var xname = this.get('/LeftTree.model').file.guessName(data);",
- " console.log('selected:' + xname);",
- " if (xname.length) {",
- " return [ xname ];",
- " }",
- " return []; // could not find it..",
- " }",
- " ",
- " var ret = [ ];",
- " ",
- " var _this = this;",
- " function addall(li)",
- " {",
- " li.forEach(function(el) {",
- " // this is specific to roo!!!?",
- " if (!el) { // skip empty?",
- " return;",
- " }",
- " var fullpath = _this.file.guessName(el);",
- " if (fullpath.length && ret.indexOf(fullpath) < 0) {",
- " ret.push(fullpath);",
- " }",
- " ",
- " ",
- " if (el.items && el.items.length) {",
- " addall(el.items);",
- " }",
- " ",
- " });",
- " ",
- " ",
- " }",
- " ",
- " addall([this.currentTree]);",
- " ",
- " // only if we have nothing, should we add '*top'",
- " if (!ret.length) {",
- " ret = [ '*top' ];",
- " }",
- " //console.log('all types in tree');",
- " //console.dump(ret);",
- " ",
- " return ret;",
- " ",
- "}",
- ""
- ],
"$ xns" : "Gtk",
- "* init" : [
- "print(\"model initialized\");",
- "",
- ""
+ "listeners" : {
+ "pressed" : [
+ "(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() ) {",
+ " \tGLib.debug(\"before_node_change return false\");",
+ " return ;",
+ " }",
+ " ",
+ "\t // nothing there -show dialog",
+ " if (_this.model.el.get_n_items() < 1) {",
+ "\t _this.main_window.windowstate.showAddObject(_this.view.el, null);",
+ " GLib.debug(\"no items\");",
+ "\t return ;",
+ " }",
+ " string pos;",
+ " var row = _this.view.getRowAt(x,y, out pos );",
+ " if (row < 0) {",
+ "\t GLib.debug(\"no row selected items\");",
+ "\t return;",
+ " }",
+ " ",
+ " var node = _this.selmodel.getNodeAt(row);",
+ " if (node == null) {",
+ " \tGLib.warning(\"No node found at row %d\", row);",
+ " \treturn;",
+ "\t}",
+ "",
+ " ",
+ " ",
+ " if (_this.view.getColAt(x,y) > 0 ) {",
+ "\t GLib.debug(\"add colum clicked.\");",
+ " var fqn = node.fqn();",
+ " \tvar cn = _this.main_window.windowstate.project.palete.getChildList(fqn, false);",
+ " \t\tif (cn.size < 1) {",
+ " \t\t\treturn ;",
+ "\t\t}",
+ "",
+ "\t\t_this.main_window.windowstate.leftTreeBeforeChange();",
+ "\t\t//_this.view.el.get_selection().select_path(res);",
+ "\t\tGLib.debug(\"Button Pressed - start show window\");",
+ "\t\t_this.main_window.windowstate.showAddObject(_this.view.el, node);",
+ "\t\tGLib.debug(\"Button Pressed - finsihed show window\");",
+ " \treturn ;",
+ "\t}",
+ " ",
+ "\t ",
+ " ",
+ "}",
+ ""
+ ],
+ "released" : [
+ "(n_press, x, y) => {",
+ " ",
+ " _this.view.button_is_pressed = false;",
+ "",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "GestureClick"
+ },
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "pressed" : [
+ "(n_press, x, y) => {",
+ "",
+ "\t",
+ "\t ",
+ "\t ",
+ " if (_this.model.el.get_n_items() < 1) {",
+ " ",
+ " GLib.debug(\"no items\");",
+ "\t return ;",
+ " }",
+ " string pos;",
+ " var row = _this.view.getRowAt(x,y, out pos );",
+ " if (row < 0) {",
+ "\t GLib.debug(\"no row selected items\");",
+ "\t return;",
+ " }",
+ " ",
+ " var node = _this.selmodel.getNodeAt(row);",
+ " if (node == null) {",
+ " \tGLib.warning(\"No node found at row %d\", row);",
+ " \treturn;",
+ "\t}",
+ "\t_this.model.selectNode(node);",
+ " ",
+ " ",
+ " ",
+ "\tGLib.debug(\"Prssed %d\", (int) this.el.get_current_button());",
+ "\t//_this.deletemenu.el.set_parent(_this.view.el);",
+ "\t_this.LeftTreeMenu.el.set_parent(_this.view.el);",
+ "\t",
+ "\t",
+ "\t//Gtk.Allocation rect;",
+ "\t//_this.view.el.get_allocation(out rect);",
+ " \t//_this.deletemenu.el.set_has_arrow(false);",
+ "\t_this.LeftTreeMenu.el.set_position(Gtk.PositionType.BOTTOM); ",
+ "\t",
+ "\t\t",
+ "\t_this.LeftTreeMenu.el.set_offset( ",
+ "\t\t\t(int)x ,",
+ "\t\t\t(int)y - (int)_this.view.el.get_height());",
+ "",
+ " _this.LeftTreeMenu.el.popup();",
+ " ",
+ "}",
+ ""
+ ]
+ },
+ "uint button" : 3,
+ "xtype" : "GestureClick"
+ },
+ {
+ "$ Gdk.DragAction[] actions" : "Gdk.DragAction.COPY | Gdk.DragAction.MOVE ",
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "drag_begin" : [
+ "( drag ) => {",
+ "\tGLib.debug(\"SOURCE: drag-begin\");",
+ "\t ",
+ " // find what is selected in our tree...",
+ " var data = _this.selmodel.getSelectedNode();",
+ "\tif (data == null) {",
+ "\t\treturn ;",
+ "\t}",
+ "\t ",
+ " var xname = data.fqn();",
+ " GLib.debug (\"XNAME IS %s\", xname);",
+ "",
+ " \tvar widget = _this.view.getWidgetAtRow(_this.selmodel.el.selected);",
+ " \t",
+ " \t",
+ " var paintable = new Gtk.WidgetPaintable(widget);",
+ " this.el.set_icon(paintable, 0,0);",
+ " ",
+ " ",
+ "}"
+ ],
+ "prepare" : [
+ "(x, y) => {",
+ "",
+ "\t",
+ "\t",
+ "///\t( drag_context, data, info, time) => {",
+ " ",
+ "",
+ "\t//print(\"drag-data-get\");",
+ " \tvar ndata = _this.selmodel.getSelectedNode();",
+ "\tif (ndata == null) {",
+ "\t \tGLib.debug(\"return empty string - no selection..\");",
+ "\t\treturn null;",
+ "\t ",
+ "\t}",
+ "",
+ " ",
+ "\t//data.set_text(tp,tp.length); ",
+ "",
+ "\tvar \tstr = ndata.toJsonString();",
+ "\tGLib.debug(\"prepare store: %s\", str);",
+ "\tGLib.Value ov = GLib.Value(typeof(string));",
+ "\tov.set_string(str);",
+ " \tvar cont = new Gdk.ContentProvider.for_value(ov);",
+ " /*",
+ "\tGLib.Value v = GLib.Value(typeof(string));",
+ "\t//var str = drop.read_text( [ \"text/plain\" ] 0);",
+ "\t ",
+ "\t\tcont.get_value(ref v);",
+ "\t ",
+ "\t}",
+ "\tGLib.debug(\"set %s\", v.get_string());",
+ " */ ",
+ " \treturn cont;",
+ "\t ",
+ "\t ",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "DragSource"
+ },
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "key_pressed" : [
+ "(keyval, keycode, state) => {",
+ "",
+ " ",
+ "",
+ "\tif (keyval != Gdk.Key.Delete && keyval != Gdk.Key.BackSpace) {",
+ "\t\treturn true;",
+ "\t}",
+ "",
+ "\t_this.model.deleteSelected();",
+ "\treturn true;",
+ "",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "EventControllerKey"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* ctor" : [
+ "new Gtk.DropTarget ( typeof(string) ,",
+ "\t\tGdk.DragAction.COPY | Gdk.DragAction.MOVE )"
],
- "* pack" : "set_model",
- "currentTree" : false,
- "id" : "model",
- "n_columns" : 5,
- "xtype" : "TreeStore",
- "| JsRender.Node pathToNode" : [
- "(string path) {",
- " ",
- " ",
- " Gtk.TreeIter iter;",
- " _this.model.el.get_iter_from_string(out iter, path);",
- " ",
- " GLib.Value value;",
- " _this.model.el.get_value(iter, 2, out value);",
- " ",
- " return (JsRender.Node)value.dup_object();",
- "",
+ "Gtk.Widget? highlightWidget" : "null",
+ "JsRender.Node? lastDragNode" : "null",
+ "id" : "drop",
+ "listeners" : {
+ "accept" : [
+ "(drop) => {",
+ "",
+ "\tGLib.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;",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ "}",
+ "*/",
+ "\treturn true;",
+ "}",
+ ""
+ ],
+ "drop" : [
+ "(v, x, y) => {",
+ "\t",
+ "\tthis.addHighlight(null,\"\");",
+ " ",
+ " ",
+ " ",
+ " \tvar pos = \"\";",
+ " \t// -- get position..",
+ " \tif (this.lastDragString != v.get_string() || this.lastDragNode == null) {",
+ "\t\t// still dragging same node",
+ " ",
+ "\t\tthis.lastDragNode = new JsRender.Node(); ",
+ "\t\tthis.lastDragNode.loadFromJsonString(v.get_string(), 1);",
+ "\t}",
+ " ",
+ " \t ",
+ " ",
+ " var dropNode = new JsRender.Node(); ",
+ "\tdropNode.loadFromJsonString(v.get_string(), 1);",
+ "\tvar 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) {",
+ " \t// FIXME check valid drop types?",
+ " \tif (!drop_on_to.contains(\"*top\")) {",
+ "\t\t\tGLib.debug(\"drop on to list does not contain top?\");",
+ "\t\t\treturn false;\t",
+ "\t\t}",
+ "\t\t// add new node to top..",
+ "\t\t",
+ "\t\t",
+ "\t\t var m = (GLib.ListStore) _this.model.el.model;",
+ " \t_this.main_window.windowstate.file.tree = dropNode; ",
+ " ",
+ " ",
+ "\t\tm.append(dropNode);",
+ "\t\t_this.model.selectNode(dropNode); \t",
+ "\t\t_this.changed();",
+ "\t\treturn true; // no need to highlight?",
+ " ",
+ " }",
+ "",
+ "",
+ "",
+ "\tvar row = _this.view.getRowAt(x,y, out pos);",
+ "\tif (row < 0) {",
+ "\t\treturn false; //Gdk.DragAction.COPY;",
+ "\t}",
+ "\tvar tr = (Gtk.TreeListRow)_this.view.el.model.get_object(row);",
+ "\t",
+ "\tvar node = (JsRender.Node)tr.get_item();",
+ "",
+ " \tif (pos == \"above\" || pos == \"below\") {",
+ "\t\tif (node.parent == null) {",
+ "\t\t\tpos = \"over\";",
+ "\t\t} else {",
+ "\t \t\tif (!drop_on_to.contains(node.parent.fqn())) {",
+ "\t\t\t\tpos = \"over\";",
+ " \t\t\t} else {",
+ "\t\t\t\tGLib.debug(\"drop contains %s - using %s\" , node.parent.fqn(), pos);",
+ "\t\t\t}",
+ " \t\t}",
+ " \t\t",
+ " \t}",
+ " \tif (pos == \"over\") {",
+ "\t \tif (!drop_on_to.contains(node.fqn())) {",
+ "\t\t\tGLib.debug(\"drop on does not contain %s - try center\" , node.fqn());",
+ "\t\t\treturn false;",
+ "",
+ "\t\t}",
+ "\t}",
+ " \t",
+ " \tswitch(pos) {",
+ " \t\tcase \"over\":",
+ "\t \t\tnode.appendChild(dropNode);",
+ " \t\t\t_this.model.selectNode(dropNode); ",
+ " \t\t\t_this.changed();\t\t\t\t \t\t",
+ "\t \t\treturn true;",
+ "\t \t\t",
+ " \t\tcase \"above\":",
+ " \t\t\tGLib.debug(\"Above - insertBefore\");",
+ " \t\t",
+ " \t\t\tnode.parent.insertBefore(dropNode, node);",
+ " \t\t\t_this.model.selectNode(dropNode); \t\t\t",
+ " \t\t\t_this.changed();",
+ " \t\t\treturn true;",
+ " \t\t\t",
+ " \t\tcase \"below\":",
+ " \t\t\tGLib.debug(\"Below - insertAfter\"); \t\t",
+ " \t\t\tnode.parent.insertAfter(dropNode, node);",
+ " \t\t\t_this.model.selectNode(dropNode);\t",
+ " \t\t\t_this.changed();",
+ " \t\t\t// select it",
+ " \t\t\treturn true;",
+ " \t\t\t",
+ " \t\tdefault:",
+ " \t\t\t// should not happen",
+ " \t\t\treturn false;",
+ " \t}",
+ " \t",
+ "\t",
+ " ",
+ "\t\t",
+ "\t\t",
+ "",
+ "}",
+ " "
+ ],
+ "leave" : [
+ "( ) => {",
+ "\tthis.addHighlight(null,\"\");",
+ "",
+ "}",
+ ""
+ ],
+ "motion" : [
+ "( x, y) => {",
+ " ",
+ "\tstring pos; // over / before / after..",
+ "",
+ " GLib.debug(\"got drag motion\");",
+ "",
+ " GLib.Value v = GLib.Value(typeof(string));",
+ " \t//var str = drop.read_text( [ \"text/plain\" ] 0);",
+ " \tvar cont = this.el.current_drop.get_drag().content ;",
+ " \ttry {",
+ " \t\tcont.get_value(ref v);",
+ "\t} catch (GLib.Error e) {",
+ "\t GLib.debug(\"failed to get drag value\");",
+ "\t\treturn Gdk.DragAction.COPY;\t ",
+ "\t",
+ "\t}",
+ "",
+ "\tGLib.debug(\"got %s\", v.get_string());",
+ "\t ",
+ "\tif (this.lastDragString != v.get_string() || this.lastDragNode == null) {",
+ "\t\t// still dragging same node",
+ " ",
+ "\t\tthis.lastDragNode = new JsRender.Node(); ",
+ "\t\tthis.lastDragNode.loadFromJsonString(v.get_string(), 1);",
+ "\t}",
+ " ",
+ "",
+ "\tvar drop_on_to = _this.main_window.windowstate.file.palete().getDropList(",
+ "\t\t\t\tthis.lastDragNode.fqn());",
+ " ",
+ " string[] str = {};",
+ " foreach(var dp in drop_on_to) {",
+ " \tstr += dp;",
+ " \t}",
+ " \tGLib.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) {",
+ " \t// FIXME check valid drop types?",
+ " \tif (drop_on_to.contains(\"*top\")) {",
+ "\t\t\tthis.addHighlight(_this.view.el, \"over\");",
+ "\t\t} else {",
+ "\t\t\tthis.addHighlight(null, \"\");\t\t",
+ "\t\t}",
+ "",
+ "\t\treturn Gdk.DragAction.COPY; // no need to highlight?",
+ " ",
+ " }",
+ " ",
+ " ",
+ " \tGLib.debug(\"check is over\");",
+ " \t ",
+ " // if path of source and dest are inside each other..",
+ " // need to add source info to drag?",
+ " // the fail();",
+ " \tvar row = _this.view.getRowAt(x,y, out pos);",
+ " \t",
+ " \tif (row < 0) {",
+ "\t\tthis.addHighlight(null, \"\");\t",
+ "\t \treturn Gdk.DragAction.COPY;",
+ " \t}",
+ "\tvar tr = (Gtk.TreeListRow)_this.view.el.model.get_object(row);",
+ "\t",
+ "\tvar node = (JsRender.Node)tr.get_item();",
+ "\t",
+ "\tGLib.debug(\"Drop over node: %s\", node.fqn());",
+ "\t",
+ "",
+ " \tif (pos == \"above\" || pos == \"below\") {",
+ "\t\tif (node.parent == null) {",
+ "\t\t\tGLib.debug(\"no parent try center\");",
+ "\t\t\tpos = \"over\";",
+ "\t\t} else {",
+ "\t \t\t ",
+ "\t \t\tif (!drop_on_to.contains(node.parent.fqn())) {",
+ "\t\t\t\tGLib.debug(\"drop on does not contain %s - try center\" , node.parent.fqn());",
+ "\t \t\t\tpos = \"over\";",
+ " \t\t\t} else {",
+ "\t\t\t\tGLib.debug(\"drop contains %s - using %s\" , node.parent.fqn(), pos);",
+ "\t\t\t}",
+ " \t\t}",
+ " \t\t",
+ " \t}",
+ " \tif (pos == \"over\") {",
+ "\t \tif (!drop_on_to.contains(node.fqn())) {",
+ "\t\t\tGLib.debug(\"drop on does not contain %s - try center\" , node.fqn());",
+ "\t\t\tthis.addHighlight(null, \"\"); ",
+ "\t\t\treturn Gdk.DragAction.COPY;\t\t",
+ "\t\t}",
+ "\t}",
+ " \t",
+ " \t",
+ " \t // _this.view.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);",
+ "\tvar w = _this.view.getWidgetAt(x,y);",
+ "\tthis.addHighlight(w, pos); ",
+ " return Gdk.DragAction.COPY;\t\t\t",
+ "}"
+ ]
+ },
+ "string lastDragString" : "\"\"",
+ "xtype" : "DropTarget",
+ "| void addHighlight" : [
+ "(Gtk.Widget? w, string hl) {",
+ "\tif (this.highlightWidget != null) {",
+ "\t\tvar ww = this.highlightWidget;",
+ "\t\tGLib.debug(\"clear drag from previous highlight\");",
+ "\t\tif (ww.has_css_class(\"drag-below\")) {",
+ "\t\t\t ww.remove_css_class(\"drag-below\");",
+ "\t\t}",
+ "\t\tif (ww.has_css_class(\"drag-above\")) {",
+ "\t\t\t ww.remove_css_class(\"drag-above\");",
+ "\t\t}",
+ "\t\tif (ww.has_css_class(\"drag-over\")) {",
+ "\t\t\t ww.remove_css_class(\"drag-over\");",
+ "\t\t}",
+ "\t}",
+ "\tif (w != null) {",
+ "\t\tGLib.debug(\"add drag=%s to widget\", hl);\t",
+ "\t\tif (!w.has_css_class(\"drag-\" + hl)) {",
+ "\t\t\tw.add_css_class(\"drag-\" + hl);",
+ "\t\t}",
+ "\t}",
+ "\tthis.highlightWidget = w;",
"}"
+ ]
+ },
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "model",
+ "id" : "selmodel",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* ctor" : "this.updateModel(null)",
+ "* prop" : "model",
+ "id" : "model",
+ "xtype" : "TreeListModel",
+ "| Gtk.TreeListModel updateModel" : [
+ "(GLib.ListStore? m) {",
+ "\tthis.el = new Gtk.TreeListModel(",
+ "\t\tm != null ? m : new GLib.ListStore(typeof(JsRender.Node)), //..... << that's our store..",
+ "\t\tfalse, // passthru",
+ "\t\ttrue, // autexpand",
+ "\t\t(item) => {",
+ "\t\t\treturn ((JsRender.Node)item).childstore;",
+ "\t\t",
+ "\t\t}",
+ "\t);",
+ "\t_this.selmodel.el.set_model(this.el);",
+ "\treturn this.el;",
+ "}"
+ ],
+ "| void deleteSelected" : [
+ "() {",
+ "",
+ "",
+ "\t",
+ "\tvar node = _this.selmodel.getSelectedNode();",
+ "\t",
+ "",
+ " if (node == null) {",
+ " \tGLib.debug(\"delete Selected - no node slected?\");",
+ "\t return;",
+ " }",
+ " _this.selmodel.el.unselect_all();",
+ " ",
+ " node.remove();",
+ " \tGLib.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;",
+ " */",
+ "}",
+ ""
+ ],
+ "| void loadFile" : [
+ "(JsRender.JsRender f) {",
+ " //console.dump(f);",
+ " ",
+ " _this.drop.highlightWidget = null;",
+ " ",
+ " var m = (GLib.ListStore) this.el.model;",
+ "\tm.remove_all();",
+ " _this.main_window.windowstate.leftTreeNodeSelected(null);",
+ " // needed???",
+ " _this.main_window.windowstate.file = f;",
+ " ",
+ " ",
+ " if (f.tree == null) {",
+ "\t try {",
+ "\t f.loadItems( );",
+ " } catch (Error e) {",
+ " \t\treturn;",
+ " }",
+ " }",
+ " // if it's still null?",
+ " if (f.tree == null) {",
+ "\t\t_this.main_window.windowstate.showAddObject(_this.view.el, null);",
+ " ",
+ " return;",
+ " }",
+ " \tm.append(f.tree);",
+ " \t// 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;",
+ " ",
+ " ",
+ "}",
+ ""
+ ],
+ "| void selectNode" : [
+ "(JsRender.Node node) ",
+ "{",
+ "\tvar row = -1;",
+ "\tvar s = (Gtk.SingleSelection)_this.view.el.model;",
+ "\tfor (var i = 0; i < s.n_items; i++) {",
+ "\t\t//GLib.debug(\"check node %s\", s.get_item(i).get_type().name());",
+ "\t\tvar lr = (Gtk.TreeListRow)s.get_item(i);",
+ "\t\tGLib.debug(\"check node %s\", lr.get_item().get_type().name());",
+ "\t\tif (((JsRender.Node)lr.get_item()).oid == node.oid) {",
+ "\t\t\trow = i;",
+ "\t\t\tbreak;",
+ "\t\t}",
+ "\t}",
+ "\tif (row < 0) {",
+ "\t\t// select none?",
+ "\t\tGLib.debug(\"Could not find node\");",
+ "\t\treturn;",
+ "\t}",
+ "\tGLib.debug(\"Select %d\", row);",
+ "\ts.set_selected(row);",
+ "\t_this.node_selected(node);\t\t\t",
+ "\t",
+ "",
+ "}"
+ ]
+ }
],
- "| string findDropNode" : [
- " (string treepath_str, string[] targets) {",
- "",
- " // this is used by the dragdrop code in the roo version AFAIR..",
- "",
- " //var path = treepath_str.replace(/^builder-/, '');",
- " // treemap is depreciated... - should really check if model has any entries..",
- "",
- " if (this.el.iter_n_children(null) < 1) {",
- " //print(\"NO KEYS\");",
- " return \"|%d\".printf((int)Gtk.TreeViewDropPosition.INTO_OR_AFTER);",
- " }",
- " //print(\"FIND treepath: \" + path);",
- " //console.dump(this.treemap);",
- " ",
- " //if (!treepath_str.match(/^builder-/)) {",
- " // return []; // nothing!",
- " //}",
- " if (targets.length > 0 && targets[0] == \"*\") {",
- " return treepath_str;",
- " }",
- " return this.findDropNodeByPath(treepath_str,targets, -1);",
- "}",
- ""
- ],
- "| string findDropNodeByPath" : [
- " (string treepath_str, string[] targets, int in_pref = -1) {",
- "",
- " var path = treepath_str; // dupe it..",
- " ",
- " ",
- " // pref : 3 = ontop - 0 = after, 1 = before",
- " int pref = in_pref < 0 ? (int)Gtk.TreeViewDropPosition.INTO_OR_AFTER : in_pref;",
- " ",
- " var last = \"\";",
- " ",
- " //console.dump(this.treemap);",
- " ",
- " print(\"findDropNodeByPath : got path length %d / %s\\n\", path.length, path);",
- " ",
- " if (path.length == 0) {",
- " // top drop. // just return empty..",
- " return \"|%d\".printf((int)pref) ;",
- " ",
- " }",
- " ",
- " ",
- " while (path.length > 0) {",
- " ",
- " if (path.length == treepath_str.length && pref != Gtk.TreeViewDropPosition.INTO_OR_AFTER) {",
- " if (path.last_index_of(\":\") < 0 ) {",
- " return \"\";",
- " }",
- " path = path.substring(0, path.last_index_of(\":\"));",
- " last = treepath_str;",
- " print(\"DROP before or after : using %s\\n\",path);",
- " continue;",
- " }",
- " ",
- " //print(\"LOOKING FOR PATH: \" + path);",
- " var node_data = this.pathToNode(path);",
- " ",
- " if (node_data == null) {",
- " print(\"node not found\");",
- " return \"\";",
- " }",
- " ",
- " var xname = node_data.fqn();",
- " var match = \"\";",
- " var prop = \"\";",
- " ",
- " for (var i =0; i < targets.length; i++) {",
- " var tg = targets[i];",
- " if ((tg == xname) ) {",
- " match = tg;",
- " break;",
- " }",
- " // if target is \"xxxx:name\"",
- " if (tg.contains(xname +\":\")) {",
- " match = tg;",
- " var ar = tg.split(\":\");",
- " prop = ar[1];",
- " break;",
- " }",
- " }",
- " ",
- " if (match.length > 0) {",
- " if (last.length > 0) { // pref is after/before..",
- " // then it's after last",
- " //if (pref > 1) {",
- " // return \"\";",
- " //}",
- " return last + \"|%d\".printf((int)pref) + \"|\" + prop;",
- "",
- " ",
- " }",
- " // we need to add prop - as :store -> needs to bee added when dropping onto.",
- " return path + \"|%d\".printf( (int) Gtk.TreeViewDropPosition.INTO_OR_AFTER) + \"|\" + prop;",
- " }",
- " /*",
- " last = \"\" + path;",
- " var par = path.split(\":\");",
- " string [] ppar = {};",
- " for (var i = 0; i < par.length-1; i++) {",
- " ppar += par[i];",
- " }",
- " ",
- " path = string.joinv(\":\", ppar);",
- " */",
- " break;",
- "",
- " }",
- " ",
- " return \"\";",
- " ",
- "}",
- ""
- ],
- "| string treePathFromNode" : [
- "(JsRender.Node node) {",
- " // iterate through the tree and find the node",
- " var ret = \"\";",
- " ",
- " this.el.foreach((mod, pth, iter) => {",
- " // get the node..",
- " ",
- " ",
- " GLib.Value value;",
- " _this.model.el.get_value(iter, 2, out value);",
- " ",
- "",
- " ",
- " var n = (JsRender.Node)value;",
- "",
- " print(\"compare %s to %s\\n\", n.fqn(), node.fqn());",
- " if (node == n) {",
- " ret = pth.to_string();",
- " return true;",
- " }",
- " return false;",
- " });",
- " return ret;",
- "",
- "}",
- ""
- ],
- "| void deleteSelected" : [
- "() {",
- " ",
- " 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;",
- "}",
- ""
- ],
- "| void dropNode" : [
- "(string target_data_str, JsRender.Node node, bool show_templates) {",
- "// print(\"drop Node\");",
- " // console.dump(node);",
- " // console.dump(target_data);",
- " ",
- " \t\t//target_data_str",
- " \t\t// {parent}|{pos}|{prop}",
- " ",
- " ",
- " // 0 = before , 1=after 2/3 onto",
- " ",
- " \t\tGLib.debug(\"dropNode %s\", target_data_str);",
- " ",
- " var target_data= target_data_str.split(\"|\");",
- " ",
- " var parent_str = target_data[0].length > 0 ? target_data[0] : \"\";",
- " var pos = target_data.length > 1 ? int.parse(target_data[1]) : 2; // ontop..",
- " ",
- " ",
- " Gtk.TreePath tree_path = parent_str.length > 0 ? new Gtk.TreePath.from_string( parent_str ) : null;",
- " ",
- " ",
- " ",
- " //print(\"add \" + tp + \"@\" + target_data[1] );",
- " ",
- " JsRender.Node parentNode = null;",
- " ",
- " Gtk.TreeIter iter_after;",
- " Gtk.TreeIter iter_par ;",
- " ",
- " \t// this appears to be done in drag_ddata_recieved as well.",
- " if (target_data.length == 3 && target_data[2].length > 0) {",
- "\t node.set_prop(new JsRender.NodeProp.special(\"prop\", target_data[2]));",
- "",
- " }",
- "",
- " Gtk.TreePath expand_parent = null;",
- " ",
- " // we only need to show the template if it's come from else where?",
- " if (show_templates) {",
- " ",
- " var ts = _this.main_window.windowstate.template_select;",
- " ",
- " var new_node = ts.show(",
- " _this.main_window, // (Gtk.Window) _this.el.get_toplevel (),",
- " _this.main_window.windowstate.file.palete(),",
- " node,",
- " _this.main_window.windowstate.project);",
- " ",
- " if (new_node == null) {",
- " return; // do not add?",
- " }",
- " node = new_node;",
- " } ",
- " ",
- " //print(\"pos is %d \\n\".printf(pos));",
- " ",
- " Gtk.TreeIter n_iter; ",
- " ",
- " if ( parent_str.length < 1) {",
- " this.el.append(out n_iter, null); // drop at top level..",
- " node.parent = null;",
- " _this.main_window.windowstate.file.tree = node;",
- " ",
- " ",
- " } else if (pos < 2) {",
- " //print(target_data[1] > 0 ? 'insert_after' : 'insert_before');",
- " ",
- " this.el.get_iter(out iter_after, tree_path ); ",
- " this.el.iter_parent(out iter_par, iter_after);",
- " expand_parent = this.el.get_path(iter_par);",
- " ",
- " ",
- " // not sure why all the 'dup_object()' stuff? did it crash before?",
- " GLib.Value value;",
- " this.el.get_value( iter_par, 2, out value);",
- " parentNode = (JsRender.Node)value.dup_object();",
- " ",
- " ",
- " this.el.get_value( iter_after, 2, out value);",
- " var relNode = (JsRender.Node)value.dup_object();",
- " ",
- " if ( pos > 0 ) {",
- " ",
- " this.el.insert_after(out n_iter, iter_par , iter_after);",
- " var ix = parentNode.items.index_of(relNode);",
- " parentNode.items.insert(ix+1, node);",
- " ",
- " } else {",
- " this.el.insert_before(out n_iter, iter_par , iter_after);",
- " var ix = parentNode.items.index_of(relNode);",
- " parentNode.items.insert(ix, node);",
- " ",
- " }",
- " node.parent = parentNode;",
- " ",
- " ",
- " ",
- " } else {",
- " // print(\"appending to \" + parent_str);",
- " this.el.get_iter(out iter_par, tree_path);",
- " this.el.append(out n_iter, iter_par );",
- " expand_parent = this.el.get_path(iter_par);",
- " ",
- " GLib.Value value;",
- " this.el.get_value( iter_par, 2, out value);",
- " parentNode = (JsRender.Node)value.dup_object();",
- " node.parent = parentNode;",
- " parentNode.items.add(node);",
- " }",
- " ",
- " ",
- " ",
- " ",
- " // work out what kind of packing to use.. -- should be in ",
- " ",
- " ",
- " //_this.main_window.windowstate.file.palete().fillPack(node,parentNode);",
- " _this.main_window.windowstate.file.palete().on_child_added(parentNode,node);",
- " ",
- " ",
- " this.iterSetValues(n_iter, node);",
- " // add the node...",
- " ",
- " ",
- " ",
- "\t\t// load children - if it has any..",
- " ",
- " if (node.items.size > 0) {",
- " this.load(node.items, n_iter);",
- " _this.view.el.expand_row(this.el.get_path(n_iter), true);",
- " } else if (expand_parent != null && !_this.view.el.is_row_expanded(expand_parent)) {",
- " _this.view.el.expand_row(expand_parent,true);",
- " }",
- "",
- " //if (tp != null && (node.items.length() > 0 || pos > 1)) {",
- " // _this.view.el.expand_row(this.el.get_path(iter_par), true);",
- " // }",
- " // wee need to get the empty proptypes from somewhere..",
- " ",
- " //var olditer = this.activeIter;",
- " this.activePath = this.el.get_path(n_iter).to_string();",
- "",
- "",
- " // pretend button was pressed, so that we can trigger select node...",
- " _this.view.button_is_pressed = true;",
- " _this.view.lastEventSource = \"\";",
- " _this.view.el.set_cursor(this.el.get_path(n_iter), null, false);",
- " _this.view.button_is_pressed = false;",
- " _this.changed();",
- " ",
- " ",
- " ",
- "}",
- ""
- ],
- "| void iterSetValues" : [
- "(Gtk.TreeIter iter, JsRender.Node node) {",
- "\tvar ic = Gtk.IconTheme.get_default();",
- " Gdk.Pixbuf pix = null,addi = null;",
- " ",
- " var o = GLib.Value(typeof(Object));",
- " o.set_object((Object)node);",
- " 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 { ",
- "\t\taddi = ic.load_icon(\"list-add\", 16,0);",
- "\t\tif (FileUtils.test (fn, FileTest.IS_REGULAR)) {",
- "\t\t\t",
- "\t\t \tpix = new Gdk.Pixbuf.from_file (fn);",
- "\t\t\t",
- "\t\t} else {",
- "\t\t \tpix = ic.load_icon(\"emblem-new\", 16,0);",
- "\t \t}",
- " \t} catch (GLib.Error e) {}",
- " ",
- " var fqn = node.fqn();",
- " var cn = _this.main_window.windowstate.project.palete.getChildList(fqn);",
- " ",
- " this.el.set(",
- " \t\titer, ",
- " \t\t0, node.nodeTitle(),",
- " 1, node.nodeTip(), ",
- " -1",
- " );",
- " this.el.set_value(iter, 2,o);",
- " this.el.set_value(iter, 3,pix); ",
- " \tthis.el.set_value(iter, 4, cn.length > 0 ? addi : null); ",
- " ",
+ "listeners" : {
+ "selection_changed" : [
+ "(position, n_items) => {",
+ "",
+ "\t",
+ "\t\t",
+ "\t\t//if (!this.button_is_pressed && !this.key_is_pressed) {",
+ "\t\t\t// then event was started by some other action",
+ "\t\t\t// which should manually trigger all the events..",
+ "\t\t//\tprint(\"SKIPPING select - no button or key pressed\\n\");",
+ "\t\t//\treturn;",
+ "\t\t//}",
+ "",
+ "",
+ "\t\t if (_this.view.blockChanges) { // probably not needed.. ",
+ "\t\t\tGLib.debug(\"SKIPPING select - blockchanges set..\"); ",
+ "\t\t return ;",
+ "\t\t }",
+ "",
+ "\t\t if (!_this.before_node_change( ) ) {",
+ "\t\t\t _this.view.blockChanges = true;",
+ "\t\t\t _this.selmodel.el.unselect_all();",
+ "\t\t\t _this.view.blockChanges = false;",
+ "\t\t\t ",
+ "\t\t\t return;",
+ "\t\t }",
+ "\t\t if (_this.main_window.windowstate.file == null) {",
+ "\t \t\tGLib.debug(\"SKIPPING select windowstate file is not set...\"); ",
+ "\t\t\treturn;",
+ "\t\t } ",
+ "\t\t ",
+ "\t\t //var render = this.get('/LeftTree').getRenderer(); ",
+ "\t\tGLib.debug(\"LEFT TREE -> view -> selection changed called\");",
+ "\t\t",
+ "\t\t",
+ "\t\t// -- it appears that the selection is not updated.",
+ "\t\t // select the node...",
+ "\t\t //_this.selmodel.el.set_selected(row);",
+ " ",
+ "\t\t GLib.debug(\"LEFT TREE -> view -> selection changed TIMEOUT CALLED\");",
+ "",
+ "\t var snode = _this.selmodel.getSelectedNode();",
+ "\t if (snode == null) {",
+ "",
+ "\t GLib.debug(\"selected rows < 1\");",
+ "\t //??this.model.load( false);",
+ "\t _this.node_selected(null);",
+ "\t ",
+ "\t return ;",
+ "\t }",
+ "\t ",
+ "\t // why dup_?",
+ "\t ",
+ "",
+ "\t GLib.debug (\"calling left_tree.node_selected\");",
+ "\t _this.node_selected(snode);",
+ "\t ",
+ "\t ",
+ "\t ",
+ "\t ",
+ "\t // no need to scroll. it's in the view as we clicked on it.",
+ "\t // _this.view.el.scroll_to_cell(new Gtk.TreePath.from_string(_this.model.activePath), null, true, 0.1f,0.0f);",
+ "\t ",
+ "\t return ;",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "SingleSelection",
+ "| JsRender.Node getNodeAt" : [
+ "(uint row) {",
"",
- "}"
- ],
- "| void load" : [
- "(Gee.ArrayList<JsRender.Node> tr, Gtk.TreeIter? iter) ",
- "{",
- " ",
+ " var tr = (Gtk.TreeListRow)this.el.get_item(row);",
+ " ",
+ " var a = tr.get_item();; ",
+ " GLib.debug(\"get_item (2) = %s\", a.get_type().name());",
" \t",
- " Gtk.TreeIter citer;",
- " //this.insert(citer,iter,0);",
" ",
- " ",
- " for(var i =0 ; i < tr.size; i++) {",
- " if (iter != null) {",
- " this.el.insert(out citer,iter,-1); // why not append?",
- " } else {",
- " this.el.append(out citer,null);",
- " }",
- " this.iterSetValues(citer, tr.get(i));",
- " ",
- " ",
- " ",
- " if (tr.get(i).items.size > 0) {",
- " this.load(tr.get(i).items, citer);",
- " }",
- " ",
- " }",
- "",
- " ",
+ " return (JsRender.Node)tr.get_item();",
+ "\t ",
"}"
],
- "| void loadFile" : [
- "(JsRender.JsRender f) {",
- " //console.dump(f);",
- " this.el.clear();",
- " _this.main_window.windowstate.leftTreeNodeSelected(null, \"\");",
- " // needed???",
- " _this.main_window.windowstate.file = f;",
- " ",
- " ",
- " if (f.tree == null) {",
- "\t try {",
- "\t f.loadItems( );",
- " } catch (Error e) {",
- " \t\treturn;",
- " }",
- " }",
- " // if it's still null?",
- " if (f.tree == null) {",
- "\t\t_this.main_window.windowstate.showAddObject(_this.view.el);",
- " ",
- " return;",
- " }",
- " ",
- " var o = new Gee.ArrayList<JsRender.Node>();",
- " o.add(f.tree);",
- " this.load(o,null);",
- " ",
- " _this.view.el.expand_all();",
- "",
- " if (f.tree.items.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);",
- " }",
- " ",
- " ",
- " while (Gtk.events_pending()) {",
- " Gtk.main_iteration();",
- " }",
- "",
- " _this.maincol.el.set_max_width(_this.viewwin.el.get_allocated_width() - 32);",
- " ",
- " ",
- " ",
- " return;",
- " ",
- " ",
- "}",
- ""
- ],
- "| void moveNode" : [
- "(string target_data, Gdk.DragAction action) ",
- "{",
- " ",
- " /// target_data = \"path|pos\");",
- " ",
- " ",
- " //print(\"MOVE NODE\");",
- " // console.dump(target_data);",
- " Gtk.TreeIter old_iter;",
- " Gtk.TreeModel mod;",
- " ",
- " var s = _this.view.el.get_selection();",
- " s.get_selected(out mod , out old_iter);",
- " mod.get_path(old_iter);",
- " ",
- " var node = this.pathToNode(mod.get_path(old_iter).to_string());",
- " //console.dump(node);",
- " if (node == null) {",
- " GLib.debug(\"moveNode: ERROR - node is null?\");",
- " }",
- " ",
- " ",
- "",
- " // needs to drop first, otherwise the target_data ",
- " // treepath will be invalid.",
- "",
- " ",
- " if ((action & Gdk.DragAction.MOVE) > 0) {",
- " GLib.debug(\"REMOVING OLD NODE : \" + target_data + \"\\n\");",
- " node.remove();",
- " this.dropNode(target_data, node, false);",
- " this.el.remove(ref old_iter);",
- " ",
- " ",
- " ",
- " } else {",
- " GLib.debug(\"DROPPING NODE // copy: \" + target_data + \"\\n\");",
- " node = node.deepClone();",
- " this.dropNode(target_data, node, false);",
- " }",
- " _this.changed();",
- " this.activePath= \"\";",
- " //this.updateNode(false,true);",
- "}",
- ""
- ],
- "| void updateSelected" : [
+ "| JsRender.Node? getSelectedNode" : [
"() {",
- " ",
- " ",
- " var s = _this.view.el.get_selection();",
- " ",
- " Gtk.TreeIter iter;",
- " Gtk.TreeModel mod;",
- " ",
- " ",
- " ",
- " if (!s.get_selected(out mod, out iter)) {",
- " return; // nothing seleted..",
- " }",
- " ",
- " GLib.Value value;",
- " this.el.get_value(iter, 2, out value);",
- " var node = (JsRender.Node)(value.get_object());",
- " ",
- " this.el.set(iter, 0, node.nodeTitle(),",
- " 1, node.nodeTip(), -1",
- " );",
- "}",
- ""
+ " if (this.el.selected_item == null) {",
+ "\t\treturn null;",
+ " }\t\t\t ",
+ " var tr = (Gtk.TreeListRow)this.el.selected_item;",
+ " return (JsRender.Node)tr.get_item();",
+ "\t ",
+ "}"
]
},
{
- "$ Gtk.TreeViewColumnSizing sizing" : "Gtk.TreeViewColumnSizing.FIXED",
"$ xns" : "Gtk",
- "* init" : [
- " this.el.add_attribute(_this.renderer.el , \"markup\", 0 );",
- " this.el.add_attribute(_this.iconrender.el , \"pixbuf\", 3 );",
- " "
- ],
"* pack" : "append_column",
"bool expand" : true,
"bool resizable" : true,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false",
- "id" : "iconrender",
- "int width" : 16,
- "xtype" : "CellRendererPixbuf"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "renderer",
- "xtype" : "CellRendererText"
+ "* prop" : "factory",
+ "listeners" : {
+ "bind" : [
+ "(listitem) => {",
+ "\t GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
+ "\t",
+ "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
+ "\tvar expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
+ "\t ",
+ "\t ",
+ "\tvar hbox = (Gtk.Box) expand.child;",
+ " ",
+ "\t",
+ "\tvar img = (Gtk.Image) hbox.get_first_child();",
+ "\tvar lbl = (Gtk.Label) img.get_next_sibling();",
+ "\t",
+ "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
+ "\tvar node = (JsRender.Node) lr.get_item();",
+ "\t",
+ " GLib.debug(\"node is %s\", node.get_type().name());",
+ "// was item (1) in old layout",
+ "",
+ "\t",
+ " ",
+ " \t /* ",
+ " \tvar 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 { ",
+ " \t ",
+ " \t\t ",
+ "\t\tif (FileUtils.test (fn, FileTest.IS_REGULAR)) {",
+ "\t\t img.set_from_file(fn);",
+ "\t\t \t ",
+ "\t \t} else {",
+ "\t \t\timg.set_from_paintable(",
+ "\t\t\t \tic.lookup_icon (",
+ "\t\t\t \t\t\"media-playback-stop\", null, 16,1, ",
+ "\t \t\t\t Gtk.TextDirection.NONE, 0",
+ " \t\t\t)",
+ "\t\t\t );",
+ "\t \t}",
+ " \t} catch (GLib.Error e) {}",
+ " */",
+ " expand.set_hide_expander( !node.hasChildren() );",
+ " \texpand.set_list_row(lr);",
+ " \t",
+ " \tnode.bind_property(\"iconFilename\",",
+ " img, \"file\",",
+ " GLib.BindingFlags.SYNC_CREATE);",
+ " \t",
+ " \tnode.bind_property(\"nodeTitleProp\",",
+ " lbl, \"label\",",
+ " GLib.BindingFlags.SYNC_CREATE);",
+ " \tnode.bind_property(\"nodeTipProp\",",
+ " lbl, \"tooltip_markup\",",
+ " GLib.BindingFlags.SYNC_CREATE);",
+ " \t// bind image...",
+ " \t",
+ "}",
+ ""
+ ],
+ "setup" : [
+ "(listitem) => {",
+ "\t",
+ "\tvar expand = new Gtk.TreeExpander();",
+ "\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();",
+ "\tvar lbl = new Gtk.Label(\"\");",
+ "\tlbl.use_markup = true;",
+ "\tlbl.ellipsize = Pango.EllipsizeMode.END;",
+ "\t",
+ "\ticon.margin_end = 4;",
+ " \tlbl.justify = Gtk.Justification.LEFT;",
+ " \tlbl.xalign = 0;",
+ "",
+ "//\tlistitem.activatable = true; ??",
+ "\t",
+ "\thbox.append(icon);",
+ "\thbox.append(lbl);",
+ "\texpand.set_child(hbox);",
+ "\t((Gtk.ListItem)listitem).set_child(expand);",
+ "\t",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "SignalListItemFactory"
}
],
- "utf8 title" : "Node",
- "xtype" : "TreeViewColumn"
+ "title" : "Property",
+ "xtype" : "ColumnViewColumn"
},
{
- "$ Gtk.TreeViewColumnSizing sizing" : "Gtk.TreeViewColumnSizing.FIXED",
"$ xns" : "Gtk",
- "* init" : [
- " this.el.add_attribute(_this.addiconrender.el , \"pixbuf\", 4 );",
- " "
- ],
"* pack" : "append_column",
- "bool expand" : false,
- "int max_width" : 24,
+ "int fixed_width" : 25,
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "addiconrender",
- "int width" : 16,
- "xtype" : "CellRendererPixbuf"
+ "* prop" : "factory",
+ "listeners" : {
+ "bind" : [
+ "(listitem) => {",
+ "",
+ " \tvar img = (Gtk.Image) ((Gtk.ListItem)listitem).get_child(); ",
+ " \tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
+ "\tvar node = (JsRender.Node) lr.get_item();",
+ "\t",
+ " ",
+ " var ic = Gtk.IconTheme.get_for_display(_this.el.get_display());",
+ "\timg.set_from_paintable(",
+ "\t \tic.lookup_icon (",
+ "\t \t\t\"list-add\", null, 16,1, ",
+ "\t\t\t Gtk.TextDirection.NONE, 0",
+ "\t\t)",
+ "\t );",
+ "\t ",
+ " \tvar fqn = node.fqn();",
+ " var cn = _this.main_window.windowstate.project.palete.getChildList(fqn, false);",
+ "",
+ "\timg.set_visible(cn.size > 0 ? true : false);",
+ " \t ",
+ "}",
+ ""
+ ],
+ "setup" : [
+ "(listitem) => {",
+ "",
+ "\t ",
+ "\tvar icon = new Gtk.Image();",
+ "\t ",
+ "\t((Gtk.ListItem)listitem).set_child(icon);",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "SignalListItemFactory"
}
],
- "utf8 title" : "Add",
- "xtype" : "TreeViewColumn"
+ "string title" : "Add",
+ "xtype" : "ColumnViewColumn"
}
],
- "listeners" : {
- "button_press_event" : [
- " ( ev) => {",
- " //console.log(\"button press?\");",
- " this.button_is_pressed = true;",
- " print(\"BUTTON DOWN\\n\");",
- " ",
- " this.lastEventSource = \"tree\";",
- " if (! _this.before_node_change() ) {",
- " ",
- " return true;",
- " }",
- " ",
- "\tif (ev.type != Gdk.EventType.BUTTON_PRESS) {",
- "\t\treturn false;",
- "\t}",
- " if (_this.model.el.iter_n_children(null) < 1) {",
- "\t _this.main_window.windowstate.showAddObject(_this.view.el);",
- "\t return true;",
- " }",
- " ",
- " ",
- " Gtk.TreePath res;",
- " Gtk.TreeViewColumn col;",
- " if (!_this.view.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, out col, null, null) ) {",
- " return true;",
- " }",
- " ",
- " if (col.title == \"Add\") {",
- " \t\tGLib.Value value;",
- " \t\tGtk.TreeIter iter;",
- "",
- "\t\t_this.model.el.get_iter (out iter, res);",
- " _this.model.el.get_value(iter, 2, out value);\t\t",
- " // why dup_ - gets and and inc's ref count (which in theory should be freed at the end.?",
- " ",
- " var node = (JsRender.Node)value.dup_object();",
- " var fqn = node.fqn();",
- " \tvar cn = _this.main_window.windowstate.project.palete.getChildList(fqn);",
- " \t\tif (cn.length < 1) {",
- " \t\t\treturn true;",
- "\t\t}",
- " ",
- " _this.main_window.windowstate.leftTreeBeforeChange();",
- " this.el.get_selection().select_path(res);",
- " \t_this.main_window.windowstate.showAddObject(this.el);",
- " \treturn true;",
- " }",
- " ",
- "\tif ( ev.button != 3) {",
- " //print(\"click\" + ev.type);",
- " return false;",
- " }",
- " _this.main_window.windowstate.leftTreeBeforeChange();",
- "",
- " ",
- " ",
- " this.el.get_selection().select_path(res);",
- " ",
- " ",
- " ",
- " //if (!this.get('/LeftTreeMenu').el) { ",
- " // this.get('/LeftTreeMenu').init(); ",
- " // }",
- " ",
- " _this.LeftTreeMenu.el.set_screen(Gdk.Screen.get_default());",
- " _this.LeftTreeMenu.el.show_all();",
- " _this.LeftTreeMenu.el.popup_at_pointer(ev);",
- " // print(\"click:\" + res.path.to_string());",
- " return true;",
- "}"
- ],
- "button_release_event" : [
- "(ev) => { ",
- " this.button_is_pressed = false;",
- " return false;",
- "}"
- ],
- "cursor_changed" : [
- " ( ) => {",
- " print(\"LEFT TREE Cursor Changed\\n\");",
- "\t//if (!this.button_is_pressed && !this.key_is_pressed) {",
- "\t\t// then event was started by some other action",
- "\t\t// which should manually trigger all the events..",
- "\t//\tprint(\"SKIPPING select - no button or key pressed\\n\");",
- "\t//\treturn;",
- "\t//}",
- "",
- "",
- " if (this.blockChanges) { // probably not needed.. ",
- "\t\tprint(\"SKIPPING select - blockchanges set..\\n\"); ",
- " return ;",
- " }",
- " if (!_this.before_node_change( ) ) {",
- "\t this.blockChanges = true;",
- "\t this.el.get_selection().unselect_all();",
- "\t this.blockChanges = false;",
- "\t ",
- "\t return;",
- " }",
- " if (_this.main_window.windowstate.file == null) {",
- " \t\tprint(\"SKIPPING select windowstate file is not set...\\n\"); ",
- " return;",
- " } ",
- " ",
- " //var render = this.get('/LeftTree').getRenderer(); ",
- " print(\"LEFT TREE -> view -> selection changed called\\n\");",
- " ",
- " ",
- " // -- it appears that the selection is not updated.",
- " ",
- " GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {",
- " print(\"LEFT TREE -> view -> selection changed TIMEOUT CALLED\\n\");",
- "",
- " if (this.el.get_selection().count_selected_rows() < 1) {",
- "",
- " print(\"selected rows < 1\\n\");",
- " //??this.model.load( false);",
- " _this.node_selected(null, this.lastEventSource);",
- " ",
- " return false ;",
- " }",
- " ",
- " //console.log('changed');",
- " var s = this.el.get_selection();",
- " Gtk.TreeIter iter;",
- " Gtk.TreeModel mod;",
- " s.get_selected(out mod, out iter);",
- " ",
- " ",
- " // var val = \"\";",
- " GLib.Value value;",
- " _this.model.el.get_value(iter, 2, out value);",
- " _this.model.activePath = mod.get_path(iter).to_string();",
- " ",
- " // why dup_?",
- " ",
- " var node = (JsRender.Node)value.dup_object();",
- " print (\"calling left_tree.node_selected\\n\");",
- " _this.node_selected(node, this.lastEventSource);",
- " while (Gtk.events_pending()) {",
- " Gtk.main_iteration();",
- " }",
- " var cp = mod.get_path(iter);",
- " Gtk.TreePath sp, ep;",
- " this.el.get_visible_range(out sp, out ep);",
- " // if sp is before cp then retuns 1.",
- " // if cp is before ep then retuns 1.",
- " if (cp.compare(sp) >= 0 && ep.compare(cp) >=1) {",
- " return false;",
- " }",
- " ",
- " ",
- " ",
- " this.el.scroll_to_cell(new Gtk.TreePath.from_string(_this.model.activePath), null, true, 0.1f,0.0f);",
- " ",
- " return false;",
- " }); ",
- " //_this.after_node_change(node);",
- "",
- "// _this.model.file.changed(node, \"tree\");",
- " ",
- " //Seed.print( value.get_string());",
- " return ;",
- " ",
- "}"
- ],
- "drag_begin" : [
- "( ctx) => {",
- "\t//print('SOURCE: drag-begin');",
- " ",
- " ",
- " //this.targetData = \"\";",
- " ",
- " // find what is selected in our tree...",
- " ",
- " var s = _this.view.el.get_selection();",
- " if (s.count_selected_rows() < 1) {",
- " return;",
- " }",
- " Gtk.TreeIter iter;",
- " Gtk.TreeModel mod;",
- " s.get_selected(out mod, out iter);",
- "",
- " ",
- "",
- " // set some properties of the tree for use by the dropped element.",
- " GLib.Value value;",
- " _this.model.el.get_value(iter, 2, out value);",
- " var tp = mod.get_path(iter).to_string();",
- " var data = (JsRender.Node)(value.dup_object());",
- " var xname = data.fqn();",
- " print (\"XNAME IS \" + xname+ \"\\n\");",
- " this.dragData = tp;",
- " this.dropList = _this.main_window.windowstate.file.palete().getDropList(xname);",
- " ",
- " print (\"DROP LIST IS \" + string.joinv(\", \", this.dropList) + \"\\n\");",
- " ",
- "",
- " // make the drag icon a picture of the node that was selected",
- " ",
- " ",
- " // by default returns the path..",
- " var path = _this.model.el.get_path(iter);",
- "",
- " ",
- " var pix = this.el.create_row_drag_icon ( path);",
- " ",
- " Gtk.drag_set_icon_surface (ctx, pix) ;",
- " ",
- " return;",
- "}"
- ],
- "drag_data_get" : [
- "( drag_context, data, info, time) => {",
- " ",
- "",
- "\t//print(\"drag-data-get\");",
- "\tvar s = this.el.get_selection();",
- "\tif (s.count_selected_rows() < 1) {",
- "\t\tdata.set_text(\"\",0); ",
- "\t\t print(\"return empty string - no selection..\");",
- "\t\treturn;",
- "\t}",
- "",
- "\tGtk.TreeIter iter;",
- "\tGtk.TreeModel mod;",
- "",
- "\ts.get_selected(out mod, out iter);",
- "",
- "",
- "",
- "\tGLib.Value value;",
- "\t_this.model.el.get_value(iter, 2, out value);",
- "\tvar ndata = (JsRender.Node)(value.dup_object());",
- "",
- "",
- "",
- "\tvar tp = mod.get_path(iter).to_string();",
- "\t// by default returns the path..",
- "",
- "\tif ( info != Gdk.Atom.intern(\"STRING\",true) ) {",
- "\t\ttp = ndata.toJsonString();",
- "\t} ",
- "",
- "\t//data.set_text(tp,tp.length); ",
- "",
- "\tdata.set (data.get_target (), 8, (uchar[]) tp.to_utf8 ());",
- "",
- "",
- "\t// print(\"return \" + tp);",
- "\t}"
- ],
- "drag_data_received" : [
- "\t(ctx, x, y, sel, info, time) => {",
- "",
- "\t// THIS CODE ONLY RELATES TO drag or drop of \"NEW\" elements or \"FROM another tree..\"",
- "",
- "",
- "\t// print(\"Tree: drag-data-received\\n\");",
- "\tvar selection_text = (string)sel.get_data();",
- "\t//print(\"selection_text= %s\\n\",selection_text);",
- "",
- "\tvar is_drag = this.drag_in_motion;",
- "",
- "",
- "",
- "\tGLib.debug(\"Is Drag %s\\n\", is_drag ? \"Y\": \"N\");",
- "\tvar targetData = \"\";",
- "",
- "\tGtk.TreePath path;",
- "\tGtk.TreeViewDropPosition pos;",
- "\tvar isOver = _this.view.el.get_dest_row_at_pos(this.drag_x,this.drag_y, out path, out pos);",
- "",
- "\t// if there are not items in the tree.. the we have to set isOver to true for anything..",
- "\tvar isEmpty = false;",
- "\tif (_this.model.el.iter_n_children(null) < 1) {",
- "\t\tGLib.debug(\"got NO children?\\n\");",
- "\t\tisOver = true; //??? ",
- "\t\tisEmpty = true;",
- "\t\tpos = Gtk.TreeViewDropPosition.INTO_OR_AFTER;",
- "\t}",
- "",
- "",
- "\t//console.log(\"LEFT-TREE: drag-motion\");",
- "\tvar src = Gtk.drag_get_source_widget(ctx);",
- "",
- "\t// a drag from self - this should be handled by drop and motion.",
- "\tif (src == this.el) {",
- "\t\tGLib.debug(\"Source == this element should not happen.. ? \\n\");",
- "\t\treturn;",
- "\t}",
- "\t//print(\"drag_data_recieved from another element\");",
- "",
- "\t ",
- "",
- "",
- "\tif (selection_text == null || selection_text.length < 1 || !isOver) {",
- "\t\t// nothing valid foudn to drop...",
- "\t\t GLib.debug(\"empty sel text or not over\");",
- "\t\tif (is_drag) {",
- "\t\t Gdk.drag_status(ctx, 0, time);",
- "\t\t this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);",
- "\t\t return;",
- "\t\t}",
- "\t\tGtk.drag_finish (ctx, false, false, time); // drop failed..",
- "\t\t// no drop action...",
- "\t\treturn; ",
- "",
- "\t}",
- "\tvar dropNode = new JsRender.Node(); ",
- "",
- "\tvar dropNodeType = selection_text;",
- "\tvar show_templates = true;",
- "\t// for drop",
- "\tif (dropNodeType[0] == '{') {",
- "\t\tvar pa = new Json.Parser();",
- "\t\ttry {",
- "\t\t pa.load_from_data(dropNodeType);",
- "\t\t} catch (Error e) {",
- "\t\t Gtk.drag_finish (ctx, false, false, time); // drop failed..",
- "\t\t // no drop action...",
- "\t\t return; ",
- "\t\t}",
- "\t\t ",
- "\t\tdropNode.loadFromJson( pa.get_root().get_object(), 2);",
- "\t\tdropNodeType = dropNode.fqn();",
- "\t\tshow_templates = false;",
- "\t\t",
- "\t\t",
- "\t} else {",
- "\t\t// drop with property.",
- "\t\tif (selection_text.contains(\":\")) {",
- "\t\t\tvar bits = selection_text.split(\":\");",
- "\t\t dropNode.setFqn(bits[0]);",
- "\t\t dropNode.set_prop(new JsRender.NodeProp.special(\"prop\", bits[1]));",
- "\t\t ",
- "\t\t ",
- "\t\t ",
- "\t\t} else {",
- "\t\t dropNode.setFqn(selection_text);",
- "\t\t}",
- "\t}",
- "",
- "\t ",
- "\t// dropList --- need to gather this ... ",
- "\tGLib.debug(\"get dropList for : %s\\n\",dropNodeType); ",
- "\tvar dropList = _this.main_window.windowstate.file.palete().getDropList(dropNodeType);",
- "",
- "\tGLib.debug(\"dropList: %s\\n\", string.joinv(\" , \", dropList));",
- "",
- "\t// if drag action is link ... then we can drop it anywahere...",
- "\t if ((ctx.get_actions() & Gdk.DragAction.LINK) > 0) {",
- "\t\t // if path is null?? dragging into an empty tree?",
- "\t\t targetData = (path == null ? \"\" : path.to_string()) + \"|%d\".printf((int)pos);",
- "\t } else {",
- "",
- "",
- "\t\ttargetData = _this.model.findDropNodeByPath( isEmpty ? \"\" : path.to_string(), dropList, pos);",
- "\t }",
- "",
- "",
- "\t\t",
- "\tGLib.debug(\"targetDAta: %s\", targetData );",
- "",
- "\tif (targetData.length < 1) {",
- "\t ",
- "\t\t// invalid drop path..",
- "\t\tif (this.drag_in_motion) {",
- "\t\t Gdk.drag_status(ctx, 0, time);",
- "\t\t this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);",
- "\t\t return;",
- "\t\t}",
- "\t\tGtk.drag_finish (ctx, false, false, time); // drop failed..",
- "\t\t// no drop action...",
- "\t\treturn;",
- "\t}",
- "",
- "",
- "",
- "\t var td_ar = targetData.split(\"|\");",
- "\t ",
- "",
- "\tif (this.drag_in_motion) { ",
- "\t\tGdk.drag_status(ctx, Gdk.DragAction.COPY ,time);",
- "",
- "\t\tthis.highlightDropPath( td_ar[0] , (Gtk.TreeViewDropPosition)int.parse(td_ar[1]));",
- "\t\treturn;",
- "\t}",
- "\t// continue on to allow drop..",
- "",
- "",
- "\t// at this point, drag is not in motion... -- as checked above... - so it's a real drop event..",
- "\t//targetData",
- "\t// {parent}|{pos}|{prop}",
- "",
- "",
- " _this.model.dropNode(targetData, dropNode, show_templates);",
- " ",
- "\tGLib.debug(\"ADD new node!!!\\n\");",
- "\t\t",
- "\t///Xcls_DialogTemplateSelect.singleton().show( _this.model.file.palete(), node);",
- "",
- "\tGtk.drag_finish (ctx, false, false,time);",
- "",
- "",
- "\t\t",
- "\t\t",
- "",
- "}"
- ],
- "drag_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;",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- "}"
- ],
- "drag_end" : [
- " (drag_context) => {",
- "\t//Seed.print('LEFT-TREE: drag-end');",
- " this.dragData = \"\";",
- " this.dropList = null;",
- "// this.targetData = \"\";",
- " this.highlightDropPath(\"\",0);",
- "// return true;",
- "}"
- ],
- "drag_motion" : [
- " ( ctx, x, y, time) => {",
- " print(\"got drag motion\\n\");",
- " var src = Gtk.drag_get_source_widget(ctx);",
- " this.drag_x = x;",
- " this.drag_y = y; ",
- "",
- " if (src != this.el) {",
- " ",
- " ",
- " ",
- " // the point of this is to detect where an item could be dropped..",
- " print(\"requesting drag data\\n\");",
- " this.drag_in_motion = true;",
- " ",
- " // 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(\"STRING\",true), // the target type we want ",
- " time // time stamp ",
- " );",
- " return true;",
- " } ",
- "",
- "",
- " print(\"action: %d\\n\", ctx.get_actions());",
- " //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;",
- " }",
- "",
- "",
- " // ------------- a drag from self..",
- "",
- "",
- " //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);",
- " ",
- " this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0); ",
- " Gdk.drag_status(ctx, action ,time);",
- " return true;",
- " ",
- " // continue through to allow drop...",
- "",
- " } ",
- " ",
- " ",
- "",
- " ",
- " ",
- " //print(\"ISOVER? \" + isOver);",
- " if (!isOver) {",
- " ",
- " Gdk.drag_status(ctx, 0 ,time);",
- " this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0); ",
- " return false;",
- "",
- " }",
- " ",
- " // 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\");",
- " Gdk.drag_status(ctx, 0 ,time);",
- " this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);",
- " return false;",
- " }",
- " ",
- " ",
- " // see if we are dragging into ourself?",
- " var target_path = path.to_string(); ",
- " print (\"Drag %s onto %s--%d\\n \", selection_text, target_path, pos);",
- " ",
- " // pos : 3 = ontop - 0 = after, 1 = before",
- " //print(\"target_path=\"+target_path);",
- "",
- " // ",
- " if (selection_text == target_path) {",
- " print(\"self drag ?? == we should perhaps allow copy onto self..\\n\");",
- " ",
- " Gdk.drag_status(ctx, 0 ,time);",
- " this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);",
- " return false;",
- "// -- 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\");",
- " ",
- " Gdk.drag_status(ctx, 0, time);",
- " this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);",
- " return false;",
- " }",
- " ",
- " var td_ar = targetData.split(\"|\");",
- " ",
- " ",
- "",
- " Gdk.drag_status(ctx, action ,time);",
- " this.highlightDropPath(td_ar[0], (Gtk.TreeViewDropPosition)int.parse(td_ar[1]));",
- " return true;",
- " ",
- " ",
- "}"
- ],
- "key_press_event" : [
- "(ev) => {",
- " this.key_is_pressed = true;",
- " return false;",
- "}"
- ],
- "key_release_event" : [
- "(ev) => {",
- " this.key_is_pressed = false;",
- " return false;",
- "}",
- ""
- ]
- },
"string name" : "left-tree-view",
- "tooltip_column" : 1,
- "xtype" : "TreeView",
- "| void highlightDropPath" : [
- " ( string treepath, Gtk.TreeViewDropPosition pos) {",
+ "xtype" : "ColumnView",
+ "| Gtk.Widget? getWidgetAt" : [
+ "(double x, double in_y) {",
+ "/*",
+ " \t",
+ "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
+ " \tvar colview = gesture.widget;",
+ " \tvar line_no = check_list_widget(colview, x,y);",
+ " if (line_no > -1) {",
+ " \t\tvar item = colview.model.get_item(line_no);",
+ " \t\t ",
+ " \t}",
+ " \t*/",
+ " \tvar y = in_y + _this.viewwin.el.vadjustment.value; ",
+ " var child = this.el.get_first_child(); ",
+ " \t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
+ " \tvar line_no = -1; ",
+ " \tvar reading_header = true;",
+ " \tvar curr_y = 0;",
+ " \tvar header_height = 0;",
+ " \tvar h = 0;",
+ " \twhile (child != null) {",
+ "\t\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
+ "\t if (reading_header) {",
+ "\t\t\t\t",
+ "",
+ "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
+ "\t\t\t h += child.get_height();",
+ "\t\t\t\t\tchild = child.get_next_sibling();",
+ "\t\t\t\t\tcontinue;",
+ "\t\t\t\t}",
+ "\t\t\t\t// should be columnlistview",
+ "\t\t\t\tchild = child.get_first_child(); ",
+ "\t\t\t GLib.debug(\"header height=%d\", h);",
+ "\t\t\t\theader_height = h;",
+ "\t\t\t\t",
+ "\t\t\t\treading_header = false;",
+ "\t\t\t\t",
+ "\t }",
+ "\t\t line_no++;",
"",
- " // highlighting for drag/drop",
- " if (treepath.length > 0) {",
- " this.el.set_drag_dest_row( new Gtk.TreePath.from_string( treepath ), pos);",
- " } else {",
- " this.el.set_drag_dest_row(null, Gtk.TreeViewDropPosition.INTO_OR_AFTER);",
- " }",
- " ",
- "}"
+ "\t\t\tif (y < header_height) {",
+ "\t\t \treturn null;",
+ "\t \t}",
+ "",
+ "\t\t\tvar hh = child.get_height();",
+ "\t\t\t//GLib.debug(\"got cell xy = %d,%d w,h= %d,%d\", alloc.x, alloc.y, alloc.width, alloc.height);",
+ "",
+ "\t\t if (y > curr_y && y <= header_height + hh + curr_y ) {",
+ "\t\t\t return (Gtk.Widget)child;",
+ "\t\t }",
+ "\t\t curr_y += hh ;",
+ "",
+ "\t\t if (curr_y > y) {",
+ "\t\t return null;",
+ "\t }",
+ "\t child = child.get_next_sibling(); ",
+ " \t}",
+ " return null;",
+ "",
+ " }"
],
- "| void selectNode" : [
- "(string treepath_str, string source) {",
- "\tthis.lastEventSource = source;",
- " //this.selection.select_path(new Gtk.TreePath.from_string( treepath_str));",
- " var tp = new Gtk.TreePath.from_string(treepath_str);",
- " ",
- " this.el.set_cursor(tp, null, false); ",
- " this.el.scroll_to_cell(tp, null, false, 0,0);",
- "}",
- ""
+ "| Gtk.Widget? getWidgetAtRow" : [
+ "(uint row) {",
+ "/*",
+ " \t",
+ "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
+ " \tvar colview = gesture.widget;",
+ " \tvar line_no = check_list_widget(colview, x,y);",
+ " if (line_no > -1) {",
+ " \t\tvar item = colview.model.get_item(line_no);",
+ " \t\t ",
+ " \t}",
+ " \t*/",
+ "\t\t//GLib.debug(\"Get Widget At Row %d\", (int)row);",
+ " var child = this.el.get_first_child(); ",
+ " \tvar line_no = -1; ",
+ " \tvar reading_header = true;",
+ "\t ",
+ " \twhile (child != null) {",
+ "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
+ " \t ",
+ " \t if (reading_header) {",
+ "\t\t\t\t",
+ "",
+ "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
+ "\t\t\t\t ",
+ "\t\t\t\t\tchild = child.get_next_sibling();",
+ "\t\t\t\t\tcontinue;",
+ "\t\t\t\t}",
+ "\t\t\t\t// should be columnlistview",
+ "\t\t\t\tchild = child.get_first_child(); ",
+ "\t\t\t ",
+ "\t\t\t ",
+ "\t\t\t\t",
+ "\t\t\t\treading_header = false;",
+ "\t\t\t\t ",
+ "\t\t }",
+ "\t\t ",
+ "\t\t ",
+ " \t ",
+ "\t\t line_no++;",
+ "\t\t\tif (line_no == row) {",
+ "\t\t\t\t//GLib.debug(\"Returning widget %s\", child.get_type().name());",
+ "\t\t\t return (Gtk.Widget)child;",
+ "\t\t }",
+ "\t child = child.get_next_sibling(); ",
+ " \t}",
+ "\t\t//GLib.debug(\"Rturning null\");",
+ " return null;",
+ "",
+ " }"
],
- "| void setCursor" : [
- "(string treepath, string sourceEvent) {",
- "\tthis.lastEventSource = sourceEvent;",
- "\t//this.blockChanges = true; << block changes prevents loading of 'node data' and firing of node_selected..",
- " this.el.set_cursor(new Gtk.TreePath.from_string(treepath), null, false); ",
- " // fire node_selected..",
- " //this.blockChanges = false;",
- "\tthis.lastEventSource = \"\";",
- "}",
- ""
+ "| int getColAt" : [
+ "(double x, double y) {",
+ "/*",
+ " \t",
+ "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
+ " \t ",
+ " \t*/",
+ "\t\t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
+ "\t\t//GLib.debug(\"Cehck %d, %d\", x,y);",
+ " var child = this.el.get_first_child(); ",
+ " \t ",
+ " \tvar col = 0;",
+ " \tvar offx = 0;",
+ " \twhile (child != null) {",
+ "\t\t\t",
+ "\t\t\tif (child.get_type().name() == \"GtkColumnViewRowWidget\") {",
+ "\t\t\t\tchild = child.get_first_child();",
+ "\t\t\t\tcontinue;",
+ "\t\t\t}",
+ "\t\t\t",
+ "\t\t\t//child.get_allocation(out alloc);",
+ "\t\t\tif (x < (child.get_width() + offx)) {",
+ "\t\t\t\treturn col;",
+ "\t\t\t}",
+ "\t\t\treturn 1;",
+ "\t\t\t//offx += child.get_width();",
+ "\t\t\t//col++;",
+ "\t\t\t//child = child.get_next_sibling();",
+ "\t\t}",
+ " \t ",
+ "\t\t\t ",
+ " return -1;",
+ "",
+ " }"
+ ],
+ "| int getRowAt" : [
+ "(double x, double in_y, out string pos) {",
+ "",
+ "",
+ "\t ",
+ "",
+ "/*",
+ " \t",
+ "from \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
+ " \tvar colview = gesture.widget;",
+ " \tvar line_no = check_list_widget(colview, x,y);",
+ " if (line_no > -1) {",
+ " \t\tvar item = colview.model.get_item(line_no);",
+ " \t\t ",
+ " \t}",
+ " \t*/",
+ " \t\t ",
+ " \t\t",
+ " \t\t//GLib.debug(\"offset = %d y = %d\", (int) voff, (int) in_y);",
+ " \tvar y = in_y + _this.viewwin.el.vadjustment.value; ",
+ " var child = this.el.get_first_child(); ",
+ " \t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
+ " \tvar line_no = -1; ",
+ " \tvar reading_header = true;",
+ " \tvar real_y = 0;",
+ " \tvar header_height = 0;",
+ " \tpos = \"none\";",
+ " \tvar h = 0;",
+ " \twhile (child != null) {",
+ "\t\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
+ " \t if (reading_header) {",
+ "\t\t\t\t",
+ "",
+ "\t\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
+ "\t\t\t h += child.get_height();",
+ "\t\t\t\t\tchild = child.get_next_sibling();",
+ "\t\t\t\t\tcontinue;",
+ "\t\t\t\t}",
+ "\t\t\t\t// should be columnlistview",
+ "\t\t\t\tchild = child.get_first_child(); ",
+ "\t\t\t GLib.debug(\"header height=%d\", h);",
+ "\t\t\t\theader_height = h;",
+ "\t\t\t\t",
+ "\t\t\t\treading_header = false;",
+ "\t\t\t\t",
+ "\t }",
+ "\t ",
+ "\t\t if (child.get_type().name() != \"GtkColumnViewRowWidget\") {",
+ " \t\t child = child.get_next_sibling();",
+ " \t\t continue;",
+ "\t\t }",
+ "\t\t ",
+ "\t\t \tif (y < header_height) {",
+ "\t\t \treturn -1;",
+ "\t \t}",
+ "\t\t ",
+ "\t\t line_no++;",
+ "\t\t\tvar hh = child.get_height();",
+ "\t\t\t//child.get_allocation(out alloc);",
+ "\t\t\t//GLib.debug(\"got cell xy = %d,%d w,h= %d,%d\", alloc.x, alloc.y, alloc.width, alloc.height);",
+ "\t\t\t//GLib.debug(\"row %d y= %d %s\", line_no, (int) (header_height + alloc.y),",
+ "\t\t\t",
+ "\t\t\t//\tchild.visible ? \"VIS\" : \"hidden\");",
+ "",
+ "\t\t if (y > (header_height + real_y) && y <= (header_height + real_y + hh) ) {",
+ "\t\t \tif (y > ( header_height + real_y + (hh * 0.8))) {",
+ "\t\t \t\tpos = \"below\";",
+ "\t \t\t} else if (y > ( header_height + real_y + (hh * 0.2))) {",
+ "\t \t\t\tpos = \"over\";",
+ " \t\t\t} else {",
+ " \t\t\t\tpos = \"above\";",
+ "\t\t\t\t}",
+ "\t\t \t GLib.debug(\"getRowAt return : %d, %s\", line_no, pos);",
+ "\t\t\t return line_no;",
+ "\t\t }",
+ " ",
+ "",
+ "\t\t if (real_y + hh > y) {",
+ "\t\t return -1;",
+ "\t }",
+ "\t real_y += hh;",
+ "\t child = child.get_next_sibling(); ",
+ " \t}",
+ " return -1;",
+ "",
+ " }"
]
},
{
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "add",
- "label" : "Delete Element",
- "listeners" : {
- "activate" : [
- " ( ) => {",
- " ",
- " print(\"ACTIVATE?\");",
- " ",
- " ",
- " _this.model.deleteSelected();",
- "}"
- ]
- },
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "label" : "Save as Template",
- "listeners" : {
- "activate" : [
- " () => {",
- "",
- " DialogSaveTemplate.singleton().show(",
- " (Gtk.Window) _this.el.get_toplevel (), ",
- " _this.main_window.windowstate.file.palete(), ",
- " _this.getActiveElement()",
- " );",
- " ",
- " ",
- "}"
- ]
- },
- "xtype" : "MenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "label" : "Save as Module",
- "listeners" : {
- "activate" : [
- " () => {",
- " var node = _this.getActiveElement();",
- " var name = DialogSaveModule.singleton().show(",
- " (Gtk.Window) _this.el.get_toplevel (), ",
- " _this.main_window.windowstate.project, ",
- " node",
- " );",
- " 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\");",
- " ",
- " ",
- "}"
- ]
- },
- "xtype" : "MenuItem"
+ "* prop" : "child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "int spacing" : 0,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "label" : "Delete Element",
+ "listeners" : {
+ "clicked" : [
+ " ( ) => {",
+ " ",
+ " print(\"ACTIVATE?\");",
+ " ",
+ " \t_this.LeftTreeMenu.el.hide();",
+ " _this.model.deleteSelected();",
+ "}"
+ ]
+ },
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "label" : "Save as Template",
+ "listeners" : {
+ "clicked" : [
+ " () => {",
+ "_this.LeftTreeMenu.el.hide();",
+ " DialogSaveTemplate.singleton().showIt(",
+ " (Gtk.Window) _this.el.get_root (), ",
+ " _this.main_window.windowstate.file.palete(), ",
+ " _this.getActiveElement()",
+ " );",
+ " ",
+ " ",
+ "}"
+ ]
+ },
+ "xtype" : "Button"
+ },
+ {
+ "$ xns" : "Gtk",
+ "label" : "Save as Module",
+ "listeners" : {
+ "clicked" : [
+ " () => {",
+ " ",
+ " _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\");",
+ " */",
+ " ",
+ "}"
+ ]
+ },
+ "xtype" : "Button"
+ }
+ ],
+ "xtype" : "Box"
}
],
- "xtype" : "Menu"
+ "xtype" : "Popover"
}
],
- "listeners" : {
- "size_allocate" : [
- "(allocation) => {",
- "",
- "\t ",
- "\t//GLib.debug(\"Got allocation width of scrolled view %d\", allocation.width );",
- "\t_this.maincol.el.set_max_width(allocation.width - 32);",
- "}",
- ""
- ]
- },
"xtype" : "ScrolledWindow"
}
],
"| JsRender.Node? getActiveElement" : [
" () { // return path to actie node.",
"",
- " var path = this.getActivePath();",
- " if (path.length < 1) {",
- " return null;",
- " }",
- " return _this.model.pathToNode(path);",
" ",
+ "\treturn _this.selmodel.getSelectedNode();",
+ " ",
+ " ",
"}",
""
],
- "| string getActivePath" : [
- " () {",
- " ",
- " var view = this.view.el;",
- " if (view.get_selection().count_selected_rows() < 1) {",
- " return \"\";",
- " }",
- " Gtk.TreeIter iter;",
- " Gtk.TreeModel mod;",
- " view.get_selection().get_selected(out mod, out iter);",
- " return mod.get_path(iter).to_string();",
+ "| void onresize" : [
+ "() {",
+ " ",
+ "\t ",
+ "\t//GLib.debug(\"Got allocation width of scrolled view %d\", allocation.width );",
+ "//\t_this.maincol.el.set_max_width( _this.viewwin.el.get_width() - 32 );",
"}",
- " "
+ "",
+ ""
]
}
],
- "modOrder" : "",
- "name" : "WindowLeftTree",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/WindowLeftTree.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "WindowLeftTree"
}
\ No newline at end of file
-static Xcls_WindowLeftTree _WindowLeftTree;
+ 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_model model;
- public Xcls_maincol maincol;
- public Xcls_iconrender iconrender;
- public Xcls_renderer renderer;
- public Xcls_addiconrender addiconrender;
- 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, string source);
-
- // 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
- var child_0 = new Xcls_viewwin( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- }
-
- // user defined functions
- public string getActivePath () {
-
- var view = this.view.el;
- if (view.get_selection().count_selected_rows() < 1) {
- return "";
- }
- Gtk.TreeIter iter;
- Gtk.TreeModel mod;
- view.get_selection().get_selected(out mod, out iter);
- return mod.get_path(iter).to_string();
- }
- public JsRender.Node? getActiveElement () { // return path to actie node.
-
- var path = this.getActivePath();
- if (path.length < 1) {
- return null;
- }
- return _this.model.pathToNode(path);
-
- }
- public JsRender.JsRender getActiveFile () {
- return this.main_window.windowstate.file;
- }
- public class Xcls_viewwin : Object
+ public class Xcls_WindowLeftTree : Object
{
- public Gtk.ScrolledWindow el;
+ 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_viewwin(Xcls_WindowLeftTree _owner )
+ public Xcls_WindowLeftTree()
{
- _this = _owner;
- _this.viewwin = this;
- this.el = new Gtk.ScrolledWindow( null, null );
+ _this = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
// my vars (dec)
+ this.main_window = null;
// set gobject values
- this.el.shadow_type = Gtk.ShadowType.IN;
- var child_0 = new Xcls_view( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_LeftTreeMenu( _this );
+ 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;
- // init method
- this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+ // my vars (def)
- //listeners
- this.el.size_allocate.connect( (allocation) => {
-
-
- //GLib.debug("Got allocation width of scrolled view %d", allocation.width );
- _this.maincol.el.set_max_width(allocation.width - 32);
- });
+ // 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;
- // user defined functions
- }
- public class Xcls_view : Object
- {
- public Gtk.TreeView el;
- private Xcls_WindowLeftTree _this;
+ // my vars (def)
- // my vars (def)
- public bool blockChanges;
- public bool drag_in_motion;
- public string lastEventSource;
- public string dragData;
- public bool button_is_pressed;
- public Gtk.CssProvider css;
- public bool key_is_pressed;
- public int drag_x;
- public int drag_y;
- public string[] dropList;
+ // ctor
+ public Xcls_SignalListItemFactory3(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
- // ctor
- public Xcls_view(Xcls_WindowLeftTree _owner )
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_viewwin : Object
{
- _this = _owner;
- _this.view = this;
- this.el = new Gtk.TreeView();
+ public Gtk.ScrolledWindow el;
+ private Xcls_WindowLeftTree _this;
- // my vars (dec)
- this.blockChanges = false;
- this.lastEventSource = "";
- this.button_is_pressed = false;
- this.key_is_pressed = false;
- // set gobject values
- this.el.name = "left-tree-view";
- this.el.expand = true;
- this.el.tooltip_column = 1;
- this.el.enable_tree_lines = true;
- this.el.headers_visible = false;
- var child_0 = new Xcls_model( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_maincol( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
- var child_2 = new Xcls_TreeViewColumn8( _this );
- child_2.ref();
- this.el.append_column ( child_2.el );
+ // 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;
- // init method
+ // 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.css = new Gtk.CssProvider();
- try {
- this.css.load_from_data("#left-tree-view { font-size: 10px;}");
- } catch (Error e) {}
- this.el.get_style_context().add_provider(this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
-
+ _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
+
+ {
- var selection = this.el.get_selection();
- selection.set_mode( Gtk.SelectionMode.SINGLE);
+ 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) {
- // is this really needed??
- /*
- this.selection.signal['changed'].connect(function() {
- _this.get('/LeftTree.view').listeners.cursor_changed.apply(
- _this.get('/LeftTree.view'), [ _this.get('/LeftTree.view'), '']
- );
- });
- */
- Gtk.drag_source_set (
- this.el, /* widget will be drag-able */
- Gdk.ModifierType.BUTTON1_MASK, /* modifier that will start a drag */
- BuilderApplication.targetList, /* lists of target to support */
- Gdk.DragAction.COPY | Gdk.DragAction.MOVE | Gdk.DragAction.LINK /* what to do with data after dropped */
- );
- // ?? needed??
- //Gtk.drag_source_add_text_targets(this.el);
+
- Gtk.drag_dest_set
- (
- this.el, /* widget that will accept a drop */
- Gtk.DestDefaults.MOTION | Gtk.DestDefaults.HIGHLIGHT,
- BuilderApplication.targetList, /* lists of target to support */
- Gdk.DragAction.COPY | Gdk.DragAction.MOVE | Gdk.DragAction.LINK /* what to do with data after dropped */
- );
+ /*
+
+ 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;
+ }
+
- //Gtk.drag_dest_set_target_list(this.el, Builder.Application.targetList);
- //Gtk.drag_dest_add_text_targets(this.el);
+ 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 ;
+ }
+
+
+
+ });
}
- //listeners
- this.el.button_release_event.connect( (ev) => {
- this.button_is_pressed = false;
- return false;
- });
- this.el.button_press_event.connect( ( ev) => {
- //console.log("button press?");
- this.button_is_pressed = true;
- print("BUTTON DOWN\n");
+ // 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) => {
- this.lastEventSource = "tree";
- if (! _this.before_node_change() ) {
+
+
+ /// ( drag_context, data, info, time) => {
+
- return true;
- }
+ //print("drag-data-get");
+ var ndata = _this.selmodel.getSelectedNode();
+ if (ndata == null) {
+ GLib.debug("return empty string - no selection..");
+ return null;
+
+ }
- if (ev.type != Gdk.EventType.BUTTON_PRESS) {
- return false;
- }
- if (_this.model.el.iter_n_children(null) < 1) {
- _this.main_window.windowstate.showAddObject(_this.view.el);
- return true;
- }
+
+ //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);
-
- Gtk.TreePath res;
- Gtk.TreeViewColumn col;
- if (!_this.view.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, out col, null, null) ) {
- return true;
- }
+ 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 (col.title == "Add") {
- GLib.Value value;
- Gtk.TreeIter iter;
-
- _this.model.el.get_iter (out iter, res);
- _this.model.el.get_value(iter, 2, out value);
- // why dup_ - gets and and inc's ref count (which in theory should be freed at the end.?
-
- var node = (JsRender.Node)value.dup_object();
- var fqn = node.fqn();
- var cn = _this.main_window.windowstate.project.palete.getChildList(fqn);
- if (cn.length < 1) {
- return true;
- }
+
- _this.main_window.windowstate.leftTreeBeforeChange();
- this.el.get_selection().select_path(res);
- _this.main_window.windowstate.showAddObject(this.el);
- return true;
- }
+ if (keyval != Gdk.Key.Delete && keyval != Gdk.Key.BackSpace) {
+ return true;
+ }
- if ( ev.button != 3) {
- //print("click" + ev.type);
- return false;
- }
- _this.main_window.windowstate.leftTreeBeforeChange();
-
+ _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");
- this.el.get_selection().select_path(res);
-
-
-
- //if (!this.get('/LeftTreeMenu').el) {
- // this.get('/LeftTreeMenu').init();
- // }
+ // 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.LeftTreeMenu.el.set_screen(Gdk.Screen.get_default());
- _this.LeftTreeMenu.el.show_all();
- _this.LeftTreeMenu.el.popup_at_pointer(ev);
- // print("click:" + res.path.to_string());
- return true;
- });
- this.el.cursor_changed.connect( ( ) => {
- print("LEFT TREE Cursor Changed\n");
- //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.blockChanges) { // probably not needed..
- print("SKIPPING select - blockchanges set..\n");
- return ;
- }
- if (!_this.before_node_change( ) ) {
- this.blockChanges = true;
- this.el.get_selection().unselect_all();
- this.blockChanges = false;
-
- return;
- }
- if (_this.main_window.windowstate.file == null) {
- print("SKIPPING select windowstate file is not set...\n");
- return;
- }
-
- //var render = this.get('/LeftTree').getRenderer();
- print("LEFT TREE -> view -> selection changed called\n");
+
+ 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
+
- // -- it appears that the selection is not updated.
-
- GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
- print("LEFT TREE -> view -> selection changed TIMEOUT CALLED\n");
-
- if (this.el.get_selection().count_selected_rows() < 1) {
-
- print("selected rows < 1\n");
- //??this.model.load( false);
- _this.node_selected(null, this.lastEventSource);
+ return false;
+ }
+
+ // handle drop around self..
+
+
- return false ;
- }
+ //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) {
- //console.log('changed');
- var s = this.el.get_selection();
- Gtk.TreeIter iter;
- Gtk.TreeModel mod;
- s.get_selected(out mod, out iter);
+ 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;
- // var val = "";
- GLib.Value value;
- _this.model.el.get_value(iter, 2, out value);
- _this.model.activePath = mod.get_path(iter).to_string();
- // why dup_?
- var node = (JsRender.Node)value.dup_object();
- print ("calling left_tree.node_selected\n");
- _this.node_selected(node, this.lastEventSource);
- while (Gtk.events_pending()) {
- Gtk.main_iteration();
- }
- var cp = mod.get_path(iter);
- Gtk.TreePath sp, ep;
- this.el.get_visible_range(out sp, out ep);
- // if sp is before cp then retuns 1.
- // if cp is before ep then retuns 1.
- if (cp.compare(sp) >= 0 && ep.compare(cp) >=1) {
- return false;
+ 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);
- this.el.scroll_to_cell(new Gtk.TreePath.from_string(_this.model.activePath), null, true, 0.1f,0.0f);
+ // dropList is a list of xtypes that this node could be dropped on.
+ // it is set up when we start to drag..
- return false;
- });
- //_this.after_node_change(node);
-
- // _this.model.file.changed(node, "tree");
-
- //Seed.print( value.get_string());
- return ;
+
+ targetData = _this.model.findDropNodeByPath( path.to_string(), this.dropList, pos);
- });
- this.el.drag_begin.connect( ( ctx) => {
- //print('SOURCE: drag-begin');
-
-
- //this.targetData = "";
-
- // find what is selected in our tree...
-
- var s = _this.view.el.get_selection();
- if (s.count_selected_rows() < 1) {
- return;
- }
- Gtk.TreeIter iter;
- Gtk.TreeModel mod;
- s.get_selected(out mod, out iter);
-
-
-
- // set some properties of the tree for use by the dropped element.
- GLib.Value value;
- _this.model.el.get_value(iter, 2, out value);
- var tp = mod.get_path(iter).to_string();
- var data = (JsRender.Node)(value.dup_object());
- var xname = data.fqn();
- print ("XNAME IS " + xname+ "\n");
- this.dragData = tp;
- this.dropList = _this.main_window.windowstate.file.palete().getDropList(xname);
-
- print ("DROP LIST IS " + string.joinv(", ", this.dropList) + "\n");
-
-
- // make the drag icon a picture of the node that was selected
-
-
- // by default returns the path..
- var path = _this.model.el.get_path(iter);
-
-
- var pix = this.el.create_row_drag_icon ( path);
-
- Gtk.drag_set_icon_surface (ctx, pix) ;
-
- return;
- });
- this.el.drag_data_get.connect( ( drag_context, data, info, time) => {
+ print("targetDAta: " + targetData +"\n");
-
- //print("drag-data-get");
- var s = this.el.get_selection();
- if (s.count_selected_rows() < 1) {
- data.set_text("",0);
- print("return empty string - no selection..");
- return;
- }
-
- Gtk.TreeIter iter;
- Gtk.TreeModel mod;
-
- s.get_selected(out mod, out iter);
-
-
-
- GLib.Value value;
- _this.model.el.get_value(iter, 2, out value);
- var ndata = (JsRender.Node)(value.dup_object());
-
-
-
- var tp = mod.get_path(iter).to_string();
- // by default returns the path..
-
- if ( info != Gdk.Atom.intern("STRING",true) ) {
- tp = ndata.toJsonString();
- }
-
- //data.set_text(tp,tp.length);
-
- data.set (data.get_target (), 8, (uchar[]) tp.to_utf8 ());
-
-
- // print("return " + tp);
- });
- this.el.drag_end.connect( (drag_context) => {
- //Seed.print('LEFT-TREE: drag-end');
- this.dragData = "";
- this.dropList = null;
- // this.targetData = "";
- this.highlightDropPath("",0);
- // return true;
- });
- this.el.drag_motion.connect( ( ctx, x, y, time) => {
- print("got drag motion\n");
- var src = Gtk.drag_get_source_widget(ctx);
- this.drag_x = x;
- this.drag_y = y;
-
- if (src != this.el) {
-
-
-
- // the point of this is to detect where an item could be dropped..
- print("requesting drag data\n");
- this.drag_in_motion = true;
-
- // 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("STRING",true), // the target type we want
- time // time stamp
- );
- return true;
- }
-
-
- print("action: %d\n", ctx.get_actions());
- //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;
- }
-
-
- // ------------- a drag from self..
-
-
- //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);
-
- this.highlightDropPath("", (Gtk.TreeViewDropPosition)0);
- Gdk.drag_status(ctx, action ,time);
- return true;
-
- // continue through to allow drop...
-
- }
-
-
-
+ 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..
- //print("ISOVER? " + isOver);
- if (!isOver) {
-
- Gdk.drag_status(ctx, 0 ,time);
- this.highlightDropPath("", (Gtk.TreeViewDropPosition)0);
- return false;
-
- }
+ var delete_selection_data = false;
- // 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 (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);
+
- if (selection_text == null || selection_text.length < 1) {
- //print("Error - drag selection text returned NULL");
- Gdk.drag_status(ctx, 0 ,time);
- this.highlightDropPath("", (Gtk.TreeViewDropPosition)0);
- return false;
- }
-
- // see if we are dragging into ourself?
- var target_path = path.to_string();
- print ("Drag %s onto %s--%d\n ", selection_text, target_path, pos);
-
- // pos : 3 = ontop - 0 = after, 1 = before
- //print("target_path="+target_path);
-
- //
- if (selection_text == target_path) {
- print("self drag ?? == we should perhaps allow copy onto self..\n");
-
- Gdk.drag_status(ctx, 0 ,time);
- this.highlightDropPath("", (Gtk.TreeViewDropPosition)0);
- return false;
- // -- fixme -- this is not really correct..
-
- }
- // check that
- //print("DUMPING DATA");
- //console.dump(data);
- // path, pos
+ // we can send stuff to souce here...
- //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..
+ // do we always say failure, so we handle the reall drop?
+ Gtk.drag_finish (ctx, false, false,time); //delete_selection_data, time);
-
- 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");
-
- Gdk.drag_status(ctx, 0, time);
- this.highlightDropPath("", (Gtk.TreeViewDropPosition)0);
- return false;
- }
-
- var td_ar = targetData.split("|");
-
-
-
- Gdk.drag_status(ctx, action ,time);
- this.highlightDropPath(td_ar[0], (Gtk.TreeViewDropPosition)int.parse(td_ar[1]));
- return true;
-
-
- });
- this.el.key_press_event.connect( (ev) => {
- this.key_is_pressed = true;
- return false;
- });
- this.el.key_release_event.connect( (ev) => {
- this.key_is_pressed = false;
- return false;
- });
- this.el.drag_data_received.connect( (ctx, x, y, sel, info, time) => {
-
- // THIS CODE ONLY RELATES TO drag or drop of "NEW" elements or "FROM another tree.."
-
-
- // print("Tree: drag-data-received\n");
- var selection_text = (string)sel.get_data();
- //print("selection_text= %s\n",selection_text);
-
- var is_drag = this.drag_in_motion;
-
-
-
- GLib.debug("Is Drag %s\n", is_drag ? "Y": "N");
- 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) {
- GLib.debug("got NO children?\n");
- isOver = true; //???
- isEmpty = true;
- pos = Gtk.TreeViewDropPosition.INTO_OR_AFTER;
- }
-
-
- //console.log("LEFT-TREE: drag-motion");
- var src = Gtk.drag_get_source_widget(ctx);
-
- // a drag from self - this should be handled by drop and motion.
- if (src == this.el) {
- GLib.debug("Source == this element should not happen.. ? \n");
- return;
- }
- //print("drag_data_recieved from another element");
-
-
-
-
- if (selection_text == null || selection_text.length < 1 || !isOver) {
- // nothing valid foudn to drop...
- GLib.debug("empty sel text or not over");
- if (is_drag) {
- Gdk.drag_status(ctx, 0, time);
- this.highlightDropPath("", (Gtk.TreeViewDropPosition)0);
- return;
- }
- Gtk.drag_finish (ctx, false, false, time); // drop failed..
- // no drop action...
- return;
-
- }
- var dropNode = new JsRender.Node();
-
- var dropNodeType = selection_text;
- var show_templates = true;
- // for drop
- if (dropNodeType[0] == '{') {
- var pa = new Json.Parser();
- try {
- pa.load_from_data(dropNodeType);
- } catch (Error e) {
- Gtk.drag_finish (ctx, false, false, time); // drop failed..
- // no drop action...
- return;
- }
-
- dropNode.loadFromJson( pa.get_root().get_object(), 2);
- dropNodeType = dropNode.fqn();
- show_templates = false;
-
-
- } else {
- // drop with property.
- if (selection_text.contains(":")) {
- var bits = selection_text.split(":");
- dropNode.setFqn(bits[0]);
- dropNode.set_prop(new JsRender.NodeProp.special("prop", bits[1]));
-
-
-
- } else {
- dropNode.setFqn(selection_text);
- }
- }
-
-
- // dropList --- need to gather this ...
- GLib.debug("get dropList for : %s\n",dropNodeType);
- var dropList = _this.main_window.windowstate.file.palete().getDropList(dropNodeType);
-
- GLib.debug("dropList: %s\n", string.joinv(" , ", dropList));
-
- // if drag action is link ... then we can drop it anywahere...
- if ((ctx.get_actions() & Gdk.DragAction.LINK) > 0) {
- // if path is null?? dragging into an empty tree?
- targetData = (path == null ? "" : path.to_string()) + "|%d".printf((int)pos);
- } else {
-
-
- targetData = _this.model.findDropNodeByPath( isEmpty ? "" : path.to_string(), dropList, pos);
- }
-
-
-
- GLib.debug("targetDAta: %s", targetData );
-
- if (targetData.length < 1) {
-
- // invalid drop path..
- if (this.drag_in_motion) {
- Gdk.drag_status(ctx, 0, time);
- this.highlightDropPath("", (Gtk.TreeViewDropPosition)0);
- return;
- }
- Gtk.drag_finish (ctx, false, false, time); // drop failed..
- // no drop action...
- return;
- }
-
-
-
- var td_ar = targetData.split("|");
-
-
- if (this.drag_in_motion) {
- Gdk.drag_status(ctx, Gdk.DragAction.COPY ,time);
-
- this.highlightDropPath( td_ar[0] , (Gtk.TreeViewDropPosition)int.parse(td_ar[1]));
- return;
- }
- // continue on to allow drop..
-
-
- // at this point, drag is not in motion... -- as checked above... - so it's a real drop event..
- //targetData
- // {parent}|{pos}|{prop}
-
-
- _this.model.dropNode(targetData, dropNode, show_templates);
-
- GLib.debug("ADD new node!!!\n");
-
- ///Xcls_DialogTemplateSelect.singleton().show( _this.model.file.palete(), node);
-
- Gtk.drag_finish (ctx, false, false,time);
-
-
-
-
-
- });
- this.el.drag_drop.connect( ( ctx, x, y, time) => {
- //Seed.print("TARGET: drag-drop");
-
-
- var src = Gtk.drag_get_source_widget(ctx);
+ return true;
+
+
+
- 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;
}
-
+ */
+ 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
- //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..
+ this.lastDragNode = new JsRender.Node();
+ this.lastDragNode.loadFromJsonString(v.get_string(), 1);
+ }
- 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..
-
+ 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?
+
}
-
- // 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);
+ 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;
-
-
- // 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;
-
-
-
-
-
-
- });
- }
-
- // user defined functions
- public void highlightDropPath ( string treepath, Gtk.TreeViewDropPosition pos) {
-
- // highlighting for drag/drop
- if (treepath.length > 0) {
- this.el.set_drag_dest_row( new Gtk.TreePath.from_string( treepath ), pos);
- } else {
- this.el.set_drag_dest_row(null, Gtk.TreeViewDropPosition.INTO_OR_AFTER);
- }
+
+ m.append(dropNode);
+ _this.model.selectNode(dropNode);
+ _this.changed();
+ return true; // no need to highlight?
- }
- public void selectNode (string treepath_str, string source) {
- this.lastEventSource = source;
- //this.selection.select_path(new Gtk.TreePath.from_string( treepath_str));
- var tp = new Gtk.TreePath.from_string(treepath_str);
-
- this.el.set_cursor(tp, null, false);
- this.el.scroll_to_cell(tp, null, false, 0,0);
- }
- public void setCursor (string treepath, string sourceEvent) {
- this.lastEventSource = sourceEvent;
- //this.blockChanges = true; << block changes prevents loading of 'node data' and firing of node_selected..
- this.el.set_cursor(new Gtk.TreePath.from_string(treepath), null, false);
- // fire node_selected..
- //this.blockChanges = false;
- this.lastEventSource = "";
- }
- }
- public class Xcls_model : Object
- {
- public Gtk.TreeStore el;
- private Xcls_WindowLeftTree _this;
-
+ }
+
+
+
+ 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;
+ }
+
+
+
+
+
+
+ });
+ }
- // my vars (def)
- public DialogTemplateSelect template_select;
- public string activePath;
+ // 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;
+ }
+ }
- // ctor
- public Xcls_model(Xcls_WindowLeftTree _owner )
+ public class Xcls_selmodel : Object
{
- _this = _owner;
- _this.model = this;
- this.el = new Gtk.TreeStore.newv( { typeof(string),
-typeof(string),
-typeof(Object),
-typeof(Gdk.Pixbuf),
-typeof(Gdk.Pixbuf) } );
-
- // my vars (dec)
- this.template_select = null;
- this.activePath = "";
-
- // set gobject values
+ public Gtk.SingleSelection el;
+ private Xcls_WindowLeftTree _this;
- // init method
- print("model initialized");
- }
+ // my vars (def)
- // user defined functions
- public void loadFile (JsRender.JsRender f) {
- //console.dump(f);
- this.el.clear();
- _this.main_window.windowstate.leftTreeNodeSelected(null, "");
- // needed???
- _this.main_window.windowstate.file = f;
-
-
- if (f.tree == null) {
- try {
- f.loadItems( );
- } catch (Error e) {
- return;
- }
+ // 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 ;
+ });
}
- // if it's still null?
- if (f.tree == null) {
- _this.main_window.windowstate.showAddObject(_this.view.el);
-
- 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();
+
}
-
- var o = new Gee.ArrayList<JsRender.Node>();
- o.add(f.tree);
- this.load(o,null);
+ public JsRender.Node getNodeAt (uint row) {
- _this.view.el.expand_all();
-
- if (f.tree.items.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);
+ 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();
+
}
-
-
- while (Gtk.events_pending()) {
- Gtk.main_iteration();
- }
-
- _this.maincol.el.set_max_width(_this.viewwin.el.get_allocated_width() - 32);
-
-
-
- return;
-
-
}
- public string findDropNodeByPath (string treepath_str, string[] targets, int in_pref = -1) {
-
- var path = treepath_str; // dupe it..
-
-
- // pref : 3 = ontop - 0 = after, 1 = before
- int pref = in_pref < 0 ? (int)Gtk.TreeViewDropPosition.INTO_OR_AFTER : in_pref;
-
- var last = "";
-
- //console.dump(this.treemap);
-
- print("findDropNodeByPath : got path length %d / %s\n", path.length, path);
-
- if (path.length == 0) {
- // top drop. // just return empty..
- return "|%d".printf((int)pref) ;
-
+ 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
}
-
-
- while (path.length > 0) {
-
- if (path.length == treepath_str.length && pref != Gtk.TreeViewDropPosition.INTO_OR_AFTER) {
- if (path.last_index_of(":") < 0 ) {
- return "";
- }
- path = path.substring(0, path.last_index_of(":"));
- last = treepath_str;
- print("DROP before or after : using %s\n",path);
- continue;
- }
-
- //print("LOOKING FOR PATH: " + path);
- var node_data = this.pathToNode(path);
-
- if (node_data == null) {
- print("node not found");
- return "";
- }
+
+ // user defined functions
+ public void loadFile (JsRender.JsRender f) {
+ //console.dump(f);
- var xname = node_data.fqn();
- var match = "";
- var prop = "";
+ _this.drop.highlightWidget = null;
- for (var i =0; i < targets.length; i++) {
- var tg = targets[i];
- if ((tg == xname) ) {
- match = tg;
- break;
- }
- // if target is "xxxx:name"
- if (tg.contains(xname +":")) {
- match = tg;
- var ar = tg.split(":");
- prop = ar[1];
- break;
- }
- }
+ var m = (GLib.ListStore) this.el.model;
+ m.remove_all();
+ _this.main_window.windowstate.leftTreeNodeSelected(null);
+ // needed???
+ _this.main_window.windowstate.file = f;
- if (match.length > 0) {
- if (last.length > 0) { // pref is after/before..
- // then it's after last
- //if (pref > 1) {
- // return "";
- //}
- return last + "|%d".printf((int)pref) + "|" + prop;
-
-
+
+ if (f.tree == null) {
+ try {
+ f.loadItems( );
+ } catch (Error e) {
+ return;
}
- // we need to add prop - as :store -> needs to bee added when dropping onto.
- return path + "|%d".printf( (int) Gtk.TreeViewDropPosition.INTO_OR_AFTER) + "|" + prop;
- }
- /*
- last = "" + path;
- var par = path.split(":");
- string [] ppar = {};
- for (var i = 0; i < par.length-1; i++) {
- ppar += par[i];
}
+ // if it's still null?
+ if (f.tree == null) {
+ _this.main_window.windowstate.showAddObject(_this.view.el, null);
- path = string.joinv(":", ppar);
- */
- break;
-
- }
-
- return "";
-
- }
- public void iterSetValues (Gtk.TreeIter iter, JsRender.Node node) {
- var ic = Gtk.IconTheme.get_default();
- Gdk.Pixbuf pix = null,addi = null;
-
- var o = GLib.Value(typeof(Object));
- o.set_object((Object)node);
- 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 {
- addi = ic.load_icon("list-add", 16,0);
- if (FileUtils.test (fn, FileTest.IS_REGULAR)) {
-
- pix = new Gdk.Pixbuf.from_file (fn);
-
- } else {
- pix = ic.load_icon("emblem-new", 16,0);
- }
- } catch (GLib.Error e) {}
-
- var fqn = node.fqn();
- var cn = _this.main_window.windowstate.project.palete.getChildList(fqn);
-
- this.el.set(
- iter,
- 0, node.nodeTitle(),
- 1, node.nodeTip(),
- -1
- );
- this.el.set_value(iter, 2,o);
- this.el.set_value(iter, 3,pix);
- this.el.set_value(iter, 4, cn.length > 0 ? addi : null);
-
-
- }
- public string treePathFromNode (JsRender.Node node) {
- // iterate through the tree and find the node
- var ret = "";
-
- this.el.foreach((mod, pth, iter) => {
- // get the node..
-
-
- GLib.Value value;
- _this.model.el.get_value(iter, 2, out value);
-
-
-
- var n = (JsRender.Node)value;
-
- print("compare %s to %s\n", n.fqn(), node.fqn());
- if (node == n) {
- ret = pth.to_string();
- return true;
+ return;
}
- return false;
- });
- return ret;
-
- }
- public void deleteSelected () {
-
- 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);
-
-
-
-
- //
-
+ m.append(f.tree);
+ // expand???
-
-
- this.activePath= ""; // again!?!?
- //this.changed(null,true);
-
- _this.changed();
-
- _this.view.blockChanges = false;
- }
- public void dropNode (string target_data_str, JsRender.Node node, bool show_templates) {
- // print("drop Node");
- // console.dump(node);
- // console.dump(target_data);
-
- //target_data_str
- // {parent}|{pos}|{prop}
-
-
- // 0 = before , 1=after 2/3 onto
-
- GLib.debug("dropNode %s", target_data_str);
-
- var target_data= target_data_str.split("|");
-
- var parent_str = target_data[0].length > 0 ? target_data[0] : "";
- var pos = target_data.length > 1 ? int.parse(target_data[1]) : 2; // ontop..
-
-
- Gtk.TreePath tree_path = parent_str.length > 0 ? new Gtk.TreePath.from_string( parent_str ) : null;
-
-
-
- //print("add " + tp + "@" + target_data[1] );
-
- JsRender.Node parentNode = null;
-
- Gtk.TreeIter iter_after;
- Gtk.TreeIter iter_par ;
-
- // this appears to be done in drag_ddata_recieved as well.
- if (target_data.length == 3 && target_data[2].length > 0) {
- node.set_prop(new JsRender.NodeProp.special("prop", target_data[2]));
-
- }
-
- Gtk.TreePath expand_parent = null;
-
- // we only need to show the template if it's come from else where?
- if (show_templates) {
-
- var ts = _this.main_window.windowstate.template_select;
-
- var new_node = ts.show(
- _this.main_window, // (Gtk.Window) _this.el.get_toplevel (),
- _this.main_window.windowstate.file.palete(),
- node,
- _this.main_window.windowstate.project);
-
- if (new_node == null) {
- return; // do not add?
- }
- node = new_node;
- }
-
- //print("pos is %d \n".printf(pos));
-
- Gtk.TreeIter n_iter;
-
- if ( parent_str.length < 1) {
- this.el.append(out n_iter, null); // drop at top level..
- node.parent = null;
- _this.main_window.windowstate.file.tree = node;
-
-
- } else if (pos < 2) {
- //print(target_data[1] > 0 ? 'insert_after' : 'insert_before');
-
- this.el.get_iter(out iter_after, tree_path );
- this.el.iter_parent(out iter_par, iter_after);
- expand_parent = this.el.get_path(iter_par);
-
-
- // not sure why all the 'dup_object()' stuff? did it crash before?
- GLib.Value value;
- this.el.get_value( iter_par, 2, out value);
- parentNode = (JsRender.Node)value.dup_object();
-
-
- this.el.get_value( iter_after, 2, out value);
- var relNode = (JsRender.Node)value.dup_object();
-
- if ( pos > 0 ) {
-
- this.el.insert_after(out n_iter, iter_par , iter_after);
- var ix = parentNode.items.index_of(relNode);
- parentNode.items.insert(ix+1, node);
-
- } else {
- this.el.insert_before(out n_iter, iter_par , iter_after);
- var ix = parentNode.items.index_of(relNode);
- parentNode.items.insert(ix, node);
-
- }
- node.parent = parentNode;
-
-
-
- } else {
- // print("appending to " + parent_str);
- this.el.get_iter(out iter_par, tree_path);
- this.el.append(out n_iter, iter_par );
- expand_parent = this.el.get_path(iter_par);
-
- GLib.Value value;
- this.el.get_value( iter_par, 2, out value);
- parentNode = (JsRender.Node)value.dup_object();
- node.parent = parentNode;
- parentNode.items.add(node);
- }
-
-
-
-
- // work out what kind of packing to use.. -- should be in
-
-
- //_this.main_window.windowstate.file.palete().fillPack(node,parentNode);
- _this.main_window.windowstate.file.palete().on_child_added(parentNode,node);
-
-
- this.iterSetValues(n_iter, node);
- // add the node...
-
-
-
- // load children - if it has any..
-
- if (node.items.size > 0) {
- this.load(node.items, n_iter);
- _this.view.el.expand_row(this.el.get_path(n_iter), true);
- } else if (expand_parent != null && !_this.view.el.is_row_expanded(expand_parent)) {
- _this.view.el.expand_row(expand_parent,true);
+ /*
+ 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);
}
-
- //if (tp != null && (node.items.length() > 0 || pos > 1)) {
- // _this.view.el.expand_row(this.el.get_path(iter_par), true);
- // }
- // wee need to get the empty proptypes from somewhere..
+ */
- //var olditer = this.activeIter;
- this.activePath = this.el.get_path(n_iter).to_string();
-
-
- // pretend button was pressed, so that we can trigger select node...
- _this.view.button_is_pressed = true;
- _this.view.lastEventSource = "";
- _this.view.el.set_cursor(this.el.get_path(n_iter), null, false);
- _this.view.button_is_pressed = false;
- _this.changed();
-
-
- }
- public void moveNode (string target_data, Gdk.DragAction action)
- {
-
- /// target_data = "path|pos");
-
-
- //print("MOVE NODE");
- // console.dump(target_data);
- Gtk.TreeIter old_iter;
- Gtk.TreeModel mod;
- var s = _this.view.el.get_selection();
- s.get_selected(out mod , out old_iter);
- mod.get_path(old_iter);
-
- var node = this.pathToNode(mod.get_path(old_iter).to_string());
- //console.dump(node);
- if (node == null) {
- GLib.debug("moveNode: ERROR - node is null?");
+ //_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 () {
-
- // needs to drop first, otherwise the target_data
- // treepath will be invalid.
-
+
+ var node = _this.selmodel.getSelectedNode();
+
- if ((action & Gdk.DragAction.MOVE) > 0) {
- GLib.debug("REMOVING OLD NODE : " + target_data + "\n");
- node.remove();
- this.dropNode(target_data, node, false);
- this.el.remove(ref old_iter);
-
-
-
- } else {
- GLib.debug("DROPPING NODE // copy: " + target_data + "\n");
- node = node.deepClone();
- this.dropNode(target_data, node, false);
- }
- _this.changed();
- this.activePath= "";
- //this.updateNode(false,true);
- }
- public void updateSelected () {
-
-
- var s = _this.view.el.get_selection();
+ 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?");
- Gtk.TreeIter iter;
- Gtk.TreeModel mod;
+ 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..
+ }
+
- if (!s.get_selected(out mod, out iter)) {
- return; // nothing seleted..
- }
-
- GLib.Value value;
- this.el.get_value(iter, 2, out value);
- var node = (JsRender.Node)(value.get_object());
+ this.activePath= "";
+ print("GET vnode value?");
- this.el.set(iter, 0, node.nodeTitle(),
- 1, node.nodeTip(), -1
- );
- }
- public string findDropNode (string treepath_str, string[] targets) {
-
- // this is used by the dragdrop code in the roo version AFAIR..
-
- //var path = treepath_str.replace(/^builder-/, '');
- // treemap is depreciated... - should really check if model has any entries..
-
- if (this.el.iter_n_children(null) < 1) {
- //print("NO KEYS");
- return "|%d".printf((int)Gtk.TreeViewDropPosition.INTO_OR_AFTER);
- }
- //print("FIND treepath: " + path);
- //console.dump(this.treemap);
+ 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);
- //if (!treepath_str.match(/^builder-/)) {
- // return []; // nothing!
- //}
- if (targets.length > 0 && targets[0] == "*") {
- return treepath_str;
- }
- return this.findDropNodeByPath(treepath_str,targets, -1);
- }
- public void load (Gee.ArrayList<JsRender.Node> tr, Gtk.TreeIter? iter)
- {
+
+
+
+ //
+
+
-
- Gtk.TreeIter citer;
- //this.insert(citer,iter,0);
-
- for(var i =0 ; i < tr.size; i++) {
- if (iter != null) {
- this.el.insert(out citer,iter,-1); // why not append?
- } else {
- this.el.append(out citer,null);
- }
- this.iterSetValues(citer, tr.get(i));
+ this.activePath= ""; // again!?!?
+ //this.changed(null,true);
-
-
- if (tr.get(i).items.size > 0) {
- this.load(tr.get(i).items, citer);
- }
-
+ _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;
+
+ }
+ );
+ _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 JsRender.Node pathToNode (string path) {
-
-
- Gtk.TreeIter iter;
- _this.model.el.get_iter_from_string(out iter, path);
-
- GLib.Value value;
- _this.model.el.get_value(iter, 2, out value);
-
- return (JsRender.Node)value.dup_object();
-
- }
- }
- public class Xcls_maincol : Object
- {
- public Gtk.TreeViewColumn el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
- // ctor
- public Xcls_maincol(Xcls_WindowLeftTree _owner )
+ public class Xcls_maincol : Object
{
- _this = _owner;
- _this.maincol = this;
- this.el = new Gtk.TreeViewColumn();
+ public Gtk.ColumnViewColumn el;
+ private Xcls_WindowLeftTree _this;
- // my vars (dec)
- // set gobject values
- this.el.title = "Node";
- this.el.sizing = Gtk.TreeViewColumnSizing.FIXED;
- this.el.expand = true;
- this.el.resizable = true;
- var child_0 = new Xcls_iconrender( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false );
- var child_1 = new Xcls_renderer( _this );
- child_1.ref();
- this.el.pack_start ( child_1.el , true );
+ // my vars (def)
- // init method
+ // 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;
+ }
- this.el.add_attribute(_this.renderer.el , "markup", 0 );
- this.el.add_attribute(_this.iconrender.el , "pixbuf", 3 );
+ // user defined functions
}
-
- // user defined functions
- }
- public class Xcls_iconrender : Object
- {
- public Gtk.CellRendererPixbuf el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_iconrender(Xcls_WindowLeftTree _owner )
+ public class Xcls_SignalListItemFactory14 : Object
{
- _this = _owner;
- _this.iconrender = this;
- this.el = new Gtk.CellRendererPixbuf();
-
- // my vars (dec)
+ public Gtk.SignalListItemFactory el;
+ private Xcls_WindowLeftTree _this;
- // set gobject values
- this.el.width = 16;
- }
- // user defined functions
- }
+ // my vars (def)
- public class Xcls_renderer : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_WindowLeftTree _this;
+ // 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
+ }
- // my vars (def)
- // ctor
- public Xcls_renderer(Xcls_WindowLeftTree _owner )
+ public class Xcls_ColumnViewColumn15 : Object
{
- _this = _owner;
- _this.renderer = this;
- this.el = new Gtk.CellRendererText();
+ public Gtk.ColumnViewColumn el;
+ private Xcls_WindowLeftTree _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
+ // 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)
- public class Xcls_TreeViewColumn8 : Object
- {
- public Gtk.TreeViewColumn el;
- private Xcls_WindowLeftTree _this;
+ // 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_TreeViewColumn8(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- this.el = new Gtk.TreeViewColumn();
+ // my vars (def)
- // my vars (dec)
+ // ctor
+ public Xcls_SignalListItemFactory16(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
- // set gobject values
- this.el.max_width = 24;
- this.el.title = "Add";
- this.el.sizing = Gtk.TreeViewColumnSizing.FIXED;
- this.el.expand = false;
- var child_0 = new Xcls_addiconrender( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
+ // my vars (dec)
- // init method
+ // set gobject values
- this.el.add_attribute(_this.addiconrender.el , "pixbuf", 4 );
- }
+ //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_addiconrender : Object
- {
- public Gtk.CellRendererPixbuf el;
- private Xcls_WindowLeftTree _this;
+ // user defined functions
+ }
- // my vars (def)
- // ctor
- public Xcls_addiconrender(Xcls_WindowLeftTree _owner )
+ public class Xcls_LeftTreeMenu : Object
{
- _this = _owner;
- _this.addiconrender = this;
- this.el = new Gtk.CellRendererPixbuf();
-
- // my vars (dec)
+ public Gtk.Popover el;
+ private Xcls_WindowLeftTree _this;
- // set gobject values
- this.el.width = 16;
- }
- // user defined functions
- }
+ // my vars (def)
+ // ctor
+ public Xcls_LeftTreeMenu(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ _this.LeftTreeMenu = this;
+ this.el = new Gtk.Popover();
+ // my vars (dec)
- public class Xcls_LeftTreeMenu : Object
- {
- public Gtk.Menu el;
- private Xcls_WindowLeftTree _this;
+ // 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_LeftTreeMenu(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- _this.LeftTreeMenu = this;
- this.el = new Gtk.Menu();
+ // my vars (def)
- // my vars (dec)
+ // 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 );
+ }
- // set gobject values
- var child_0 = new Xcls_MenuItem11( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- var child_1 = new Xcls_MenuItem12( _this );
- child_1.ref();
- this.el.add ( child_1.el );
- var child_2 = new Xcls_MenuItem13( _this );
- child_2.ref();
- this.el.add ( child_2.el );
+ // user defined functions
}
+ public class Xcls_Button19 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_WindowLeftTree _this;
- // user defined functions
- }
- public class Xcls_MenuItem11 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_WindowLeftTree _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Button19(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // ctor
- public Xcls_MenuItem11(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.label = "Delete Element";
- // set gobject values
- this.el.label = "Delete Element";
- this.el.show();
+ //listeners
+ this.el.clicked.connect( ( ) => {
+
+ print("ACTIVATE?");
+
+ _this.LeftTreeMenu.el.hide();
+ _this.model.deleteSelected();
+ });
+ }
- //listeners
- this.el.activate.connect( ( ) => {
-
- print("ACTIVATE?");
-
-
- _this.model.deleteSelected();
- });
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_Button20 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_WindowLeftTree _this;
- public class Xcls_MenuItem12 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_WindowLeftTree _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Button20(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // ctor
- public Xcls_MenuItem12(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.label = "Save as Template";
- // set gobject values
- this.el.label = "Save as Template";
- this.el.show();
+ //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()
+ );
+
+
+ });
+ }
- //listeners
- this.el.activate.connect( () => {
-
- DialogSaveTemplate.singleton().show(
- (Gtk.Window) _this.el.get_toplevel (),
- _this.main_window.windowstate.file.palete(),
- _this.getActiveElement()
- );
-
-
- });
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_Button21 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_WindowLeftTree _this;
- public class Xcls_MenuItem13 : Object
- {
- public Gtk.MenuItem el;
- private Xcls_WindowLeftTree _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Button21(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // ctor
- public Xcls_MenuItem13(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuItem();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.label = "Save as Module";
- // set gobject values
- this.el.label = "Save as Module";
- this.el.show();
-
- //listeners
- this.el.activate.connect( () => {
- var node = _this.getActiveElement();
- var name = DialogSaveModule.singleton().show(
- (Gtk.Window) _this.el.get_toplevel (),
- _this.main_window.windowstate.project,
- node
- );
- if (name.length < 1) {
- return;
-
- }
- node.set_prop( new JsRender.NodeProp.special("xinclude", name));
- node.items.clear();
-
-
- var s = _this.view.el.get_selection();
+ //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();
- 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);
+ var s = _this.view.el.get_selection();
-
- print("removing node from Tree\n");
+ print("GET SELECTED?");
+ Gtk.TreeIter iter;
+ Gtk.TreeModel mod;
- _this.model.el.remove(ref citer);
- }
- _this.changed();
- _this.node_selected(node, "tree");
-
+
+ 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
}
- // user defined functions
- }
-}
+ }
+++ /dev/null
-{
- "build_module" : "builder",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "@ void after_node_change(JsRender.Node? node)" : "",
- "@ void before_node_change(JsRender.Node? node)" : "",
- "@ void drag_end()" : "",
- "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
- "id" : "RightPalete",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,true,true,0",
- "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
- "id" : "viewbox",
- "items" : [
- {
- "$ shadow_type" : "Gtk.ShadowType.IN",
- "$ xns" : "Gtk",
- "* init" : [
- " this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
- " this.el.set_size_request(-1,200);",
- " ",
- ""
- ],
- "* pack" : "pack_start,true,true,0",
- "items" : [
- {
- "# string dragData" : "",
- "$ enable_tree_lines" : true,
- "$ headers_visible" : true,
- "$ xns" : "Gtk",
- "* init" : [
- " {",
- " this.el.set_size_request(150,-1);",
- " // set_reorderable: [1]",
- " ",
- " var description = new Pango.FontDescription();",
- " description.set_size(8000);",
- " this.el.override_font(description);",
- " ",
- " var selection = this.el.get_selection();",
- " selection.set_mode( Gtk.SelectionMode.SINGLE);",
- " // this.selection.signal['changed'].connect(function() {",
- " // _view.listeners['cursor-changed'].apply(_view, [ _view, '']);",
- " //});",
- " // see: http://live.gnome.org/GnomeLove/DragNDropTutorial",
- " ",
- " Gtk.drag_source_set (",
- " this.el, /* widget will be drag-able */",
- " Gdk.ModifierType.BUTTON1_MASK, /* modifier that will start a drag */",
- " BuilderApplication.targetList, /* lists of target to support */",
- " Gdk.DragAction.COPY /* what to do with data after dropped */",
- " );",
- " //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);",
- " ",
- " // Gtk.drag_source_set_target_list(this.el, Application.targetList);",
- " // Gtk.drag_source_add_text_targets(this.el); ",
- " ",
- "}",
- ""
- ],
- "* pack" : "add",
- "items" : [
- {
- "$ columns" : "typeof(string),typeof(string)",
- "$ xns" : "Gtk",
- "* pack" : "set_model",
- "id" : "model",
- "n_columns" : 2,
- "xtype" : "ListStore",
- "| string getValue" : [
- " (Gtk.TreeIter iter, int col) {",
- " GLib.Value gval;",
- " this.el.get_value(iter, col , out gval);",
- " return (string)gval;",
- " ",
- " ",
- "}"
- ]
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- " this.el.add_attribute(_this.txtrender.el , \"markup\", 1 );",
- " ",
- ""
- ],
- "* pack" : "append_column",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "pack_start,true",
- "id" : "txtrender",
- "xtype" : "CellRendererText"
- }
- ],
- "utf8 title" : "Drag to add Object",
- "xtype" : "TreeViewColumn"
- }
- ],
- "listeners" : {
- "button_press_event" : [
- " ( event) => {",
- "",
- " //\tif (!this.get('/Editor').save()) {",
- " //\t // popup!! - click handled.. ",
- "// \t return true;",
- "// }",
- " return false;",
- "}"
- ],
- "drag_begin" : [
- " ( ctx) => {",
- " // we could fill this in now...",
- "// Seed.print('SOURCE: drag-begin');",
- " ",
- " ",
- " ",
- " Gtk.TreeIter iter;",
- " var s = this.el.get_selection();",
- " ",
- " Gtk.TreeModel mod;",
- " s.get_selected(out mod, out iter);",
- " var path = mod.get_path(iter);",
- " ",
- " /// pix is a surface..",
- " var pix = this.el.create_row_drag_icon ( path);",
- " ",
- " ",
- " Gtk.drag_set_icon_surface (ctx, pix);",
- " GLib.Value value;",
- " ",
- "",
- " _this.model.el.get_value(iter, 0, out value);",
- " ",
- " this.dragData = (string) value;",
- " ",
- " ",
- " return;",
- "}"
- ],
- "drag_data_get" : [
- "(drag_context, selection_data, info, time) => {",
- " \t//Seed.print('Palete: drag-data-get: ' + target_type);",
- " if (this.dragData.length < 1 ) {",
- " return; ",
- " }",
- " ",
- " GLib.debug(\"setting drag data to %s\\n\", this.dragData);",
- " // selection_data.set_text(this.dragData ,this.dragData.length);",
- " selection_data.set (selection_data.get_target (), 8, (uchar[]) this.dragData.to_utf8 ());",
- "",
- " //this.el.dragData = \"TEST from source widget\";",
- " ",
- " ",
- "}"
- ],
- "drag_end" : [
- "( drag_context) => {",
- " \t GLib.debug(\"SOURCE: drag-end (call listener on this)\\n\");",
- "\t",
- "\tthis.dragData = \"\";",
- "\t//this.dropList = null;",
- "\t_this.drag_end(); // call signal..",
- "\t//this.get('/LeftTree.view').highlight(false);",
- "\t ",
- "}"
- ]
- },
- "xtype" : "TreeView"
- }
- ],
- "xtype" : "ScrolledWindow"
- }
- ],
- "xtype" : "Box"
- }
- ],
- "xtype" : "Box",
- "| void clear" : [
- "() {",
- " this.model.el.clear();",
- "} "
- ],
- "| void load" : [
- " (Palete.Palete pal, string cls ) {",
- " ",
- " // this.get('model').expanded();",
- " ",
- " var tr = pal.getChildList(cls);",
- " this.model.el.clear();",
- "",
- "",
- " Gtk.TreeIter citer;",
- "",
- " for(var i =0 ; i < tr.length; i++) {",
- " this.model.el.append(out citer); ",
- " var dname = tr[i];",
- " if (dname.contains(\":\")) {",
- "\t\t\tvar ar = dname.split(\":\");",
- "\t\t\tdname = \"<b>\" + ar[1] +\"</b> - <i>\"+ar[0]+\"</i>\";",
- "\t\t}",
- " ",
- " this.model.el.set_value(citer, 0, tr[i] ); // used data. ",
- " this.model.el.set_value(citer, 1, dname ); // displayed value.",
- " ",
- " }",
- " this.model.el.set_sort_column_id(1,Gtk.SortType.ASCENDING);",
- " ",
- "} ",
- "",
- ""
- ]
- }
- ],
- "modOrder" : "",
- "name" : "WindowRightPalete",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/WindowRightPalete.bjs",
- "permname" : "",
- "title" : ""
-}
\ No newline at end of file
+++ /dev/null
-static Xcls_RightPalete _RightPalete;
-
-public class Xcls_RightPalete : Object
-{
- public Gtk.Box el;
- private Xcls_RightPalete _this;
-
- public static Xcls_RightPalete singleton()
- {
- if (_RightPalete == null) {
- _RightPalete= new Xcls_RightPalete();
- }
- return _RightPalete;
- }
- public Xcls_viewbox viewbox;
- public Xcls_model model;
- public Xcls_txtrender txtrender;
-
- // my vars (def)
- public signal void after_node_change(JsRender.Node? node) ;
- public signal void before_node_change(JsRender.Node? node) ;
- public signal void drag_end() ;
-
- // ctor
- public Xcls_RightPalete()
- {
- _this = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_viewbox( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true,true,0 );
- }
-
- // user defined functions
- public void load (Palete.Palete pal, string cls ) {
-
- // this.get('model').expanded();
-
- var tr = pal.getChildList(cls);
- this.model.el.clear();
-
-
- Gtk.TreeIter citer;
-
- for(var i =0 ; i < tr.length; i++) {
- this.model.el.append(out citer);
- var dname = tr[i];
- if (dname.contains(":")) {
- var ar = dname.split(":");
- dname = "<b>" + ar[1] +"</b> - <i>"+ar[0]+"</i>";
- }
-
- this.model.el.set_value(citer, 0, tr[i] ); // used data.
- this.model.el.set_value(citer, 1, dname ); // displayed value.
-
- }
- this.model.el.set_sort_column_id(1,Gtk.SortType.ASCENDING);
-
- }
- public void clear () {
- this.model.el.clear();
- }
- public class Xcls_viewbox : Object
- {
- public Gtk.Box el;
- private Xcls_RightPalete _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_viewbox(Xcls_RightPalete _owner )
- {
- _this = _owner;
- _this.viewbox = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_ScrolledWindow3( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true,true,0 );
- }
-
- // user defined functions
- }
- public class Xcls_ScrolledWindow3 : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_RightPalete _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ScrolledWindow3(Xcls_RightPalete _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
-
- // my vars (dec)
-
- // set gobject values
- this.el.shadow_type = Gtk.ShadowType.IN;
- var child_0 = new Xcls_TreeView4( _this );
- child_0.ref();
- this.el.add ( child_0.el );
-
- // init method
-
- this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
- this.el.set_size_request(-1,200);
- }
-
- // user defined functions
- }
- public class Xcls_TreeView4 : Object
- {
- public Gtk.TreeView el;
- private Xcls_RightPalete _this;
-
-
- // my vars (def)
- public string dragData;
-
- // ctor
- public Xcls_TreeView4(Xcls_RightPalete _owner )
- {
- _this = _owner;
- this.el = new Gtk.TreeView();
-
- // my vars (dec)
-
- // set gobject values
- this.el.enable_tree_lines = true;
- this.el.headers_visible = true;
- var child_0 = new Xcls_model( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_TreeViewColumn6( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
-
- // init method
-
- {
- this.el.set_size_request(150,-1);
- // set_reorderable: [1]
-
- var description = new Pango.FontDescription();
- description.set_size(8000);
- this.el.override_font(description);
-
- var selection = this.el.get_selection();
- selection.set_mode( Gtk.SelectionMode.SINGLE);
- // this.selection.signal['changed'].connect(function() {
- // _view.listeners['cursor-changed'].apply(_view, [ _view, '']);
- //});
- // see: http://live.gnome.org/GnomeLove/DragNDropTutorial
-
- Gtk.drag_source_set (
- this.el, /* widget will be drag-able */
- Gdk.ModifierType.BUTTON1_MASK, /* modifier that will start a drag */
- BuilderApplication.targetList, /* lists of target to support */
- Gdk.DragAction.COPY /* what to do with data after dropped */
- );
- //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);
-
- // Gtk.drag_source_set_target_list(this.el, Application.targetList);
- // Gtk.drag_source_add_text_targets(this.el);
-
- }
-
- //listeners
- this.el.button_press_event.connect( ( event) => {
-
- // if (!this.get('/Editor').save()) {
- // // popup!! - click handled..
- // return true;
- // }
- return false;
- });
- this.el.drag_begin.connect( ( ctx) => {
- // we could fill this in now...
- // Seed.print('SOURCE: drag-begin');
-
-
-
- Gtk.TreeIter iter;
- var s = this.el.get_selection();
-
- Gtk.TreeModel mod;
- s.get_selected(out mod, out iter);
- var path = mod.get_path(iter);
-
- /// pix is a surface..
- var pix = this.el.create_row_drag_icon ( path);
-
-
- Gtk.drag_set_icon_surface (ctx, pix);
- GLib.Value value;
-
-
- _this.model.el.get_value(iter, 0, out value);
-
- this.dragData = (string) value;
-
-
- return;
- });
- this.el.drag_end.connect( ( drag_context) => {
- GLib.debug("SOURCE: drag-end (call listener on this)\n");
-
- this.dragData = "";
- //this.dropList = null;
- _this.drag_end(); // call signal..
- //this.get('/LeftTree.view').highlight(false);
-
- });
- this.el.drag_data_get.connect( (drag_context, selection_data, info, time) => {
- //Seed.print('Palete: drag-data-get: ' + target_type);
- if (this.dragData.length < 1 ) {
- return;
- }
-
- GLib.debug("setting drag data to %s\n", this.dragData);
- // selection_data.set_text(this.dragData ,this.dragData.length);
- selection_data.set (selection_data.get_target (), 8, (uchar[]) this.dragData.to_utf8 ());
-
- //this.el.dragData = "TEST from source widget";
-
-
- });
- }
-
- // user defined functions
- }
- public class Xcls_model : Object
- {
- public Gtk.ListStore el;
- private Xcls_RightPalete _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_model(Xcls_RightPalete _owner )
- {
- _this = _owner;
- _this.model = this;
- this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- public string getValue (Gtk.TreeIter iter, int col) {
- GLib.Value gval;
- this.el.get_value(iter, col , out gval);
- return (string)gval;
-
-
- }
- }
-
- public class Xcls_TreeViewColumn6 : Object
- {
- public Gtk.TreeViewColumn el;
- private Xcls_RightPalete _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_TreeViewColumn6(Xcls_RightPalete _owner )
- {
- _this = _owner;
- this.el = new Gtk.TreeViewColumn();
-
- // my vars (dec)
-
- // set gobject values
- this.el.title = "Drag to add Object";
- var child_0 = new Xcls_txtrender( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
-
- // init method
-
- this.el.add_attribute(_this.txtrender.el , "markup", 1 );
- }
-
- // user defined functions
- }
- public class Xcls_txtrender : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_RightPalete _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_txtrender(Xcls_RightPalete _owner )
- {
- _this = _owner;
- _this.txtrender = this;
- this.el = new Gtk.CellRendererText();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
-
-
-
-
-}
{
"build_module" : "builder",
+ "gen_extended" : false,
"items" : [
{
"# Gtk.Widget lastObj" : "null",
"# Xcls_MainWindow main_window" : "",
"$ xns" : "Gtk",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
- "Gtk.SourceSearchContext searchcontext" : "",
+ "GtkSource.SearchContext searchcontext" : "",
"bool hexpand" : true,
"bool vexpand" : true,
"id" : "WindowRooView",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,true,true,0",
+ "bool vexpand" : true,
"id" : "notebook",
"items" : [
{
"$ xns" : "Gtk",
"* pack" : "append_page,_this.label_preview.el",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool vexpand" : true,
"id" : "paned",
"items" : [
{
"$ homogeneous" : false,
"$ xns" : "Gtk",
- "* pack" : "pack1,true,true",
+ "* pack" : "set_start_child",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool vexpand" : true,
"id" : "viewbox",
"items" : [
{
"$ homogeneous" : true,
"$ vexpand" : false,
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,true,0",
"Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
"items" : [
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
"label" : "Redraw",
"listeners" : {
"clicked" : [
{
"$ active" : true,
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
"id" : "AutoRedraw",
"label" : "Auto Redraw On",
"listeners" : {
},
{
"$ xns" : "Gtk",
- "* pack" : "pack_start,false,false,0",
"label" : "Full Redraw",
"listeners" : {
"clicked" : [
" () => {",
" _this.view.redraws = 99;",
- " _this.view.el.web_context.clear_cache(); ",
+ " // _this.view.el.web_context.clear_cache(); ",
" //_this.view.renderJS(true);",
" FakeServerCache.clear();",
" _this.view.reInit();",
"xtype" : "Box"
},
{
- "$ shadow_type" : "Gtk.ShadowType.IN",
- "$ xns" : "Gtk",
+ "# GLib.DateTime lastRedraw" : "null",
+ "# WebKit.WebInspector inspector" : "",
+ "# bool pendingRedraw" : false,
+ "# bool refreshRequired" : false,
+ "# int redraws" : 0,
+ "# string renderedData" : "\"\"",
+ "# string runhtml" : "\"\"",
+ "# string runjs" : "\"\"",
+ "$ xns" : "WebKit",
"* init" : [
- " this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
+ " {",
+ " // 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;",
+ " });",
+ " ",
+ " ",
+ "}",
+ ""
+ ],
+ "bool vexpand" : true,
+ "id" : "view",
+ "listeners" : {
+ "load_changed" : [
+ "(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 = \"\";",
+ "}"
+ ],
+ "ready_to_show" : [
+ "( ) => {",
+ " this.initInspector();",
+ "",
+ "}",
+ ""
+ ],
+ "script_dialog" : [
+ " (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\":",
+ "\t GLib.debug(\"GOT saveHTML %d\", ar[2].length);",
+ " _this.file.saveHTML(ar[2]);",
+ " _this.createThumb();",
+ " return true;",
+ " default:",
+ " return false;",
+ " }",
+ " ",
+ "}"
+ ]
+ },
+ "xtype" : "WebView",
+ "| 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 {",
+ "\t print(\"got inspector web view FAILED\\n\");",
+ " //this.inspector.close();",
+ " ",
+ " //this.inspector = null;",
+ " ",
+ " ",
+ " }",
+ " return true;",
+ " ",
+ " });",
+ " this.inspector.show();",
+ " ",
+ " ",
+ " ",
+ "}",
""
],
- "* pack" : "pack_end,true,true,0",
- "id" : "viewcontainer",
- "items" : [
- {
- "# GLib.DateTime lastRedraw" : "null",
- "# WebKit.WebInspector inspector" : "",
- "# bool pendingRedraw" : false,
- "# bool refreshRequired" : false,
- "# int redraws" : 0,
- "# string renderedData" : "\"\"",
- "# string runhtml" : "\"\"",
- "# string runjs" : "\"\"",
- "$ xns" : "WebKit",
- "* init" : [
- " {",
- " // 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;",
- " });",
- " ",
- " ",
- "}",
- ""
- ],
- "* pack" : "add",
- "id" : "view",
- "listeners" : {
- "drag_drop" : [
- " ( ctx, x, y,time, ud) => {",
- " return false;",
- " /*",
- "\tprint(\"TARGET: drag-drop\");",
- " var is_valid_drop_site = true;",
- " ",
- " ",
- " Gtk.drag_get_data",
- " (",
- " w, // will receive 'drag-data-received' signal ",
- " ctx, /* represents the current state of the DnD ",
- " this.get('/Window').atoms[\"STRING\"], /* the target type we want ",
- " time /* time stamp ",
- " );",
- " ",
- " ",
- " /* No target offered by source => error ",
- " ",
- "",
- "\treturn is_valid_drop_site;",
- "\t*/",
- "}"
- ],
- "load_changed" : [
- "(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 = \"\";",
- "}"
- ],
- "script_dialog" : [
- " (dialog) => {",
- " ",
- " ",
- " if (this.el == null) {",
- " return true;",
- " }",
- " ",
- " var msg = dialog.get_message();",
- " if (msg.length < 4) {",
- " return false;",
- " }",
- " if (msg.substring(0,4) != \"IPC:\") {",
- " return false;",
- " }",
- " var ar = msg.split(\":\", 3);",
- " if (ar.length < 3) {",
- " return false;",
- " }",
- "",
- " switch(ar[1]) {",
- " case \"SAVEHTML\":",
- "\t print(\"GOT saveHTML %d?\\n\", ar[2].length);",
- " _this.file.saveHTML(ar[2]);",
- " return true;",
- " default:",
- " return false;",
- " }",
- " ",
- "}"
- ],
- "show" : [
- " ( ) => {",
- " this.initInspector();;",
- "}"
- ]
- },
- "xtype" : "WebView",
- "| void initInspector" : [
- "() {",
- " ",
- " /* if (this.inspector == this.el.get_inspector()) {",
- " this.inspector.show();",
- " this.inspector.open_window(); ",
- " print(\"init inspecter called, and inspector is the same as existing\\n\");",
- " return;",
- " }",
- " print(\"new inspector?\\n\");",
- "*/",
- " this.inspector = this.el.get_inspector();",
- " this.inspector.ref();",
- " ",
- " // got a new inspector...",
- " ",
- " this.inspector.open_window.connect(() => {",
- " this.inspector = this.el.get_inspector();",
- " 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_child();",
- " if (cn != null) {",
- " _this.inspectorcontainer.el.remove(cn);",
- " }",
- " ",
- " _this.inspectorcontainer.el.add(wv);",
- " wv.show();",
- " } else {",
- " //this.inspector.close();",
- " ",
- " //this.inspector = null;",
- " ",
- " ",
- " }",
- " return true;",
- " ",
- " });",
- " /*",
- " this.inspector.closed.connect(() => {",
- " print(\"inspector closed?!?\");",
- " // 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.el.remove(_this.inspectorcontainer.el); ",
- " ",
- " // destory seems to cause problems.",
- " //this.el.destroy();",
- " //_this.viewcontainer.el.destroy();",
- " //_this.inspectorcontainer.el.destroy();",
- "",
- " this.el = null; ",
- " var nv =new Xcls_viewcontainer(_this);",
- " nv.ref();",
- " _this.viewbox.el.pack_end(nv.el,true,true,0);",
- " ",
- " var inv =new Xcls_inspectorcontainer(_this);",
- " inv.ref();",
- " _this.el.pack2(inv.el,true,true);",
- " ",
- " inv.el.show_all();",
- " nv.el.show_all();",
- " //while(Gtk.events_pending ()) Gtk.main_iteration ();",
- " //_this.view.renderJS(true); ",
- " _this.view.refreshRequired = true;",
- " ",
- " }); ",
- " */",
- " ",
- " this.inspector.show();",
- "}",
- ""
- ],
- "| 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);",
- " inv.ref();",
- " _this.paned.el.pack2(inv.el,true,true);",
- " ",
- " ",
- " this.el = null; ",
- " var nv =new Xcls_viewcontainer(_this);",
- " nv.ref();",
- " _this.viewbox.el.pack_end(nv.el,true,true,0);",
- " ",
- " ",
- " inv.el.show_all();",
- " nv.el.show_all();",
- " //while(Gtk.events_pending ()) Gtk.main_iteration ();",
- " //_this.view.renderJS(true); ",
- " _this.view.refreshRequired = true;",
- "}",
- ""
- ],
- "| 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;",
- "}",
- ""
- ],
- "| 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 = _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 = _this.file.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 + \"\\n\" +",
- "\t\"Roo.onReady(function() {\\n\" +",
- "\t\"if (\" + _this.file.name +\".show) \" + _this.file.name +\".show({});\\n\" +",
- "\t\"Roo.XComponent.build();\\n\" +",
- "\t\"});\\n\";",
- "\t",
- " // 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 = _this.file.project.rootURL;",
- " ",
- " ",
- " ",
- " this.el.load_html( html , ",
- " //fixme - should be a config option!",
- " (rootURL.length > 0 ? rootURL : \"xhttp://localhost/roobuilder/\")",
- " );",
- " ",
- " // 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()));",
- " ",
- "}",
- " "
- ]
- }
+ "| 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;",
+ " ",
+ " */",
+ "}",
+ ""
],
- "xtype" : "ScrolledWindow"
+ "| 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;",
+ "}",
+ ""
+ ],
+ "| 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) {",
+ "\t\t\" + _this.file.name +\".show({});",
+ "\t\t(function() { ",
+ "\t\t\tBuilder.saveHTML.defer(100, Builder);",
+ "\t\t}).defer(100);",
+ "}",
+ "Roo.XComponent.build();",
+ "});\\n\";",
+ "\t",
+ " // 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()));",
+ " ",
+ "}",
+ " "
+ ]
}
],
"xtype" : "Box"
},
{
- "$ shadow_type" : "Gtk.ShadowType.IN",
"$ xns" : "Gtk",
- "* init" : [
- " this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
- " ",
- ""
- ],
- "* pack" : "pack2,true,true",
+ "* pack" : "set_end_child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool vexpand" : true,
"id" : "inspectorcontainer",
- "xtype" : "ScrolledWindow"
+ "xtype" : "Box"
}
],
"xtype" : "Paned"
"$ xns" : "Gtk",
"* pack" : "append_page,_this.label_code.el",
"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "bool vexpand" : true,
"int spacing" : 0,
"items" : [
{
"$ xns" : "Gtk",
"bool vexpand" : true,
+ "id" : "sourceviewscroll",
"items" : [
{
"# JsRender.Node? node_selected" : "null",
"# bool loading" : true,
"# int editable_start_pos" : "-1",
"# string prop_selected" : "\"\"",
- "$ xns" : "Gtk",
+ "$ xns" : "GtkSource",
"* init" : [
"{",
" ",
" this.css = new Gtk.CssProvider();",
- "\ttry {",
- "\t\tthis.css.load_from_data(\"#roo-view { font: 10px Monospace;}\");",
- "\t} catch (Error e) {}",
- "\tthis.el.get_style_context().add_provider(this.css,",
- "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION);",
"\t ",
+ "\tthis.css.load_from_string(",
+ "\t\t\"#roo-view { font: 10px monospace; }\"",
+ "\t);",
+ " ",
+ "\tGtk.StyleContext.add_provider_for_display(",
+ "\t\tthis.el.get_display(),",
+ "\t\tthis.css,",
+ "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
+ "\t);",
+ "\t\t",
"\t ",
" ",
" this.loading = true;",
" //buf.notify.connect(this.onCursorChanged);",
" ",
" ",
- " var attrs = new Gtk.SourceMarkAttributes();",
+ " var attrs = new GtkSource.MarkAttributes();",
" var pink = Gdk.RGBA();",
" pink.parse ( \"pink\");",
" attrs.set_background ( pink);",
" ",
" this.el.set_mark_attributes (\"ERR\", attrs, 1);",
" ",
- " var wattrs = new Gtk.SourceMarkAttributes();",
+ " var wattrs = new GtkSource.MarkAttributes();",
" var blue = Gdk.RGBA();",
" blue.parse ( \"#ABF4EB\");",
" wattrs.set_background ( blue);",
" ",
" ",
" ",
- " var dattrs = new Gtk.SourceMarkAttributes();",
+ " var dattrs = new GtkSource.MarkAttributes();",
" var purple = Gdk.RGBA();",
" purple.parse ( \"#EEA9FF\");",
" dattrs.set_background ( purple);",
" this.el.set_mark_attributes (\"DEPR\", dattrs, 1);",
" ",
" ",
- " var gattrs = new Gtk.SourceMarkAttributes();",
+ " var gattrs = new GtkSource.MarkAttributes();",
" var grey = Gdk.RGBA();",
" grey.parse ( \"#ccc\");",
" gattrs.set_background ( grey);",
"}",
" "
],
- "* pack" : "add",
+ "* pack" : "set_child",
"Gtk.CssProvider css" : "",
"gboolean editable" : false,
"gboolean show_line_marks" : true,
"id" : "sourceview",
"items" : [
{
- "$ xns" : "Gtk",
+ "$ xns" : "GtkSource",
"* pack" : "set_buffer",
"bool dirty" : false,
"id" : "buffer",
"listeners" : {
"changed" : [
" () => {",
- " ",
- "",
+ " ",
" // check syntax??",
" // ??needed..??",
" // _this.save_button.el.sensitive = true;",
" print(\"- PREVIEW EDITOR CHANGED--\");",
"",
" this.dirty = true; ",
- " this.checkSyntax(); // this calls backs and highlights errors.. in theory... ",
+ " // this.checkSyntax(); // this calls backs and highlights errors.. in theory... ",
"",
"",
"",
"\t",
"\tif (_this.sourceview.editable_start_pos > -1) {",
"\t\t",
- "\t\tvar buf = (Gtk.SourceBuffer)_this.sourceview.el.get_buffer();",
+ "\t\tvar buf = (GtkSource.Buffer)_this.sourceview.el.get_buffer();",
"\t\t",
" //print(\"cursor changed : %d\\n\", buf.cursor_position);",
" Gtk.TextIter spos,epos;",
""
]
},
- "xtype" : "SourceBuffer",
- "| 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, \"WARN\");",
- " this.el.remove_source_marks (start, end, \"ERR\"); ",
- "",
- " }",
- " ",
- " if (str.length < 1) {",
- " print(\"checkSyntax - empty string?\\n\");",
- " return false;",
- " }",
- " ",
- " if (_this.file == null) {",
- " return false;",
- " }",
- " var p = _this.file.project.palete;",
- " ",
- " ",
- " if (_this.file.language != \"js\") {",
- "\t\treturn false; // fake syntax error.",
- "\t}",
- "\t",
- " //Gee.HashMap<int,string> ret_x;",
- "",
- "\treturn p.javascriptHasErrors(",
- "\t\t_this.main_window.windowstate,",
- " str, ",
- " null, // prop - not relivant.",
- " _this.file, ",
- " null",
- " ); ",
- " ",
- "}",
- ""
- ],
+ "xtype" : "Buffer",
"| bool highlightErrors" : [
"( Gee.HashMap<int,string> validate_res) {",
" ",
"}",
" "
]
+ },
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "add_controller",
+ "listeners" : {
+ "key_pressed" : [
+ "(keyval, keycode, state) => {",
+ "",
+ " ",
+ " ",
+ " \tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
+ "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
+ "\t\t_this.forwardSearch(true);",
+ "\t return false;",
+ "\t}",
+ "\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 return false ;",
+ "\t}",
+ " ",
+ "\t//this.button_is_pressed = true;",
+ "\t//return false;",
+ " // print(event.key.keyval)",
+ " ",
+ " return false;",
+ " ",
+ " ",
+ "}",
+ ""
+ ]
+ },
+ "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" : {
- "button_press_event" : [
- "( ) => {",
- " ",
- "\tthis.button_is_pressed = true;",
- "\treturn false;",
- "}\t ",
- ""
- ],
- "button_release_event" : [
- "() => {",
- "",
- "\tprint(\"BUTTON RELEASE EVENT\\n\");",
- "\tthis.onCursorChanged();",
- "\tthis.button_is_pressed = false;",
- "\treturn false;",
- "}"
- ],
- "key_press_event" : [
- " (event) => {",
+ "query_tooltip" : [
+ "(x, y, keyboard_tooltip, tooltip) => {",
"\t",
- "\tif (event.keyval == Gdk.Key.g && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
- "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
- "\t\t_this.forwardSearch(true);",
- "\t return true;",
- "\t}",
- "\tif (event.keyval == Gdk.Key.f && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
- "\t GLib.debug(\"SAVE: ctrl-f pressed\");",
- "\t\t_this.search_entry.el.grab_focus();",
- "\t return true;",
+ "\t//GLib.debug(\"query tooltip\");",
+ "\tGtk.TextIter iter;",
+ "\tint trailing;",
+ "\t",
+ "\tvar yoff = (int) _this.sourceviewscroll.el.vadjustment.value;",
+ "\t",
+ "\tthis.el.get_iter_at_position (out iter, out trailing, x, y + yoff);",
+ "\t ",
+ "\tvar l = iter.get_line();",
+ "\t//GLib.debug(\"query tooltip line %d\", (int) l);",
+ "\tvar marks = _this.buffer.el.get_source_marks_at_line(l, null);",
+ "\t//GLib.debug(\"query tooltip line marks %d\", (int) marks.length());",
+ "\tvar str = \"\";",
+ "\tmarks.@foreach((m) => { ",
+ "\t\t//GLib.debug(\"got mark %s\", m.name);",
+ "\t\tstr += (str.length > 0 ? \"\\n\" : \"\") + m.name;",
+ "\t});",
+ "\t// true if there is a mark..",
+ "\tif (str.length > 0 ) {",
+ "\t\t\ttooltip.set_text( str);",
"\t}",
- " ",
- "\tthis.button_is_pressed = true;",
- "\treturn false;",
- "}\t ",
- " "
- ],
- "key_release_event" : [
- "() => { ",
- "\tthis.key_is_pressed = false;",
- "\treturn false;",
- "}",
- ""
+ "\treturn str.length > 0 ? true : false;",
+ "",
+ "}"
]
},
"string name" : "roo-view",
- "xtype" : "SourceView",
+ "xtype" : "View",
"| string toString" : [
"() {",
" Gtk.TextIter s;",
"| void clearGreySelection" : [
"() {",
" // clear all the marks..",
- " var sbuf = (Gtk.SourceBuffer)this.el.buffer;",
+ " var sbuf = (GtkSource.Buffer)this.el.buffer;",
" ",
" Gtk.TextIter start;",
" Gtk.TextIter end; ",
" ",
" ",
" buf.set_text(\"\",0);",
- " var sbuf = (Gtk.SourceBuffer) buf;",
+ " var sbuf = (GtkSource.Buffer) buf;",
"",
" ",
"",
" ",
"// print(\"setting str %d\\n\", str.length);",
" buf.set_text(str, str.length);",
- " var lm = Gtk.SourceLanguageManager.get_default();",
+ " var lm = GtkSource.LanguageManager.get_default();",
" ",
" //?? is javascript going to work as js?",
" ",
- " ((Gtk.SourceBuffer)(buf)) .set_language(lm.get_language(_this.file.language));",
+ " ((GtkSource.Buffer)(buf)) .set_language(lm.get_language(_this.file.language));",
" ",
" ",
" Gtk.TextIter start;",
"\t\tthis.onCursorChanged();",
"\t\t",
"\t\t",
- "\t\t_this.buffer.checkSyntax();",
+ "\t\t//_this.buffer.checkSyntax();",
"\t\treturn false;",
"\t});",
"\t\t",
"",
"",
"\t// not sure why.... ",
- " while(Gtk.events_pending()) {",
- " Gtk.main_iteration();",
- " }",
+ " // while(Gtk.events_pending()) {",
+ " // Gtk.main_iteration();",
+ " // }",
" ",
" this.node_selected = sel;",
" ",
" return;",
" }",
" var prop = node.lineToProp(ln+1);",
- " print(\"prop : %s\", prop == null ? \"???\" : prop);",
+ " print(\"prop : %s\", prop == null ? \"???\" : prop.name);",
" ",
" ",
" // ---------- this selects the tree's node...",
" ",
" var ltree = _this.main_window.windowstate.left_tree;",
- " var tp = ltree.model.treePathFromNode(node);",
- " print(\"got tree path %s\\n\", tp);",
- " if (tp != \"\") {",
- "\t ",
- "\t ",
- "\t //print(\"changing cursor on tree..\\n\");",
+ " ltree.model.selectNode(node);",
+ " ",
"\t ",
- " ",
- " ",
- " // 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\") {",
+ " //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\t//var k = prop.get_key(kv[1]);",
- "\t \t\t// fixme -- need to determine if it's an editable property...",
- "\t \t\tthis.prop_selected = prop;",
- "\t \t\t",
- " \t\t} else if (kv[0] == \"l\") {",
- " \t\t\t this.prop_selected = prop;",
- " \t\t\t",
- " \t\t}",
- " }",
- " ltree.view.setCursor(tp, \"editor\");",
+ " \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..",
"}",
"\tvar sel = this.node_selected;",
"\tprint(\"node selected\\n\");",
" var buf = this.el.get_buffer();",
- " var sbuf = (Gtk.SourceBuffer) buf;",
+ " var sbuf = (GtkSource.Buffer) buf;",
"",
" ",
" this.clearGreySelection();",
{
"$ xns" : "Gtk",
"* init" : [
- "\tthis.css = new Gtk.CssProvider();",
- "\ttry {",
- "\t\tthis.css.load_from_data(\"#roo-search-entry { background-color: #ccc; }\");",
- "\t} catch (Error e) {}",
- "\tthis.el.get_style_context().add_provider(this.css,",
- "\t\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION);",
+ "this.css = new Gtk.CssProvider();",
+ " ",
+ "this.css.load_from_string(",
+ "\t\"#roo-search-entry { background-color: #ccc; }\"",
+ ");",
+ " ",
+ "Gtk.StyleContext.add_provider_for_display(",
+ "\tthis.el.get_display(),",
+ "\tthis.css,",
+ "\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
+ ");",
+ "\t\t",
"\t ",
" ",
""
"Gtk.CssProvider css" : "",
"bool hexpand" : true,
"id" : "search_entry",
- "int width_request" : 300,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "listeners" : {
+ "key_pressed" : [
+ "(keyval, keycode, state) => {",
+ "",
+ "\tif (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
+ "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
+ "\t\t_this.forwardSearch(true);",
+ "\t return true;",
+ "\t}",
+ " ",
+ " ",
+ " \tif (keyval == Gdk.Key.Return) {",
+ "\t\t_this.forwardSearch(true);",
+ "\t\t",
+ "\t\t",
+ "\t return true;",
+ "",
+ "\t} ",
+ " // print(event.key.keyval)",
+ " ",
+ " return false;",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "EventControllerKey"
+ }
+ ],
"listeners" : {
- "changed" : [
- "() => {",
- "\t/*",
- "\tif (this.el.text == \"\") {",
- "\t\t_this.search_results.el.hide();",
- "\t\treturn;",
- "\t}",
- "\tvar res = 0;",
- "\tswitch(_this.windowstate.state) {",
- "\t\tcase WindowState.State.CODEONLY:",
- "\t\t///case WindowState.State.CODE:",
- "\t\t\t// search the code being edited..",
- "\t\t\tres = _this.windowstate.code_editor_tab.search(this.el.text);",
- "\t\t\t",
- "\t\t\tbreak;",
- "\t\tcase WindowState.State.PREVIEW:",
- "\t\t\tif (_this.windowstate.file.xtype == \"Gtk\") {",
- "\t\t\t\t res = _this.windowstate.window_gladeview.search(this.el.text);",
- "\t\t\t} else { ",
- "\t\t\t\t res = _this.windowstate.window_rooview.search(this.el.text);\t\t\t",
- "\t\t\t}",
- "\t\t",
- "\t\t",
- "\t\t\tbreak;",
- "\t}",
- "\t_this.search_results.el.show();",
- "\tif (res > 0) {",
- "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
- "\t} else {",
- "\t\t_this.search_results.el.label = \"No Matches\";",
- "\t}",
- "\t\t",
- "\t*/",
- "\t",
- "}",
- ""
- ],
- "key_press_event" : [
- "(event) => {",
- " if (event.keyval == Gdk.Key.g && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
- "\t GLib.debug(\"SAVE: ctrl-g pressed\");",
- "\t\t_this.forwardSearch(true);",
- "\t return true;",
- "\t}",
- " ",
- " ",
- " \tif (event.keyval == Gdk.Key.Return && this.el.text.length > 0) {",
- "\t\t _this.search(this.el.text);",
- "\t\t _this.search_results.updateResults();",
- "",
- "\t\tGLib.Timeout.add_seconds(2,() => {",
- "\t\t\t _this.search_results.updateResults();",
- "\t\t\t return false;",
- "\t\t });",
- "\t ",
- "\t\t",
- "\t return true;",
+ "search_changed" : [
+ "( ) => {",
"",
- "\t} ",
- " // print(event.key.keyval)",
- " ",
- " return false;",
+ "_this.search(_this.search_entry.el.text);",
+ "\t _this.search_results.updateResults();",
"",
- "} "
+ "\tGLib.Timeout.add_seconds(1,() => {",
+ "\t\t _this.search_results.updateResults();",
+ "\t\t return false;",
+ "\t });",
+ "}",
+ ""
]
},
"string name" : "roo-search-entry",
},
{
"$ xns" : "Gtk",
- "* pack" : "add",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "bool always_show_image" : true,
- "bool visible" : false,
- "id" : "search_results",
- "listeners" : {
- "button_press_event" : [
- "() => {",
- "/*",
- " if (this.popup == null) {",
- " this.popup = new Xcls_ValaCompileErrors();",
- " this.popup.window = _this;",
- " }",
- " ",
- " ",
- " this.popup.show(this.notices, this.el);",
- " */",
- " return true;",
- "}"
- ]
- },
- "xtype" : "MenuItem",
- "| void updateResults" : [
- "() {",
- "\tthis.el.visible = true;",
- "\t",
- "\tvar res = _this.searchcontext.get_occurrences_count();",
- "\tif (res < 0) {",
- "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
- "\t\treturn;",
- "\t}",
- "",
- "\t_this.nextBtn.el.sensitive = false;",
- "\t_this.backBtn.el.sensitive = false;\t",
- "",
- "\tif (res > 0) {",
- "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
- "\t\t_this.nextBtn.el.sensitive = true;",
- "\t\t_this.backBtn.el.sensitive = true;",
- "\t\treturn;",
- "\t} ",
- "\t_this.search_results.el.label = \"No Matches\";",
- "\t",
- "}"
- ]
- }
- ],
- "xtype" : "MenuBar"
+ "id" : "search_results",
+ "int margin_end" : 4,
+ "int margin_start" : 4,
+ "string label" : "No Results",
+ "xtype" : "Label",
+ "| void updateResults" : [
+ "() {",
+ "\tthis.el.visible = true;",
+ "\t",
+ "\tvar res = _this.searchcontext.get_occurrences_count();",
+ "\tif (res < 0) {",
+ "\t\t_this.search_results.el.label = \"??? Matches\";\t\t",
+ "\t\treturn;",
+ "\t}",
+ "",
+ "\t_this.nextBtn.el.sensitive = false;",
+ "\t_this.backBtn.el.sensitive = false;\t",
+ "",
+ "\tif (res > 0) {",
+ "\t\t_this.search_results.el.label = \"%d Matches\".printf(res);",
+ "\t\t_this.nextBtn.el.sensitive = true;",
+ "\t\t_this.backBtn.el.sensitive = true;",
+ "\t\treturn;",
+ "\t} ",
+ "\t_this.search_results.el.label = \"No Matches\";",
+ "\t",
+ "}"
+ ]
},
{
"$ xns" : "Gtk",
"bool always_show_image" : true,
"bool sensitive" : false,
"id" : "nextBtn",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* prop" : "image",
- "string icon_name" : "go-down",
- "xtype" : "Image"
- }
- ],
"listeners" : {
- "button_press_event" : [
+ "clicked" : [
"(event) => {",
"",
"\t_this.forwardSearch(true);",
- "\t",
- "\treturn true;",
+ "\t ",
"}",
""
]
},
- "string label" : "Next",
+ "string icon_name" : "go-down",
"xtype" : "Button"
},
{
"bool always_show_image" : true,
"bool sensitive" : false,
"id" : "backBtn",
- "items" : [
- {
- "$ xns" : "Gtk",
- "* prop" : "image",
- "string icon_name" : "go-up",
- "xtype" : "Image"
- }
- ],
"listeners" : {
- "button_press_event" : [
+ "clicked" : [
"(event) => {",
"",
"\t_this.backSearch(true);",
"\t",
- "\treturn true;",
+ "\t ",
"}",
""
]
},
- "string label" : "Previous",
+ "string icon_name" : "go-up",
"xtype" : "Button"
},
{
"items" : [
{
"$ xns" : "Gtk",
- "* prop" : "image",
- "string icon_name" : "emblem-system",
- "xtype" : "Image"
- },
- {
- "$ xns" : "Gtk",
- "* prop" : "popup",
+ "* pack" : false,
+ "* prop" : "popover",
"id" : "search_settings",
"items" : [
{
"$ xns" : "Gtk",
- "* init" : [
- "{",
- "\tthis.el.show();",
- "}",
- ""
+ "* prop" : "child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+ "int spacing" : 0,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ "\tthis.el.show();",
+ "}",
+ ""
+ ],
+ "id" : "case_sensitive",
+ "string label" : "Case Sensitive",
+ "xtype" : "CheckButton"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ "\tthis.el.show();",
+ "}",
+ ""
+ ],
+ "id" : "regex",
+ "string label" : "Regex",
+ "xtype" : "CheckButton"
+ },
+ {
+ "$ xns" : "Gtk",
+ "* init" : [
+ "{",
+ "\tthis.el.show();",
+ "}",
+ ""
+ ],
+ "id" : "multiline",
+ "string label" : "Multi-line (add \\n)",
+ "xtype" : "CheckButton"
+ }
],
- "id" : "case_sensitive",
- "string label" : "Case Sensitive",
- "xtype" : "CheckMenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- "{",
- "\tthis.el.show();",
- "}",
- ""
- ],
- "id" : "regex",
- "string label" : "Regex",
- "xtype" : "CheckMenuItem"
- },
- {
- "$ xns" : "Gtk",
- "* init" : [
- "{",
- "\tthis.el.show();",
- "}",
- ""
- ],
- "id" : "multiline",
- "string label" : "Multi-line (add \\n)",
- "xtype" : "CheckMenuItem"
+ "xtype" : "Box"
}
],
- "xtype" : "Menu"
+ "xtype" : "Popover"
}
],
- "string label" : "Settings",
+ "string icon_name" : "emblem-system",
"xtype" : "MenuButton"
}
],
"\t",
" ",
" ",
- "\tvar s = new Gtk.SourceSearchSettings();",
+ "\tvar s = new GtkSource.SearchSettings();",
"\ts.case_sensitive = _this.case_sensitive.el.active;",
"\ts.regex_enabled = _this.regex.el.active;\t",
"\ts.wrap_around = false;",
"\t",
- "\tthis.searchcontext = new Gtk.SourceSearchContext(this.buffer.el,s);",
+ "\tthis.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);",
"\tthis.searchcontext.set_highlight(true);",
"\tvar txt = in_txt;",
"\t",
"\tGtk.TextIter beg, st,en;",
"\tbool has_wrapped_around;",
"\tthis.buffer.el.get_start_iter(out beg);",
- "\tthis.searchcontext.forward2(beg, out st, out en, out has_wrapped_around);",
+ "\tthis.searchcontext.forward(beg, out st, out en, out has_wrapped_around);",
"\tthis.last_search_end = 0;",
"\t",
"\treturn this.searchcontext.get_occurrences_count();",
"\tbool has_wrapped_around;",
"\tthis.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );",
"\t",
- "\tif (!this.searchcontext.backward2(beg, out st, out en, out has_wrapped_around)) {",
+ "\tif (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {",
"\t",
"\t\tthis.last_search_end = 0;",
"\t\treturn;",
" if (this.file == null) {",
" return;",
" }",
+ " ",
"\tif (this.notebook.el.page > 0 ) {",
" return;",
" }",
" ",
- " ",
- " var win = this.el.get_parent_window();",
- " var width = win.get_width();",
- " // var height = win.get_height();",
- " ",
- " Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, this.paned.el.position);",
- " this.file.writeIcon(screenshot);",
- " ",
- " ",
+ " \tthis.file.widgetToIcon(this.view.el); ",
"",
" ",
" ",
"\tbool has_wrapped_around;",
"\tvar buf = this.sourceview.el.get_buffer();",
"\tbuf.get_iter_at_offset(out beg, this.last_search_end);",
- "\tif (!this.searchcontext.forward2(beg, out st, out en, out has_wrapped_around)) {",
+ "\tif (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {",
"\t\tthis.last_search_end = 0;",
"\t\treturn;",
"\t}",
" return;",
" }",
" var prop = node.lineToProp(ln+1);",
- " print(\"prop : %s\", prop == null ? \"???\" : prop);",
+ " print(\"prop : %s\", prop == null ? \"???\" : prop.name);",
" ",
" ",
" // ---------- this selects the tree's node...",
" ",
" var ltree = _this.main_window.windowstate.left_tree;",
- " var tp = ltree.model.treePathFromNode(node);",
- " print(\"got tree path %s\\n\", tp);",
- " if (tp == \"\") {",
- "\t\treturn;",
- "\t}",
+ " ltree.model.selectNode(node);",
+ " ",
" //_this.sourceview.allow_node_scroll = false; /// block node scrolling..",
"\t ",
" ",
" // let's try allowing editing on the methods.",
" // a little klunky at present..",
"\t_this.sourceview.prop_selected = \"\";",
+ "\t/*",
" if (prop != null) {",
"\t\t//see if we can find it..",
"\t\tvar kv = prop.split(\":\");",
"\t\t\t",
"\t\t}",
" }",
- " ltree.view.setCursor(tp, \"editor\");",
+ " */",
" // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false); ",
" _this.sourceview.nodeSelected(node,false);",
" ",
" this.view.renderJS(true);",
" this.notebook.el.page = 0;// gtk preview ",
" this.sourceview.loadFile(); ",
- " ",
"}",
" ",
" "
"\t ",
"\t\t var buf = this.sourceview.el.get_buffer();",
"\t ",
- "\t\tvar sbuf = (Gtk.SourceBuffer) buf;",
+ "\t\tvar sbuf = (GtkSource.Buffer) buf;",
"",
"",
"\t\tGtk.TextIter iter; ",
]
}
],
- "modOrder" : "",
- "name" : "WindowRooView",
- "parent" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/WindowRooView.bjs",
- "permname" : "",
- "title" : ""
+ "name" : "WindowRooView"
}
\ No newline at end of file
-static Xcls_WindowRooView _WindowRooView;
+ static Xcls_WindowRooView _WindowRooView;
-public class Xcls_WindowRooView : Object
-{
- public Gtk.Box el;
- private Xcls_WindowRooView _this;
-
- public static Xcls_WindowRooView singleton()
+ public class Xcls_WindowRooView : Object
{
- if (_WindowRooView == null) {
- _WindowRooView= new Xcls_WindowRooView();
+ public Gtk.Box el;
+ private Xcls_WindowRooView _this;
+
+ public static Xcls_WindowRooView singleton()
+ {
+ if (_WindowRooView == null) {
+ _WindowRooView= new Xcls_WindowRooView();
+ }
+ return _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_viewcontainer viewcontainer;
- public Xcls_view view;
- public Xcls_inspectorcontainer inspectorcontainer;
- 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 Gtk.SourceSearchContext searchcontext;
- public int last_search_end;
- 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;
- var child_0 = new Xcls_notebook( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true,true,0 );
- }
+ 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;
- // 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;
+ // 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 );
}
- var prop = node.lineToProp(ln+1);
- print("prop : %s", prop == null ? "???" : prop);
-
-
- // ---------- this selects the tree's node...
+
+ // 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) {
- var ltree = _this.main_window.windowstate.left_tree;
- 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;
+
+ // highlight node...
+
- } 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 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.forward2(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.backward2(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 Gtk.SourceSearchSettings();
- s.case_sensitive = _this.case_sensitive.el.active;
- s.regex_enabled = _this.regex.el.active;
- s.wrap_around = false;
-
- this.searchcontext = new Gtk.SourceSearchContext(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.forward2(beg, out st, out en, out has_wrapped_around);
- this.last_search_end = 0;
-
- return this.searchcontext.get_occurrences_count();
-
-
+ 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");
+
-
- }
- public void createThumb () {
+
+ // 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.file == null) {
- return;
+ 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);
}
- if (this.notebook.el.page > 0 ) {
- return;
+ 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();
+
+
- var win = this.el.get_parent_window();
- var width = win.get_width();
- // var height = win.get_height();
+ }
+ public void createThumb () {
+
+
+ if (this.file == null) {
+ return;
+ }
+
+ if (this.notebook.el.page > 0 ) {
+ return;
+ }
+
+ this.file.widgetToIcon(this.view.el);
- Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, this.paned.el.position);
- this.file.writeIcon(screenshot);
+
+
+
+ }
+ 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 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 = (Gtk.SourceBuffer) 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
- var child_0 = new Xcls_label_preview( _this );
- child_0.ref();
- var child_1 = new Xcls_label_code( _this );
- child_1.ref();
- var child_2 = new Xcls_paned( _this );
- child_2.ref();
- this.el.append_page ( child_2.el , _this.label_preview.el );
- var child_3 = new Xcls_Box14( _this );
- child_3.ref();
- this.el.append_page ( child_3.el , _this.label_code.el );
+
}
+ public class Xcls_notebook : Object
+ {
+ public Gtk.Notebook el;
+ private Xcls_WindowRooView _this;
- // user defined functions
- }
- public class Xcls_label_preview : Object
- {
- public Gtk.Label el;
- private Xcls_WindowRooView _this;
+ // my vars (def)
- // 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 );
+ }
- // ctor
- public Xcls_label_preview(Xcls_WindowRooView _owner )
+ // user defined functions
+ }
+ public class Xcls_label_preview : Object
{
- _this = _owner;
- _this.label_preview = this;
- this.el = new Gtk.Label( "Preview" );
+ public Gtk.Label el;
+ private Xcls_WindowRooView _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_label_preview(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.label_preview = this;
+ this.el = new Gtk.Label( "Preview" );
- public class Xcls_label_code : Object
- {
- public Gtk.Label el;
- private Xcls_WindowRooView _this;
+ // my vars (dec)
+ // set gobject values
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_label_code(Xcls_WindowRooView _owner )
+ public class Xcls_label_code : Object
{
- _this = _owner;
- _this.label_code = this;
- this.el = new Gtk.Label( "Preview Generated Code" );
+ public Gtk.Label el;
+ private Xcls_WindowRooView _this;
- // my vars (dec)
- // set gobject values
- }
+ // my vars (def)
- // user defined functions
- }
+ // ctor
+ public Xcls_label_code(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.label_code = this;
+ this.el = new Gtk.Label( "Preview Generated Code" );
- public class Xcls_paned : Object
- {
- public Gtk.Paned el;
- private Xcls_WindowRooView _this;
+ // my vars (dec)
+ // set gobject values
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_paned(Xcls_WindowRooView _owner )
+ public class Xcls_paned : Object
{
- _this = _owner;
- _this.paned = this;
- this.el = new Gtk.Paned( Gtk.Orientation.VERTICAL );
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_viewbox( _this );
- child_0.ref();
- this.el.pack1 ( child_0.el , true,true );
- var child_1 = new Xcls_inspectorcontainer( _this );
- child_1.ref();
- this.el.pack2 ( child_1.el , true,true );
- }
+ public Gtk.Paned el;
+ private Xcls_WindowRooView _this;
- // user defined functions
- }
- public class Xcls_viewbox : Object
- {
- public Gtk.Box el;
- private Xcls_WindowRooView _this;
+ // my vars (def)
- // 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 );
+ }
- // ctor
- public Xcls_viewbox(Xcls_WindowRooView _owner )
+ // user defined functions
+ }
+ public class Xcls_viewbox : Object
{
- _this = _owner;
- _this.viewbox = this;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ public Gtk.Box el;
+ private Xcls_WindowRooView _this;
- // my vars (dec)
- // set gobject values
- this.el.homogeneous = false;
- var child_0 = new Xcls_Box7( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,true,0 );
- var child_1 = new Xcls_viewcontainer( _this );
- child_1.ref();
- this.el.pack_end ( child_1.el , true,true,0 );
- }
+ // my vars (def)
- // user defined functions
- }
- public class Xcls_Box7 : Object
- {
- public Gtk.Box el;
- private Xcls_WindowRooView _this;
+ // 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;
- // my vars (def)
- // ctor
- public Xcls_Box7(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+ // my vars (def)
- // my vars (dec)
+ // 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 );
+ }
- // set gobject values
- this.el.homogeneous = true;
- this.el.height_request = 20;
- this.el.vexpand = false;
- var child_0 = new Xcls_Button8( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , false,false,0 );
- var child_1 = new Xcls_AutoRedraw( _this );
- child_1.ref();
- this.el.pack_start ( child_1.el , false,false,0 );
- var child_2 = new Xcls_Button10( _this );
- child_2.ref();
- this.el.pack_start ( child_2.el , false,false,0 );
+ // user defined functions
}
+ public class Xcls_Button8 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_WindowRooView _this;
- // user defined functions
- }
- public class Xcls_Button8 : Object
- {
- public Gtk.Button el;
- private Xcls_WindowRooView _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_Button8(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // ctor
- public Xcls_Button8(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.label = "Redraw";
- // set gobject values
- this.el.label = "Redraw";
+ //listeners
+ this.el.clicked.connect( ( ) => {
+ _this.view.renderJS( true);
+ });
+ }
- //listeners
- this.el.clicked.connect( ( ) => {
- _this.view.renderJS( true);
- });
+ // user defined functions
}
- // user defined functions
- }
+ public class Xcls_AutoRedraw : Object
+ {
+ public Gtk.CheckButton el;
+ private Xcls_WindowRooView _this;
- public class Xcls_AutoRedraw : Object
- {
- public Gtk.CheckButton el;
- private Xcls_WindowRooView _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_AutoRedraw(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.AutoRedraw = this;
+ this.el = new Gtk.CheckButton();
- // ctor
- public Xcls_AutoRedraw(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.AutoRedraw = this;
- this.el = new Gtk.CheckButton();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.active = true;
+ this.el.label = "Auto Redraw On";
- // 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");
+ });
+ }
- //listeners
- this.el.toggled.connect( (state) => {
- this.el.set_label(this.el.active ? "Auto Redraw On" : "Auto Redraw Off");
- });
+ // user defined functions
}
- // user defined functions
- }
-
- public class Xcls_Button10 : Object
- {
- public Gtk.Button el;
- private Xcls_WindowRooView _this;
+ public class Xcls_Button10 : Object
+ {
+ public Gtk.Button el;
+ private Xcls_WindowRooView _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Button10(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
+ // ctor
+ public Xcls_Button10(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Button();
- // my vars (dec)
+ // 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();
-
- });
- }
+ // set gobject values
+ this.el.label = "Full Redraw";
- // user defined functions
- }
+ //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_viewcontainer : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_WindowRooView _this;
+ 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;
- // my vars (def)
+ // set gobject values
+ this.el.vexpand = true;
- // ctor
- public Xcls_viewcontainer(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.viewcontainer = this;
- this.el = new Gtk.ScrolledWindow( null, null );
+ // init method
- // my vars (dec)
-
- // set gobject values
- this.el.shadow_type = Gtk.ShadowType.IN;
- var child_0 = new Xcls_view( _this );
- child_0.ref();
- this.el.add ( child_0.el );
-
- // init method
-
- this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
- }
-
- // 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
-
- // 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;
-
-
-
-
+ {
+ // 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/"
- );
+ // 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;
+ });
- //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) {
+ }
+
+ //listeners
+ this.el.script_dialog.connect( (dialog) => {
+
+
+ if (this.el == null) {
+ return true;
+ }
+
+ var msg = dialog.get_message();
+ if (msg.length < 4) {
return false;
}
- this.runRefresh();
- return true;
- });
+
+ 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 = "";
+ });
}
- //listeners
- this.el.script_dialog.connect( (dialog) => {
+ // user defined functions
+ public void initInspector () {
-
- if (this.el == null) {
- return true;
- }
-
- var msg = dialog.get_message();
- if (msg.length < 4) {
- return false;
- }
- if (msg.substring(0,4) != "IPC:") {
- return false;
- }
- var ar = msg.split(":", 3);
- if (ar.length < 3) {
- return false;
- }
-
- switch(ar[1]) {
- case "SAVEHTML":
- print("GOT saveHTML %d?\n", ar[2].length);
- _this.file.saveHTML(ar[2]);
- return true;
- default:
- return false;
- }
-
- });
- this.el.show.connect( ( ) => {
- this.initInspector();;
- });
- this.el.drag_drop.connect( ( ctx, x, y,time, ud) => {
- return false;
- /*
- print("TARGET: drag-drop");
- var is_valid_drop_site = true;
-
+
+
+ // this.inspector.open_window.connect(() => {
+ this.inspector = this.el.get_inspector();
- Gtk.drag_get_data
- (
- w, // will receive 'drag-data-received' signal
- ctx, /* represents the current state of the DnD
- this.get('/Window').atoms["STRING"], /* the target type we want
- time /* time stamp
- );
-
-
- /* No target offered by source => error
-
+ 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) {
- return is_valid_drop_site;
- */
- });
- this.el.load_changed.connect( (le) => {
- if (le != WebKit.LoadEvent.FINISHED) {
- return;
- }
- if (this.runjs.length < 1) {
+ // 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.el.run_javascript(this.runjs, null);
- FakeServerCache.remove( this.runjs);
- this.runjs = "";
- });
- }
-
- // user defined functions
- public void initInspector () {
-
- /* if (this.inspector == this.el.get_inspector()) {
- this.inspector.show();
- this.inspector.open_window();
- print("init inspecter called, and inspector is the same as existing\n");
- return;
+
+ this.refreshRequired = true;
}
- print("new inspector?\n");
- */
- this.inspector = this.el.get_inspector();
- this.inspector.ref();
-
- // got a new inspector...
-
- this.inspector.open_window.connect(() => {
- this.inspector = this.el.get_inspector();
- 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_child();
- if (cn != null) {
- _this.inspectorcontainer.el.remove(cn);
- }
-
- _this.inspectorcontainer.el.add(wv);
- wv.show();
- } else {
- //this.inspector.close();
-
- //this.inspector = null;
-
-
- }
- return true;
-
- });
- /*
- this.inspector.closed.connect(() => {
- print("inspector closed?!?");
- // if this happens destroy the webkit..
- // recreate it..
+ 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.el.remove(_this.inspectorcontainer.el);
-
- // destory seems to cause problems.
- //this.el.destroy();
- //_this.viewcontainer.el.destroy();
- //_this.inspectorcontainer.el.destroy();
-
+ //_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.pack_end(nv.el,true,true,0);
-
- var inv =new Xcls_inspectorcontainer(_this);
- inv.ref();
- _this.el.pack2(inv.el,true,true);
-
- inv.el.show_all();
- nv.el.show_all();
- //while(Gtk.events_pending ()) Gtk.main_iteration ();
- //_this.view.renderJS(true);
+ // 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;
-
- });
- */
-
- 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);
- inv.ref();
- _this.paned.el.pack2(inv.el,true,true);
-
+ */
+ }
+ public void runRefresh ()
+ {
+ // this is run every 2 seconds from the init..
+
- this.el = null;
- var nv =new Xcls_viewcontainer(_this);
- nv.ref();
- _this.viewbox.el.pack_end(nv.el,true,true,0);
+
+ 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");
- inv.el.show_all();
- nv.el.show_all();
- //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..
-
-
+ //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 (!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 ) {
+ if (js.length < 1) {
+ print("no data");
return;
}
- }
+ // var data = js[0];
+ this.redraws++;
+
+ var project = (Project.Roo) _this.file.project;
- if (_this.file == null) {
- return;
- }
+ //print (project.fn);
+ // set it to non-empty.
+
+ // runhtml = runhtml.length ? runhtml : '<script type="text/javascript"></script>';
- this.refreshRequired = false;
- // print("HTML RENDERING");
-
+ // this.runhtml = this.runhtml || '';
- //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 = _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;
+ // then we need to reload the browser using
+ // load_html_string..
- 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 = _this.file.project.base_template;
+ // then trigger a redraw once it's loaded..
+ this.pendingRedraw = true;
- 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 = "";
+ 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 = "";
+ }
- }
- try {
- GLib.FileUtils.get_contents(
- BuilderApplication.configDirectory() + "/resources/" +
- (base_template.length > 0 ? base_template : "roo.builder.html")
- , out inhtml);
+ runhtml += builderhtml + "\n";
+ runhtml += "</script>\n" ;
- } catch (Error e) {
- inhtml = "";
- }
- this.renderedData = js;
-
-
- string js_src = js + "\n" +
- "Roo.onReady(function() {\n" +
- "if (" + _this.file.name +".show) " + _this.file.name +".show({});\n" +
- "Roo.XComponent.build();\n" +
- "});\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;
+ // fix to make sure they are the same..
+ this.runhtml = project.runhtml;
+ // need to modify paths
- 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 = _this.file.project.rootURL;
-
+ 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 = "";
- this.el.load_html( html ,
- //fixme - should be a config option!
- (rootURL.length > 0 ? rootURL : "xhttp://localhost/roobuilder/")
- );
-
- // force the inspector...
- // this.initInspector();
+ }
+ try {
+ GLib.FileUtils.get_contents(
+ BuilderApplication.configDirectory() + "/resources/" +
+ (base_template.length > 0 ? base_template : "roo.builder.html")
+ , out inhtml);
- // - 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()));
+ } 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.ScrolledWindow el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
- // ctor
- public Xcls_inspectorcontainer(Xcls_WindowRooView _owner )
+ public class Xcls_inspectorcontainer : Object
{
- _this = _owner;
- _this.inspectorcontainer = this;
- this.el = new Gtk.ScrolledWindow( null, null );
+ public Gtk.Box el;
+ private Xcls_WindowRooView _this;
- // my vars (dec)
- // set gobject values
- this.el.shadow_type = Gtk.ShadowType.IN;
+ // my vars (def)
- // init method
+ // ctor
+ public Xcls_inspectorcontainer(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.inspectorcontainer = this;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
- this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
- }
+ // my vars (dec)
- // user defined functions
- }
+ // set gobject values
+ this.el.vexpand = true;
+ }
+ // user defined functions
+ }
- public class Xcls_Box14 : Object
- {
- public Gtk.Box el;
- private Xcls_WindowRooView _this;
+ public class Xcls_Box13 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_WindowRooView _this;
- // my vars (def)
- // ctor
- public Xcls_Box14(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+ // my vars (def)
- // my vars (dec)
+ // 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 );
+ }
- // set gobject values
- var child_0 = new Xcls_ScrolledWindow15( _this );
- child_0.ref();
- this.el.add( child_0.el );
- var child_1 = new Xcls_Box18( _this );
- child_1.ref();
- this.el.add( child_1.el );
+ // user defined functions
}
+ public class Xcls_sourceviewscroll : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private Xcls_WindowRooView _this;
- // user defined functions
- }
- public class Xcls_ScrolledWindow15 : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_WindowRooView _this;
+ // my vars (def)
- // my vars (def)
+ // ctor
+ public Xcls_sourceviewscroll(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.sourceviewscroll = this;
+ this.el = new Gtk.ScrolledWindow();
- // ctor
- public Xcls_ScrolledWindow15(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ this.el.vexpand = true;
+ new Xcls_sourceview( _this );
+ this.el.set_child ( _this.sourceview.el );
+ }
- // set gobject values
- this.el.vexpand = true;
- var child_0 = new Xcls_sourceview( _this );
- child_0.ref();
- this.el.add ( child_0.el );
+ // user defined functions
}
+ public class Xcls_sourceview : Object
+ {
+ public GtkSource.View el;
+ private Xcls_WindowRooView _this;
- // user defined functions
- }
- public class Xcls_sourceview : Object
- {
- public Gtk.SourceView 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;
- // my vars (def)
- public bool loading;
- public int editable_start_pos;
- 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();
- // ctor
- public Xcls_sourceview(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.sourceview = this;
- this.el = new Gtk.SourceView();
-
- // my vars (dec)
- this.loading = true;
- this.editable_start_pos = -1;
- 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;
- var child_0 = new Xcls_buffer( _this );
- child_0.ref();
- this.el.set_buffer ( child_0.el );
-
- // init method
-
- {
-
- this.css = new Gtk.CssProvider();
- try {
- this.css.load_from_data("#roo-view { font: 10px Monospace;}");
- } catch (Error e) {}
- this.el.get_style_context().add_provider(this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
-
-
+ // my vars (dec)
+ this.editable_start_pos = -1;
this.loading = true;
- //var buf = this.el.get_buffer();
- //buf.notify.connect(this.onCursorChanged);
-
-
- var attrs = new Gtk.SourceMarkAttributes();
- 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);
+ 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;
- var wattrs = new Gtk.SourceMarkAttributes();
- 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;
});
+ }
+
+ // user defined functions
+ public void loadFile ( ) {
+ this.loading = true;
- this.el.set_mark_attributes ("WARN", wattrs, 1);
-
-
-
- var dattrs = new Gtk.SourceMarkAttributes();
- 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);
+ // 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();
+
- var gattrs = new Gtk.SourceMarkAttributes();
- var grey = Gdk.RGBA();
- grey.parse ( "#ccc");
- gattrs.set_background ( grey);
+ buf.set_text("",0);
+ var sbuf = (GtkSource.Buffer) buf;
+
- this.el.set_mark_attributes ("grey", gattrs, 1);
-
-
-
+
+ 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));
+
- }
-
- //listeners
- this.el.button_release_event.connect( () => {
-
- print("BUTTON RELEASE EVENT\n");
- this.onCursorChanged();
- this.button_is_pressed = false;
- return false;
- });
- this.el.button_press_event.connect( ( ) => {
-
- this.button_is_pressed = true;
- return false;
- });
- this.el.key_press_event.connect( (event) => {
-
- if (event.keyval == Gdk.Key.g && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-g pressed");
- _this.forwardSearch(true);
- return true;
- }
- if (event.keyval == Gdk.Key.f && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-f pressed");
- _this.search_entry.el.grab_focus();
- return true;
- }
+ Gtk.TextIter start;
+ Gtk.TextIter end;
+
+ sbuf.get_bounds (out start, out end);
+ sbuf.remove_source_marks (start, end, null); // remove all marks..
- this.button_is_pressed = true;
- return false;
- });
- this.el.key_release_event.connect( () => {
- this.key_is_pressed = false;
- return false;
- });
- }
-
- // user defined functions
- public void loadFile ( ) {
- this.loading = true;
-
+ GLib.Timeout.add(500, () => {
- // 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 = (Gtk.SourceBuffer) buf;
-
+ 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);;
+
-
- if (_this.file == null || _this.file.xtype != "Roo") {
- print("xtype != Roo");
- this.loading = false;
- return;
+ this.onCursorChanged();
+
+
+ //_this.buffer.checkSyntax();
+ return false;
+ });
+
+ this.loading = false;
+ _this.buffer.dirty = false;
}
+ public void onCursorChanged (/*ParamSpec ps*/) {
- // 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 = Gtk.SourceLanguageManager.get_default();
-
- //?? is javascript going to work as js?
+ if (!this.key_is_pressed && !this.button_is_pressed) {
+ return;
+ }
- ((Gtk.SourceBuffer)(buf)) .set_language(lm.get_language(_this.file.language));
-
+ if (this.loading) {
+ return;
+ }
+ // if (ps.name != "cursor-position") {
+ // return;
+ // }
- Gtk.TextIter start;
- Gtk.TextIter end;
-
- sbuf.get_bounds (out start, out end);
- sbuf.remove_source_marks (start, end, null); // remove all marks..
+ 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");
+
- 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);
-
-
- // ---------- this selects the tree's node...
-
- var ltree = _this.main_window.windowstate.left_tree;
- var tp = ltree.model.treePathFromNode(node);
- print("got tree path %s\n", tp);
- if (tp != "") {
-
-
- //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;
-
+ //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.setCursor(tp, "editor");
- // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false);
- //this.nodeSelected(node,false);
+ */
+ // 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.
+
- // 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();
+ // highlight the node..
}
-
- this.node_selected = sel;
-
- // this.updateGreySelection(scroll);
-
+ public void nodeSelected (JsRender.Node? sel, bool scroll ) {
+
+
+
+ // this is connected in widnowstate
- }
- public void updateGreySelection (bool scroll) {
- var sel = this.node_selected;
- print("node selected\n");
- var buf = this.el.get_buffer();
- var sbuf = (Gtk.SourceBuffer) buf;
-
-
- this.clearGreySelection();
-
-
-
- if (sel == null) {
- print("no selected node\n");
- // no highlighting..
- return;
+ // 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;
- 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;
+
+ 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;
+ //}
+
+ }
+
+
- //var colon_pos = 0;
+
+ }
+ 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);
+ }
- 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");
+ 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 ;
+
+
- // 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);
+ public void clearGreySelection () {
+ // clear all the marks..
+ var sbuf = (GtkSource.Buffer)this.el.buffer;
+
+ Gtk.TextIter start;
+ Gtk.TextIter end;
- }
-
- }
- 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 string toString () {
- Gtk.TextIter s;
- Gtk.TextIter e;
- this.el.get_buffer().get_start_iter(out s);
- this.el.get_buffer().get_end_iter(out e);
- var ret = this.el.get_buffer().get_text(s,e,true);
- //print("TO STRING? " + ret);
- return ret;
- }
- public void clearGreySelection () {
- // clear all the marks..
- var sbuf = (Gtk.SourceBuffer)this.el.buffer;
-
- Gtk.TextIter start;
- Gtk.TextIter end;
+ sbuf.get_bounds (out start, out end);
+ sbuf.remove_source_marks (start, end, "grey");
- 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 Gtk.SourceBuffer el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
- public int error_line;
- public bool dirty;
-
- // ctor
- public Xcls_buffer(Xcls_WindowRooView _owner )
+ public class Xcls_buffer : Object
{
- _this = _owner;
- _this.buffer = this;
- this.el = new Gtk.SourceBuffer( null );
+ public GtkSource.Buffer el;
+ private Xcls_WindowRooView _this;
- // my vars (dec)
- this.error_line = -1;
- this.dirty = false;
- // set gobject values
+ // my vars (def)
+ public int error_line;
+ public bool dirty;
- //listeners
- this.el.changed.connect( () => {
-
-
- // check syntax??
- // ??needed..??
- // _this.save_button.el.sensitive = true;
- ///?? has changed occured during loading?
-
- // only trigger this if
+ // 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.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 = (Gtk.SourceBuffer)_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..
+ if (!_this.sourceview.button_is_pressed && !_this.sourceview.key_is_pressed) {
+ print("button or key not pressed to generate change?!\n");
+ return;
+ }
+
- 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;
+ // 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 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, "WARN");
- this.el.remove_source_marks (start, end, "ERR");
-
+
+ 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 ;
+ });
}
-
- if (str.length < 1) {
- print("checkSyntax - empty string?\n");
+
+ // 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;
}
-
- if (_this.file == null) {
- return false;
- }
- var p = _this.file.project.palete;
-
-
- if (_this.file.language != "js") {
- return false; // fake syntax error.
- }
-
- //Gee.HashMap<int,string> ret_x;
-
- return p.javascriptHasErrors(
- _this.main_window.windowstate,
- str,
- null, // prop - not relivant.
- _this.file,
- null
- );
-
+ 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 bool highlightErrors ( Gee.HashMap<int,string> validate_res) {
+
+ 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) => {
+
- this.error_line = validate_res.size;
-
- if (this.error_line < 1) {
- return true;
+
+ 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;
+
+
+ });
}
- 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;
+
+ // user defined functions
}
- 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_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_Box18 : Object
- {
- public Gtk.Box el;
- private Xcls_WindowRooView _this;
+ public class Xcls_Box19 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_WindowRooView _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_Box18(Xcls_WindowRooView _owner )
+ // 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
{
- _this = _owner;
- this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+ public Gtk.SearchEntry el;
+ private Xcls_WindowRooView _this;
- // my vars (dec)
- // set gobject values
- this.el.homogeneous = false;
- this.el.vexpand = false;
- var child_0 = new Xcls_search_entry( _this );
- child_0.ref();
- this.el.add( child_0.el );
- var child_1 = new Xcls_MenuBar20( _this );
- child_1.ref();
- this.el.add ( child_1.el );
- var child_2 = new Xcls_nextBtn( _this );
- child_2.ref();
- this.el.add( child_2.el );
- var child_3 = new Xcls_backBtn( _this );
- child_3.ref();
- this.el.add( child_3.el );
- var child_4 = new Xcls_MenuButton26( _this );
- child_4.ref();
- this.el.add( child_4.el );
- }
+ // my vars (def)
+ public Gtk.CssProvider css;
- // user defined functions
- }
- public class Xcls_search_entry : Object
- {
- public Gtk.SearchEntry el;
- private Xcls_WindowRooView _this;
+ // ctor
+ public Xcls_search_entry(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.search_entry = this;
+ this.el = new Gtk.SearchEntry();
+ // my vars (dec)
- // my vars (def)
- public Gtk.CssProvider css;
+ // 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 );
- // ctor
- public Xcls_search_entry(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.search_entry = this;
- this.el = new Gtk.SearchEntry();
+ // init method
- // my vars (dec)
+ 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
+ );
- // set gobject values
- this.el.width_request = 300;
- this.el.name = "roo-search-entry";
- this.el.hexpand = true;
- this.el.placeholder_text = "Press enter to search";
-
- // init method
-
- this.css = new Gtk.CssProvider();
- try {
- this.css.load_from_data("#roo-search-entry { background-color: #ccc; }");
- } catch (Error e) {}
- this.el.get_style_context().add_provider(this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
- //listeners
- this.el.key_press_event.connect( (event) => {
- if (event.keyval == Gdk.Key.g && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
- GLib.debug("SAVE: ctrl-g pressed");
- _this.forwardSearch(true);
- return true;
- }
+ //listeners
+ this.el.search_changed.connect( ( ) => {
-
- if (event.keyval == Gdk.Key.Return && this.el.text.length > 0) {
- _this.search(this.el.text);
- _this.search_results.updateResults();
+ _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) {
- GLib.Timeout.add_seconds(2,() => {
- _this.search_results.updateResults();
- return false;
- });
-
-
- return true;
- }
- // print(event.key.keyval)
-
- return false;
+ _this.forwardSearch(change_focus);
+
+ /*
- });
- this.el.changed.connect( () => {
- /*
- if (this.el.text == "") {
- _this.search_results.el.hide();
- return;
- }
- var res = 0;
switch(_this.windowstate.state) {
case WindowState.State.CODEONLY:
- ///case WindowState.State.CODE:
+ //case WindowState.State.CODE:
// search the code being edited..
- res = _this.windowstate.code_editor_tab.search(this.el.text);
-
+ _this.windowstate.code_editor_tab.forwardSearch(change_focus);
+
break;
case WindowState.State.PREVIEW:
if (_this.windowstate.file.xtype == "Gtk") {
- res = _this.windowstate.window_gladeview.search(this.el.text);
+ _this.windowstate.window_gladeview.forwardSearch(change_focus);
} else {
- res = _this.windowstate.window_rooview.search(this.el.text);
+ _this.windowstate.window_rooview.forwardSearch(change_focus);
}
-
break;
}
- _this.search_results.el.show();
- if (res > 0) {
- _this.search_results.el.label = "%d Matches".printf(res);
- } else {
- _this.search_results.el.label = "No Matches";
- }
-
*/
- });
- }
-
- // 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_MenuBar20 : Object
- {
- public Gtk.MenuBar el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_MenuBar20(Xcls_WindowRooView _owner )
+ public class Xcls_EventControllerKey21 : Object
{
- _this = _owner;
- this.el = new Gtk.MenuBar();
-
- // my vars (dec)
-
- // set gobject values
- var child_0 = new Xcls_search_results( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- }
-
- // user defined functions
- }
- public class Xcls_search_results : Object
- {
- public Gtk.MenuItem el;
- private Xcls_WindowRooView _this;
+ public Gtk.EventControllerKey el;
+ private Xcls_WindowRooView _this;
- // my vars (def)
- public bool always_show_image;
+ // my vars (def)
- // ctor
- public Xcls_search_results(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.search_results = this;
- this.el = new Gtk.MenuItem();
+ // ctor
+ public Xcls_EventControllerKey21(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.EventControllerKey();
- // my vars (dec)
- this.always_show_image = true;
+ // my vars (dec)
- // set gobject values
- this.el.visible = false;
- this.el.show();
+ // set gobject values
- //listeners
- this.el.button_press_event.connect( () => {
- /*
- if (this.popup == null) {
- this.popup = new Xcls_ValaCompileErrors();
- this.popup.window = _this;
- }
-
+ //listeners
+ this.el.key_pressed.connect( (keyval, keycode, state) => {
- this.popup.show(this.notices, this.el);
- */
- return true;
- });
- }
+ 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 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";
-
+ // user defined functions
}
- }
- public class Xcls_nextBtn : Object
- {
- public Gtk.Button el;
- private Xcls_WindowRooView _this;
+ public class Xcls_search_results : Object
+ {
+ public Gtk.Label el;
+ private Xcls_WindowRooView _this;
- // my vars (def)
+ // my vars (def)
- // ctor
- public Xcls_nextBtn(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.nextBtn = this;
- this.el = new Gtk.Button();
+ // ctor
+ public Xcls_search_results(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ _this.search_results = this;
+ this.el = new Gtk.Label( "No Results" );
- // my vars (dec)
+ // my vars (dec)
- // set gobject values
- this.el.always_show_image = true;
- this.el.label = "Next";
- this.el.sensitive = false;
- var child_0 = new Xcls_Image23( _this );
- child_0.ref();
- this.el.image = child_0.el;
-
- //listeners
- this.el.button_press_event.connect( (event) => {
+ // 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;
- _this.forwardSearch(true);
+ 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";
- return true;
- });
+ }
}
- // user defined functions
- }
- public class Xcls_Image23 : Object
- {
- public Gtk.Image el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image23(Xcls_WindowRooView _owner )
+ public class Xcls_nextBtn : Object
{
- _this = _owner;
- this.el = new Gtk.Image();
+ public Gtk.Button el;
+ private Xcls_WindowRooView _this;
- // my vars (dec)
- // set gobject values
- this.el.icon_name = "go-down";
- }
+ // my vars (def)
+ public bool always_show_image;
- // user defined functions
- }
+ // 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;
- public class Xcls_backBtn : Object
- {
- public Gtk.Button el;
- private Xcls_WindowRooView _this;
+ // set gobject values
+ this.el.icon_name = "go-down";
+ this.el.sensitive = false;
+ //listeners
+ this.el.clicked.connect( (event) => {
+
+ _this.forwardSearch(true);
+
+ });
+ }
- // my vars (def)
+ // user defined functions
+ }
- // ctor
- public Xcls_backBtn(Xcls_WindowRooView _owner )
+ public class Xcls_backBtn : Object
{
- _this = _owner;
- _this.backBtn = this;
- this.el = new Gtk.Button();
-
- // my vars (dec)
+ public Gtk.Button el;
+ private Xcls_WindowRooView _this;
- // set gobject values
- this.el.always_show_image = true;
- this.el.label = "Previous";
- this.el.sensitive = false;
- var child_0 = new Xcls_Image25( _this );
- child_0.ref();
- this.el.image = child_0.el;
-
- //listeners
- this.el.button_press_event.connect( (event) => {
-
- _this.backSearch(true);
-
- return true;
- });
- }
- // user defined functions
- }
- public class Xcls_Image25 : Object
- {
- public Gtk.Image 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 (def)
+ // my vars (dec)
+ this.always_show_image = true;
- // ctor
- public Xcls_Image25(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
+ // set gobject values
+ this.el.icon_name = "go-up";
+ this.el.sensitive = false;
- // my vars (dec)
+ //listeners
+ this.el.clicked.connect( (event) => {
+
+ _this.backSearch(true);
+
+
+ });
+ }
- // set gobject values
- this.el.icon_name = "go-up";
+ // user defined functions
}
- // user defined functions
- }
-
+ public class Xcls_MenuButton25 : Object
+ {
+ public Gtk.MenuButton el;
+ private Xcls_WindowRooView _this;
- public class Xcls_MenuButton26 : Object
- {
- public Gtk.MenuButton el;
- private Xcls_WindowRooView _this;
+ // my vars (def)
+ public bool always_show_image;
- // my vars (def)
+ // ctor
+ public Xcls_MenuButton25(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.MenuButton();
- // ctor
- public Xcls_MenuButton26(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- this.el = new Gtk.MenuButton();
+ // my vars (dec)
+ this.always_show_image = true;
- // my vars (dec)
+ // set gobject values
+ this.el.icon_name = "emblem-system";
+ new Xcls_search_settings( _this );
+ this.el.popover = _this.search_settings.el;
+ }
- // set gobject values
- this.el.always_show_image = true;
- this.el.label = "Settings";
- var child_0 = new Xcls_Image27( _this );
- child_0.ref();
- this.el.image = child_0.el;
- var child_1 = new Xcls_search_settings( _this );
- child_1.ref();
- this.el.popup = child_1.el;
+ // user defined functions
}
+ public class Xcls_search_settings : Object
+ {
+ public Gtk.Popover el;
+ private Xcls_WindowRooView _this;
- // user defined functions
- }
- public class Xcls_Image27 : Object
- {
- public Gtk.Image 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();
- // ctor
- public Xcls_Image27(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
+ // my vars (dec)
- // my vars (dec)
+ // set gobject values
+ var child_1 = new Xcls_Box27( _this );
+ this.el.child = child_1.el;
+ }
- // set gobject values
- this.el.icon_name = "emblem-system";
+ // user defined functions
}
+ public class Xcls_Box27 : Object
+ {
+ public Gtk.Box el;
+ private Xcls_WindowRooView _this;
- // user defined functions
- }
-
- public class Xcls_search_settings : Object
- {
- public Gtk.Menu el;
- private Xcls_WindowRooView _this;
-
-
- // my vars (def)
- // ctor
- public Xcls_search_settings(Xcls_WindowRooView _owner )
- {
- _this = _owner;
- _this.search_settings = this;
- this.el = new Gtk.Menu();
+ // my vars (def)
- // my vars (dec)
+ // ctor
+ public Xcls_Box27(Xcls_WindowRooView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+ // 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
- var child_0 = new Xcls_case_sensitive( _this );
- child_0.ref();
- this.el.append( child_0.el );
- var child_1 = new Xcls_regex( _this );
- child_1.ref();
- this.el.append( child_1.el );
- var child_2 = new Xcls_multiline( _this );
- child_2.ref();
- this.el.append( child_2.el );
+ // user defined functions
}
-
- // user defined functions
- }
- public class Xcls_case_sensitive : Object
- {
- public Gtk.CheckMenuItem el;
- private Xcls_WindowRooView _this;
+ 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.CheckMenuItem();
+ // 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";
- this.el.show();
+ // 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.CheckMenuItem 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.CheckMenuItem();
+ // 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";
- this.el.show();
+ // 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.CheckMenuItem 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.CheckMenuItem();
+ // 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)";
- this.el.show();
+ // 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
- }
-}
+ }
PREVIEW,
CODE,
CODEONLY
- }
-
+ }
+
public State state = State.NONE;
public bool children_loaded = false;
- public Project.Project project;
- public JsRender.JsRender file;
+ public Project.Project? project = null;
+ public JsRender.JsRender? file = null;
public Xcls_WindowLeftTree left_tree;
public Xcls_PopoverAddProp add_props;
public Editor code_editor_tab;
public Xcls_WindowRooView window_rooview;
public Xcls_GtkView window_gladeview;
- public Xcls_PopoverFiles popover_files;
+ public DialogFiles popover_files;
//public Xcls_ClutterFiles clutterfiles;
//public Xcls_WindowLeftProjects left_projects; // can not see where this is initialized..
public Xcls_ValaCompileResults compile_results;
// dialogs??
- public Xcls_DialogPluginWebkit webkit_plugin;
+
//public Palete.ValaSource valasource; // the spawner that runs the vala compiler.
this.fileDetailsInit();
- this.webkit_plugin = new Xcls_DialogPluginWebkit();
+
this.template_select = new DialogTemplateSelect();
this.children_loaded = true;
- BuilderApplication.valasource.compiled.connect(this.showCompileResult);
+ //BuilderApplication.valasource.compiled.connect(this.showCompileResult);
+
this.compile_results = new Xcls_ValaCompileResults(); // the poup dialogs with results in.
this.compile_results.window = this.win;
- BuilderApplication.valasource.compile_output.connect(this.compile_results.addLine);
+ //BuilderApplication.valasource.compile_output.connect(this.compile_results.addLine);
this.win.statusbar_compilestatus_label.el.hide();
this.win.statusbar_run.el.hide();
+
+ this.popover_files = new DialogFiles();
+ this.popover_files.win = this.win;
+ this.popover_files.el.application = this.win.el.application;
+ this.popover_files.el.set_transient_for( this.win.el );
-
- this.popover_files = new Xcls_PopoverFiles();
- this.popover_files.setMainWindow(this.win);
- }
+ }
+
// left tree
public void leftTreeInit()
this.win.leftpane.el.remove(this.win.editpane.el);
//this.win.tree.el.remove(this.left_tree.el);
- this.win.leftpane.el.add(this.left_tree.el);
+ this.win.leftpane.el.append(this.left_tree.el);
//this.win.tree.el.pack_start(this.left_tree.el,true, true,0);
- this.left_tree.el.show_all();
+ this.left_tree.el.show();
this.left_tree.before_node_change.connect(() => {
// if the node change is caused by the editor (code preview)
});
// node selected -- only by clicking?
- this.left_tree.node_selected.connect((sel, source) => {
+ this.left_tree.node_selected.connect((sel) => {
//if (source == "editor") {
// return;
//}
}
});
- this.left_tree.node_selected.connect((sel, source) => {
- this.leftTreeNodeSelected(sel, source);
+ this.left_tree.node_selected.connect((sel) => {
+ this.leftTreeNodeSelected(sel);
});
this.left_tree.changed.connect(() => {
{
// in theory code editor has to hide before tree change occurs.
//if (this.state != State.CODE) {
- this.left_props.finish_editing();
+ //this.left_props.finish_editing();
if (this.state == State.CODE) {
this.code_editor_tab.saveContents();
int tree_width = 300;
int props_width = 300;
- public void leftTreeNodeSelected(JsRender.Node? sel, string source)
+ public void leftTreeNodeSelected(JsRender.Node? sel)
{
// do we really want to flip paletes if differnt nodes are selected
this.win.leftpane.el.remove(this.win.editpane.el);
this.win.tree.el.remove(this.left_tree.el);
- this.win.leftpane.el.add(this.left_tree.el);
+ this.win.leftpane.el.append(this.left_tree.el);
}
//GLib.debug("Hide Properties");
- outerpane.show_all(); // make sure it's visiable..
+ outerpane.show(); // make sure it's visiable..
this.left_props.el.hide();
GLib.debug("set position: %d", this.tree_width);
outerpane.set_position(this.tree_width);
// remove this.ldeftree from this.win.leftpane
this.win.leftpane.el.remove(this.left_tree.el);
- this.win.tree.el.add(this.left_tree.el);
- this.win.leftpane.el.add(this.win.editpane.el);
+ this.win.tree.el.append(this.left_tree.el);
+ this.win.leftpane.el.append(this.win.editpane.el);
// at start (hidden) - outer = 400 inner = 399
// expanded out -> outer = 686, inner = 399
//this.win.props.el.pack_start(this.left_props.el,true, true,0);
- this.left_props.el.show_all();
- //if (!this.left_props.el.visible) {
+ this.left_props.el.show(); //if (!this.left_props.el.visible) {
GLib.debug("outerpos : %d, innerpos : %d", outerpane.get_position(), innerpane.get_position());
outerpane.set_position(this.tree_width + this.props_width);
this.left_props =new Xcls_LeftProps();
this.left_props.ref();
this.left_props.main_window = this.win;
- this.win.props.el.pack_start(this.left_props.el,true, true,0);
- this.left_props.el.show_all();
+ this.win.props.el.append(this.left_props.el);
+ this.left_props.el.show();
this.left_props.show_editor.connect( (file, node, prop) => {
this.switchState(State.CODE);
node,
prop
);
-
+ ///this.markBuf();
});
} else {
this.window_gladeview.loadFile(this.left_tree.getActiveFile());
}
- this.left_tree.model.updateSelected();
+ //this.left_tree.model.updateSelected();
this.file.save();
- if (this.file.xtype=="Gtk") {
- BuilderApplication.valasource.checkFileSpawn(this.file);
+ if (this.file.project.xtype=="Gtk") {
+ BuilderApplication.valacompilequeue.addFile(
+ Palete.ValaCompileRequestType.PROJECT,
+ this.file, "", true ) ;
+
+ //BuilderApplication.valasource.checkFileSpawn(this.file);
}
});
public void projectEditInit()
{
this.roo_projectsettings_pop =new Xcls_RooProjectSettings();
- this.roo_projectsettings_pop.ref(); /// really?
+ this.roo_projectsettings_pop.el.application = this.win.el.application;
+
this.vala_projectsettings_pop =new ValaProjectSettingsPopover();
- this.vala_projectsettings_pop.ref();
- this.vala_projectsettings_pop.window = this.win;
+
+ this.vala_projectsettings_pop.window = this.win;
+ this.vala_projectsettings_pop.el.application = this.win.el.application;
+
+ //this.vala_projectsettings_pop.el.set_parent(this.win.el); // = this.win;
//((Gtk.Container)(this.win.projecteditview.el.get_widget())).add(this.projectsettings.el);
var ep = this.roo_projectsettings_pop.project;
foreach(var ww in BuilderApplication.windows) {
if (ww.windowstate.file != null &&
- ww.windowstate.project.fn == ep.fn &&
+ ww.windowstate.project.path == ep.path &&
ww.windowstate.file.xtype == "Roo") {
ww.windowstate.window_rooview.view.renderJS(true);
}
- public void projectPopoverShow(Gtk.Widget btn, Project.Project? pr)
+ public void projectPopoverShow(Gtk.Window pwin, Project.Project? pr)
{
if (pr == null) {
pr = this.project;
}
- /*
- var active_file = this.left_tree.getActiveFile() ;
- if (active_file != null) {
- xtype = active_file.xtype;
- } else {
-
- return; // no active project
- // we might be on the file brower..
- //pr = this.left_projects.getSelectedProject();
- //if (pr != null) {
- // xtype = pr.xtype;
- //}
- }
- */
+
if (pr.xtype == "") {
return;
}
if (pr.xtype == "Roo" ) {
- this.roo_projectsettings_pop.show(btn,pr);
+ this.roo_projectsettings_pop.show(pwin,(Project.Roo)pr);
return;
}
// gtk..
- this.vala_projectsettings_pop.show(btn,(Project.Gtk)pr);
+
+ this.vala_projectsettings_pop.show(pwin,(Project.Gtk)pr);
}
//stage.set_background_color( Clutter.Color.from_string("#000"));
- this.add_props.select.connect( (prop) => {
-
- this.left_props.addProp(prop);
- });
+
}
public void propsAddShow()
{
this.code_editor_tab = new Editor();
//this.code_editor.ref(); /// really?
- this.win.codeeditviewbox.el.add(this.code_editor_tab.el);
+ this.win.codeeditviewbox.el.append(this.code_editor_tab.el);
this.win.codeeditviewbox.el.hide();
this.code_editor_tab.window = this.win;
this.code_editor_tab.save.connect( () => {
this.file.save();
- this.left_tree.model.updateSelected();
+ //this.left_tree.model.updateSelected();
if (this.left_tree.getActiveFile().xtype == "Roo" ) {
this.window_rooview.requestRedraw();
} else {
this.window_gladeview.loadFile(this.left_tree.getActiveFile());
}
- // we do not need to call spawn... - as it's already called by the editor?
-
- });
-
- }
- /*
- public void codePopoverEditInit()
- {
- this.code_editor_popover = new Xcls_PopoverEditor();
- //this.code_editor.ref(); /// really?
-
- this.code_editor_popover.setMainWindow( this.win);
-
- this.code_editor_popover.editor.save.connect( () => {
- this.file.save();
- this.left_tree.model.updateSelected();
- if (this.left_tree.getActiveFile().xtype == "Roo" ) {
- this.window_rooview.requestRedraw();
- } else {
- this.window_gladeview.loadFile(this.left_tree.getActiveFile());
+ if (this.file.project.xtype=="Gtk") {
+ BuilderApplication.valacompilequeue.addFile(
+ Palete.ValaCompileRequestType.PROJECT,
+ this.file, "", false ) ;
}
+
// we do not need to call spawn... - as it's already called by the editor?
});
}
- */
- // ----------- list of projects on left
- /*
- public void projectListInit()
- {
-
- this.left_projects = new Xcls_WindowLeftProjects();
- this.left_projects.ref();
- this.win.leftpane.el.pack_start(this.left_projects.el,true, true,0);
- this.left_projects.el.show_all();
- this.left_projects.project_selected.connect((proj) => {
- this.buttonsShowHide();
- proj.scanDirs();
- this.clutterfiles.loadProject(proj);
-
- });
-
- }
- */
-
+
// ----------- file view
public void showPopoverFiles(Gtk.Widget btn, Project.Project? project, bool new_window)
{
- this.popover_files.show(btn, project, new_window);
+ this.popover_files.show( project, new_window);
}
{
this.file_details = new Xcls_PopoverFileDetails();
this.file_details.mainwindow = this.win;
+ this.file_details.el.application = this.win.el.application;
+// this.file_details.el.set_parent(this.win.el);
// force it modal to the main window..
this.file_details.success.connect((project,file) =>
{
+ this.popover_files.el.hide();
this.fileViewOpen(file, this.file_details.new_window, -1);
// if it's comming from the file dialog -> hide it...
this.switchState (State.CODEONLY);
this.code_editor_tab.scroll_to_line(line);
-
- } else {
-
- this.switchState (State.PREVIEW);
-
- if (file.project.xtype == "Gtk" && line> -1 ) {
- // fixme - show the editing tab.
+ return;
+ }
+
+
+ this.switchState (State.PREVIEW);
+
+ if ( line> -1 ) {
+ // fixme - show the editing tab.
+ // node and prop?
+ var node = file.lineToNode(line);
+ if (node != null) {
+ this.left_tree.model.selectNode(node);
+ var prop = node.lineToProp(line);
+
+ if (prop == null) {
+ GLib.debug("could not find prop at line %d", line);
+ return;
+ }
+ this.left_props.view.editProp(prop);
+
+
+
+ return;
+ }
+
+ if (this.project.xtype == "Gtk") {
this.window_gladeview.scroll_to_line(line);
} else {
- this.window_rooview.scroll_to_line(line);
- // fixme - what about Roo?
+ this.window_rooview.scroll_to_line(line);
}
- }
+
+ return;
+ }
+ var node = file.lineToNode(line);
+ if (node != null) {
+ this.left_tree.model.selectNode(node);
+ //var prop = node.lineToProp(line);
+ return;
+ }
+
+ this.window_rooview.scroll_to_line(line);
+
+
}
this.file = file;
BuilderApplication.updateWindows();
+
+
+
if (file.xtype == "PlainFile") {
this.win.codeeditviewbox.el.show();
this.switchState (State.CODEONLY);
this.left_tree.model.loadFile(file);
+ }
+ BuilderApplication.updateCompileResults();
+ if (file.project.xtype == "Gtk" && file.project.last_request == null ) {
+
+ BuilderApplication.valacompilequeue.addFile(
+ Palete.ValaCompileRequestType.PROJECT,
+ this.file, "" , true) ;
+
}
this.gotoLine(line);
if (file.project.xtype == "Roo" ) {
// removes all the childe elemnts from rooviewbox
-
- ctr.foreach( (w) => { ctr.remove(w); });
-
- ctr.add(this.window_rooview.el);
+ while( ctr.get_last_child() != null) {
+ ctr.remove(ctr.get_last_child());
+ }
+
+ ctr.append(this.window_rooview.el);
if (file.xtype != "PlainFile") {
this.window_rooview.loadFile(file);
- this.window_rooview.el.show_all();
+ this.window_rooview.el.show();
}
} else {
- ctr.foreach( (w) => { ctr.remove(w); });
+ while( ctr.get_last_child() != null) {
+ ctr.remove(ctr.get_last_child());
+ }
- ctr.add(this.window_gladeview.el);
+ ctr.append(this.window_gladeview.el);
if (file.xtype != "PlainFile") {
this.window_gladeview.loadFile(file);
- this.window_gladeview.el.show_all();
+ this.window_gladeview.el.show();
}
}
this.win.codeeditviewbox.el.hide();
//this.win.editpane.el.set_position(this.win.editpane.el.max_position);
}
- this.win.setTitle(file.project.name + " : " + file.name);
+ this.win.setTitle();
}
this.window_rooview =new Xcls_WindowRooView();
this.window_rooview.main_window = this.win;
this.window_rooview.ref();
- this.win.rooviewbox.el.add(this.window_rooview.el);
+ this.win.rooviewbox.el.append(this.window_rooview.el);
- this.window_rooview.el.show_all();
+ this.window_rooview.el.show();
this.win.rooviewbox.el.hide();
}
return;
}
this.rightpalete.hide();
-
- this.add_props.el.show_all();
+ this.add_props.el.set_parent(btn);
+ this.add_props.el.set_position(Gtk.PositionType.RIGHT);
+
this.add_props.show(
this.win.project.palete, //Palete.factory(this.win.project.xtype),
sig_or_listen, //this.state == State.LISTENER ? "signals" : "props",
- ae.fqn(),
+ ae,
btn
);
}
- public void showAddObject(Gtk.Widget btn)
+ public void showAddObject(Gtk.Widget btn, JsRender.Node? on_node)
{
- var n = this.left_tree.getActiveElement();
+
this.add_props.hide();
- this.rightpalete.el.show_all();
+
+ this.add_props.el.set_position(Gtk.PositionType.RIGHT);
+
+ //this.rightpalete.el.set_parent(btn);
+
this.rightpalete.show(
this.left_tree.getActiveFile().palete(),
- n == null ? "*top" : n.fqn(),
+ on_node == null ? "*top" : on_node.fqn(),
btn
);
}
-
+
public void switchState(State new_state)
{
this.win.editpane.el.show();
this.win.rooviewbox.el.hide();
this.win.codeeditviewbox.el.show();
- this.code_editor_tab.el.show_all();
+ this.code_editor_tab.el.show();
break;
case State.CODEONLY:
this.win.leftpane.el.hide();
this.win.codeeditviewbox.el.show();
this.win.rooviewbox.el.hide();
- this.code_editor_tab.el.show_all();
+ this.code_editor_tab.el.show();
break;
case State.NONE:
}
-
- // -- buttons show hide.....
-
-
-
- public void showCompileResult(Json.Object obj)
- {
- // vala has finished compiling...
- // stop the spinner...
- GLib.debug("vala compiled Built Project: %s Window Project %s",
-
- BuilderApplication.valasource.file == null ? "No file?" : (
-
- BuilderApplication.valasource.file.project == null ? "No Project" : BuilderApplication.valasource.file.project.fn
- ),
- this.project != null ? this.project.fn : "No Project?"
- );
-
-
-
- if (this.project != null &&
- BuilderApplication.valasource.file != null &&
- BuilderApplication.valasource.file.project != null &&
- this.project.fn != BuilderApplication.valasource.file.project.fn) {
- GLib.debug("skip update - not our project");
- return;
- }
-
- var generator = new Json.Generator ();
- var n = new Json.Node(Json.NodeType.OBJECT);
- n.init_object(obj);
- generator.set_root (n);
- print("result :%s", generator.to_data (null));
-
-
- var buf = this.code_editor_tab.buffer;
- buf.check_running = false;
- var has_errors = false;
-
- if (obj.has_member("ERR-TOTAL")) {
- if (obj.get_int_member("ERR-TOTAL")> 0) {
- has_errors = true;
- }
- this.win.statusbar_errors.setNotices( obj.get_object_member("ERR") , (int) obj.get_int_member("ERR-TOTAL"));
- } else {
- this.win.statusbar_errors.setNotices( new Json.Object() , 0);
- }
-
- if (obj.has_member("WARN-TOTAL")) {
-
- this.win.statusbar_warnings.setNotices(obj.get_object_member("WARN"), (int) obj.get_int_member("WARN-TOTAL"));
- } else {
- this.win.statusbar_warnings.setNotices( new Json.Object() , 0);
-
- }
- if (obj.has_member("DEPR-TOTAL")) {
-
- this.win.statusbar_depricated.setNotices( obj.get_object_member("DEPR"), (int) obj.get_int_member("DEPR-TOTAL"));
-
- } else {
- this.win.statusbar_depricated.setNotices( new Json.Object(),0);
- }
- //if (this.state == State.CODE || this.state == State.PROJECTCODEONLY) {
- if ( this.state == State.CODEONLY) {
- buf.highlightErrorsJson("ERR", obj);
- buf.highlightErrorsJson("WARN", obj);
- buf.highlightErrorsJson("DEPR", obj);
- }
-
- this.win.statusbar_compilestatus_label.el.hide();
- this.win.statusbar_run.el.hide();
- if (!has_errors) {
- this.win.statusbar_compilestatus_label.el.show();
- this.win.statusbar_run.el.show();
- }
- if (this.file.xtype == "Gtk") {
- // not sure how this is working ok? - as highlighting is happening on the vala files at present..
- var gbuf = this.window_gladeview.sourceview;
- gbuf.highlightErrorsJson("ERR", obj);
- gbuf.highlightErrorsJson("WARN", obj);
- gbuf.highlightErrorsJson("DEPR", obj);
-
- if (!has_errors) {
- this.win.statusbar_run.el.show();
- }
-
- }
-
- if (this.file.xtype == "Roo") {
- // not sure how this is working ok? - as highlighting is happening on the vala files at present..
- var gbuf = this.window_rooview.sourceview;
- gbuf.highlightErrorsJson("ERR", obj);
- gbuf.highlightErrorsJson("WARN", obj);
- gbuf.highlightErrorsJson("DEPR", obj);
-
- }
-
- this.last_compile_result = obj;
-
-
- }
-
}
"sources" : [
"../Builder4/About.vala",
"../Builder4/DialogConfirm.vala",
- "../Builder4/DialogPluginWebkit.vala",
"../Builder4/DialogSaveModule.vala",
"../Builder4/DialogSaveTemplate.vala",
"../Builder4/DialogTemplateSelect.vala",
"../JsRender/Gtk.vala",
"../JsRender/JsRender.vala",
"../JsRender/Lang.vala",
- "../JsRender/NodeToGtk.vala",
"../JsRender/NodeToJs.vala",
"../JsRender/NodeToVala.vala",
"../JsRender/Node.vala",
"../JsRender",
"../Palete/Gir.vala",
"../Palete/Gtk.vala",
- "../Palete/Javascript.vala",
"../Palete/Palete.vala",
"../Palete/RooDatabase.vala",
"../Palete/Roo.vala",
"../Builder4/PopoverAddProp.vala",
"../Builder4/PopoverAddObject.vala",
"../Builder4/Editor.vala",
- "../Builder4/PopoverFiles.vala",
"../JsRender/NodeToGlade.vala",
"../JsRender/NodeProp.vala",
- "../Project/GtkValaSettings.vala"
+ "../Project/GtkValaSettings.vala",
+ "../Palete/CompileError.vala",
+ "../Builder4/DialogFiles.vala",
+ "../JsRender/Dir.vala",
+ "../Project/VapiSelection.vala"
],
"packages" : []
},
"../../..//gitlive",
"..//codegen",
"..//ccode",
- "../..//debian"
+ "../..//debian",
+ null
],
"packages" : [
- "gdk-3.0",
- "gtk+-3.0",
- "gtksourceview-3.0",
"libgda-5.0",
"glib-2.0",
"gobject-introspection-1.0",
"gobject-2.0",
- "javascriptcore",
"json-glib-1.0",
"libxml-2.0",
- "libsoup-2.4",
"libvala-0.26",
- "webkit2gtk-4.0",
"gee-1.0",
"posix",
"libvala-0.24",
"libvala-0.36",
"gee-0.8",
"roojspacker-1.4",
- "libvala-0.56"
+ "libvala-0.56",
+ "gtk4",
+ "javascriptcore",
+ "gtksourceview-5",
+ "javascriptcoregtk-6.0",
+ "webkitgtk-6.0"
]
}
]
\ No newline at end of file
--- /dev/null
+/**
+ represents a directory (cant be edited?)
+
+**/
+
+namespace JsRender {
+ int did = 1;
+ public class Dir : JsRender
+ {
+
+ public Dir(Project.Project project, string path) {
+
+ aconstruct( project, path);
+ this.xtype = "Dir";
+ this.language = "";
+
+
+ this.id = "dir-%d".printf(did++);
+ this.name = this.relpath;
+ if (this.name == "") {
+ this.name = "/";
+ }
+ //console.dump(this);
+ // various loader methods..
+
+ // Class = list of arguments ... and which property to use as a value.
+
+
+
+
+ }
+ public override void save() {}
+ public override void saveHTML(string html) {}
+ public override string toSource() { return ""; }
+ public override string toSourceCode() {return "";} // used by commandline tester..
+ public override void setSource(string str) {}
+ public override string toSourcePreview() {return "";}
+ public override void removeFiles() {}
+ public override void findTransStrings(Node? node ) {}
+ public override string toGlade() {return "";}
+ public override string targetName() {return "";}
+ public override void loadItems() throws GLib.Error {}
+ }
+
+
+
+}
\ No newline at end of file
public class Gtk : JsRender
{
+
+ public Project.Gtk gproject {
+ get {
+ return (Project.Gtk) this.project;
+ }
+ private set {}
+ }
public Gtk(Project.Project project, string path) {
var obj = node.get_object ();
this.name = obj.get_string_member("name");
- this.parent = obj.get_string_member("parent");
- this.title = obj.get_string_member("title");
+
if (obj.has_member("build_module")) { // should check type really..
this.build_module = obj.get_string_member("build_module");
}
+ if (obj.has_member("gen_extended")) { // should check type really..
+ this.gen_extended = obj.get_boolean_member("gen_extended");
+ }
+
+
// load items[0] ??? into tree...
var bjs_version_str = this.jsonHasOrEmpty(obj, "bjs-version");
bjs_version_str = bjs_version_str == "" ? "1" : bjs_version_str;
}
+
+
+ public void updateCompileGroup(string old_target, string new_target)
+ {
+ if (old_target == new_target) {
+ return;
+ }
+ if (old_target != "") {
+ if (this.gproject.compilegroups.has_key(old_target)) {
+ var cg = this.gproject.compilegroups.get(old_target);
+ if (cg.sources.contains(this.relpath)) {
+ cg.sources.remove(this.relpath);
+ }
+ }
+ }
+ if (new_target != "") {
+ if (this.gproject.compilegroups.has_key(new_target)) {
+ var cg = this.gproject.compilegroups.get(new_target);
+ if (!cg.sources.contains(this.relpath)) {
+ cg.sources.add(this.relpath);
+ }
+ }
+ }
+
+
+ }
+
/*
valaCompileCmd : function()
{
},
*/
-
-
public override void findTransStrings(Node? node )
{
*/
public Gee.ArrayList<string> doubleStringProps;
- public string id;
- public string name; // is the JS name of the file.
- public string fullname;
- public string path; // is the full path to the file.
- public string parent; // JS parent.
- public string region; // RooJS - insert region.
+ public string id = "";
+ public string name { get; set; default = ""; } // is the JS name of the file.
+ public string fullname = "";
+ public string path = ""; // is the full path to the file.
+
+ public string relpath {
+ owned get {
+ return this.project.path == this.path ? "" : this.path.substring(this.project.path.length+1);
+ }
+ private set {}
+ }
+ public string reldir {
+ owned get {
+ return this.project.path == this.dir ? "" : this. dir.substring(this.project.path.length+1);
+ }
+ private set {}
+ }
+
+ public string dir {
+ owned get {
+ return GLib.Path.get_dirname(this.path);
+
+ }
+ private set {}
+ }
+
+ public string file_namespace {
+ public owned get {
+ if (!this.name.contains(".")) {
+ return "";
+ }
+ var bits = this.name.split(".");
+ return bits[0];
+ }
+ private set {}
+ }
+ public string file_without_namespace {
+ public owned get {
+ if (!this.name.contains(".")) {
+ return this.name;
+ }
+ var bits = this.name.split(".");
+ return this.name.substring(bits[0].length +1);
+ }
+ private set {}
+ }
+
+
+ public string parent = ""; // JS parent.
+ public string region = ""; // RooJS - insert region.
- public string title; // a title.. ?? nickname.. ??? -
- public string build_module; // module to build if we compile (or are running tests...)
+ public string title = ""; // a title.. ?? nickname.. ??? -
+
public string permname;
public string modOrder;
public string xtype;
public uint64 webkit_page_id; // set by webkit view - used to extract extension/etc..
-
+ public bool gen_extended = false; // nodetovala??
+
public Project.Project project;
+
+ // GTK Specifc
+
+ public string build_module; // module to build if we compile (or are running tests...)
+
//Project : false, // link to container project!
public Node tree; // the tree of nodes.
- public GLib.List<JsRender> cn; // child files.. (used by project ... should move code here..)
+ //public GLib.List<JsRender> cn; // child files.. (used by project ... should move code here..)
public bool hasParent;
*
*/
//public Xcls_Editor editor;
-
+ public GLib.ListStore childfiles; // used by directories..
//abstract JsRender(Project.Project project, string path);
public void aconstruct(Project.Project project, string path)
{
- this.cn = new GLib.List<JsRender>();
+ //this.cn = new GLib.List<JsRender>();
this.path = path;
this.project = project;
this.hasParent = false;
this.parent = "";
- this.tree = null;
+ this.tree = null;
this.title = "";
this.region = "";
this.permname = "";
this.language = "";
this.content_type = "";
this.build_module = "";
- this.loaded = false;
+ //this.loaded = false;
//print("JsRender.cto() - reset transStrings\n");
this.transStrings = new Gee.HashMap<string,string>();
this.namedStrings = new Gee.HashMap<string,string>();
var ar = this.path.split("/");
// name is in theory filename without .bjs (or .js eventually...)
try {
- Regex regex = new Regex ("\\.(bjs|js)$");
+ Regex regex = new Regex ("\\.(bjs)$");
this.name = ar.length > 0 ? regex.replace(ar[ar.length-1],ar[ar.length-1].length, 0 , "") : "";
} catch (GLib.Error e) {
this.fullname = (this.parent.length > 0 ? (this.parent + ".") : "" ) + this.name;
this.doubleStringProps = new Gee.ArrayList<string>();
+ this.childfiles = new GLib.ListStore(typeof(JsRender));
}
switch (xt) {
case "Gtk":
return new Gtk(project, path);
+
case "Roo":
- return new Roo(project, path);
+ return new Roo((Project.Roo) project, path);
// case "Flutter":
// return new Flutter(project, path);
case "PlainFile":
throw new Error.INVALID_FORMAT("JsRender Factory called with xtype=%s", xt);
//return null;
}
-
+
public string nickType()
this.screenshot368 = null;
this.screenshot = null;
try {
+ GLib.debug("Wirte %s", this.getIconFileName( ));
pixbuf.save(this.getIconFileName( ),"png");
this.screenshot = pixbuf;
- } catch (GLib.Error e) {}
+ } catch (GLib.Error e) {
+ GLib.debug("failed to write pixbuf?");
+
+ }
}
+ public void widgetToIcon(global::Gtk.Widget widget) {
+
+ this.screenshot92 = null;
+ this.screenshot368 = null;
+ this.screenshot = null;
+
+ try {
+
+
+ var filename = this.getIconFileName();
+
+
+ var p = new global::Gtk.WidgetPaintable(widget);
+ var s = new global::Gtk.Snapshot();
+ 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();
+ 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);
+ r.unrealize();
+
+
+ } catch (GLib.Error e) {
+ GLib.debug("failed to write pixbuf?");
+
+ }
+
+
+
+ }
public string getIconFileName( )
public void saveBJS()
{
- if (!this.loaded) {
- return;
- }
+ // if (!this.loaded) {
+ /// GLib.debug("saveBJS - skip - not loaded?");
+ // return;
+ //}
if (this.xtype == "PlainFile") {
return;
}
- ;
+
GLib.debug("WRITE :%s\n " , this.path);// + "\n" + JSON.stringify(write));
- public abstract void loadItems() throws GLib.Error;
+
//ret.set_string_member("id", this.id); // not relivant..
ret.set_string_member("name", this.name);
- ret.set_string_member("parent", this.parent == null ? "" : this.parent);
- ret.set_string_member("title", this.title == null ? "" : this.title);
- ret.set_string_member("path", this.path);
- //ret.set_string_member("items", this.items);
- ret.set_string_member("permname", this.permname == null ? "" : this.permname);
- ret.set_string_member("modOrder", this.modOrder == null ? "" : this.modOrder);
+
+ if (this.project.xtype == "Roo") {
+ ret.set_string_member("parent", this.parent == null ? "" : this.parent);
+ ret.set_string_member("title", this.title == null ? "" : this.title);
+ //ret.set_string_member("path", this.path);
+ //ret.set_string_member("items", this.items);
+ ret.set_string_member("permname", this.permname == null ? "" : this.permname);
+ ret.set_string_member("modOrder", this.modOrder == null ? "" : this.modOrder);
+ }
if (this.project.xtype == "Gtk") {
- ret.set_string_member("build_module", this.build_module == null ? "" : this.build_module);
+
+ ret.set_string_member("build_module", this.build_module );
}
+ ret.set_boolean_member("gen_extended", this.gen_extended);
if (this.transStrings.size > 0) {
var tr = new Json.Object();
public string getTitle ()
{
+ if (this.title == null) { // not sure why this happens..
+ return "";
+ }
if (this.title.length > 0) {
return this.title;
}
}
+ public GLib.ListStore toListStore()
+ {
+ var ret = new GLib.ListStore(typeof(Node));
+ ret.append(this.tree);
+ return ret;
+ }
+
+
+ // used to handle list of files in project editor (really Gtk only)
+ public bool compile_group_selected {
+ get {
+ var gproj = (Project.Gtk) this.project;
+
+ if (gproj.active_cg == null) {
+ return false;
+ }
+ if (this.xtype == "Dir") {
+ // show ticked if all ticked..
+ var ticked = true;
+ for(var i = 0; i < this.childfiles.n_items; i++ ) {
+ var f = (JsRender) this.childfiles.get_item(i);
+ if (!f.compile_group_selected) {
+ ticked = false;
+ break;
+ }
+ }
+ return ticked;
+
+
+ }
+ if (gproj.active_cg.sources == null) {
+ GLib.debug("compile_group_selected - sources is null? ");
+ return false;
+ }
+
+ return gproj.active_cg.sources.contains(this.relpath);
+
+ }
+ set {
+
+ var gproj = (Project.Gtk) this.project;
+
+ if (gproj.active_cg == null) {
+ return;
+ }
+ if (gproj.active_cg.loading_ui) {
+ return;
+ }
+
+ if (this.xtype == "Dir") {
+ for(var i = 0; i < this.childfiles.n_items; i++ ) {
+ var f = (JsRender) this.childfiles.get_item(i);
+ f.compile_group_selected = value;
+
+ }
+ return;
+
+ }
+
+
+
+ if (value == false) {
+ GLib.debug("REMOVE %s", this.relpath);
+
+ gproj.active_cg.sources.remove(this.relpath);
+ return;
+ }
+ if (!gproj.active_cg.sources.contains(this.relpath)) {
+ GLib.debug("ADD %s", this.relpath);
+ gproj.active_cg.sources.add(this.relpath);
+ }
+
+ }
+ }
+ /*
+ public bool compile_group_hidden {
+ get {
+ var gproj = (Project.Gtk) this.project;
+
+
+ return gproj.hidden.contains(this.relpath);
+
+ }
+ set {
+
+ var gproj = (Project.Gtk) this.project;
+
+ if (gproj.active_cg == null) {
+ return;
+ }
+ if (gproj.active_cg.loading_ui) {
+ return;
+ }
+ if (value == false) {
+ GLib.debug("REMOVE %s", this.relpath);
+
+ gproj.hidden.remove(this.relpath);
+ return;
+ }
+ if (!gproj.hidden.contains(this.relpath)) {
+ gproj.hidden.add(this.relpath);
+ // hiding a project will auto clear it.
+ for(var i = 0; i < this.childfiles.n_items; i++ ) {
+ var f = (JsRender) this.childfiles.get_item(i);
+ f.compile_group_selected = false;
+ }
+ return;
+
+ }
+
+ }
+ }
+ */
+ public void remove()
+ {
+ if (this.xtype == "Dir") {
+ return;
+ }
+ // cleans up build (should really be in children..
+ this.removeFile(this.path);
+ if (this.path.has_suffix(".bjs") && this.project.xtype == "Roo") {
+ this.removeFile(this.path.substring(0, this.path.length-4) + ".js");
+ return;
+ }
+ if (this.path.has_suffix(".bjs") && this.project.xtype == "Gtk") {
+ this.removeFile(this.path.substring(0, this.path.length-4) + ".vala");
+ this.removeFile(this.path.substring(0, this.path.length-4) + ".c");
+ this.removeFile(this.path.substring(0, this.path.length-4) + ".o");
+ }
+ if (this.path.has_suffix(".vala") && this.project.xtype == "Gtk") {
+ this.removeFile(this.path.substring(0, this.path.length-5) + ".c");
+ this.removeFile(this.path.substring(0, this.path.length-5) + ".o");
+ }
+
+
+ }
+
+ private void removeFile(string path)
+ {
+
+ if (GLib.FileUtils.test(path, GLib.FileTest.EXISTS)) {
+ GLib.FileUtils.unlink(path);
+ }
+
+ }
+
public abstract void save();
public abstract void saveHTML(string html);
public abstract void findTransStrings(Node? node );
public abstract string toGlade();
public abstract string targetName();
+ public abstract void loadItems() throws GLib.Error;
}
}
+
case Json.NodeType.VALUE:
size_t sl;
this.generator.set_root(node);
+<<<<<<< HEAD
var str = this.generator.to_data(out sl);
buffer.append( str );
+=======
+ var str = this.generator.to_data(out sl);
+ buffer.append( str );
+>>>>>>> wip_alan_T7440_handling_gtk4_and_bad_girs
break;
case Json.NodeType.ARRAY:
-public class JsRender.Node : Object {
+public class JsRender.Node : GLib.Object {
public static int uid_count = 0;
+ public int oid { get; private set; }
public Node parent;
- public Gee.ArrayList<Node> items; // child items..
-
- public Gee.HashMap<string,NodeProp> props; // the properties..
- public Gee.HashMap<string,NodeProp> listeners; // the listeners..
+ private Gee.ArrayList<Node> items; // child items..
+ public GLib.ListStore childstore; // must be kept in sync with items
+ public GLib.ListStore? propstore; // must be kept in sync with items
public string xvala_cls;
public string xvala_xcls; // 'Xcls_' + id;
public string xvala_id; // item id or ""
public Gee.ArrayList<int> node_lines;
public Gee.HashMap<int,Node> node_lines_map; // store of l:xxx or p:....
+ private int _updated_count = 0;
+ public int updated_count {
+ get {
+ return this._updated_count;
+ }
+ set {
+ this.nodeTitleProp = ""; // ?? should trigger set?
+ this.iconFilename = "";
+ this. _updated_count = value;
+ }
+
+ } // changes to this trigger updates on the tree..
public Node()
{
this.items = new Gee.ArrayList<Node>();
- this.props = new Gee.HashMap<string,NodeProp>();
- this.listeners = new Gee.HashMap<string,NodeProp>(); // Nodeprop can include line numbers..
+ //this._props = new Gee.HashMap<string,NodeProp>();
+ //this._listeners = new Gee.HashMap<string,NodeProp>(); // Nodeprop can include line numbers..
+ this.propstore = new GLib.ListStore(typeof(NodeProp)); // Nodeprop can include line numbers..
this.xvala_cls = "";
this.xvala_xcls = "";
this.xvala_id = "";
this.line_map = new Gee.HashMap<int,string>();
this.node_lines = new Gee.ArrayList<int>();
this.node_lines_map = new Gee.HashMap<int,Node>();
+ this.childstore = new GLib.ListStore( typeof(Node));
+ this.oid = uid_count++;
}
+ public Gee.ArrayList<Node> readItems()
+ {
+ return this.items; // note should not modify add/remove from this directly..
+
+ }
public void setNodeLine(int line, Node node) {
//print("Add node @ %d\n", line);
if (this.node_lines_map.has_key(line)) {
}
- public void setLine(int line, string type, string prop) {
+ public void setLine(int line, string type, string prop)
+ {
+ //GLib.debug("set prop %s (%s) to line %d", prop, type, line);
if (this.line_map.has_key(line)) {
if (this.line_map.get(line) != "e:" ) {
return;
this.lines.add(line);
}
this.line_map.set(line, type + ":" + prop);
- GLib.debug("setLine %d, %s", line, type + ":" + prop);
+ if (type == "e" || type == "p" ) {
+
+ if (prop == "" || !this.props.has_key(prop)) {
+ ///GLib.debug("cant find prop '%s'", prop);
+ return;
+ }
+
+ var prope = this.props.get(prop);
+ if (prope != null && type =="p") {
+ prope.start_line = line;
+ }
+ if (prope != null && type =="e") {
+ prope.end_line = line;
+ }
+
+ }
+ if (type == "l" || type =="x") {
+ if (prop == "" || !this.listeners.has_key(prop)) {
+ //GLib.debug("cant find listener '%s'", prop);
+ return;
+ }
+
+ var prope = this.listeners.get(prop);
+ if (prope != null && type =="l") {
+ prope.start_line = line;
+ }
+ if (prope != null && type =="x") {
+ prope.end_line = line;
+ }
+
+
+ }
+
+
+
+ //GLib.debug("setLine %d, %s", line, type + ":" + prop);
}
public void sortLines() {
//print("sortLines\n");
}
- public string lineToProp(int line)
+ public NodeProp? lineToProp(int line)
{
- // assume lineToNode called first...
- var l = -1;
- //foreach(int el in this.lines) {
- // //print("all lines %d\n", el);
- //
-
- foreach(int el in this.lines) {
- //print("?match %d\n", el);
- if (el < line) {
-
- l = el;
- //print("LESS\n");
+ for(var i= 0; i < this.propstore.get_n_items();i++) {
+ var p = (NodeProp) this.propstore.get_item(i);
+ GLib.debug("prop %s lines %d -> %d", p.name, p.start_line, p.end_line);
+ if (p.start_line > line) {
continue;
}
- if (el == line) {
- //print("SAME\n");
- l = el;
- break;
- }
- if (l > -1) {
- //print("RETURNING NODE ON LINE %d", l);
- return this.line_map.get(l);
+ if (line > p.end_line) {
+ continue;
}
- return "";
-
+ return p;
}
- if (l > -1) {
- //print("RETURNING NODE ON LINE %d", l);
- return this.line_map.get(l);
- }
- return "";
-
+ return null;
}
+
+
public bool getPropertyRange(string prop, out int start, out int end)
{
public string uid()
{
if (this.props.get("id") == null) {
- uid_count++;
- return "uid-%d".printf(uid_count);
+ return "uid-%d".printf(this.oid);
}
return this.props.get("id").val;
}
}
return false;
}
+
+ public string FQN { // for sorting
+ owned get { return this.fqn(); }
+ private set {}
+ }
+
public string fqn()
{
if (!this.hasXnsType ()) {
public void setFqn(string name)
{
var ar = name.split(".");
- this.props.set("xtype",new NodeProp.prop("xtype", "", ar[ar.length-1]));
var l = name.length - (ar[ar.length-1].length +1);
- this.props.set("xns", new NodeProp.raw("xns", "", name.substring(0, l)));
+
+
+
+ if (this.props.has_key("xtype")) {
+ this.props.get("xtype").val = ar[ar.length-1];
+ } else {
+ this.add_prop(new NodeProp.prop("xtype", "", ar[ar.length-1]));
+ }
+ if (this.props.has_key("xns")) {
+ this.props.get("xns").val = name.substring(0, l);
+ } else {
+ this.add_prop(new NodeProp.raw("xns", "", name.substring(0, l)));
+ }
+
+
//print("setFQN %s to %s\n", name , this.fqn());
var v = this.props.get(key);
return v == null ? "" : v.val;
}
- /*
- var k = this.props.get(key);
- if (k != null) {
- return k;
- }
-
- k = this.props.get("$ " + key);
- if (k != null) {
- return k;
- }
-
- var iter = this.props.map_iterator();
- while (iter.next()) {
- var kk = iter.get_key().split(" ");
- if (kk[kk.length-1] == key) {
- return iter.get_value();
- }
-
-
- return "";
- }
- */
-
- /*
-
- SAMNE AS ABOVE
- public string get_key(string key)
- {
- var k = this.props.get(key);
- if (k != null) {
- return key;
- }
-
- k = this.props.get("$ " + key);
- if (k != null) {
- return "$ " + key;
- }
-
- var iter = this.props.map_iterator();
- while (iter.next()) {
- var kk = iter.get_key().split(" ");
- if (kk[kk.length-1] == key) {
- return iter.get_key();
- }
- }
-
-
- return "";
-
- }
- */
+
public NodeProp? get_prop(string key)
{
}
- public void set_prop(NodeProp prop)
- {
-
- this.props.set(prop.to_index_key(), prop);
-
- }
-
- /*
- public void normalize_key(string key, out string kname, out string kflag, out string ktype)
- {
- // key formats : XXXX
- // XXX - plain
- // string XXX - with type
- // $ XXX - with flag (no type)
- // $ string XXX - with flag
- kname = "";
- ktype = ""; // these used to contain '-' ???
- kflag = ""; // these used to contain '-' ???
- var kkv = key.strip().split(" ");
- string[] kk = {};
- for (var i = 0; i < kkv.length; i++) {
- if (kkv[i].length > 0 ) {
- kk += kkv[i];
- }
- }
- //print("normalize %s => %s\n", key,string.joinv("=:=",kk));
-
- switch(kk.length) {
- case 1:
- kname = kk[0];
- return;
- case 2:
- kname = kk[1];
- if (kk[0].length > 1) {
- ktype = kk[0];
- } else {
- kflag = kk[0];
- }
- return;
- case 3:
- kname = kk[2];
- kflag = kk[0];
- ktype = kk[1];
- return;
- }
- // everything blank otherwise...
- }
- */
+
- public new void set(string key, NodeProp val) {
- this.props.set(key,val);
- }
public bool has(string key)
{
return this.props.has_key(key);
- /*
- var k = this.props.get(key);
- if (k != null) {
- return true;
- }
- var iter = this.props.map_iterator();
- while (iter.next()) {
- var kk = iter.get_key().strip().split(" ");
- if (kk[kk.length-1] == key) {
- return true;
- }
- }
-
- return false;
- */
+
+
}
public void remove()
{
if (this.parent == null) {
-
-
+ GLib.debug("remove - parent is null?");
return;
}
var nlist = new Gee.ArrayList<Node>();
}
nlist.add(this.parent.items.get(i));
}
+ uint pos;
+ if ( this.parent.childstore.find(this, out pos)) {
+ this.parent.childstore.remove(pos);
+ }
+
this.parent.items = nlist;
this.parent = null;
return Node.gen.to_data (null);
}
+ public void loadFromJsonString(string str, int ver)
+ {
+ var pa = new Json.Parser();
+ try {
+ pa.load_from_data(str);
+ } catch (GLib.Error e) {
+ GLib.debug("Error loading string?");
+ return;
+ }
+ var new_node = pa.get_root();
+ var obj = new_node.get_object ();
+
+ this.loadFromJson(obj, ver);
+ }
+
+
+
public void loadFromJson(Json.Object obj, int version) {
obj.foreach_member((o , key, value) => {
node.parent = this;
node.loadFromJson(el.get_object(), version);
this.items.add(node);
+ this.childstore.append(node);
});
return;
}
if (key == "listeners") {
var li = value.get_object();
li.foreach_member((lio , li_key, li_value) => {
- this.listeners.set(li_key, new NodeProp.listener(li_key, this.jsonNodeAsString(li_value)));
+ this.add_prop(new NodeProp.listener(li_key, this.jsonNodeAsString(li_value)));
+ //this.listeners.set(li_key, new NodeProp.listener(li_key, this.jsonNodeAsString(li_value)));
});
return;
}
}
var n = new NodeProp.from_json(rkey, sval);
- this.props.set(n.to_index_key(), n );
+ this.add_prop(n );
});
//o.set_string_member(key,val);
}
+
+
+ public string nodeTipProp {
+ set {
+ // NOOp ??? should
+ }
+ owned get {
+ return this.nodeTip();
+ }
+ }
// fixme this needs to better handle 'user defined types etc..
public string nodeTip()
{
var prop = this.props.get(pk);
var i = prop.name.strip();
+ var val = prop.val;
+ val = val == null ? "" : val;
+
switch(prop.ptype) {
case PROP:
case RAW: // should they be the same?
- props += "\n\t<b>" +
- GLib.Markup.escape_text(i) +"</b> : " +
- GLib.Markup.escape_text(prop.val.split("\n")[0]);
+ props += "\n\t" + GLib.Markup.escape_text(prop.rtype) +
+ " <b>" + GLib.Markup.escape_text(i) +"</b> : " +
+ GLib.Markup.escape_text(val.split("\n")[0]);
break;
case METHOD :
- funcs += "\n\t<b>" +
- GLib.Markup.escape_text(i.substring(1)).strip() +"</b> : " +
- GLib.Markup.escape_text(prop.val.split("\n")[0]);
+ funcs += "\n\t" + GLib.Markup.escape_text(prop.rtype) +
+ " <b>" + GLib.Markup.escape_text(i) +"</b> : " +
+ 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(prop.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(prop.val.split("\n")[0]);
+ GLib.Markup.escape_text(val.split("\n")[0]);
break;
case LISTENER : return ""; // always raw...
return ret;
}
+
+ public string nodeTitleProp {
+ set {
+ // NOOp ??? should
+ }
+ owned get {
+ return this.nodeTitle();
+ }
+ }
+
+
+
+
+
+
public string nodeTitle(bool for_tip = false)
{
string[] txt = {};
//if (sr) txt.push('</s>');
return (txt.length == 0) ? "Element" : string.joinv(" ", txt);
}
+ // used by trees to display icons?
+ // needs more thought?!?
+ public string iconFilename {
+ set {
+ // NOOp ??? should
+ }
+ owned get {
+ var clsname = this.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";
+ //if (FileUtils.test (fn, FileTest.IS_REGULAR)) {
+ return fn;
+ //}
+ //return "/dev/null"; //???
+ }
+ }
+
+
+
+ public void insertAfter(Node child, Node after)
+ {
+ this.insertChild(this.items.index_of(after) + 1, child);
+ }
+ public void insertBefore(Node child, Node before)
+ {
+ this.insertChild(this.items.index_of(before), child);
+ }
+
+ public void insertChild(int pos, Node child)
+ {
+ this.items.insert(pos, child);
+ this.childstore.insert(pos, child);
+ child.parent = this;
+ }
+ public void appendChild(Node child)
+ {
+ this.items.add( child);
+ this.childstore.append(child);
+ child.parent = this;
+ }
+
+
+ /**
+
+ properties
+ previous we had listeners / and props
+
+ we really need to store this as flat array - keep it simple!?
+
+ getValue(key)
+ update(key, value)
+
+
+
+ */
+
+
+
+
+ public void loadProps(GLib.ListStore model)
+ {
+
+ // fixme sorting?? - no need to loop twice .. just use sorting.!
+ var oldstore = this.propstore;
+ this.propstore = model;
+ for(var i = 0; i < oldstore.n_items; i++ ) {
+ var it = (NodeProp) oldstore.get_item(i);
+ model.append(it);
+
+ }
+ this.sortProps();
+
+ }
+ // used to replace propstore, so it does not get wiped by editing a node
+ public void dupeProps()
+ {
+ GLib.debug("dupeProps START");
+ var oldstore = this.propstore;
+ this.propstore = new GLib.ListStore(typeof(NodeProp));;
+ for(var i = 0; i < oldstore.n_items; i++ ) {
+ var it = (NodeProp) oldstore.get_item(i);
+ this.propstore.append(it);
+ }
+ GLib.debug("dupeProps END");
+ }
+
+
+ public void remove_prop(NodeProp prop)
+ {
+ uint pos;
+ if (!this.propstore.find(prop, out pos)) {
+ return;
+ }
+ this.propstore.remove(pos);
+ this.updated_count++;
+
+ }
+
+ public bool has_prop_key(NodeProp prop)
+ {
+ for(var i = 0; i < this.propstore.n_items; i++ ) {
+ var it = (NodeProp) this.propstore.get_item(i);
+ if (it.ptype == prop.ptype && it.to_index_key() == prop.to_index_key()) {
+ return true;
+ }
+
+ }
+ return false;
+
+ }
+
+
+
+
+ public void add_prop(NodeProp prop)
+ {
+ 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.sortProps();
+
+ this.updated_count++;
+
+
+ }
+
+ int props_updated_count = -1;
+ Gee.HashMap<string,NodeProp> props_cache;
+
+ public Gee.HashMap<string,NodeProp> props {
+ owned get {
+ if (this.updated_count == this.props_updated_count) {
+ return this.props_cache;
+ }
+ this.props_cache = new Gee.HashMap<string,NodeProp>(); // the properties..
+ for(var i = 0; i < this.propstore.n_items; i++ ) {
+ var it = (NodeProp) this.propstore.get_item(i);
+ if (it.ptype != NodePropType.LISTENER) {
+ // GLib.debug("props add key %s", it.to_index_key());
+ this.props_cache.set( it.to_index_key() , it);
+ }
+ }
+ this.props_updated_count = this.updated_count;
+ return this.props_cache;
+ }
+ private set {
+ GLib.error("do not set listerners direclty");
+ }
+ }
+
+ int listeners_updated_count = -1;
+ Gee.HashMap<string,NodeProp> listeners_cache;
+
+ //private Gee.HashMap<string,NodeProp> _listeners; // the listeners..
+ public Gee.HashMap<string,NodeProp> listeners {
+ owned get {
+ if (this.updated_count == this.listeners_updated_count) {
+ return this.listeners_cache;
+ }
+
+ this.listeners_cache = new Gee.HashMap<string,NodeProp>(); // the properties..
+
+ for(var i = 0; i < this.propstore.n_items; i++ ) {
+ var it = (NodeProp) this.propstore.get_item(i);
+ if (it.ptype == NodePropType.LISTENER) {
+ this.listeners_cache.set( it.to_index_key() , it);
+ }
+ }
+ this.listeners_updated_count = this.updated_count;
+ return this.listeners_cache;;
+ }
+ private set {
+ GLib.error("do not set listerners direclty");
+ }
+ }
+ private void sortProps ()
+ {
+
+ this.propstore.sort( (a, b) => {
+
+ return Posix.strcmp( ((NodeProp)a).to_sort_key(), ((NodeProp)b).to_sort_key());
+
+ });
+
+
+ }
}
return PROP;
}
+ public string to_name()
+ {
+ switch (this) {
+ case RAW: return "Raw Property (not quoted or escaped)";
+ case METHOD : return "User Defined Method";
+ case SIGNAL : return "Vala Signal"; // vala signal
+ case USER : return "User Defined Property"; // user defined.
+ case SPECIAL : return "Special Property (eg. prop / arg / ctor / init)"; // * prop| args | ctor | init
+ case LISTENER : return "Listener / Signal Handler"; // always raw...
+ // not used
+ case NONE: return "None??";
+ case CTOR: return "Constructor?";
+ case PROP: return "Gtk/Roo Property";
+ default: return "oops";
+
+ }
+ }
+
}
public class JsRender.NodeProp : Object {
+ private string _name = "";
+ public string name {
+ get {
+ return this._name;
+ }
+ set {
+ if (this._name == value) {
+ return;
+ }
+ this._name = value;
- public string name = "";
- public NodePropType ptype;
- public string rtype = ""; // return or type
- public string val = "";
+ if (this.parent != null) {
+ // causes props/ listeners array to get updated.
+ this.parent.updated_count++;
+ }
+ }
+ } // can not be updated... ?? you have to remove / replace?
+ private NodePropType _ptype;
+
+ public NodePropType ptype {
+ get {
+ return this._ptype;
+ }
+ set {
+ if (this._ptype == value) {
+ return;
+ }
+ this._ptype = value;
+ if (this.parent != null) {
+ // causes props/ listeners array to get updated.
+ this.parent.updated_count++;
+ }
+ }
+ }
+ private string _rtype = "";
+ public string rtype {
+ get {
+ return this._rtype;
+ }
+ set {
+ if (this._rtype == value) {
+ return;
+ }
+ this._rtype = value;
+ if (this.parent != null) {
+ this.parent.updated_count++;
+ }
+ this.to_display_name_prop = "";
+ this.to_tooltip_name_prop = "";
+ this.updated_count++;
+ }
+ } // return or type
+
+ private string _val = "";
+ public string val {
+ get {
+ return this._val;
+ }
+ set {
+ if (this._val == value) {
+ return;
+ }
+ this._val = value;
+
+ if (this.parent != null) {
+ this.parent.updated_count++;
+ }
+ this.val_short = "";
+ this.val_tooltip = "";
+ this.updated_count++;
+
+ }
+ }
+
+
+ private int _updated_count = 0;
+ public int updated_count {
+ get {
+ return this._updated_count;
+ }
+ set {
+
+ // set things that are used to display values.
+ this.to_display_name_prop = "";
+ this.to_tooltip_name_prop = "";
+ this. _updated_count = value;
+ }
+
+ } // changes to this trigger updates on the tree..
+
+ public string sort_name {
+ owned get {
+ if (this.add_node == null) {
+ return this.name;
+ }
+ return this.name + " " + this.add_node.fqn();
+ }
+ set {}
+
+ }
+
+
+ public Node? parent; // the parent node.
+
+
public int start_line = 0;
public int end_line = 0;
+ // used by display list..
+ public GLib.ListStore childstore; // WILL BE USED FOR properties with mutliple types
+ public Node? add_node = null; // used when we list potentional nodes for properties in add list.
+
+ public string propertyof { get; set; }
public NodeProp(string name, NodePropType ptype, string rtype, string val) {
this.ptype = ptype;
this.rtype = rtype;
this.val = val;
+ this.childstore = new GLib.ListStore( typeof(NodeProp));
+ }
+
+
+ public bool equals(NodeProp p)
+ {
+ return this.name == p.name
+ &&
+ this.ptype == p.ptype
+ &&
+ this.rtype == p.rtype
+ &&
+ this.val == p.val;
}
public NodeProp dupe()
return this.name;
}
- // how it appears on the property list. --
+ // how it appears on the property list. -
+
+
+
+ public string val_short {
+ set {
+ // NOOp ??? should
+ }
+ owned get {
+
+ if (this._val.index_of("\n") < 0) {
+ return this._val;
+ }
+ var vals = this._val.split("\n");
+ return vals[0] + (vals.length > 1 ? " ..." : "");
+ }
+ }
+
+ public string val_tooltip {
+ set {
+ // NOOp ??? should
+ }
+ owned get {
+
+ return "<tt>" + GLib.Markup.escape_text(this.val) + "</tt>";
+ }
+
+
+ }
+
+ public string to_display_name_prop {
+ set {
+ // NOOp ??? should
+ }
+ owned get {
+ return this.to_display_name();
+ }
+ }
+
+
+
public string to_display_name()
{
// before we showed "@" for signals
switch(this.ptype) {
case NodePropType.PROP:
- return this.name;
+ return GLib.Markup.escape_text(this.name);
case NodePropType.RAW:
return "<span style=\"italic\">" + GLib.Markup.escape_text(this.name) + "</span>";
return this.name;
}
+ public string to_tooltip_name_prop {
+ set {
+ // NOOp ??? should
+ }
+ owned get {
+ return this.to_tooltip_name();
+ }
+ }
+
+ public string to_tooltip_name()
+ {
+
+ //return (this.rtype.length > 0 ? this.rtype + " " : "") + this.name;
+ // before we showed "@" for signals
+ switch(this.ptype) {
+ case NodePropType.PROP:
+ case NodePropType.SIGNAL:
+ case NodePropType.RAW:
+ case NodePropType.SPECIAL :
+ case NodePropType.LISTENER :
+ return GLib.Markup.escape_text(this.name) ;
+
+ case NodePropType.METHOD :
+ case NodePropType.USER :
+ return GLib.Markup.escape_text(this.rtype) + " " + GLib.Markup.escape_text( this.name) ;
+
+
+
+ case NodePropType.NONE: // not used
+ case NodePropType.CTOR:
+ return "";
+
+
+ }
+ return this.name;
+ }
// used ot sort the dispaly list of properties.
public string to_sort_key()
{
{
this(name, NodePropType.SIGNAL, rtype, val);
}
+ public void appendChild(NodeProp child)
+ {
+ this.childstore.append(child);
+
+ }
+
+ /**
+ could use enums.. but basically.
+ 0 - > inline text editor
+ 1 -> pulldown
+ 2 -> full editor
+ */
+ public bool useTextArea()
+ {
+
+ var use_textarea = false;
+
+ //------------ things that require the text editor...
+
+ if (this.ptype == NodePropType.LISTENER) {
+ use_textarea = true;
+ }
+ if (this.ptype == NodePropType.METHOD) {
+ use_textarea = true;
+ }
+
+ if ( this.name == "init" && this.ptype == NodePropType.SPECIAL) {
+ use_textarea = true;
+ }
+ if (this.val.length > 40 || this.val.index_of("\n") > -1) { // long value...
+ use_textarea = true;
+ }
+
+ return use_textarea;
+
+ }
+
+
+
}
+
\ No newline at end of file
public Xml.Doc* mungeNode()
{
Xml.Doc* doc;
+ var is_top = false;
if (this.parent == null) {
+ is_top = true;
doc = new Xml.Doc("1.0");
var inf = this.create_element("interface");
doc->set_root_element(inf);
var req = this.create_element("requires");
req->set_prop("lib", "gtk+");
- req->set_prop("version", "3.12");
+ req->set_prop("version", "4.1");
inf->add_child(req);
this.parent = inf;
} else {
}
var cls = this.node.fqn().replace(".", "");
- Palete.Gir.factoryFqn(this.project, this.node.fqn());
+ var gdata = Palete.Gir.factoryFqn(this.project, this.node.fqn());
+ if (gdata == null || !gdata.inherits.contains("Gtk.Buildable")) {
+ return doc;
+ }
+ if (gdata.inherits.contains("Gtk.Native")&& !is_top) {
+ return doc;
+ }
-
+ // other problems!!!
+
+ if (gdata.fqn() == ("Gtk.ListStore")) {
+ return doc;
+ }
// should really use GXml...
var obj = this.create_element("object");
- var id = this.node.uid();
- obj->set_prop("class", cls);
- obj->set_prop("id", id);
+ //var id = this.node.uid();
+ var skip_props = false;
+ if (gdata.inherits.contains("Gtk.Native")) {
+
+ obj->set_prop("class", "GtkFrame");
+ skip_props = true;
+ } else {
+
+ obj->set_prop("class", cls);
+ }
+ obj->set_prop("id", "w" + this.node.oid.to_string());
this.parent->add_child(obj);
// properties..
var props = Palete.Gir.factoryFqn(this.project, this.node.fqn()).props;
var pviter = props.map_iterator();
- while (pviter.next()) {
+ while (!skip_props && pviter.next()) {
GLib.debug ("Check: " +cls + "::(" + pviter.get_value().propertyof + ")" + pviter.get_key() + " " );
if (!this.node.has(pviter.get_key())) {
continue;
}
- var k = pviter.get_key();
- var val = this.node.get(pviter.get_key()).strip();
- var prop = this.create_element("property");
- prop->set_prop("name", k);
- switch (k) {
- case "orientation":
- var bits = val.split(".");
- val = bits.length > 2 ? bits[2].down() : "vertical"; // ??
- break;
+ var k = pviter.get_key();
+ var prop = props.get(k);
+ var val = this.node.get(pviter.get_key()).strip();
+ // for Enums - we change it to lowercase, and remove all the previous bits.. hopefully might work.
+ if (prop.type.contains(".") && val.contains(".")) {
+ var typ = Palete.Gir.factoryFqn(this.project, prop.type);
+ if (typ.nodetype == "Enum") {
+ var bits = val.split(".");
+ val = bits[bits.length-1].down();
+ }
}
+
+
+
+
+ var domprop = this.create_element("property");
+ domprop->set_prop("name", k);
+
- prop->add_child(new Xml.Node.text(val));
- obj->add_child(prop);
+ domprop->add_child(new Xml.Node.text(val));
+ obj->add_child(domprop);
}
// packing???
/*
} */
// children..
-
- for (var i = 0; i < this.node.items.size; i++ ) {
- var cn = this.node.items.get(i);
+ var items = this.node.readItems();
+ for (var i = 0; i < items.size; i++ ) {
+ var cn = items.get(i);
var child = this.create_element("child");
if (cls == "GtkWindow" && cn.fqn() == "Gtk.HeaderBar") {
child->set_prop("type", "titlebar");
}
- /*
- public string packString()
- {
-
-
-
-
- // pack is part of the parent element..
- var p = node.parent;
- string[] pk= { "add" };
- var pfqn = "Gtk.Box";
- if (p != null) {
- pfqn = p.fqn();
- if (this.node.props.get("* pack") == null) {
- return "";
- }
- pk = this.node.get("* pack").split(",");
- } else {
- if (this.node.props.get("* pack") != null) {
- pk = this.node.get("* pack").split(",");
- }
-
- }
-
- if (pfqn == null) {
- return "";
- }
- if (pfqn == "Gtk.ScrolledWindow") {
- return "";
- }
- var p_parts =pfqn.split(".");
-
-
- var ns = p_parts[0];
- var gir = Palete.Gir.factory(this.project, ns);
- var cls = gir.classes.get(p_parts[1]);
- var mdef = cls.methods.get(pk[0]);
- if (mdef == null) {
- GLib.debug ("could not find method : %s\n", pk[0]);
- return "";
- }
- /*
- var generator = new Json.Generator ();
- var n = new Json.Node(Json.NodeType.OBJECT);
- n.set_object(mdef.toJSON());
- generator.set_root(n);
- generator.indent = 4;
- generator.pretty = true;
-
- GLib.debug print(generator.to_data(null));
- */
- /*
- string[] pbody = {};
- switch(pk[0]) {
-
- case "pack_start":
- pbody += @"$pad <property name=\"pack_type\">start</property>\n";
- break;
-
- case "pack_end":
- pbody += @"$pad <property name=\"pack_type\">start</property>\n";
- break;
-
- case "add":
- //pbody += @"$pad <property name=\"pack_type\">start</property>\n";
- pbody += @"$pad <property name=\"expand\">True</property>\n";
- pbody += @"$pad <property name=\"fill\">True</property>\n";
- //pbody += @"$pad <property name=\"position\">1</property>\n";
- var pack = @"$pad<packing>\n" +
- string.joinv("", pbody) +
- @"$pad</packing>\n";
- return pack;
-
- case "set_model":
- GLib.debug ("set_model not handled yet..");
- return "";
-
- default:
- GLib.debug ("unknown pack type: %s", pk[0]);
- return "";
-
- }
-
-
-
- for (var i = 2; i < mdef.paramset.params.size; i++) {
- var poff = i - 1;
- if (poff > (pk.length-1)) {
- break;
- }
-
- var key = mdef.paramset.params.get(i).name;
- var val = pk[poff];
- pbody += @"$pad <property name=\"$key\">$val</property>\n";
-
- }
-
- if (pbody.length < 1) {
- /*var generator = new Json.Generator ();
- var n = new Json.Node(Json.NodeType.OBJECT);
- n.set_object(mdef.toJSON());
- generator.set_root(n);
- generator.indent = 4;
- generator.pretty = true;
-
- print(generator.to_data(null));
- */
- /*
- GLib.debug ("skip - packing - no arguments (" + pk[0] + ")\n");
- return "";
- }
-
- var pack = @"$pad<packing>\n" +
- string.joinv("", pbody) +
- @"$pad</packing>\n";
- return pack;
-
- }
- */
+
// pack paramenters
-
- if (parent != null && parent.get_type().is_a(typeof(global::Gtk.Container))) {
+ // GTK 4 does not appear to have any way to determine if a element is a container..
+ //if (parent != null && parent.get_type().is_a(typeof(global::Gtk.Container))) {
this.packContainerParams();
- }
-
+ //}//
var cls_gir =Palete.Gir.factoryFqn(this.project, this.node.fqn());
if (cls_gir == null) {
return null;
print("skip menu pack - parent is not a widget");
return;
}
-
+ return;
+ /*
var p = (global::Gtk.Menu)this.wrapped_object;
((global::Gtk.Widget)parent).button_press_event.connect((s, ev) => {
p.set_screen(Gdk.Screen.get_default());
p.popup_at_pointer(ev);
return true;
});
+ */
}
public void packTreeStore()
continue;
}
print ("pack:set_property ( %s , %s / %s)\n", k, pack[i].strip(), val.strdup_contents());
-
- ((global::Gtk.Container)parent).child_set_property(
- (global::Gtk.Widget)this.wrapped_object , k, val);
+
+ //((global::Gtk.Container)parent).child_set_property(
+ // (global::Gtk.Widget)this.wrapped_object , k, val);
}
// output xns / xtype first..
if (this.out_props.has_key("xtype")) {
var v = this.out_props.get("xtype");
+
this.node.setLine(this.cur_line, "p","xtype");
this.addLine(this.pad + "xtype" + " : " + v + suffix, ',');
}
var v = this.out_props.get(k);
this.node.setLine(this.cur_line, "p",k);
+
this.addLine(this.pad + k + " : " + v + suffix, ',');
-
- this.node.setLine(this.cur_line, "e", "");
+
+ this.node.setLine(this.cur_line, "e", k);
}
var k = iter.get();
var v = this.out_listeners.get(k);
+
this.node.setLine(this.cur_line, "l",k); //listener
this.addLine(this.pad + indent_str + k + " : " + v , ',');
- this.node.setLine(this.cur_line, "e", "");
+
+ this.node.setLine(this.cur_line, "x", k);
}
this.closeLine();
if (this.out_props.has_key("xns")) {
var v = this.out_props.get("xns");
+
this.node.setLine(this.cur_line, "p","xns");
this.addLine(this.pad + "xns" + " : " + v + suffix, ',');
this.node.setLine(this.cur_line, "p","| xns");
this.addLine(this.pad + "'|xns' : '" + v + "'", ',');
- this.node.setLine(this.cur_line, "e", "");
+ this.node.setLine(this.cur_line, "e", "xns");
+
}
this.node.line_end = this.cur_line;
var niter = this.out_nodeprops.map_iterator();
while(niter.next()) {
- var addstr = this.mungeChildNew(this.pad + indent_str, niter.get_value());
+
//print("add str: %s\n", addstr);
this.node.setLine(this.cur_line, "p",niter.get_key());
+
+ var addstr = this.mungeChildNew(this.pad + indent_str, niter.get_value());
this.addLine(this.pad + niter.get_key() + " : " + addstr, ',');
-
+
this.node.setLine(this.cur_line, "e", "");
}
// prop arrays...
var piter = this.out_props_array.map_iterator();
while(piter.next()) {
+
this.node.setLine(this.cur_line, "p",piter.get_key());
this.addLine(this.pad + piter.get_key() + " : [", 0);
this.node.setLine(this.cur_line, "e", "");
}
this.closeLine();
+
this.addLine(this.pad + "]" , ',');
+
}
// children..
return;
}
// look for '*props'
-
- for (var ii =0; ii< this.node.items.size; ii++) {
- var pl = this.node.items.get(ii);
+ var items = this.node.readItems();
+ for (var ii =0; ii< items.size; ii++) {
+ var pl = items.get(ii);
if (!pl.props.has_key("* prop")) {
//newitems.add(pl);
continue;
public void iterChildren()
{
-
+ var items = this.node.readItems();
// finally munge the children...
- if (this.node.items.size < 1) {
+ if (items.size < 1) {
return;
}
var itms = "items : [\n";
//var n = 0;
- for(var i = 0; i < this.node.items.size;i++) {
- var ele = this.node.items.get(i);
+ for(var i = 0; i < items.size;i++) {
+ var ele = items.get(i);
if (ele.props.has_key("* prop")) {
continue;
}
*
*/
-
-
-
+
public class JsRender.NodeToVala : Object {
Node node;
this.node = node;
this.depth = depth;
- this.inpad = string.nfill(depth > 0 ? 4 : 0, ' ');
+ if (file.name.contains(".")) { // namespaced..
+ this.inpad = string.nfill(depth > 0 ? 8 : 4, ' ');
+ } else {
+ this.inpad = string.nfill(depth > 0 ? 8 : 4, ' ');
+ }
this.pad = this.inpad + " ";
this.ipad = this.inpad + " ";
this.cls = node.xvala_cls;
this.xcls = node.xvala_xcls;
+ if (depth == 0 && this.xcls.contains(".")) {
+ var ar = this.xcls.split(".");
+ this.xcls = ar[ar.length-1];
+ }
+
+
this.ret = "";
this.cur_line = parent == null ? 0 : parent.cur_line;
} else if (!item.props.has_key("id")) {
// use the file name..
- item.xvala_xcls = this.file.name;
+ item.xvala_xcls = this.file.file_without_namespace;
// is id used?
- item.xvala_id = this.file.name;
+ item.xvala_id = this.file.file_without_namespace;
}
// loop children..
- if (item.items.size < 1) {
+ if (item.readItems().size < 1) {
return;
}
- for(var i =0;i<item.items.size;i++) {
- this.toValaName(item.items.get(i), depth+1);
+ for(var i =0;i<item.readItems().size;i++) {
+ this.toValaName(item.readItems().get(i), depth+1);
}
}
}
-
+ int child_count = 1; // used to number the children.
public string munge ( )
{
//return this.mungeToString(this.node);
-
+ this.child_count = 1;
this.ignore("pack");
this.ignore("init");
this.ignore("xns");
this.ignore("xtype");
this.ignore("id");
+ this.namespaceHeader();
this.globalVars();
this.classHeader();
this.addSingleton();
this.addPlusProperties();
this.addValaCtor();
this.addUnderThis();
- this.addWrappedCtor();
+ this.addWrappedCtor(); // var this.el = new XXXXX()
this.addInitMyVars();
this.addWrappedProperties();
this.addEndCtor();
this.addUserMethods();
this.iterChildren();
+ this.namespaceFooter();
return this.ret;
this.ret += str + "\n";
}
+ public void namespaceHeader()
+ {
+ if (this.depth > 0 || this.file.file_namespace == "") {
+ return;
+ }
+ this.addLine("namespace " + this.file.file_namespace);
+ this.addLine("{");
+
+ }
+ public void namespaceFooter()
+ {
+ if (this.depth > 0 || this.file.file_namespace == "") {
+ return;
+ }
+ this.addLine("}");
+ }
public void globalVars()
{
if (this.depth > 0) {
this.top.node.setNodeLine(this.cur_line, this.node);
- this.addLine(inpad + "public class " + this.xcls + " : Object");
+ this.addLine(this.inpad + "public class " + this.xcls + " : Object");
this.addLine(this.inpad + "{");
// if id of child is '+' then it's a property of this..
void addPlusProperties()
{
- if (this.node.items.size < 1) {
+ if (this.node.readItems().size < 1) {
return;
}
- var iter = this.node.items.list_iterator();
+ var iter = this.node.readItems().list_iterator();
while (iter.next()) {
var ci = iter.get();
}
}
+
/**
* Initialize this.el to point to the wrapped element.
*
var args_str = "";
switch(this.node.fqn()) {
+ // FIXME -- these are all GTK3 - can be removed when I get rid of them..
case "Gtk.ComboBox":
var is_entry = this.node.has("has_entry") && this.node.get_prop("has_entry").val.down() == "true";
if (!is_entry) {
if (default_ctor != null && default_ctor.paramset != null && default_ctor.paramset.params.size > 0) {
string[] args = {};
- var iter = default_ctor.paramset.params.list_iterator();
- while (iter.next()) {
- var n = iter.get().name;
- GLib.debug("building CTOR ARGS: %s, %s", n, iter.get().is_varargs ? "VARARGS": "");
+ foreach(var param in default_ctor.paramset.params) {
+
+ var n = param.name;
+ GLib.debug("building CTOR ARGS: %s, %s", n, param.is_varargs ? "VARARGS": "");
if (n == "___") { // for some reason our varargs are converted to '___' ...
continue;
}
- if (!this.node.has(n)) { // node does not have a value
+ if (this.node.has(n)) { // node does not have a value
-
- if (iter.get().type.contains("int")) {
- args += "0";
- continue;
+ this.ignoreWrapped(n);
+ this.ignore(n);
+
+ var v = this.node.get(n);
+
+ if (param.type == "string") {
+ v = "\"" + v.escape("") + "\"";
}
- if (iter.get().type.contains("float")) {
- args += "0f";
- continue;
+ if (v == "TRUE" || v == "FALSE") {
+ v = v.down();
}
- if (iter.get().type.contains("bool")) {
- args += "true"; // always default to true?
- continue;
+
+
+ args += v;
+ continue;
+ }
+ var propnode = this.node.findProp(n);
+ if (propnode != null) {
+ // assume it's ok..
+
+ var pname = this.addPropSet(propnode, propnode.has("id") ? propnode.get_prop("id").val : "");
+ args += (pname + ".el") ;
+ if (!propnode.has("id")) {
+ this.addLine(this.ipad + pname +".ref();");
}
- // any other types???
- args += "null";
+
+
+ this.ignoreWrapped(n);
+
continue;
}
- this.ignoreWrapped(n);
- this.ignore(n);
-
- var v = this.node.get(n);
-
- if (iter.get().type == "string") {
- v = "\"" + v.escape("") + "\"";
+
+
+
+
+
+ if (param.type.contains("int")) {
+ args += "0";
+ continue;
}
- if (v == "TRUE" || v == "FALSE") {
- v = v.down();
+ if (param.type.contains("float")) {
+ args += "0f";
+ continue;
}
-
+ if (param.type.contains("bool")) {
+ args += "true"; // always default to true?
+ continue;
+ }
+ // any other types???
+
+
+
+
+ args += "null";
+
- args += v;
}
this.node.setLine(this.cur_line, "p", "* xtype");
-
this.addLine(this.ipad + "this.el = new " + this.node.fqn() + "( "+ string.joinv(", ",args) + " );") ;
return;
void addChildren()
{
//code
- if (this.node.items.size < 1) {
+ if (this.node.readItems().size < 1) {
return;
}
this.pane_number = 0;
- var cols = this.node.has("* columns") ? int.parse(this.node.get_prop("* columns").val) : 1;
+ var cols = this.node.has("* columns") ? int.max(1, int.parse(this.node.get_prop("* columns").val)) : 1;
var colpos = 0;
- var iter = this.node.items.list_iterator();
- var i = -1;
- while (iter.next()) {
- i++;
-
- var child = iter.get();
+
+
+ foreach(var child in this.node.readItems()) {
+
+
+
if (child.xvala_id[0] == '*') {
continue; // skip generation of children?
}
-
- var xargs = "";
- if (child.has("* args")) {
-
- var ar = child.get_prop("* args").val.split(",");
- for (var ari = 0 ; ari < ar.length; ari++ ) {
- var arg = ar[ari].split(" ");
- xargs += "," + arg[arg.length -1];
- }
+
+ // probably added in ctor..
+ if (child.has("* prop") && this.shouldIgnoreWrapped(child.get_prop("* prop").val)) {
+ continue;
}
// create the element..
- this.addLine(this.ipad + "var child_" + "%d".printf(i) + " = new " + child.xvala_xcls +
- "( _this " + xargs + ");" );
// this is only needed if it does not have an ID???
-
+ var childname = this.addPropSet(child, child.has("id") ? child.get_prop("id").val : "") ;
if (child.has("* prop")) {
+
+
// fixme special packing!??!?!
if (child.get_prop("* prop").val.contains("[]")) {
// currently these 'child props
// used for label[] on Notebook
// used for button[] on Dialog?
// columns[] ?
+<<<<<<< HEAD
this.packChild(child, i, 0, 0, child.get_prop("* prop").val); /// fixme - this is a bit speciall...
+=======
+
+ this.packChild(child, childname, 0, 0, child.get_prop("* prop").val); /// fixme - this is a bit speciall...
+>>>>>>> wip_alan_T7440_handling_gtk4_and_bad_girs
continue;
}
- // add a ref... (if 'id' is not set... to a '+' ?? what does that mean? - fake ids?
- if (child.xvala_id.length < 1 || child.xvala_id[0] != '+') {
- this.addLine(this.ipad + "child_" + "%d".printf(i) +".ref();"); // we need to reference increase unnamed children...
- } else {
- //this.addLine(this.ipad + "// no ref as xvala_id is %s".printf(child.xvala_id));
- }
+
+
+ this.ignoreWrapped(child.get_prop("* prop").val);
- this.addLine(ipad + "this.el." + child.get_prop("* prop").val + " = child_" + "%d".printf(i) + ".el;");
+ this.addLine(ipad + "this.el." + child.get_prop("* prop").val + " = " + childname + ".el;");
continue;
}
+ if (!child.has("id")) {
+ this.addLine(this.ipad + childname +".ref();");
+ }
+ this.packChild(child, childname, cols, colpos);
- if (child.xvala_id.length < 1 || child.xvala_id[0] != '+') {
- this.addLine(this.ipad + "child_" + "%d".printf(i) +".ref();"); // we need to reference increase unnamed children...
- } else {
- //this.addLine(this.ipad + "// no ref as xvala_id is %s".printf(child.xvala_id));
- }
-
-
- this.packChild(child, i, cols, colpos);
if (child.has("colspan")) {
colpos += int.parse(child.get_prop("colspan").val);
} else {
colpos += 1;
}
- if (child.xvala_id[0] != '+') {
- continue; // skip generation of children?
-
- }
+
// this.{id - without the '+'} = the element...
- this.addLine(this.ipad + "this." + child.xvala_id.substring(1) + " = child_" + "%d".printf(i) + ";");
+
}
}
+ string addPropSet(Node child, string child_name)
+ {
+
+
+ var xargs = "";
+ if (child.has("* args")) {
+
+ var ar = child.get_prop("* args").val.split(",");
+ for (var ari = 0 ; ari < ar.length; ari++ ) {
+ var arg = ar[ari].split(" ");
+ xargs += "," + arg[arg.length -1];
+ }
+ }
+
+ var childname = "child_" + "%d".printf(this.child_count++);
+ var prefix = "";
+ if (child_name == "") {
+ prefix = "var " + childname + " = ";
+ }
+
+ this.addLine(this.ipad + prefix + "new " + child.xvala_xcls + "( _this " + xargs + ");" );
+
+ // add a ref... (if 'id' is not set... to a '+' ?? what does that mean? - fake ids?
+ // remove '+' support as I cant remember what it does!!!
+ //if (child.xvala_id.length < 1 ) {
+ // this.addLine(this.ipad + childname +".ref();"); // we need to reference increase unnamed children...
+ //}
+ //if (child.xvala_id[0] == '+') {
+ // this.addLine(this.ipad + "this." + child.xvala_id.substring(1) + " = " + childname+ ";");
+
+ //}
+
+
+ return child_name == "" ? childname : ("_this." + child_name);
+ }
+
+
- void packChild(Node child, int i, int cols, int colpos, string propname= "")
+ void packChild(Node child, string childname, int cols, int colpos, string propname= "")
{
GLib.debug("packChild %s=>%s", this.node.fqn(), child.fqn());
}
var pack = packing[0];
- this.addLine(this.ipad + "this.el." + pack.strip() + " ( child_" + "%d".printf(i) + ".el " +
+ this.addLine(this.ipad + "this.el." + pack.strip() + " ( " + childname + ".el " +
(packing.length > 1 ?
(", " + string.joinv(",", packing).substring(pack.length+1))
:
return;
}
var childcls = this.file.project.palete.getClass(child.fqn()); // very trusting..
+<<<<<<< HEAD
var is_event = childcls.inherits.contains("Gtk.EventController") || childcls.implements.contains("Gtk.EventController");
if (is_event) {
this.addLine(this.ipad + "this.el.add_controller( child_%d.el );".printf(i) );
+=======
+ if (childcls == null) {
+ return;
+ }
+ // GTK4
+ var is_event = childcls.inherits.contains("Gtk.EventController") || childcls.implements.contains("Gtk.EventController");
+ if (is_event) {
+ this.addLine(this.ipad + "this.el.add_controller( %s.el );".printf(childname) );
+>>>>>>> wip_alan_T7440_handling_gtk4_and_bad_girs
return;
}
case "Gtk.Layout":
var x = child.has("x") ? child.get_prop("x").val : "0";
var y = child.has("y") ? child.get_prop("y").val : "0";
- this.addLine(this.ipad + "this.el.put( child_%d.el, %s, %s );".printf(i,x,y) );
+ this.addLine(this.ipad + "this.el.put( %s.el, %s, %s );".printf(childname,x,y) );
return;
- case "Gtk.Grid":
- var x = "%d".printf(colpos % cols);
- var y = "%d".printf(( colpos - (colpos % cols) ) / cols);
- var w = child.has("colspan") ? child.get_prop("colspan").val : "1";
- var h = "1";
- this.addLine(this.ipad + "this.el.attach( child_%d.el, %s, %s, %s, %s );".printf(i,x,y, w, h) );
- return;
+
case "Gtk.Stack":
var named = child.has("stack_name") ? child.get_prop("stack_name").val.escape() : "";
var title = child.has("stack_title") ? child.get_prop("stack_title").val.escape() : "";
if (title.length > 0) {
- this.addLine(this.ipad + "this.el.add_titled( child_%d.el, \"%s\", \"%s\" );".printf(i,named,title));
+ this.addLine(this.ipad + "this.el.add_titled( %s.el, \"%s\", \"%s\" );".printf(childname,named,title));
} else {
- this.addLine(this.ipad + "this.el.add_named( child_%d.el, \"%s\" );".printf(i,named));
+ this.addLine(this.ipad + "this.el.add_named( %s.el, \"%s\" );".printf(childname,named));
}
return;
case "Gtk.Notebook": // use label
var label = child.has("notebook_label") ? child.get_prop("notebook_label").val.escape() : "";
- this.addLine(this.ipad + "this.el.append_page( child_%d.el, new Gtk.Label(\"%s\"));".printf(i, label));
+ this.addLine(this.ipad + "this.el.append_page( %s.el, new Gtk.Label(\"%s\"));".printf(childname, label));
return;
case "Gtk.TreeView": // adding TreeViewColumns
- this.addLine(this.ipad + "this.el.append_column( child_" + "%d".printf(i) + ".el );");
+ this.addLine(this.ipad + "this.el.append_column( " + childname + ".el );");
return;
case "Gtk.TreeViewColumn": //adding Renderers - I think these are all proprerties of the renderer used...
if (child.has("markup_column") && int.parse(child.get_prop("markup_column").val) > -1) {
- this.addLine(this.ipad + "this.el.add_attribute( child_%d.el, \"markup\", %s );".printf(i, child.get_prop("markup_column").val));
+ this.addLine(this.ipad + "this.el.add_attribute( %s.el, \"markup\", %s );".printf(childname, child.get_prop("markup_column").val));
}
if (child.has("text_column") && int.parse(child.get_prop("text_column").val) > -1) {
- this.addLine(this.ipad + "this.el.add_attribute( child_%d.el, \"text\", %s );".printf(i, child.get_prop("text_column").val));
+ this.addLine(this.ipad + "this.el.add_attribute( %s.el, \"text\", %s );".printf(childname, child.get_prop("text_column").val));
}
if (child.has("pixbuf_column") && int.parse(child.get_prop("pixbuf_column").val) > -1) {
- this.addLine(this.ipad + "this.el.add_attribute( child_%d.el, \"pixbuf\", %s );".printf(i, child.get_prop("pixbuf_column").val));
+ this.addLine(this.ipad + "this.el.add_attribute( %s.el, \"pixbuf\", %s );".printf(childname, child.get_prop("pixbuf_column").val));
}
if (child.has("pixbuf_column") && int.parse(child.get_prop("active_column").val) > -1) {
- this.addLine(this.ipad + "this.el.add_attribute( child_%d.el, \"active\", %s );".printf(i, child.get_prop("active_column").val));
+ this.addLine(this.ipad + "this.el.add_attribute( %s.el, \"active\", %s );".printf(childname, child.get_prop("active_column").val));
}
if (child.has("background_column") && int.parse(child.get_prop("background_column").val) > -1) {
- this.addLine(this.ipad + "this.el.add_attribute( child_%d.el, \"background-rgba\", %s );".printf(i, child.get_prop("background_column").val));
+ this.addLine(this.ipad + "this.el.add_attribute( %s.el, \"background-rgba\", %s );".printf(childname, child.get_prop("background_column").val));
}
- this.addLine(this.ipad + "this.el.add( child_" + "%d".printf(i) + ".el );");
+ this.addLine(this.ipad + "this.el.add( " + childname + ".el );");
// any more!?
return;
case "Gtk.Dialog":
if (propname == "buttons[]") {
- var resp_id = i;
+ var resp_id = int.parse(childname.replace("child_", ""));
if (child.has("* response_id")) {
resp_id = int.parse(child.get_prop("* response_id").val);
}
- this.addLine(this.ipad + "this.el.add_action_widget( child_%d.el, %d);".printf(i,resp_id) );
+ this.addLine(this.ipad + "this.el.add_action_widget( %s.el, %d);".printf(childname,resp_id) );
return;
}
- this.addLine(this.ipad + "this.el.get_content_area().add( child_" + "%d".printf(i) + ".el );");
+ this.addLine(this.ipad + "this.el.get_content_area().add( " + childname + ".el );");
return;
+
+
+
+
+
+ // known working with GTK4 !
+ case "Gtk.HeaderBar": // it could be end... - not sure how to hanle that other than overriding the pack method?
+ this.addLine(this.ipad + "this.el.pack_start( "+ childname + ".el );");
+ return;
+
+ case "GLib.Menu":
+ this.addLine(this.ipad + "this.el.append_item( "+ childname + ".el );");
+ return;
+
case "Gtk.Paned":
this.pane_number++;
switch(this.pane_number) {
case 1:
+ this.addLine(this.ipad + "this.el.pack_start( %s.el );".printf(childname));
+ return;
case 2:
- this.addLine(this.ipad + "this.el.pack%d( child_%d".printf(this.pane_number,i) + ".el );");
+ this.addLine(this.ipad + "this.el.pack_end( %s.el );".printf(childname));
return;
default:
// do nothing
break;
}
return;
-
- case "Gtk.Menu":
- this.addLine(this.ipad + "this.el.append( child_" + "%d".printf(i) + ".el );");
+
+ case "Gtk.ColumnView":
+ this.addLine(this.ipad + "this.el.append_column( "+ childname + ".el );");
+ return;
+
+ case "Gtk.Grid":
+ var x = "%d".printf(colpos % cols);
+ var y = "%d".printf(( colpos - (colpos % cols) ) / cols);
+ var w = child.has("colspan") ? child.get_prop("colspan").val : "1";
+ var h = "1";
+ this.addLine(this.ipad + "this.el.attach( %s.el, %s, %s, %s, %s );".printf(childname ,x,y, w, h) );
return;
default:
// gtk4 uses append!!!! - gtk3 - uses add..
+<<<<<<< HEAD
this.addLine(this.ipad + "this.el.append( child_" + "%d".printf(i) + ".el );");
+=======
+ this.addLine(this.ipad + "this.el.append( "+ childname + ".el );");
+>>>>>>> wip_alan_T7440_handling_gtk4_and_bad_girs
return;
this.addLine(this.inpad + "}");
}
- var iter = this.node.items.list_iterator();
+ var iter = this.node.readItems().list_iterator();
while (iter.next()) {
this.addMultiLine(this.mungeChild(iter.get()));
-
-
-
+
\ No newline at end of file
- public Roo(Project.Project project, string path) {
+ public Roo(Project.Roo project, string path)
+ {
aconstruct( project, path);
+
this.xtype = "Roo";
this.language = "js";
this.permname = this.jsonHasOrEmpty(obj, "permname");
this.title = this.jsonHasOrEmpty(obj, "title");
this.modOrder = this.jsonHasOrEmpty(obj, "modOrder");
-
+ if (obj.has_member("gen_extended")) { // should check type really..
+ this.gen_extended = obj.get_boolean_member("gen_extended");
+ }
var bjs_version_str = this.jsonHasOrEmpty(obj, "bjs-version");
bjs_version_str = bjs_version_str == "" ? "1" : bjs_version_str;
}
-
+ public Project.Roo roo_project {
+ set {}
+ get {
+ return (Project.Roo) this.project;
+ }
+ }
+
public override void saveHTML ( string html )
{
- GLib.debug ("SAVEHTML %s\n", this.project.runhtml);
- if (this.project.runhtml == "") {
+ GLib.debug ("SAVEHTML %s\n", this.roo_project.runhtml);
+ if (this.roo_project.runhtml == "") {
return;
}
if (node.props.has_key("* xinclude")) {
ret.add(node.props.get("* xinclude").val);
}
- for (var i =0; i < node.items.size; i++) {
- this.findxincludes(node.items.get(i), ret);
+ var items = node.readItems();
+ for (var i =0; i < items.size; i++) {
+ this.findxincludes(items.get(i), ret);
}
return ret;
var chksum = GLib.Checksum.compute_for_string (ChecksumType.MD5, str.strip());
if (this.doubleStringProps.index_of(kname) > -1) {
- GLib.debug("flag=%s type=%s name=%s : %s\n", prop.ptype.to_string(),ktype,kname,str);
+ //GLib.debug("flag=%s type=%s name=%s : %s\n", prop.ptype.to_string(),ktype,kname,str);
this.transStrings.set(str, chksum);
named.set("_" + kname, chksum);
continue;
}
}
-
+ var items = node.readItems();
// iterate children..
- for (var i =0; i < node.items.size; i++) {
- this.findTransStrings(node.items.get(i) );
+ for (var i =0; i < items.size; i++) {
+ this.findTransStrings(items.get(i) );
}
var app = BuilderApplication.singleton( args);
- Gtk.init (ref args);
-
-
+ Gtk.init ();
+
// not sure why this was done?? - it caused crash bugs on gtk_Box_gadget so removed critical.
// GLib.Log.set_always_fatal(LogLevelFlags.LEVEL_ERROR | LogLevelFlags.LEVEL_CRITICAL);
GLib.Log.set_always_fatal(LogLevelFlags.LEVEL_ERROR );
+ app.activate.connect(() => {
+ var w = new Xcls_MainWindow();
- var w = Xcls_MainWindow.singleton();
-
- BuilderApplication.addWindow(w);
- w.el.show_all();
- // it looks like showall after children causes segfault on ubuntu 14.4
- w.initChildren();
- w.windowstate.showPopoverFiles(w.open_projects_btn.el, null, false);
-// w.windowstate.switchState(WindowState.State.FILES);
+ BuilderApplication.addWindow(w);
+
+ // it looks like showall after children causes segfault on ubuntu 14.4
+ w.initChildren();
+ // w.windowstate.showPopoverFiles(w.open_projects_btn.el, null, false);
+ w.show();
- Gtk.main();
+ });
- app = null;
+ //
+// w.windowstate.switchState(WindowState.State.FILES);
+ var ret = app.run(args);
- return 0;
+
+ return ret;
+
}
-if HAVE_LIBVALA36
-roobuilder_LIBVALA = --pkg libvala-0.36
-roobuilder_CODEGEN =
-
-endif
+
if HAVE_LIBVALA56
roobuilder_GDA = --pkg libgda-5.0
endif
-if HAVE_GDA4
-roobuilder_GDA = --pkg libgda-4.0
-endif
+
# webkit
-if HAVE_WEBKIT4
-roobuilder_WEBKKIT = --pkg webkit2gtk-4.0
+if HAVE_WEBKIT6
+roobuilder_WEBKKIT = --pkg webkitgtk-6.0
endif
-if HAVE_WEBKIT3
-roobuilder_WEBKKIT = --pkg webkit2gtk-3.0
-endif
+
# vte
# - not sure if needed....
-AM_CPPFLAGS = $(ROOBUILDER_CFLAGS) $(WEBKIT_CFLAGS) $(GDA_CFLAGS) $(LIBVALA_CFLAGS) $(JAVASCRIPTCOREGTK_CFLAGS) $(VTE_CFLAGS) \
+AM_CPPFLAGS = $(ROOBUILDER_CFLAGS) $(WEBKIT_CFLAGS) $(GDA_CFLAGS) $(LIBVALA_CFLAGS) $(JAVASCRIPTCOREGTK_CFLAGS) \
-Wno-incompatible-pointer-types \
-Wno-discarded-qualifiers \
-Wno-deprecated-declarations \
roobuilder_PKGS = --pkg glib-2.0 \
--pkg gobject-2.0 \
- --pkg gtk+-3.0 \
- --pkg gtksourceview-3.0 \
+ --pkg gtk4 \
+ --pkg gtksourceview-5 \
--pkg libxml-2.0 \
--pkg json-glib-1.0 \
--pkg gee-0.8 \
--pkg gobject-introspection-1.0 \
- --pkg libsoup-2.4 \
- --pkg javascriptcore \
+ --pkg libsoup-3.0 \
--pkg roojspacker-1.4 \
- --pkg gladeui-2.0 \
$(roobuilder_LIBVALA) \
$(roobuilder_GDA) \
$(roobuilder_WEBKKIT) \
$(roobuilder_JAVASCRIPTCOREGTK) \
- $(roobuilder_VTE) \
--pkg posix
-
+#
# JsRender/Flutter.vala
+# --pkg javascriptcore
BUIDERJSRENDER = JsRender/Gtk.vala \
JsRender/PlainFile.vala \
JsRender/JsRender.vala \
JsRender/Lang.vala \
JsRender/NodeProp.vala \
- JsRender/NodeToGtk.vala \
JsRender/NodeToJs.vala \
JsRender/NodeToVala.vala \
JsRender/NodeToGlade.vala \
JsRender/Node.vala \
- JsRender/Roo.vala
-
+ JsRender/Roo.vala \
+ JsRender/Dir.vala
+
+# JsRender/NodeToGtk.vala
# Palete/Flutter.vala
BUIDERPALETE = Palete/Gir.vala \
Palete/VapiParser.vala \
Palete/Gtk.vala \
Palete/RooDatabase.vala \
- c/jscore_object_call_as_function.c \
- Palete/Javascript.vala \
Palete/Palete.vala \
Palete/Roo.vala \
Palete/ValaSource.vala \
Palete/ValaSourceCompiler.vala \
Palete/CompletionProvider.vala \
+ Palete/CompileError.vala \
+ Palete/ValaCompileRequest.vala \
+ Palete/ValaCompileQueue.vala \
+ Palete/Javascript.vala \
$(roobuilder_CODEGEN)
-
+
+# c/jscore_object_call_as_function.c \
# Project/Flutter.vala
+# Palete/Javascript.vala
+
BUIDERPROJECT = Project/Gtk.vala \
Project/Project.vala \
Project/Roo.vala \
+ Project/VapiSelection.vala \
Project/GtkValaSettings.vala
Builder4/DialogTemplateSelect.vala \
Builder4/EditProject.vala \
Builder4/Editor.vala \
- Builder4/PopoverFiles.vala \
Builder4/RooProjectSettings.vala \
Builder4/PopoverAddObject.vala \
Builder4/WindowLeftTree.vala \
Builder4/MainWindow.vala \
Builder4/WindowState.vala \
Builder4/FakeServer.vala \
- Builder4/DialogPluginWebkit.vala \
- Builder4/DialogNewComponent.vala \
Builder4/PopoverFileDetails.vala \
Builder4/ValaCompileErrors.vala \
Builder4/ValaCompileResults.vala \
- Builder4/PopoverProperty.vala
+ Builder4/PopoverProperty.vala \
+ Builder4/DialogFiles.vala
roobuilder_SOURCES = Application.vala \
Main.vala \
roobuilder_VALAFLAGS =--target-glib=2.32 --vapidir=$(srcdir)/vapi -g $(roobuilder_PKGS)
-roobuilder_LDADD = $(ROOBUILDER_LIBS) $(LIBVALA_LIBS) $(GDA_LIBS) $(WEBKIT_LIBS) $(VTE_LIBS) $(JAVASCRIPTCOREGTK_LIBS)
+roobuilder_LDADD = $(ROOBUILDER_LIBS) $(LIBVALA_LIBS) $(GDA_LIBS) $(WEBKIT_LIBS) $(JAVASCRIPTCOREGTK_LIBS)
+++ /dev/null
-
-
\ No newline at end of file
--- /dev/null
+/*
+
+Object to handle compiler errors
+so they can be passed off to trees.
+
+*/
+
+namespace Palete {
+
+ public class CompileError : Object
+ {
+
+ public JsRender.JsRender file = null;
+ public string title = "";
+
+ public GLib.ListStore lines;
+
+ public CompileError? parent = null;
+ public string category;
+ public string msg;
+ public int line { get; set; default = -1; }
+
+ public CompileError.new_line(CompileError parent, int line, string msg)
+ {
+ this.lines = new GLib.ListStore(typeof(CompileError));
+ this.parent = parent;
+ this.line = line;
+ this.msg = msg;
+ this.file = parent.file;
+ this.category = parent.category;
+
+
+ }
+
+
+
+
+ public CompileError.new_file(JsRender.JsRender file, Json.Object jlines, string category)
+ {
+ this.file = file;
+ this.category = category;
+ this.title = file.relpath + " (" + jlines.get_size().to_string() + ")";
+
+ this.lines = new GLib.ListStore(typeof(CompileError));
+
+ jlines.foreach_member((obja, line, nodea) => {
+ var msg = "";
+ var ar = jlines.get_array_member(line);
+
+
+
+ for (var i = 0 ; i < ar.get_length(); i++) {
+ msg += (msg.length > 0) ? "\n" : "";
+ msg += ar.get_string_element(i);
+ }
+ this.lines.append(new CompileError.new_line(this, int.parse(line) ,msg));
+
+
+ });
+
+ }
+
+ public string file_line { // sorting?
+ set {}
+ owned get {
+ return this.parent == null ? this.file.relpath :
+ (this.file.relpath + ":" + this.line.to_string("%09d"));
+ }
+ }
+ public string line_msg {
+ set {}
+ owned get {
+ return this.parent == null ?
+ GLib.Markup.escape_text( this.file.relpath + "(" + this.lines.n_items.to_string() + ")") :
+ GLib.Markup.escape_text(this.line.to_string() + ": " + this.msg);
+ }
+ }
+
+
+ public static void parseCompileResults (ValaCompileRequest req, Json.Object tree)
+ {
+ req.errorByFile = new Gee.HashMap<string,GLib.ListStore>();
+ req.errorByType = new Gee.HashMap<string,GLib.ListStore>();
+
+ req.errorByType.set("ERR", new GLib.ListStore(typeof(CompileError)));
+ req.errorByType.set("WARN", new GLib.ListStore(typeof(CompileError)));
+ req.errorByType.set("DEPR", new GLib.ListStore(typeof(CompileError)));
+
+ jsonToListStoreProp(req, "WARN", tree);
+ jsonToListStoreProp(req, "ERR", tree);
+ jsonToListStoreProp(req, "DEPR", tree);
+
+
+ }
+
+ public static void jsonToListStoreProp(ValaCompileRequest req, string prop, Json.Object tree)
+ {
+ var project = req.file.project;
+ var ls = new GLib.ListStore(typeof(CompileError));
+ if (!tree.has_member(prop)) {
+ GLib.debug("Files with %s : 0", prop);
+ req.errorByType.set(prop,ls);
+ return;
+ }
+ var res = tree.get_object_member(prop);
+ res.foreach_member((obj, file, node) => {
+
+ var fe = project.getByPath(file);
+
+ if (fe == null) {
+ GLib.debug("Warning Can not find file %s", file);
+ return;
+ }
+
+
+
+
+ var ce = new CompileError.new_file(fe, res.get_object_member(file), prop);
+ ls.append(ce);
+
+ if (!req.errorByFile.has_key(fe.targetName())) {
+ GLib.debug("add file %s to req.errorByFile", fe.targetName());
+ req.errorByFile.set(fe.targetName(), new GLib.ListStore(typeof(CompileError)));
+ }
+ for(var i = 0; i < ce.lines.get_n_items(); i++) {
+ var lce = (CompileError) ce.lines.get_item(i);
+ GLib.debug("add error %s to %s", lce.msg, fe.targetName());
+ req.errorByFile.get(fe.targetName()).append(lce);
+ }
+
+
+
+ });
+ GLib.debug("Files with %s : %d", prop, (int) ls.get_n_items());
+ req.errorByType.set(prop,ls);
+
+ }
+
+ // only used by javascript /roo errors..
+ public static GLib.ListStore jsonToListStore(Project.Project project, Json.Object tree)
+ {
+ var ls = new GLib.ListStore(typeof(CompileError));
+ tree.foreach_member((obj, file, node) => {
+
+ var fe = project.getByPath(file);
+
+ if (fe == null) {
+ GLib.debug("Warning Can not find file %s", file);
+ return;
+ }
+ var ce = new CompileError.new_file(fe, tree.get_object_member(file), "ERR");
+ ls.append(ce);
+
+
+
+ });
+ return ls;
+
+
+ }
+
+
+ }
+
+}
\ No newline at end of file
// not sure why - but extending Gtk.SourceCompletionProvider seems to give an error..
namespace Palete {
- public class CompletionProvider : Object, SourceCompletionProvider
+ public class CompletionProvider : Object, GtkSource.CompletionProvider
{
- Editor editor;
- WindowState windowstate;
- //public List<Gtk.SourceCompletionItem> filtered_proposals;
+ public Editor editor;
+ //public WindowState windowstate;
+ public CompletionModel model;
public CompletionProvider(Editor editor)
{
this.editor = editor;
- this.windowstate = null; // not ready until the UI is built.
+ // this.windowstate = null; // not ready until the UI is built.
}
return "roojsbuilder";
}
- public int get_priority ()
+ public int get_priority (GtkSource.CompletionContext context)
{
return 200;
}
-
- public bool match (SourceCompletionContext context)
- {
- bool has_matches = false;
- this.fetchMatches(context, out has_matches);
- return has_matches;
- }
-
- public List<SourceCompletionItem>? fetchMatches(SourceCompletionContext context, out bool has_matches)
+
+ public void activate (GtkSource.CompletionContext context, GtkSource.CompletionProposal proposal)
{
- has_matches = false;
+ var p = (CompletionProposal) proposal;
+ TextMark end_mark = null;
+ TextIter begin, end;
- if (this.windowstate == null) {
- this.windowstate = this.editor.window.windowstate;
- }
-
+ if (!context.get_bounds(out begin, out end)) {
+ return;
+ }
+ var buffer = begin.get_buffer();
- var buffer = context.completion.view.buffer;
- var mark = buffer.get_insert ();
- TextIter end;
+ var word = p.get_typed_text();
+ var len = -1;
- buffer.get_iter_at_mark (out end, mark);
- var endpos = end;
-
- var searchpos = endpos;
-
- searchpos.backward_find_char(is_space, null);
- searchpos.forward_char();
- var search = endpos.get_text(searchpos);
- print("got search %s\n", search);
-
- if (search.length < 2) {
- return null;
- }
-
- // now do our magic..
- var filtered_proposals = this.windowstate.file.palete().suggestComplete(
- this.windowstate.file,
- this.editor.node,
- this.editor.prop,
- search
- );
-
- print("GOT %d results\n", (int) filtered_proposals.length());
-
- if (filtered_proposals.length() < 2) {
- return null;
- }
+ /* If the insertion cursor is within a word and the trailing characters
+ * of the word match the suffix of the proposal, then limit how much
+ * text we insert so that the word is completed properly.
+ */
+ if (!end.ends_line() &&
+ !end.get_char().isspace() &&
+ !end.ends_word ())
+ {
+ var word_end = end;
+
+ if (word_end.forward_word_end ()) {
+ var text = end.get_slice(word_end);
+
+ if (word.has_suffix (text)) {
+ //g_assert (strlen (word) >= strlen (text));
+ len = word.length - text.length;
+ end_mark = buffer.create_mark (null, word_end, false);
+ }
+ }
+ }
+
+ buffer.begin_user_action();
+ buffer.delete (ref begin, ref end);
+ buffer.insert ( ref begin, word, len);
+ buffer.end_user_action ();
+
+ if (end_mark != null)
+ {
+ buffer.get_iter_at_mark(out end, end_mark);
+ buffer.select_range(end, end);
+ buffer.delete_mark(end_mark);
+ }
- filtered_proposals.sort((a, b) => {
- return ((string)(a.text)).collate((string)(b.text));
- });
- has_matches = true;
- return filtered_proposals;
}
-
- public void populate (SourceCompletionContext context)
+
+
+ public void display (GtkSource.CompletionContext context, GtkSource.CompletionProposal proposal, GtkSource.CompletionCell cell)
{
- bool has_matches = false;
- var filtered_proposals = this.fetchMatches(context, out has_matches);
- if (!has_matches) {
- context.add_proposals (this, null, true);
- return;
- }
- // add proposals triggers a critical error in Gtk - try running gtksourceview/tests/test-completion.
- // see https://bugzilla.gnome.org/show_bug.cgi?id=758646
- var fe = GLib.Log.set_always_fatal(0);
- context.add_proposals (this, filtered_proposals, true);
- GLib.Log.set_always_fatal(fe);
+ var col = cell.get_column();
+ //var p = (CompletionProposal) proposal;
+ switch(col) {
+ case GtkSource.CompletionColumn.TYPED_TEXT:
+ cell.set_icon_name("completion-snippet-symbolic");
+ break;
+ case GtkSource.CompletionColumn.ICON:
+ cell.set_text(cell.text);
+ break;
+ case GtkSource.CompletionColumn.COMMENT:
+ cell.set_text(cell.text);
+ break;
+ case GtkSource.CompletionColumn.DETAILS:
+ cell.set_text(cell.text);
+ break;
+ default:
+ cell.set_text(cell.text);
+ break;
+ }
}
+ public async GLib.ListModel populate_async (GtkSource.CompletionContext context, GLib.Cancellable? cancelleble)
+ {
+
+ this.model = new CompletionModel(this, context, cancelleble);
+ return this.model;
+
+ }
+
+ public void refilter (GtkSource.CompletionContext context, GLib.ListModel in_model)
+ {
+
+
+ //GtkFilterListModel *filter_model = NULL;
+ //G//tkExpression *expression = NULL;
+ //GtkStringFilter *filter = NULL;
+ //GListModel *replaced_model = NULL;
+ //char *word;
+
+ var model = in_model;
+
+ var word = context.get_word();
+ if (model is FilterListModel) {
+ model = model.get_model ();
+ }
+
+
+ if (!this.model.can_filter(word)) {
+ this.model.cancel();
+ var replaced_model = new CompletionModel(this, context, this.model.cancellable);
+ context.set_proposals_for_provider(this, replaced_model);
+
+ context.set_proposals_for_provider(this, replaced_model);
+ return;
+ }
+
+ var expression = new PropertyExpression(typeof(CompletionProposal), null, "word");
+ var filter = new StringFilter(expression);
+ filter.set_search( word);
+ var filter_model = new FilterListModel(in_model, filter);
+ filter_model.set_incremental(true);
+ context.set_proposals_for_provider(this, filter_model);
+
+
+
+ }
- public bool activate_proposal (SourceCompletionProposal proposal, TextIter iter)
+/*
+ public bool activate_proposal (GtkSource.CompletionProposal proposal, TextIter iter)
{
var istart = iter;
istart.backward_find_char(is_space, null);
return true;
}
+
+
- public SourceCompletionActivation get_activation ()
- {
- //if(SettingsManager.Get_Setting("complete_auto") == "true"){
- return SourceCompletionActivation.INTERACTIVE | SourceCompletionActivation.USER_REQUESTED;
- //} else {
- // return Gtk.SourceCompletionActivation.USER_REQUESTED;
- //}
+ private bool is_space(unichar space){
+ return space.isspace() || space.to_string() == "";
}
-
- public int get_interactive_delay ()
+ */
+
+ }
+ public class CompletionModel : Object, GLib.ListModel
+ {
+ CompletionProvider provider;
+ Gee.ArrayList<CompletionProposal> items;
+ string search;
+ int minimum_word_size = 2;
+ public Cancellable cancellable;
+
+ public CompletionModel(CompletionProvider provider, GtkSource.CompletionContext context, Cancellable cancellable)
+ {
+ this.provider = provider;
+ this.cancellable = cancellable;
+ this.items = new Gee.ArrayList<CompletionProposal>();
+ this.search = context.get_word();
+ if (this.search.length < this.minimum_word_size) {
+ return;
+ }
+ var prov = this.provider;
+
+ if (prov.editor.window.windowstate == null) {
+ GLib.debug("Warning - provider windowstate not set?");
+ return;
+ }
+ // now do our magic..
+ this.items = prov.editor.window.windowstate.file.palete().suggestComplete(
+ prov.editor.window.windowstate.file,
+ prov.editor.node,
+ prov.editor.prop,
+ this.search
+ );
+
+ print("GOT %d results\n", (int) items.size);
+ // WHY TWICE?
+ if (this.items.size < this.minimum_word_size) {
+ return;
+ }
+
+ items.sort((a, b) => {
+ return ((string)(a.text)).collate((string)(b.text));
+ });
+
+ }
+
+
+
+ public GLib.Object? get_item (uint pos)
+ {
+ return (Object) this.items.get((int) pos);
+ }
+ public GLib.Type get_item_type ()
{
- return -1;
+ return typeof(GtkSource.CompletionProposal);
}
-/*
- public bool get_start_iter (SourceCompletionContext context, SourceCompletionProposal proposal, out TextIter iter)
+ public uint get_n_items ()
{
- iter = new TextIter();
- return false;
+ return this.items.size;
}
-*/
- public void update_info (SourceCompletionProposal proposal, SourceCompletionInfo info)
+ public bool can_filter (string word)
{
+ if (word == null || word[0] == 0) {
+ return false;
+ }
+
+ if (word.length < this.minimum_word_size) {
+ return false;
+ }
+ /* If the new word starts with our initial word, then we can simply
+ * refilter outside this model using a GtkFilterListModel.
+ */
+ return word.has_prefix(this.search);
}
-
- private bool is_space(unichar space){
- return space.isspace() || space.to_string() == "";
+ public void cancel ()
+ {
+ this.cancellable.cancel();
}
-
-
- }
+
+ }
+ public class CompletionProposal : Object, GtkSource.CompletionProposal
+ {
+
+ string label;
+
+ public string text;
+ string info;
+ public CompletionProposal(string label, string text, string info)
+ {
+ this.text = text;
+ this.label = label;
+ this.info = info;
+ }
+
+ }
+
}
*
*/
- public static Gee.HashMap<string,Gir> global_cache = null;
+ // public static Gee.HashMap<string,Gir> global_cache = null;
- public static Gir? factory(Project.Project? project, string ns)
+ public static GirObject? factory(Project.Project? project, string ns)
{
- if (global_cache == null) {
- global_cache = new Gee.HashMap<string,Gir>();
+
+ if (project == null) {
+ return null;
+ }
+ if (project.gir_cache == null) {
+ project.gir_cache = new Gee.HashMap<string,GirObject>();
}
- var cache = global_cache;
+ var cache = project.gir_cache;
if (project != null && project is Project.Gtk) {
var gproj = ((Project.Gtk)project);
if (!gproj.gir_cache_loaded) {
public Gee.HashMap<string,GirObject> props;
public Gee.HashMap<string,GirObject> consts;
public Gee.HashMap<string,GirObject> signals;
+ public Gee.HashMap<string,GirObject> delegates;
public Gee.ArrayList<string> optvalues; // used by Roo only..
this.props = new Gee.HashMap<string,GirObject>();
this.consts = new Gee.HashMap<string,GirObject>();
this.signals = new Gee.HashMap<string,GirObject>();
+ this.delegates = new Gee.HashMap<string,GirObject>();
this.optvalues = new Gee.ArrayList<string>();
this.can_drop_onto = new Gee.ArrayList<string>();
public string fqn() {
// not sure if fqn really is correct here...
//
- return this.nodetype == "Class" || this.nodetype=="Interface"
+ return this.nodetype.down() == "class" || this.nodetype.down() =="interface"
? this.name : (this.ns + this.name);
}
}
ret = this.ctors.get(bits[0]);
- if (ret != null) {
+ if (ret != null) {
if (bits.length < 2) {
return ret;
}
}
ret = this.methods.get(bits[0]);
- if (ret != null) {
+ if (ret != null) {
if (bits.length < 2) {
return ret;
}
return ret.fetchByFqn(fqn.substring(bits[0].length+1));
}
ret = this.props.get(bits[0]);
- if (ret != null) {
+ if (ret != null) {
if (bits.length < 2) {
return ret;
}
return ret.fetchByFqn(fqn.substring(bits[0].length+1));
}
ret = this.consts.get(bits[0]);
- if (ret != null) {
+ if (ret != null) {
if (bits.length < 2) {
return ret;
}
}
ret = this.signals.get(bits[0]);
- if (ret != null) {
+ if (ret != null) {
if (bits.length < 2) {
return ret;
}
return ret.fetchByFqn(fqn.substring(bits[0].length+1));
}
+ ret = this.delegates.get(bits[0]);
+ if (ret != null) {
+ // delegates are only on namespaces...
+ return ret;
+
+ }
+
if (this.paramset == null) {
return null;
}
}
- public JsRender.NodeProp toNodeProp()
+ public JsRender.NodeProp toNodeProp( Palete pal, string par_xtype)
{
if (this.nodetype.down() == "signal") { // gtk is Signal, roo is signal??
// when we add properties, they are actually listeners attached to signals
- var r =new JsRender.NodeProp.listener(this.name, this.sig);
- r.rtype = this.type;
+ // was a listener overrident?? why?
+ var r = new JsRender.NodeProp.listener(this.name, this.sig);
+ r.propertyof = this.propertyof;
+ if (this.name == "notify" && pal.name == "Gtk") {
+ this.nodePropAddNotify(r, par_xtype, pal);
+ }
+
return r;
}
// does not handle Enums... - no need to handle anything else.
var def = this.type.contains(".") ? "" : Gir.guessDefaultValueForType(this.type);
- if (this.type.contains(".") ) {
- return new JsRender.NodeProp.raw(this.name, this.type, def);
+ if (this.type.contains(".") || this.type.contains("|") || this.type.contains("/")) {
+ var ret = new JsRender.NodeProp.prop(this.name, this.type, def); ///< was raw..?
+ ret.propertyof = this.propertyof;
+ this.nodePropAddChildren(ret, this.type, pal);
+ if (ret.childstore.n_items == 1) {
+ var np = (JsRender.NodeProp) ret.childstore.get_item(0);
+ ret.add_node = np.add_node;
+ ret.childstore.remove_all();
+ }
+
+
+ return ret;
}
if (this.type.down() == "function" ) {
- return new JsRender.NodeProp.raw(this.name, this.type, "function()\n{\n\n}");
+ var r = new JsRender.NodeProp.raw(this.name, this.type, "function()\n{\n\n}");
+ r.propertyof = this.propertyof;
+ return r;
}
if (this.type.down() == "array" ) {
- return new JsRender.NodeProp.raw(this.name, this.type, "[\n\n]");
+ var r = new JsRender.NodeProp.raw(this.name, this.type, "[\n\n]");
+ r.propertyof = this.propertyof;
+ return r;
}
if (this.type.down() == "object" ) {
- return new JsRender.NodeProp.raw(this.name, this.type, "{\n\n}");
+ var r = new JsRender.NodeProp.raw(this.name, this.type, "{\n\n}");
+ r.propertyof = this.propertyof;
+ return r;
}
- return new JsRender.NodeProp.prop(this.name, this.type, def); // signature?
+ // plain property.. no children..
+ var r = new JsRender.NodeProp.prop(this.name, this.type, def); // signature?
+ r.propertyof = this.propertyof;
+ return r;
}
-
- /*
- //public string fqtype() {
- // return Gir.fqtypeLookup(this.type, this.ns);
+ public void nodePropAddChildren(JsRender.NodeProp par, string str, Palete pal)
+ {
+
- /* return Gir.fqtypeLookup(this.type, this.ns); */
- //}
+ if (str.contains("|")) {
+ var ar = str.split("|");
+ for(var i = 0; i < ar.length; i++) {
+ this.nodePropAddChildren(par, ar[i], pal);
+ }
+ return;
+ }
+ if (str.contains("/")) {
+ var ar = str.split("/");
+ for(var i = 0; i < ar.length; i++) {
+ this.nodePropAddChildren(par, ar[i], pal);
+ }
+ return;
+ }
+ var cls = pal.getClass(str);
+ // it's an object..
+ // if node does not have any children and the object type only has 1 type.. then we dont add anything...
+ // note all classes are expected to have '.' seperators
+ if (cls == null || !str.contains(".")) {
+ GLib.debug("nodepropaddchildren: check class %s - not found in classes", str);
+ par.childstore.append( new JsRender.NodeProp.prop(this.name, str, Gir.guessDefaultValueForType(str)));
+ return;
+ }
+ GLib.debug("nodepropaddchildren: check class %s - type = %s", str, cls.nodetype);
+ if (cls.nodetype.down() == "enum") {
+ var add = new JsRender.NodeProp.raw(this.name, str, "");
+ par.childstore.append( add);
+ return ;
+ }
+
+
+ if (cls.nodetype.down() == "class") {
+ var add = new JsRender.NodeProp.raw(this.name, str, "");
+ // no propertyof ?
+
+
+ add.add_node = pal.fqnToNode(str);
+ add.add_node.add_prop(new JsRender.NodeProp.special("prop", this.name));
+ par.childstore.append( add);
+ }
+
+
+
+ if (cls.implementations.size < 1) {
+ GLib.debug("nodepropaddchildren: check class %s - no implementations", str);
+ return;
+ }
+
+ GLib.debug("nodepropaddchildren: check class %s", str);
+
+ foreach (var cname in cls.implementations) {
+
+
+ var subcls = pal.getClass(cname);
+
+ GLib.debug("nodepropaddchildren: check class %s add %s type %s", str, cname, subcls == null ? "NO?" :subcls.nodetype );
+ if (subcls.nodetype.down() != "class") {
+
+ continue;
+ }
+
+ var add = new JsRender.NodeProp.raw(this.name, cname, "");
+ // no propertyof ?
+ add.add_node = pal.fqnToNode(cname);
+ add.add_node.add_prop(new JsRender.NodeProp.special("prop", this.name));
+ par.childstore.append( add);
+
+
+ }
+
+
+
+
+ }
+ public void nodePropAddNotify(JsRender.NodeProp par, string par_xtype, Palete pal)
+ {
+ var els = pal.getPropertiesFor( par_xtype, JsRender.NodePropType.PROP);
+ foreach(var elname in els.keys) {
+ var add = new JsRender.NodeProp.listener("notify[\"" + elname +"\"]" , "() => {\n }");
+ add.propertyof = par.propertyof;
+ par.childstore.append( add);
+ }
+
+ }
+
+
+
}
}
/**
+
+Palete.map
+ -> contains a list of parent and child classes
+ // eg. what can be added to what.
+
+// defaults
+
+// node properties??
+ (mostly from
+
Known issues with Palete
- public class Introspect.El : Object
- {
- public enum eltype {
- NS,
- CLASS,
- METHOD,
- PROP
- }
-
-
- public eltype type;
- }
-
+
public class Gtk : Palete {
this.package_cache.add_all(
this.loadPackages(Path.get_dirname (context.get_vapi_path("gee-0.8")))
);
- //this.load();
- // various loader methods..
- //this.map = [];
- //this.load();
- //this.proplist = {};
- //this.comments = { };
- // no parent...
+
}
// c) build child list for all widgets (based on properties)
// d) handle oddities?
+ public bool loaded = false; // set to false to force a reload
+
public override void load ()
{
+<<<<<<< HEAD
Gir.factory(this.project, "Gtk"); // triggers a load...
var pr = (Project.Gtk) this.project;
localopts_l.add(parent);
if (cls_cn == null) {
+=======
+ if (this.loaded) {
+>>>>>>> wip_alan_T7440_handling_gtk4_and_bad_girs
return;
}
- if (!cls_cn.is_abstract) { // and check for interface?
-
- localopts_r.add(child + ( prop.length > 0 ? ":" + prop : "") );
- }
- GLib.debug("Special Parent %s - add %s ", parent , child);
- foreach(var impl in cls_cn.implementations) {
-
- // in theory these can not be abstract?
-
- var impcls = this.getClass(impl);
- if (impcls.is_abstract) {
- continue;
- }
- if (impcls.nodetype == "Interface") {
- continue;
- }
- GLib.debug("Special Parent %s - add %s ", parent , impl + ( prop.length > 0 ? ":" + prop : ""));
- localopts_r.add( impl + ( prop.length > 0 ? ":" + prop : "") );
- }
- this.map.add(new Usage(localopts_l, localopts_r));
+ Gir.factory(this.project, "Gtk"); // triggers a load...
+
+ this.init_node_defaults();
+ this.add_node_default_from_ctor_all();
+ this.init_child_defaults();
+
+ this.loaded = true;
+
}
-
+<<<<<<< HEAD
public void build_class_children_from_props(Gee.HashMap<string,GirObject> classes)
{
}
+=======
+
+>>>>>>> wip_alan_T7440_handling_gtk4_and_bad_girs
public string doc(string what)
{
var ns = what.split(".")[0];
var gir = Gir.factory(this.project,ns);
- return gir.doc(what);
+ return ((Gir) gir).doc(what);
//return typeof(this.comments[ns][what]) == 'undefined' ? '' : this.comments[ns][what];
}
return gir.classes.get(es[1]);
}
+
+ public GirObject? getDelegate(string ename)
+ {
+ var es = ename.split(".");
+ if (es.length < 2) {
+ return null;
+ }
+ var gir = Gir.factory(this.project,es[0]);
+ if (gir == null) {
+ return null;
+ }
+ return gir.delegates.get(es[1]);
+
+ }
public GirObject? getClassOrEnum(string ename)
{
//print("Loading for " + ename);
-
+ this.load();
// if (typeof(this.proplist[ename]) != 'undefined') {
//print("using cache");
// return this.proplist[ename][type];
switch (ptype) {
case JsRender.NodePropType.PROP:
- return this.filterProps(cls.props);
+ var ret = this.filterProps(cls.props);
+ // add ctor
+ this.add_props_from_ctors(cls, ret);
+ return ret;
case JsRender.NodePropType.LISTENER:
return this.filterSignals(cls.signals);
case JsRender.NodePropType.METHOD:
foreach(var k in props.keys) {
var val = props.get(k);
- if (k == "___") {
+// GLib.debug("FilterProp: %s", k);
+ // properties that dont make any sense to display.
+ if (
+ k == "___" ||
+ k == "parent" ||
+ k == "default_widget" ||
+ k == "root" ||
+ k == "layout_manager" || // ??
+ k == "widget" // gestures..
+ ) {
continue;
}
+
if (val.is_deprecated) {
continue;
}
+ if (val.type == "GLib.Object") { /// this is practually everything? ?? shoud we display it as a property?
+ continue;
+ }
if (!val.type.contains(".")) {
outprops.set(k,val);
continue;
var cls = this.getClassOrEnum(val.type);
// if cls == null - it's probably a struct? I don't think we handle thses
- if ( cls.nodetype == "Enum") {
+ if ( cls != null ) { // cls.nodetype == "Enum") {
// assume it's ok
outprops.set(k,val);
continue;
}
+
+ private void add_props_from_ctors(GirObject cls, Gee.HashMap<string,GirObject> props)
+ {
+ if (cls.ctors.has_key("new")) {
+ this.add_props_from_ctor(cls.ctors.get("new"), props);
+ return;
+ }
+ // does not have new ?? needed?
+ foreach(var ctor in cls.ctors.values) {
+ this.add_props_from_ctor(ctor, props);
+ break;
+
+ }
+ }
+
+ private void add_props_from_ctor(GirObject ctor, Gee.HashMap<string,GirObject> props)
+ {
+ var cname = ctor.gparent.fqn();
+ GLib.debug("Add node from ctor %s:%s", ctor.gparent.fqn(), ctor.name);
+
+ if (ctor.paramset == null) {
+ return;
+ }
+
+
+ // assume we are calling this for a reason...
+ // get the first value params.
+
+ //gtk box failing
+ //GLib.debug("No. of parmas %s %d", cls, ctor.params.size);
+
+ foreach (var prop in ctor.paramset.params) {
+
+
+ if (props.has_key(prop.name)) { // overlap (we assume it's the same..)
+ continue;
+ }
+ prop.propertyof = cname + "." + ctor.name; // as it's probably not filled in..
+
+ GLib.debug("adding proprty from ctor : %s, %s, %s", cname , prop.name, prop.type);
+
+ props.set(prop.name, prop);
+
+
+
+ }
+ }
+
+
+
// get rid of depricated from signal list..
public Gee.HashMap<string,GirObject> filterSignals(Gee.HashMap<string,GirObject> props)
{
}
- Gee.HashMap<string,Gee.ArrayList<JsRender.NodeProp>> node_defaults;
+ Gee.HashMap<string,Gee.HashMap<string,JsRender.NodeProp>> node_defaults;
Gee.HashMap<string,Gee.ArrayList<JsRender.NodeProp>> child_defaults;
public void init_node_defaults()
{
- this.node_defaults = new Gee.HashMap<string,Gee.ArrayList<JsRender.NodeProp>>();
+ this.node_defaults = new Gee.HashMap<string,Gee.HashMap<string,JsRender.NodeProp>>();
// this lot could probably be configured?
// does this need to add properties to methods?
// these are fake methods.
- this.add_node_default("Gtk.ListStore", "types", "/*\n fill in an array of { typeof(xxx), typeof(xxx) } \n */\n{\n\tttypeof(string)\n}");
- this.add_node_default("Gtk.TreeStore", "types", "/*\n fill in an array of { typeof(xxx), typeof(xxx) } \n */\n{\n\tttypeof(string)\n}");
-
-
-
- this.add_node_default_from_ctor("Gtk.Box", "new");
-
-
- this.add_node_default("Gtk.AccelLabel", "label", "Label");
- this.add_node_default_from_ctor("Gtk.AppChooserButton", "new");
- this.add_node_default_from_ctor("Gtk.AppChooserWidget", "new");
-
- this.add_node_default_from_ctor("Gtk.AspectFrame", "new");
-
- this.add_node_default("Gtk.Button", "label", "Label"); // these are not necessary
- this.add_node_default("Gtk.CheckButton", "label", "Label");
+
this.add_node_default("Gtk.ComboBox", "has_entry", "false");
this.add_node_default("Gtk.Expander", "label", "Label");
- this.add_node_default_from_ctor("Gtk.FileChooserButton", "new");
- this.add_node_default_from_ctor("Gtk.FileChooserWidget", "new");
+
this.add_node_default("Gtk.Frame", "label", "Label");
- this.add_node_default("Gtk.Grid", "columns", "2"); // special properties
+ this.add_node_default("Gtk.Grid", "columns", "2"); // special properties (is special as it's not part of the standard?!)
//this.add_node_default("Gtk.Grid", "rows", "2"); << this is not really that important..
this.add_node_default("Gtk.HeaderBar", "title", "Window Title");
this.add_node_default("Gtk.Label", "label", "Label"); // althought the ctor asks for string.. - we can use label after ctor.
- this.add_node_default_from_ctor("Gtk.LinkButton", "with_label");
- this.add_node_default_from_ctor("Gtk.Paned", "new");
+
this.add_node_default("Gtk.Scale", "orientation");
- this.add_node_default_from_ctor("Gtk.ScaleButton", "new"); /// ctor ignore optional array of strings at end?
- this.add_node_default_from_ctor("Gtk.Scrollbar", "new");
- this.add_node_default_from_ctor("Gtk.Separator", "new");
- this.add_node_default_from_ctor("Gtk.SpinButton", "new");
+
this.add_node_default("Gtk.ToggleButton", "label", "Label");
this.add_node_default("Gtk.MenuItem", "label", "Label");
this.add_node_default("Gtk.CheckItem", "label", "Label");
}
- public void add_node_default_from_ctor(string cls, string method )
+
+
+
+ private void add_node_default_from_ctor_all()
+ {
+
+ var pr = (Project.Gtk) this.project;
+
+
+
+ foreach(var key in pr.gir_cache.keys) {
+ var gir = pr.gir_cache.get(key);
+ GLib.debug("building drop list for package %s", key);
+ this.add_node_default_from_ctor_package(gir.classes);
+ }
+ }
+
+ private void add_node_default_from_ctor_package(Gee.HashMap<string,GirObject> classes)
+ {
+
+
+
+ foreach(var cls in classes.values) {
+ GLib.debug("building drop list for class %s.%s", cls.package, cls.name);
+ this.add_node_default_from_ctor_classes(cls);
+ }
+
+ }
+
+ private void add_node_default_from_ctor_classes(GirObject cls)
+ {
+ if (cls.ctors.has_key("new")) {
+ this.add_node_default_from_ctor(cls.ctors.get("new"));
+ return; // and no more.
+ }
+ // does not have new ?? needed?
+ foreach(var ctor in cls.ctors.values) {
+ this.add_node_default_from_ctor(ctor);
+ break;
+
+ }
+ }
+
+
+
+
+
+
+ private void add_node_default_from_ctor(GirObject ctor )
{
- GLib.debug("Add node from ctor %s:%s", cls, method);
- if (!this.node_defaults.has_key(cls)) {
- this.node_defaults.set(cls, new Gee.ArrayList<JsRender.NodeProp>());
+ var cname = ctor.gparent.fqn();
+ GLib.debug("Add node from ctor %s:%s", ctor.gparent.fqn(), ctor.name);
+ if (!this.node_defaults.has_key(cname)) {
+ this.node_defaults.set(cname, new Gee.HashMap<string,JsRender.NodeProp>());
}
+ if (ctor.paramset == null) {
+ return;
+ }
+
+ var defs= this.node_defaults.get(cname);
- var ar = this.getPropertiesFor(cls, JsRender.NodePropType.CTOR);
- GLib.debug("ctor: %s", ar.get(method).asJSONString());
+ GLib.debug("ctor: %s: %s", cname , ctor.name);
// assume we are calling this for a reason...
//gtk box failing
//GLib.debug("No. of parmas %s %d", cls, ctor.params.size);
+<<<<<<< HEAD
var m = ar.get(method);
if (m != null) {
}
+=======
+
+ foreach (var prop in ctor.paramset.params) {
+ string[] opts;
+
+ if (defs.has_key(prop.name)) {
+ continue;
+ }
+ var sub = this.getClass(prop.type);
+
+ // GLib.debug("adding property from ctor : %s, %s, %s [%s]", cname , prop.name, prop.type, sub == null ? "-" : sub.nodetype);
+
+ if (sub != null) { // can't add child classes here...
+
+ GLib.debug("skipping ctor argument proprty is an object");
+ continue;
+ }
+ sub = this.getDelegate(prop.type);
+ if (sub != null) { // can't add child classes here...
+ this.node_defaults.get(cname).set(prop.name, new JsRender.NodeProp.raw(prop.name, prop.type, sub.sig));
+ continue;
+ }
+
+ // FIXME!!! - what about functions
+
+ var dval = "";
+ switch (prop.type) {
+ case "int":
+ dval = "0";break;
+ case "string":
+ dval = ""; break;
+ // anything else?
+
+ default: // enam? or bool?
+ this.typeOptions(cname, prop.name, prop.type, out opts);
+ dval = opts.length > 0 ? opts[0] : "";
+ break;
+ }
+
+ this.node_defaults.get(cname).set(prop.name, new JsRender.NodeProp.prop( prop.name, prop.type, dval));
+
+
+
+>>>>>>> wip_alan_T7440_handling_gtk4_and_bad_girs
}
}
- public void add_node_default(string cls, string propname, string val = "")
+ private void add_node_default(string cname, string propname, string val = "")
{
- if (!this.node_defaults.has_key(cls)) {
- this.node_defaults.set(cls, new Gee.ArrayList<JsRender.NodeProp>());
+ if (!this.node_defaults.has_key(cname)) {
+ var add = new Gee.HashMap<string, JsRender.NodeProp>();
+ this.node_defaults.set(cname, add);
}
-
- var ar = getPropertiesFor( cls, JsRender.NodePropType.PROP);
+ // this recurses...
+ var cls = this.getClass(cname);
+ if (cls == null) {
+ GLib.debug("invalid class name %s", cname);
+ return;
+ }
+ var ar = cls.props;
// liststore.columns - exists as a property but does not have a type (it's an array of typeofs()....
if (ar.has_key(propname) && ar.get(propname).type != "") { // must have type (otherwise special)
//GLib.debug("Class %s has property %s from %s - adding normal property", cls, propname, ar.get(propname).asJSONString());
- var add = ar.get(propname).toNodeProp(); // our nodes dont have default values.
+ var add = ar.get(propname).toNodeProp(this, cname); // our nodes dont have default values.
add.val = val;
- this.node_defaults.get(cls).add(add);
- } else {
- //GLib.debug("Class %s has property %s - adding special property", cls, propname);
- this.node_defaults.get(cls).add(
- new JsRender.NodeProp.special( propname, val)
- );
+ this.node_defaults.get(cname).set(propname, add);
+ return;
+
+ }
+ //GLib.debug("Class %s has property %s - adding special property", cls, propname);
+ this.node_defaults.get(cname).set(propname,
+ new JsRender.NodeProp.special( propname, val)
+ );
- }
}
- public void init_child_defaults()
+ private void init_child_defaults()
{
this.child_defaults = new Gee.HashMap<string,Gee.ArrayList<JsRender.NodeProp>>();
}
- public void add_child_default(string cls, string propname, string type, string val)
+ private void add_child_default(string cls, string propname, string type, string val)
{
if (!this.child_defaults.has_key(cls)) {
this.child_defaults.set(cls, new Gee.ArrayList<JsRender.NodeProp>());
this.child_defaults.get(cls).add( new JsRender.NodeProp.prop(propname, type, val));
}
+<<<<<<< HEAD
public override void on_child_added(JsRender.Node? parent,JsRender.Node child)
{
}
+=======
+>>>>>>> wip_alan_T7440_handling_gtk4_and_bad_girs
public Gee.ArrayList<string> packages(Project.Gtk gproject)
{
}
- public override List<SourceCompletionItem> suggestComplete(
+ public override Gee.ArrayList<CompletionProposal> suggestComplete(
JsRender.JsRender file,
JsRender.Node? node,
JsRender.NodeProp? xxxprop, // is this even used?
string complete_string
) {
- var ret = new List<SourceCompletionItem>();
+ var ret = new Gee.ArrayList<CompletionProposal>();
// completion rules??
// make sure data is loaded
var ss = s.slice(1,-1);
if (s[0] == '`' && GLib.Regex.match_simple("^[a-z]+$", ss) &&
complete_string != ss && ss.index_of(complete_string,0) == 0 ) {
- var sci = SourceCompletionItem.new2();
- //string label, string text, Pixbuf? icon, string? info)
- sci.label = ss;
- sci.text = ss;
- sci.info = "vala : " + ss;
- ret.append(sci);
+ var sci = new CompletionProposal(ss,ss, "vala : " + ss);
+ ret.add(sci);
}
}
var miter = ((Project.Gtk)this.project).gir_cache.map_iterator();
var ss = miter.get_key();
if (complete_string != ss && ss.index_of(complete_string,0) == 0 ) {
-
- var sci = SourceCompletionItem.new2();
- //string label, string text, Pixbuf? icon, string? info)
- sci.label = ss;
- sci.text = ss;
- sci.info = "vala namespace: " + ss;
- ret.append(sci);
+ var sci = new CompletionProposal(ss,ss, "vala namespace: " + ss);
+ ret.add(sci);
+
}
}
if (complete_string != "_this" && "_this".index_of(complete_string,0) == 0 ) { // should we ignore exact matches... ???
-
- var sci = SourceCompletionItem.new2();
- //string label, string text, Pixbuf? icon, string? info)
- sci.label = "_this - the top level element";
- sci.text = "_this";
- sci.info = "Reference to the container object instance of this file";
- ret.append(sci);
+ var sci = new CompletionProposal("_this - the top level element","_this",
+ "Reference to the container object instance of this file");
+ ret.add(sci);
+
}
// basic types..
continue;
}
// got a starting match..
- var sci = SourceCompletionItem.new2();
- //string label, string text, Pixbuf? icon, string? info)
- sci.label = prevbits + scls;
- sci.text = prevbits + scls;
- sci.info = scls;
-
- ret.append(sci);
+ var sci = new CompletionProposal(prevbits + scls,prevbits + scls,scls);
+ ret.add(sci);
+
+
}
// methods....
citer = cls.methods.map_iterator();
continue;
}
// got a starting match..
- var sci = SourceCompletionItem.new2();
- //string label, string text, Pixbuf? icon, string? info)
- sci.label = prevbits + scls + citer.get_value().sig;
- sci.text = prevbits + scls;
- sci.info = scls;
- ret.append(sci);
+
+ var sci = new CompletionProposal(prevbits + scls + citer.get_value().sig,prevbits + scls,scls);
+ ret.add(sci);
+
}
// enums....
continue;
}
// got a starting match..
-
- var sci = SourceCompletionItem.new2();
- //string label, string text, Pixbuf? icon, string? info)
- sci.label = prevbits + scls + citer.get_value().sig;
- sci.text = prevbits + scls;
- sci.info = scls;
- ret.append(sci);
+ var sci = new CompletionProposal(prevbits + scls + citer.get_value().sig,prevbits + scls,scls);
+ ret.add(sci);
+
}
}
// got a matching property...
// return type?
- var sci = SourceCompletionItem.new2();
- //string label, string text, Pixbuf? icon, string? info)
- sci.label = cprop.name + cprop.sig + " : ("+ cprop.propertyof + ")";
- sci.text = prevbits + cprop.name + "(";
- sci.info = cprop.doctxt;
-
- ret.append(sci);
+ var sci = new CompletionProposal( cprop.name + cprop.sig + " : ("+ cprop.propertyof + ")",
+ prevbits + cprop.name + "(",cprop.doctxt);
+ ret.add(sci);
+
+
}
// get the properties / methods and subclasses.. of cls..
continue;
}
// got a matching property...
- var sci = SourceCompletionItem.new2();
- //string label, string text, Pixbuf? icon, string? info)
- sci.label = cprop.name + " : " + cprop.type + " ("+ cprop.propertyof + ")";
- sci.text = prevbits + cprop.name;
- sci.info = cprop.doctxt;
- ret.append(sci);
+ var sci = new CompletionProposal(cprop.name + " : " + cprop.type + " ("+ cprop.propertyof + ")",
+ prevbits + cprop.name,cprop.doctxt);
+ ret.add(sci);
+
+
+
}
return ret;
}
- public override string[] getChildList(string in_rval)
+
+ void add_classes_from_method(GirObject cls, string method , Gee.ArrayList<string> ret)
+ {
+
+ //GLib.debug("add_classes_from_method %s, %s", cls.fqn(), method);
+ // does class have this method?
+ if (!cls.methods.has_key(method)) {
+ GLib.debug("skip %s does not have method %s", cls.fqn(), method);
+ return;
+ }
+ // add all the possible classes to ret based on first arguemnt?
+ var m = cls.methods.get(method);
+
+ if (m.paramset.params.size < 1) {
+ GLib.debug("%s: %s does not have any params?", cls.fqn(), method);
+ return;
+ }
+
+
+
+ var ty = m.paramset.params.get(0).type;
+ GLib.debug("add %s method %s arg0 = %s", cls.fqn(), method, ty);
+ this.addRealClasses(ret, ty);
+ // skip dupe // skip depricated
+ // skip not object // skip GLib.Object (base)
+
+ }
+
+ void addRealClasses(Gee.ArrayList<string> ret, string cn, bool allow_root = false)
+ {
+ if (!cn.contains(".")) {
+ return;
+ }
+
+ var w = this.getClass(cn);
+ if (w == null) {
+ return;
+ }
+
+ if (w.nodetype != "Class" && w.nodetype != "Interface" ) {
+ return;
+ }
+ if (ret.contains(cn)) {
+ return;
+ }
+
+ if (!allow_root && w.implements.contains("Gtk.Native")) { // removes popover + window
+ return;
+ }
+
+ if (!w.is_deprecated && !w.is_abstract && w.nodetype == "Class" ) {
+ ret.add(cn);
+ }
+
+
+
+
+ foreach (var str in w.implementations) {
+ var c = this.getClass(str);
+ if (c.is_deprecated || c.is_abstract) {
+ continue;
+ }
+ if (ret.contains(str)) {
+ continue;
+ }
+ if (!allow_root && c.implements.contains("Gtk.Native")) { // removes popover + window
+ continue;
+ }
+
+
+
+ ret.add(str);
+ }
+ }
+
+
+ /**
+ this is the real list of objects that appear in the add object pulldown
+ @param in_rval "*top" || "Gtk.Widget"
+
+ */
+ public override Gee.ArrayList<string> getChildList(string in_rval, bool with_props)
{
- return this.original_getChildList( in_rval);
+
+ GLib.debug("getChildList %s %s", in_rval, with_props ? "(with props)" : "");
+
+ //return this.original_getChildList( in_rval, with_props);
+ var pr = (Project.Gtk) this.project;
+ if (with_props && pr.child_list_cache_props.has_key(in_rval)) {
+ return pr.child_list_cache_props.get(in_rval);
+ }
+ if (!with_props && pr.child_list_cache.has_key(in_rval)) {
+ return pr.child_list_cache.get(in_rval);
+ }
+
+ // CACHE ?
+ var ret = new Gee.ArrayList<string>();
+
+ if (in_rval == "*top") {
+ // everythign that's not depricated and extends Gtk.Widget
+ // even a gtk window and about dialog are widgets
+ this.addRealClasses(ret, "Gtk.Widget", true);
+
+ return ret;
+
+
+
+ }
+ var cls = this.getClass(in_rval);
+ if (cls == null) {
+ GLib.debug("could not get class for %s", in_rval);
+ return ret;
+ }
+
+ // look through methods of in_rval
+ // set_X << ignore
+ // probably methods:
+ this.add_classes_from_method(cls, "add_controller", ret);
+ this.add_classes_from_method(cls, "add_shortcut", ret);
+ this.add_classes_from_method(cls, "add_tick_callback", ret); // wtf does this do.
+ this.add_classes_from_method(cls, "append", ret);
+ this.add_classes_from_method(cls, "append_column", ret); // columnview column
+ this.add_classes_from_method(cls, "append_item", ret); // GLib.Menu
+ this.add_classes_from_method(cls, "attach", ret); // grid column
+ this.add_classes_from_method(cls, "pack_start", ret); // headerbar (also has pack end?)
+
+ // add_controller 1st arge = ??
+ // add_menomic_label ??? << no ???
+ // add_shortcut?
+ // add_tick_callback ?
+ // append << core one to add stuff..
+
+ if (!with_props) {
+
+ pr.child_list_cache.set(in_rval, ret);
+ return ret;
+ }
+ foreach(var pn in cls.props.values) {
+
+ if (!pn.is_writable ) {
+ GLib.debug("Skip (not write) %s : (%s) %s", cls.fqn(), pn.type , pn.name);
+ continue;
+ }
+ // if (&& !pn.ctor_only << we add these?
+ // are they really available ?
+ GLib.debug("Add %s : (%s) %s", cls.fqn(), pn.type , pn.name);
+ this.addRealClasses(ret, pn.type);
+ }
+
+ pr.child_list_cache_props.set(in_rval, ret);
+
+ return ret;
+
+
+ }
+
+ public void buildChildListForDroppingProject()
+ {
+
+ this.load();
+ var pr = (Project.Gtk) this.project;
+
+ if (pr.dropList != null) {
+ GLib.debug("Drop list alreayd loaded");
+ return;
+ }
+
+ pr.dropList = new Gee.HashMap<string,Gee.ArrayList<string>>();
+ foreach(var key in pr.gir_cache.keys) {
+ var gir = pr.gir_cache.get(key);
+ GLib.debug("building drop list for package %s", key);
+ this.buildChildListForDropping(key, gir.classes);
+ }
+ }
+
+ public void buildChildListForDropping(string pkg, Gee.HashMap<string,GirObject> classes)
+ {
+
+
+
+ foreach(var cls in classes.keys) {
+ GLib.debug("building drop list for class %s.%s", pkg, cls);
+ this.buildDropList(pkg + "." + cls, this.getChildList(pkg + "." + cls, true));
+ }
+ this.buildDropList("*top", this.getChildList("*top", true));
+ }
+
+
+
+ public void buildDropList(string parent, Gee.ArrayList<string> children)
+ {
+
+ var pr = (Project.Gtk) this.project;
+ foreach(var c in children) {
+ if (!pr.dropList.has_key(c)) {
+
+ pr.dropList.set(c, new Gee.ArrayList<string>());
+ }
+ var dl = pr.dropList.get(c);
+ if (dl.contains(parent)) {
+ continue;
+ }
+ GLib.debug("%s[] = %s", c, parent);
+ dl.add(parent);
+ }
+
+
}
- public override string[] getDropList(string rval)
+
+ public override Gee.ArrayList<string> getDropList(string rval)
+ {
+ this.buildChildListForDroppingProject();
+ var pr = (Project.Gtk) this.project;
+ if (!pr.dropList.has_key(rval)) {
+ GLib.debug("returning empty drop list for %s", rval);
+ return new Gee.ArrayList<string>();
+ }
+ GLib.debug("returning %d items in drop list %s", pr.dropList.get(rval).size, rval);
+ return pr.dropList.get(rval);
+
+
+ }
+
+
+ public override JsRender.Node fqnToNode(string fqn)
{
- return this.default_getDropList(rval);
- }
+ this.load();
+ var ret = new JsRender.Node();
+ ret.setFqn(fqn);
+ if (!this.node_defaults.has_key(fqn)) {
+ return ret;
+ }
+
+ foreach (var nv in this.node_defaults.get(fqn).values) {
+ ret.add_prop(nv.dupe());
+ }
+ return ret;
+
+
+
+ }
+
+
+
}
}
-
+/*
extern JSCore.Value jscore_object_call_as_function(
JSCore.Context ctx,
JSCore.Object object,
out JSCore.Value exception
);
-
-
+*/
+
namespace Palete {
public class Javascript {
-
+/*
public static JSCore.Object class_constructor(
JSCore.Context ctx,
JSCore.Object constructor,
public JSCore.GlobalContext js_global_context = null;
-
+*/
public static Javascript singleton()
{
if (instance == null) {
}
public Javascript()
{
- var goc = new JSCore.Class( class_definition );
- this.js_global_context = new JSCore.GlobalContext(goc);
+ //var goc = new JSCore.Class( class_definition );
+ //this.js_global_context = new JSCore.GlobalContext(goc);
}
- public int validate(string code, out string res)
+ public Json.Object validate(string code, string fn)
{
- JSCore.Value ex;
- unowned JSCore.GlobalContext ctx = this.js_global_context;
- this.js_global_context.check_script_syntax(
- new JSCore.String.with_utf8_c_string(code),
- null,
- 0,
- out ex
- );
- res = "";
- if (ex.is_null(ctx)) {
- return -1;
- }
-
-
- var exo = ex.to_object(ctx, null);
- //unowned JSCore.PropertyNameArray property_names = exo.copy_property_names (ctx);
-
+
+ JSC.Exception? ex;
+ var ctx = new JSC.Context();
+ //GLib.debug("Check syntax %s", code);
-
- var js_string = new JSCore.String.with_utf8_c_string("line");
- var line = exo.get_property(ctx, js_string, null).to_number(ctx,null);
+ ctx.check_syntax(code, code.length, JSC.CheckSyntaxMode.SCRIPT, "", 1 ,out ex);
+
+ if (ex == null) {
+ return this.compressionErrors(code, fn);
+
+
+ }
+
+ //GLib.debug("got error %d %s", (int)ex.get_line_number() , ex.get_message() );
+
+ var ar = new Json.Array();
+ ar.add_string_element(ex.get_message());
- // see if we can convert exception string
- char *c_string = new char[1024];
- var err_string = ex.to_string_copy (ctx, null);
- err_string.get_utf8_c_string (c_string, 1023);
- res = (string)c_string;
- //print ("Error on line %d\n%s\n", (int)line, res);
+ var line_to_err = new Json.Object();
+
+ line_to_err.set_array_member(ex.get_line_number().to_string(), ar);
+ var file_to_line = new Json.Object();
+ file_to_line.set_object_member(fn, line_to_err);
+ var ret = new Json.Object();
+ ret.set_object_member("ERR", file_to_line);
- var rline = (int) line;
+ /*
+ var g = new Json.Generator ();
+
+ g.pretty = true;
+ g.indent = 2;
+ var n = new Json.Node(Json.NodeType.OBJECT);
+ n.set_object(ret);
+ g.set_root (n);
+
+ GLib.debug("got %s", g.to_data (null));
+ */
+ return ret;
- return rline > 0 ? rline -1 : 0;
+ }
+
+ public Json.Object compressionErrors(string code , string fn)
+ {
+ // this uses the roojspacker code to try and compress the code.
+ // it should highlight errors before we actually push live the code.
+ // standard error format: file %s, line %s, Error
+
+
+ var cfg = new JSDOC.PackerRun();
+ cfg.opt_keep_whitespace = false;
+ cfg.opt_skip_scope = false;
+ cfg.opt_dump_tokens = false;
+ cfg.opt_clean_cache = false;
+
+
+ var p = new JSDOC.Packer(cfg);
+
+
+ p.packFile(code, fn,"");
+ //state.showCompileResult(p.result);
+ /*
+ var g = new Json.Generator ();
+
+ g.pretty = true;
+ g.indent = 2;
+ var n = new Json.Node(Json.NodeType.OBJECT);
+ n.set_object(p.result);
+ g.set_root (n);
+
+ GLib.debug("got %s", g.to_data (null));
+ */
+ return p.result;
+
}
+
/**
* extension API concept..
* javascript file.. loaded into jscore,
* then a method is called, with a string argument (json encoded)
*
*/
+ /*
public string executeFile(string fname, string call_method, string js_data)
throws JavascriptError
{
if (!oval.is_function(ctx)) {
throw new JavascriptError.MISSING_METHOD ("Plugin: not a method %s", call_method);
}
-
+ throw new JavascriptError.MISSING_METHOD ("Plugin: not supported anymore");
+ return "";
var res = jscore_object_call_as_function(
ctx, oval, othis, js_data, out exd
return (string) buf;
}
+ */
+
-
-
}
}
-
+
\ No newline at end of file
MISSING_FILE,
INVALID_VALUE
}
-
- public class Usage : Object
- {
- public Gee.ArrayList<string> left;
- public Gee.ArrayList<string> right;
- public Usage(Gee.ArrayList<string> ileft, Gee.ArrayList<string> iright)
- {
- this.left = ileft;
- this.right= iright;
- }
- public bool leftHas(string s)
- {
- for(var i = 0 ; i < this.left.size; i++) {
- var m = this.left.get(i);
- if (s == m) {
- return true;
- }
- if (!m.contains(":")) {
- continue;
- }
- var ar = m.split(":");
- if (ar[0] == s) {
- return true;
- }
- }
- return false;
-
- }
-
- public string to_string()
- {
- var r = "left:\n";
- foreach(var s in left) {
- r+= " " + s + "\n";
- }
- r+= "right:\n";
- foreach(var s in right) {
- r+= " " + s + "\n";
- }
- return r;
-
- }
-
- }
-
-
-
- //static Gee.HashMap<string,Palete>? cache = null;
-
- /*
- public static Palete factory(project)
- {
- if (cache == null) {
- cache = new Gee.HashMap<string,Palete>();
- }
- if (cache.get(xtype) != null) {
- return cache.get(xtype);
- }
- switch(xtype) {
- case "Gtk":
- cache.set(xtype, new Gtk());
- break;
- case "Roo":
- cache.set(xtype, new Roo());
- break;
- default:
- throw new Error.INVALID_TYPE("invalid argument to Palete factory");
- }
- return cache.get(xtype);
- }
- */
-
+
public abstract class Palete : Object
{
public string name;
- public Gee.ArrayList<Usage> map;
+ //public Gee.ArrayList<Usage> map;
public Gee.HashMap<string,GirObject> classes; // used in roo..
-
+ public Gee.HashMap<string,Gee.ArrayList<string>> dropCache;
public Project.Project project;
public void aconstruct(Project.Project project)
{
// nothing?
this.project = project;
- this.map = null;
+ //this.map = null;
this.classes = null;
+ this.dropCache = new Gee.HashMap<string,Gee.ArrayList<string>>() ;
}
-
- //map : false, // array of mappings left: [] , right : []
-
- //items : false, // the tree of nodes.
-
-
-
-
-
-
-
- // this is the old verison using 'Usage'... see flutter for a better version..
-
- public string[] original_getChildList(string in_rval)
- {
-
- if (this.map == null) {
- this.load();
- }
- // empty == *top
-
- var rval = in_rval == "" ? "*top" : in_rval;
-
- // should be a bit more than this..
- // -> it should look for all elements that inherit
- string[] ret = {};
- var rt = new Gee.ArrayList<string>();
- for (var i = 0; i < this.map.size; i++) {
- var m = this.map.get(i);
-
- if (!m.leftHas(rval)) {
- continue;
- }
- print("found LEFT, adding right\n");
-
- for(var ii =0; ii < m.right.size; ii++) {
- var l = m.right.get(ii);
-
- if (rt.index_of(l) > -1) {
- continue;
- }
- //print("ADD " + string.joinv(", ", ret) + "\n");
- ret += l;
- rt.add(l);
- }
-
-
- }
- print ("drop list for %s is:\n%s\n", rval, string.joinv("\n", ret));
- //console.log("DROP LIST:");
- //console.dump(ret);
- return ret;
-
- }
-
-
-
- public string[] default_getDropList(string rval)
- {
-
- if (this.map == null) {
- this.load();
- }
-
-
- // should be a bit more than this..
- // -> it should look for all elements that inherit
- string[] ret = {};
- var rt = new Gee.ArrayList<string>();
- for (var i = 0; i < this.map.size; i++) {
- var m = this.map.get(i);
-
- if (m.right.index_of(rval) < 0) {
- continue;
- }
- //print("found RIGHT, adding left\n");
-
- for(var ii =0; ii < m.left.size; ii++) {
- var l = m.left.get(ii);
-
- if (rt.index_of(l) > -1) {
- continue;
- }
- //print("ADD " + string.joinv(", ", ret) + "\n");
- ret += l;
- rt.add(l);
- }
-
-
- }
- print ("drop list for %s is:\n%s\n", rval, string.joinv("\n", ret));
- //console.log("DROP LIST:");
- //console.dump(ret);
- return ret;
-
- }
-
public void saveTemplate (string name, JsRender.Node data)
{
return ret;
}
-
-
- public void loadUsageFile (string fname) {
-
-
-
-
- print("Palete Load called\n");
- string raw;
- if (!FileUtils.test (fname, FileTest.EXISTS)) {
- GLib.error("Missing File: %s", fname);
- ;
- }
- try {
- FileUtils.get_contents(fname, out raw);
- } catch (GLib.Error e) {
- GLib.error("Error %s", e.message);
- }
- // print(data);
- var data = raw.split("\n");
- var state = 0;
- var cfg = new Gee.ArrayList<Usage>();
- var left = new Gee.ArrayList<string>();
- var right = new Gee.ArrayList<string>();
-
- for (var i = 0; i < data.length; i++) {
- var d = data[i].strip();
- //print("READ " + d + "\n");
- if (
- d.length < 1
- ||
- Regex.match_simple ("^\\s+$", d)
- ||
- Regex.match_simple ("^\\s*/", d)
- ){
- continue;
- }
-
- if (Regex.match_simple ("^left:", d)) {
- state = 1;
- if (left.size > 0 ){
- cfg.add(new Usage( left, right));
- }
- left = new Gee.ArrayList<string>();
- right = new Gee.ArrayList<string>();
- continue;
- }
- if (Regex.match_simple ("^right:", d)) {
- state = 2;
- continue;
- }
- if (state == 1) {
- //print("add left: " + d + "\n");
- left.add(d);
- continue;
- }
- //print("add Right: " + d + "\n");
- right.add(d);
- //Seed.quit();
-
- }
- if (left.size > 0 ){
- cfg.add(new Usage( left, right));
- }
- this.map = cfg;
-
- }
-
-
- public void validateVala(
- WindowState state,
- string code,
- JsRender.NodeProp prop,
- JsRender.JsRender file,
- JsRender.Node node
- )
- {
-
- print("validate code (%s) %s\n", file.language, code);
-
-
-
- if (file.language != "vala" ) { // not sure if we need to validate property
- return;
- }
- // file.project , file.path, file.build_module, ""
-
-
-
- //var cd = new JSCore.ClassDefinitionEmpty();
- BuilderApplication.valasource.checkFileWithNodePropChange(
- file,
- node,
- prop,
- code
- );
-
-
- }
-
-
-
-
- public bool javascriptHasErrors(
- WindowState state,
- string code,
- JsRender.NodeProp? prop, // null if you are testing a whole file.
- JsRender.JsRender file,
- out Gee.HashMap<int,string> errors
- )
- {
-
- // print("validate code (%s) ptype=%s property=%s\n", file.language, ptype, property);
- errors = new Gee.HashMap<int,string>();
-
- if (file.language != "js") {
- return false;
- }
- // only check listeners and methods?
- if (prop != null && prop.ptype != JsRender.NodePropType.LISTENER && prop.ptype != JsRender.NodePropType.METHOD ) {
- return false;
- }
-
- //var cd = new JSCore.ClassDefinitionEmpty();
- //print("TESTING CODE %s\n", code);
- string errmsg;
- var testcode = prop == null ? code : "var __aaa___ = " + code;
- var line = Javascript.singleton().validate(
- testcode, out errmsg);
-
- if (line > -1) {
- if (prop == null) {
- var err = new Json.Object();
- err.set_int_member("ERR-TOTAL", 1);
- var files_obj = new Json.Object();
- var lines_obj = new Json.Object();
- var lines_ar = new Json.Array();
- lines_ar.add_string_element(errmsg);
- lines_obj.set_array_member(line.to_string(), lines_ar);
- files_obj.set_object_member(file.path, lines_obj);
-
- err.set_object_member("ERR", files_obj);
- state.showCompileResult(err);
- // do not set errors.. that's not done here..
- return true;
- }
- errors.set(line, errmsg); // depricated - this is used by the editor currently -- but we are planning to switch from that..
- print("got errors\n");
- return true;
-
- }
- // now syntax is OK.. try the
-
-
-
- if (prop == null) {
- return this.javascriptHasCompressionErrors(file, state, code);
- }
- print("no errors\n");
- return false;
-
- }
-
- public bool javascriptHasCompressionErrors(JsRender.JsRender file, WindowState state, string code)
- {
- // this uses the roojspacker code to try and compress the code.
- // it should highlight errors before we actually push live the code.
-
- // standard error format: file %s, line %s, Error
-
- var cfg = new JSDOC.PackerRun();
- cfg.opt_keep_whitespace = false;
- cfg.opt_skip_scope = false;
- cfg.opt_dump_tokens = false;
- cfg.opt_clean_cache = false;
-
-
- var p = new JSDOC.Packer(cfg);
-
-
- p.packFile(code, file.path,"");
- state.showCompileResult(p.result);
- if (p.hasErrors("")) {
- return true;
- }
- return false;
-
-
-
- }
- public abstract void on_child_added(JsRender.Node? parent,JsRender.Node child);
+ //public abstract void on_child_added(JsRender.Node? parent,JsRender.Node child);
public abstract void load();
public abstract Gee.HashMap<string,GirObject> getPropertiesFor(string ename, JsRender.NodePropType ptype);
public abstract GirObject? getClass(string ename);
public abstract bool typeOptions(string fqn, string key, string type, out string[] opts);
- public abstract List<SourceCompletionItem> suggestComplete(
+ public abstract Gee.ArrayList<CompletionProposal> suggestComplete(
JsRender.JsRender file,
JsRender.Node? node,
JsRender.NodeProp? prop,
string complete_string
);
- public abstract string[] getChildList(string in_rval);
- public abstract string[] getDropList(string rval);
-
+ public abstract Gee.ArrayList<string> getChildList(string in_rval, bool with_prop);
+ public abstract Gee.ArrayList<string> getDropList(string rval);
+ public abstract JsRender.Node fqnToNode(string fqn);
}
Gee.ArrayList<string> top_classes;
public static Gee.HashMap<string,GirObject>? classes_cache = null;
public static Gee.ArrayList<string>? top_classes_cache = null;
-
+
public Roo(Project.Project project)
{
aconstruct(project);
this.name = "Roo";
this.top_classes = new Gee.ArrayList<string>();
+
+
this.load(); // ? initialize the roodata?
+
}
Gee.HashMap<string,GirObject> propsFromJSONArray(string type, Json.Array ar, GirObject cls)
}
+
+
public override Gee.HashMap<string,GirObject> getPropertiesFor(string ename, JsRender.NodePropType ptype)
{
//print("Loading for " + ename);
}
+ // removes all the properties where the type contains '.' ?? << disabled now..
public Gee.HashMap<string,GirObject> filterProps(Gee.HashMap<string,GirObject> props)
{
}
- if (!val.type.contains(".")) {
+ //if (!val.type.contains(".")) {
outprops.set(k,val);
continue;
- }
+ //}
}
-
- public override void on_child_added(JsRender.Node? parent,JsRender.Node child)
- {
-
- return;
- }
+
/*
* Pulldown options for type
*/
return true;
}
- public override List<SourceCompletionItem> suggestComplete(
+ public override Gee.ArrayList<CompletionProposal> suggestComplete(
JsRender.JsRender file,
JsRender.Node? node,
JsRender.NodeProp? xxprop,
string complete_string
) {
- var ret = new List<SourceCompletionItem>();
+ var ret = new Gee.ArrayList<CompletionProposal>();
// completion rules??
// Roo......
for(var i = 0; i < JsRender.Lang.match_strings.size ; i++) {
var str = JsRender.Lang.match_strings.get(i);
if (complete_string != str && str.index_of(complete_string,0) == 0 ) {
- // should we ignore exact matches... ???
- var sci = SourceCompletionItem.new2();
- //string label, string text, Pixbuf? icon, string? info)
- sci.label = str;
- sci.text = str;
- sci.info = "javascript: " + str;
-
- ret.append(sci);
+ // should we ignore exact matches... ???tr,str,
+ var sci = new CompletionProposal(str,str, "javascript: " + str);
+ ret.add(sci);
+
}
if (complete_string != "Roo" && "Roo".index_of(complete_string,0) == 0 ) {
// should we ignore exact matches... ???
- var sci = SourceCompletionItem.new2();
- //string label, string text, Pixbuf? icon, string? info)
- sci.label = "Roo - A Roo class";
- sci.text = "Roo";
- sci.info = "Roo Library";
-
- ret.append(sci);
+ var sci = new CompletionProposal("Roo - A Roo class","Roo", "Roo Library");
+ ret.add(sci);
+
}
if (complete_string != "_this" && "_this".index_of(complete_string,0) == 0 ) {
// should we ignore exact matches... ???
- var sci = SourceCompletionItem.new2();
- //string label, string text, Pixbuf? icon, string? info)
- sci.label = "_this - Reference to the global pointer to the files main class instance";
- sci.text = "_this";
- sci.info = "Reference to the global pointer to the files main class instance";
- ret.append(sci);
+ var sci = new CompletionProposal("_this - Reference to the global pointer to the files main class instance",
+ "_this", "Reference to the global pointer to the files main class instance");
+ ret.add(sci);
+
}
return ret;
}
}
// got a starting match..
- var sci = SourceCompletionItem.new2();
- //string label, string text, Pixbuf? icon, string? info)
- sci.label = scls;
- sci.text = scls;
- sci.info = scls;
- ret.append(sci);
+ var sci = new CompletionProposal(scls,scls,scls);
+ ret.add(sci);
}
return ret;
}
}
// got a matching property...
// return type?
- var sci = SourceCompletionItem.new2();
- //string label, string text, Pixbuf? icon, string? info)
- sci.label = prop.name + prop.sig + " : ("+ prop.propertyof + ")";
- sci.text = prevbits + prop.name + "(";
- sci.info = prop.doctxt;
- ret.append(sci);
+
+
+ var sci = new CompletionProposal(prop.name + prop.sig + " : ("+ prop.propertyof + ")",
+ prevbits + prop.name + "(",prop.doctxt);
+ ret.add(sci);
+
}
// get the properties / methods and subclasses.. of cls..
if (parts[i].length > 0 && prop.name.index_of(parts[i],0) != 0) {
continue;
}
- // got a matching property...
- var sci = SourceCompletionItem.new2();
- //string label, string text, Pixbuf? icon, string? info)
- sci.label = prop.name + " : " + prop.type + " ("+ prop.propertyof + ")";
- sci.text = prevbits + prop.name;
- sci.info = prop.doctxt;
- ret.append(sci);
+ // got a matching property..
+ var sci = new CompletionProposal(prop.name + prop.type + " : ("+ prop.propertyof + ")",
+ prevbits + prop.name + "(",prop.doctxt);
+ ret.add(sci);
+
}
return ret;
}
- public override string[] getChildList(string in_rval)
+
+
+ public override Gee.ArrayList<string> getChildList(string in_rval, bool with_prop)
{
if (this.top_classes.size < 1) {
this.load();
}
-
-
- string[] ret = {};
+
+
+
var ar = this.top_classes;
if (in_rval != "*top") {
if (this.classes.has_key(in_rval)) {
}
}
- foreach(var str in ar) {
- ret += str;
- }
- GLib.debug("getChildList for %s returns %s", in_rval, string.joinv(", ", ret));
- return ret;
+ if (!with_prop) {
+ var ret = new Gee.ArrayList<string>();
+ foreach(var v in ar) {
+ if (v.contains(":")) {
+ continue;
+ }
+ ret.add(v);
+ }
+ return ret;
+ }
+
+ GLib.debug("getChildList for %s returns %d items", in_rval, ar.size);
+ return ar;
//return this.original_getChildList( in_rval);
}
- public override string[] getDropList(string rval)
+
+
+
+ public override Gee.ArrayList<string> getDropList(string rval)
{
+
+ if (this.dropCache.has_key(rval)) {
+ return this.dropCache.get(rval);
+ }
// we might be dragging Roo.bootstrap.layout.Region:center
// in which case we need to lookup Roo.bootstrap.layout.Region
// and see if it's has can_drop_onto
- string[] ret = {};
+ var ret = new Gee.ArrayList<string>();
var cls = this.classes.get(rval);
// cls can be null.
if (cls == null && rval.contains(":")) {
foreach(var str in cls.can_drop_onto) {
- ret += str;
+ ret.add(str);
}
- GLib.debug("getDropList for %s return[] %s", rval, string.joinv(", ", ret));
+ //GLib.debug("getDropList for %s return[] %s", rval, string.joinv(", ", ret));
+ this.dropCache.set(rval,ret);
return ret;
//return this.default_getDropList(rval);
}
+ public override JsRender.Node fqnToNode(string fqn)
+ {
+ var ret = new JsRender.Node();
+ ret.setFqn(fqn);
+ // any default requred proerties?
+
+ return ret;
+
+
+
+ }
+
}
+
+
+
+
+
}
public class RooDatabase : Object
{
- public Project.Project project;
+ public Project.Roo project;
public string DBTYPE;
public string DBNAME;
public Gda.Connection cnc;
- public RooDatabase.from_project (Project.Project project)
+ public RooDatabase.from_project (Project.Roo project)
{
this.project = project;
- this.DBTYPE = this.project.get_string_member("DBTYPE");
- this.DBNAME = this.project.get_string_member("DBNAME");
+ this.DBTYPE = this.project.DBTYPE;
+ this.DBNAME = this.project.DBNAME;
if (this.DBTYPE.length < 1) {
return;
}
this.cnc = Gda.Connection.open_from_string (
this.DBTYPE,
"DB_NAME=" + this.DBNAME,
- "USERNAME=" + this.project.get_string_member("DBUSERNAME") +
- ";PASSWORD=" + this.project.get_string_member("DBPASSWORD"),
+ "USERNAME=" + this.project.DBUSERNAME +
+ ";PASSWORD=" + this.project.DBPASSWORD,
Gda.ConnectionOptions.NONE
);
} catch(GLib.Error e) {
--- /dev/null
+
+/**
+ only one queue exists for the whole program
+*/
+namespace Palete {
+
+ public class ValaCompileQueue : Object
+ {
+
+ ValaCompileRequest? next_request = null;
+ ValaCompileRequest? cur_request = null;
+ ValaCompileRequest? last_request = null;
+
+
+
+
+ int countdown_start = 5;
+ int countdown = -1;
+ int timeout = 0;
+ uint countdown_running = 0;
+
+ int terminal_pid = 0;
+
+
+
+ public ValaCompileQueue()
+ {
+ //start timeout for compiler.
+
+ }
+
+ public void addFile( ValaCompileRequestType reqtype, JsRender.JsRender file , string alt_code, bool force)
+ {
+ var add = new ValaCompileRequest(
+ reqtype,
+ file,
+ null,
+ null,
+ alt_code
+ );
+
+
+ if (file.project.xtype == "Gtk" && file.targetName().has_suffix(".vala")) {
+
+
+ this.add(add , force);
+ }
+ if (file.project.xtype == "Roo" && file.targetName().has_suffix(".js")) {
+ this.next_request = null;
+ this.cur_request = add;
+ add.runJavascript(this);
+ }
+ }
+
+
+ public void addProp( ValaCompileRequestType requestType,
+ JsRender.JsRender file,
+ JsRender.Node node,
+ JsRender.NodeProp prop,
+ string alt_code
+ )
+ {
+ if (prop.name == "xns" || prop.name == "xtype") {
+ return ;
+ }
+ var add = new ValaCompileRequest(
+ requestType,
+ file,
+ node,
+ prop,
+ alt_code
+ );
+
+ if (file.project.xtype == "Gtk") {
+ this.add(add , false); // delayed?
+ }
+ if (file.project.xtype == "Roo" ) {
+ this.next_request = null;
+ this.cur_request = add;
+ add.runJavascript(this);
+ }
+ }
+ void add(ValaCompileRequest req, bool force)
+ {
+ GLib.debug("Add compile request to queue %s", req.file.path);
+ if (this.next_request != null && this.next_request.eq(req)) {
+ this.countdown = this.last_request == null || force ? 1 : this.countdown_start;
+
+ if (this.countdown_running < 1) {
+ this.startCountdown();
+ }
+ return;
+ }
+ if (this.cur_request != null && this.cur_request.eq(req)) { // ingore
+ GLib.debug("Ingore - its' running Add compile request to queue %s", req.file.path);
+ return;
+ }
+ if (this.last_request != null && this.last_request.eq(req)) { // ingore
+ GLib.debug("Ingore - its same as last request %s", req.file.path);
+ return;
+ }
+ this.next_request = req;
+ // quick if no previous
+ this.countdown = this.last_request == null || force ? 1 : this.countdown_start;
+ if (this.countdown_running < 1) {
+ this.startCountdown();
+ }
+
+ }
+
+ public void startCountdown()
+ {
+ this.countdown_running = GLib.Timeout.add_seconds(1, () => {
+ if (this.next_request == null && this.cur_request == null) {
+ this.countdown_running = 0;
+ return false;
+ }
+ this.countdown--;
+ // 60 sedonds
+ if (this.cur_request == null) {
+ this.timeout = 0;
+ }
+ if (this.cur_request != null) {
+
+ this.timeout--;
+ GLib.debug("Timeout running %d", this.timeout);
+ if (this.timeout < 1) {
+ GLib.debug("Timeout canceling %s", this.cur_request.file.path);
+ this.cur_request.cancel();
+ this.cur_request = null;
+ }
+ }
+
+ if (this.countdown < 1) {
+ this.run();
+ this.countdown_running = 0;
+ return false;
+ }
+
+ return true; // keep going.
+ });
+
+
+ }
+
+
+ // called on each tick/timeout
+ // not called if compiler is running..
+ void run()
+ {
+ this.timeout = 30;
+ var req = this.next_request;
+ this.next_request = null;
+ this.cur_request = req;
+
+
+ if (!req.run(this)) {
+ GLib.debug("run failed- give up on this one - should we show a problem??");
+ this.onCompileFail();
+ return;
+ }
+ this.showSpinner(true);
+
+
+ }
+ public void onCompileFail()
+ {
+ this.cur_request = null;
+ this.showSpinner(false);
+ }
+
+ public void onCompileComplete(ValaCompileRequest req)
+ {
+ this.cur_request = null;
+ req.file.project.last_request = req; // technically it should update compile group.
+ this.last_request = req;
+ this.showSpinner(false);
+ // update errors
+ BuilderApplication.updateCompileResults();
+ }
+
+ public void onCompilerOutput( string str )
+ {
+ // send output to all windows (of this project?)
+
+ }
+ public void showSpinner(bool state)
+ {
+ foreach (var win in BuilderApplication.windows) {
+ if (state) {
+ win.statusbar_compile_spinner.start();
+ } else {
+ win.statusbar_compile_spinner.stop();
+ }
+ }
+ }
+
+ // handle execution of result..-------
+
+ public void killChildren(int pid)
+ {
+ if (pid < 1) {
+ return;
+ }
+ 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);
+ return;
+ }
+ string cpids = "";
+ try {
+ FileUtils.get_contents(cn, out cpids);
+
+
+ if (cpids.length > 0) {
+ this.killChildren(int.parse(cpids));
+ }
+
+ } catch (GLib.FileError e) {
+ // skip
+ }
+ GLib.debug("killing %d", pid);
+ Posix.kill(pid, 9);
+ }
+
+
+ public void execResult(ValaCompileRequest req)
+ {
+
+ this.killChildren(this.terminal_pid);
+ this.terminal_pid = 0;
+
+ var exe = req.target();
+ var pr = (Project.Gtk) req.file.project;
+ var cg = pr.compilegroups.get(exe);
+
+ if (!GLib.FileUtils.test(exe, GLib.FileTest.EXISTS)) {
+ print("Missing output file: %s\n",exe);
+ return;
+ }
+ 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 += exe;
+ if (cg.execute_args.length > 0) {
+ args+= "--args";
+ var aa = cg.execute_args.split(" ");
+ for (var i =0; i < aa.length; i++) {
+ args += aa[i];
+ }
+ }
+
+
+
+ // should be home directory...
+
+
+ try {
+
+ var exec = new Spawn(pr.path , args);
+ exec.env = GLib.Environ.get();
+
+ exec.detach = true;
+ exec.run();
+
+ this.terminal_pid = exec.pid;
+ GLib.debug("Child PID = %d", this.terminal_pid);
+
+ } catch(GLib.Error e) {
+ GLib.debug("Failed to spawn: %s", e.message);
+ return;
+ }
+
+ }
+
+
+
+
+ }
+
+}
\ No newline at end of file
--- /dev/null
+
+
+
+namespace Palete {
+ public enum ValaCompileRequestType {
+ PROP_CHANGE,
+ FILE_CHANGE,
+ PROJECT,
+ RUN
+ }
+
+ public class ValaCompileRequest : Object
+ {
+ 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 Gee.HashMap<string,GLib.ListStore>? errorByType = null;
+ public Gee.HashMap<string,GLib.ListStore>? errorByFile = null;
+
+
+ public ValaCompileRequest(
+ ValaCompileRequestType requestType,
+ JsRender.JsRender file ,
+ JsRender.Node? node,
+ JsRender.NodeProp? prop,
+ string alt_code = ""
+
+ ) {
+ 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);
+
+ }
+
+ 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(ValaCompileQueue queue)
+ {
+ this.queue = queue;
+ if ( this.target() == "") {
+ this.onCompileFail();
+ return false;
+ }
+ 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()) {
+ 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 {
+ this.compiler = new Spawn(pr.path + "/build", args);
+ } catch (GLib.Error e) {
+ GLib.debug("Spawn failed: %s", e.message);
+ this.onCompileFail();
+ return false;
+ }
+ this.compiler.output_line.connect(this.onOutput);
+ this.compiler.complete.connect(this.onCompileComplete);
+ try {
+ this.compiler.run();
+ } catch (GLib.Error e) {
+ this.onCompileFail();
+ return false;
+ }
+ return true; // it's running..
+ }
+ void onCompileFail() // only called before we start (assumes spinner has nto started etc..
+ {
+ this.compiler = null;
+ this.deleteTemp();
+ }
+
+ public void cancel() {
+ Posix.kill(this.compiler.pid, 9);
+ this.compiler = null;
+ this.deleteTemp();
+ }
+
+ public void deleteTemp()
+ {
+ if (this.tmpfile == "") {
+ return;
+ }
+ if (GLib.FileUtils.test(this.tmpfile, GLib.FileTest.EXISTS)) {
+ GLib.FileUtils.unlink(this.tmpfile);
+ }
+ 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 == "") {
+ this.queue.onCompileFail();
+ return;
+ }
+
+ try {
+ //GLib.debug("GOT output %s", output);
+
+ var pa = new Json.Parser();
+ pa.load_from_data(output);
+ var node = pa.get_root();
+
+ if (node.get_node_type () != Json.NodeType.OBJECT) {
+ this.queue.onCompileFail();
+ return;
+ }
+ var ret = node.get_object ();
+ CompileError.parseCompileResults(this,ret);
+ this.queue.onCompileComplete(this);
+
+
+
+
+
+ } catch (GLib.Error e) {
+ GLib.debug("parsing output got error %s", e.message);
+ this.queue.onCompileFail();
+ return;
+
+ }
+ if (this.requestType == ValaCompileRequestType.RUN) {
+ this.queue.execResult(this);
+ }
+ }
+
+ public void onOutput(string line)
+ {
+ // pass it to UI?
+
+ }
+ public int totalErrors(string type, JsRender.JsRender? file=null)
+ {
+ var ar = this.errorByType.get(type);
+ if (ar == null) {
+ GLib.debug("by type has no eroros %s", type);
+ return 0;
+ }
+
+
+ var ret =0;
+
+ for(var i =0 ;i< ar.get_n_items();i++) {
+ var ce = (CompileError) ar.get_item(i);
+ if (file == null) {
+ ret += (int)ce.lines.get_n_items();
+ GLib.debug("got lines type has no eroros %s", type);
+ continue;
+ }
+
+
+ if (ce.file.path == file.path) {
+ ret += (int)ce.lines.get_n_items();
+ }
+ }
+ return ret;
+ }
+
+ public void runJavascript(ValaCompileQueue queue)
+ {
+ this.queue = queue;
+
+ var contents = this.alt_code == "" ? this.file.toSourceCode() : this.generateTempContents();
+
+ var ret = Javascript.singleton().validate(contents, this.file.targetName());
+
+ CompileError.parseCompileResults(this,ret);
+ this.queue.onCompileComplete(this);
+
+
+ // see pack file (from palete/palete..palete_palete_javascriptHasCompressionErrors.)
+
+ }
+
+ }
+
+
+
+}
+
+
* x = new ValaSource();
* x.connect.compiled(... do something with results... );
*
- * x.
*
*/
- public class ValaSource : Object {
+ public class ValaSourceOLD : Object {
-
+ public Json.Object? last_result = null;
public signal void compiled(Json.Object res);
public signal void compile_output(string str);
public JsRender.JsRender file;
public int line_offset = 0;
-
+
public Gee.ArrayList<Spawn> children;
- public ValaSource( )
+ Spawn compiler;
+
+ public string tmpfile_path = "";
+
+
+ public int terminal_pid = 0;
+
+ public ValaSourceOLD( )
{
base();
this.file = file;
if (this.compiler != null) {
+ //this.compiler.tidyup();
+ //this.spawnResult(0,"","");
return false;
}
}
- Spawn compiler;
+
- private bool checkStringSpawn(
- string contents
- )
+ private bool checkStringSpawn( string contents )
{
if (this.compiler != null) {
+ this.compiler.isZombie();
+ //this.compiler.tidyup();
+ //this.spawnResult(-2,"","");
return false;
}
-
- File tmpfile;
- FileIOStream iostream;
- try {
- tmpfile = File.new_tmp ("test-XXXXXX.vala", out iostream);
- tmpfile.ref(); // why??
- } catch(GLib.Error e) {
- GLib.debug("failed to create temporary file");
+ var pr = (Project.Gtk)(file.project);
+
+ var tmpfilename = pr.path + "/build/tmp-%u.vala".printf( (uint) GLib.get_real_time()) ;
+ try {
+ GLib.FileUtils.set_contents(tmpfilename,contents);
+ } catch (GLib.FileError e) {
+ GLib.debug("Error creating temp build file %s : %s", tmpfilename, e.message);
return false;
}
+
- OutputStream ostream = iostream.output_stream;
- DataOutputStream dostream = new DataOutputStream (ostream);
- try {
- dostream.put_string (contents);
- } catch(GLib.Error e) {
- GLib.debug("failed to write to temporary file");
- return false;
- }
+
var valafn = "";
try {
var regex = new Regex("\\.bjs$");
return false;
}
+
+
string[] args = {};
args += BuilderApplication._self;
+ args += "--skip-linking";
args += "--project";
- args += this.file.project.fn;
+ args += this.file.project.path;
args += "--target";
- args += this.file.build_module;
+ args += pr.firstBuildModuleWith(this.file);
args += "--add-file";
- args += tmpfile.get_path();
+ args += tmpfilename;
args += "--skip-file";
args += valafn;
-
+ this.tmpfile_path = tmpfilename;
try {
- this.compiler = new Spawn("/tmp", args);
+ this.compiler = new Spawn(pr.path + "/build", args);
} catch (GLib.Error e) {
GLib.debug("Spawn failed: %s", e.message);
return false;
GLib.debug("Error %s",e.message);
this.spinner(false);
this.compiler = null;
+ this.deleteTemp();
return false;
}
{
// race condition..
if (this.compiler != null) {
+ this.compiler.isZombie();
+ //this.compiler.tidyup();
+ //this.spawnResult(-2,"","");
return false;
}
this.file = file;
+ var pr = (Project.Gtk)(file.project);
this.line_offset = 0;
string[] args = {};
args += BuilderApplication._self;
+ args += "--skip-linking";
args += "--project";
- args += this.file.project.fn;
+ args += this.file.project.path;
args += "--target";
- args += this.file.build_module;
+ args += pr.firstBuildModuleWith(this.file);
+
try {
- this.compiler = new Spawn("/tmp", args);
+ this.compiler = new Spawn(pr.path+"/build", args);
+ this.compiler.output_line.connect(this.compile_output_line);
this.compiler.complete.connect(spawnResult);
this.spinner(true);
this.compiler.run();
public void spawnExecute(JsRender.JsRender file)
{
// race condition..
- if (this.compiler != null) {
+ if (this.compiler != null) {
+ this.compiler.isZombie();
+ this.compiler.tidyup();
+ this.spawnResult(-2,"","");
return;
}
if (!(file.project is Project.Gtk)) {
this.file = file;
this.line_offset = 0;
+
+
string[] args = {};
args += BuilderApplication._self;
+ args += "--debug";
+ args += "all";
+
args += "--project";
- args += this.file.project.fn;
+ args += this.file.project.path;
args += "--target";
- if (this.file.build_module.length > 0 ) {
- args += this.file.build_module;
- } else {
- args += pr.firstBuildModule();
- }
+ args += pr.firstBuildModuleWith(this.file);
+
//args += "--output"; -- set up by the module -- defaults to testrun
//args += "/tmp/testrun";
// assume code is in home...
try {
this.compiler = new Spawn( GLib.Environment.get_home_dir(), args);
- this.compiler.output_line.connect(compile_output_line);
+ this.compiler.output_line.connect(this.compile_output_line);
this.compiler.complete.connect(runResult);
this.spinner(true);
this.compiler.run();
}
public void compile_output_line( string str )
{
+ GLib.debug("%s", str);
this.compile_output(str);
}
/**
{
// race condition..
if (this.compiler != null) {
+ this.compiler.isZombie();
return false;
}
this.file = file;
return false;
}
for (var i = 0; i < cg.sources.size; i++) {
- var path = pr.resolve_path(
- pr.resolve_path_combine_path(pr.firstPath(),cg.sources.get(i)));
- if (path == file.path) {
- foundit = true;
- break;
- }
+ var path = pr.path + "/" + cg.sources.get(i);
+ if (path == file.path) {
+ foundit = true;
+ break;
+ }
}
if (!foundit) {
}
// is the file in the module?
-
- FileIOStream iostream;
- File tmpfile;
- try {
- tmpfile = File.new_tmp ("test-XXXXXX.vala", out iostream);
- tmpfile.ref();
- } catch(GLib.Error e) {
- GLib.debug("Failed to create tempoary file %s", e.message);
- return false;
- }
- OutputStream ostream = iostream.output_stream;
- DataOutputStream dostream = new DataOutputStream (ostream);
- try {
- dostream.put_string (contents);
- } catch(GLib.Error e) {
- GLib.debug("Failed to write to tempoary file %s", e.message);
+ var tmpfilename = pr.path + "/build/tmp-%u.vala".printf( (uint) GLib.get_real_time()) ;
+ try {
+ GLib.FileUtils.set_contents(tmpfilename,contents);
+ } catch (GLib.FileError e) {
+ GLib.debug("Error creating temp build file %s : %s", tmpfilename, e.message);
return false;
}
+
var target = pr.firstBuildModule();
if (target.length < 1) {
return false;
string[] args = {};
args += BuilderApplication._self;
+ args += "--skip-linking";
args += "--project";
- args += file.project.fn;
+ args += file.project.path;
args += "--target";
- args += m;
+ args += pr.firstBuildModuleWith(this.file);
args += "--add-file";
- args += tmpfile.get_path();
+ args += tmpfilename;
args += "--skip-file";
args += file.path;
-
+ this.tmpfile_path = tmpfilename;
try {
this.compiler = new Spawn("/tmp", args);
+ this.compiler.output_line.connect(this.compile_output_line);
this.compiler.complete.connect(spawnResult);
this.spinner(true);
this.compiler.run();
} catch (GLib.Error e) {
this.spinner(false);
this.compiler = null;
+ this.deleteTemp();
+
+
return false;
}
return true;
}
-
+ public void deleteTemp()
+ {
+ if (this.tmpfile_path == "") {
+ return;
+ }
+ if (GLib.FileUtils.test(this.tmpfile_path, GLib.FileTest.EXISTS)) {
+ GLib.FileUtils.unlink(this.tmpfile_path);
+ }
+ var cf = this.tmpfile_path.substring(0, this.tmpfile_path.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_path = "";
+ }
+ // update the compiler results into the lists.
+
+
+ // what to do when we have finished running..
+ // call this.compiled(result) (handled by windowstate?)
public void spawnResult(int res, string output, string stderr)
{
- this.spinner(false);
+ if (res == -2) {
+ var ret = new Json.Object();
+ ret.set_boolean_member("success", false);
+ ret.set_string_member("message","killed");
+ this.compiled(ret);
+ this.compiler.isZombie();
+ this.compiler = null;
+ this.deleteTemp();
+ this.spinner(false);
+ return;
+ }
try {
//GLib.debug("GOT output %s", output);
}
var ret = node.get_object ();
ret.set_int_member("line_offset", this.line_offset);
-
+ this.last_result = ret;
this.compiled(ret);
ret.set_string_member("message", e.message);
this.compiled(ret);
}
+ this.compiler.isZombie();
this.compiler = null;
+ this.deleteTemp();
+ this.spinner(false);
//compiler.unref();
//tmpfile.unref();
}
+ public void killChildren(int pid)
+ {
+ if (pid < 1) {
+ return;
+ }
+ 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);
+ return;
+ }
+ string cpids = "";
+ try {
+ FileUtils.get_contents(cn, out cpids);
+
+
+ if (cpids.length > 0) {
+ this.killChildren(int.parse(cpids));
+ }
+
+ } catch (GLib.FileError e) {
+ // skip
+ }
+ GLib.debug("killing %d", pid);
+ Posix.kill(pid, 9);
+ }
+
+
public void runResult(int res, string output, string stderr)
{
this.compiler = null;
- var exe = "/tmp/testrun";
+
+
+ GLib.debug("run result last pid = %d", this.terminal_pid );
+ this.spinner(false);
+ this.killChildren(this.terminal_pid);
+ this.terminal_pid = 0;
+
+
+
+
+
var mod = "";
var pr = (Project.Gtk)(this.file.project);
mod = pr.firstBuildModule();
}
if (mod.length < 1) {
+ GLib.debug("missing compilegroup module");
return;
}
var cg = pr.compilegroups.get(mod);
- if (cg.target_bin.length > 0) {
- exe = cg.target_bin;
- }
+ var exe = pr.path + "/build/" + cg.name;
+
if (!GLib.FileUtils.test(exe, GLib.FileTest.EXISTS)) {
print("Missing output file: %s\n",exe);
return;
}
- string[] args = "/usr/bin/gnome-terminal -x /usr/bin/gdb -ex=r --args".split(" ");
+ 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(" ");
+ //string[] args = "/usr/bin/xterm -e /usr/bin/gdb -x".split(" ");
+
+ args+= gdb_cfg;
// runs gnome-terminal, with gdb .. running the application..
args += exe;
if (cg.execute_args.length > 0) {
+ args+= "--args";
var aa = cg.execute_args.split(" ");
for (var i =0; i < aa.length; i++) {
args += aa[i];
try {
- var exec = new Spawn(GLib.Environment.get_home_dir() , args);
+
+ var exec = new Spawn(pr.path , args);
+ exec.env = GLib.Environ.get();
+ /*{
+ "PATH=" + GLib.Environment.get_variable("PATH"),
+ "SHELL=" + GLib.Environment.get_variable("SHELL"),
+ "DISPLAY=" + GLib.Environment.get_variable("DISPLAY"),
+ "TERM=xterm",
+ "USER=" + GLib.Environment.get_variable("USER"),
+ "DBUS_SESSION_BUS_ADDRESS="+ GLib.Environment.get_variable("DBUS_SESSION_BUS_ADDRESS"),
+ "XDG_SESSION_PATH="+ GLib.Environment.get_variable("XDG_SESSION_PATH"),
+ "SESSION_MANAGER="+ GLib.Environment.get_variable("SESSION_MANAGER"),
+ "XDG_SESSION_CLASS="+ GLib.Environment.get_variable("XDG_SESSION_CLASS"),
+ "XDG_SESSION_DESKTOP="+ GLib.Environment.get_variable("XDG_SESSION_DESKTOP"),
+ "XDG_SESSION_TYPE="+ GLib.Environment.get_variable("XDG_SESSION_TYPE")
+ };
+ */
exec.detach = true;
exec.run();
+
+ this.terminal_pid = exec.pid;
+ GLib.debug("Child PID = %d", this.terminal_pid);
+
} catch(GLib.Error e) {
GLib.debug("Failed to spawn: %s", e.message);
return;
public class ValaSourceReport : Vala.Report {
- public string filepath;
+ private Project.Project project;
+ public string filepath = "";
public string tmpname;
public void compile_notice(string type, string filename, int line, string message) {
+
+ GLib.debug("%s %s %d %s", type, filename, line, message);
+
if (!this.result.has_member(type+"-TOTAL")) {
this.result.set_int_member(type+"-TOTAL", 1);
} else {
- public ValaSourceReport(string filepath, string tmpname)
+ public ValaSourceReport(string filepath, string tmpname, Project.Project project)
{
base();
+ this.project = project;
this.filepath = filepath;
this.tmpname = tmpname;
this.result = new Json.Object();
}
Project.Project.loadAll();
- var proj = Project.Project.getProjectByHash(BuilderApplication.opt_compile_project);
+ var proj = Project.Project.getProjectByPath(BuilderApplication.opt_compile_project);
+ proj.load();
if (proj == null) {
jerr("could not load test project %s".printf( BuilderApplication.opt_compile_project));
ValaSourceReport report;
Project.Gtk project;
public string build_module;
- public string filepath;
+ public string filepath = "";
public string original_filepath;
public int line_offset = 0;
public string output;
context.report.enable_warnings = true;
context.metadata_directories = { };
context.gir_directories = {};
+ context.save_temps = true; // keep c sources = is it faster?
//context.thread = true;
valac += " --thread ";
context.debug = true;
valac += " -g ";
- this.report = new ValaSourceReport(this.original_filepath, this.filepath);
+ this.report = new ValaSourceReport(this.original_filepath, this.filepath, this.project);
context.report = this.report;
- valac += " -b " + GLib.Environment.get_home_dir() + " ";
- context.basedir = GLib.Environment.get_home_dir(); //Posix.realpath (".");
+ valac += " -b " + this.project.path; //."GLib.Environment.get_home_dir() + " ";
+ context.basedir = this.project.path; // GLib.Environment.get_home_dir(); //Posix.realpath (".");
- context.directory = null; //??? causes target to end up in the right place at present..
+ this.project.makeProjectSubdir("build");
+ context.directory = this.project.path + "/build"; //null; //??? causes target to end up in the right place at present..
// add default packages:
if (this.build_module.length > 0) {
var cg = pr.compilegroups.get(this.build_module);
- if (this.output.length < 1 && cg.target_bin.length > 0) {
- this.output = cg.target_bin;
+ if (this.output.length < 1) {
+ this.output = cg.name;
}
for (var i = 0; i < cg.sources.size; i++) {
- var path = pr.resolve_path(
- pr.resolve_path_combine_path(pr.firstPath(),cg.sources.get(i)));
-
- if (!FileUtils.test(path, FileTest.EXISTS)) {
+ var path = cg.sources.get(i);
+ GLib.debug("Try add source file %s", path);
+ // flip bjs to vala
+ if (path.has_suffix(".bjs")) {
+ path = path.splice(path.length -4, path.length, ".vala");
+ GLib.debug("Change source file %s", path);
+ }
+ if (!path.has_suffix(".vala") && path.has_suffix(".c") ) {
+ continue;
+ }
+ if (!FileUtils.test(pr.path + "/" + path, FileTest.EXISTS)) {
continue;
}
// skip thie original
- if (path == this.original_filepath) {
+ if (pr.path + "/" + path == this.original_filepath) {
+ GLib.debug("Add orig source file %s", path);
valac += " " + path;
continue;
}
- if (FileUtils.test(path, FileTest.IS_DIR)) {
+ if (FileUtils.test(pr.path + "/" + path, FileTest.IS_DIR)) {
continue;
}
- //print("Add source file %s\n", path);
+ GLib.debug("Add source file %s", path);
- valac += " " + path;
+ valac += " " + pr.path + "/" + path;
- if (Regex.match_simple("\\.c$", path)) {
+ if ( path.has_suffix(".c")) {
context.add_c_source_file(path);
continue;
}
var xsf = new Vala.SourceFile (
context,
Vala.SourceFileType.SOURCE,
- path
+ pr.path + "/" + path
);
xsf.add_using_directive (ns_ref);
context.add_source_file(xsf);
context.add_external_package ("gobject-2.0");
// user defined ones..
- var dcg = pr.compilegroups.get("_default_");
- for (var i = 0; i < dcg.packages.size; i++) {
+
+ for (var i = 0; i < pr.packages.size; i++) {
- var pkg = dcg.packages.get(i);
+ var pkg = pr.packages.get(i);
// do not add libvala versions except the one that matches the one we are compiled against..
if (Regex.match_simple("^libvala", pkg) && pkg != ("libvala-0." + ver.to_string())) {
- GLib.debug("Skip libvala Package: %s" , dcg.packages.get(i));
+ GLib.debug("Skip libvala Package: %s" , pkg);
continue;
}
- GLib.debug("Add Package: %s" , dcg.packages.get(i));
- valac += " --pkg " + dcg.packages.get(i);
- if (!this.has_vapi(context.vapi_directories, dcg.packages.get(i))) {
- GLib.debug("Skip vapi '%s' - does not exist", dcg.packages.get(i));
+ GLib.debug("Add Package: %s" ,pkg);
+ valac += " --pkg " + pr.packages.get(i);
+ if (!this.has_vapi(context.vapi_directories, pkg)) {
+ GLib.debug("Skip vapi '%s' - does not exist", pkg);
continue;
}
- context.add_external_package (dcg.packages.get(i));
+ context.add_external_package(pkg);
}
//Vala.Config.PACKAGE_SUFFIX.substring (1)
}
// none of this works on vala-40 as the API is not publicly visible
-
+
-
+ GLib.debug("calling emit");
context.codegen = new Vala.GDBusServerModule ();
context.codegen.emit (context);
+ if (BuilderApplication.opt_skip_linking) {
+ GLib.debug("skip linking is set = outputing result");
+ Vala.CodeContext.pop ();
+ this.outputResult();
+ GLib.Process.exit(Posix.EXIT_SUCCESS);
+
+ }
/* --- - only if we are actually doing a full build.- no added benifet for inline complier
on my laptop a 5s upto here.. then 40+s doing this.. - no additional warnings really (although if we are using 'C' code it maight be usefull
*/
+
+ GLib.debug("this.filepath = %s" , this.filepath);
+
if (this.filepath == "") {
+ GLib.debug("calling ccompiler");
var ccompiler = new Vala.CCodeCompiler ();
- var cc_command = Environment.get_variable ("CC");
+
- string [] cc_options = { "-lm", "-pg" };
- valac += " -X -lm -X -pg";
+ var cc_command = Environment.get_variable ("CC");
+
+ string [] cc_options = { "-lm" , "-pg"};
+ // ccache - would be nice, but we use multiple input files - which causes problems.
+ // would have to modify ccompile a bit, to handle this..
+ /*.
+ if (FileUtils.test("/usr/bin/ccache", FileTest.EXISTS)) {
+ GLib.debug("Using ccache");
+ cc_command = "/usr/bin/ccache " + (cc_command == null ? "cc" : cc_command) ;
+ } else {
+ GLib.debug("Try installing ccache to speed things up");
+ }
+ */
+
+ valac += " -X -lm -X -pg";
+ context.verbose_mode = true;
#if VALA_0_56
ccompiler.compile (context, cc_command, cc_options);
#elif VALA_0_36
#endif
}
- if (this.filepath != "") {
- GLib.FileUtils.unlink(this.filepath);
- }
+
+
+
+ //if (this.filepath != "") {
+ // GLib.FileUtils.unlink(this.filepath);
+ //}
//print("%s\n", valac);
Vala.CodeContext.pop ();
var g = new GirObject("Package",element.name) ;
if (parent == null) {
- this.project.gir_cache.set(element.name, (Gir)g);
+ this.project.gir_cache.set(element.name, g);
} else {
// we add it as a class of the package.. even though its a namespace..
parent.classes.set(element.name, g);
foreach(var c in element.get_structs()) {
this.add_struct(g, c);
}
-
+ foreach(var c in element.get_delegates()) {
+ this.add_delegate(g, c);
+ }
element.accept_children(this); // catch sub namespaces..
}
-
+
public void add_enum(GirObject parent, Vala.Enum cls)
{
c.type = prop.property_type.data_type == null ? "" : prop.property_type.data_type.get_full_name();
#endif
c.is_readable = prop.get_accessor != null ? prop.get_accessor.readable : false;
- c.is_writable = prop.get_accessor != null ? prop.get_accessor.writable : false;
+ c.is_writable = prop.set_accessor != null ? prop.set_accessor.writable || prop.set_accessor.construction : false;
+ //if (prop.name == "child") {
+ // GLib.debug("prop child : w%s r%s", c.is_writable ? "YES" : "n" , c.is_readable ? "YES" : "n");
+ //}
if (prop.version.deprecated) {
GLib.debug("class %s is deprecated", c.name);
c.is_deprecated = true;
}
+ public void add_delegate(GirObject parent, Vala.Delegate sig)
+ {
+
+ var c = new GirObject("Delegate", sig.name);
+ c.gparent = parent;
+ c.ns = parent.ns;
+ c.propertyof = parent.name;
+#if VALA_0_56
+ var dt = sig.return_type.type_symbol ;
+#elif VALA_0_36
+ var dt = sig.return_type.data_type;
+#endif
+ if (sig.version.deprecated) {
+ GLib.debug("class %s is deprecated", c.name);
+ c.is_deprecated = true;
+ }
+
+ var retval = "";
+
+ if (dt != null) {
+ //print("creating return type on signal %s\n", sig.name);
+ var cc = new GirObject("Return", "return-value");
+ cc.gparent = c;
+ cc.ns = c.ns;
+ cc.type = dt.get_full_name();
+ c.return_value = cc;
+ c.type = dt.get_full_name(); // type is really return type in this scenario.
+ retval = "\treturn " + cc.type +";";
+ }
+ parent.delegates.set(sig.name,c);
+
+ var params = sig.get_parameters() ;
+ if (params.size < 1) {
+
+ c.sig = "( ) => {\n\n"+ retval + "\n}\n";
+
+ return;
+ }
+ var cc = new GirObject("Paramset",sig.name); // what's the name on this?
+ cc.gparent = c;
+ cc.ns = c.ns;
+ c.paramset = cc;
+
+ var args = "";
+ foreach(var p in params) {
+ this.add_param(cc, p);
+ args += args.length > 0 ? ", " : "";
+ args += p.name;
+ }
+ // add c.sig -> this is the empty
+ c.sig = "(" + args + ") => {\n\n"+ retval + "\n}\n";
+
+
+
+ }
+
+
+
public void add_signal(GirObject parent, Vala.Signal sig)
{
context.add_external_package ("gobject-2.0");
// user defined ones..
- var dcg = this.project.compilegroups.get("_default_");
- var pkgs = this.fillDeps(dcg.packages);
+
+
+ var pkgs = this.fillDeps(this.project.packages);
for (var i = 0; i < pkgs.size; i++) {
namespace Project
{
- static int gtk_id = 1;
+
public class Gtk : Project
{
* Gir cache - it's local as we might want clear it if we modify the packages...
*
*/
- public Gee.HashMap<string,Palete.Gir> gir_cache = null;
- public bool gir_cache_loaded = false;
-
-
+ // public Gee.HashMap<string,Palete.GirObject> gir_cache = null; ??
+
+ public bool gir_cache_loaded = false; /// set this to false to force a relaod of vapi's?
+
+ // these are loaded / created by the palete.. but are project specific.
+ public Gee.HashMap<string,Gee.ArrayList<string>>? dropList = null;
+ public Gee.HashMap<string,Gee.ArrayList<string>> child_list_cache; // what child can on on what node
+ public Gee.HashMap<string,Gee.ArrayList<string>> child_list_cache_props; // what child can go on what node (with properties included)
+
+ public string compile_flags = ""; // generic to all.
+ public Gee.ArrayList<string> packages; // list of vapi's that are used by this project.
+
+ //pblic Gee.ArrayList<string> hidden; // list of dirs to be hidden from display...
+
+ public GtkValaSettings? active_cg = null;
+ public Gee.HashMap<string,GtkValaSettings> compilegroups;
+
+
+ public Palete.Gtk gpalete {
+ get {
+ return (Palete.Gtk) this.palete;
+ }
+ set {}
+ }
+
+
public Gtk(string path) {
base(path);
+
+ this.initChildCache();
+
this.palete = new Palete.Gtk(this);
- this.gir_cache = new Gee.HashMap<string,Palete.Gir>();
+ this.gir_cache = new Gee.HashMap<string,Palete.GirObject>();
this.xtype = "Gtk";
- var gid = "project-gtk-%d".printf(gtk_id++);
- this.id = gid;
- try {
- this.loadConfig();
- } catch (GLib.Error e ) {
- // is tihs ok?
- }
+ //var gid = "project-gtk-%d".printf(gtk_id++);
+ //this.id = gid;
+ this.packages = new Gee.ArrayList<string>();
+ //this.hidden = new Gee.ArrayList<string>();
+
}
- public Gee.HashMap<string,GtkValaSettings> compilegroups;
- public void loadConfig() throws GLib.Error
+ public void initChildCache()
+ {
+ this.child_list_cache = new Gee.HashMap<string,Gee.ArrayList<string>>();
+ this.child_list_cache_props = new Gee.HashMap<string,Gee.ArrayList<string>>();
+ this.dropList = null;
+ }
+
+
+
+ public override void loadJson(Json.Object obj)
{
// load a builder.config JSON file.
//
this.compilegroups = new Gee.HashMap<string,GtkValaSettings>();
-
- var fn = this.firstPath() + "/config1.builder";
- GLib.debug("load: " + fn );
-
- if (!FileUtils.test(fn, FileTest.EXISTS)) {
- this.compilegroups.set("_default_", new GtkValaSettings("_default_") );
- return;
+ if (obj.has_member("packages")) {
+ this.packages = this.readArray(obj.get_array_member("packages"));
}
-
- var pa = new Json.Parser();
- pa.load_from_file(fn);
- var node = pa.get_root();
-
- // should be an array really.
- if (node.get_node_type () != Json.NodeType.ARRAY) {
- throw new Error.INVALID_FORMAT ("Unexpected element type %s", node.type_name ());
+ if (obj.has_member("compiler_flags")) {
+ this.compile_flags = obj.get_string_member("compile_flags");
}
- var obj = node.get_array ();
- for(var i= 0;i<obj.get_length();i++) {
- var el = obj.get_object_element(i);
- var vs = new GtkValaSettings.from_json(el);
+ if (!obj.has_member("compilegroups") || obj.get_member("compilegroups").get_node_type () != Json.NodeType.ARRAY) {
+ // make _default_ ?
+ return;
+ }
+
+ //this.hidden = this.readArray(obj.get_array_member("hidden"));
+ var ar = obj.get_array_member("compilegroups");
+ for(var i= 0;i<ar.get_length();i++) {
+ var el = ar.get_object_element(i);
+ var vs = new GtkValaSettings.from_json(this,el);
if (vs == null) {
print("problem loading json file");
continue;
}
- if (vs.name != "_default_") {
- vs.parent = this.compilegroups.get("_default_");
- }
+
this.compilegroups.set(vs.name,vs);
}
- GLib.debug("%s\n",this.configToString ());
+
+
+ //GLib.debug("%s\n",this.configToString ());
}
- public string configToString()
+ public override void saveJson(Json.Object obj)
{
var ar = new Json.Array();
- var iter = this.compilegroups.map_iterator();
- while(iter.next()) {
-
- ar.add_object_element(iter.get_value().toJson());
+ foreach(var cg in this.compilegroups.values) {
+ ar.add_object_element(cg.toJson());
}
-
- var generator = new Json.Generator ();
- generator.indent = 4;
- generator.pretty = true;
- var node = new Json.Node(Json.NodeType.ARRAY);
- node.set_array(ar);
- generator.set_root(node);
- return generator.to_data(null);
- }
-
- public void writeConfig()
- {
- var fn = this.firstPath() + "/config1.builder";
- GLib.debug("write: " + fn );
-
-
- var f = GLib.File.new_for_path(fn);
- try {
- var data_out = new GLib.DataOutputStream(
- f.replace(null, false, GLib.FileCreateFlags.NONE, null)
- );
- data_out.put_string(this.configToString(), null);
- data_out.close(null);
- } catch (GLib.Error e) {
- GLib.debug("Error writing config: %s", e.message);
- return;
+ obj.set_array_member("compilegroups", ar);
+
+ obj.set_string_member("compile_flags", this.compile_flags);
+ var par = new Json.Array();
+ foreach(var p in this.packages) {
+ par.add_string_element(p);
}
- this.gir_cache_loaded = false; // force a reload.
+ obj.set_array_member("packages", par);
+ //var hi = new Json.Array();
+ //foreach(var p in this.hidden) {
+ // hi.add_string_element(p);
+ //}
+ //obj.set_array_member("hidden", hi);
-
+ this.gir_cache_loaded = false; // force reload of the cache if we change the packages.
+ this.gpalete.loaded = false;
+ this.initChildCache();
+ this.gir_cache = null;
}
+
+
/**
* perhaps we should select the default in the window somewhere...
*/
public string firstBuildModule()
{
- var iter = this.compilegroups.map_iterator();
- while(iter.next()) {
-
- if (iter.get_value().name == "_default_") {
- continue;
- }
-
- return iter.get_value().name;
+
+ foreach(var cg in this.compilegroups.values) {
+ return cg.name;
+
}
return "";
+
}
public string firstBuildModuleWith(JsRender.JsRender file)
{
-
- var iter = this.compilegroups.map_iterator();
- while(iter.next()) {
-
- if (iter.get_value().name == "_default_") {
- continue;
- }
- if (iter.get_value().has_file(file)) {
- return iter.get_value().name;
+ foreach(var cg in this.compilegroups.values) {
+ if (cg.has_file(file)) {
+ return cg.name;
}
}
- return "";
+ return this.firstBuildModule();
+
}
- public string relPath(string target)
+ public void loadVapiIntoStore(GLib.ListStore ls)
{
- var basename = this.firstPath();
- // eg. base = /home/xxx/fred/blogs
- // target = /home/xxx/fred/jones
-
- // this does not work correctly...
- var bb = basename;
- var prefix = "";
- while (true) {
- if ( bb.length < target.length &&
- target.substring(0, bb.length) == bb) {
-
- return prefix + target.substring(bb.length );
- }
- if (bb.length < 1) {
- GLib.error("Could not work out relative path %s to %s",
- basename, target);
- }
- bb = GLib.Path.get_dirname(bb);
- prefix += "../";
-
+ ls.remove_all();
+
+
+ var pal = (Palete.Gtk) this.palete;
+ var pkgs = pal.packages(this);
+ foreach (var p in pkgs) {
+ ls.append(new VapiSelection(this.packages, p));
}
-
+
}
- /**
- * get a list of files for a folder..
- *
- * - in the project manager this has to list all possible compilable
- * files - eg. exclue XXX.vala.c or XXX.c with the same name as
- * a vala file (so to ignore the generated files)
- *
- * - for the editor navigation - this should exclude all files that
- * are vala based on a bjs file..
- *
- */
- public Gee.ArrayList<string> filesAll(string in_path,bool abspath = true)
+ public void loadTargetsIntoStore(GLib.ListStore ls)
{
- var ret = new Gee.ArrayList<string>();
-
- var dirname = this.resolve_path(
- this.resolve_path_combine_path(this.firstPath(),in_path));
-
- GLib.debug("SCAN %s", dirname);
- // scan the directory for files -- ending with vala || c
-
-
- var dir = File.new_for_path(dirname);
- if (!dir.query_exists()) {
- GLib.debug("SCAN %s - skip - does not exist\n", dirname);
- return ret;
+ ls.remove_all();
+ foreach(var cg in this.compilegroups.values) {
+ ls.append(cg);
}
- var pathprefix = abspath ? dirname : in_path;
-
- try {
- var file_enum = dir.enumerate_children(
- "standard::*",
- GLib.FileQueryInfoFlags.NONE,
- null
- );
-
-
- FileInfo next_file;
- while ((next_file = file_enum.next_file(null)) != null) {
- var fn = next_file.get_display_name();
-
- if (next_file.get_file_type () == GLib.FileType.DIRECTORY) {
-
- GLib.debug("SKIP %s not regular ", fn);
- continue;
- }
- if (!Regex.match_simple("^text", next_file.get_content_type())) {
- continue;
- }
- GLib.debug("SCAN ADD %s : %s", fn, next_file.get_content_type());
- ret.add(pathprefix + "/" + fn);
-
- // any other valid types???
-
- }
-
- } catch(GLib.Error e) {
- GLib.warning("oops - something went wrong scanning the projects\n");
- }
-
- return ret;
}
- public Gee.ArrayList<string> filesForCompile(string in_path, bool abspath = true)
+
+
+
+
+ public string[] vapidirs()
{
- var allfiles = this.filesAll(in_path,abspath);
- var ret = new Gee.ArrayList<string>();
- Regex is_c;
- try {
- is_c = new Regex("\\.c$");
- } catch (RegexError e) {
- GLib.error("Regex failed :%s", e.message);
- }
- for (var i = 0; i < allfiles.size; i ++) {
- var fn = allfiles.get(i);
- try {
- if (Regex.match_simple("\\.vala$", fn)) {
- ret.add( fn);
- continue;
- }
- // vala.c -- ignore..
- if (Regex.match_simple("\\.vala\\.c$", fn)) {
- continue;
- }
- // not a c file...
- if (!Regex.match_simple("\\.c$", fn)) {
- continue;
- }
-
- // is the c file the same as a vala file...
-
-
-
- var vv = is_c.replace( fn, fn.length, 0, ".vala");
-
-
-
-
- if (allfiles.index_of( vv) > -1) {
- continue;
- }
- // add the 'c' file..
- ret.add(fn);
- } catch (GLib.Error e) {
- continue;
- }
- }
- // sort.
- ret.sort((fa,fb) => {
- return ((string)fa).collate((string) fb);
- });
- return ret;
-
+ return this.pathsMatching("vapi", false);
}
-
- public Gee.ArrayList<string> filesForOpen(string in_path)
+
+ public override void initialize()
{
- var allfiles = this.filesAll(in_path);
- var ret = new Gee.ArrayList<string>();
- GLib.debug("SCAN %s - %d files",in_path, allfiles.size);
+ string[] dirs = {
+ "src",
+ "src/ui"
+ // ?? docs ?
+ //
+ };
- Regex is_c, is_vala;
- try {
- is_c = new Regex("\\.c$");
- is_vala = new Regex("\\.vala$");
- } catch (RegexError e) {
- GLib.error("Regex failed :%s", e.message);
+
+ string[] vapis = {
+ "gtk4",
+ "gee-0.8",
+ "gio-2.0",
+
+ "glib-2.0",
+ "gobject-2.0",
+
+ // "json-glib-1.0",
+
+ "libadwaita-1",
+ //"libxml-2.0",
+ "posix"
+
+
+ };
+ for(var i = 0; i < dirs.length; i++) {
+ this.makeProjectSubdir( dirs[i]);
}
+ for(var i = 0; i < vapis.length; i++) {
+ this.packages.add(vapis[i]);
+ }
+ // create/// some dummy files?
+ // application
+
+ this.makeMain();
+ this.makeApplication();
+ this.makeWindow();
- for (var i = 0; i < allfiles.size; i ++) {
- var fn = allfiles.get(i);
- var bn = GLib.Path.get_basename(fn);
- try {
-
- if (Regex.match_simple("\\.vala\\.c$", fn)) {
- GLib.debug("SKIP %s - vala.c",fn);
- continue;
- }
-
- if (Regex.match_simple("\\.bjs$", fn)) {
- GLib.debug("SKIP %s - .bjs",fn);
- continue;
- }
-
- if (Regex.match_simple("\\~$", fn)) {
- GLib.debug("SKIP %s - ~",fn);
- continue;
- }
- if (Regex.match_simple("\\.stamp$", fn)) {
- GLib.debug("SKIP %s - .o",fn);
- continue;
- }
- if ("stamp-h1" == bn) {
- GLib.debug("SKIP %s - .o",fn);
- continue;
- }
-
- // confgure.am
- if ("config.h" == bn || "config.h.in" == bn || "config.log" == bn || "configure" == bn ) {
- if (allfiles.index_of( in_path +"/configure.ac") > -1) {
- continue;
- }
- }
- // makefile
- if ("Makefile" == bn || "Makefile.in" == bn ) {
- if (allfiles.index_of( in_path +"/Makefile.am") > -1) {
- continue;
- }
- }
-
- if (Regex.match_simple("^\\.", bn)) {
- GLib.debug("SKIP %s - hidden",fn);
- continue;
- }
- if (Regex.match_simple("\\.vala$", fn)) {
- var vv = is_vala.replace( fn, fn.length, 0, ".bjs");
- if (allfiles.index_of( vv) > -1) {
- GLib.debug("SKIP %s - .vala (got bjs)",fn);
- continue;
- }
- GLib.debug("ADD %s",fn);
- ret.add( fn);
- continue;
- }
- // vala.c -- ignore..
-
- // not a c file...
- if (Regex.match_simple("\\.c$", fn)) {
-
- var vv = is_c.replace( fn, fn.length, 0, ".vala");
- if (allfiles.index_of( vv) > -1) {
- GLib.debug("SKIP %s - .c (got vala)",fn);
- continue;
- }
- GLib.debug("ADD %s",fn);
- ret.add( fn);
- continue;
- }
-
- if (GLib.Path.get_basename( fn) == "config1.builder") {
- continue;
- }
- // not .c / not .vala /not .bjs.. -- other type of file..
- // allow ???
- GLib.debug("ADD %s",fn);
- // add the 'c' file..
- ret.add(fn);
- } catch (GLib.Error e) {
- GLib.debug("Exception %s",e.message);
- continue;
- }
- }
- // sort.
- ret.sort((fa,fb) => {
- return ((string)fa).collate((string) fb);
- });
- return ret;
+ var cg = new GtkValaSettings(this, this.name);
+ this.compilegroups.set(this.name, cg);
+ cg.sources.add("src/Main.vala");
+ cg.sources.add("src/%sApplication.vala".printf(this.name));
+ cg.sources.add("src/ui/ui.Window.bjs");
+ // rescan... not needed as it get's selected after initialization.
+
+
}
-
-
-
- public string resolve_path_combine_path(string first, string second)
+ void makeTemplatedFile(string name, string[] str, string replace)
{
- string ret = first;
- if (first.length > 0 && second.length > 0 && !first.has_suffix("/") && !second.has_prefix("/"))
- {
- ret += "/";
+ var o = "";
+ for(var i=0;i< str.length;i++) {
+ o += str[i].replace("%s", replace) + "\n";
}
- //print("combined path = %s", ret + second);
- return ret + second;
+ this.writeFile(name, o);
}
- public string resolve_path_times(string part, int times, string? clue = null)
+ public void writeFile(string name, string o)
{
- string ret = "";
- for (int i = 0; i < times; i++)
- {
- if (clue != null && i > 0)
- {
- ret += clue;
- }
- ret += part;
+ var f = GLib.File.new_for_path(this.path + "/" + name);
+ try {
+ var data_out = new GLib.DataOutputStream( f.replace(null, false, GLib.FileCreateFlags.NONE, null) );
+ data_out.put_string(o, null);
+ data_out.close(null);
+ } catch (GLib.Error e) {
+ GLib.debug("Error writing file %s", e.message);
}
- return ret;
+
+ }
+
+ void makeMain()
+ {
+ string[] str = {
+ "int main (string[] args)",
+ "{",
+ " var app = new %sApplication( args);",
+ " Gtk.init ();",
+ " GLib.Log.set_always_fatal(LogLevelFlags.LEVEL_ERROR ); ",
+ " app.activate.connect(() => {",
+ " var w = new ui.Window();", // ?? main window as UI window?
+ " w.el.application = app;",
+ " w.ref();",
+ " w.show();",
+ " });",
+ " var ret = app.run(args);",
+ " return ret; ",
+ "}"
+ };
+ this.makeTemplatedFile("src/Main.vala", str, this.name); // fixme name needs to be code friendly!
}
- public string resolve_path(string _path, string? relative = null)
+ void makeApplication()
{
- string path = _path;
- if (relative != null)
- {
- path = this.resolve_path_combine_path(path, relative);
- }
- string[] parts = path.split("/");
- string[] ret = {};
- int relative_parts = 0;
-
- foreach (var part in parts)
- {
- if (part.length < 1 || part == ".")
- {
- continue;
- }
-
- if (part == "..")
- {
- if (ret.length > 0)
- {
- ret = ret[0: ret.length -1];
- }
- else
- {
- relative_parts++;
- }
- continue;
- }
+ string[] str = {
+
+
+ "public class %sApplication : Gtk.Application",
+ "{",
+ " public %sApplication (string[] args) ",
+ " {",
+ " Object(",
+ " application_id: \"org.roojs.%s\",",
+ " flags: ApplicationFlags.FLAGS_NONE",
+ " );",
+ " }",
+ "}"
+ };
- ret += part;
- }
- path = this.resolve_path_combine_path(this.resolve_path_times("..", relative_parts, "/"), string.joinv("/", ret));
- if (_path.has_prefix("/"))
- {
- path = "/" + path;
- }
- return path;
+ this.makeTemplatedFile("src/%sApplication.vala".printf(this.name), str, this.name); // fixme name needs to be code friendly!
}
+
- public string[] vapidirs()
+ void makeWindow()
{
- string[] ret = {};
- var sources = this.compilegroups.get("_default_").sources;
- for(var i =0; i< sources.size; i++) {
-
- var path = this.resolve_path( this.firstPath(), sources.get(i));
-
- if (Path.get_basename (path) == "vapi") {
- GLib.debug("Adding VAPIDIR: %s\n", path);
- ret += path;
- }
-
- }
- return ret;
+ this.writeFile("src/ui/ui.Window.bjs", """{
+ "build_module" : "",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* prop" : "child",
+ "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+ "int spacing" : 0,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "string label" : "Hello World",
+ "xtype" : "Label"
+ }
+ ],
+ "xtype" : "Box"
+ }
+ ],
+ "xtype" : "Window"
+ }
+ ],
+ "name" : "ui.Window",
+ "gen_extended" : false
+}
+""");
+ }
+
+
- }
- public string[] sourcedirs()
- {
- string[] ret = {};
- var sources = this.compilegroups.get("_default_").sources;
- ret += this.firstPath();
- for(var i =0; i< sources.size; i++) {
-
- var path = this.resolve_path( this.firstPath(), sources.get(i));
- if (path == this.firstPath()) {
- continue;
- }
- if (Path.get_basename (path) == "vapi") {
- continue;
- }
- // GLib.debug("Adding VAPIDIR: %s\n", path);
- ret += path;
- }
- return ret;
-
- }
-
+ public override void initDatabase()
+ {
+ // nOOP
+ }
}
-
+
}
{
// an object describing a build config (or generic ...)
public class GtkValaSettings : Object {
- public string name;
- public GtkValaSettings? parent;
+ public string name { get; set; }
+
- public string compile_flags; // generic to all.
- public Gee.ArrayList<string> packages; // list of packages?? some might be genericly named?
+ Gtk project;
+
public Gee.ArrayList<string> sources; // list of files+dirs (relative to project)
- public string target_bin;
+
public string execute_args;
+ public bool loading_ui = true;
- public GtkValaSettings(string name)
+ public GtkValaSettings(Gtk project, string name)
{
this.name = name;
- this.compile_flags = "";
- this.target_bin = "";
- this.packages = new Gee.ArrayList<string>();
+ this.project = project;
+
+
this.sources = new Gee.ArrayList<string>();
this.execute_args = "";
}
-
-
- public GtkValaSettings.from_json(Json.Object el) {
+
+ public GtkValaSettings.from_json(Gtk project, Json.Object el) {
-
+ this.project = project;
this.name = el.get_string_member("name");
- this.compile_flags = el.get_string_member("compile_flags");
+
if ( el.has_member("execute_args")) {
this.execute_args = el.get_string_member("execute_args");
} else {
this.execute_args = "";
- }
- this.target_bin = el.get_string_member("target_bin");
+ }
// sources and packages.
- this.sources = this.readArray(el.get_array_member("sources"));
- this.packages = this.readArray(el.get_array_member("packages"));
+ this.sources = this.project.readArray(el.get_array_member("sources")) ;
+
}
// why not array of strings?
- public Gee.ArrayList<string> readArray(Json.Array ar)
- {
- var ret = new Gee.ArrayList<string>();
- for(var i =0; i< ar.get_length(); i++) {
- ret.add(ar.get_string_element(i));
- }
- return ret;
- }
+
public Json.Object toJson()
{
var ret = new Json.Object();
ret.set_string_member("name", this.name);
- ret.set_string_member("compile_flags", this.compile_flags);
ret.set_string_member("execute_args", this.execute_args);
- ret.set_string_member("target_bin", this.target_bin);
+
ret.set_array_member("sources", this.writeArray(this.sources));
- ret.set_array_member("packages", this.writeArray(this.packages));
+ ret.set_array_member("hidden", this.writeArray(this.sources));
+
return ret;
}
public Json.Array writeArray(Gee.ArrayList<string> ar) {
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.resolve_path( pr.resolve_path_combine_path( pr.firstPath(), this.sources.get(i)));
+ var path = pr.path + "/" + this.sources.get(i);
GLib.debug("check %s", path);
if (path == file.path) {
should really store project data in the directory of the project?
+ // steps:
+ // List of projects - just an array of paths in .Builder/Projects.json
+
+ // .roobuilder.jcfg << hidden file with project details?
+
+
*
}
// static array of all projects.
- public Gee.HashMap<string,Project> projects;
+ private Gee.ArrayList<Project> projects;
- public class Project : Object {
+ public abstract class Project : Object {
public signal void on_changed ();
- public string id;
- public string fn = ""; // just a md5...
- public string name = "";
- public string runhtml = "";
- public string base_template = "";
- public string rootURL = "";
- public string html_gen = "";
-
- public Gee.HashMap<string,string> paths;
- public Gee.HashMap<string,JsRender.JsRender> files ;
+ //public string id;
+ //public string fn = ""; // just a md5...
+ public string name {
+ private set {}
+ owned get {
+ return GLib.Path.get_basename(path);
+ }
+
+ }
+
+
+ public string path = "";
+ private Gee.ArrayList<JsRender.JsRender> sub_paths;
+
+ private Gee.HashMap<string,JsRender.JsRender> files ; // contains full list of files.
//tree : false,
public string xtype;
- public Json.Object json_project_data;
- public Palete.RooDatabase roo_database;
+ //public Json.Object json_project_data;
+
public Palete.Palete palete;
- bool is_scanned;
-
+ private bool is_scanned = false;
+ public Gee.HashMap<string,Palete.GirObject> gir_cache = null; // used by Gir ??? is this used by Roo?
+ public Palete.ValaCompileRequest last_request = null;
- public Project (string path) {
+ protected Project (string path) {
- this.name = GLib.Path.get_basename(path); // default..
- this.json_project_data = new Json.Object();
+
+ //this.json_project_data = new Json.Object();
this.is_scanned = false;
- this.paths = new Gee.HashMap<string,string>();
+ this.sub_paths = new Gee.ArrayList<JsRender.JsRender>();
this.files = new Gee.HashMap<string,JsRender.JsRender>();
//XObject.extend(this, cfg);
//this.files = { };
- if (path.length > 0) {
- this.paths.set(path, "dir");
- }
- // dummy roo database...
- this.initRooDatabase();
-
+ this.path = path;
+
}
- public void initRooDatabase()
- {
-
- this.roo_database = new Palete.RooDatabase.from_project(this);
- }
+
}
return;
}
- projects = new Gee.HashMap<string,Project>();
+ projects = new Gee.ArrayList<Project>();
-
+
+ if (FileUtils.test(dirname + "/Projects.list", GLib.FileTest.IS_REGULAR)) {
+ loadProjectList();
+ projects_loaded = true;
+ return;
+ }
+ convertOldProjects(); // this saves..
+ foreach(var p in projects) {
+ p.save();
+ }
+ projects_loaded = true;
+
+ }
+
+ public static void remove(Project p) {
+ projects.remove(p);
+ saveProjectList();
+
+ }
+
+ public static void saveProjectList()
+ {
+ var f = new Json.Object();
+ foreach(var p in projects) {
+ f.set_string_member(p.path, p.xtype);
+ }
+
+ var generator = new Json.Generator ();
+ var root = new Json.Node(Json.NodeType.OBJECT);
+ root.init_object(f);
+ generator.set_root (root);
+ generator.pretty = true;
+ generator.indent = 4;
+
+ var data = generator.to_data (null);
+ var dirname = GLib.Environment.get_home_dir() + "/.Builder";
+ GLib.debug("Write new Project list\n %s", data);
+ //Posix.exit(0);
+
+ try {
+ //FileUtils.set_contents(dirname + "/" + this.fn + ".json", s, s.length);
+ FileUtils.set_contents(dirname + "/Projects.list", data, data.length);
+ } catch (GLib.Error e) {
+ GLib.error("failed to save file %s", e.message);
+ }
+
+ }
+
+
+
+ public static void convertOldProjects()
+ {
+
+ var dirname = GLib.Environment.get_home_dir() + "/.Builder";
+ var dir = File.new_for_path(dirname);
try {
var file_enum = dir.enumerate_children(
GLib.FileAttribute.STANDARD_DISPLAY_NAME,
GLib.FileQueryInfoFlags.NONE,
null
);
-
FileInfo next_file;
while ((next_file = file_enum.next_file(null)) != null) {
- var fn = next_file.get_display_name();
+ var fn = next_file.get_display_name();
if (!Regex.match_simple("\\.json$", fn)) {
continue;
}
- factoryFromFile(dirname + "/" + fn);
+ Project.factoryFromFileOld(dirname + "/" + fn);
}
} catch(GLib.Error e) {
GLib.warning("oops - something went wrong scanning the projects\n");
}
-
+ GLib.debug("Loaded all old Projects - saving");
+ Project.saveProjectList();
}
public static Gee.ArrayList<Project> allProjectsByName()
{
- var ret = new Gee.ArrayList<Project>();
- var iter = projects.map_iterator();
- while (iter.next()) {
- ret.add(iter.get_value());
- }
- // fixme -- sort...
- return ret;
+
+ return projects;
}
- public static Project? getProject(string name)
+ public static Project? getProjectByName(string name)
{
- var iter = projects.map_iterator();
- while (iter.next()) {
- if (iter.get_value().name == name) {
- return iter.get_value();
+ foreach (var p in projects) {
+ if (p.name == name) {
+ return p;
}
-
}
return null;
}
+ public static Project? getProjectByPath(string path)
+ {
+
+ foreach (var p in projects) {
+ if (p.path == path) {
+ return p;
+ }
+ }
+
+ return null;
+ }
public static string listAllToString()
{
- var all = new Gee.ArrayList<Project>();
+ var all = projects;
- var fiter = projects.map_iterator();
-
- while(fiter.next()) {
- all.add(fiter.get_value());
- }
+
all.sort((fa,fb) => {
return ((Project)fa).name.collate(((Project)fb).name);
var iter = all.list_iterator();
var ret = "ID\tName\tDirectory\n";
while (iter.next()) {
- ret += "%s\t%s\t%s\n".printf(
- iter.get().fn,
+ ret += "%s\t%s\n".printf(
+
iter.get().name,
- iter.get().firstPath()
+ iter.get().path
);
}
+ public static void loadIntoStore(GLib.ListStore st)
+ {
+ st.remove_all();
+ foreach (var p in projects) {
+ st.append(p);
+ }
+
+ }
+
+
+
- public static Project? getProjectByHash(string fn)
+ static void loadProjectList()
{
+
+ var dirname = GLib.Environment.get_home_dir() + "/.Builder";
+
+ projects = new Gee.ArrayList<Project>();
+
+ var pa = new Json.Parser();
+ try {
+ pa.load_from_file(dirname + "/Projects.list");
+ } catch (GLib.Error e) {
+ GLib.error("could not load json file %s", e.message);
+ }
+ var node = pa.get_root();
+ if (node == null || node.get_node_type () != Json.NodeType.OBJECT) {
+ GLib.error( dirname + "/Projects.list - invalid format?");
+
+ }
+
- var iter = projects.map_iterator();
- while (iter.next()) {
- if (iter.get_value().fn == fn) {
- return iter.get_value();
+ var obj = node.get_object ();
+ obj.foreach_member((sobj, key, val) => {
+ GLib.debug("read ProjectList %s: %s", key, val.get_string());
+ // facotry adds project!
+ try {
+ Project.factory(val.get_string(), key );
+ } catch (GLib.Error e ) {
+ GLib.debug("error createing project %s", e.message);
}
-
- }
+
+ });
- return null;
}
// load project data from project file.
- public static void factoryFromFile(string jsonfile)
+ public static void factoryFromFileOld(string jsonfile)
{
GLib.debug("parse %s", jsonfile);
}
});
+
+ if (fpath.length < 0 || !FileUtils.test(fpath,FileTest.IS_DIR)) {
+ return;
+ }
+
Project proj;
try {
proj = factory(xtype, fpath);
return;
}
- proj.json_project_data = obj; // store the original object...
+ //proj.json_project_data = obj; // store the original object...
- proj.fn = Path.get_basename(jsonfile).split(".")[0];
+ //proj.fn = Path.get_basename(jsonfile).split(".")[0];
+ proj.loadJson(obj);
// might not exist?
-
- if (obj.has_member("runhtml")) {
- proj.runhtml = obj.get_string_member("runhtml");
- }
- // might not exist?
- if (obj.has_member("base_template")) {
- proj.base_template = obj.get_string_member("base_template");
- }
- // might not exist?
- if (obj.has_member("rootURL")) {
- proj.rootURL = obj.get_string_member("rootURL");
- }
-
- if (obj.has_member("html_gen")) {
- proj.html_gen = obj.get_string_member("html_gen");
- }
-
+
proj.name = obj.get_string_member("name");
-
- paths.foreach_member((sobj, key, val) => {
- proj.paths.set(key, "dir");
- });
- proj.initRooDatabase();
-
- GLib.debug("Add Project %s", proj.id);
-
- projects.set(proj.id,proj);
+ // used to load paths..
+ //proj.initSubDirectories();
+
+ //proj.initDatabase();
+ GLib.debug("Add Project %s", proj.name);
+ projects.add(proj);
+
}
// check to see if it's already loaded..
-
- var iter = projects.map_iterator();
- while (iter.next()) {
- if (iter.get_value().hasPath( path)) {
- return iter.get_value();
+ foreach(var p in projects) {
+ if (p.path == path) {
+ return p;
}
}
-
+
switch(xtype) {
case "Gtk":
- return new Gtk(path);
+ var ret = new Gtk(path);
+ projects.add(ret);
+
+ return ret;
case "Roo":
- return new Roo(path);
+ var ret = new Roo(path);
+ projects.add(ret);
+
+ return ret;
//case "Flutter":
// return new Flutter(path);
}
}
-
- public static void remove(Project project)
- {
- // delete the file..
- var dirname = GLib.Environment.get_home_dir() + "/.Builder";
-
- FileUtils.unlink(dirname + "/" + project.fn + ".json");
- projects.unset(project.id,null);
-
-
- }
-
+
public void save()
{
// fixme..
- if (this.fn.length < 1) {
- // make the filename..
- //var t = new DateTime.now_local ();
- //TimeVal tv;
- //t.to_timeval(out tv);
- //var str = "%l:%l".printf(tv.tv_sec,tv.tv_usec);
- var str = this.firstPath();
-
- this.fn = GLib.Checksum.compute_for_string(GLib.ChecksumType.MD5, str, str.length);
- }
+
- var dirname = GLib.Environment.get_home_dir() + "/.Builder";
- var s = this.toJSON(false);
+
+
+ //var dirname = GLib.Environment.get_home_dir() + "/.Builder";
+
+ var s = this.toJSON();
+ GLib.debug("Save Project %s\n%s", this.name, s);
try {
- FileUtils.set_contents(dirname + "/" + this.fn + ".json", s, s.length);
+ //FileUtils.set_contents(dirname + "/" + this.fn + ".json", s, s.length);
+ FileUtils.set_contents(this.path + "/.roobuilder.jcfg", s, s.length);
} catch (GLib.Error e) {
GLib.error("failed to save file %s", e.message);
}
}
+
+
- public string toJSON(bool show_all)
+ public string toJSON( )
{
-
- this.json_project_data.set_string_member("name", this.name);
- this.json_project_data.set_string_member("fn", this.fn);
- this.json_project_data.set_string_member("xtype", this.xtype);
- this.json_project_data.set_string_member("runhtml", this.runhtml);
- this.json_project_data.set_string_member("rootURL", this.rootURL);
- this.json_project_data.set_string_member("base_template", this.base_template);
- this.json_project_data.set_string_member("rootURL", this.rootURL);
- this.json_project_data.set_string_member("html_gen", this.html_gen);
-
- var paths = new Json.Object();
-
-
- var iter = this.paths.map_iterator();
- while (iter.next()) {
- paths.set_string_member(iter.get_key(), "path");
- }
- this.json_project_data.set_object_member("paths", paths);
-
-
- if (show_all) {
- var files = new Json.Array();
-
-
- var fiter = this.files.map_iterator();
- while (fiter.next()) {
- files.add_string_element (fiter.get_key());
- }
- this.json_project_data.set_array_member("files", files);
-
- }
-
+ var obj = new Json.Object();
+ obj.set_string_member("xtype", this.xtype);
+
+
+ this.saveJson(obj);
var generator = new Json.Generator ();
var root = new Json.Node(Json.NodeType.OBJECT);
- root.init_object(this.json_project_data);
+ root.init_object(obj);
generator.set_root (root);
- if (show_all) {
+ //if (show_all) {
generator.pretty = true;
generator.indent = 4;
- }
+ //}
return generator.to_data (null);
}
+
+ // used to check what type a project might be..
+ // for 'new'
+ public static string peekProjectType(string fn)
+ {
+ var pa = new Json.Parser();
+ try {
+ pa.load_from_file(fn);
+ } catch (GLib.Error e) {
+ GLib.debug("could not load json file %s", e.message);
+ return "";
+
+ }
+ var node = pa.get_root();
+
+ if (node == null || node.get_node_type () != Json.NodeType.OBJECT) {
+ GLib.debug("SKIP %s/.roobuilder.jcfg - invalid format?",fn);
+ return "";
+ }
+
+ var obj = node.get_object ();
+
+ var xtype = obj.get_string_member("xtype");
+ return xtype == null ? "" : xtype;
+
+ }
+
+
+ // this will do a full scan - should only be done on viewing project..
+ // not initial load.. - may take time.
+
+ public void load()
+ {
+ if (this.is_scanned) {
+ return;
+ }
+ GLib.debug("load is_scanned = false");
+
+ if (FileUtils.test(this.path + "/.roobuilder.jcfg", FileTest.EXISTS)) {
+
+ var pa = new Json.Parser();
+ try {
+ pa.load_from_file(this.path + "/.roobuilder.jcfg");
+ } catch (GLib.Error e) {
+ GLib.error("could not load json file %s", e.message);
+ }
+ var node = pa.get_root();
+
+
+ if (node == null || node.get_node_type () != Json.NodeType.OBJECT) {
+ GLib.debug("SKIP %s/.roobuilder.jcfg - invalid format?",this.path);
+ return;
+ }
+
+ var obj = node.get_object ();
+
+ this.loadJson(obj);
+ }
+ // 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");
+
+ }
+
+ public abstract void loadJson(Json.Object obj);
+ public abstract void saveJson(Json.Object obj);
+
+ /*
+
public string firstPath()
{
var iter = this.paths.map_iterator();
return "";
}
+ */
public Gee.ArrayList<JsRender.JsRender> sortedFiles()
{
public string listAllFilesToString()
{
- this.scanDirs();
+
var iter = this.sortedFiles().list_iterator();
var ret = "ID\tName\tDirectory\n";
while (iter.next()) {
public JsRender.JsRender? getByName(string name)
{
-
- var fiter = files.map_iterator();
- while(fiter.next()) {
-
- var f = fiter.get_value();
-
-
- GLib.debug ("Project.getByName: %s ?= %s" ,f.name , name);
+ foreach(var f in this.files.values) {
if (f.name == name) {
return f;
}
};
return null;
}
+ // this get's a file using the full path ( replaces vala->bjs if they exist);
+
public JsRender.JsRender? getByPath(string path)
{
-
- var fiter = files.map_iterator();
- while(fiter.next()) {
-
- var f = fiter.get_value();
-
-
- //GLib.debug ("Project.getByName: %s ?= %s" ,f.name , name);
- if (f.path == path) {
+
+ // keys are not paths...
+ foreach(var f in this.files.values) {
+ if (f.path == path || f.targetName() == path) {
return f;
}
};
- return null;
+ return null;
}
public JsRender.JsRender? getById(string id)
{
-
- var fiter = files.map_iterator();
- while(fiter.next()) {
-
- var f = fiter.get_value();
-
-
- //console.log(f.id + '?=' + id);
+ foreach(var f in this.files.values) {
if (f.id == id) {
return f;
}
- };
+ };
return null;
}
-
- public JsRender.JsRender newFile (string name)
+
+ // name should include extension.
+ /*
+ public JsRender.JsRender? newFile (string xtype, string sub_dir, string name)
{
try {
- var ret = JsRender.JsRender.factory(this.xtype,
+ var fp = this.path + (sub_dir.length > 0 ? "/" : "") + sub_dir;
+ if (this.files.has_key(fp + "/" + name)) {
+ return null;
+ }
+
+
+ var ret = JsRender.JsRender.factory(xtype,
this,
- this.firstPath() + "/" + name + ".bjs");
- this.addFile(ret);
+ fp + "/" + name
+ );
+ this.files.set(fp + "/" + name , ret);
return ret;
} catch (JsRender.Error e) {
GLib.error("failed to create file %s", e.message);
}
}
-
+ */
+
public JsRender.JsRender loadFileOnly (string path)
{
var xt = this.xtype;
}
+ /*
public JsRender.JsRender create(string filename)
{
var ret = this.loadFileOnly(filename);
return ret;
}
-
-
- public void addFile(JsRender.JsRender pfile) { // add a single file, and trigger changed.
-
-
- this.files.set(pfile.path, pfile); // duplicate check?
- this.on_changed();
- }
-
- public void add(string path, string type)
+ */
+ private void loadSubDirectories(string subdir, int dp)
{
- this.paths.set(path,type);
- //Seed.print(" type is '" + type + "'");
- if (type == "dir") {
- this.scanDir(path);
- // console.dump(this.files);
+ //dp = dp || 0;
+ //print("Project.Base: Running scandir on " + dir +"\n");
+ if (dp > 5) { // no more than 5 deep?
+ return;
}
- if (type == "file" ) {
-
- this.files.set(path,this.loadFileOnly( path ));
+ if (subdir == "build") { // cmake!
+ return;
}
- this.on_changed();
- }
-
- public void scanDirs() // cached version
- {
- // -- why cache this - is it that slow?
- //if (this.is_scanned) {
- // return;
- //}
- this.scanDirsForce();
- //console.dump(this.files);
-
- }
-
- public void scanDirsForce()
- {
- this.is_scanned = true;
- var iter = this.paths.map_iterator();
- while (iter.next()) {
- //print("path: " + iter.get_key() + " : " + iter.get_value() +"\n");
- if (iter.get_value() != "dir") {
- continue;
- }
- this.scanDir(iter.get_key());
+ if (subdir == "autom4te.cache") { // automake?
+ return;
}
- //console.dump(this.files);
-
- }
- // list files.
- public void scanDir(string dir, int dp =0 )
- {
- //dp = dp || 0;
- //print("Project.Base: Running scandir on " + dir +"\n");
- if (dp > 5) { // no more than 5 deep?
+ if (subdir == "debian") { // debian!?
return;
}
+
+
+ var dir = this.path + (subdir.length > 0 ? "/" : "") + subdir;
+
+
+ GLib.debug("Project %s Scan Dir: %s", this.name, dir);
+ var jsDir = new JsRender.Dir(this, dir);
+ this.sub_paths.add(jsDir); // might be ''...
+
+
// this should be done async -- but since we are getting the proto up ...
var other_files = new Gee.ArrayList<string>();
var bjs_files = new Gee.ArrayList<string>();
+ var vala_files = new Gee.ArrayList<string>();
+ var subs = new Gee.ArrayList<string>();
+
- var subs = new GLib.List<string>();;
var f = File.new_for_path(dir);
try {
var file_enum = f.enumerate_children(GLib.FileAttribute.STANDARD_DISPLAY_NAME, GLib.FileQueryInfoFlags.NONE, null);
}
if (FileUtils.test(dir + "/" + fn, GLib.FileTest.IS_DIR)) {
- subs.append(dir + "/" + fn);
+ subs.add(dir + "/" + fn);
continue;
}
+ if (Regex.match_simple("\\.(o|cache|gif|jpg|png|gif|out|stamp|~)$", fn)) { // object..
+ continue;
+ }
+ if (Regex.match_simple("^(config1.builder|a.out|stamp-h1|depcomp|config.log|config.status)$", fn)) { // object..
+ continue;
+ }
+
+ if (Regex.match_simple("\\.vala$", fn)) {
+ vala_files.add(fn);
+ other_files.add(fn);
+ //print("no a bjs\n");
+ continue;
+ }
if (!Regex.match_simple("\\.bjs$", fn)) {
other_files.add(fn);
//print("no a bjs\n");
var xt = this.xtype;
var el = JsRender.JsRender.factory(xt,this, dir + "/" + fn);
this.files.set( dir + "/" + fn, el);
+ jsDir.childfiles.append(el);
+
// parent ??
GLib.warning("Project::scanDirs failed : " + e.message + "\n");
} catch (GLib.Error e) {
GLib.warning("Project::scanDirs failed : " + e.message + "\n");
- }
+ }
+
foreach(var fn in other_files) {
var dpos = fn.last_index_of(".");
var without_ext = fn.substring(0, dpos);
- if (bjs_files.contains(without_ext)) {
+ if (bjs_files.contains(without_ext)) { // will remove vala and c.
+ continue;
+ }
+ // c with a vala - skip
+ if (Regex.match_simple("\\.c$", fn) && vala_files.contains(without_ext + ".vala")) {
continue;
}
- GLib.debug("Could have added %s/%s", dir, fn);
- //var el = JsRender.JsRender.factory("plain",this, dir + "/" + fn);
- //this.files.set( dir + "/" + fn, el);
+ // Makefile (only allow am files at present.
+ if (without_ext == "Makefile") {
+ if (!Regex.match_simple("\\.am$", fn)) {
+ continue;
+ }
+ }
+ if (without_ext == "configure") {
+ if (!Regex.match_simple("\\.ac$", fn)) {
+ continue;
+ }
+ }
+
+
+
+
+
+ //GLib.debug("Could have added %s/%s", dir, fn);
+ try {
+ var el = JsRender.JsRender.factory("PlainFile",this, dir + "/" + fn);
+ this.files.set( dir + "/" + fn, el);
+ jsDir.childfiles.append(el);
+ } catch (JsRender.Error e) {
+ GLib.warning("Project::scanDirs failed : " + e.message + "\n");
+ }
}
- for (var i = 0; i < subs.length(); i++) {
- this.scanDir(subs.nth_data(i), dp+1);
+ foreach (var sd in subs) {
+ this.loadSubDirectories(sd.substring(this.path.length+1), dp+1);
}
+
}
- // wrapper around the javascript data...
- public string get_string_member(string key) {
+
+ // calle dfrom new file dialog
+ // add files to dires
+ // update
- if (!this.json_project_data.has_member(key)) {
- return "";
+
+ public void addFile(JsRender.JsRender pfile)
+ { // add a single file, and trigger changed.
+
+ if (pfile.xtype == "Gtk" || pfile.xtype == "Roo" ) {
+ this.files.set(pfile.path, pfile); // duplicate check
+
+ if (pfile.xtype == "Gtk" && pfile.build_module != "") {
+
+ var gfile = (JsRender.Gtk) pfile;
+ gfile.updateCompileGroup("", pfile.build_module);
+
+ }
}
- var ret = this.json_project_data.get_string_member(key);
- if (ret == null) {
- return "";
+ var sp = this.findDir(pfile.dir);
+ sp.childfiles.append(pfile);
+
+
+ this.on_changed();
+ }
+
+
+
+ public void deleteFile(JsRender.JsRender file)
+ {
+ if (file.xtype =="Dir") {
+ return;
+ }
+ var sp = this.findDir(file.dir);
+ for(var i =0;i < sp.childfiles.n_items; i++) {
+ var jf = (JsRender.JsRender) sp.childfiles.get_item(i);
+ if (jf.path == file.path) {
+ sp.childfiles.remove(i);
+ break;
+ }
+ }
+ if (this.files.has_key(file.path)) {
+ this.files.unset(file.path);
+ }
+
+
+ file.remove();
+ // remove it from
+
+
+ }
+
+ // but do not add it to our list.!!!
+ public void makeProjectSubdir(string name)
+ {
+ var dir = File.new_for_path(this.path + "/" + name);
+ if (FileUtils.test(this.path + "/" + name, FileTest.EXISTS)) {
+ return;
+ }
+ try {
+
+ dir.make_directory();
+ } catch (GLib.Error e) {
+ GLib.error("Failed to make directory %s", this.path + "/" + name);
+ }
+ }
+
+ public void createDir(string subdir) // add a single dir, and trigger changed.
+ {
+ if (subdir.strip() == "" || this.subpathsContains(subdir)) {
+ return;
+ }
+ var dir= File.new_for_path(this.path + "/" + subdir);
+
+ if (!dir.query_exists()) {
+
+ try {
+
+ dir.make_directory();
+ } catch (GLib.Error e) {
+ GLib.error("Failed to make directory %s", this.path + "/" + name);
+ }
+
+ }
+ this.sub_paths.add(new JsRender.Dir(this,this.path + "/" + subdir));
+ this.on_changed(); // not sure if it's needed - adding a dir doesnt really change much.
+ }
+
+ // this store is used in the icon view ?? do we need to store and update it?
+ public void loadFilesIntoStore(GLib.ListStore ls)
+ {
+ ls.remove_all();
+ //GLib.debug("Load files (into grid) %s", this.name);
+ foreach(var f in this.files.values) {
+ // GLib.debug("Add file %s", f.name);
+ if (f.xtype == "PlainFile") {
+ continue;
+ }
+ ls.append(f);
+ }
+
+ }
+ public void loadDirsIntoStore(GLib.ListStore ls)
+ {
+ ls.remove_all();
+ foreach(var f in this.sub_paths) {
+ //GLib.debug("Add %s", f.name);
+ ls.append(f);
+ }
+ ;
+ }
+
+ public bool subpathsContains(string subpath)
+ {
+ foreach(var sp in this.sub_paths) {
+
+ if (sp.path == this.path + "/" + subpath) {
+ return true;
+ }
+ }
+ return false;
+
+ }
+ public void loadDirsToStringList( global::Gtk.StringList sl)
+ {
+
+ while (sl.get_n_items() > 0) {
+ sl.remove(0);
+ }
+
+ foreach(var sp in this.sub_paths) {
+
+ sl.append( sp.path == this.path ? "/" : sp.path.substring(this.path.length));
+ }
+
+ }
+
+ public JsRender.Dir? findDir(string path) {
+
+ foreach(var jdir in this.sub_paths) {
+ if (path == jdir.path) {
+ return (JsRender.Dir)jdir;
+ }
+ }
+ return null;
+ }
+
+ public string[] pathsMatching(string name, bool full_path)
+ {
+ string[] ret = {};
+
+ foreach(var jdir in this.sub_paths) {
+
+
+
+ if (Path.get_basename (jdir.path) == name) {
+ GLib.debug("pathsMatching %s\n", jdir.path);
+ ret += full_path ? jdir.path : jdir.relpath;
+ }
+
}
return ret;
}
+ public Gee.ArrayList<string> readArray(Json.Array ar)
+ {
+ var ret = new Gee.ArrayList<string>();
+ for(var i =0; i< ar.get_length(); i++) {
+ var add = ar.get_string_element(i);
+ if (ret.contains(add)) {
+ continue;
+ }
+
+ ret.add(add);
+ }
+ return ret;
+ }
+
+
+ public abstract void initDatabase();
+ public abstract void initialize(); // for new projects (make dirs?);
}
}
-static int rid = 1;
+
public class Project.Roo : Project {
-
+ public Palete.RooDatabase roo_database;
+ public string runhtml = "";
+ public string base_template = "";
+ public string rootURL = "";
+ public string html_gen = "";
+ public string DBTYPE = "";
+ public string DBNAME = "";
+ public string DBUSERNAME = ""; // should be stored in settings somehwere - not in roo file!
+ public string DBPASSWORD = "";
public Roo(string path) {
this.palete = new Palete.Roo(this);
this.xtype = "Roo";
// various loader methods..
- this.id = "project-roo-%d".printf(rid++);
+ //this.id = "project-roo-%d".printf(rid++);
+ this.initDatabase();
}
+ public override void initDatabase()
+ {
+ this.roo_database = new Palete.RooDatabase.from_project(this);
+ }
+ public override void loadJson(Json.Object obj)
+ {
+ // might not exist?
+
+ if (obj.has_member("runhtml")) {
+ this.runhtml = obj.get_string_member("runhtml");
+ }
+ // might not exist?
+ if (obj.has_member("base_template")) {
+ this.base_template = obj.get_string_member("base_template");
+ }
+ // might not exist?
+ if (obj.has_member("rootURL")) {
+ this.rootURL = obj.get_string_member("rootURL");
+ }
+
+ if (obj.has_member("html_gen")) {
+ this.html_gen = obj.get_string_member("html_gen");
+ }
+ if (obj.has_member("DBTYPE")) {
+ this.DBTYPE = obj.get_string_member("DBTYPE");
+ }
+
+ if (obj.has_member("DBNAME")) {
+ this.DBNAME = obj.get_string_member("DBNAME");
+ }
+ //if (obj.has_member("DBUSERNAME")) {
+ // this.DBUSERNAME = obj.get_string_member("DBUSERNAME");
+ //}
+ //if (obj.has_member("DBPASSWORD")) {
+ // this.DBPASSWORD = obj.get_string_member("DBPASSWORD");
+ //}
+
+ }
+ public override void saveJson(Json.Object obj)
+ {
+ //obj.set_string_member("fn", this.fn);
+
+ obj.set_string_member("runhtml", this.runhtml);
+ obj.set_string_member("rootURL", this.rootURL);
+ obj.set_string_member("base_template", this.base_template);
+ obj.set_string_member("rootURL", this.rootURL);
+ obj.set_string_member("html_gen", this.html_gen);
+ obj.set_string_member("DBTYPE", this.DBTYPE);
+ obj.set_string_member("DBNAME", this.DBNAME);
+ //obj.set_string_member("DBUSERNAME", this.DBUSERNAME);
+ //obj.set_string_member("DBPASSWORD", this.DBPASSWORD);
+ }
+
+ public override void initialize() {
+ // ?? what kind of files can we set up a project ?
+ }
+
+
}
\ No newline at end of file
--- /dev/null
+/**
+ Simple wrapper around selected vapi packages
+ for list store
+*/
+
+public class Project.VapiSelection : Object
+{
+ //Project project;
+ public string name { get; set; }
+ public string sortkey {
+ owned get {
+ return (this.vapi_list.contains(this.name)? "A" : "Z" ) + "-"+ this.name;
+ }
+ set {}
+
+ }
+ public bool selected {
+ get {
+ var res = this.vapi_list.contains(this.name);
+ GLib.debug("vapi %s = %s", this.name, res ? "X" : "");
+ return res;
+ }
+ set {
+ if (value) {
+ if (!vapi_list.contains(this.name)) {
+ GLib.debug("vapi set %s = X", this.name);
+ this.vapi_list.add(this.name);
+ this.sortkey = "";
+ if (this.btn != null) {
+ this.btn.active = true;
+ }
+
+ }
+ } else {
+ if (vapi_list.contains(this.name)) {
+ GLib.debug("vapi set %s = .", this.name);
+ this.vapi_list.remove(this.name);
+ if (this.btn != null) {
+ this.btn.active = false;
+ }
+ this.sortkey = "";
+
+ }
+ }
+ }
+ }
+ Gee.ArrayList<string> vapi_list;
+ public global::Gtk.CheckButton? btn = null;
+
+ public VapiSelection( Gee.ArrayList<string> vapi_list, string name)
+ {
+ //this.project = project;
+ this.vapi_list = vapi_list;
+ this.name = name;
+ }
+}
\ No newline at end of file
var session = new Soup.Session ();
session.user_agent = "App Builder ";
var message = new Soup.Message ("GET", item.src );
- session.queue_message (message, (sess, mess) => {
+ session.send_and_read_async.begin( message, 0, null, (obj, res) => {
+ GLib.Bytes bytes;
+ try {
+ bytes = session.send_and_read_async.end(res);
+ } catch (GLib.Error e) {
+ GLib.debug("Failed to fetch stream %s" , e.message);
+ this.fetchNext();
+ return;
+ }
+
+
if (item.target.contains("*")) {
// then it's a directory listing in JSON, and we need to add any new items to our list..
// it's used to fetch Editors (and maybe other stuff..)
- this.parseDirectory((string) message.response_body.data,item.target );
+ this.parseDirectory( (string) bytes.get_data(),item.target );
this.fetchNext();
return;
}
}
-
-
// set data??? - if it's binary?
try {
- FileUtils.set_contents( tfn, (string) message.response_body.data );
+ FileUtils.set_contents( tfn, (string) bytes.get_data());
} catch(GLib.Error e) {
GLib.error("Problem writing data %s", e.message);
}
/**
* @property pid {Number} pid of child process (of false if it's not running)
*/
- int pid = -1;
+ public int pid {
+ get;
+ private set;
+ default = -1;
+ }
/**
* @property in_ch {GLib.IOChannel} input io channel
*/
GLib.debug("cd %s; %s" , this.cwd , string.joinv(" ", this.args));
+ var pid = -1;
if (this.detach) {
- Process.spawn_async_with_pipes (
+ //Process.spawn_async_with_pipes (
+ Process.spawn_async (
this.cwd,
this.args,
this.env.length > 0 ? this.env : null,
SpawnFlags.SEARCH_PATH | SpawnFlags.DO_NOT_REAP_CHILD,
null,
- out this.pid);
- ChildWatch.add (this.pid, (pid, status) => {
- // Triggered when the child indicated by child_pid exits
- Process.close_pid (pid);
-
- });
-
- return;
+ out pid);
+
+ this.pid = pid;
+
+ ChildWatch.add (this.pid, (pid, status) => {
+
+ Process.close_pid (pid);
+
+ });
+
+ return;
}
+
+
Process.spawn_async_with_pipes (
this.cwd,
this.args,
this.env.length > 0 ? this.env : null,
SpawnFlags.SEARCH_PATH | SpawnFlags.DO_NOT_REAP_CHILD,
null,
- out this.pid,
+ out pid,
out standard_input,
out standard_output,
out standard_error);
-
+ this.pid = pid;
// stdout:
this.out_src = (int) this.out_ch.add_watch (
IOCondition.OUT | IOCondition.IN | IOCondition.PRI | IOCondition.HUP | IOCondition.ERR ,
(channel, condition) => {
- return this.read(this.out_ch);
+ return this.out_ch == null ? true : this.read(this.out_ch);
}
);
this.err_src = (int) this.err_ch.add_watch (
IOCondition.OUT | IOCondition.IN | IOCondition.PRI | IOCondition.HUP | IOCondition.ERR ,
(channel, condition) => {
- return this.read(this.err_ch);
+ return this.err_ch == null ? true : this.read(this.err_ch);
}
);
- private void tidyup()
+ public void tidyup() // or kill
{
if (this.pid > -1) {
Process.close_pid(this.pid); // hopefully kills it..
this.err_ch = null;
this.out_ch = null;
// rmeove listeners !! important otherwise we kill the CPU
- //if (this.err_src > -1 ) GLib.source_remove(this.err_src);
- //if (this.out_src > -1 ) GLib.source_remove(this.out_src);
+ if (this.err_src > -1 ) GLib.Source.remove(this.err_src);
+ if (this.out_src > -1 ) GLib.Source.remove(this.out_src);
this.err_src = -1;
this.out_src = -1;
* @arg giochannel to read from.
* @returns none
*/
- private bool read(IOChannel ch)
- {
- // string prop = (ch == this.out_ch) ? "output" : "stderr";
- // print("prop: " + prop);
+ private bool read(IOChannel ch)
+ {
+ // string prop = (ch == this.out_ch) ? "output" : "stderr";
+ // print("prop: " + prop);
-
- //print(JSON.stringify(ch, null,4));
- while (true) {
- string buffer;
- size_t term_pos;
- size_t len;
- IOStatus status;
- try {
- status = ch.read_line( out buffer, out len, out term_pos );
- } catch (Error e) {
- //FIXme
- break; // ??
-
- }
+
+ //print(JSON.stringify(ch, null,4));
+ while (true) {
+ string buffer;
+ size_t term_pos;
+ size_t len;
+ IOStatus status;
+ try {
+ status = ch.read_line( out buffer, out len, out term_pos );
+ } catch (Error e) {
+ //FIXme
+ break; // ??
+
+ }
- // print('status: ' +JSON.stringify(status));
- // print(JSON.stringify(x));
- switch(status) {
- case GLib.IOStatus.NORMAL:
+ // print('status: ' +JSON.stringify(status));
+ // print(JSON.stringify(x));
+ switch(status) {
+ case GLib.IOStatus.NORMAL:
- //write(fn, x.str);
-
- //if (this.listeners[prop]) {
- // this.listeners[prop].call(this, x.str_return);
- //}
- if (ch == this.out_ch) {
- this.output += buffer;
- this.output_line( buffer);
-
- } else {
- this.stderr += buffer;
- this.output_line( buffer);
- }
- //_this[prop] += x.str_return;
- //if (this.cfg.debug) {
- //GLib.debug("%s : %s", prop , buffer);
- //}
- if (this.is_async) {
-
- //if ( Gtk.events_pending()) {
- // Gtk.main_iteration();
- //}
-
- }
-
- //this.ctx.iteration(true);
- continue;
- case GLib.IOStatus.AGAIN:
+ //write(fn, x.str);
+
+ //if (this.listeners[prop]) {
+ // this.listeners[prop].call(this, x.str_return);
+ //}
+ if (ch == this.out_ch) {
+ this.output += buffer;
+ this.output_line( buffer);
+
+ } else {
+ this.stderr += buffer;
+ this.output_line( buffer);
+ }
+ //_this[prop] += x.str_return;
+ //if (this.cfg.debug) {
+ //GLib.debug("%s : %s", prop , buffer);
+ //}
+ if (this.is_async) {
+
+ //if ( Gtk.events_pending()) {
+ // Gtk.main_iteration();
+ //}
+
+ }
+
+ //this.ctx.iteration(true);
+ continue;
+ case GLib.IOStatus.AGAIN:
//print("Should be called again.. waiting for more data..");
- return true;
- //break;
- case GLib.IOStatus.ERROR:
- case GLib.IOStatus.EOF:
- return false;
- //break;
-
- }
- break;
- }
-
- //print("RETURNING");
- return false; // allow it to be called again..
- }
+ return true;
+ //break;
+ case GLib.IOStatus.ERROR:
+ case GLib.IOStatus.EOF:
+ return false;
+ //break;
+
+ }
+ break;
+ }
+
+ //print("RETURNING");
+ return false; // allow it to be called again..
+ }
+ public bool isZombie()
+ {
+ if (!GLib.FileUtils.test("/proc/%d".printf(this.pid), FileTest.EXISTS)) {
+ return false;
+ }
+ size_t sz;
+ string f;
+ try {
+ if (!GLib.FileUtils.get_contents("/proc/%d/stat".printf(this.pid), out f, out sz)) {
+ return false;
+ }
+ } catch(GLib.Error e) {
+ return false;
+ }
+ var bits = f.split(" ");
+ if (bits.length > 3 && bits[2] == "Z") {
+ GLib.debug("Process pid:%d is a zombie - trying waitpid", this.pid);
+ int status;
+ Posix.waitpid(this.pid, out status, 0);
+ GLib.debug("Process pid:%d is a zombie - done waitpid", this.pid);
+ return true;
+ }
+ return false;
+
+
+
+
+ }
}
/*
-#include <JavaScriptCore/JavaScript.h>
+#include <jsc/jsc.h>
#include <glib.h>
#include <glib-object.h>
/**
--- /dev/null
+include $(top_srcdir)/Makefile.common
+
+NULL =
+
+AM_CPPFLAGS = \
+ -DG_LOG_DOMAIN=\"vala-ccode\" \
+ $(COVERAGE_CFLAGS) \
+ -I$(top_srcdir)/gee \
+ -I$(top_srcdir)/vala \
+ $(GLIB_CFLAGS) \
+ $(NULL)
+
+BUILT_SOURCES = ccode.vala.stamp
+
+noinst_LTLIBRARIES = \
+ libvalaccode.la \
+ $(NULL)
+
+libvalaccode_la_VALASOURCES = \
+ valaccode.vala \
+ valaccodeassignment.vala \
+ valaccodebinaryexpression.vala \
+ valaccodeblock.vala \
+ valaccodebreakstatement.vala \
+ valaccodecasestatement.vala \
+ valaccodecastexpression.vala \
+ valaccodecommaexpression.vala \
+ valaccodecomment.vala \
+ valaccodeconditionalexpression.vala \
+ valaccodeconstant.vala \
+ valaccodeconstantidentifier.vala \
+ valaccodecontinuestatement.vala \
+ valaccodedeclaration.vala \
+ valaccodedeclarator.vala \
+ valaccodedefine.vala \
+ valaccodedostatement.vala \
+ valaccodeemptystatement.vala \
+ valaccodeenum.vala \
+ valaccodeenumvalue.vala \
+ valaccodeexpression.vala \
+ valaccodeexpressionstatement.vala \
+ valaccodefile.vala \
+ valaccodeforstatement.vala \
+ valaccodefragment.vala \
+ valaccodefunction.vala \
+ valaccodefunctioncall.vala \
+ valaccodefunctiondeclarator.vala \
+ valaccodeggnucsection.vala \
+ valaccodegotostatement.vala \
+ valaccodeidentifier.vala \
+ valaccodeifstatement.vala \
+ valaccodeincludedirective.vala \
+ valaccodeinitializerlist.vala \
+ valaccodeinvalidexpression.vala \
+ valaccodelabel.vala \
+ valaccodelinedirective.vala \
+ valaccodeifsection.vala \
+ valaccodemacroreplacement.vala \
+ valaccodememberaccess.vala \
+ valaccodemodifiers.vala \
+ valaccodenewline.vala \
+ valaccodenode.vala \
+ valaccodeoncesection.vala \
+ valaccodeparameter.vala \
+ valaccodeparenthesizedexpression.vala \
+ valaccodereturnstatement.vala \
+ valaccodestatement.vala \
+ valaccodestruct.vala \
+ valaccodeswitchstatement.vala \
+ valaccodetypedefinition.vala \
+ valaccodeunaryexpression.vala \
+ valaccodevariabledeclarator.vala \
+ valaccodewhilestatement.vala \
+ valaccodewriter.vala \
+ valaccodeelementaccess.vala \
+ $(NULL)
+
+libvalaccode_la_SOURCES = \
+ ccode.vala.stamp \
+ $(libvalaccode_la_VALASOURCES:.vala=.c) \
+ $(NULL)
+
+ccode.vapi ccode.vala.stamp: $(libvalaccode_la_VALASOURCES)
+ $(VALA_V)$(VALAC) \
+ $(COVERAGE_VALAFLAGS) \
+ $(VALAFLAGS) \
+ -C \
+ --vapidir $(top_srcdir)/vapi --pkg gobject-2.0 \
+ --vapidir $(top_srcdir)/gee --pkg gee \
+ --vapidir $(top_srcdir)/vala --pkg vala \
+ --pkg config \
+ -H valaccode.h \
+ --library ccode \
+ $^
+ touch $@
+
+libvalaccode_la_LIBADD = \
+ $(COVERAGE_LIBS) \
+ $(GLIB_LIBS) \
+ $(top_builddir)/vala/libvala@PACKAGE_SUFFIX@.la \
+ $(NULL)
+
+EXTRA_DIST = $(libvalaccode_la_VALASOURCES) ccode.vapi ccode.vala.stamp valaccode.h
+
+MAINTAINERCLEANFILES = \
+ ccode.vapi \
+ valaccode.h \
+ $(libvalaccode_la_VALASOURCES:.vala=.c) \
+ $(NULL)
store_value (get_parameter_cvalue (param), value, source_reference);
}
+<<<<<<< HEAD
public override void store_field (Vala.Field field, Vala.TargetValue? instance, Vala.TargetValue value, Vala.SourceReference? source_reference = null, bool initializer = false)
{
+=======
+ public override void store_field (Vala.Field field, Vala.TargetValue? instance, Vala.TargetValue value, Vala.SourceReference? source_reference = null, bool initializer = false)
+ {
+>>>>>>> wip_alan_T7440_handling_gtk4_and_bad_girs
var lvalue = get_field_cvalue (field, instance);
var type = lvalue.value_type;
if (lvalue.actual_value_type != null) {
type = lvalue.actual_value_type;
}
- if ((!(field.variable_type is DelegateType) || get_ccode_delegate_target (field)) && requires_destroy (type)) {
+ if (!initializer && (!(field.variable_type is DelegateType) || get_ccode_delegate_target (field)) && requires_destroy (type)) {
/* unref old value */
ccode.add_expression (destroy_field (field, instance));
}
+ if (initializer && instance != null && get_ccode_delegate_target (field) && get_delegate_target_cvalue (value) == null) {
+ unowned DelegateType delegate_type = field.variable_type as DelegateType;
+ if (delegate_type != null && delegate_type.delegate_symbol.has_target) {
+ ((GLibValue) value).delegate_target_cvalue = get_cvalue_ (instance);
+ }
+ }
store_value (lvalue, value, source_reference);
}
-}
+}
\ No newline at end of file
--- /dev/null
+gdk-pixbuf-2.0
+gio-2.0
+gtk4
+pango
+cairo
--- /dev/null
+/* gtksourceview-5.vapi generated by vapigen, do not modify. */
+
+[CCode (cprefix = "GtkSource", gir_namespace = "GtkSource", gir_version = "5", lower_case_cprefix = "gtk_source_")]
+namespace GtkSource {
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_buffer_get_type ()")]
+ public class Buffer : Gtk.TextBuffer {
+ [CCode (has_construct_function = false)]
+ public Buffer (Gtk.TextTagTable? table);
+ public bool backward_iter_to_source_mark (ref Gtk.TextIter iter, string? category);
+ public void change_case (GtkSource.ChangeCaseType case_type, Gtk.TextIter start, Gtk.TextIter end);
+ public unowned GtkSource.Mark create_source_mark (string? name, string category, Gtk.TextIter where);
+ public void ensure_highlight (Gtk.TextIter start, Gtk.TextIter end);
+ public bool forward_iter_to_source_mark (ref Gtk.TextIter iter, string? category);
+ [CCode (array_length = false, array_null_terminated = true)]
+ public string[] get_context_classes_at_iter (Gtk.TextIter iter);
+ public bool get_highlight_matching_brackets ();
+ public bool get_highlight_syntax ();
+ public bool get_implicit_trailing_newline ();
+ public unowned GtkSource.Language? get_language ();
+ public GLib.SList<weak GtkSource.Mark> get_source_marks_at_iter (Gtk.TextIter iter, string? category);
+ public GLib.SList<weak GtkSource.Mark> get_source_marks_at_line (int line, string? category);
+ public unowned GtkSource.StyleScheme? get_style_scheme ();
+ public bool iter_backward_to_context_class_toggle (ref Gtk.TextIter iter, string context_class);
+ public bool iter_forward_to_context_class_toggle (ref Gtk.TextIter iter, string context_class);
+ public bool iter_has_context_class (Gtk.TextIter iter, string context_class);
+ public void join_lines (Gtk.TextIter start, Gtk.TextIter end);
+ public void remove_source_marks (Gtk.TextIter start, Gtk.TextIter end, string? category);
+ public void set_highlight_matching_brackets (bool highlight);
+ public void set_highlight_syntax (bool highlight);
+ public void set_implicit_trailing_newline (bool implicit_trailing_newline);
+ public void set_language (GtkSource.Language? language);
+ public void set_style_scheme (GtkSource.StyleScheme? scheme);
+ public void sort_lines (Gtk.TextIter start, Gtk.TextIter end, GtkSource.SortFlags flags, int column);
+ [CCode (has_construct_function = false)]
+ public Buffer.with_language (GtkSource.Language language);
+ public bool highlight_matching_brackets { get; set; }
+ public bool highlight_syntax { get; set; }
+ public bool implicit_trailing_newline { get; set construct; }
+ public GtkSource.Language language { get; set; }
+ public GtkSource.StyleScheme style_scheme { get; set; }
+ public virtual signal void bracket_matched (Gtk.TextIter? iter, GtkSource.BracketMatchType state);
+ public signal void cursor_moved ();
+ public signal void highlight_updated (Gtk.TextIter start, Gtk.TextIter end);
+ public signal void source_mark_updated (Gtk.TextMark mark);
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_get_type ()")]
+ public class Completion : GLib.Object {
+ [CCode (has_construct_function = false)]
+ protected Completion ();
+ public void add_provider (GtkSource.CompletionProvider provider);
+ public void block_interactive ();
+ public static Pango.AttrList? fuzzy_highlight (string haystack, string casefold_query);
+ public static bool fuzzy_match (string? haystack, string casefold_needle, out uint priority);
+ public unowned GtkSource.Buffer get_buffer ();
+ public uint get_page_size ();
+ public unowned GtkSource.View get_view ();
+ public void remove_provider (GtkSource.CompletionProvider provider);
+ public void set_page_size (uint page_size);
+ public void unblock_interactive ();
+ public Gtk.TextView buffer { get; }
+ public uint page_size { get; set; }
+ [NoAccessorMethod]
+ public bool remember_info_visibility { get; set; }
+ [NoAccessorMethod]
+ public bool select_on_show { get; set; }
+ [NoAccessorMethod]
+ public bool show_icons { get; set; }
+ public GtkSource.View view { get; construct; }
+ [HasEmitter]
+ public signal void hide ();
+ public signal void provider_added (GtkSource.CompletionProvider provider);
+ public signal void provider_removed (GtkSource.CompletionProvider provider);
+ [HasEmitter]
+ public signal void show ();
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_cell_get_type ()")]
+ public class CompletionCell : Gtk.Widget, Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
+ [CCode (has_construct_function = false)]
+ protected CompletionCell ();
+ public GtkSource.CompletionColumn get_column ();
+ public unowned Gtk.Widget? get_widget ();
+ public void set_gicon (GLib.Icon gicon);
+ public void set_icon_name (string icon_name);
+ public void set_markup (string markup);
+ public void set_paintable (Gdk.Paintable paintable);
+ public void set_text (string? text);
+ public void set_text_with_attributes (string text, Pango.AttrList attrs);
+ public void set_widget (Gtk.Widget child);
+ public GtkSource.CompletionColumn column { get; construct; }
+ [NoAccessorMethod]
+ public string markup { owned get; set; }
+ [NoAccessorMethod]
+ public Gdk.Paintable paintable { owned get; set; }
+ [NoAccessorMethod]
+ public string text { owned get; set; }
+ public Gtk.Widget widget { get; set; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_context_get_type ()")]
+ public class CompletionContext : GLib.Object, GLib.ListModel {
+ [CCode (has_construct_function = false)]
+ protected CompletionContext ();
+ public GtkSource.CompletionActivation get_activation ();
+ public bool get_bounds (out Gtk.TextIter begin, out Gtk.TextIter end);
+ public unowned GtkSource.Buffer? get_buffer ();
+ public bool get_busy ();
+ public unowned GtkSource.Completion? get_completion ();
+ public bool get_empty ();
+ public unowned GtkSource.Language? get_language ();
+ [Version (since = "5.6")]
+ public unowned GLib.ListModel? get_proposals_for_provider (GtkSource.CompletionProvider provider);
+ public unowned GtkSource.View? get_view ();
+ public string get_word ();
+ [Version (since = "5.6")]
+ public GLib.ListModel list_providers ();
+ public void set_proposals_for_provider (GtkSource.CompletionProvider provider, GLib.ListModel? results);
+ public bool busy { get; }
+ public GtkSource.Completion completion { get; construct; }
+ public bool empty { get; }
+ [Version (since = "5.6")]
+ public signal void provider_model_changed (GtkSource.CompletionProvider provider, GLib.ListModel? model);
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_snippets_get_type ()")]
+ public class CompletionSnippets : GLib.Object, GtkSource.CompletionProvider {
+ [CCode (has_construct_function = false)]
+ public CompletionSnippets ();
+ [NoAccessorMethod]
+ public int priority { get; set construct; }
+ [NoAccessorMethod]
+ public string title { owned get; set construct; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_words_get_type ()")]
+ public class CompletionWords : GLib.Object, GtkSource.CompletionProvider {
+ [CCode (has_construct_function = false)]
+ public CompletionWords (string? title);
+ public void register (Gtk.TextBuffer buffer);
+ public void unregister (Gtk.TextBuffer buffer);
+ [NoAccessorMethod]
+ public uint minimum_word_size { get; set construct; }
+ [NoAccessorMethod]
+ public int priority { get; set construct; }
+ [NoAccessorMethod]
+ public uint proposals_batch_size { get; set construct; }
+ [NoAccessorMethod]
+ public uint scan_batch_size { get; set construct; }
+ [NoAccessorMethod]
+ public string title { owned get; set construct; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "gtk_source_encoding_get_type ()")]
+ [Compact]
+ public class Encoding {
+ public GtkSource.Encoding copy ();
+ public void free ();
+ public static GLib.SList<weak GtkSource.Encoding> get_all ();
+ public unowned string get_charset ();
+ public static unowned GtkSource.Encoding get_current ();
+ public static GLib.SList<weak GtkSource.Encoding> get_default_candidates ();
+ public static unowned GtkSource.Encoding? get_from_charset (string charset);
+ public unowned string get_name ();
+ public static unowned GtkSource.Encoding get_utf8 ();
+ public string to_string ();
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_file_get_type ()")]
+ public class File : GLib.Object {
+ [CCode (has_construct_function = false)]
+ public File ();
+ public void check_file_on_disk ();
+ public GtkSource.CompressionType get_compression_type ();
+ public unowned GtkSource.Encoding get_encoding ();
+ public unowned GLib.File get_location ();
+ public GtkSource.NewlineType get_newline_type ();
+ public bool is_deleted ();
+ public bool is_externally_modified ();
+ public bool is_local ();
+ public bool is_readonly ();
+ public void set_location (GLib.File? location);
+ public GtkSource.CompressionType compression_type { get; }
+ public GtkSource.Encoding encoding { get; }
+ public GLib.File location { get; set construct; }
+ public GtkSource.NewlineType newline_type { get; }
+ [NoAccessorMethod]
+ public bool read_only { get; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_file_loader_get_type ()")]
+ public class FileLoader : GLib.Object {
+ [CCode (has_construct_function = false)]
+ public FileLoader (GtkSource.Buffer buffer, GtkSource.File file);
+ [CCode (has_construct_function = false)]
+ public FileLoader.from_stream (GtkSource.Buffer buffer, GtkSource.File file, GLib.InputStream stream);
+ public unowned GtkSource.Buffer get_buffer ();
+ public GtkSource.CompressionType get_compression_type ();
+ public unowned GtkSource.Encoding get_encoding ();
+ public unowned GtkSource.File get_file ();
+ public unowned GLib.InputStream? get_input_stream ();
+ public unowned GLib.File? get_location ();
+ public GtkSource.NewlineType get_newline_type ();
+ public async bool load_async (int io_priority, GLib.Cancellable? cancellable, owned GLib.FileProgressCallback? progress_callback) throws GLib.Error;
+ public void set_candidate_encodings (GLib.SList<GtkSource.Encoding> candidate_encodings);
+ public GtkSource.Buffer buffer { get; construct; }
+ public GtkSource.File file { get; construct; }
+ public GLib.InputStream input_stream { get; construct; }
+ public GLib.File location { get; construct; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_file_saver_get_type ()")]
+ public class FileSaver : GLib.Object {
+ [CCode (has_construct_function = false)]
+ public FileSaver (GtkSource.Buffer buffer, GtkSource.File file);
+ public unowned GtkSource.Buffer get_buffer ();
+ public GtkSource.CompressionType get_compression_type ();
+ public unowned GtkSource.Encoding get_encoding ();
+ public unowned GtkSource.File get_file ();
+ public GtkSource.FileSaverFlags get_flags ();
+ public unowned GLib.File get_location ();
+ public GtkSource.NewlineType get_newline_type ();
+ public async bool save_async (int io_priority, GLib.Cancellable? cancellable, owned GLib.FileProgressCallback? progress_callback) throws GLib.Error;
+ public void set_compression_type (GtkSource.CompressionType compression_type);
+ public void set_encoding (GtkSource.Encoding? encoding);
+ public void set_flags (GtkSource.FileSaverFlags flags);
+ public void set_newline_type (GtkSource.NewlineType newline_type);
+ [CCode (has_construct_function = false)]
+ public FileSaver.with_target (GtkSource.Buffer buffer, GtkSource.File file, GLib.File target_location);
+ public GtkSource.Buffer buffer { get; construct; }
+ public GtkSource.CompressionType compression_type { get; set construct; }
+ public GtkSource.Encoding encoding { get; set construct; }
+ public GtkSource.File file { get; construct; }
+ public GtkSource.FileSaverFlags flags { get; set construct; }
+ public GLib.File location { get; construct; }
+ public GtkSource.NewlineType newline_type { get; set construct; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_gutter_get_type ()")]
+ public class Gutter : Gtk.Widget, Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
+ [CCode (has_construct_function = false)]
+ protected Gutter ();
+ public unowned GtkSource.View get_view ();
+ public bool insert (GtkSource.GutterRenderer renderer, int position);
+ public void remove (GtkSource.GutterRenderer renderer);
+ public void reorder (GtkSource.GutterRenderer renderer, int position);
+ public GtkSource.View view { get; construct; }
+ [NoAccessorMethod]
+ public Gtk.TextWindowType window_type { get; construct; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_gutter_lines_get_type ()")]
+ public class GutterLines : GLib.Object {
+ [CCode (has_construct_function = false)]
+ protected GutterLines ();
+ public void add_class (uint line, string name);
+ public void add_qclass (uint line, GLib.Quark qname);
+ public unowned Gtk.TextBuffer get_buffer ();
+ public uint get_first ();
+ public void get_iter_at_line (out Gtk.TextIter iter, uint line);
+ public uint get_last ();
+ public void get_line_yrange (uint line, GtkSource.GutterRendererAlignmentMode mode, out int y, out int height);
+ public unowned Gtk.TextView get_view ();
+ [Version (since = "5.6")]
+ public bool has_any_class (uint line);
+ public bool has_class (uint line, string name);
+ public bool has_qclass (uint line, GLib.Quark qname);
+ public bool is_cursor (uint line);
+ public bool is_prelit (uint line);
+ public bool is_selected (uint line);
+ public void remove_class (uint line, string name);
+ public void remove_qclass (uint line, GLib.Quark qname);
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_gutter_renderer_get_type ()")]
+ public abstract class GutterRenderer : Gtk.Widget, Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
+ [CCode (has_construct_function = false)]
+ protected GutterRenderer ();
+ public void align_cell (uint line, float width, float height, out float x, out float y);
+ [NoWrapper]
+ public virtual void begin (GtkSource.GutterLines lines);
+ [NoWrapper]
+ public virtual void change_buffer (GtkSource.Buffer? old_buffer);
+ [NoWrapper]
+ public virtual void change_view (GtkSource.View? old_view);
+ [NoWrapper]
+ public virtual void end ();
+ public GtkSource.GutterRendererAlignmentMode get_alignment_mode ();
+ public unowned GtkSource.Buffer? get_buffer ();
+ public unowned GtkSource.View get_view ();
+ public float get_xalign ();
+ public int get_xpad ();
+ public float get_yalign ();
+ public int get_ypad ();
+ public void set_alignment_mode (GtkSource.GutterRendererAlignmentMode mode);
+ public void set_xalign (float xalign);
+ public void set_xpad (int xpad);
+ public void set_yalign (float yalign);
+ public void set_ypad (int ypad);
+ [NoWrapper]
+ public virtual void snapshot_line (Gtk.Snapshot snapshot, GtkSource.GutterLines lines, uint line);
+ public GtkSource.GutterRendererAlignmentMode alignment_mode { get; set; }
+ [NoAccessorMethod]
+ public GtkSource.GutterLines lines { owned get; }
+ public Gtk.TextView view { get; }
+ public float xalign { get; set; }
+ public int xpad { get; set; }
+ public float yalign { get; set; }
+ public int ypad { get; set; }
+ [HasEmitter]
+ public virtual signal void activate (Gtk.TextIter iter, Gdk.Rectangle area, uint button, Gdk.ModifierType state, int n_presses);
+ [HasEmitter]
+ public virtual signal bool query_activatable (Gtk.TextIter iter, Gdk.Rectangle area);
+ public virtual signal void query_data (GLib.Object lines, uint line);
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_gutter_renderer_pixbuf_get_type ()")]
+ public class GutterRendererPixbuf : GtkSource.GutterRenderer, Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
+ [CCode (has_construct_function = false, type = "GtkSourceGutterRenderer*")]
+ public GutterRendererPixbuf ();
+ public unowned GLib.Icon get_gicon ();
+ public unowned string get_icon_name ();
+ public unowned Gdk.Paintable? get_paintable ();
+ public unowned Gdk.Pixbuf get_pixbuf ();
+ public void overlay_paintable (Gdk.Paintable paintable);
+ public void set_gicon (GLib.Icon? icon);
+ public void set_icon_name (string? icon_name);
+ public void set_paintable (Gdk.Paintable? paintable);
+ public void set_pixbuf (Gdk.Pixbuf? pixbuf);
+ public GLib.Icon gicon { get; set; }
+ public string icon_name { get; set; }
+ public Gdk.Paintable paintable { get; set; }
+ public Gdk.Pixbuf pixbuf { get; set; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_gutter_renderer_text_get_type ()")]
+ public class GutterRendererText : GtkSource.GutterRenderer, Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
+ [CCode (has_construct_function = false, type = "GtkSourceGutterRenderer*")]
+ public GutterRendererText ();
+ public void measure (string text, out int width, out int height);
+ public void measure_markup (string markup, out int width, out int height);
+ public void set_markup (string markup, int length);
+ public void set_text (string text, int length);
+ [NoAccessorMethod]
+ public string markup { owned get; set construct; }
+ [NoAccessorMethod]
+ public string text { owned get; set construct; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_hover_get_type ()")]
+ public class Hover : GLib.Object {
+ [CCode (has_construct_function = false)]
+ protected Hover ();
+ public void add_provider (GtkSource.HoverProvider provider);
+ public void remove_provider (GtkSource.HoverProvider provider);
+ [NoAccessorMethod]
+ public uint hover_delay { get; set; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_hover_context_get_type ()")]
+ public class HoverContext : GLib.Object {
+ [CCode (has_construct_function = false)]
+ protected HoverContext ();
+ public bool get_bounds (out Gtk.TextIter begin, out Gtk.TextIter end);
+ public unowned GtkSource.Buffer get_buffer ();
+ public bool get_iter (Gtk.TextIter iter);
+ public unowned GtkSource.View get_view ();
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_hover_display_get_type ()")]
+ public class HoverDisplay : Gtk.Widget, Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
+ [CCode (has_construct_function = false)]
+ protected HoverDisplay ();
+ public void append (Gtk.Widget child);
+ public void insert_after (Gtk.Widget child, Gtk.Widget sibling);
+ public void prepend (Gtk.Widget child);
+ public void remove (Gtk.Widget child);
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_language_get_type ()")]
+ public class Language : GLib.Object {
+ [CCode (has_construct_function = false)]
+ protected Language ();
+ [CCode (array_length = false, array_null_terminated = true)]
+ public string[]? get_globs ();
+ public bool get_hidden ();
+ public unowned string get_id ();
+ public unowned string? get_metadata (string name);
+ [CCode (array_length = false, array_null_terminated = true)]
+ public string[]? get_mime_types ();
+ public unowned string get_name ();
+ public unowned string get_section ();
+ public unowned string? get_style_fallback (string style_id);
+ [CCode (array_length = false, array_null_terminated = true)]
+ public string[]? get_style_ids ();
+ public unowned string? get_style_name (string style_id);
+ public bool hidden { get; }
+ public string id { get; }
+ public string name { get; }
+ public string section { get; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_language_manager_get_type ()")]
+ public class LanguageManager : GLib.Object {
+ [CCode (has_construct_function = false)]
+ public LanguageManager ();
+ [Version (since = "5.4")]
+ public void append_search_path (string path);
+ public static unowned GtkSource.LanguageManager get_default ();
+ public unowned GtkSource.Language? get_language (string id);
+ [CCode (array_length = false, array_null_terminated = true)]
+ public unowned string[]? get_language_ids ();
+ [CCode (array_length = false, array_null_terminated = true)]
+ public unowned string[] get_search_path ();
+ public unowned GtkSource.Language? guess_language (string? filename, string? content_type);
+ [Version (since = "5.4")]
+ public void prepend_search_path (string path);
+ public void set_search_path ([CCode (array_length = false, array_null_terminated = true)] string[]? dirs);
+ [CCode (array_length = false, array_null_terminated = true)]
+ public string[] language_ids { get; }
+ [CCode (array_length = false, array_null_terminated = true)]
+ public string[] search_path { get; set; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_map_get_type ()")]
+ public class Map : GtkSource.View, Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Scrollable {
+ [CCode (has_construct_function = false, type = "GtkWidget*")]
+ public Map ();
+ public unowned GtkSource.View? get_view ();
+ public void set_view (GtkSource.View view);
+ [NoAccessorMethod]
+ public Pango.FontDescription font_desc { owned get; set; }
+ public GtkSource.View view { get; set; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_mark_get_type ()")]
+ public class Mark : Gtk.TextMark {
+ [CCode (has_construct_function = false)]
+ public Mark (string? name, string category);
+ public unowned string get_category ();
+ public unowned GtkSource.Mark? next (string? category);
+ public unowned GtkSource.Mark? prev (string category);
+ public string category { get; construct; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_mark_attributes_get_type ()")]
+ public class MarkAttributes : GLib.Object {
+ [CCode (has_construct_function = false)]
+ public MarkAttributes ();
+ public bool get_background (out Gdk.RGBA background);
+ public unowned GLib.Icon get_gicon ();
+ public unowned string get_icon_name ();
+ public unowned Gdk.Pixbuf get_pixbuf ();
+ public string get_tooltip_markup (GtkSource.Mark mark);
+ public string get_tooltip_text (GtkSource.Mark mark);
+ public unowned Gdk.Paintable render_icon (Gtk.Widget widget, int size);
+ public void set_background (Gdk.RGBA background);
+ public void set_gicon (GLib.Icon gicon);
+ public void set_icon_name (string icon_name);
+ public void set_pixbuf (Gdk.Pixbuf pixbuf);
+ [NoAccessorMethod]
+ public Gdk.RGBA background { owned get; set; }
+ public GLib.Icon gicon { get; set; }
+ public string icon_name { get; set; }
+ public Gdk.Pixbuf pixbuf { get; set; }
+ public signal string query_tooltip_markup (GtkSource.Mark mark);
+ public signal string query_tooltip_text (GtkSource.Mark mark);
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_print_compositor_get_type ()")]
+ public class PrintCompositor : GLib.Object {
+ [CCode (has_construct_function = false)]
+ public PrintCompositor (GtkSource.Buffer buffer);
+ public void draw_page (Gtk.PrintContext context, int page_nr);
+ [CCode (has_construct_function = false)]
+ public PrintCompositor.from_view (GtkSource.View view);
+ public string get_body_font_name ();
+ public double get_bottom_margin (Gtk.Unit unit);
+ public unowned GtkSource.Buffer get_buffer ();
+ public string get_footer_font_name ();
+ public string get_header_font_name ();
+ public bool get_highlight_syntax ();
+ public double get_left_margin (Gtk.Unit unit);
+ public string get_line_numbers_font_name ();
+ public int get_n_pages ();
+ public double get_pagination_progress ();
+ public bool get_print_footer ();
+ public bool get_print_header ();
+ public uint get_print_line_numbers ();
+ public double get_right_margin (Gtk.Unit unit);
+ public uint get_tab_width ();
+ public double get_top_margin (Gtk.Unit unit);
+ public Gtk.WrapMode get_wrap_mode ();
+ [Version (since = "5.2")]
+ public void ignore_tag (Gtk.TextTag tag);
+ public bool paginate (Gtk.PrintContext context);
+ public void set_body_font_name (string font_name);
+ public void set_bottom_margin (double margin, Gtk.Unit unit);
+ public void set_footer_font_name (string? font_name);
+ public void set_footer_format (bool separator, string? left, string? center, string? right);
+ public void set_header_font_name (string? font_name);
+ public void set_header_format (bool separator, string? left, string? center, string? right);
+ public void set_highlight_syntax (bool highlight);
+ public void set_left_margin (double margin, Gtk.Unit unit);
+ public void set_line_numbers_font_name (string? font_name);
+ public void set_print_footer (bool print);
+ public void set_print_header (bool print);
+ public void set_print_line_numbers (uint interval);
+ public void set_right_margin (double margin, Gtk.Unit unit);
+ public void set_tab_width (uint width);
+ public void set_top_margin (double margin, Gtk.Unit unit);
+ public void set_wrap_mode (Gtk.WrapMode wrap_mode);
+ public string body_font_name { owned get; set; }
+ public GtkSource.Buffer buffer { get; construct; }
+ public string footer_font_name { owned get; set; }
+ public string header_font_name { owned get; set; }
+ public bool highlight_syntax { get; set; }
+ public string line_numbers_font_name { owned get; set; }
+ public int n_pages { get; }
+ public bool print_footer { get; set; }
+ public bool print_header { get; set; }
+ public uint print_line_numbers { get; set; }
+ public uint tab_width { get; set; }
+ public Gtk.WrapMode wrap_mode { get; set; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_region_get_type ()")]
+ public class Region : GLib.Object {
+ [CCode (has_construct_function = false)]
+ public Region (Gtk.TextBuffer buffer);
+ public void add_region (GtkSource.Region? region_to_add);
+ public void add_subregion (Gtk.TextIter _start, Gtk.TextIter _end);
+ public bool get_bounds (out Gtk.TextIter start, out Gtk.TextIter end);
+ public unowned Gtk.TextBuffer? get_buffer ();
+ public GtkSource.RegionIter get_start_region_iter ();
+ public GtkSource.Region? intersect_region (GtkSource.Region? region2);
+ public GtkSource.Region? intersect_subregion (Gtk.TextIter _start, Gtk.TextIter _end);
+ public bool is_empty ();
+ public void subtract_region (GtkSource.Region? region_to_subtract);
+ public void subtract_subregion (Gtk.TextIter _start, Gtk.TextIter _end);
+ public string? to_string ();
+ public Gtk.TextBuffer buffer { get; construct; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_search_context_get_type ()")]
+ public class SearchContext : GLib.Object {
+ [CCode (has_construct_function = false)]
+ public SearchContext (GtkSource.Buffer buffer, GtkSource.SearchSettings? settings);
+ public bool backward (Gtk.TextIter iter, out Gtk.TextIter match_start, out Gtk.TextIter match_end, out bool has_wrapped_around);
+ public async bool backward_async (Gtk.TextIter iter, GLib.Cancellable? cancellable, out Gtk.TextIter match_start, out Gtk.TextIter match_end, out bool has_wrapped_around) throws GLib.Error;
+ public bool forward (Gtk.TextIter iter, out Gtk.TextIter match_start, out Gtk.TextIter match_end, out bool has_wrapped_around);
+ public async bool forward_async (Gtk.TextIter iter, GLib.Cancellable? cancellable, out Gtk.TextIter match_start, out Gtk.TextIter match_end, out bool has_wrapped_around) throws GLib.Error;
+ public unowned GtkSource.Buffer get_buffer ();
+ public bool get_highlight ();
+ public unowned GtkSource.Style get_match_style ();
+ public int get_occurrence_position (Gtk.TextIter match_start, Gtk.TextIter match_end);
+ public int get_occurrences_count ();
+ public GLib.Error? get_regex_error ();
+ public unowned GtkSource.SearchSettings get_settings ();
+ public bool replace (Gtk.TextIter match_start, Gtk.TextIter match_end, string replace, int replace_length) throws GLib.Error;
+ public uint replace_all (string replace, int replace_length) throws GLib.Error;
+ public void set_highlight (bool highlight);
+ public void set_match_style (GtkSource.Style? match_style);
+ public GtkSource.Buffer buffer { get; construct; }
+ public bool highlight { get; set construct; }
+ public GtkSource.Style match_style { get; set construct; }
+ public int occurrences_count { get; }
+ public GLib.Error regex_error { owned get; }
+ public GtkSource.SearchSettings settings { get; construct; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_search_settings_get_type ()")]
+ public class SearchSettings : GLib.Object {
+ [CCode (has_construct_function = false)]
+ public SearchSettings ();
+ public bool get_at_word_boundaries ();
+ public bool get_case_sensitive ();
+ public bool get_regex_enabled ();
+ public unowned string? get_search_text ();
+ public bool get_wrap_around ();
+ public void set_at_word_boundaries (bool at_word_boundaries);
+ public void set_case_sensitive (bool case_sensitive);
+ public void set_regex_enabled (bool regex_enabled);
+ public void set_search_text (string? search_text);
+ public void set_wrap_around (bool wrap_around);
+ public bool at_word_boundaries { get; set construct; }
+ public bool case_sensitive { get; set construct; }
+ public bool regex_enabled { get; set construct; }
+ public string search_text { get; set construct; }
+ public bool wrap_around { get; set construct; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_snippet_get_type ()")]
+ public class Snippet : GLib.Object {
+ [CCode (has_construct_function = false)]
+ public Snippet (string? trigger, string? language_id);
+ public void add_chunk (GtkSource.SnippetChunk chunk);
+ public GtkSource.Snippet copy ();
+ public unowned GtkSource.SnippetContext? get_context ();
+ public unowned string get_description ();
+ public int get_focus_position ();
+ public unowned string get_language_id ();
+ public uint get_n_chunks ();
+ public unowned string get_name ();
+ public unowned GtkSource.SnippetChunk get_nth_chunk (uint nth);
+ public unowned string? get_trigger ();
+ [CCode (has_construct_function = false)]
+ [Version (since = "5.6")]
+ public Snippet.parsed (string text) throws GLib.Error;
+ public void set_description (string description);
+ public void set_language_id (string language_id);
+ public void set_name (string name);
+ public void set_trigger (string trigger);
+ [NoAccessorMethod]
+ public Gtk.TextBuffer buffer { owned get; }
+ public string description { get; set; }
+ public int focus_position { get; }
+ public string language_id { get; set; }
+ public string name { get; set; }
+ public string trigger { get; set; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_snippet_chunk_get_type ()")]
+ public class SnippetChunk : GLib.InitiallyUnowned {
+ [CCode (has_construct_function = false)]
+ public SnippetChunk ();
+ public GtkSource.SnippetChunk copy ();
+ public unowned GtkSource.SnippetContext get_context ();
+ public int get_focus_position ();
+ public unowned string? get_spec ();
+ public unowned string get_text ();
+ public bool get_text_set ();
+ public unowned string get_tooltip_text ();
+ public void set_context (GtkSource.SnippetContext context);
+ public void set_focus_position (int focus_position);
+ public void set_spec (string spec);
+ public void set_text (string text);
+ public void set_text_set (bool text_set);
+ public void set_tooltip_text (string tooltip_text);
+ public GtkSource.SnippetContext context { get; set; }
+ public int focus_position { get; set; }
+ public string spec { get; set; }
+ public string text { get; set; }
+ public bool text_set { get; set; }
+ public string tooltip_text { get; set; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_snippet_context_get_type ()")]
+ public class SnippetContext : GLib.Object {
+ [CCode (has_construct_function = false)]
+ public SnippetContext ();
+ public void clear_variables ();
+ public string expand (string input);
+ public unowned string? get_variable (string key);
+ public void set_constant (string key, string value);
+ public void set_line_prefix (string line_prefix);
+ public void set_tab_width (int tab_width);
+ public void set_use_spaces (bool use_spaces);
+ public void set_variable (string key, string value);
+ public signal void changed ();
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_snippet_manager_get_type ()")]
+ public class SnippetManager : GLib.Object {
+ [CCode (has_construct_function = false)]
+ protected SnippetManager ();
+ public static unowned GtkSource.SnippetManager get_default ();
+ [CCode (array_length = false, array_null_terminated = true)]
+ public unowned string[] get_search_path ();
+ public GtkSource.Snippet? get_snippet (string? group, string? language_id, string trigger);
+ [Version (since = "5.6")]
+ public unowned GLib.ListModel list_all ();
+ [CCode (array_length = false, array_null_terminated = true)]
+ public (unowned string)[] list_groups ();
+ public GLib.ListModel list_matching (string? group, string? language_id, string? trigger_prefix);
+ public void set_search_path ([CCode (array_length = false, array_null_terminated = true)] string[]? dirs);
+ [CCode (array_length = false, array_null_terminated = true)]
+ public string[] search_path { get; set; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_space_drawer_get_type ()")]
+ public class SpaceDrawer : GLib.Object {
+ [CCode (has_construct_function = false)]
+ public SpaceDrawer ();
+ public void bind_matrix_setting (GLib.Settings settings, string key, GLib.SettingsBindFlags flags);
+ public bool get_enable_matrix ();
+ public GLib.Variant get_matrix ();
+ public GtkSource.SpaceTypeFlags get_types_for_locations (GtkSource.SpaceLocationFlags locations);
+ public void set_enable_matrix (bool enable_matrix);
+ public void set_matrix (GLib.Variant? matrix);
+ public void set_types_for_locations (GtkSource.SpaceLocationFlags locations, GtkSource.SpaceTypeFlags types);
+ public bool enable_matrix { get; set construct; }
+ public GLib.Variant matrix { owned get; set construct; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_style_get_type ()")]
+ public class Style : GLib.Object {
+ [CCode (has_construct_function = false)]
+ protected Style ();
+ public void apply (Gtk.TextTag tag);
+ public GtkSource.Style copy ();
+ [NoAccessorMethod]
+ public string background { owned get; construct; }
+ [NoAccessorMethod]
+ public bool background_set { get; construct; }
+ [NoAccessorMethod]
+ public bool bold { get; construct; }
+ [NoAccessorMethod]
+ public bool bold_set { get; construct; }
+ [NoAccessorMethod]
+ public string foreground { owned get; construct; }
+ [NoAccessorMethod]
+ public bool foreground_set { get; construct; }
+ [NoAccessorMethod]
+ public bool italic { get; construct; }
+ [NoAccessorMethod]
+ public bool italic_set { get; construct; }
+ [NoAccessorMethod]
+ public string line_background { owned get; construct; }
+ [NoAccessorMethod]
+ public bool line_background_set { get; construct; }
+ [NoAccessorMethod]
+ public Pango.Underline pango_underline { get; construct; }
+ [NoAccessorMethod]
+ public string scale { owned get; construct; }
+ [NoAccessorMethod]
+ public bool scale_set { get; construct; }
+ [NoAccessorMethod]
+ public bool strikethrough { get; construct; }
+ [NoAccessorMethod]
+ public bool strikethrough_set { get; construct; }
+ [NoAccessorMethod]
+ public string underline_color { owned get; construct; }
+ [NoAccessorMethod]
+ public bool underline_color_set { get; construct; }
+ [NoAccessorMethod]
+ public bool underline_set { get; construct; }
+ [NoAccessorMethod]
+ public Pango.Weight weight { get; construct; }
+ [NoAccessorMethod]
+ public bool weight_set { get; construct; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_style_scheme_get_type ()")]
+ public class StyleScheme : GLib.Object {
+ [CCode (has_construct_function = false)]
+ protected StyleScheme ();
+ [CCode (array_length = false, array_null_terminated = true)]
+ public unowned string[]? get_authors ();
+ public unowned string? get_description ();
+ public unowned string? get_filename ();
+ public unowned string get_id ();
+ [Version (since = "5.4")]
+ public unowned string? get_metadata (string name);
+ public unowned string get_name ();
+ public unowned GtkSource.Style? get_style (string style_id);
+ public string description { get; }
+ public string filename { get; }
+ public string id { get; construct; }
+ public string name { get; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_style_scheme_chooser_button_get_type ()")]
+ public class StyleSchemeChooserButton : Gtk.Button, Gtk.Accessible, Gtk.Actionable, Gtk.Buildable, Gtk.ConstraintTarget, GtkSource.StyleSchemeChooser {
+ [CCode (has_construct_function = false, type = "GtkWidget*")]
+ public StyleSchemeChooserButton ();
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_style_scheme_chooser_widget_get_type ()")]
+ public class StyleSchemeChooserWidget : Gtk.Widget, Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, GtkSource.StyleSchemeChooser {
+ [CCode (has_construct_function = false, type = "GtkWidget*")]
+ public StyleSchemeChooserWidget ();
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_style_scheme_manager_get_type ()")]
+ public class StyleSchemeManager : GLib.Object {
+ [CCode (has_construct_function = false)]
+ public StyleSchemeManager ();
+ public void append_search_path (string path);
+ public void force_rescan ();
+ public static unowned GtkSource.StyleSchemeManager get_default ();
+ public unowned GtkSource.StyleScheme? get_scheme (string scheme_id);
+ [CCode (array_length = false, array_null_terminated = true)]
+ public unowned string[]? get_scheme_ids ();
+ [CCode (array_length = false, array_null_terminated = true)]
+ public unowned string[] get_search_path ();
+ public void prepend_search_path (string path);
+ public void set_search_path ([CCode (array_length = false, array_null_terminated = true)] string[]? path);
+ [CCode (array_length = false, array_null_terminated = true)]
+ public string[] scheme_ids { get; }
+ [CCode (array_length = false, array_null_terminated = true)]
+ public string[] search_path { get; set; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_style_scheme_preview_get_type ()")]
+ [Version (since = "5.4")]
+ public class StyleSchemePreview : Gtk.Widget, Gtk.Accessible, Gtk.Actionable, Gtk.Buildable, Gtk.ConstraintTarget {
+ [CCode (has_construct_function = false, type = "GtkWidget*")]
+ public StyleSchemePreview (GtkSource.StyleScheme scheme);
+ public unowned GtkSource.StyleScheme get_scheme ();
+ public bool get_selected ();
+ public void set_selected (bool selected);
+ public GtkSource.StyleScheme scheme { get; construct; }
+ public bool selected { get; set; }
+ public signal void activate ();
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_tag_get_type ()")]
+ public class Tag : Gtk.TextTag {
+ [CCode (has_construct_function = false, type = "GtkTextTag*")]
+ public Tag (string? name);
+ [NoAccessorMethod]
+ public bool draw_spaces { get; set; }
+ [NoAccessorMethod]
+ public bool draw_spaces_set { get; set; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_view_get_type ()")]
+ public class View : Gtk.TextView, Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Scrollable {
+ [CCode (has_construct_function = false, type = "GtkWidget*")]
+ public View ();
+ public bool get_auto_indent ();
+ public GtkSource.BackgroundPatternType get_background_pattern ();
+ public unowned GtkSource.Completion get_completion ();
+ public bool get_enable_snippets ();
+ public unowned GtkSource.Gutter get_gutter (Gtk.TextWindowType window_type);
+ public bool get_highlight_current_line ();
+ public unowned GtkSource.Hover get_hover ();
+ public bool get_indent_on_tab ();
+ public int get_indent_width ();
+ public unowned GtkSource.Indenter? get_indenter ();
+ public bool get_insert_spaces_instead_of_tabs ();
+ public unowned GtkSource.MarkAttributes get_mark_attributes (string category, int priority);
+ public uint get_right_margin_position ();
+ public bool get_show_line_marks ();
+ public bool get_show_line_numbers ();
+ public bool get_show_right_margin ();
+ public bool get_smart_backspace ();
+ public GtkSource.SmartHomeEndType get_smart_home_end ();
+ public unowned GtkSource.SpaceDrawer get_space_drawer ();
+ public uint get_tab_width ();
+ public uint get_visual_column (Gtk.TextIter iter);
+ public void indent_lines (Gtk.TextIter start, Gtk.TextIter end);
+ public void set_auto_indent (bool enable);
+ public void set_background_pattern (GtkSource.BackgroundPatternType background_pattern);
+ public void set_enable_snippets (bool enable_snippets);
+ public void set_highlight_current_line (bool highlight);
+ public void set_indent_on_tab (bool enable);
+ public void set_indent_width (int width);
+ public void set_indenter (GtkSource.Indenter? indenter);
+ public void set_insert_spaces_instead_of_tabs (bool enable);
+ public void set_mark_attributes (string category, GtkSource.MarkAttributes attributes, int priority);
+ public void set_right_margin_position (uint pos);
+ public void set_show_line_marks (bool show);
+ public void set_show_line_numbers (bool show);
+ public void set_show_right_margin (bool show);
+ public void set_smart_backspace (bool smart_backspace);
+ public void set_smart_home_end (GtkSource.SmartHomeEndType smart_home_end);
+ public void set_tab_width (uint width);
+ public void unindent_lines (Gtk.TextIter start, Gtk.TextIter end);
+ [CCode (has_construct_function = false, type = "GtkWidget*")]
+ public View.with_buffer (GtkSource.Buffer buffer);
+ public bool auto_indent { get; set; }
+ public GtkSource.BackgroundPatternType background_pattern { get; set; }
+ public GtkSource.Completion completion { get; }
+ public bool enable_snippets { get; set; }
+ public bool highlight_current_line { get; set; }
+ public bool indent_on_tab { get; set; }
+ public int indent_width { get; set; }
+ public GtkSource.Indenter indenter { get; set; }
+ public bool insert_spaces_instead_of_tabs { get; set; }
+ public uint right_margin_position { get; set; }
+ public bool show_line_marks { get; set; }
+ public bool show_line_numbers { get; set; }
+ public bool show_right_margin { get; set; }
+ public bool smart_backspace { get; set; }
+ public GtkSource.SmartHomeEndType smart_home_end { get; set; }
+ public GtkSource.SpaceDrawer space_drawer { get; }
+ public uint tab_width { get; set; }
+ public signal void change_case (GtkSource.ChangeCaseType case_type);
+ public signal void change_number (int count);
+ public signal void join_lines ();
+ public virtual signal void line_mark_activated (Gtk.TextIter iter, uint button, Gdk.ModifierType state, int n_presses);
+ public virtual signal void move_lines (bool down);
+ public signal void move_to_matching_bracket (bool extend_selection);
+ public virtual signal void move_words (int step);
+ [HasEmitter]
+ public virtual signal void push_snippet (GtkSource.Snippet snippet, ref Gtk.TextIter location);
+ public virtual signal void show_completion ();
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_vim_im_context_get_type ()")]
+ [Version (since = "5.4")]
+ public class VimIMContext : Gtk.IMContext {
+ [CCode (has_construct_function = false, type = "GtkIMContext*")]
+ public VimIMContext ();
+ public unowned string get_command_bar_text ();
+ public unowned string get_command_text ();
+ public string command_bar_text { get; }
+ public string command_text { get; }
+ public signal void edit (GtkSource.View view, string? path);
+ [HasEmitter]
+ public signal bool execute_command (string command);
+ public signal void format_text (Gtk.TextIter begin, Gtk.TextIter end);
+ public signal void write (GtkSource.View view, string? path);
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_cname = "GtkSourceCompletionProposalInterface", type_id = "gtk_source_completion_proposal_get_type ()")]
+ public interface CompletionProposal : GLib.Object {
+ [Version (since = "5.6")]
+ public virtual string? get_typed_text ();
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_cname = "GtkSourceCompletionProviderInterface", type_id = "gtk_source_completion_provider_get_type ()")]
+ public interface CompletionProvider : GLib.Object {
+ public abstract void activate (GtkSource.CompletionContext context, GtkSource.CompletionProposal proposal);
+ public abstract void display (GtkSource.CompletionContext context, GtkSource.CompletionProposal proposal, GtkSource.CompletionCell cell);
+ public virtual int get_priority (GtkSource.CompletionContext context);
+ public virtual string? get_title ();
+ public virtual bool is_trigger (Gtk.TextIter iter, unichar ch);
+ public virtual bool key_activates (GtkSource.CompletionContext context, GtkSource.CompletionProposal proposal, uint keyval, Gdk.ModifierType state);
+ public virtual GLib.GenericArray<GtkSource.CompletionProposal>? list_alternates (GtkSource.CompletionContext context, GtkSource.CompletionProposal proposal);
+ public abstract async GLib.ListModel populate_async (GtkSource.CompletionContext context, GLib.Cancellable? cancellable) throws GLib.Error;
+ public abstract void refilter (GtkSource.CompletionContext context, GLib.ListModel model);
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_cname = "GtkSourceHoverProviderInterface", type_id = "gtk_source_hover_provider_get_type ()")]
+ public interface HoverProvider : GLib.Object {
+ [NoWrapper]
+ public abstract bool populate (GtkSource.HoverContext context, GtkSource.HoverDisplay display) throws GLib.Error;
+ public abstract async bool populate_async (GtkSource.HoverContext context, GtkSource.HoverDisplay display, GLib.Cancellable? cancellable) throws GLib.Error;
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_cname = "GtkSourceIndenterInterface", type_id = "gtk_source_indenter_get_type ()")]
+ public interface Indenter : GLib.Object {
+ public abstract void indent (GtkSource.View view, ref Gtk.TextIter iter);
+ public abstract bool is_trigger (GtkSource.View view, Gtk.TextIter location, Gdk.ModifierType state, uint keyval);
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", type_cname = "GtkSourceStyleSchemeChooserInterface", type_id = "gtk_source_style_scheme_chooser_get_type ()")]
+ public interface StyleSchemeChooser : GLib.Object {
+ public abstract unowned GtkSource.StyleScheme get_style_scheme ();
+ public abstract void set_style_scheme (GtkSource.StyleScheme scheme);
+ public abstract GtkSource.StyleScheme style_scheme { get; set; }
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", has_type_id = false)]
+ public struct RegionIter {
+ public bool get_subregion (out Gtk.TextIter start, out Gtk.TextIter end);
+ public bool is_end ();
+ public bool next ();
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_BACKGROUND_PATTERN_TYPE_", type_id = "gtk_source_background_pattern_type_get_type ()")]
+ public enum BackgroundPatternType {
+ NONE,
+ GRID
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_BRACKET_MATCH_", type_id = "gtk_source_bracket_match_type_get_type ()")]
+ public enum BracketMatchType {
+ NONE,
+ OUT_OF_RANGE,
+ NOT_FOUND,
+ FOUND
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_CHANGE_CASE_", type_id = "gtk_source_change_case_type_get_type ()")]
+ public enum ChangeCaseType {
+ LOWER,
+ UPPER,
+ TOGGLE,
+ TITLE
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_COMPLETION_ACTIVATION_", type_id = "gtk_source_completion_activation_get_type ()")]
+ public enum CompletionActivation {
+ NONE,
+ INTERACTIVE,
+ USER_REQUESTED
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_COMPLETION_COLUMN_", type_id = "gtk_source_completion_column_get_type ()")]
+ public enum CompletionColumn {
+ ICON,
+ BEFORE,
+ TYPED_TEXT,
+ AFTER,
+ COMMENT,
+ DETAILS
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_COMPRESSION_TYPE_", type_id = "gtk_source_compression_type_get_type ()")]
+ public enum CompressionType {
+ NONE,
+ GZIP
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_FILE_SAVER_FLAGS_", type_id = "gtk_source_file_saver_flags_get_type ()")]
+ [Flags]
+ public enum FileSaverFlags {
+ NONE,
+ IGNORE_INVALID_CHARS,
+ IGNORE_MODIFICATION_TIME,
+ CREATE_BACKUP
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_", type_id = "gtk_source_gutter_renderer_alignment_mode_get_type ()")]
+ public enum GutterRendererAlignmentMode {
+ CELL,
+ FIRST,
+ LAST
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_NEWLINE_TYPE_", type_id = "gtk_source_newline_type_get_type ()")]
+ public enum NewlineType {
+ LF,
+ CR,
+ CR_LF
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_SMART_HOME_END_", type_id = "gtk_source_smart_home_end_type_get_type ()")]
+ public enum SmartHomeEndType {
+ DISABLED,
+ BEFORE,
+ AFTER,
+ ALWAYS
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_SORT_FLAGS_", type_id = "gtk_source_sort_flags_get_type ()")]
+ [Flags]
+ public enum SortFlags {
+ NONE,
+ CASE_SENSITIVE,
+ REVERSE_ORDER,
+ REMOVE_DUPLICATES
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_SPACE_LOCATION_", type_id = "gtk_source_space_location_flags_get_type ()")]
+ [Flags]
+ public enum SpaceLocationFlags {
+ NONE,
+ LEADING,
+ INSIDE_TEXT,
+ TRAILING,
+ ALL
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_SPACE_TYPE_", type_id = "gtk_source_space_type_flags_get_type ()")]
+ [Flags]
+ public enum SpaceTypeFlags {
+ NONE,
+ SPACE,
+ TAB,
+ NEWLINE,
+ NBSP,
+ ALL
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_VIEW_GUTTER_POSITION_", type_id = "gtk_source_view_gutter_position_get_type ()")]
+ public enum ViewGutterPosition {
+ LINES,
+ MARKS
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_FILE_LOADER_ERROR_", type_id = "gtk_source_file_loader_error_get_type ()")]
+ public errordomain FileLoaderError {
+ TOO_BIG,
+ ENCODING_AUTO_DETECTION_FAILED,
+ CONVERSION_FALLBACK;
+ public static GLib.Quark quark ();
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_FILE_SAVER_ERROR_", type_id = "gtk_source_file_saver_error_get_type ()")]
+ public errordomain FileSaverError {
+ INVALID_CHARS,
+ EXTERNALLY_MODIFIED;
+ public static GLib.Quark quark ();
+ }
+ [CCode (cheader_filename = "gtksourceview/gtksource.h", instance_pos = 1.9)]
+ [Version (since = "5.2")]
+ public delegate bool SchedulerCallback (int64 deadline);
+ [CCode (cheader_filename = "gtksourceview/gtksource.h")]
+ [Version (replacement = "Encoding.get_all")]
+ public static GLib.SList<weak GtkSource.Encoding> encoding_get_all ();
+ [CCode (cheader_filename = "gtksourceview/gtksource.h")]
+ [Version (replacement = "Encoding.get_current")]
+ public static unowned GtkSource.Encoding encoding_get_current ();
+ [CCode (cheader_filename = "gtksourceview/gtksource.h")]
+ [Version (replacement = "Encoding.get_default_candidates")]
+ public static GLib.SList<weak GtkSource.Encoding> encoding_get_default_candidates ();
+ [CCode (cheader_filename = "gtksourceview/gtksource.h")]
+ [Version (replacement = "Encoding.get_from_charset")]
+ public static unowned GtkSource.Encoding? encoding_get_from_charset (string charset);
+ [CCode (cheader_filename = "gtksourceview/gtksource.h")]
+ [Version (replacement = "Encoding.get_utf8")]
+ public static unowned GtkSource.Encoding encoding_get_utf8 ();
+ [CCode (cheader_filename = "gtksourceview/gtksource.h")]
+ [Version (replacement = "FileLoaderError.quark")]
+ public static GLib.Quark file_loader_error_quark ();
+ [CCode (cheader_filename = "gtksourceview/gtksource.h")]
+ [Version (replacement = "FileSaverError.quark")]
+ public static GLib.Quark file_saver_error_quark ();
+ [CCode (cheader_filename = "gtksourceview/gtksource.h")]
+ public static void finalize ();
+ [CCode (cheader_filename = "gtksourceview/gtksource.h")]
+ public static void init ();
+ [CCode (cheader_filename = "gtksourceview/gtksource.h")]
+ [Version (since = "5.2")]
+ public static size_t scheduler_add ([CCode (scope = "async")] GtkSource.SchedulerCallback callback);
+ [CCode (cheader_filename = "gtksourceview/gtksource.h")]
+ [Version (since = "5.2")]
+ public static size_t scheduler_add_full (owned GtkSource.SchedulerCallback callback);
+ [CCode (cheader_filename = "gtksourceview/gtksource.h")]
+ [Version (since = "5.2")]
+ public static void scheduler_remove (size_t handler_id);
+ [CCode (cheader_filename = "gtksourceview/gtksource.h")]
+ public static string utils_escape_search_text (string text);
+ [CCode (cheader_filename = "gtksourceview/gtksource.h")]
+ public static string utils_unescape_search_text (string text);
+}
* http://live.gnome.org/Seed for more information.
*/
-[CCode (lower_case_cprefix = "js_", cheader_filename = "JavaScriptCore/JavaScript.h")]
+[CCode (lower_case_cprefix = "js_", cheader_filename = "jsc/jsc.h")]
namespace JSCore {
[Compact]
[CCode (cname = "void", free_function = "JSContextGroupRelease")]