summaryrefslogtreecommitdiff
path: root/gtk2_ardour/au_pluginui.mm
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-04-11 14:06:50 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-04-11 14:06:50 +0000
commitcb413146428ce5db5e281d70f2b3b7df27c1aaab (patch)
tree4961e9dcb107f2ca1f0a4298faf5135ba8611d92 /gtk2_ardour/au_pluginui.mm
parent9aa8af5a28abbb86c9ae86c6991838eb6828d0a9 (diff)
merge 3.0 from 2.0-ongoing@3243
git-svn-id: svn://localhost/ardour2/branches/3.0@3248 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/au_pluginui.mm')
-rw-r--r--gtk2_ardour/au_pluginui.mm95
1 files changed, 48 insertions, 47 deletions
diff --git a/gtk2_ardour/au_pluginui.mm b/gtk2_ardour/au_pluginui.mm
index 3f71f126f5..ab14d4aafd 100644
--- a/gtk2_ardour/au_pluginui.mm
+++ b/gtk2_ardour/au_pluginui.mm
@@ -83,6 +83,7 @@ AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert)
cocoa_parent = 0;
cocoa_window = 0;
au_view = 0;
+ packView = 0;
/* prefer cocoa, fall back to cocoa, but use carbon if its there */
@@ -108,6 +109,9 @@ AUPluginUI::~AUPluginUI ()
DisposeWindow (carbon_window);
}
+ if (packView && packView != au_view) {
+ [packView release];
+ }
}
bool
@@ -260,6 +264,49 @@ AUPluginUI::create_cocoa_view ()
[(AUGenericView *)au_view setShowsExpertParameters:YES];
}
+ NSRect packFrame;
+
+ // Get the size of the new AU View's frame
+ 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;
+
return 0;
}
@@ -353,7 +400,7 @@ AUPluginUI::activate ()
void
AUPluginUI::deactivate ()
{
- return;
+ return;
cerr << "APP DEactivated, for " << insert->name() << endl;
_activating_from_app = true;
ActivateWindow (carbon_window, FALSE);
@@ -465,7 +512,6 @@ int
AUPluginUI::parent_cocoa_window ()
{
NSWindow* win = get_nswindow ();
- NSView* packView = 0;
NSRect packFrame;
if (!win) {
@@ -481,40 +527,6 @@ AUPluginUI::parent_cocoa_window ()
// Get the size of the new AU View's frame
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;
- }
NSView* view = gdk_quartz_window_get_nsview (low_box.get_window()->gobj());
@@ -559,17 +571,6 @@ AUPluginUI::on_hide ()
bool
AUPluginUI::on_map_event (GdkEventAny* ev)
{
- cerr << "AU plugin map event\n";
-
- if (carbon_window) {
-
- // move top level GTK window to the correct level
- // to keep the stack together and not be sliceable
-
- NSWindow* win = get_nswindow ();
- // [win setLevel:NSFloatingWindowLevel];
- }
-
return false;
}