Builder3/Window.js
[app.Builder.js] / Builder3 / Window.js
index 1490f35..fa13a8d 100644 (file)
@@ -7,7 +7,7 @@ GObject = imports.gi.GObject;
 GtkSource = imports.gi.GtkSource;
 WebKit = imports.gi.WebKit;
 Vte = imports.gi.Vte;
-GtkClutter = imports.gi.GtkClutter;
+//GtkClutter = imports.gi.GtkClutter;
 console = imports.console;
 XObject = imports.XObject.XObject;
 Window=new XObject({
@@ -482,8 +482,8 @@ Window=new XObject({
                                                                                    return true;
                                                                                 }
                                                                                
-                                                                                if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button.button != 3) {
-                                                                                    print("click" + ev.type);
+                                                                                if (ev.button.button != 3) {
+                                                                                    print("click" + ev.button.button);
                                                                                     return false;
                                                                                 }
                                                                               
@@ -522,7 +522,12 @@ Window=new XObject({
                                                                                 // returns a cairo surface
                                                                                 var pix = this.el.create_row_drag_icon ( path);
                                                                                 
-                                                                                Gtk.drag_set_icon_surface (ctx, pix);
+                                                                                if (Gtk.drag_set_icon_surface) {
+                                                                                   Gtk.drag_set_icon_surface( ctx,   pix  );
+                                                                                } else {
+                                                                                    Gtk.drag_set_icon_pixmap (ctx,
+                                                                                        pix.get_colormap(),   pix,   null, -10, -10);
+                                                                                }
                                                                                 
                                                                                 return true;
                                                                         },
@@ -635,11 +640,11 @@ Window=new XObject({
                                                                                 return  true;
                                                                         },
                                                                         drag_data_received : function (self, ctx, x, y, sel_data, info, time) {
-                                                                                print("Tree: drag-data-received");
+                                                                                 print("Tree: drag-data-received");
                                                                         
                                                                                       var   delete_selection_data = false;
                                                                                        var  dnd_success = false;
-                                                                                       print(JSON.stringify(sel_data, null,4));
+                                                                                       //print(JSON.stringify(sel_data, null,4));
                                                                                         /* Deal with what we are given from source */
                                                                                         
                                                                                         // simce I can not be bothered to sort out
@@ -1460,13 +1465,13 @@ Window=new XObject({
                                                                             listeners : {
                                                                                 activate : function (self) {
                                                                                 
-                                                                                     var tree = this.get('/LeftTree');
-                                                                                      var model = this.get('/LeftTree.model');
-                                                                                     var el = tree.getActivePath();
-                                                                                     print(el);
-                                                                                     var js = model.toJS(el, false);
+                                                                                    var tree = this.get('/LeftTree');
+                                                                                    var model = this.get('/LeftTree.model');
+                                                                                    var el = tree.getActivePath();
+                                                                                    print(el);
+                                                                                    var js = model.toJS(el, false);
                                                                                     // print(JSON.stringify(js[0], null,4));
-                                                                                     this.get('/DialogSaveTemplate').show(JSON.stringify(js[0], null,4));
+                                                                                    this.get('/DialogSaveTemplate').show(JSON.stringify(js[0], null,4));
                                                                                      
                                                                                     
                                                                                 }
@@ -1997,7 +2002,7 @@ Window=new XObject({
                                                                     }
                                                                     
                                                                      // right click.
-                                                                     if (ev.type == Gdk.EventType.BUTTON_PRESS  && ev.button.button == 3) {    
+                                                                     if (ev.button.button == 3) {    
                                                                         // show popup!.   
                                                                         if (res.column.title == 'value' && this.get('/LeftPanel').editing) {
                                                                             return false;
@@ -2990,9 +2995,9 @@ Window=new XObject({
                                                                                                 this.el.execute_script("Builder.overPos(" + x +','+ y + ");");
                                                                                                 
                                                                                                 // A) find out from drag all the places that node could be dropped.
-                                                                                                var src = Gtk.drag_get_source_widge(ctx);
+                                                                                                var src = Gtk.drag_get_source_widget(ctx);
                                                                                                 if (!src.dropList) {
-                                                                                                    ctx.drag_status(0, time);
+                                                                                                    Gdk.drag_status(ctx,0, time);
                                                                                                     return true;
                                                                                                 }
                                                                                                 // b) get what we are over.. (from activeNode)
@@ -4022,13 +4027,17 @@ Window=new XObject({
                                                                        var  iret = {};
                                                                         var s = this.selection;
                                                                         s.get_selected(iret);
-                                                                        var path = this.get('/RightPalete.model').el.get_path(iter.iter);
+                                                                        var path = this.get('/RightPalete.model').el.get_path(iret.iter);
                                                                         
                                                                         var pix = this.el.create_row_drag_icon ( path);
                                                                             
-                                                                                
-                                                                        Gtk.drag_set_icon_surface ( ctx,   pix  );
-                                                                        
+                                                                        print(pix);       
+                                                                        if (Gtk.drag_set_icon_surface) {
+                                                                                Gtk.drag_set_icon_surface( ctx,   pix  );
+                                                                        } else {
+                                                                            Gtk.drag_set_icon_pixmap (ctx,
+                                                                                pix.get_colormap(),   pix,   null, -10, -10);
+                                                                        }
                                                                         
                                                                         var value = ''+ this.get('/RightPalete.model').el.get_value(iret.iter, 0).value.get_string();
                                                                         if (!this.get('/RightPalete').provider) {