public Xcls_LeftTreeMenu LeftTreeMenu;
// my vars (def)
- public signal bool before_node_change (JsRender.Node? node);
+ public signal bool before_node_change ();
public signal void changed ();
- public signal void node_selected (JsRender.Node? node);
+ public signal void node_selected (JsRender.Node? node, string source);
public Xcls_MainWindow main_window;
// ctor
public int drag_x;
public string[] dropList;
public int drag_y;
+ public string lastEventSource;
public bool drag_in_motion;
public bool blockChanges;
this.el = new Gtk.TreeView();
// my vars (dec)
+ this.lastEventSource = "";
this.blockChanges = false;
// set gobject values
+ this.el.expand = true;
this.el.tooltip_column = 1;
this.el.enable_tree_lines = true;
this.el.headers_visible = false;
//listeners
this.el.button_press_event.connect( ( ev) => {
//console.log("button press?");
- if (! _this.before_node_change(null) ) {
+ this.lastEventSource = "tree";
+ if (! _this.before_node_change() ) {
+
return true;
}
+
if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) {
if (this.blockChanges) { // probably not needed..
return ;
}
- if (!_this.before_node_change(null) ) {
+ if (!_this.before_node_change( ) ) {
this.blockChanges = true;
this.el.get_selection().unselect_all();
this.blockChanges = false;
// -- it appears that the selection is not updated.
-
+
GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
print("selected rows < 1\n");
//??this.model.load( false);
- _this.node_selected(null);
+ _this.node_selected(null, this.lastEventSource);
return false ;
}
_this.model.activePath = mod.get_path(iter).to_string();
var node = (JsRender.Node)value.dup_object();
- _this.node_selected(node);
+ _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);
// dropList --- need to gather this ...
print("get dropList for : %s\n",dropNodeType);
- var dropList = _this.model.file.palete().getDropList(dropNodeType);
+ var dropList = _this.main_window.windowstate.file.palete().getDropList(dropNodeType);
print("dropList: %s\n", string.joinv(" , ", dropList));
}
}
- public void selectNode (string treepath_str) {
+ 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 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);
if (f.tree == null) {
- f.loadItems( );
+ try {
+ f.loadItems( );
+ } catch (Error e) {
+ return;
+ }
}
// if it's still null?
if (f.tree == null) {
var data = (JsRender.Node)(value.get_object());
print("removing node from Render\n");
if (data.parent == null) {
- this.file.tree = null;
+ _this.main_window.windowstate.file.tree = null;
} else {
data.remove();
}
var new_node = ts.show(
_this.main_window, // (Gtk.Window) _this.el.get_toplevel (),
- this.file.palete(),
+ _this.main_window.windowstate.file.palete(),
node,
- this.file.project);
+ _this.main_window.windowstate.project);
if (new_node == null) {
return; // do not add?
if ( parent_str.length < 1) {
this.el.append(out n_iter, null); // drop at top level..
node.parent = null;
- this.file.tree = node;
+ _this.main_window.windowstate.file.tree = node;
} else if (pos < 2) {
// work out what kind of packing to use.. -- should be in
if (!node.has("pack") && parent_str.length > 1) {
- this.file.palete().fillPack(node,parentNode);
+ _this.main_window.windowstate.file.palete().fillPack(node,parentNode);
}
DialogSaveTemplate.singleton().show(
(Gtk.Window) _this.el.get_toplevel (),
- _this.model.file.palete(),
+ _this.main_window.windowstate.file.palete(),
_this.getActiveElement()
);
var node = _this.getActiveElement();
var name = DialogSaveModule.singleton().show(
(Gtk.Window) _this.el.get_toplevel (),
- _this.model.file.project,
+ _this.main_window.windowstate.project,
node
);
if (name.length < 1) {
_this.model.el.remove(ref citer);
}
_this.changed();
- _this.node_selected(node);
+ _this.node_selected(node, "tree");
});