[vlc-devel] commit: macosx: added an entry to Video-> Aspect-ratio to disable our AR-lock for one session. ( Felix Paul Kühne )
git version control
git at videolan.org
Fri May 22 22:35:20 CEST 2009
vlc | branch: 0.9-bugfix | Felix Paul Kühne <fkuehne at videolan.org> | Fri May 22 22:35:17 2009 +0200| [bb95be1f9d972beb5876ad673338c4c7d8202bcd] | committer: Felix Paul Kühne
macosx: added an entry to Video->Aspect-ratio to disable our AR-lock for one session.
Manual backport from [2d63b67e97034199cbf8979bf714d3c8536af240]
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bb95be1f9d972beb5876ad673338c4c7d8202bcd
---
modules/gui/macosx/controls.h | 7 +++++--
modules/gui/macosx/controls.m | 30 +++++++++++++++++++++++++++++-
modules/gui/macosx/embeddedwindow.m | 15 +++++++++------
3 files changed, 43 insertions(+), 9 deletions(-)
diff --git a/modules/gui/macosx/controls.h b/modules/gui/macosx/controls.h
index e077716..9e07c9f 100644
--- a/modules/gui/macosx/controls.h
+++ b/modules/gui/macosx/controls.h
@@ -1,13 +1,13 @@
/*****************************************************************************
* controls.h: MacOS X interface module
*****************************************************************************
- * Copyright (C) 2002-2007 the VideoLAN team
+ * Copyright (C) 2002-2009 the VideoLAN team
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl at nanocrew.net>
* Christophe Massiot <massiot at via.ecp.fr>
* Derk-Jan Hartman <thedj at users.sourceforge.net>
- * Felix Kühne <fkuehne at videolan org>
+ * Felix Paul Kühne <fkuehne at videolan org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -53,6 +53,7 @@
IBOutlet id o_specificTime_mi;
VLCFSPanel *o_fs_panel;
+ BOOL b_lockAspectRatio;
}
- (void)controlTintChanged;
@@ -78,6 +79,8 @@
- (IBAction)backward:(id)sender;
- (id)getVoutView;
+- (BOOL)aspectRatioIsLocked;
+- (IBAction)lockVideosAspectRatio:(id)sender;
- (IBAction)volumeUp:(id)sender;
- (IBAction)volumeDown:(id)sender;
diff --git a/modules/gui/macosx/controls.m b/modules/gui/macosx/controls.m
index 197585d..809394a 100644
--- a/modules/gui/macosx/controls.m
+++ b/modules/gui/macosx/controls.m
@@ -8,7 +8,7 @@
* Christophe Massiot <massiot at via.ecp.fr>
* Derk-Jan Hartman <hartman at videolan dot org>
* Benjamin Pracht <bigben at videolan doit org>
- * Felix Kühne <fkuehne at videolan dot org>
+ * Felix Paul Kühne <fkuehne at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -49,6 +49,7 @@
{
[super init];
o_fs_panel = [[VLCFSPanel alloc] init];
+ b_lockAspectRatio = YES;
return self;
}
@@ -160,6 +161,21 @@
return o_vout_view;
}
+- (BOOL)aspectRatioIsLocked
+{
+ return b_lockAspectRatio;
+}
+
+- (IBAction)lockVideosAspectRatio:(id)sender
+{
+ if( [sender state] == NSOffState )
+ [sender setState: NSOnState];
+ else
+ [sender setState: NSOffState];
+
+ b_lockAspectRatio = !b_lockAspectRatio;
+}
+
- (IBAction)stop:(id)sender
{
intf_thread_t * p_intf = VLCIntf;
@@ -693,6 +709,18 @@
/* make (un)sensitive */
[o_parent setEnabled: ( val_list.p_list->i_count > 1 )];
+ /* Special case for the Aspect Ratio menu */
+ if( [[o_parent title] isEqualToString: _NS("Aspect-ratio")] == YES )
+ {
+ NSMenuItem *o_lmi_tmp2;
+ o_lmi_tmp2 = [o_menu addItemWithTitle: _NS("Lock Aspect Ratio") action: @selector(lockVideosAspectRatio:) keyEquivalent: @""];
+ [o_lmi_tmp2 setTarget: self];
+ [o_lmi_tmp2 setEnabled: YES];
+ [o_lmi_tmp2 setState: b_lockAspectRatio];
+ [o_parent setEnabled: YES];
+ [o_menu addItem: [NSMenuItem separatorItem]];
+ }
+
for( i = 0; i < val_list.p_list->i_count; i++ )
{
vlc_value_t another_val;
diff --git a/modules/gui/macosx/embeddedwindow.m b/modules/gui/macosx/embeddedwindow.m
index 4a5cc69..43bb90e 100644
--- a/modules/gui/macosx/embeddedwindow.m
+++ b/modules/gui/macosx/embeddedwindow.m
@@ -1,7 +1,7 @@
/*****************************************************************************
* embeddedwindow.m: MacOS X interface module
*****************************************************************************
- * Copyright (C) 2005-2008 the VideoLAN team
+ * Copyright (C) 2005-2009 the VideoLAN team
* $Id$
*
* Authors: Benjamin Pracht <bigben at videolan dot org>
@@ -182,11 +182,14 @@
if( videoRatio.height == 0. || videoRatio.width == 0. )
return proposedFrameSize;
- NSRect viewRect = [o_view convertRect:[o_view bounds] toView: nil];
- NSRect contentRect = [self contentRectForFrameRect:[self frame]];
- float marginy = viewRect.origin.y + [self frame].size.height - contentRect.size.height;
- float marginx = contentRect.size.width - viewRect.size.width;
- proposedFrameSize.height = (proposedFrameSize.width - marginx) * videoRatio.height / videoRatio.width + marginy;
+ if( [[[VLCMain sharedInstance] getControls] aspectRatioIsLocked] )
+ {
+ NSRect viewRect = [o_view convertRect:[o_view bounds] toView: nil];
+ NSRect contentRect = [self contentRectForFrameRect:[self frame]];
+ float marginy = viewRect.origin.y + [self frame].size.height - contentRect.size.height;
+ float marginx = contentRect.size.width - viewRect.size.width;
+ proposedFrameSize.height = (proposedFrameSize.width - marginx) * videoRatio.height / videoRatio.width + marginy;
+ }
return proposedFrameSize;
}
More information about the vlc-devel
mailing list