Skip to content

Commit

Permalink
volume-maximize bug in opening movie fixed
Browse files Browse the repository at this point in the history
- related system-volume bugs fixed, too.

floating-playlist option added to details
- playlist can be shown as sheet or floating widnow.
- pressing shift-key works opposite to option setting.

subtitle re-showing bug after window is resized fixed
- added checking subtitle-visibility for animated-window-resizing

window-resize-mode added: title-left, title-right, bottom-left.

black-screens now works for full-screen-navigation.
- black-screens reimplemented with ScreenFader.

remember last selected tab of advanced pane




git-svn-id: http://movist.googlecode.com/svn/trunk@209 9988c26d-9134-0410-b5bb-5778289bb252
  • Loading branch information
cocoable committed Jun 11, 2008
1 parent 48a8ce4 commit 8799050
Show file tree
Hide file tree
Showing 31 changed files with 250 additions and 160 deletions.
1 change: 1 addition & 0 deletions AppController.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
NSTimer* _updateSystemActivityTimer;
BOOL _audioDeviceSupportsDigital;
float _systemVolume;
BOOL _checkForAltVolumeChange;

// movie & subtitle
IBOutlet NSMenu* _movieMenu;
Expand Down
3 changes: 2 additions & 1 deletion AppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ - (void)awakeFromNib
cell = [_fsVolumeSlider cell];
[cell setImageName:@"FSVolume" backColor:HUDBackgroundColor trackOffset:0.0 knobOffset:2.0];

_checkForAltVolumeChange = TRUE;
_systemVolume = -1;
[self updateVolumeUI];

Expand Down Expand Up @@ -206,7 +207,7 @@ - (void)applicationWillFinishLaunching:(NSNotification*)aNotification
// initial update preferences: advanced - details : general
[_movieView setActivateOnDragging:[_defaults boolForKey:MActivateOnDraggingKey]];
[_mainWindow setResizeMode:[_defaults integerForKey:MWindowResizeKey]];
[_movieView setDraggingAction:[_defaults integerForKey:MDraggingActionKey]];
[_movieView setViewDragAction:[_defaults integerForKey:MViewDragActionKey]];

// initial update preferences: advanced - details : video
[_movieView setCaptureFormat:[_defaults integerForKey:MCaptureFormatKey]];
Expand Down
29 changes: 19 additions & 10 deletions AppController_Audio.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ - (float)systemVolume
if (noErr == AudioDeviceGetProperty(device, 0, 0,
kAudioDevicePropertyVolumeScalar,
&size, &volume)) { //kAudioDevicePropertyVolumeScalarToDecibels
return volume;
return normalizedFloat2(adjustToRange(volume, MIN_SYSTEM_VOLUME, MAX_SYSTEM_VOLUME));
}

// otherwise, try seperate channels
Expand All @@ -76,7 +76,8 @@ - (float)systemVolume
TRACE(@"error getting volume of channel %d", channels[1]);
return -1;
}
return (volumes[0] + volumes[1]) / 2.00;
volume = (volumes[0] + volumes[1]) / 2.00;
return normalizedFloat2(adjustToRange(volume, MIN_SYSTEM_VOLUME, MAX_SYSTEM_VOLUME));
}

- (void)setSystemVolume:(float)volume
Expand Down Expand Up @@ -129,11 +130,13 @@ - (void)setSystemVolume:(float)volume
}
}

- (int)isUpdateSystemVolume
- (BOOL)isUpdateSystemVolume
{
BOOL updateSystemVolume = [_defaults boolForKey:MUpdateSystemVolumeKey];
return ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) ?
!updateSystemVolume : updateSystemVolume;
if (_checkForAltVolumeChange &&
([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask)) {
return ![_defaults boolForKey:MUpdateSystemVolumeKey];
}
return [_defaults boolForKey:MUpdateSystemVolumeKey];
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -187,7 +190,7 @@ - (void)setVolume:(float)volume
_systemVolume = normalizedFloat2(adjustToRange(volume, MIN_SYSTEM_VOLUME, MAX_SYSTEM_VOLUME));
[self setSystemVolume:_systemVolume];
[_movieView setMessage:[NSString stringWithFormat:
NSLocalizedString(@"System Volume %.2f", nil), volume]];
NSLocalizedString(@"System Volume %.2f", nil), _systemVolume]];
}
else { // movie volume
volume = normalizedFloat1(adjustToRange(volume, MIN_VOLUME, MAX_VOLUME));
Expand Down Expand Up @@ -228,8 +231,6 @@ - (void)updateVolumeUI
if (_systemVolume < 0) {
return;
}
_systemVolume = normalizedFloat2(
adjustToRange(_systemVolume, MIN_SYSTEM_VOLUME, MAX_SYSTEM_VOLUME));
}
// adjust for using same slider min/max range
volume = normalizedFloat2(MIN_VOLUME +
Expand Down Expand Up @@ -483,14 +484,22 @@ - (IBAction)volumeAction:(id)sender
[self volumeUp];
}
else { // volume slider
[self setVolume:[sender floatValue]];
float volume = [sender floatValue];
if ([self isUpdateSystemVolume]) {
volume = (volume - MIN_VOLUME) *
(MAX_SYSTEM_VOLUME - MIN_SYSTEM_VOLUME) /
(MAX_VOLUME - MIN_VOLUME);
}
[self setVolume:volume];
}
}

- (IBAction)muteAction:(id)sender
{
//TRACE(@"%s", __PRETTY_FUNCTION__);
_checkForAltVolumeChange = FALSE;
[self setMuted:([_muteMenuItem state] == NSOffState)];
_checkForAltVolumeChange = TRUE;
}

- (IBAction)audioTrackAction:(id)sender
Expand Down
4 changes: 4 additions & 0 deletions AppController_Open.m
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ - (BOOL)openMovie:(NSURL*)movieURL movieClass:(Class)movieClass
[nc addObserver:self selector:@selector(playlistUpdated:)
name:MPlaylistUpdatedNotification object:_playlist];

// don't check for alt-volume-change while opening movie
_checkForAltVolumeChange = FALSE;

// update movie
[self updateDigitalAudioOut:self];
// -[autoenableAudioTracks] should be sent after -[updateDigitalAudioOut:]
Expand Down Expand Up @@ -310,6 +313,7 @@ - (BOOL)openMovie:(NSURL*)movieURL movieClass:(Class)movieClass
}

[self updateUIForOpenedMovieAndSubtitle];
_checkForAltVolumeChange = TRUE;

[_movie setRate:_playRate]; // auto play

Expand Down
6 changes: 5 additions & 1 deletion AppController_Playlist.m
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ - (void)showPlaylistWindow
initWithAppController:self playlist:_playlist];
}
if (![self playlistWindowVisible]) {
if ([self isFullScreen]) {
BOOL floating = [_defaults boolForKey:MFloatingPlaylistKey];
if (([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask)) {
floating = !floating;
}
if ([self isFullScreen] || floating) {
[_playlistController showWindow:self];
[[_playlistController window] setDelegate:self];
[[_playlistController window] makeKeyWindow];
Expand Down
30 changes: 20 additions & 10 deletions AppController_Video.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,24 @@ - (void)resizeWithMagnification:(float)magnification
size.width *= magnification;
size.height *= magnification;
}
int align = ALIGN_WINDOW_TITLE_CENTER;
int resize = [_defaults integerForKey:MOpeningResizeKey];
int align =
(resize == OPENING_RESIZE_BOTTOM_CENTER) ? ALIGN_WINDOW_BOTTOM_CENTER :
(resize == OPENING_RESIZE_BOTTOM_RIGHT) ? ALIGN_WINDOW_BOTTOM_RIGHT :
ALIGN_WINDOW_TITLE_CENTER;
switch (resize) {
case OPENING_RESIZE_TITLE_CENTER : align = ALIGN_WINDOW_TITLE_CENTER; break;
case OPENING_RESIZE_TITLE_LEFT : align = ALIGN_WINDOW_TITLE_LEFT; break;
case OPENING_RESIZE_TITLE_RIGHT : align = ALIGN_WINDOW_TITLE_RIGHT; break;
case OPENING_RESIZE_BOTTOM_CENTER : align = ALIGN_WINDOW_BOTTOM_CENTER; break;
case OPENING_RESIZE_BOTTOM_LEFT : align = ALIGN_WINDOW_BOTTOM_LEFT; break;
case OPENING_RESIZE_BOTTOM_RIGHT : align = ALIGN_WINDOW_BOTTOM_RIGHT; break;
}
NSRect frame = [_mainWindow frameRectForMovieSize:size align:align];
if ([[_mainWindow screen] visibleFrame].size.height < frame.size.height) {
frame = [_mainWindow frameRectForScreen];
}
BOOL subtitleVisible = [_movieView subtitleVisible];
[_movieView setSubtitleVisible:FALSE];
[_mainWindow setFrame:frame display:TRUE animate:TRUE];
[_movieView setSubtitleVisible:TRUE];
[_movieView setSubtitleVisible:subtitleVisible];
}
}

Expand All @@ -76,9 +82,11 @@ - (void)resizeToScreen
//TRACE(@"%s", __PRETTY_FUNCTION__);
if (![self isFullScreen]) {
NSRect frame = [_mainWindow frameRectForScreen];

BOOL subtitleVisible = [_movieView subtitleVisible];
[_movieView setSubtitleVisible:FALSE];
[_mainWindow setFrame:frame display:TRUE animate:TRUE];
[_movieView setSubtitleVisible:TRUE];
[_movieView setSubtitleVisible:subtitleVisible];
}
}

Expand Down Expand Up @@ -110,7 +118,7 @@ - (void)beginFullScreen
}
}

BOOL blackout = [_defaults boolForKey:MBlackoutSecondaryScreenKey];
BOOL blackScreens = [_defaults boolForKey:MFullScreenBlackScreensKey];
int effect = [_defaults integerForKey:MFullScreenEffectKey];
#if defined(AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER)
if ([_mainWindow userSpaceScaleFactor] != 1.0 &&
Expand All @@ -119,8 +127,8 @@ - (void)beginFullScreen
}
#endif
_fullScreener = [FullScreener alloc];
[_fullScreener initWithMainWindow:_mainWindow playPanel:_playPanel];
[_fullScreener setBlackoutSecondaryScreens:blackout];
[_fullScreener initWithMainWindow:_mainWindow playPanel:_playPanel
blackScreens:blackScreens];
[_fullScreener setEffect:effect];
[_fullScreener setMovieURL:[self movieURL]];
[_fullScreener beginFullScreen];
Expand Down Expand Up @@ -155,8 +163,10 @@ - (void)beginFullNavigation
}
else {
// enter from window-mode with no-movie
BOOL blackScreens = [_defaults boolForKey:MFullScreenBlackScreensKey];
_fullScreener = [FullScreener alloc];
[_fullScreener initWithMainWindow:_mainWindow playPanel:_playPanel];
[_fullScreener initWithMainWindow:_mainWindow playPanel:_playPanel
blackScreens:blackScreens];
[_fullScreener setMovieURL:nil];
[_fullScreener beginFullScreen];
}
Expand Down
4 changes: 4 additions & 0 deletions English.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@
"Activate on Dragging over Main Window" = "Activate on Dragging over Main Window";
"Window Resize on Opening Movie" = "Window Resize on Opening Movie";
"Title Center" = "Title Center";
"Title Left" = "Title Left";
"Title Right" = "Title Right";
"Bottom Center" = "Bottom Center";
"Bottom Left" = "Bottom Left";
"Bottom Right" = "Bottom Right";
"Window Resize" = "Window Resize";
"Free" = "Free";
Expand All @@ -137,6 +140,7 @@
"Dragging Action on Movie Area" = "Dragging Action on Movie Area";
"Move Window" = "Move Window";
"Capture Movie" = "Capture Movie";
"Floating Playlist" = "Floating Playlist";

/* Preferences: advanced - details: video */
"Capture Format" = "Capture Format";
Expand Down
4 changes: 4 additions & 0 deletions English.lproj/Preferences.nib/classes.nib

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion English.lproj/Preferences.nib/info.nib

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified English.lproj/Preferences.nib/keyedobjects.nib
Binary file not shown.
9 changes: 5 additions & 4 deletions FullScreener.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,16 @@
NSRect _maxMainRect;
NSRect _fullMovieRect;

// for black-out effect
NSMutableArray* _blackoutWindows;
// for black-screens effect
NSMutableArray* _screenFaders;
}

- (id)initWithMainWindow:(MainWindow*)mainWindow playPanel:(PlayPanel*)playPanel;
- (id)initWithMainWindow:(MainWindow*)mainWindow
playPanel:(PlayPanel*)playPanel
blackScreens:(BOOL)blackScreens;

- (FullWindow*)fullWindow;
- (void)setEffect:(int)effect;
- (void)setBlackoutSecondaryScreens:(BOOL)blackout;
- (void)setMovieURL:(NSURL*)movieURL;

- (void)beginFullScreen;
Expand Down
Loading

0 comments on commit 8799050

Please sign in to comment.