Fix #7368 - auto show menu items
authorAlan <alan@roojs.com>
Wed, 31 Aug 2022 08:37:41 +0000 (16:37 +0800)
committerAlan <alan@roojs.com>
Wed, 31 Aug 2022 08:37:41 +0000 (16:37 +0800)
src/Builder4/MainWindow.vala
src/Builder4/WindowLeftTree.bjs
src/Builder4/WindowLeftTree.vala
src/Builder4/WindowRooView.bjs
src/Builder4/WindowRooView.vala
src/Builder4/WindowState.vala
src/JsRender/NodeToVala.vala
src/Palete/Gtk.vala

index 922d90b..1a9a8c7 100644 (file)
@@ -340,6 +340,7 @@ public class Xcls_MainWindow : Object
 
             // set gobject values
             this.el.label = "New Window";
+            this.el.show_all();
 
             //listeners
             this.el.activate.connect( ( ) => {
@@ -368,6 +369,7 @@ public class Xcls_MainWindow : Object
             // my vars (dec)
 
             // set gobject values
+            this.el.show_all();
         }
 
         // user defined functions
@@ -932,6 +934,7 @@ public class Xcls_MainWindow : Object
 
             // set gobject values
             this.el.label = "Download updated Resources";
+            this.el.show_all();
 
             //listeners
             this.el.activate.connect( ( ) => {
@@ -960,6 +963,7 @@ public class Xcls_MainWindow : Object
 
             // set gobject values
             this.el.label = "About the Builder";
+            this.el.show_all();
 
             //listeners
             this.el.activate.connect( () => {
@@ -1116,6 +1120,7 @@ public class Xcls_MainWindow : Object
 
             // set gobject values
             this.el.label = "Compile Status:";
+            this.el.show_all();
         }
 
         // user defined functions
@@ -1147,6 +1152,7 @@ public class Xcls_MainWindow : Object
             var child_0 = new Xcls_Image35( _this );
             child_0.ref();
             this.el.set_image (  child_0.el  );
+            this.el.show_all();
 
             //listeners
             this.el.button_press_event.connect( () => {
@@ -1219,6 +1225,7 @@ public class Xcls_MainWindow : Object
             var child_0 = new Xcls_Image37( _this );
             child_0.ref();
             this.el.set_image (  child_0.el  );
+            this.el.show_all();
 
             //listeners
             this.el.button_press_event.connect( () => {
@@ -1290,6 +1297,7 @@ public class Xcls_MainWindow : Object
             var child_0 = new Xcls_Image39( _this );
             child_0.ref();
             this.el.set_image (  child_0.el  );
+            this.el.show_all();
 
             //listeners
             this.el.button_press_event.connect( () => {
@@ -1360,6 +1368,7 @@ public class Xcls_MainWindow : Object
             var child_0 = new Xcls_Image41( _this );
             child_0.ref();
             this.el.set_image (  child_0.el  );
+            this.el.show_all();
 
             //listeners
             this.el.button_press_event.connect( () => {
index 7ff79cc..4769803 100644 (file)
         "cursor_changed" : [
          " ( ) => {",
          "    print(\"LEFT TREE Cursor Changed\\n\");",
-         "\tif (!this.button_is_pressed && !this.key_is_pressed) {",
+         "\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}",
+         "\t//\tprint(\"SKIPPING select - no button or key pressed\\n\");",
+         "\t//\treturn;",
+         "\t//}",
          "",
          "",
          "     if (this.blockChanges) { // probably not needed.. ",
index f7f5b34..ad39952 100644 (file)
@@ -272,12 +272,12 @@ public class Xcls_WindowLeftTree : Object
             });
             this.el.cursor_changed.connect( ( ) => {
                 print("LEFT TREE Cursor Changed\n");
-               if (!this.button_is_pressed && !this.key_is_pressed) {
+               //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;
-               }
+               //      print("SKIPPING select - no button or key pressed\n");
+               //      return;
+               //}
             
             
                  if (this.blockChanges) { // probably not needed.. 
index e02260d..e066de4 100644 (file)
             "    ",
             "    this.node_selected = sel;",
             "    ",
-            "    this.updateGreySelection(scroll);",
+            "   // this.updateGreySelection(scroll);",
             "    ",
             "    ",
             "    ",
             "            }",
             "            ltree.view.setCursor(tp, \"editor\");",
             "           // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false); ",
-            "           this.nodeSelected(node,false);",
+            "           //this.nodeSelected(node,false);",
             "            ",
             "            // scrolling is disabled... as node selection calls scroll 10ms after it changes.",
             "             ",
index 1027b68..dbbf4b9 100644 (file)
@@ -1345,7 +1345,7 @@ public class Xcls_WindowRooView : Object
                     }
                     ltree.view.setCursor(tp, "editor");
                    // ltree.view.el.set_cursor(new Gtk.TreePath.from_string(tp), null, false); 
-                   this.nodeSelected(node,false);
+                   //this.nodeSelected(node,false);
                     
                     // scrolling is disabled... as node selection calls scroll 10ms after it changes.
                      
@@ -1367,7 +1367,7 @@ public class Xcls_WindowRooView : Object
             
             this.node_selected = sel;
             
-            this.updateGreySelection(scroll);
+           // this.updateGreySelection(scroll);
             
             
             
index 16ad572..4629069 100644 (file)
@@ -127,9 +127,9 @@ public class WindowState : Object
                });
                // node selected -- only by clicking?
                this.left_tree.node_selected.connect((sel, source) => {
-                       if (source == "editor") {
-                               return;
-                       }
+                       //if (source == "editor") {
+                       //      return;
+                       //}
                        if (this.file.xtype == "Roo") { 
                                this.window_rooview.sourceview.nodeSelected(sel,true); // foce scroll.
                        } else {
index 6178db3..8e3d55b 100644 (file)
@@ -188,6 +188,8 @@ public class JsRender.NodeToVala : Object {
                this.addInitMyVars();
                this.addWrappedProperties();
                this.addChildren();
+               this.addAutoShow(); // autoshow menuitems
+               
                this.addInit();
                this.addListeners();
                this.addEndCtor();
@@ -615,6 +617,24 @@ public class JsRender.NodeToVala : Object {
                
 
                        
+       }
+       public static Gee.ArrayList<string> menuitem_children = null;
+       
+       void addAutoShow()
+       {
+               if (menuitem_children == null) {
+                       menuitem_children = new Gee.ArrayList<string>();
+                       menuitem_children.add("Gtk.MenuItem");
+                       var gir = this.file.project.palete.getClass("Gtk.MenuItem");
+                       foreach(var impl in gir.implementations) {
+                               menuitem_children.add(impl);
+                       }
+               }
+
+               if (menuitem_children.contains(this.node.fqn())) {
+                       this.addLine(this.ipad + "this.el.show();");
+               
+               }
        }
 
        void addInitMyVars()
index 202d2f0..6e968ae 100644 (file)
@@ -293,7 +293,10 @@ namespace Palete {
                                        continue;
                                }
                                this.generic_child_widgets.add(fqn);
-                               this.add_special_children(fqn, "Gtk.Menu", "_menu"); // fake propety
+                               
+                               
+                               
+                               //this.add_special_children(fqn, "Gtk.Menu", "_menu"); // fake propety
                        }
                
                }