Fix comments.
[ardour.git] / gtk2_ardour / au_pluginui.mm
index 977e5762a7363c75c8ed1ae347b2444350574627..cb58f67f6fb616bb2dc379f0324c43440deeda45 100644 (file)
@@ -1,6 +1,9 @@
-#include <pbd/error.h>
-#include <ardour/audio_unit.h>
-#include <ardour/insert.h>
+#undef  Marker
+#define Marker FuckYouAppleAndYourLackOfNameSpaces
+
+#include "pbd/error.h"
+#include "ardour/audio_unit.h"
+#include "ardour/insert.h"
 
 #undef check // stupid gtk, stupid apple
 
 #import <AudioUnit/AUCocoaUIView.h>
 #import <CoreAudioKit/AUGenericView.h>
 
+#undef Marker
+
+#include "keyboard.h"
+#include "utils.h"
+#include "public_editor.h"
 #include "i18n.h"
 
 using namespace ARDOUR;
@@ -57,15 +65,27 @@ AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert)
 
        /* stuff some stuff into the top of the window */
 
+       HBox* smaller_hbox = manage (new HBox);
+
+       smaller_hbox->pack_start (preset_label, false, false, 10);
+       smaller_hbox->pack_start (preset_combo, false, false);
+       smaller_hbox->pack_start (save_button, false, false);
+       smaller_hbox->pack_start (automation_mode_label, false, false);
+       smaller_hbox->pack_start (automation_mode_selector, false, false);
+       smaller_hbox->pack_start (bypass_button, false, true);
+
+       VBox* v1_box = manage (new VBox);
+       VBox* v2_box = manage (new VBox);
+
+       v1_box->pack_start (*smaller_hbox, false, true);
+       v2_box->pack_start (focus_button, false, true);
+
+       top_box.set_homogeneous (false);
        top_box.set_spacing (6);
        top_box.set_border_width (6);
 
-       top_box.pack_end (bypass_button, false, true);
-       top_box.pack_end (automation_mode_selector, false, false);
-       top_box.pack_end (automation_mode_label, false, false);
-       top_box.pack_end (save_button, false, false);
-       top_box.pack_end (preset_combo, false, false);
-       top_box.pack_end (preset_label, false, false);
+       top_box.pack_end (*v2_box, false, false);
+       top_box.pack_end (*v1_box, false, false);
 
        set_spacing (6);
        pack_start (top_box, false, false);
@@ -109,8 +129,12 @@ AUPluginUI::~AUPluginUI ()
                DisposeWindow (carbon_window);
        }
 
-       if (packView && packView != au_view) {
-               [packView release];
+       if (packView) {
+               /* remove whatever we packed into low_box so that GTK doesn't
+                  mess with it.
+               */
+
+               [packView removeFromSuperview];
        }
 }
 
@@ -264,46 +288,11 @@ AUPluginUI::create_cocoa_view ()
                [(AUGenericView *)au_view setShowsExpertParameters:YES];
        }
 
-       NSRect packFrame;
-
+       packView = au_view;
+       
        // Get the size of the new AU View's frame 
+       NSRect packFrame;
        packFrame = [au_view frame];
-
-       packFrame.origin.x = 0;
-       packFrame.origin.y = 0;
-
-       if (packFrame.size.width > 500 || packFrame.size.height > 500) {
-               
-               /* its too big - use a scrollview */
-
-               NSRect frameRect = [[cocoa_window contentView] frame];
-               scroll_view = [[[NSScrollView alloc] initWithFrame:frameRect] autorelease];
-               [scroll_view setDrawsBackground:NO];
-               [scroll_view setHasHorizontalScroller:YES];
-               [scroll_view setHasVerticalScroller:YES];
-
-               packFrame.size = [NSScrollView  frameSizeForContentSize:packFrame.size
-                                   hasHorizontalScroller:[scroll_view hasHorizontalScroller]
-                                   hasVerticalScroller:[scroll_view hasVerticalScroller]
-                                   borderType:[scroll_view borderType]];
-               
-               // Create a new frame with same origin as current
-               // frame but size equal to the size of the new view
-               NSRect newFrame;
-               newFrame.origin = [scroll_view frame].origin;
-               newFrame.size = packFrame.size;
-               
-               // Set the new frame and document views on the scroll view
-               [scroll_view setFrame:newFrame];
-               [scroll_view setDocumentView:au_view];
-               
-               packView = scroll_view;
-
-       } else {
-
-               packView = au_view;
-       }
-
        prefwidth = packFrame.size.width;
        prefheight = packFrame.size.height;
 
@@ -617,14 +606,16 @@ create_au_gui (boost::shared_ptr<PluginInsert> plugin_insert, VBox** box)
 bool
 AUPluginUI::on_focus_in_event (GdkEventFocus* ev)
 {
-       cerr << "au plugin focus in\n";
+       //cerr << "au plugin focus in\n";
+       //Keyboard::magic_widget_grab_focus ();
        return false;
 }
 
 bool
 AUPluginUI::on_focus_out_event (GdkEventFocus* ev)
 {
-       cerr << "au plugin focus out\n";
+       //cerr << "au plugin focus out\n";
+       //Keyboard::magic_widget_drop_focus ();
        return false;
 }