update Chinese translation ardour/gtk2_ardour/po/zh.po base on Ardour build 4.7-372...
[ardour.git] / gtk2_ardour / au_pluginui.mm
index dbfbe115261ff9ea26110c38fb90f6ba4f327683..af174f9963383fd56afe3e652956d9be30387380 100644 (file)
@@ -240,11 +240,13 @@ AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert)
 
        low_box.signal_realize().connect (mem_fun (this, &AUPluginUI::lower_box_realized));
        low_box.signal_visibility_notify_event ().connect (mem_fun (this, &AUPluginUI::lower_box_visibility_notify));
-       low_box.signal_size_request ().connect (mem_fun (this, &AUPluginUI::lower_box_size_request));
-       low_box.signal_size_allocate ().connect (mem_fun (this, &AUPluginUI::lower_box_size_allocate));
-       low_box.signal_map ().connect (mem_fun (this, &AUPluginUI::lower_box_map));
-       low_box.signal_unmap ().connect (mem_fun (this, &AUPluginUI::lower_box_unmap));
-       //low_box.signal_expose_event ().connect (mem_fun (this, &AUPluginUI::lower_box_expose));
+       if (au_view) {
+               low_box.signal_size_request ().connect (mem_fun (this, &AUPluginUI::lower_box_size_request));
+               low_box.signal_size_allocate ().connect (mem_fun (this, &AUPluginUI::lower_box_size_allocate));
+               low_box.signal_map ().connect (mem_fun (this, &AUPluginUI::lower_box_map));
+               low_box.signal_unmap ().connect (mem_fun (this, &AUPluginUI::lower_box_unmap));
+               low_box.signal_expose_event ().connect (mem_fun (this, &AUPluginUI::lower_box_expose));
+       }
 }
 
 AUPluginUI::~AUPluginUI ()
@@ -539,8 +541,8 @@ AUPluginUI::create_carbon_view ()
        req_width = (int) (size.x + 0.5);
        req_height = (int) (size.y + 0.5);
 
-       SizeWindow (carbon_window, prefwidth, req_height,  true);
-       low_box.set_size_request (prefwidth, req_height); // ??
+       SizeWindow (carbon_window, req_width, req_height,  true);
+       low_box.set_size_request (req_width, req_height);
 
        return 0;
 #else
@@ -596,13 +598,6 @@ AUPluginUI::parent_carbon_window ()
                return -1;
        }
 
-       Gtk::Container* toplevel = get_toplevel();
-
-       if (!toplevel || !toplevel->is_toplevel()) {
-               error << _("AUPluginUI: no top level window!") << endmsg;
-               return -1;
-       }
-
        /* figure out where the cocoa parent window is in carbon-coordinate space, which
           differs from both cocoa-coordinate space and GTK-coordinate space
        */
@@ -813,10 +808,17 @@ AUPluginUI::lower_box_size_allocate (Gtk::Allocation& allocation)
 gboolean
 AUPluginUI::lower_box_expose (GdkEventExpose* event)
 {
+#if 0 // AU view magically redraws by itself
        [au_view drawRect:NSMakeRect(event->area.x,
                        event->area.y,
                        event->area.width,
                        event->area.height)];
+#endif
+       /* hack to keep ardour responsive
+        * some UIs (e.g Addictive Drums) completely hog the CPU
+        */
+       ARDOUR::GUIIdle();
+
        return true;
 }